diff --git a/md/train/-oUhJJILWHb/-oUhJJILWHb.md b/md/train/-oUhJJILWHb/-oUhJJILWHb.md new file mode 100644 index 0000000000000000000000000000000000000000..e0538ee133339bde8ce15b3e0a421910e205d8b6 --- /dev/null +++ b/md/train/-oUhJJILWHb/-oUhJJILWHb.md @@ -0,0 +1,197 @@ +# Learning Debiased Representation via Disentangled Feature Augmentation + +Jungsoo Lee\*1,2 Eungyeup $\mathbf { K i m } ^ { * 1 , 2 }$ Juyoung Lee2 Jihyeon Lee1 Jaegul Choo1 + +1KAIST AI, 2Kakao Enterprise, South Korea 1{bebeto, eykim94, gina3833, jchoo}@kaist.ac.kr, 2{bebeto.lee, josh.ey, michael.jy}@kakaoenterprise.com + +# Abstract + +Image classification models tend to make decisions based on peripheral attributes of data items that have strong correlation with a target variable (i.e., dataset bias). These biased models suffer from the poor generalization capability when evaluated on unbiased datasets. Existing approaches for debiasing often identify and emphasize those samples with no such correlation (i.e., bias-conflicting) without defining the bias type in advance. However, such bias-conflicting samples are significantly scarce in biased datasets, limiting the debiasing capability of these approaches. This paper first presents an empirical analysis revealing that training with “diverse” bias-conflicting samples beyond a given training set is crucial for debiasing as well as the generalization capability. Based on this observation, we propose a novel feature-level data augmentation technique in order to synthesize diverse bias-conflicting samples. To this end, our method learns the disentangled representation of (1) the intrinsic attributes (i.e., those inherently defining a certain class) and (2) bias attributes (i.e., peripheral attributes causing the bias), from a large number of bias-aligned samples, the bias attributes of which have strong correlation with the target variable. Using the disentangled representation, we synthesize bias-conflicting samples that contain the diverse intrinsic attributes of bias-aligned samples by swapping their latent features. By utilizing these diversified bias-conflicting features during the training, our approach achieves superior classification accuracy and debiasing results against the existing baselines on synthetic and real-world datasets. + +# 1 Introduction + +Despite the recent advancement of deep neural networks, they often rely overly on the correlation between peripheral attributes and labels, referred to as dataset bias [1], especially when such strong bias is found in a given dataset. A majority of samples in the biased dataset exhibit visual attributes that are not innate but frequently co-occur with target labels (i.e., bias attributes). For example, most of the bird images in the training dataset may contain the background as the blue sky, while the birds may still be found in different places. Thus, the model trained with such a biased dataset is likely to learn the bias attributes more than intrinsic attributes, the innate visual attributes that inherently define a certain class, e.g., the wings of birds. This causes the model to learn shortcuts for classification [2], failing to generalize on the images with no such correlations (e.g., birds on grounds or grass) during the test phase. Throughout the paper, bias-aligned samples correspond to data items containing a strong correlation between bias attributes and labels (e.g., birds in the sky), while bias-conflicting samples indicate the other cases that are rarely found (e.g., birds on grounds). + +To tackle such a task, previous studies often define a specific bias type (e.g., color and texture) in advance [3, 4, 5, 6, 7, 8, 9, 10], which enables them to design a debiasing network tailored for the predefined bias type. For example, Bahng et al. [6] leverage BagNet [11], which has limited size of receptive fields, to focus on learning color and texture. However, defining a bias type in advance 1) limits the capability of debiasing in other bias types and 2) requires expensive labor to manually identify the bias type. To handle such an issue, a recent approach [12] defines a bias based on an intuitive observation that the bias attributes are often easier to learn than the intrinsic attributes for neural networks. In this regard, they re-weight bias-conflicting samples while de-emphasizing the bias-aligned ones. However, we point out that the reason behind the limited generalization capability of existing debiasing approaches lies in the significant scarcity of bias-conflicting samples compared to the bias-aligned ones in a given training set. In other words, it is challenging to learn the debiased representation from these scarce bias-conflicting samples because the models are prone to memorize (thus being overfitted to) these samples, failing to learn the intrinsic attributes. Therefore, we claim that a neural network can learn properly debiased representation when these data items are diversified during training. + +We conduct a brief experiment to demonstrate the importance of diversity in debiasing. Diversity in our work indicates the different valid realization of intrinsic attributes in a certain class (e.g., thick, narrow, tilted, and scribbled digit shapes in MNIST [13]). Our observation is that training a model with diverse bias-conflicting samples beyond a given training set is crucial for learning debiased representation (Section 3.2). In this regard, synthesizing bias-conflicting samples is one of the straightforward approaches to increase the diversity of such samples. In fact, a large amount of bias-aligned samples in a given training set already contain diverse intrinsic attributes, which can work as informative sources for increasing the diversity. However, as bias and intrinsic attributes are highly entangled in their embedding space, it is difficult to extract the intrinsic ones from these bias-aligned samples. Therefore, disentangling these correlations enables to synthesize diversified bias-conflicting samples that originate from bias-aligned samples. + +In this paper, we propose a novel feature augmentation approach via disentangled representation for debiasing. We first train two different encoders to embed images into the disentangled representation of their intrinsic and bias attributes. With the disentangled representation, we randomly swap the latent vectors extracted from different images, most of which are bias-aligned samples in our training set. These swapped features thus contain both bias and intrinsic attributes without the correlation between them, which, in turn, can work as augmented bias-conflicting samples in our training. These features include intrinsic features of bias-aligned ones, increasing the diversity of a given training set, especially for bias-conflicting data items. Furthermore, to enhance the quality of diversified features, we propose a scheduling strategy of feature augmentation which enables to utilize the representation disentangled to a certain degree. In summary, the main contributions of our work include: + +• Through our preliminary experiment, we reveal that increasing the diversity of biasconflicting samples is crucial for debiasing. +• Based on such an observation, we propose a novel feature augmentation method via disentangled representation for diversifying the bias-conflicting samples. +• We achieve the state-of-the-art performances in two synthetic datasets (i.e., Colored MNIST and Corrupted CIFAR-10) and one real-world dataset (i.e., Biased FFHQ) against existing baselines. + +# 2 Related Work + +Debiasing predefined bias Several existing approaches mitigate the bias by pre-defining a certain bias type, either explicitly [3, 4, 5] or implicitly [6, 7, 8, 9, 10, 14]. For example, Bahng et al. [6] and Wang et al. [7] design a color- and texture-oriented network to adversarially learn a debiased model against the biased one. However, as these methods still require a specific bias type such as texture in advance, they lack the general applicability to the datasets where the bias types are demanding to recognize. + +Instead of defining certain types of bias, recent approaches [12, 15, 16] rely on the straightforward assumption that networks are prone to exploit the bias when it acts as a shortcut [2], i.e., easy to learn in the early training phase. Nam et al. [12] emphasize the bias-conflicting samples during training by using generalized cross-entropy loss [17]. Darlow et al. [15] and Huang et al. [16] presume that high gradient of latent vectors accounts for the shortcuts that model learns. In the line with the recent studies, we tackle debiasing without pre-defining a certain bias type. + +Table 1: The classification accuracy on the unbiased test sets. The diversity ratio indicates the ratio of bias-conflicting samples in the dataset pooled for each experiment. The sampling ratio refers to the ratio of bias-conflicting samples included in each mini-batch. We report the averaged accuracy over three independent trials with the standard deviation. In both datasets, we observe that the bias can be mitigated with diverse bias-conflicting samples even with a small sampling ratio. Bold and underlined values indicate the best and second best accuracy, respectively. + +
DatasetDiversity ratioSampling ratioAccuracy (%)
Colored MNIST5%50%83.77±2.03
1%50%67.19±1.99
5%1%77.97±6.00
1%1%49.91±4.22
Corrupted CIFAR-105%50%46.99±0.82
1%50%33.08±0.80
5%1%36.66±0.55
1%1%23.98±0.00
+ +Data augmentation for debiasing Geirhos et al. [10] mitigate the texture bias by utilizing additional training images with their styles being transferred by adaptive instance normalization (AdaIN) [18]. Minderer et al. [19] train an image-to-image translation network for removing shortcut cues in the self-supervised task. However, such image-level data augmentation is limited to resolving the predefined texture bias which can not be adopted to other general types of bias. + +One alternative is to exploit the latent space for data augmentation. For example, Darlow et al. [15] adversarially perturb the latent vectors corresponding to the high gradients to generate the samples against bias. Zhou et al. [20] mix the style of different source domains by AdaIN [18] to increase the domain generalization ability. Despite the effectiveness of the augmentation in the latent space, the strong unwanted correlation between bias attributes and labels prevents from obtaining the desirable intrinsic features. We resolve this issue by leveraging the disentangled representation in debiasing, which is widely used in image-to-image translation task [21, 22, 23]. To the best of our knowledge, no previous work in debiasing leverage this disentangled representation for the purpose of feature augmentation. For the rest of the paper, we elaborate how we perform the feature augmentation based on the disentangled representation. + +# 3 Importance of Diversity in Debiasing + +This section describes the details of a toy-set experiment in which we observe the importance of diversity in learning debiased representation. In Section 3.1, we first introduce the two synthetic datasets, Colored MNIST and Corrupted CIFAR-10, that we utilize for the observation. Then, we elaborate the results of the experiments in Section 3.2. + +# 3.1 Dataset + +Colored MNIST is a modified MNIST dataset [13] with the color bias. We select ten distinct colors and inject each color on the foreground of each digit to create color bias. By adjusting the number of bias-conflicting data samples in the training set, we obtain four different datasets with the ratio of bias-conflicting samples of $0 . 5 \%$ , $1 \%$ , $2 \%$ , and $5 \%$ . + +Corrupted CIFAR-10 has ten different types of texture bias applied in CIFAR-10 [24] dataset, constructed by following the design protocol of Hendrycks and Dietterich [25]. Each class is highly correlated with a certain texture (e.g., frost and brightness). Corrupted CIFAR-10 also has four different datasets with their correlation ratios as in Colored MNIST. + +# 3.2 Increasing diversity outperforms oversampling + +To confirm the significance of diversity of bias-conflicting samples in debiasing, we train four different settings: oversampling bias-conflicting samples by $50 \%$ in each mini-batch (i.e., 128 from a batch size of 256), from the pool of i) $5 \%$ dataset and ii) $1 \%$ dataset, sampling bias-conflicting samples by $1 \%$ in each mini-batch (i.e., 2 from a batch size of 256) from the pool of iii) $5 \%$ dataset and iv) $1 \%$ dataset. Oversampling provides the same amount of bias-conflicting samples as the aligned ones to the model in every training step. Bias-conflicting images sampled from the pool of $5 \%$ dataset have more diverse appearances of bias-conflicting samples compared to those from $1 \%$ dataset. + +Table 1 shows the image classification accuracy of each setting validated on the unbiased test images. Apparently, oversampling diverse bias-conflicting samples (first row) outperforms the other three methods. Similarly, sampling a small amount of bias-conflicting samples with the least diversity (fourth row) shows the lowest classification accuracy. The interesting finding is that sampling fewer but diverse conflicting samples in each mini-batch (third row) outperforms oversampling bias-conflicting samples with limited diversity (second row). These results lead to the conclusion that the diversity of bias-conflicting samples is a more crucial factor for learning debiased representation than the ratio of sampling in the training. As the diversity is limited (the latter case), the model can be easily overfitted to the given bias-conflicting samples, thus less likely to learn the generalized intrinsic attributes. With the Colored MNIST as an example, the shape of digits may vary. To be more specific, the digit shape may be thick, narrow, tilted, scribbled, and etc. If the bias-conflicting samples do not include certain visual facets (e.g., not including scribbled digit images) due to the limited number of samples, the model may imperfectly learn the intrinsic attributes of digit shapes. On the other hand, in the former case (third row), the model can learn multiple facets of intrinsic attributes when they are sampled from the diverse pool of datasets, resulting in learning intrinsic attributes even without oversampling the bias-conflicting images. + +# 4 Debiasing via disentangled feature augmentation + +Motivated by such an observation in Section 3.2, we propose a feature-level augmentation strategy for synthesizing additional bias-conflicting samples, as illustrated in Fig. 1. First, we train the two separate encoders which embed an image into disentangled latent vectors corresponding to the intrinsic and bias attributes, respectively (Section 4.1). Swapping these feature vectors among training samples enables to augment the bias-conflicting samples which no more contain a correlation between two attributes (Section 4.2). To further enhance the effectiveness, we schedule the feature augmentation after the representation is disentangled at a certain degree (Section 4.3). + +# 4.1 Learning disentangled representation + +In contrast to the bias-conflicting samples, a large amount of bias-aligned images have diverse appearances of their intrinsic attributes. By leveraging these attributes for augmentation, we can naturally obtain the diversified bias-conflicting samples containing the diverse intrinsic attributes. However, it remains challenging in that these attributes are strongly correlated with the bias attributes in the bias-aligned samples. Therefore, we propose to design two encoders with their linear classifiers to extract the disentangled latent vectors from the input images. + +As shown in Fig. 1, encoders $E _ { i }$ and $E _ { b }$ embed an image $x$ into intrinsic feature vectors $z _ { i } = E _ { i } ( x )$ and bias feature vectors $z _ { b } = E _ { b } ( x )$ , respectively. Afterward, linear classifiers $C _ { i }$ and $C _ { b }$ take the concatenated vector $z = [ z _ { i } ; z _ { b } ]$ as input to predict the target label $y$ . To train $E _ { i }$ and $C _ { i }$ as intrinsic feature extractor and $E _ { b }$ and $C _ { b }$ as bias extractor, we utilize the relative difficulty score of each data sample, proposed in the previous work of Nam et al. [12]. More specifically, we train $E _ { b }$ and $C _ { b }$ to be overfitted to the bias attributes by utilizing the generalized cross entropy (GCE) [17], while $E _ { i }$ and $C _ { i }$ are trained with the cross entropy (CE) loss. Then, the samples with high CE loss from $C _ { b }$ can be regarded as the bias-conflicting samples compared to the samples with low CE loss. In this regard, we obtain the relative difficulty score of each data sample as + +$$ +W ( z ) = \frac { C E ( C _ { b } ( z ) , y ) } { C E ( C _ { i } ( z ) , y ) + C E ( C _ { b } ( z ) , y ) } . +$$ + +As bias-conflicting samples obtain high values of $W$ , we emphasize the loss of these samples for + +training $E _ { i }$ and $C _ { i }$ , enforcing them to learn the intrinsic attributes. Therefore, the objective function for disentanglement can be written as + +$$ +L _ { \mathrm { d i s } } = W ( z ) C E ( C _ { i } ( z ) , y ) + \lambda _ { \mathrm { d i s } } G C E ( C _ { b } ( z ) , y ) . +$$ + +To ensure that $C _ { i }$ and $C _ { b }$ predicts target labels mainly based on $z _ { i }$ and $z _ { b }$ , respectively, the loss + +$C _ { i }$ is not backpropagated to $E _ { b }$ , and vice versa. + +![](images/eedd1538e5f1b3d233b423f13d2940012c778d468a152b8756c79289fdabf7bd.jpg) +Figure 1: The overview of our proposed debiasing approach. $( E _ { i } , C _ { i } )$ and $( E _ { b } , C _ { b } )$ are pairs of an encoder and a linear classifier trained to learn the disentangled representation of intrinsic attributes and bias attributes, respectively. With the disentangled features $z _ { i }$ and $z _ { b }$ , the feature augmentation is performed by swapping these latent vectors among different training samples, after certain iterations of training. $R$ refers to the re-weighting algorithm which implicitly differentiates bias-aligned samples and bias-conflicting samples. Each color indicates the different data samples. + +# Algorithm 1 Debiasing with disentangled feature augmentation + +Input: image $x$ , label $y$ , iteration $t$ , augment iteration $t _ { \mathrm { s w a p } }$ +Initialize two networks $( E _ { i } , C _ { i } )$ , $( E _ { b } , C _ { b } )$ +while not converged do Extract $z _ { i } , z _ { b }$ from $E _ { i } ( x )$ , $E _ { b } ( x )$ Concatenate $\boldsymbol { z } = [ z _ { i } ; z _ { b } ]$ Update $( E _ { i } , C _ { i } )$ , $( E _ { b } , C _ { b } )$ with $L _ { \mathrm { d i s } } = W ( z ) C E ( C _ { i } ( z ) , y ) + G C E ( C _ { b } ( z ) , y )$ if $t > t _ { \mathrm { s w a p } }$ : Randomly permute $\boldsymbol { z } = [ z _ { i } , z _ { b } ]$ into $z _ { \mathrm { s w a p } } = [ z _ { i } ; \tilde { z _ { b } } ]$ Calculate Ls $\ L _ { \mathrm { v a p } } = W ( z ) C E ( C _ { i } ( z _ { \mathrm { s w a p } } ) , \dot { y } ) + G C E ( C _ { b } ( z _ { \mathrm { s w a p } } ) , \tilde { y }$ ) Update $( E _ { i } , C _ { i } ^ { \dot { \mathbf { \alpha } } } )$ , $( E _ { b } , C _ { b } )$ with $L _ { \mathrm { t o t a l } } = L _ { \mathrm { d i s } } + \lambda _ { \mathrm { s w a p } } L _ { \mathrm { s w a p } }$ +end + +# 4.2 Feature swapping for augmentation + +While such an architecture disentangles the intrinsic features and bias features, $E _ { i }$ and $C _ { i }$ are still mainly trained with an excessively small amount of bias-conflicting samples. Therefore, $E _ { i }$ and $C _ { i }$ fail to fully acquire the intrinsic representation of a target class. To promote further improvement in learning intrinsic feature vectors, we diversify the bias-conflicting samples by swapping the disentangled latent vectors among the training sets. In other words, we randomly permute the intrinsic features and bias features in each mini-batch and obtain $z _ { \mathrm { s w a p } } ~ = ~ [ z _ { i } ; \tilde { z _ { b } } ]$ where $\tilde { z _ { b } }$ denotes the randomly permuted bias attributes of $z _ { b }$ . As the intrinsic and bias attributes in ${ z _ { \mathrm { s w a p } } }$ are obtained from two different images, they certainly have less correlation compared to $\boldsymbol { z } = [ z _ { i } ; \dot { z _ { b } } ]$ where both are from the same image. Since the biased dataset is mostly composed of bias-aligned samples, these vectors are likely from the bias-aligned samples, highly diversified compared to the bias-conflicting ones. Then, $z _ { \mathrm { s w a p } } = [ z _ { i } ; \tilde { z _ { b } } ]$ act as augmented bias-conflicting latent vectors with diversity inherited from the bias-aligned samples. Along with $L _ { \mathrm { d i s } }$ , we add the following loss function to train two neural networks with the augmented features + +$$ +L _ { \mathrm { s w a p } } = W ( z ) C E ( C _ { i } ( z _ { \mathrm { s w a p } } ) , y ) + \lambda _ { \mathrm { s w a p } _ { b } } G C E ( C _ { b } ( z _ { \mathrm { s w a p } } ) , \tilde { y } ) , +$$ + +where $\tilde { y }$ denotes target labels for permute bias attributes $\tilde { z }$ . Thus, total loss function is described as + +$$ +L _ { \mathrm { t o t a l } } = L _ { \mathrm { d i s } } + \lambda _ { \mathrm { s w a p } } L _ { \mathrm { s w a p } } +$$ + +where $\lambda _ { \mathrm { s w a p } }$ is adjusted for weighting the importance of the feature augmentation. + +# 4.3 Scheduling the feature augmentation + +While training with additional synthesized features helps to mitigate the unwanted correlation, utilizing them from the beginning of training does not improve the debiasing performance. To be more specific, in the early stage of training, the representations of $z _ { i }$ and $z _ { b }$ are imperfectly disentangled to be used as the sources of feature augmentation. Feature augmentation should be conducted after two features are disentangled at a certain degree. Without the disentangled representation, the augmented features work as noisy samples which may aggravate the debiasing performances. We verify the importance of scheduling the feature augmentation in Table 3. Our approach can be summarized with Algorithm 1. + +![](images/ba755777f4dbc4501ef0965a443c6e1994c4a532a25d0df3ee04f0f6e490293c.jpg) +Figure 2: Example images of datasets utilized in our work. In each dataset, the images above the dotted line indicate the bias-aligned samples while the ones below the dotted line are the bias-conflicting samples. For Colored MNIST and Corrupted CIFAR-10, each column indicates each class. For BFFHQ, the group of three columns indicates each class. + +# 5 Experiment + +This section demonstrates the effectiveness of feature augmentation based on disentangled representation in debiasing with both quantitative and qualitative evaluation. We compare our method with the previous approaches in debiasing with three different datasets with varied bias ratios. Then, we conduct the ablation study which demonstrates the importance of 1) learning disentangled representation, 2) feature augmentation, and 3) scheduling feature augmentation. For the qualitative evaluation, we verify how our approach disentangles the intrinsic features and bias features by visualizing them on 2D embedding space via t-SNE [26] and reconstructing images from them. + +# 5.1 Experiment details + +Baselines Our baselines consist of vanilla network, HEX [7], EnD [27], ReBias [6] and LfF [12]. Vanilla denotes the classification model trained only with the original cross-entropy (CE) loss, without any debiasing strategies. EnD explicitly leverages the bias labels (e.g., the color label in Colored MNIST) during the training phase. HEX and ReBias explicitly presume the texture of an image as a bias type, while LfF requires no prior knowledge on it. + +Datasets As shown in Fig. 2, we use two synthetic datasets (Colored MNIST and Corrputed CIFAR10) and one real-world dataset (Biased FFHQ) to evaluate the generalization of debiasing baselines over various domains. Biased FFHQ (BFFHQ) is curated from FFHQ dataset [28] which contains human face images annotated with their facial attributes. Among the facial attributes, we select age and gender as the intrinsic and bias attribute, respectively, and construct the dataset with images of high correlation between them. More specifically, most of the females are ‘young’ (i.e., age ranging from 10 to 29) and males are ‘old’ (i.e., age ranging from 40 to 59). Therefore, bias-aligned samples which compose the majority of the dataset are young women and old men. + +For each dataset, we set the degree of correlation by adjusting the number of bias-conflicting samples among the training dataset. The ratio of bias-conflicting samples are $0 . 5 \%$ , $1 \%$ , $2 \%$ and $5 \%$ for both Colored MNIST and Corrupted CIFAR-10, respectively, and $0 . 5 \%$ for BFFHQ. For the evaluation of Colored MNIST and Corrupted CIFAR-10, we construct an unbiased test set which includes images without the high correlation existing in the training set. For the BFFHQ, we construct a bias-conflicting test set which excludes the bias-aligned samples from the unbiased test set. The reason is as following. The bias-aligned images consist a half of the unbiased test set in BFFHQ which may still be correctly classified by the biased classifier. This inflates the accuracy of the unbiased test set which is not our original intention. Therefore, we intentionally use the bias-conflicting test set for the BFFHQ. + +Table 2: Image classification accuracy evaluated on unbiased test sets of Colored MNIST and Corrupted CIFAR-10, and the bias-conflicting test set of BFFHQ with varying ratio of bias-conflicting samples. We denote whether the model requires a bias type in advance by cross mark (i.e., not required), and check mark (i.e., required). Best performing results are marked in bold, while secondbest results are denoted with underlines. + +
DatasetRatio (%)Vanilla [29]HEX [7]EnD [27]ReBias [6]LfF[12]Ours
X×X
Colored MNIST0.535.19±3.4930.33±0.7634.28±1.2070.47±1.8452.50±2.4365.22±4.41
1.052.09±2.8843.73±5.5049.50±2.5187.4±0.7861.89±4.9781.73±2.34
2.065.86±3.5956.85±2.5868.45±2.1692.91±0.1571.03±2.4484.79±0.95
5.082.17±0.7474.62±3.2081.15±1.4396.96±0.0480.57±3.8489.66±1.09
Corrupted CIFAR-100.523.08±1.2513.87±0.0622.89±0.2722.27±0.4128.57±1.3029.95±0.71
1.025.82±0.3314.81±0.4225.46±0.4125.72±0.2033.07±0.7736.49±1.79
2.030.06±0.7115.20±0.5431.31±0.3531.66±0.4339.91±0.3041.78±2.29
5.039.42±0.6416.04±0.6340.26±0.8543.43±0.4150.27±1.5651.13±1.28
BFFHQ0.556.87±2.6952.83±0.9056.87±1.4259.46±0.6462.2±1.063.87±0.31
+ +Implementation details We use multi-layer perceptron (MLP) with three hidden layers for Colored MNIST, and ResNet-18 [29] for the remaining datasets. To accommodate the disentangled vectors, we double the number of hidden units in the last fully-connected layer of each network. During the inference phase, we use $C _ { i } ( z )$ for the final prediction, where $z = [ z _ { i } ; z _ { b } ]$ . For the training, we set the batch size of 256 for Colored MNIST and Corrupted CIFAR-10, respectively, and 64 for BFFHQ. Bias-conflicting augmentation is scheduled to be applied after 10K iterations for all datasets. We report the averaged accuracy of the unbiased test sets over three independent trials with the mean and the standard deviation. We include the remaining implementation details in Section D in the supplementary material. + +# 5.2 Quantitative evaluation + +Comparison on test sets Table 2 shows the comparisons of image classification accuracy evaluated on the test sets. In general, our approach demonstrates the superior performance in both synthetic and real-world datasets against the baselines with large gaps. Especially, compared to the baselines which do not define the bias types in advance (vanilla [29] and LfF [12]), our approach achieves the stateof-the-art performance across all datasets. This indicates that utilizing the diversified bias-conflicting samples through our augmentation plays a pivotal role in learning debiased representation regardless of the bias types. + +Regarding the real-world dataset, our approach also outperforms HEX [7] and ReBias [6] which utilize the tailored modules for a specific bias type (e.g., color and texture), and EnD [27] that uses the explicit bias labels. We even show superior performance compared to HEX in Colored MNIST without defining the bias type beforehand. While ReBias achieves the best accuracy in Colored MNIST, they utilize BagNet [11] in order to focus on the color bias. Even without using such an architecture, we achieve the second best performance which is comparable to ReBias. + +Ablation studies Table 3 demonstrates the importance of each module in our approach through ablation studies: 1) disentangled representation learning, 2) feature augmentation, and 3) scheduling feature augmentation. We set the ratio of bias-conflicting samples to $1 \%$ for Colored MNIST and Corrupted CIFAR10, and $0 . 5 \%$ for BFFHQ. We also compare each module with the vanilla network (first row). We observe that performing the scheduled feature augmentation shows the best classification accuracy on the test sets across all datasets. We also show that performing feature augmentation at the early stage of training does not guarantee the effectiveness of debiasing. Performing feature augmentation at the beginning of training rather aggravates the performance. That is, when the representation of intrinsic attributes and bias attributes are not disentangled at a certain degree, augmented features may act as noisy samples. Training with these additional noisy features prevents models from achieving further improvement. + +Table 3: Ablation studies on 1) disentangled representation learning, 2) feature augmentation, and 3) scheduling feature augmentation. Each row indicates the different training settings with check mark denoting the setting applied. We average the accuracy of each training over three independent trials. + +
DisentangleAugmentScheduled AugmentColored MNISTCorrupted CIFAR10BFFHQ
52.09±2.8825.82±0.3356.87±2.69
<>>74.03±2.4027.73±1.0259.4±2.46
72.29±3.8232.81±2.4761.27±3.26
?81.73±2.3452.31±1.0063.87±0.31
+ +# 5.3 Analysis + +2D Projection of Disentangled Representation Fig. 3 shows the projection of latent vectors $z _ { i }$ and $z _ { b }$ extracted from the intrinsic encoder $E _ { i }$ and bias encoder $E _ { b }$ , respectively, on a 2D space using Colored MNIST. We show projection of $z _ { i }$ and $z _ { b }$ in Fig. 3(a) and Fig. 3(b), respectively. The colors of projected dots in the first row (i) and the second row (ii) indicate the target labels and bias labels, respectively. We observe that $z _ { i }$ are clustered according to the target labels while $z _ { b }$ are clustered with the bias labels. The results represent that our method successfully learns the disentangled intrinsic and bias attributes. + +Prediction with Disentangled Representation In Table 4, we report the 1) original and 2) swapping accuracy of $C _ { i }$ and $C _ { b }$ , the linear classifiers of the intrinsic and the bias encoder, respectively. To be specific, for the original accuracy, we extract the two disentangled vectors, $z _ { i }$ and $z _ { b }$ , from the same image, concatenate them to make $z = [ z _ { i } ; z _ { b } ]$ , and forward them into each linear classifier. For the swapping accuracy, however, we first permute $z _ { b }$ and concatenate $z _ { i }$ with the permuted $z _ { b }$ (i.e., denoted as $\tilde { z _ { b } }$ in Section 4.2) to make $z _ { \mathrm { s w a p } } = [ z _ { i } ; \tilde { z _ { b } } ]$ . Then, we pass these concatenated latent vectors to each linear classifier. Afterward, we evaluate the accuracy of predicted labels of 1) $C _ { i } ( z )$ and $C _ { i } ( z _ { \mathrm { { s w a p } } } )$ with intrinsic labels and 2) $C _ { b } ( z )$ and $C _ { b } ( z _ { \mathrm { s w a p } } )$ with bias labels. The Intrinsic and Bias columns in Table 4 denote the accuracy with respect to the target labels and bias labels, respectively. Even the feature vectors of bias attributes are randomly swapped, our method maintains a reasonable classification accuracy. This indicates that our model well disentangles between $z _ { i }$ and $z _ { b }$ , and $C _ { i }$ robustly utilizes $z _ { i }$ to predict target labels even when $z _ { b }$ is taken from the different image, and vice versa. Note that we utilized the parameters of the model trained on each dataset after converging at a certain degree. + +![](images/518a65caee93a7bacd73aa33ae86be3e48d6ec3f4a7026d8b5d9f262d7aad24c.jpg) +Figure 3: Each row (i and ii) include 2D projection of $z _ { i }$ and $z _ { b }$ with the colors encoded by their labels (i.e., groundtruth labels in row i and bias labels in row ii) in Colored MNIST. We observe that $z _ { i }$ and $z _ { b }$ are well clustered according to the target and bias labels, respectively. + +
Accuracy(%)Colored MNISTCorrupted CIFAR10BFFHQ
IntrinsicBiasIntrinsicBiasIntrinsicBias
Original76.0898.0735.6374.1657.4049.00
Swapping71.4094.2935.1476.4658.4051.60
+ +Table 4: Accuracy from disentangled representation. The ratio of bias-conflicting samples in Colored MNIST, Corrupted CIFAR-10, and BFFHQ are $1 \%$ , $1 \%$ , and $0 . 5 \%$ , respectively. + +![](images/2b4e9d878f240ee01a845a45ee2022674a4d89c928c89f547b0b14a52c57dfe1.jpg) +Figure 4: Reconstructed images from disentangled representation in Colored MNIST. Each column and row indicate the samples where the bias attribute (color) and the intrinsic attribute (digit) are extracted, respectively. By swapping the bias features with a given intrinsic feature, we observe that the color changes while maintaining the digit. + +Reconstruction of Disentangled Representation Fig. 4 shows the reconstructed images of Colored MNIST by using the disentangled representation of intrinsic features and bias features. Images in the first row and column indicate the images used for extracting the bias attribute (i.e., color) and intrinsic attribute (i.e., digit), respectively. We train an auxiliary decoder by providing the latent vector $z$ from our pre-trained models as input in order to visualize the disentangled representations at the pixel level. By changing the bias attributes (as the column changes), the color of digit changes while maintaining the digit shape. This demonstrates that the bias features and intrinsic features independently contain color and digit information, respectively. Note that the reconstruction loss for updating the decoder is not backpropagated to our pre-trained classification models. Due to this fact, the reconstructed images may lack qualities such as showing blurry images. Further implementation details are included in Section D in the supplementary material. + +# 6 Conclusions + +In this work, we propose a feature augmentation method based on the disentangled representation of intrinsic and bias attributes. The main intuition behind our work is that increasing the diversity of bias-conflicting samples beyond a given training set is crucial for debiasing. Since the biased dataset strongly correlates the bias attributes and labels, we intentionally train two different encoders and extract bias features and intrinsic features. After the representations are disentangled to a certain degree, we proliferate the bias-conflicting samples by randomly swapping the vectors. We demonstrate the effectiveness of feature augmentation via extensive experiments, ablation studies, and qualitative evaluation of the disentangled representation. We believe our work inspires the future work of learning debiased representation with the improved generalization capability. + +Acknowledgements This work was supported by the Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korean government(MSIT) (No. 2019-0-00075, Artificial Intelligence Graduate School Program(KAIST), No. 2021-0-01778, Development of human image synthesis and discrimination technology below the perceptual threshold), the Air Force Research Laboratory, under agreement number FA9550-18-S-0003, and Kakao Enterprise. This material is based on research sponsored by The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright notation thereon. + +References +[1] A. Torralba and A. A. Efros. Unbiased look at dataset bias. CVPR ’11, 2011. +[2] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11):665–673, 2020. +[3] Byungju Kim, Hyunwoo Kim, Kyungsu Kim, Sungjin Kim, and Junmo Kim. Learning not to learn: Training deep neural networks with biased data. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019. +[4] Yi Li and Nuno Vasconcelos. Repair: Removing representation bias by dataset resampling. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 9572–9581, 2019. +[5] Shiori Sagawa, Pang Wei Koh, Tatsunori B Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. arXiv preprint arXiv:1911.08731, 2019. +[6] Hyojin Bahng, Sanghyuk Chun, Sangdoo Yun, Jaegul Choo, and Seong Joon Oh. Learning de-biased representations with biased representations. In International Conference on Machine Learning (ICML), 2020. +[7] Haohan Wang, Zexue He, Zachary L. Lipton, and Eric P. Xing. Learning robust representations by projecting superficial statistics out. In International Conference on Learning Representations, 2019. +[8] Remi Cadene, Corentin Dancette, Hedi Ben younes, Matthieu Cord, and Devi Parikh. Rubi: Reducing unimodal biases for visual question answering. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché- Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. +[9] Christopher Clark, Mark Yatskar, and Luke Zettlemoyer. Don’t take the easy way out: Ensemble based methods for avoiding known dataset biases. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4069–4082, Hong Kong, China, November 2019. Association for Computational Linguistics. +[10] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019. +[11] Wieland Brendel and Matthias Bethge. Approximating cnns with bag-of-local-features models works surprisingly well on imagenet. International Conference on Learning Representations, 2019. +[12] Junhyun Nam, Hyuntak Cha, Sungsoo Ahn, Jaeho Lee, and Jinwoo Shin. Learning from failure: Training debiased classifier from biased classifier. In Advances in Neural Information Processing Systems, 2020. +[13] Yann LeCun and Corinna Cortes. MNIST handwritten digit database. 2010. +[14] Aishwarya Agrawal, Dhruv Batra, and Devi Parikh. Analyzing the behavior of visual question answering models. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1955–1960, Austin, Texas, November 2016. Association for Computational Linguistics. +[15] Luke Darlow, Stanisław Jastrz˛ebski, and Amos Storkey. Latent adversarial debiasing: Mitigating collider bias in deep neural networks. arXiv preprint arXiv:2011.11486, 2020. +[16] Zeyi Huang, Haohan Wang, Eric P. Xing, and Dong Huang. Self-challenging improves cross-domain generalization. In ECCV, 2020. +[17] Zhilu Zhang and Mert R Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. arXiv preprint arXiv:1805.07836, 2018. +[18] Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In ICCV, 2017. +[19] Matthias Minderer, Olivier Bachem, N. Houlsby, and M. Tschannen. Automatic shortcut removal for self-supervised representation learning. In ICML, 2020. +[20] Kaiyang Zhou, Yongxin Yang, Yu Qiao, and Tao Xiang. Domain generalization with mixstyle. In ICLR, 2021. +[21] Hsin-Ying Lee, Hung-Yu Tseng, Jia-Bin Huang, Maneesh Kumar Singh, and Ming-Hsuan Yang. Diverse image-to-image translation via disentangled representations. In European Conference on Computer Vision, 2018. +[22] Xun Huang, Ming-Yu Liu, Serge Belongie, and Jan Kautz. Multimodal unsupervised image-to-image translation. In ECCV, 2018. +[23] Taesung Park, Jun-Yan Zhu, Oliver Wang, Jingwan Lu, Eli Shechtman, Alexei A. Efros, and Richard Zhang. Swapping autoencoder for deep image manipulation. In Advances in Neural Information Processing Systems, 2020. +[24] A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Master’s thesis, Department of Computer Science, University of Toronto, 2009. +[25] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019. +[26] Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. Journal of Machine Learning Research, 9:2579–2605, 2008. +[27] Enzo Tartaglione, Carlo Alberto Barbano, and Marco Grangetto. End: Entangling and disentangling deep representations for bias correction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 13508–13517, June 2021. +[28] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019. +[29] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015. \ No newline at end of file diff --git a/md/train/1-j4VLSHApJ/1-j4VLSHApJ.md b/md/train/1-j4VLSHApJ/1-j4VLSHApJ.md new file mode 100644 index 0000000000000000000000000000000000000000..e48c9651a06cc4f52af7d9286ba567dfb97371f5 --- /dev/null +++ b/md/train/1-j4VLSHApJ/1-j4VLSHApJ.md @@ -0,0 +1,256 @@ +# LEARN2WEIGHT: WEIGHTS TRANSFER DEFENSE AGAINST SIMILAR-DOMAIN ADVERSARIAL ATTACKS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Recent work in black-box adversarial attacks for NLP systems has attracted attention. Prior black-box attacks assume that attackers can observe output labels from target models based on selected inputs. In this work, inspired by adversarial transferability, we propose a new type of black-box NLP adversarial attack that an attacker can choose a similar domain and transfer the adversarial examples to the target domain and cause poor performance in target model. Based on domain adaptation theory, we then propose a defensive strategy, called Learn2Weight, which trains to predict the weight adjustments for target model in order to defense the attack of similar-domain adversarial examples. Using Amazon multi-domain sentiment classification dataset, we empirically show that Learn2Weight model is effective against the attack compared to standard black-box defense methods such as adversarial training and defense distillation. This work contributes to the growing literature on machine learning safety. + +# 1 INTRODUCTION + +As machine learning models are applied to more and more real-world tasks, addressing machine learning safety is becoming an increasingly pressing issue. Deep learning algorithms have been shown to be vulnerable to adversarial examples (Szegedy et al., 2013; Goodfellow et al., 2014; Papernot et al., 2016a). In particular, prior black-box adversarial attacks assume that the adversary is not aware of the target model architecture, parameters or training data, but is capable of querying the target model with supplied inputs and obtaining the output predictions. The phenomenon that adversarial examples generated from one model may also be adversarial to another model is known as adversarial transferability (Szegedy et al., 2013). + +Motivated by adversarial transferability, we conjecture another black-box attack pipeline where the adversary does not even need to have access to the target model nor query labels from crafted inputs. Instead, as long as the adversary knows the task of the target, he can choose a similar domain, to build a substitute model and then attack the target model with adversarial examples that are generated from the attack domain. + +![](images/701afe98cb7850d055da84d06c5c1d1b52a84093b502551f5fed697193981e36.jpg) +Figure 1: Diagrammatic representation of the problem + +(a) Generalized architecture of similarity-based attacks. + +![](images/6a410fa93b25f802d45fc136ccbe9aaeb9316e28f884c5c0ba6e0598c359b6f5.jpg) + +(b) Flow of how an adversary physician can leverage similarity attack to fool opioid risk models. + +The similar-domain adversarial attack may be more practical than prior blackbox attacks as label querying from target model is not needed. This attack can be illustrated with the following example (Figure 1b) in medical insurance fraud (Finlayson et al., 2019). Insurance companies may use hypothetical opioid risk models to classify the likelihood (high/low) of a patient to abuse the opioids to be prescribed, based on the patient’s medical history as text input. Physicians can run the original patient history through the attack pipeline to generate an adversarial patient history, where the original is more likely to be rejected (”High” risk) and the adversarial is more likely to be accepted (”Low” risk). Perturbations in patient history could be, for example, a slight perturbation from ”alcohol abuse” to ”alcohol dependence”, and it may successfully fool the insurance company’s model. + +Based on domain adaption theory (Ben-David et al., 2010), we conjecture that it is the domain-variant features that cause the success of the similar-domain attack. The adversarial examples with domainvariant features are likely to reside in the low-density regions (far away from decision boundary) of the empirical distribution of the target training data which could fool the target model (Zhang et al., 2019b). Literature indicates that worsened generalizability is a tradeoff faced by existing defenses such as adversarial training (Raghunathan et al., 2019) and domain generalization techniques (Wang et al., 2019). In trying to increase robustness against adversarial inputs, a model faces a tradeoff of weakened accuracy towards clean inputs. Given that an adversarial training loss function is composed of a loss against clean inputs and loss against adversarial inputs, improper optimization where the latter is highly-optimized and the former weakly-optimized does not improve general performance in the real-world. To curb this issue, methods have been proposed (Zhang et al., 2019b; Lamb et al., 2019; Schmidt et al., 2018), such as factoring in under-represented data points in training set. + +To defend against this similar-domain adversarial attack, we propose a weight transfer network approach, Learn2Weight, so that the target model’s decision boundary can adapt to the examples from low-density regions. Experiments confirm the effectiveness of our approach against the similardomain attack over other baseline defense methods. Moreover, our approach is able to improve robustness accuracy without losing the target model’s standard generalization accuracy. + +Our contribution can be summarized as follows: + +• We are among the first to propose the similar-domain adversarial attack. This attack pipeline relaxes the previous black-box attack assumption that the adversary has access to the target model and can query the model with crafted examples. +• We propose a defensive strategy for this attack based on domain adaptation theory. Experiment results show the effectiveness of our approach over existing defense methods, against the similar-domain attack. + +Recent work in adversarial attack for NLP systems has attracted attention. See (Zhang et al., 2020) survey for an overview of the adversarial attack in NLP. Existing research proposes different attack methods for generating adversarial text examples (Moosavi-Dezfooli et al., 2016; Ebrahimi et al., 2018; Wallace et al., 2019). The crafted adversarial text examples have been shown to fool the state-of-the-art NLP systems such as BERT (Jin et al., 2019). A large body of adversarial attack research focuses on black-box attack where the adversary builds a substitute model by querying the target model with supplied inputs and obtaining the output predictions. The key idea behind such black-box attack is that adversarial examples generated from one model may also be mis-classified by another model, which is known as adversarial transferability (Szegedy et al., 2013; Cheng et al., 2019). While prior work examines the transferability between different models trained over the same dataset, or the transferability between the same or different model trained over disjoint subsets of a dataset, our work examines the adversarial transferability between different domains, which we call similar-domain attack. + +Table 1: Comparison of attack domain sentences correctly classified when unperturbed by respective attack domain models and target domain models, then misclassified after perturbation by target models trained on books and baby domain. The perturbations are in blue, and prediction confidence in brackets. + +
Attack domain:baby,Target domain:books
Original sentence (Actual label: Pos)I purchased this toy for my sonwhen he was 4 monthsold.At first,he seemed a little intimidated by the toys.Pos (0.712)
Adversarial sentenceI obtained this toys for my children when he was 4 weeks senior. At first, he hoped a modest harassed by the toy.Neg (0.364)
Original sentence (Actual label: Pos)It felt like a big commitment for me to have to run the program 2 times a day, and near the end of my pregnancy I was annoyed with having anything strapped across my belly.Pos (0.825)
Adversarial sentenceIt felt like a big committed for me to have to run the program 2 length a day, and near the end of my pregnancy Iwas annoyed with takes anything strapped acrossmy belly.Neg (0.420)
Attack domain: dvd, Target domain: baby
Original sentence (Actual label: Pos)Fast times at ridgemont high is a clever, insightful,and wicked film! It is not just another teen movie.Pos (0.614)
Adversarial sentenceSooner days at ridgemont high is a sane, thoughtful, and wicked flick! It is not just another adolescent flick.Neg (0.335)
Original sentenceThis dvd gives a very good 6O minute workout.As others have pointed out thePos (0.647)
(Actual label: Pos) Adversarial sentencecardio is very dancy. The first time I did it,I felt a bit awkward with the steps. This dvd gives a awfully okay 6O minute exercise. As others have pointed out the cardio is very dancy. The first time I did it, I perceived a bit awkward with the steps.Neg (0.258)
+ +# 3 SIMILAR-DOMAIN ADVERSARIAL ATTACK + +# 3.1 ADVERSARIAL ATTACK BACKGROUND + +Adversarial attacks modify inputs to cause errors in machine learning inference (Szegedy et al., 2013). We utilize the basic gradient-based attack method Fast Gradient Sign Method (FGSM) (Goodfellow et al., 2014) and its variants, RAND-FGSM (Tramer et al., 2017) and \` Basic Iterative Method (BIM) (Kurakin et al., 2016a;b; Xie et al., 2018). Other NLP adversarial generation algorithms could also be used, such as DeepFool (Moosavi-Dezfooli et al., 2016), HotFlip (Ebrahimi et al., 2018), universal adversarial trigger (Wallace et al., 2019), and TextFooler (Jin et al., 2019). To perform gradient-based perturbations upon discrete space data, we follow (Yang et al., 2018) to generate adversarial text. + +Our proposed similar-domain adversarial attack is in-variant to adversarial algorithm, meaning that the adversarial algorithm used would not affect the attack performance. Without losing generality, we denote $A d v ( f , x )$ as an NLP adversarial text generation method, defined as below. + +Definition 1. NLP Adversarial Generation. Given a deep neural network model $f$ built on text data $X$ , an NLP adversarial generation method produces one adversarial instances $x ^ { \prime } A d v ( f , x )$ for $x \in X$ , $x ^ { \prime } \approx x$ . The goal of the adversarial attack is to deviate the label to incorrect one $f ( x ^ { \prime } ) \neq f ( x )$ + +# 3.2 SIMILAR-DOMAIN ADVERSARIAL ATTACK + +We present the architecture of similar-domain adversarial attack in Figure 1a. The defender, the target of the attack, constructs a target model trained on domain text data $T$ (0). An attacker, only having a rough idea about the target’s task but lacking direct access to the target data or target model parameters, collects attack data from a similar domain $S$ and trains an attack model (1). He runs the attack model on the test data (2) to obtain correctly-classified instances (3). He chooses an adversarial attack algorithm and generates a set of adversarial samples $A$ (4). He exposes $A$ to the target model, hoping $A$ mislead the target model to produce an output of his choice (5). This type of attack works best as an adversarial attack that compromises systems that base decision-making on one-instance. + +Definition 2. Similar-domain Adversarial Attack. A target model $f$ , built on target domain data $T$ , is a deep neural network model with parameter weights $W _ { T }$ that maps a text instance to a label: $y f ( X , W _ { T } )$ . An adversary chooses a source attack domain $S$ , builds a substitute model $f _ { S }$ , and generates a set of adversarial examples $A$ from $S$ using $A d v ( f _ { S } , S )$ , so that during an attack $f ( A , W _ { T } ) = f _ { S } ( A )$ . + +Table 2: Similar-domain attack performance. Bold indicates the least successful attack domain (i.e. highest after-attack accuracy) for each target domain, as well as the corresponding transfer loss value. + +
Target Domainbookmagazinebaby
Original Accuracy Intra-attack Accuracy0.8800.9600.890
0.5250.5700.632
Attack Domainmagazinebabydvdbabydvdbookdvdbookmagazine
Unperturbed Accuracy0.7260.6460.7450.7390.6630.6730.6240.6520.665
After-attack Accuracy0.3980.4210.3950.3810.3660.3430.3650.3860.401
Shared Vocab0.3810.2550.4550.2600.3450.3810.2700.2550.260
Transfer Loss0.0170.0710.0000.0790.0220.0100.0660.0500.069
+ +# 3.3 DOMAIN SIMILARITY + +Here, domain similarity refers to the similarity between attacker’s chosen domain and defender’s domain. SharedVocab measures the overlap of unique words, in each of the datasets; a higher degree of overlapping vocabulary implies the two domains are more similar. We also use Transfer Loss, a standard metric for domain adaptation Blitzer et al. (2007); Glorot et al. (2011), to measure domain similarity; lower loss indicates higher similarity. The test error from a target model trained on target domain $T$ and evaluated on attack domain $S$ returns transfer error $e ( S , T )$ . The baseline error $e ( T , T )$ term is the test error obtained from target model trained on target domain (train) data $T$ and tested on target domain (evaluation) data $T$ . This computes the transfer loss, $t f ( S , T ) = e ( S , T ) - e ( T , T )$ . + +# 4 IS THE ATTACK EFFECTIVE? + +# 4.1 SETUP + +Dataset. We simulate the similar-domain adversarial attack using Amazon’s multi-domain sentiment classification dataset (Blitzer et al., 2007), a commonly-used dataset in cross-domain sentiment classification1, with 1,000 positive and 1,000 negative reviews for each of the 25 product categories. + +Model. In practice, there could be unlimited choice for the attack model and target model, such as different deep learning architecture, different training parameters. To simplify the discussion, we choose Long Short-Term Memory (LSTM) network as a suitable baseline sentiment classification model (Wang et al., 2018) for our target model and attack model. The architecture consists of 64 LSTM cells, $80 \%$ dropout, using a sigmoid activation function. + +Metrics. We first report the accuracy of the target models on the target domain test samples before the attack as the original accuracy. Then we measure the accuracy of the target models against adversarial samples crafted from the attack domain samples, denoted as the after-attack accuracy. Intra-attack accuracy denotes the after-attack accuracy where the attack domain is identical to the target domain. By comparing original and after-attack accuracy, we can evaluate the success of the attack. The greater the gap between the original and after-attack accuracy, the more successful the attack. Unperturbed accuracy measures the accuracy of the target model against the complete, unperturbed test set of the attack domain, to demonstrate that any drop in classification accuracy is not from domain shift alone but from adversarial transferability. + +# 4.2 RESULTS + +The similar-domain adversarial attack results are presented in Table 2. We see a significant gap between original accuracy and after-attack accuracy indicating that this attack can impose valid threat to a target NLP system. After the similar-domain adversarial attack, the accuracy drops dramatically by a large margin. Take the book target domain for example, when the attack domain is magazine, the after-attack accuracy drops to 0.398, and when the attack domain is baby, the accuracy is 0.421. Moreover, we observe a positive correlation between transfer loss and after-attack accuracy, and a negative correlation between shared vocab and after-attack accuracy. + +# 5 DEFENDING AGAINST SIMILAR-DOMAIN ADVERSARIAL ATTACK + +In order to defend against a similarity based adversarial attack, it is critical to block adversarial transferability. Adversarial training is the most intuitive yet effective defense strategy for adversarial attack (Goodfellow et al., 2014; Madry et al., 2017). However, this may not be effective for two reasons. First, there is no formal guidance for generating similar-domain adversarial examples because the defender has no idea what the attack data domain is. Second, simple feeding the target model with adversarial examples may even hurt the generalization of the target model (Raghunathan et al., 2019; Zhang et al., 2019a; Su et al., 2018), which is also confirmed in our experiments. + +# 5.1 WEIGHT TRANSFER LEARNING + +The use of weight transfer networks (Ha et al., 2016; Hu et al., 2018; Kuen et al., 2019) is concerned with adapting weights from one model into another, and generating/predicting the complete set of weights for a model given the input samples. In our context, distinctly different weights are produced for target models trained on inputs of different domains, and feature transferability (Yosinski et al., 2014) in the input space can be expected to translate to weight transferability in the model weights space. Rather than completely regenerating classification weights, our model robustification defense, Learn2Weight L2W predicts the perturbation to existing weights $\left( W ^ { \prime } = W + \Delta W \right)$ ) for each new instance. + +# 5.2 LEARN2WEIGHT MODEL + +We conjecture that an effective defense strategy is to perturb the target model weights depending on the feature distribution of the input instance. $L 2 W$ (Algorithm 1) recalculates the target model weights depending on the input. $L 2 W$ (Algorithm 2) trains on sentences from different domains and a weight differential for that domain (the weight adjustment required to tune the target model’s weights to adapt to the input’s domain). We obtain the weight differential $\Delta W$ by finding the difference between the weights of $f$ trained on sentence:label pairs from a specific domain $W _ { S _ { j } }$ and weights of $f$ trained on sentence:label pairs from the target domain $W _ { T }$ . Other training models may be possible; here we trained a sequence-to-sequence network (Sutskever et al., 2014) on sentence: $\Delta W$ pairs. + +
Algorithm 1: Learn2Weight: InferenceAlgorithm 2: Learn2Weight:Training
inference (Xadv, L2W(.), f(Wr,T)) Input:Passed arguments include the adversarial input Xadu, the Learn2Weight model L2W(-),and the target model f(Wr,T) Output :Target model with weightedtrain (T,D) Input :Target domain T={Ti}0; Set of M domains D={S,j)j; withNsentences, N,M i indexing specific sentence tensor and j indexing specific domains Output :Trained Learn2Weight model L2W(·)
updated byLearn2Weight f(W*,T) is the expected output Pass Xadu as in input into the trained L2W(-) function,and the weight differential required for the target model with weights Wr is△W.Initialize empty X and Y to store sentences Xi from each domain j with corresponding weight differential. X←;Y←; Compute weights of f trained on T. Wr ← f(T);
△W ← L2W(Xadv); The returned function is the target model with updated weights Wr+△W. return f(Wr +△W,T);X←T;Y←WT-Wr; Train each domain Sj,compute respective weights, append the differential △W to Y and each sentence in Si,j into X. foreach domain Sj ∈D do Ws,← f(Sj); △W ←Wsj-Wr;
+ +# Algorithm 3: tf-optimization + +tfOptimization $( T , M , n _ { m a x } )$ + +Input :Target domain $T = \{ T _ { i } \} _ { i = 0 } ^ { N }$ to be used in synthesizing $M$ similar domains; with $N$ sentences, $i$ indexing specific sentence tensor; $n _ { m a x }$ is the max number of tf-optimization iterations +Output :Set $D$ containing $M$ domains +Initialize empty $D$ to store synthesized domains $S _ { j }$ of index $j$ . +$D \gets \emptyset ; j \gets 0$ ; +while $j < M$ do Run each iteration until $n _ { m a x }$ . for iter $ 0$ to $n _ { m a x }$ do Apply adversarial perturbations to $T$ . $T _ { i t e r } ^ { \hat { a } \hat { d } v } \gets A d v ( f , \hat { T } )$ ; Determine change to $A d v ( \cdot )$ or iter depending on computed transfer loss. if $c h e c k ( t f ( T _ { i t e r } ^ { a d v } , T ) ) \gets T r u e$ then If low enough, $T _ { i t e r } ^ { a d v }$ can be added as synthetic domain into $D$ . $D \gets T _ { i t e r } ^ { a d v }$ ; break; else Adjust perturbation parameters. $A d v ( \cdot ) a d j u s t ( A d v ( \cdot ) )$ ; $j \gets j + 1$ ; Return set of Domains to be used for training by $L 2 W$ . +return $D$ ; + +# 5.3 TRANSFER LOSS OPTIMIZATION + +To generate synthetic domains of varying domain similarity so that defenders defend their model using only target domain data $T$ , the following equation introduces transfer loss optimization (Algorithm 3). The defender iteratively generates adversarial examples $X _ { N } ^ { a d v }$ while maximizing the transfer loss function $t f$ ; this produces a substitute attack domain corpora $S _ { j }$ . We iteratively adjust perturbation parameters $A d v ( \cdot )$ and iteration count $N$ to minimize the transfer loss of our generated dataset. + +$$ +\underset { N , A d v ( \cdot ) } { \arg \operatorname* { m i n } } t f _ { N } \Bigl ( X _ { N } ^ { a d v } , T \Bigr ) = e \Bigl ( A d v ( f , T ) , T \Bigr ) - e \Bigl ( T , T \Bigr ) +$$ + +# 5.4 EXPLANATION: BLOCKING TRANSFERABILITY + +To facilitate our explanation, we adapt from domain adaptation literature (Ben-David et al., 2010; Liu et al., 2019; Zhang et al., $2 0 1 9 \mathrm { c }$ ): + +$$ +e ( A , T ) \leq e ( T , T ) + d _ { \mathcal { H } \Delta \mathcal { H } } ( A , T ) + \lambda +$$ + +where $\mathcal { H }$ is the hypothesis space, $h$ is a hypothesis function that returns labels $\{ 0 , 1 \}$ , and $e ( T , T )$ and $e ( A , T )$ are the generalization errors from passing target domain data $T$ and adversarial data $A$ through a classifier trained on $T$ . $d _ { \mathcal { H } \Delta \mathcal { H } } ( A , T )$ is the $\mathcal { H } \Delta \bar { \mathcal { H } }$ -distance between $T$ and $A$ , and measures the divergence between the feature distributions of $A$ and $T$ . $e _ { A } ( h , h ^ { ' } )$ and $e _ { T } ( h , h ^ { ' } )$ represents the probability that $h$ disagrees with $h ^ { ' }$ on the label of an input in the domain space $A$ and $T$ respectively. + +$$ +\begin{array} { r } { d _ { \mathcal { H } \Delta \mathcal { H } } ( A , T ) = \underset { h , h ^ { \prime } \in \mathcal { H } } { \operatorname* { s u p } } | e _ { A } ( h , h ^ { ' } ) - e _ { T } ( h , h ^ { ' } ) | } \\ { d _ { \mathcal { H } \Delta \mathcal { H } } ( A , T ) = \operatorname* { s u p } _ { h , h ^ { \prime } \in \mathcal { H } } | \mathbb { E } _ { X \sim S } [ | ( h ( x ) - h ^ { ' } ( x ) | ] | } \\ { - | \mathbb { E } _ { X \sim T } [ | ( h ( x ) - h ^ { ' } ( x ) | ] | | } \end{array} +$$ + +Divergence $d _ { \mathcal { H } \Delta \mathcal { H } }$ measures the divergence between feature distributions $A$ and $T$ . Higher $d _ { \mathcal { H } \Delta \mathcal { H } }$ indicates less shared features between 2 domains. The greater the intersection between feature distributions, the greater the proportion of domain-variant features; one approach to domain adaptation is learning domain-invariant features representations (Zhao et al., 2019) to minimize $d _ { \mathcal { H } \Delta \mathcal { H } }$ . + +Table 3: After-defense accuracy performance of different defensive methods. + +
Target Domainmagazinebaby
Attack Domainbabydvdbookdvdbookmagazine
After-attack Accuracy0.3810.3660.3430.3650.3860.401
After-defense Accuracy
Adversarial training0.6390.5590.6570.5580.5770.661
Defensive distillation0.5490.5610.5970.5880.6290.577
SharedVocab defense0.6280.6530.6310.6640.6680.621
Domain-adapted adversarial training0.6080.6370.6200.6040.6200.587
Learn2Weight0.7960.8420.8430.7740.7510.737
+ +Explaining similarity-domain attacks. As demonstrated by empirical results, $e ( A , T )$ increases in a similarity-based attack setting, and this would arise if $d _ { \mathcal { H } \Delta \mathcal { H } }$ increases correspondingly. $d _ { \mathcal { H } \Delta \mathcal { H } }$ computes inconsistent labels from inconsistent feature distributions, and attributes the success of the attack to domain-variant features. + +FGSM and variants adjust the input data to maximize the loss based on the backpropagated gradients of a model trained on $S$ . As our pipeline used correctly-labelled sentences before adversarially perturbing them, we can infer that perturbations applied to $S$ were not class-dependent (i.e. the success of the attack is not based on the removal of class-specific features), but class-independent features. It is already difficult for a model trained on $S$ to classify when there is insufficient classdependent features (hence a high $t f ( A , T ) )$ ; in a cross-domain setting, it must be even more difficult for a model trained on $T$ to classify given a shortage of domain-invariant, class-dependent features. + +$$ +\begin{array} { c } { { d _ { { \mathcal { H } } \Delta { \mathcal { H } } } \leq e ( A , T ) - e ( T , T ) - \lambda } } \\ { { d _ { { \mathcal { H } } \Delta { \mathcal { H } } } \leq t f ( A , T ) - \lambda } } \end{array} +$$ + +Explaining Learn2Weight. $L 2 W$ minimizes divergence by training on $\{ d _ { \mathcal { H } \Delta \mathcal { H } } ( S _ { j } , T ) : \Delta W _ { A . S _ { j } } \}$ pairs, $d _ { \mathcal { H } \Delta \mathcal { H } } ( S _ { j } , T )$ being reconstructed from the difference between S $x _ { i } ^ { S _ { j } }$ and $x _ { i } ^ { T }$ . $L 2 W$ is trained on $\{ d _ { \mathcal { H } \Delta \mathcal { H } } ^ { S _ { j } } \} _ { j = 0 } ^ { N } : \{ \Delta W ^ { S _ { j } } \} _ { j = 0 } ^ { N }$ pairs, such that . Intuitively the target model possesses a decision boundary (Liu et al., 2019) to classify inputs based on whether they cross the boundary or not; adversarial inputs have a tendency of being near the boundary and fooling it. Weights transfer learning applies perturbations to the decision boundary such that the boundary covers certain adversarial inputs otherwise misclassified, and in this way blocks transferability. The advantage of training on multiple domains $\{ S _ { j } \} _ { j = 0 } ^ { M }$ is that the after- $. L 2 W$ divergence between $A$ and $T$ is smaller because $L 2 W$ ’s weight perturbations render the decision boundary more precise in classifying inputs. + +Explaining tf-optimization. We have attributed why adversarial sentences $A$ are computed to be domain-dissimilar despite originating from $S$ due to insufficient domain-invariant, class-dependent features resulting in low $e ( A , T )$ , i.e. low $t f ( A , T )$ . To replicate this phenomenon in natural domains, we use $t f$ -optimization to iteratively perturb $T$ to increase the proportion of class-independent features. This approximates the real-world similarity-based attack scenario where class-dependent features may be limited for inference. By generating the synthetic data, we are feeding $L 2 W$ attack data with variations in $d _ { \mathcal { H } \Delta \mathcal { H } }$ and class-independent feature distributions. This prepares $L 2 W$ to robustify weights in $f ( T )$ when such feature distributions are encountered. + +# 6 EXPERIMENTS + +# 6.1 BASELINES + +We consider two defense strategies that are empirically effective and are widely used for general black-box adversarial attacks: adversarial training (Goodfellow et al., 2014; Madry et al., 2017) and defensive distillation (Papernot et al., 2016b; 2017). In addition we consider two ablation baselines. + +Defensive distillation: The high-level implementation of defensive distillation (Papernot et al., 2016b; 2017) is to first train an initial model against target domain inputs and labels, and retrieve the raw class probability scores. The predicted probability values would be used as the new labels for the same target sentences, and we would train a new model based on this new label-sentence pair. + +Table 4: Learn2Weight comparison against different attack model architectures. + +
TargetOriginalAttackAttack Model After-attack AccuracyAfter-Defense Accuracy
DomainAccuracy Target Model: LSTMDomainLogRegCNNLogReg
BERT LSTMBERT LSTM
book0.880dvd0.3420.413GRU 0.477CNN 0.3350.4400.7860.8470.8040.8160.782
kitchenware0.3500.3720.3250.3530.4250.7650.8260.7950.7420.767
electronics0.4000.3890.4160.3150.4600.7920.8120.7840.7700.725
dvd0.9200.3260.4340.4790.3830.4900.8160.7950.8240.8040.794
book kitchenware0.3550.3700.3790.3590.4900.7280.7960.7550.7350.695
electronics0.3870.3770.3320.3480.4550.8250.8360.8120.8340.796
electronics0.910book0.4250.3940.4730.3580.4740.7750.8210.7950.7820.712
dvd0.3420.3950.4520.3680.4930.7840.8450.8550.8420.792
kitchenware0.3900.3840.4640.3290.4320.7300.8240.7530.7240.678
+ +Adversarial training: It is shown that injecting adversarial examples throughout training increases the robustness of target neural network models. In this baseline, target model is trained with both original training data and adversarial examples generated from original training data. However, since the adversarial examples are still generated from the target domain, it is unlikely that the method can defend similar-domain attack which is the result of domain-variant features. + +SharedVocab defense. Given that it is the domain-variant features that cause the success of similardomain attack, a simple baseline is to remove those words that are not in the target domain’s vocabulary. This tests whether the effect of perturbing target model weights w.r.t domain-variant features will yield incremental after-attack accuracy in the similar-domain attack setting. + +Domain-adapted adversarial training. This ablation baseline tests for incremental performance to a baseline defense using domain-variant inputs. We adapt adversarial training to be trained on adversarial sentences from attack domain $S$ , whereas the traditional adversarial training generates adversarial samples $X ^ { a d v , T }$ from its training data $T$ , this adapted version uses adversarial samples $X ^ { a d v , S }$ generated from $S$ . + +# 6.2 LEARN2WEIGHT PERFORMANCE + +Defense performance. We present the results of different defense baselines in Table 3. First, we can see that Learn2Weight achieves the highest after-defense accuracy against the adversarial attack. Take the magazine as target domain for example, if the adversary chooses to use book data as the attack domain, it would reduce the target model accuracy to 0.343. However, the Learn2Weight method can improve the performance to 0.843, which is a significant and substantial improvement against the attack. This improvements also exist across different target/attack domain pairs. Second, we see that all defense methods can improve the accuracy to some extent which indicates the importance and effectiveness of having robust training for machine learning models. Third, it is interesting to note that two simple baselines SharedVocab defense and Domain-adapted adversarial training yield overall better performance compared to adversarial training and defensive distillation. + +Attack model architectures. So far, all the results are conducted using the same LSTM as the target/attack model due to simplicity purpose. Here, we keep the target model unchanged, but vary the architecture of the attack model for the generation of adversarial examples. A variation of a Recurrent Neural Network is a Gated Recurrent Unit (GRU) network, with 512 GRU cells, $60 \%$ dropout and tanh activation function. We have also tested other attack model variants that are commonly-used in sentiment classification, including Bidirectional Encoder Representations from Transformers (BERT) (Devlin et al., 2019), Convolutional Neural Network (CNN) (Kim, 2014), and Logistic Regression (Maas et al., 2011). For both RNN and CNN, we use pre-computed Glove embeddings2 to encode words. All models are trained with enough epochs after ensuring the model achieved near state-of-the-art validation accuracy before proceeding to tests of adversarial attacks and defenses. + +We present the results of different attack model architectures in Table 4. First, similar-domain attack is model-agnostic and it does not require the target and attack model to have identical architectures. + +We can see that all four attack model architectures are able to reduce the target model accuracy. Second, the results suggest that Learn2Weight is also model-agnostic as it can substantially improve the after-defense accuracy regardless which attack model is used. + +# 7 CONCLUSION + +In this newly-proposed, empirically-effective similar-domain attack, an adversary can choose a similar domain to the target task, build a substitute model and produce adversarial examples to fool the target model. We also propose a defense strategy, Learn2Weight, that learns to adapt the target model’s weight using crafted adversarial examples. Compared with other adversarial defense strategies, Learn2Weight can improve the target model robustness against the similar-domain attack. Our method demonstrates properties of a good adversarial defense, such as adopting defense architectures that adapt to situations/inputs rather than compromising standard error versus robustness error, to leverage class-independent properties in domain-variant text, and factoring in domain similarity in adversarial robustness exercises. + +# REFERENCES + +Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Vaughan. A theory of learning from different domains. Machine Learning, 79:151–175, 2010. URL http://www.springerlink.com/content/q6qk230685577n52/. + +John Blitzer, Mark Dredze, and Fernando Pereira. Biographies, bollywood, boom-boxes and blenders: Domain adaptation for sentiment classification. In ACL, pp. 440–447, 2007. + +Shuyu Cheng, Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Improving black-box adversarial attacks with a transfer-based prior. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Garnett (eds.), ´ Advances in Neural Information Processing Systems 32, pp. 10934–10944. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/ 9275-improving-black-box-adversarial-attacks-with-a-transfer-based-prior. pdf. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //www.aclweb.org/anthology/N19-1423. + +Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. Hotflip: White-box adversarial examples for text classification. In ACL, pp. 31–36, 2018. + +Samuel G. Finlayson, John D. Bowers, Joichi Ito, Jonathan L. Zittrain, Andrew L. Beam, and Isaac S. Kohane. Adversarial attacks on medical machine learning. Science, 363(6433):1287–1289, 2019. ISSN 0036-8075. doi: 10.1126/science.aaw4399. URL https://science.sciencemag.org/ content/363/6433/1287. + +Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Domain adaptation for large-scale sentiment classification: A deep learning approach. In ICML, pp. 513–520, 2011. + +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. + +David Ha, Andrew Dai, and Quoc V Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016. + +Ronghang Hu, Piotr Dollar, Kaiming He, Trevor Darrell, and Ross Girshick. Learning to segment ´ every thing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4233–4241, 2018. + +Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. Is bert really robust? natural language attack on text classification and entailment. arXiv preprint arXiv:1907.11932, 2019. + +Yoon Kim. Convolutional neural networks for sentence classification. In EMNLP, pp. 1746–1751, 2014. + +Jason Kuen, Federico Perazzi, Zhe Lin, Jianming Zhang, and Yap-Peng Tan. Scaling object detection by transferring classification weights. In Proceedings of the IEEE International Conference on Computer Vision, pp. 6044–6053, 2019. + +Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016a. + +Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016b. + +Alex Lamb, Vikas Verma, Juho Kannala, and Yoshua Bengio. Interpolated adversarial training: Achieving robust neural networks without sacrificing too much accuracy. In Proceedings of the 12th ACM Workshop on Artificial Intelligence and Security, AISec’19, pp. 95–103, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450368339. doi: 10.1145/3338501.3357369. URL https://doi.org/10.1145/3338501.3357369. + +Hong Liu, Mingsheng Long, Jianmin Wang, and Michael Jordan. Transferable adversarial training: A general approach to adapting deep classifiers. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 4013–4022, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/liu19b.html. + +Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In ACL, pp. 142–150, 2011. + +Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017. + +Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In CVPR, pp. 2574–2582, 2016. + +Nicolas Papernot, Patrick McDaniel, and Ian Goodfellow. Transferability in machine learning: from phenomena to black-box attacks using adversarial samples. arXiv preprint arXiv:1605.07277, 2016a. + +Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In 2016 IEEE Symposium on Security and Privacy (SP), pp. 582–597. IEEE, 2016b. + +Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, ASIA CCS ’17, pp. 506–519, New York, NY, USA, 2017. Association for Computing Machinery. ISBN 9781450349444. doi: 10.1145/3052973.3053009. URL https://doi.org/10.1145/3052973.3053009. + +Aditi Raghunathan, Sang Michael Xie, Fanny Yang, John C Duchi, and Percy Liang. Adversarial training can hurt generalization. arXiv preprint arXiv:1906.06032, 2019. + +Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS’18, pp. 5019–5031, Red Hook, NY, USA, 2018. Curran Associates Inc. + +Dong Su, Huan Zhang, Hongge Chen, Jinfeng Yi, Pin-Yu Chen, and Yupeng Gao. Is robustness the cost of accuracy?–a comprehensive study on the robustness of 18 deep image classification models. In Proceedings of ECCV, pp. 631–648, 2018. + +Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 2, NIPS’14, pp. 3104–3112, Cambridge, MA, USA, 2014. MIT Press. + +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. + +Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick Mc- \` Daniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017. + +Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. Universal adversarial triggers for attacking and analyzing nlp. In EMNLP, pp. 2153–2162, 2019. + +Haohan Wang, Songwei Ge, Zachary Lipton, and Eric Xing. Learning robust global representations by penalizing local predictive power. Neural Information Processing Systems, pp. 10506–10518, 2019. + +Jenq-Haur Wang, Ting-Wei Liu, Xiong Luo, and Long Wang. An LSTM approach to short text sentiment classification with word embeddings. In ROCLING, pp. 214–223, 2018. + +Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan Yuille. Improving transferability of adversarial examples with input diversity, 2018. + +Puyudi Yang, Jianbo Chen, Cho-Jui Hsieh, Jane-Ling Wang, and Michael I. Jordan. Greedy attack and gumbel attack: Generating adversarial examples for discrete data, 2018. + +Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 2, NIPS’14, pp. 3320–3328, Cambridge, MA, USA, 2014. MIT Press. + +Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric Xing, Laurent El Ghaoui, and Michael Jordan. Theoretically principled trade-off between robustness and accuracy. In Proceedings of ICML, pp. 7472–7482, 2019a. + +Huan Zhang, Hongge Chen, Zhao Song, Duane Boning, Inderjit S. Dhillon, and Cho-Jui Hsieh. The limitations of adversarial training and the blind-spot attack, 2019b. + +Wei Emma Zhang, Quan Z Sheng, Ahoud Alhazmi, and Chenliang Li. Adversarial attacks on deep-learning models in natural language processing: A survey. ACM Transactions on Intelligent Systems and Technology (TIST), 11(3):1–41, 2020. + +Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. Bridging theory and algorithm for domain adaptation. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 7404–7413, Long Beach, California, USA, 09–15 Jun 2019c. PMLR. URL http://proceedings.mlr.press/v97/zhang19i.html. + +Han Zhao, Remi Tachet Des Combes, Kun Zhang, and Geoffrey Gordon. On learning invariant representations for domain adaptation. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 7523–7532, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/zhao19a.html. \ No newline at end of file diff --git a/md/train/9CPc4EIr2t1/9CPc4EIr2t1.md b/md/train/9CPc4EIr2t1/9CPc4EIr2t1.md new file mode 100644 index 0000000000000000000000000000000000000000..cea7c99514097ade315ef775ed77c20336dc26c5 --- /dev/null +++ b/md/train/9CPc4EIr2t1/9CPc4EIr2t1.md @@ -0,0 +1,294 @@ +# Stable Neural ODE with Lyapunov-Stable Equilibrium Points for Defending Against Adversarial Attacks + +# Qiyu Kang∗ + +Continental-NTU Corporate Lab Nanyang Technological University 50 Nanyang Avenue, 639798, Singapore kang0080@e.ntu.edu.sg + +Yang Song∗ School of Electrical and Electronic Engineering Nanyang Technological University 50 Nanyang Avenue, 639798, Singapore songy@ntu.edu.sg + +# Qinxu Ding + +School of Business +Singapore University of Social Sciences +463 Clementi Road, 599494, Singapore qinxuding@suss.edu.sg + +Wee Peng Tay School of Electrical and Electronic Engineering Nanyang Technological University 50 Nanyang Avenue, 639798, Singapore wptay@ntu.edu.sg + +# Abstract + +Deep neural networks (DNNs) are well-known to be vulnerable to adversarial attacks, where malicious human-imperceptible perturbations are included in the input to the deep network to fool it into making a wrong classification. Recent studies have demonstrated that neural Ordinary Differential Equations (ODEs) are intrinsically more robust against adversarial attacks compared to vanilla DNNs. In this work, we propose a stable neural ODE with Lyapunov-stable equilibrium points for defending against adversarial attacks (SODEF). By ensuring that the equilibrium points of the ODE solution used as part of SODEF is Lyapunov-stable, the ODE solution for an input with a small perturbation converges to the same solution as the unperturbed input. We provide theoretical results that give insights into the stability of SODEF as well as the choice of regularizers to ensure its stability. Our analysis suggests that our proposed regularizers force the extracted feature points to be within a neighborhood of the Lyapunov-stable equilibrium points of the ODE. SODEF is compatible with many defense methods and can be applied to any neural network’s final regressor layer to enhance its stability against adversarial attacks. + +# 1 Introduction + +Although deep learning has found successful applications in many tasks such as image classification [1, 2], speech recognition [3], and natural language processing [4], the vulnerability of deep learning to adversarial attacks (e.g., see [5]) has limited its real-world applications due to performance and safety concerns in critical applications. Inputs corrupted with human-imperceptible perturbations can easily fool many vanilla deep neural networks (DNNs) into mis-classifying them and thus significantly impact their performance. + +Recent studies [6–8] have applied neural Ordinary Differential Equations (ODEs) [9] to defend against adversarial attacks. Some works like [6] have revealed interesting intrinsic properties of + +ODEs that make them more stable than conventional convolutional neural networks (CNNs). The paper [6] proposes a time-invariant steady neural ODE (TisODE) using the property that the integral curves from a ODE solution starting from different initial points (inputs) do not intersect and always preserve uniqueness in the solution function space. However, this does not guarantee that small perturbations of the initial point lead to small perturbations of the integral curve output at a later time $T$ . The authors thus proposed a regularizer to limit the evolution of the curves by forcing the integrand to be close to zero. However, neither the non-intersecting property nor the steady-state constraint used in TisODE can guarantee robustness against input perturbations since these constraints do not ensure that the inputs are within a neighborhood of Lyapunov-stable equilibrium points. An example is an ODE that serves as an identity mapping is not robust to input perturbations but satisfies all the constraints proposed in [6]. + +In this paper, our objective is to design a neural ODE such that the features extracted are within a neighborhood of the Lyapunov-stable equilibrium points of the ODE. We first develop a diversity promoting technique applied in the final fully connected (FC) layer to improve the ODE’s stability and analyze the reasons why. We then propose a stable neural ODE with Lyapunov-stable equilibrium points to eliminate the effects of perturbations in the input. From linear control theory [10], a linear time-invariant system $\mathrm { d } { \mathbf { z } ( t ) } / \mathrm { d } t = { \mathbf { A } } { \mathbf { z } ( t ) }$ , where $\mathbf { A }$ is a constant matrix, is exponentially stable if all eigenvalues of $\mathbf { A }$ have negative real parts. Specifically, we propose to force the Jacobian matrix of the ODE used in the neural ODE to have eigenvalues with negative real parts. Instead of directly imposing constraints on the eigenvalues of the matrix, which lead to high computational complexity when the Jacobian matrix is large, we instead add constraints to the matrix elements to implicitly force the real parts of its eigenvalues to be negative. + +Our main contributions are summarized as follows: + +1. Based on the concept of Lyapunov-stable equilibrium points, we propose a simple yet effective technique to improve the robustness of neural ODE networks by fixing the final FC layer to be a matrix whose rows have unit norm and such that the maximum cosine similarity between any two rows is minimized. Such a FC layer can be constructed off-line. +2. We propose a stable neural ODE for deFending against adversarial attacks (SODEF) to suppress the input perturbations. We derive an optimization formulation for SODEF to force the extracted feature points to be within a neighborhood of the Lyapunov-stable equilibrium points of the SODEF ODE. We provide sufficient conditions for learning a robust feature representation under SODEF. +3. We test SODEF on several widely used datasets MNIST [11], CIFAR-10 and CIFAR-100 [12] under well-known adversarial attacks. We demonstrate that SODEF is robust against adversarial white-box attacks with improvement in classification accuracy of adversarial examples under PGD attack [13] of up to $4 4 . 0 2 \%$ , $5 2 . 5 4 \%$ and $1 8 . 9 1 \%$ percentage points compared to another current state-of-the-art neural ODE network TisODE [6] on MNIST, CIFAR-10 and CIFAR-100, respectively. Similar improvements in classification accuracy of adversarial examples of up to $\bar { 4 3 . 6 9 \% }$ , $5 2 . 3 8 \%$ and $\mathrm { \bar { 1 8 . 9 9 \% } }$ percentage points compared to ODE net [9] are also obtained. + +The rest of this paper is organized as follows. We provide essential preliminaries on neural ODE and its stability analysis in Section 2. In Section 3, we present SODEF model architecture and its training method. We show how to maximize the distance between stable equilibrium points of neural ODEs. We propose an optimization and present theoretical results on its stability properties. We summarize experimental results in Section 4 and conclude the paper in Section 5. The proofs for all lemmas and theorems proposed in this paper are given in the supplementary material. We also refer interested readers to the supplementary material for a more detailed account of related works [14–16, 6] and some popular adversarial attacks [17, 13] that are used to verify the robustness of our proposed SODEF. In the paper, we use lowercase boldface characters like $\mathbf { z }$ to denote vectors in $\mathbb { R } ^ { n }$ , capital boldface characters like $\mathbf { A }$ to denote matrices in $\mathbb { R } ^ { n \times n }$ , and normal characters like $z$ to denote scalars except that the notation $( x , y )$ are normal characters reserved to denote the input and label pairs. A vector $\mathbf { z } \in \mathbb { R } ^ { n }$ is represented as $( \mathbf { z } ^ { ( 1 ) } , \mathbf { z } ^ { ( 2 ) } , \ldots , \mathbf { z } ^ { ( n ) } )$ . The $( i , j )$ -th element of a matrix $\mathbf { A }$ is $\mathbf { A } _ { i j }$ or $[ \mathbf { A } ] _ { i j }$ . The Jacobian matrix of a function $f : \mathbb { R } ^ { n } \mapsto \mathbb { R } ^ { n }$ evaluated at $\mathbf { z }$ is denoted as $\nabla f ( \mathbf { z } )$ The set of functions $\mathbb { R } ^ { n } \mapsto \mathbb { R } ^ { n }$ with continuous first derivatives is denoted as $C ^ { 1 } ( \mathbb { R } ^ { n } , \mathbb { R } ^ { n } )$ . + +# 2 Preliminaries: Neural ODE and Stability + +In a neural ODE layer, the relation between the layer input ${ \bf z } ( 0 )$ and output ${ \mathbf z } ( T )$ is described as the following differential equation: + +$$ +\frac { \mathrm { d } \mathbf { z } ( t ) } { \mathrm { d } t } = f _ { \pmb { \theta } } ( \mathbf { z } ( t ) , t ) +$$ + +where $f _ { \pmb \theta } : \mathbb { R } ^ { n } \times [ 0 , \infty ) \mapsto \mathbb { R } ^ { n }$ denotes the non-linear trainable layers that are parameterized by weights $\pmb { \theta }$ and $\mathbf { z } : [ 0 , \infty ) \mapsto \mathbb { R } ^ { n }$ represents the $n$ -dimensional state of the neural ODE. Neural ODEs are the continuous analog of residual networks where the hidden layers of residual networks can be regarded as discrete-time difference equations ${ \bf z } ( t + 1 ) = { \bf z } ( t ) + { f _ { \theta } } ( { \bf z } ( t ) , t )$ . In this work, for simplicity, we only consider the time-invariant (autonomous) case $f _ { \pmb \theta } ( \mathbf { z } ( t ) , t ) = f _ { \pmb \theta } ( \mathbf { z } ( t ) )$ , where the dynamical system does not explicitly depend on $t$ . For such non-linear dynamical systems, the following theorem shows that under mild conditions, its behaviour can be studied via linearization near special points called hyperbolic equilibrium points. + +Theorem 1 (Hartman–Grobman Theorem [18]). Consider a system evolving in time with state $\mathbf { z } ( t ) \in \mathbb { R } ^ { n }$ that satisfies the differential equation $\frac { \mathrm { d } { \bf z } ( t ) } { \mathrm { d } t } = f ( { \bf z } ( t ) )$ for some $f \in C ^ { 1 } ( \mathbb { R } ^ { n } , \mathbb { R } ^ { n } ) ;$ , $f ( \mathbf { z } ) = ( f ^ { ( 1 ) } ( \mathbf { z } ) , \ldots , f ^ { ( n ) } ( \mathbf { z } ) )$ . Suppose the map has a hyperbolic equilibrium state $\mathbf { z } ^ { \ast } \in \mathbb { R } ^ { n }$ , i.e., $f ( { \bf z } ^ { * } ) = 0$ and the Jacobian matrix with real part equal to zer $\nabla f = [ \partial f ^ { ( i ) } / \partial \mathbf { z } ^ { ( j ) } ] _ { i , j = 1 } ^ { n }$ of hb $f$ evalurhood at of $\textbf { z } = \textbf { z } ^ { * }$ has nolibrium $N _ { \mathbf { z } ^ { * } }$ point $\mathbf { z } ^ { \ast }$ and a homeomorphism $g : N _ { \mathbf { z } ^ { * } } \mapsto \mathbb { R } ^ { n }$ , such that $g ( \mathbf { z } ^ { * } ) = 0$ and in the neighbourhood $N _ { \mathbf { z } ^ { * } }$ , the flow of $\frac { \mathrm { d } { \bf z } ( t ) } { \mathrm { d } t } = f ( { \bf z } ( t ) )$ is topologically conjugate by the continuous map $\bar { \mathbf { z } } ( t ) = g ( \mathbf { z } ( t ) )$ to the flow of its linearization $\frac { \mathrm { d } \bar { \mathbf { z } } ( t ) } { \mathrm { d } t } = \nabla f ( \mathbf { z } ^ { * } ) \cdot \bar { \mathbf { z } } ( t ) .$ + +The theorem states that when the Jacobian matrix at the zeros of $f$ has no eigenvalue with zero real part, the behaviour of the original dynamical system can be studied using the simpler linearization of the system around those zeros. We next review some definitions and theorems from linear control theory [10]. + +Definition 1 (Lyapunov Stability [10]). The linear time-invariant system $\frac { \mathrm { d } \bar { \mathbf { z } } ( t ) } { \mathrm { d } t } = \mathbf { A } \bar { \mathbf { z } } ( t )$ with constant matrix A is marginally stable or stable in the sense of Lyapunov if every finite initial state $\bar { \mathbf { z } } ( 0 )$ excites a bounded response. It is asymptotically stable if every finite initial state excites $a$ bounded response, which, in addition, approaches 0 as $t \to \infty$ . + +Theorem 2 (Lyapunov Stability Theorem [10]). a) The equation $\frac { \mathrm { d } \bar { \mathbf { z } } ( t ) } { \mathrm { d } t } = \mathbf { A } \bar { \mathbf { z } } ( t ) )$ is marginally stable if and only if all eigenvalues of A have zero or negative real parts and those with zero real parts are simple roots of the minimal polynomial of A. $^ b$ ) The equation $\frac { \mathrm { d } \bar { \mathbf { z } } ( t ) } { \mathrm { d } t } = \mathbf { A } \bar { \mathbf { z } } ( t )$ is asymptotically stable if and only if all eigenvalues of A have negative real parts. + +In Theorem 1, we say that a hyperbolic equilibrium point is Lyapunov-stable if all eigenvalues of the Jacobian matrix evaluated at it have negative real parts. From Theorems 1 and 2, we see that a small perturbation around the Lyapunov-stable equilibrium point ${ \bf z } ( 0 )$ leads to $\tilde { \mathbf { z } } ( t ) \to \mathbf { z } ( 0 )$ as $t \to \infty$ , i.e., $\exists \delta > 0$ such that for all $\tilde { \mathbf { z } } ( 0 )$ with $\lVert { \mathbf z } ( 0 ) \dot { - } \tilde { { \mathbf z } } ( 0 ) \rVert _ { 2 } \dot { < } \delta$ , we have $\| \widetilde { \mathbf { z } } ( t ) - \mathbf { z } ( 0 ) \| _ { 2 } \to \dot { 0 }$ as $t \to \infty$ , where $\tilde { \mathbf { z } } ( t )$ is the ODE solution for the perturbed input $\tilde { \mathbf { z } } ( 0 )$ . In the context of neural network adversarial attacks, if the malicious perturbations around the ODE input ${ \bf z } ( 0 )$ is small, then the output ${ \mathbf z } ( T )$ for large enough $T$ will not be affected significantly by the perturbation. Consequently, the succeeding network layers after the neural ODE layer can still perform well without being affected by the input perturbation. The perturbation weakening phenomenon around Lyapunov-stable equilibrium points works like a noise filter and acts as a defense against adversarial attacks. + +We require the following definition and result in our stability analysis. + +Definition 2 (Strictly diagonally dominant [19]). Let $\mathbf { A } \in \mathbb { C } ^ { n \times n }$ . We say that A is strictly diagonally dominant if $\begin{array} { r } { \left| { { { \mathbf { A } } _ { i i } } } \right| > \sum _ { j \neq i } \left| { { { \mathbf { A } } _ { i j } } } \right| } \end{array}$ for all $i = 1 , . . . , n$ . + +Theorem 3 (Levy–Desplanques theorem [19]). If $\mathbf { A } \in \mathbb { C } ^ { n \times n }$ is strictly diagonally dominant and if every main diagonal entry of A is real and negative, then $A$ is non-singular and every eigenvalue of A has negative real part. + +![](images/96641a4aad1ec2c9f3138777e3d67fc9ff9849146d1c1b15becd36b84d50c353.jpg) +Fig. 1: SODEF model architecture. + +Lemma 1. Given $k$ distinct points $\mathbf { z } _ { i } \in \mathbb { R } ^ { n }$ and matrices $\mathbf { A } _ { i } \in \mathbb { R } ^ { n \times n }$ , $i = 1 , . . . , k$ , there exists a function $f \in C ^ { 1 } ( \mathbb { R } ^ { n } , \mathbb { R } ^ { n } )$ such that $f ( \mathbf { z } _ { i } ) = 0$ and $\nabla f _ { \pmb { \theta } } ( \mathbf { z } _ { i } ) = \mathbf { A } _ { i }$ . + +# 3 SODEF Architecture + +We consider a classification problem with $L$ classes. The proposed SODEF model architecture is shown in Fig. 1. The input $x \in X$ (e.g., an image) is first passed through a feature extractor $h _ { \phi } : X \mapsto \mathbb { R } ^ { n }$ to obtain an embedding feature representation ${ \bf z } ( 0 )$ . A neural ODE layer $f _ { \theta }$ follows as a nonlinear feature mapping to stabilize the feature representation output ${ \bf z } ( 0 )$ from $h _ { \phi }$ . The final FC layer $\mathbf { V }$ serves as a linear mapping to generate a prediction vector based on the output $\mathbf { \dot { z } } ( T )$ of the neural ODE layer. The parameters $\phi , \theta$ and $\mathbf { V }$ are parameterized weights for the feature extractor, neural ODE layer and FC layer, respectively. + +We provide motivation and design guidance for the FC layer V in Section 3.1, which attempts to separate Lyapunov-stable equilibrium points implicitly by maximizing the similarity distance between feature representations corresponding to the $L$ different classes. Experimental results demonstrate the advantages of our diversity promoting FC layer in Section 3.1 with comparisons to traditional neural ODEs without diversity promoting. + +However, the embedded features after using diversity promoting are not guaranteed to locate near the Lyapunov-stable equilibrium points. In Section 3.2, we formulate an optimization problem to force embedding features to locate near the Lyapunov-stable equilibrium points. We introduce optimization constraints to force the Jacobian matrix of the ODE in our neural ODE layer to have eigenvalues with negative real parts at the Lyapunov-stable equilibrium points. Instead of directly imposing constraints on the eigenvalue of the matrix, which may be computationally complex especially when the matrix is large, we add constraints to the matrix elements instead. + +# 3.1 Maximizing the Distance between Lyapunov-Stable Equilibrium Points + +From Section 2, we observe that points in a small neighbourhood of a Lyapunov-stable equilibrium point is robust against adversarial perturbations. We call this neighborhood a stable neighborhood. However Lyapunov-stable equilibrium points for different classes may very well locate near each other and therefore each stable neighborhood may be very small, leading to poor adversarial defense. In this section, we propose to add a FC layer after the neural ODE layer given by (1) to avoid this scenario. The purpose of the FC layer is to map the output of the neural ODE layer to a feature vector $\mathbf { v } _ { l }$ if the input $x$ belongs to the class $l = 1 , \ldots , L$ . We design the FC layer so that the cosine similarities between different $\mathbf { v } _ { l }$ ’s are minimized. + +Lemma 2. Given a set of $k$ unit vectors $\mathbf { v } _ { 1 } , \ldots , \mathbf { v } _ { k }$ in $\mathbb { R } ^ { n }$ , where $n \geq k$ , let $a ( \mathbf { v } _ { 1 } , \ldots , \mathbf { v } _ { k } ) =$ $\mathrm { m a x } _ { i \neq j } { \mathbf { \Delta v } _ { i } ^ { \mathsf { T } } } { \mathbf { v } _ { j } }$ . Then $\operatorname* { m i n } a ( \mathbf { v } _ { 1 } , . . . , \mathbf { v } _ { k } ) = 1 / ( 1 - k )$ , where the minimum is taken over all possible sets of $k$ unit vectors $\mathbf { v } _ { 1 } , \ldots , \mathbf { v } _ { k }$ . + +Corollary 1. Consider a $k \times k$ matrix $\mathbf { B } = [ b _ { i j } ] _ { i , j = 1 } ^ { k }$ with $b _ { i i } = 1$ and $b _ { i j } = 1 / ( 1 - k )$ , $\forall i \ne j$ Let the eigen decomposition of $\mathbf { B }$ be $\mathbf { B } = \mathbf { U } \pmb { \Sigma } \bar { \mathbf { U } } ^ { \dag }$ . For any $n \geq k$ and $i = 1 , \ldots , k$ , let $\mathbf { v } _ { i }$ be the $i$ -th column of $\mathbf { Q } \mathbf { \Sigma } ^ { \mathrm { { X } ^ { 1 / 2 } \bar { U } ^ { \top } } }$ , where $\mathbf { Q }$ is any $n \times k$ matrix such that $\mathbf { Q } ^ { \intercal } \mathbf { Q } = \mathbf { I } _ { k }$ . Then, $a ( \mathbf { v } _ { 1 } , \ldots , \mathbf { v } _ { k } ) = \operatorname* { m a x } _ { i \neq j } \mathbf { v } _ { i } ^ { \mathsf { T } } \mathbf { v } _ { j } = { 1 } / ( 1 - k )$ . + +Corollary 1 suggests a diversity promoting scheme to maximally separate the equilibrium points of the neural ODE layer. The FC layer is represented by an $n \times L$ matrix $\mathbf { V } = \left[ \mathbf { v } _ { 1 } , \ldots , \mathbf { v } _ { L } \right]$ , where $n$ is the dimension of ${ \mathbf z } ( T )$ , the output from the neural ODE layer. If ${ \mathbf z } ( T )$ is generated from an input from class $l$ , it is mapped to $\mathbf { v } _ { l }$ . By minimizing the maximum cosine similarity $a ( \mathbf { v } _ { 1 } , \ldots , \mathbf { v } _ { k } ) = \operatorname* { m a x } _ { i \neq j } \mathbf { v } _ { i } ^ { \mathsf { T } } \mathbf { v } _ { j }$ between the representations from two different classes, we ensure that the output of SODEF is robust to perturbations in the input. Corollary 1 provides a way to choose the FC layer weights $\mathbf { V }$ . + +To validate our observations, we conduct experiments to compare the robustness of ODE net [9] and TisODE [6] with and without our proposed FC layer V, on two standard datasets: MNIST [2] and CIFAR10 [12] 2. On the MNIST dataset, all models consist of four convolutional layers and one fully-connected layer. On the CIFAR10 dataset, the networks are similar to those for MNIST except the down-sampling network is a stack of 2 ResNet blocks. In practice, the neural ODE can be solved with different numerical solvers such as the Euler method and the Runge-Kutta methods [9]. Here, we use Runge-Kutta of order 5 in our experiments. Our implementation builds on the open-source neural ODE codes.3 During training, no Gaussian noise or adversarial examples are augmented into the training set. We test the performance of our model in defending against white-box attacks FGSM [17] and PGD [13] . The parameters for different attack methods used in this paper are given in the supplementary material. From Tables 1 and 2, we observe that for both datasets, our fixed FC layer improves each network’s defense ability by a significant margin. We visualize the features before the final FC layer using t-SNE [20] in Figs. 2 and 3. We observe that with the FC layer, the features for different classes are well separated even under attacks. + +Table 1: Classification accuracy $( \% )$ on adversarial MNIST examples, where the superscript + indicates the last FC layer is fixed to be $\mathbf { V }$ . + +
AttackPara.ODEODE+TisODETisODE+
None-99.699.799.599.7
FGSM∈ = 0.331.452.845.963.5
PGD∈=0.30.290.300.420.20
+ +Table 2: Classification accuracy $( \% )$ on adversarial CIFAR10 examples, where the superscript + indicates the last FC layer is fixed to be $\mathbf { V }$ . + +
AttackPara.ODE ODE+TisODETisODE+
None-87.0 85.087.481.8
FGSM∈ = 0.112.9 47.613.141.9
PGD∈=0.17.8 14.77.416.2
+ +![](images/2298e75b6e25d3394e76c905205ab4b066d9a6a5a3e690669fcd410610b0c475.jpg) +Fig. 2: t-SNE visualization results on the features before the final FC layer. The input is the test set of MNIST. Left: trained with TisODE, middle: TisODE using a randomly chosen orthogonal matrix as the final FC, right: TisODE using proposed $\mathbf { V }$ as the final FC. + +# 3.2 Objective Formulation and Stability + +In this subsection, we formulate an optimization framework for SODEF to force output features to locate within the stable neighborhood of Lyapunov-stable equilibrium points. We make the following assumption. + +Assumption 1. The input x takes values in a compact metric space $X$ and has probability distribution $\mu$ . The feature extractor $h _ { \phi }$ is injective and continuous. + +![](images/7a95cfded3451c7f092fca178fd0f289e9f1e03180a9b9200b577ccb2fbf9ae9.jpg) +Fig. 3: t-SNE visualization results on the features before the final FC layer. The input is the adversarial examples of the test set of MNIST generated using FGSM method at $\epsilon = 0 . 3$ . Left: trained with TisODE, middle: TisODE using a randomly chosen orthogonal matrix as the final FC, right: TisODE using proposed $\mathbf { V }$ as the final FC. + +The above assumption is satisfied if the input $x$ (e.g., an image) resides in a bounded and closed set of a Euclidean space. We denote the pushforward measure (still a probability distribution) of $\mu$ under the continuous feature extractor mapping $h _ { \phi }$ as $\nu _ { \phi } = \mu \circ h _ { \phi } ^ { - 1 }$ , where $\circ$ denotes function composition. The conditional probability distribution for the embedding of each class $l \in \{ 1 , . . . , L \}$ has compact support $E _ { l } \subset \mathbb { R } ^ { n }$ since $E _ { l }$ is closed and $h _ { \phi } ( X )$ is bounded in $\mathbb { R } ^ { n }$ . In Section 3.1, the FC layer $\mathbf { V }$ tries to maximize the distance between $E _ { l }$ , $l = 1 , \ldots , L$ . In this section for analysis purposes, we also assume the following. + +Assumption 2. We have $E _ { l } \bigcap E _ { l ^ { \prime } } = \varnothing i f l \neq l ^ { \prime }$ , i.e., the supports of each class are pairwise disjoint. + +Our objective function is formulated as follows, which is explained in detail in the sequel: + +$$ +\begin{array} { r l } & { \underset { \theta , \phi } { \operatorname* { m i n } } \mathbb { E } _ { \boldsymbol { \mu } } \ell ( { \mathbf { V } } ^ { \top } ( { \mathbf { z } } ( T ) ) , y _ { i } ) } \\ & { \mathrm { s . t . } \ \mathbb { E } _ { \boldsymbol { \nu } _ { \phi } } \| f _ { \theta } ( { \mathbf { z } } ( 0 ) ) \| _ { 2 } < \epsilon , \ f _ { \theta } \in C ^ { 1 } ( \mathbb { R } ^ { n } , \mathbb { R } ^ { n } ) , } \\ & { \quad \quad \quad \mathbb { E } _ { \boldsymbol { \nu } _ { \phi } } \left[ \nabla f _ { \theta } ( { \mathbf { z } } ( 0 ) ) \right] _ { i i } < 0 , \ \forall i = 1 , \ldots , n , } \\ & { \quad \quad \mathbb { E } _ { \boldsymbol { \nu } _ { \phi } } \left[ | [ \nabla f _ { \theta } ( { \mathbf { z } } ( 0 ) ) ] _ { i i } | - \sum _ { j \neq i } | [ \nabla f _ { \theta } ( { \mathbf { z } } ( 0 ) ) ] _ { i j } | \right] > 0 , \ \forall i = 1 , \ldots , n , } \end{array} +$$ + +$\mathbf { z } ( 0 ) = h _ { \phi } ( x )$ , and ${ \mathbf z } ( T )$ is the output of (1) with input ${ \bf z } ( 0 )$ . + +Here, $\ell$ is a loss function and $\epsilon > 0$ is a positive constant. The constraints (3) to (5) force ${ \bf z } ( 0 )$ to be near the Lyapunov-stable equilibrium points with strictly diagonally dominant derivatives. We limit the $f _ { \theta }$ to be in $C ^ { 1 } ( \mathbb { R } ^ { n } , \mathbb { R } ^ { n } )$ to satisfy the condition in Theorem 1. From [21], we also know that standard multi-layer feed forward networks with as few as a single hidden layer and arbitrary bounded and non-constant activation function are universal approximators for $C ^ { 1 ^ { \prime } } ( \mathbb { R } ^ { n } , \mathbb { R } ^ { n } )$ functions with respect to some performance criteria provided only that sufficiently many hidden units are available. + +As a comparison, TisODE [6] only includes a constraint similar to (3), which in general provides no guarantee to force ${ \bf z } ( 0 )$ near the Lyapunov-stable equilibrium points. In the extreme case with parameters $\theta = 0$ for $f _ { \theta }$ such that $f _ { \pmb { \theta } } = 0$ , the ODE degenerates to an identity mapping. No $\mathbf { z } ( 0 ) \in \mathbb { R } ^ { n }$ can now be a Lyapunov-stable equilibrium point, and no stability can therefore be guaranteed to defend against adversarial attacks even though the ODE curves still possess the nonintersecting property and steady-state constraint, which were cited as reasons for the stability of TisODE. + +Instead of directly optimizing the above objective function, in our implementation, we optimize the following empirical Lagrangian with a training set $\left\{ \left( x _ { k } , y _ { k } \right) : k = 1 , { \overset { - } { \ldots } } , N \right\}$ : + +$$ +\begin{array} { l } { \displaystyle \operatorname* { m i n } _ { \theta , \phi } \frac { 1 } { N } \sum _ { k = 0 } ^ { N - 1 } \bigg ( \ell \big ( \mathbf { V } ^ { \top } \mathbf { z } _ { k } ( T ) , y _ { k } \big ) + \alpha _ { 1 } \| f _ { \theta } \big ( \mathbf { z } _ { k } ( 0 ) \big ) \| _ { 2 } + \alpha _ { 2 } g _ { 1 } \Big ( \displaystyle \sum _ { i = 1 } ^ { n } [ \nabla f _ { \theta } ( \mathbf { z } _ { k } ( 0 ) ) ] _ { i i } \Big ) } \\ { \displaystyle \quad \quad + \alpha _ { 3 } g _ { 2 } \Big ( \displaystyle \sum _ { i = 1 } ^ { n } ( - | [ \nabla f _ { \theta } ( \mathbf { z } _ { k } ( 0 ) ) ] _ { i i } | + \displaystyle \sum _ { j \neq i } \vert [ \nabla f _ { \theta } ( \mathbf { z } _ { k } ( 0 ) ) ] _ { i j } | ) \Big ) \bigg ) } \end{array} +$$ + +s. t. $\mathbf { z } _ { k } ( 0 ) = h _ { \phi } ( x _ { k } )$ , and ${ \mathbf z } _ { k } ( T )$ is the output of (1) with input $\mathbf { z } _ { k } ( 0 ) , \forall k = 1 , . . . , N$ (8) + +where $\alpha _ { 1 } , \alpha _ { 2 }$ and $\alpha _ { 3 }$ are hyperparameter weights, $g _ { 1 }$ and $g _ { 2 }$ are chosen monotonically increasing functions bounded below to eliminate the unbounded impact of the two regularizers that can otherwise dominate the loss. In this paper, we set $g _ { 1 } ( \cdot ) = g _ { 2 } ( \cdot ) \bar { = } \exp ( \cdot )$ . We call these two latter terms the SODEF regularizers. + +Suppose for each class $l = 1 , \ldots , L$ , the embedding feature set $E _ { l } = \{ \mathbf { z } _ { 1 } ^ { ( l ) } , \dots , \mathbf { z } _ { k } ^ { ( l ) } \}$ z(l)k } is finite. For each $i = 1 , \ldots , k$ , let $\mathbf { A } _ { i } \in \mathbb { R } ^ { n \times n }$ be strictly diagonally dominant matrix with every main diagonal entry be negative such that the eigenvalues for $\mathbf { A } _ { i }$ all have negative real part. From Theorem 3, each $\mathbf { A } _ { i }$ is non-singular and every eigenvalue of $\mathbf { A } _ { i }$ has negative real part. Therefore, from Theorem 2 and Lemma 1, there exists a function $f _ { \theta }$ such that all $\mathbf { z } _ { i } ^ { ( l ) }$ are Lyapunov-stable equilibrium points with corresponding first derivative $\nabla f _ { \pmb \theta } ( \mathbf z _ { i } ^ { ( l ) } ) = \mathbf { A } _ { i }$ . This shows that if there exist only finite representation points for each class, we can find a function $f _ { \theta }$ such that all inputs to the neural ODE layer are Lyapunov-stable equilibrium points for $f _ { \theta }$ and + +$$ +\begin{array} { r l } & { \mathbb { E } _ { \boldsymbol \nu _ { \phi } } \left\| f _ { \boldsymbol \theta } ( \mathbf { z } ( 0 ) ) \right\| _ { 2 } = 0 , } \\ & { \mathbb { E } _ { \boldsymbol \nu _ { \phi } } \left[ \nabla f _ { \boldsymbol \theta } ( \mathbf { z } ( 0 ) ) \right] _ { i i } < 0 , \forall i = 1 , \ldots , n , } \\ & { \mathbb { E } _ { \boldsymbol \nu _ { \phi } } \left[ | [ \nabla f _ { \boldsymbol \theta } ( \mathbf { z } ( 0 ) ) ] _ { i i } | - \sum _ { j \neq i } \vert [ \nabla f _ { \boldsymbol \theta } ( \mathbf { z } ( 0 ) ) ] _ { i j } \vert \right] > 0 , \forall i = 1 , \ldots , n . } \end{array} +$$ + +If the input space $X$ has infinite cardinality, then an injective and continuous feature extractor $h _ { \phi }$ results in a $\nu _ { \phi }$ with non-finite support, i.e., at least one $E _ { l }$ , $l = 1 , \ldots , L$ , is infinite. It is not obvious whether we can obtain a $f _ { \theta }$ where every point in $\textstyle E = \bigcup _ { l } E _ { l }$ is a stable equilibrium point. The following result gives a negative answer if $\nu _ { \phi }$ is a continuous measure (i.e., absolutely continuous with respect to (w.r.t.) Lebesgue measure) on some subset. + +Lemma 3. If the restriction of $\nu _ { \phi }$ to some open set $E ^ { \prime } \subset E$ is a continuous measure, there is no continuous function fθ such that for $\nu _ { \phi }$ -almost surely all $\mathbf { z } \in E$ , $f _ { \pmb \theta } ( \mathbf z ) = 0$ and all the eigenvalues of $\nabla f _ { \boldsymbol { \theta } } ( \mathbf { z } )$ have negative real parts. In other words, there is no continuous function fθ such that almost surely all $\mathbf { z }$ in $E$ are Lyapunov-stable equilibrium points. + +Lemma 3 indicates that it is too much to hope for all points in $E$ to be Lyapunov-stable equilibrium points. In the following, we relax this requirement and show that under mild conditions, for all $\epsilon > 0$ , we can find a continuous function $f _ { \theta }$ with finitely many stable equilibrium points such that conditions (b) and (c) above hold and condition (a) is replaced by $\mathbb { E } _ { \boldsymbol { \nu } _ { \phi } } \bar { \| } f _ { \theta } ( \mathbf { z } ( 0 ) ) \| _ { 2 } ^ { - } < \epsilon$ . This motivates the optimization constraints in (3) to (5). + +Theorem 4. Suppose Assumptions $I$ and 2. If $\nu _ { \phi }$ is not a continuous uniform measure on $E _ { l }$ for each $l = 1 , \ldots , L$ , then the following holds: 1) The function space satisfying the constraints in (3) to (5) is non-empty for all $\epsilon > 0$ . 2) If additionally the restriction of $\nu _ { \phi }$ to any open set $O \subset E _ { l }$ is not a continuous uniform measure, there exist functions in this space such that each support $E _ { l }$ contains at least one Lyapunov-stable equilibrium point. + +# 4 Experiments + +In this section, we evaluate the robustness of SODEF under adversarial attacks with different attack parameters. We conduct experiments to compare the robustness of ODE net [9] and TisODE net [6] on three standard datasets: MNIST [2], CIFAR10 and CIFAR100 [3]. Since SODEF is compatible with many defense methods, it can be applied to any neural network’s final regressor layer to enhance its stability against adversarial attacks. Our experiment codes are provided in https://github.com/KANGQIYU/SODEF. + +# 4.1 Setup + +We use open-source pre-trained models that achieve the top accuracy on each dataset as the feature extractor $h _ { \phi }$ . Specifically for simple MNIST task, we use the ResNet18 model provided in Pytorch. We use the model provided by [22], which obtains nearly $8 8 \%$ clean accuracy on CIFAR100 using EfficientNet [23] and the model provided by [24], which has nearly $9 5 \%$ clean accuracy on CIFAR10. In the neural ODE layer, $f _ { \theta }$ consists of 2 FC layers. During the trainings of SODEF (except in the experiment included in Section 4.2), we train the neural network with the fixed FC introduced in Section 3.1. In the first 30 epochs, we fixed $f _ { \theta }$ to let the feature extractor $h _ { \phi }$ learn a feature representation with only the cross-entropy loss $\ell$ , and in the remaining 120 epochs, we release $h _ { \phi }$ to further train $f _ { \theta }$ using (7) with $\alpha _ { 1 } = 1$ and $\alpha _ { 2 } = \alpha _ { 3 } = 0 . 0 5$ . For CIFAR10 and CIFAR100, the pixel values are normalized by $( x - \mu ) / \sigma$ where $\mu = [ 0 . 4 9 1 4 , 0 . 4 8 2 2 , 0 . 4 4 6 5 ]$ and $\sigma = [ 0 . 2 0 2 3 , 0 . 1 9 9 4 , 0 . 2 0 1 0 ] ^ { 4 }$ . To show that our SODEF is compatible with many defense methods and can be applied to any neural network’s final regression layer, we conduct an experiment where we use a recently proposed robust network TRADES [25] as the feature extractor in our SODEF. The pretrained model is provided here 5, and we choose the model with architecture "WRN- $3 4 \mathrm { - } 1 0 "$ to conduct our experiments. Besides the two vanilla white-box attacks FGSM and PGD as metioned in Section 3.1, we also include a strong ensemble attack AutoAttack [26], which sequentially performs attack using all of the following four individual attacks: three white-box attacks APGDCE, APGDTDLR and FABT[27], and one black-box Square attack [28]. We refer the reader to the the supplementary material for more details of the attacks used in this paper, where, in additional, more experiments are included. + +# 4.2 Compatibility of SODEF + +Adversarial training (AT) is one of the most effective strategies for defending adversarial attacks. TRADES [25] is one of the adversarial training defense methods with combinations of tricks of warmup, early stopping, weight decay, batch size and other hyper parameter settings. In this experiment we fix the pretained TRADES model (except the final FC layer (size $6 4 0 \mathrm { x } 1 0 )$ ) as our feature extractor $h _ { \phi }$ . We then append our (trainable) SODEF with integration time $T = 5$ to the output of the feature extractor. To evaluate model robustness, we use AutoAttack and attack the models using both the $\mathcal { L } _ { 2 }$ norm $\epsilon = 0 . 5$ ) and $\mathcal { L } _ { \infty }$ norm $( \epsilon = 8 / 2 5 5 )$ ). The results are shown in Table 3. We clearly observe that our SODEF can enhance TRADES’s robustness under all the four individual attacks and the strongest ensemble AutoAttack. For the strong $\mathcal { L } _ { 2 }$ AutoAttack, our SODEF have improved the model robustness from $5 9 . 4 2 \%$ to $6 7 . 7 5 \%$ . Our experiment show that SODEF can be applied to many defense models’ regression layer to enhance their stability against attacks. + +Table 3: Classification accuracy $( \% )$ using TRADES (w/ and w/o SODEF) under AutoAttack on adversarial CIFAR10 examples with $\mathcal { L } _ { 2 }$ norm $\epsilon = 0 . 5 )$ and $\mathcal { L } _ { \infty }$ norm $( \epsilon = 8 / 2 5 5 )$ . + +
Attack /ModelTRADES LTRADES+SODEF LTRADES L2TRADES+SODEF L2
Clean85.4885.1885.48 85.18
APGDcE56.0870.9061.74 74.35
APGDDLR53.7064.1559.22 68.55
FABT54.1882.9260.31 83.15
Square59.1262.2172.65 76.02
AutoAttack53.6957.7659.42 67.75
+ +# 4.3 Influence of Integration Time $T$ + +From the discussion after Theorems 1 and 2, we know if the malicious perturbations around the ODE input Lyapunov-stable equilibrium point ${ \bf z } ( 0 )$ is small, then the output ${ \mathbf z } ( T )$ for large enough $T$ will not be affected significantly by the perturbation: $\| \tilde { { \mathbf z } } ( t ) - { \mathbf z } ( 0 ) \| _ { 2 } \dot { \to } 0$ as $t \to \infty$ . Consequently, the succeeding network layers after the neural ODE layer can still perform well without being affected by the input perturbation. In this section, we test the influence of the SODEF integration time $T$ using CIFAR100. We use the model EfficientNet provided by [23] as $h _ { \phi }$ (Note, unlike Section 4.2, $h _ { \phi }$ is trainable in this experiments). We use AutoAttack with $\mathcal { L } _ { 2 }$ norm $\epsilon = 0 . 5$ ). We observe that for all the four individual attacks and the strongest ensemble AutoAttack, SODEF performs generally better for large integration time $T$ . We also test larger integration time $T > 1 0$ , but do not see any obvious improvements. + +# 4.4 Performance Comparison Under AutoAttack + +For a comparison, we provide the results of applying AutoAttack to other baseline models mentioned in the paper. We set the same integration time for ODE, TisODE and SODEF. We observe that for the + +Table 4: Classification accuracy $( \% )$ under AutoAttack on adversarial CIFAR100 examples with $\mathcal { L } _ { 2 }$ norm, $\epsilon = 0 . 5$ and different integration time $T$ for SODEF. + +
Attack/T135678910
Clean88.0088.1288.1588.0087.9288.0088.0588.10
APGDcE17.2021.3321.0523.6769.6785.3387.1086.88
APGDLR21.0221.0022.0026.0063.3086.9086.2086.54
FABT86.3385.1086.3687.7087.6786.5586.2285.93
Square84.6786.2287.0587.2086.9086.3387.0586.75
AutoAttack2.003.534.874.3330.6678.8078.9779.10
+ +strongest AutoAttack, our SODEF outperforms the other baseline models by a significant margin. In this case, SODEF achieves $7 9 . 1 0 \%$ accuracy while other models only get less than $3 \%$ accuracy. + +Table 5: Classification accuracy $( \% )$ under AutoAttack on adversarial CIFAR100 examples with $\mathcal { L } _ { 2 }$ norm, $\epsilon = 0 . 5$ and $T = 1 0$ . + +
Attack/ModelNoODEODETisODESODEF
Clean88.0087.9088.0088.10
APGDCE23.306.7514.3286.88
7.3322.0024.2086.54
FAB79.3078.6777.1685.93
Square84.5285.6786.3286.75
AutoAttack0.001.334.0679.10
+ +# 4.5 Performance Under PGD and FGSM Attacks + +White-box adversaries have knowledge of the classifier models, including training data, model architectures and parameters. We test the performance of our model in defending against the whitebox attacks, PGD and FGSM. We set $T = 5$ as the integration time for the neural ODE layer. The parameters for different attack methods used are given in the supplementary material. The subsequent experiments use these settings by default, unless otherwise stated. + +Table 6: Classification accuracy $( \% )$ on adversarial MNIST examples. + +
AttackPara.no odeODETisODESODEF
None-99.4599.4299.4399.44
FGSM∈=0.310.0329.636.7063.36
PGD∈= 0.30.311.561.8245.25
+ +The classification results on MNIST are shown in Table 6. We observe that while maintaining the state-of-the-art accuracy on normal images, SODEF improves the adversarial robustness as compared to the other two methods. For the most effective attack in this experiment, i.e., PGD attack, SODEF shows a $4 5 . 2 5 \% - 1 . 5 6 \% = 4 3 . 6 9 \%$ improvement over ODE and a $4 5 . 2 5 \% - 1 . 2 3 \% = 4 4 . 0 2 \%$ improvement over TisODE. + +Table 7: Classification accuracy $( \% )$ on adversarial CIFAR10 examples. + +
AttackPara.no odeODETisODESODEF
None-95.294.995.195.0
FGSM∈=0.147.3145.2343.2868.05
PGD∈=0.13.093.213.8055.59
+ +For CIFAR-10, we see from Table 7 that SODEF maintains high accuracy on normal examples and makes the best predictions under adversarial attacks. In particular, SODEF achieves an absolute percentage point improvement over ODE net up to $5 2 . 3 8 \%$ and over TisODE up to $5 2 . 5 4 \%$ for PGD attack. + +For CIFAR-100, the results in the supplementary material shows that the most effective attack causes the classification accuracy to drop relatively by $\begin{array} { r } { 7 4 . 6 \% = \frac { 8 8 . 0 - 2 2 . 3 5 } { 8 8 . 0 } } \end{array}$ 88.0−22.35 for SODEF and by $\begin{array} { r } { 9 7 . 3 \% = \frac { 8 8 . 3 - 2 . 3 9 } { 8 8 . 3 } } \end{array}$ for vanilla EfficientNet, which is pre-trained on ImageNet to obtain a top clean accuracy. Neither ODE net nor TisODE net can improve the classification accuracy under PGD attack by a big margin, e.g. TisODE net only improves the classification accuracy from $2 . 3 9 \%$ to $3 . 4 4 \%$ , while SODEF still shows clear defense capability in this scenario. + +# 4.6 Ablation Studies + +The impact of the ODE with and without the SODEF regularizers in (7) has been presented in the above comparisons between SODEF and ODE. In this section, we show the necessity of diversity promoting using the FC introduced in Section 3.1 and conduct transferability study. + +# 4.6.1 Impact of Diversity Promotion + +Table 8: Classification accuracy $( \% )$ on adversarial MNIST examples, where the superscript indicates the last FC layer is not fixed to be $\mathbf { V }$ and is set to be a trainable layer. + +
AttackPara.SODEFSODEF-
None-95.095.1
FGSM∈=0.163.3651.6
PGD∈=0.145.2534.9
+ +Table 8 shows the difference of the defense performance when fixing the final FC be $\mathbf { V }$ or setting it to a trainable linear layer. It can be seen that having diversity control improves the robustness. One possible reason for this phenomenon given in Section 3 is that diversity promotion with a fixed designed FC attempts to make the embedding feature support $E _ { l }$ of each class $l$ disjoint to each other and therefore the Lyapunov-stable equilibrium points for each $E _ { l }$ are well separated. + +# 4.6.2 Transferability Study + +Transferability study is carried out on CIFAR-10, where the adversarial examples are generated using FGSM and PGD attacks using ResNet18 without any ODEs. The classification accuracy drops from $6 8 . 0 5 \%$ to $5 9 \%$ for FGSM with $\epsilon = 0 . 3$ , and from $5 5 . 5 9 \%$ to $3 4 \%$ for PGD with $\epsilon = 0 . 1$ . One possible reason for this phenomenon is that ODEs have obfuscated gradient masking effect as discussed in [15], and a transfer attack may deteriorate the defense effect. However, as we observe from Table 7, even with a transfer attack on SODEF, it still performs better than other ODEs without transfer attacks. + +# 5 Conclusion + +In this paper, we have developed a new neural ODE network, SODEF, to suppress input perturbations. SODEF is compatible with any existing neural networks and can thus be appended to the state-of-theart networks to increase their robustness to adversarial attacks. We demonstrated empirically and theoretically that the robustness of SODEF mainly derives from its stability and proposed a training method that imposes constraints to ensure all eigenvalues of the Jacobian matrix of the neural ODE layer have negative real parts. When each classification class converges to its own equilibrium points, we showed that the last FC layer can be designed in such a way that the distance between the stable equilibrium points is maximized, which further improves the network’s robustness. The effectiveness of SODEF has been verified under several popular while-box attacks. + +# Acknowledgments and Disclosure of Funding + +This research is supported in part by A\*STAR under its RIE2020 Advanced Manufacturing and Engineering (AME) Industry Alignment Fund – Pre Positioning (IAF-PP) (Grant No. A19D6a0053) and the RIE2020 Industry Alignment Fund – Industry Collaboration Projects (IAF-ICP) Funding Initiative, as well as cash and in-kind contribution from the industry partner(s). The computational work for this article was partially performed on resources of the National Supercomputing Centre, Singapore (https://www.nscc.sg). + +# Broader Impact + +Our work, which contributes to more robust DNNs, is supposed to mitigate the threat of adversarial attacks. However, on the hand, the reliable deployment of DNNs in automation of tasks will potentially bring mass-scale unemployment and social unrest. As DNNs become more robust and more tasks, especially those whose failures will bring high risks to human lives or large property losses under adversarial attacks, fall into the automatic task category, massive jobs could disappear. + +# References + +[1] A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet classification with deep convolutional neural networks,” in Proc. Advances Neural Inf. Process. Syst., 2012. +[2] Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-based learning applied to document recognition,” Proceedings of the IEEE, vol. 86, no. 11, pp. 2278–2324, Nov. 1998. +[3] G. Hinton, L. Deng, D. Yu, G. E. Dahl, A. Mohamed, N. Jaitly, A. Senior, V. Vanhoucke, P. Nguyen, T. N. Sainath, and B. Kingsbury, “Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups,” IEEE Signal Process. Mag., vol. 29, no. 6, pp. 82–97, Nov. 2012. +[4] D. Andor, C. Alberti, D. Weiss, A. Severyn, A. Presta, K. Ganchev, S. Petrov, and M. Collins, “Globally normalized transition-based neural networks,” in Proc. Annu. Meeting Assoc, Comput. Linguistics, 2016. +[5] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus, “Intriguing properties of neural networks,” in Proc. Int. Conf. Learning Representations, 2013. +[6] H. Yan, J. Du, V. Y. Tan, and J. Feng, “On robustness of neural ordinary differential equations,” in Proc. Advances Neural Inf. Process. Syst., 2018, pp. 1–13. +[7] E. Haber and L. Ruthotto, “Stable architectures for deep neural networks,” Inverse Problems, vol. 34, no. 1, pp. 1–23, Dec. 2017. +[8] X. Liu, S. Si, Q. Cao, S. Kumar, and C.-J. Hsieh, “How does noise help robustness? Explanation and exploration under the neural sde framework,” in Proc. Conf. Comput. Vision Pattern Recognition, 2020, pp. 282–290. +[9] R. T. Chen, Y. Rubanova, J. Bettencourt, and D. Duvenaud, “Neural ordinary differential equations,” arXiv preprint arXiv:1806.07366, 2018. +[10] C.-T. Chen and B. Shafai, Linear system theory and design. New York: Oxford university press New York, 1999. +[11] Y. LeCun, C. Corte, and C. Burges, “MNIST handwritten digit database,” ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, vol. 2, 2010, (Last accessed: Dec 1, 2020). +[12] A. Krizhevsky and G. Hinton, “Learning multiple layers of features from tiny images,” Master’s thesis, Department of Computer Science, University of Toronto, 2009. +[13] A. M ˛adry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu, “Towards deep learning models resistant to adversarial attacks,” in Proc. Int. Conf. Learning Representations, 2018. +[14] E. Haber and L. Ruthotto, “Stable architectures for deep neural networks,” Inverse Problems, vol. 34, no. 1, 2018. +[15] Y. Huang, Y. Yu, H. Zhang, Y. Ma, and Y. Yao, “Adversarial robustness of stabilized neuralodes might be from obfuscated gradients,” arXiv preprint arXiv:2009.13145, 2020. +[16] L. Mingjie, H. Lingshen, and L. Zhouchen, “Implicit Euler skip connections: Enhancing adversarial robustness via numerical stability,” in Proc. Int. Conf. Machine Learning, 2020. +[17] I. J. Goodfellow, J. Shlens, and C. Szegedy, “Explaining and harnessing adversarial examples,” in Proc. Int. Conf. Learning Representations, 2015. +[18] D. Arrowsmith and C. M. Place, Dynamical systems: differential equations, maps, and chaotic behaviour. London: CRC Press, 1992. +[19] R. A. Horn and C. R. Johnson, Matrix analysis. New York: Cambridge university press, 2012. +[20] L. Van der Maaten and G. Hinton, “Visualizing data using t-sne,” J. Mach. Learning Res., vol. 9, no. 11, pp. 2580–2605, Nov. 2008. +[21] K. Hornik, “Approximation capabilities of multilayer feedforward networks,” Neural Networks, vol. 4, no. 2, pp. 251–257, Oct. 1991. +[22] Y. Luo, Y. Wong, S. M. Kankanhalli, and Q. Zhao, “Direction concentration learning: Enhancing congruency in machine learning,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 43, no. 1, pp. 1928 – 1946, Jun. 2021. +[23] M. Tan and Q. Le, “Efficientnet: Rethinking model scaling for convolutional neural networks,” in Proc. Int. Conf. Mach. Learning, 2019, pp. 6105–6114. +[24] Github pytorch-cifar repository. Accessed: May 1, 2021. [Online]. Available: https: //github.com/kuangliu/pytorch-cifar +[25] T. Pang, X. Yang, Y. Dong, H. Su, and J. Zhu, “Bag of tricks for adversarial training,” in Proc. Int. Conf. Learning Representations, 2021. +[26] F. Croce and M. Hein, “Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks,” in Proc. Int. Conf. Mach. Learning, 2020, pp. 2206–2216. +[27] ——, “Minimally distorted adversarial examples with a fast adaptive boundary attack,” in Proc. Int. Conf. Mach. Learning, 2020, pp. 2196–2205. +[28] M. Andriushchenko, F. Croce, N. Flammarion, and M. Hein, “Square attack: a query-efficient black-box adversarial attack via random search,” in Proc. European Conf. Comput. Vision. Springer, 2020, pp. 484–501. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] . See Assumption 1 and Assumption 2 +(b) Did you include complete proofs of all theoretical results? [Yes] . See supplementary material. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] . +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] . See Sections 3.1 and 4 +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Having ODE blocks in our model, it would be too computationally expensive to repeat experiments for many times. We repeated each experiment for 2-3 times and we observe the deviation of the classification results is within $\pm 3 \%$ , though these experimental repetitions are not enough to construct error bars. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 3.1. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] See Sections 3.1 and 4 for the open-source models we have used from GitHub. +(b) Did you mention the license of the assets? [No] . Please see the licenses given in the GitHub link. +(c) Did you include any new assets either in the supplemental material or as a URL? [No] No new assets. +(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] MNIST, CIFAR-10 and CIFAR-100 are all open-source datasets. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] There is no identifiable information or offensive content in the datasets. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/md/train/B1eksh4KvH/B1eksh4KvH.md b/md/train/B1eksh4KvH/B1eksh4KvH.md new file mode 100644 index 0000000000000000000000000000000000000000..79c39064383d0907a5acc61803c3de0b3f543770 --- /dev/null +++ b/md/train/B1eksh4KvH/B1eksh4KvH.md @@ -0,0 +1,258 @@ +# CURRICULARFACE: ADAPTIVE CURRICULUM LEARN-ING LOSS FOR DEEP FACE RECOGNITION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +As an emerging topic in face recognition, designing margin-based loss functions can increase the feature margin between different classes for enhanced discriminability. More recently, absorbing the idea of mining-based strategies is adopted to emphasize the misclassified samples and achieve promising results. However, during the entire training process, the prior methods either do not explicitly emphasize the sample based on its importance that renders the hard samples not fully exploited; or explicitly emphasize the effects of semi-hard/hard samples even at the early training stage that may lead to convergence issue. In this work, we propose a novel Adaptive Curriculum Learning loss (CurricularFace) that embeds the idea of curriculum learning into the loss function to achieve a novel training strategy for deep face recognition, which mainly addresses easy samples in the early training stage and hard ones in the later stage. Specifically, our CurricularFace adaptively adjusts the relative importance of easy and hard samples during different training stages. In each stage, different samples are assigned with different importance according to their corresponding difficultness. Extensive experimental results on popular benchmarks demonstrate the superiority of our CurricularFace over the state-of-the-art competitors. Code will be available upon publication. + +# INTRODUCTION + +The success of Convolutional Neural Networks (CNNs) on face recognition can be mainly credited to : enormous training data, network architectures, and loss functions. Recently, designing appropriate loss functions that enhance discriminative power is pivotal for training deep face CNNs. + +Current state-of-the-art face recognition methods mainly adopt softmax-based classification loss. Since the learned features with the original softmax is not discriminative enough for the open-set face recognition problem, several margin-based variants have been proposed to enhance features’ discriminative power. For example, explicit margin, i.e., CosFace (Wang et al., 2018a), Sphereface (Li et al., 2017), ArcFace (Deng et al., 2019), and implicit margin, i.e., Adacos (Zhang et al., 2019a), supplement the original softmax function to enforce greater intra-class compactness and inter-class discrepancy, which are shown to result in more discriminate features. However, these margin-based loss functions do not explicitly emphasize each sample according to its importance. + +As demonstrated in Chen et al. (2019), hard sample mining is also a critical step to further improve the final accuracy. Recently, Triplet loss (Schroff et al., 2015) and SV-Arc-Softmax (Wang et al., 2018b) integrate the motivations of both margin and mining into one framework for deep face recognition. Triplet loss adopts a semi-hard mining strategy to obtain semi-hard triplets and enlarge the margin between triplet samples. SV-Arc-Softmax (Wang et al., 2018b) clearly defines hard samples as misclassified samples and emphasizes them by increasing the weights of their negative cosine similarities with a preset constant. In a nutshell, mining-based loss functions explicitly emphasize the effects of semi-hard or hard samples. + +However, there are drawbacks in training strategies of both margin- and mining-based loss functions. For margin-based methods, mining strategy is ignored and thus the difficultness of each sample is not fully exploited, which may lead to convergence issues when using a large margin on small backbones, e.g., MobileFaceNet (Chen et al., 2018). As shown in Fig. 1, the modulation coefficient for the negative cosine similarities $I ( \cdot )$ is fixed as a constant 1 in ArcFace for all samples during the entire training process. For mining-based methods, over-emphasizing hard samples in early training stage may hinder the model to converge. As SV-Arc-Softmax claimed, the manually defined constant $t$ plays a key role in the model convergence property and a slight larger value (e.g., ${ > } 1 . 4$ ) may cause the model difficult to converge. Thus $t$ needs to be carefully tuned. + +![](images/26d2e0767b65dd67f07c9b1c61156c4365d57d1148bf6246b32fab974d2aa629.jpg) +Figure 1: Different training strategies for modulating negative cosine similarities of hard samples (i.e., the mis-classified sample) in ArcFace, SV-Arc-Softmax and our CurricularFace. Left: The modulation coefficients $I ( t , \cos \theta _ { j } )$ for negative cosine similarities of hard samples in different methods, where $t$ is an adaptively estimated parameter and $\theta _ { j }$ denotes the angle between the hard sample and the non-ground truth $j$ -class center. Right: The corresponding hard samples’ negative cosine similarities $N ( t , \cos \theta _ { j } ) = I ( t , \cos \theta _ { j } ) \cos \theta _ { j } + c$ after modulation, where $c$ indicates a constant. On one hand, during early training stage (e.g., $t$ is close to 0), hard sample’s negative cosine similarities is usually reduced and thus leads to smaller hard sample loss than the original one. Therefore, easier samples are relatively emphasized; during later training stage (e.g., $t$ is close to 1), the hard sample’s negative cosine similarities are enhanced and thus leads to larger hard sample loss. On the other hand, in the same training stage, we modulate the hard samples’ negative cosine similarities with $\cos \theta _ { j }$ . Specifically, the smaller the angle $\theta _ { j }$ is, the larger the modulation coefficient should be. + +In this work, we propose a novel adaptive curriculum learning loss, termed CurricularFace, to achieve a novel training strategy for deep face recognition. Motivated by the nature of human learning that easy cases are learned first and then come the hard ones (Bengio et al., 2009), our CurricularFace incorporates the idea of Curriculum Learning (CL) into face recognition in an adaptive manner, which differs from the traditional CL in two aspects. First, the curriculum construction is adaptive. In traditional CL, the samples are ordered by the corresponding difficultness, which are often defined by a prior and then fixed to establish the curriculum. In CurricularFace, the samples are randomly selected in each mini-batch, while the curriculum is established adaptively via mining the hard samples online, which shows the diversity in samples with different importance. Second, the importance of hard samples are adaptive. On one hand, the relative importance between easy and hard samples is dynamic and could be adjusted in different training stages. On the other hand, the importance of each hard sample in current mini-batch depends on its own difficultness. + +Specifically, the mis-classified samples in mini-batch are chosen as hard samples and weighted by adjusting the modulation coefficients $I ( t , c o s \theta _ { j } )$ of cosine similarities between the sample and the non-ground truth class center vectors, i.e., negative cosine similarity $N ( t , c o s \theta _ { j } )$ . To achieve the goal of adaptive curricular learning in the entire training, we design a novel coefficient function $I ( \cdot )$ that is determined by two factors: 1) the adaptively estimated parameter $t$ that utilizes moving average of positive cosine similarities between samples and the corresponding ground-truth class center to unleash the burden of manually tuning; and 2) the angle $\theta _ { j }$ that defines the difficultness of hard samples to achieve adaptive assignment. To sum up, the contributions of this work are: + +• We propose an adaptive curriculum learning loss for face recognition, which automatically emphasizes easy samples first and hard samples later. To the best of our knowledge, it is the first work to introduce the idea of adaptive curriculum learning for face recognition. We design a novel modulation coefficient function $I ( \cdot )$ to achieve adaptive curriculum learning during training, which connects positive and negative cosine similarity simultaneously without the need of manually tuning any additional hyper-parameter. • We conduct extensive experiments on popular facial benchmarks, which demonstrate the superiority of our CurricularFace over the state-of-the-art competitors. + +# RELATED WORK + +Margin-based loss function Loss design is pivotal for large-scale face recognition. Current stateof-the-art deep face recognition methods mostly adopt softmax-based classification loss. Since the learned features with the original softmax loss are not guaranteed to be discriminative enough for open-set face recognition problem, margin-based losses (Liu et al., 2016; Li et al., 2017; Deng et al., 2019) are proposed. Though the margin-based loss functions are verified to obtain good performance, they do not take the difficultness of each sample into consideration, while our CurricularFace emphasizes easy samples first and hard samples later, which is more reasonable and effectiveness. + +Mining-based loss function Though some mining-based loss function such as Focal loss (Lin et al., 2017), Online Hard Sample Mining (OHEM) (Shrivastava et al., 2016) are prevalent in the field of object detection, they are rarely used in face recognition. OHEM focuses on the large-loss samples in one mini-batch, in which the percentage of the hard samples is empirically determined and easy samples are completely discarded. Focal loss is a soft mining variant that rectifies the loss function to an elaborately designed form, where two hyper-parameters should be tuned with a lot of efforts to decide the weights of each samples and hard samples are emphasized by reducing the weight of easy samples. The recent work, SV-Arc-Softmax (Wang et al., 2018b) fuses the motivations of both margin and mining into one framework for deep face recognition. They define hard samples as misclassified samples and enlarge the weight of hard samples with a preset constant. Our method differs from SV-Arc-Softmax in three aspects: 1) We do not always emphasize the hard samples, especially in the early training stages. 2) We assign different weights for hard samples according to their corresponding difficultness. 3) There’s no need in our method to manually tune the additional hyper-parameter $t$ , which is estimated adaptively. + +Curriculum Learning Learning from easier samples first and harder samples later is a common strategy in Curriculum Learning (CL) (Bengio et al., 2009), (Zhou & Bilmes, 2018). The key problem in CL is to define the difficultness of each sample. For example, Basu & Christensen (2013) takes the negative distance to the boundary as the indicator for easiness in classification. However, the ad-hoc curriculum design in CL turns out to be difficult to implement in different problems. To alleviate this issue, Kumar et al. (2010) designs a new formulation, called Self-Paced Learning (SPL), where examples with lower losses are considered to be easier and emphasized during training. The key differences between our CurricularFace with SPL are: 1) Our method focuses on easier samples in the early training stage and emphasizes hard samples in the later training stage. 2) Our method proposes a novel modulation function $N ( \cdot )$ for negative cosine similarities, which achieves not only adaptive assignment on modulation coefficients $I ( \cdot )$ for different samples in the same training stage, but also adaptive curriculum learning strategy in different training stages. + +# THE PROPOSED CURRICULARFACE + +PRELIMINARY KNOWLEDGE ON LOSS FUNCTION + +The original softmax loss is formulated as follows: + +$$ +\mathcal { L } = - \log \frac { e ^ { W _ { y _ { i } } x _ { i } + b _ { y _ { i } } } } { \sum _ { j = 1 } ^ { n } e ^ { W _ { j } x _ { i } + b _ { j } } } , +$$ + +where $x _ { i } \in R ^ { d }$ denotes the deep feature of $i$ -th sample which belongs to the $y _ { i }$ class, $W _ { j } \in R ^ { d }$ denotes the $j$ -th column of the weight $W \in R ^ { d \times n }$ and $b _ { j }$ is the bias term. The class number and the embedding feature size are $n$ and $d$ , respectively. In practice, the bias is usually set to $b _ { j } = 0$ and the individual weight is set to $| | W _ { j } | | = 1$ by $l _ { 2 }$ normalization. The deep feature is also normalized and re-scaled to $s$ . Thus, the original softmax can be modified as follows: + +$$ +\mathcal { L } = - \log \frac { e ^ { s ( \cos \theta _ { y _ { i } } ) } } { e ^ { s ( \cos \theta _ { y _ { i } } ) } + \sum _ { j = 1 , j \neq y _ { i } } ^ { n } e ^ { s ( \cos \theta _ { j } ) } } . +$$ + +Since the learned features with original softmax loss may not be discriminative enough for open-set face recognition problem, several variants are proposed and can be formulated in a general form: + +$$ +\mathcal { L } = - G ( \boldsymbol { p } ( \boldsymbol { x } _ { i } ) ) \log \frac { e ^ { s T ( \cos \theta _ { y _ { i } } ) } } { e ^ { s T ( \cos \theta _ { y _ { i } } ) + \sum _ { j = 1 , j \neq y _ { i } } ^ { n } e ^ { s N ( t , \cos \theta _ { j } ) } } , } +$$ + +where $\begin{array} { r l r } { p ( x _ { i } ) } & { = } & { \frac { e ^ { s T ( \cos \theta _ { y _ { i } } ) } } { e ^ { s T ( \cos \theta _ { y _ { i } } ) + \sum _ { j = 1 , j \neq y _ { i } } ^ { n } e ^ { s N ( t , \cos \theta _ { j } ) } } } } \end{array}$ esN(t,cos θj) is the predicted ground truth probability and $G ( \boldsymbol { p } ( \boldsymbol { x } _ { i } ) )$ is an indicator function. $T ( \cos \theta _ { y _ { i } } )$ and $N ( t , \cos \theta _ { j } ) = I ( t , \cos \theta _ { j } ) \cos \theta _ { j } + c$ are the functions to modulate the positive and negative cosine similarities, respectively, where $c$ is a constant, and $I ( t , \cos \theta _ { j } )$ denotes the modulation coefficients of negative cosine similarities. In margin-based loss function, e.g, ArcFace, $G ( p ( x _ { i } ) ) = 1$ , $T ( \cos \theta _ { y _ { i } } ) = \cos ( \theta _ { y _ { i } } + m )$ , and $N ( t , \cos \theta _ { j } ) = \cos \theta _ { j }$ . It only modifies the positive cosine similarity of each sample to enhance the feature discrimination. As shown in Fig. 1, the modulation coefficients of each sample’ negative cosine similarity $I ( \cdot )$ is fixed as 1. The recent work, SV-Arc-Softmax emphasizes hard samples by increasing $I ( t , \cos \theta _ { j } )$ for hard samples. That is, $G ( p ( x _ { i } ) ) = 1$ and $N ( t , \mathrm { c o s } _ { \theta _ { j } } )$ is formulated as follows: + +$$ +N ( t , c o s _ { \theta _ { j } } ) = \left\{ \begin{array} { l l } { \cos \theta _ { j } , } & { T ( \cos \theta _ { y _ { i } } ) - \cos \theta _ { j } \geq 0 } \\ { t \cos \theta _ { j } + t - 1 , } & { T ( \cos \theta _ { y _ { i } } ) - \cos \theta _ { j } < 0 . } \end{array} \right. +$$ + +If a sample is defined to be easy, its negative cosine similarity is kept the same as the original one, $\cos \theta _ { j }$ ; if as a hard sample, its negative cosine similarity becomes $t \cos \theta _ { j } + t - 1$ . That is, as shown in Fig. 1, $I ( \cdot )$ is a constant and determined by a preset hyper-parameter $t$ . Meanwhile, since $t$ is always larger than 1, $t \cos \theta _ { j } + t - 1 > \cos \theta _ { j }$ always holds true, which means the model always focuses on hard samples, even in the early training stage. However, the parameter $t$ is sensitive that a large pre-defined value $( e . g . , > 1 . 4 ,$ ) may lead to convergence issue. + +# ADAPTIVE CURRICULAR LEARNING LOSS + +Next, we present the details of our proposed adaptive curriculum learning loss, which is the first attempt to introduce adaptive curriculum learning into deep face recognition. The formulation of our loss function is also contained in the general form, where $G ( p ( x _ { i } ) ) = 1$ , positive and negative cosine similarity functions are defined as follows: + +$$ +T ( \cos \theta _ { y _ { i } } ) = \cos ( \theta _ { y _ { i } } + m ) , +$$ + +$$ +N ( t , \cos _ { \theta _ { j } } ) = \left\{ { \begin{array} { l l } { \cos \theta _ { j } , } & { T ( \cos \theta _ { y _ { i } } ) - \cos \theta _ { j } \geq 0 } \\ { \cos \theta _ { j } ( t + \cos \theta _ { j } ) , } & { T ( \cos \theta _ { y _ { i } } ) - \cos \theta _ { j } < 0 . } \end{array} } \right. +$$ + +It should be noted that the positive cosine similarity can adopt any margin-based loss functions and here we adopt ArcFace as the example. As shown in Fig. 1, the modulation coefficient of hard sample negative cosine similarity $I ( t , \bar { \theta _ { j } } )$ depends on both the value of $t$ and $\theta _ { j }$ . In the early training stage, learning from easy samples is beneficial to model convergence. Thus, $t$ should be close to zero and $I ( \cdot )$ is smaller than 1. Therefore, the weights of hard samples are reduced and the easy samples are emphasized relatively. As training goes on, the model gradually focuses on the hard samples, i.e., the value of $t$ shall increase and $I ( \cdot )$ is larger than 1. Then, the weights of hard samples are enlarged, which are thus emphasized. Moreover, within the same training stage, $I ( \cdot )$ is monotonically decreasing with $\theta _ { j }$ so that harder sample can be assigned with larger coefficient according to its difficultness. The value of the parameter $t$ is automatically estimated in our CurricularFace, otherwise it would require a lot of efforts for manually tuning. + +Adaptive estimation of $t$ It is critical to determine appropriate values of $t$ in different training stages. Ideally the value of $t$ can indicate the model training process. We empirically find the average of positive cosine similarities is a good indicator. However, mini-batch statistic-based methods usually face an issue: when many extreme data are sampled in one mini-batch, the statistics can be vastly noisy and the estimation will be unstable. Exponential Moving Average (EMA) is a common solution to address this issue (Li et al., 2019). Specifically, let $r ^ { ( k ) }$ be the average of the positive cosine similarities of the $k$ -th batch and be formulated as $\begin{array} { r } { r ^ { ( k ) } = \sum _ { i } \cos \theta _ { y _ { i } } } \end{array}$ , we have: + +$$ +t ^ { ( k ) } = \alpha r ^ { ( k ) } + ( 1 - \alpha ) t ^ { ( k - 1 ) } , +$$ + +where $t ^ { 0 } = 0$ , $\alpha$ is the momentum parameter and set to 0.99. As shown in Fig. 2, the parameter $t$ increases with the model training, thus the gradient modulation coefficients’ range of hard sample, $M ( \cdot ) = 2 \cos \theta _ { j } + t$ , also increases. Therefore, hard samples are emphasized gradually. With the EMA, we avoid the hyper-parameter tuning and make the modulation coefficients of hard sample + +# Algorithm 1: CurricularFace + +Input: The deep feature of $_ { i }$ -th sample $x _ { i }$ with its corresponding label $y _ { i }$ , last fully-connected layer parameters $W$ , cosine similarity $\cos \theta _ { j }$ between two vectors, embedding network parameters $\Theta$ , learning rate $\lambda$ , number of iteration $k$ , parameter $t$ , and margin $m$ +$k 0$ , $t \gets 0$ , $m \gets 0 . 5$ ; +while not converged do $k \gets k + 1$ ; if $\cos ( \theta _ { y _ { i } } + m ) > \cos \theta _ { j }$ then $N ( t , \cos \theta _ { j } ) = \cos \theta _ { j }$ ; else $\begin{array} { r l } { \small \int _ { - \infty } ( t , \cos \theta _ { j } ) = ( t ^ { ( k ) } + \cos \theta _ { j } ) \cos \theta _ { j } \ ; } \end{array}$ end $T ( \cos \theta _ { y _ { i } } ) = \cos ( \theta _ { y _ { i } } + m )$ ; Compute the loss $\mathcal { L }$ by Eq. 8; Compute the back-propagation error of $x _ { i }$ and $W _ { j }$ by Eq. 9; Update the parameters $W$ and $\Theta$ by: $\begin{array} { r } { \boldsymbol { W } ^ { ( k + 1 ) } = \boldsymbol { W } ^ { ( k ) } - \lambda ^ { ( k ) } \frac { \partial \boldsymbol { L } } { \partial \boldsymbol { W } } , \Theta ^ { ( k + 1 ) } = \Theta ^ { ( k ) } - \lambda ^ { ( k ) } \frac { \partial \boldsymbol { L } } { \partial x _ { i } } \frac { \partial x _ { i } } { \partial \Theta ^ { ( k ) } } ; } \end{array}$ Update the parameter $t$ by Eq. 7; + +negative cosine similarities $I ( \cdot )$ adaptive to the current training stage. To sum up, the loss function of our CurricularFace is formulated as follows: + +$$ +\mathcal { L } = - \log \frac { e ^ { s \cos ( \theta _ { y _ { i } } + m ) } } { e ^ { s \cos ( \theta _ { y _ { i } } + m ) } + \sum _ { j = 1 , j \neq y _ { i } } ^ { n } e ^ { s N ( t ^ { ( k ) } , \cos \theta _ { j } ) } } , +$$ + +where $N ( t ^ { ( k ) } , \cos \theta _ { j } )$ is defined in Eq. 6. The entire training process is summarized in Algorithm 1. + +Fig. 3 illustrates how the loss changes from ArcFace to our CurricularFace during training. Here are some observations: 1) As we excepted, hard samples are suppressed in early training stage but emphasized later. 2) The ratio is monotonically increasing with $c o s \theta _ { j }$ , since the larger $c o s \theta _ { j }$ is, the harder the sample is. 3) The positive cosine similarity of a perceptualwell image is often large. However, during the early training stage, the negative cosine similarities of the perceptual-well image may also be large so that it could be classified as the hard one. + +Optimization Next, we show our CurricularFace can be easily optimized by the conventional stochastic gradient descent. Assuming $x _ { i }$ denotes the deep feature of $i$ -th sample which belongs to the $y _ { i }$ class, the input of the proposed function is the logit $f _ { j }$ , where $j$ denotes the $j$ -th class. + +![](images/f87305e9b5fbc1a980f008019d65e600689158bf54c829bba1922eba29835748.jpg) +Figure 2: Illustrations on the adaptive parameter $t$ (red line) and gradient modulation coefficients $M ( \cdot ) = 2 \cos \theta _ { j } + t$ of hard samples (green area). Since the number of mined hard samples reduces with the model training, the green area $M ( \cdot )$ is relatively smooth in early stage and there are some burrs in later stage. + +In the forwarding process, when $j ~ = ~ y _ { i }$ , it is the same as the ArcFace, i.e., $f _ { j } = s T ( \cos \theta _ { y _ { i } } )$ $T ( \cos \theta _ { y _ { i } } ) = \cos ( \theta _ { y _ { i } } + m )$ . When $j \neq y _ { i }$ , it has two cases, if $x _ { i }$ is an easy sample, it is the the same as the original softmax, i.e., $f _ { j } = s \cos \theta _ { j }$ . Otherwise, it will be modulated as $f _ { j } = s N ( t , \cos \theta _ { j } )$ , where $N ( t , \cos \theta _ { j } ) = ( t + \cos \theta _ { j } ) \cos \theta _ { j }$ . In the backward propagation process, the gradient of $x _ { i }$ and $W _ { j }$ can also be divided into three cases and formulated as follows: + +$$ +\frac { \partial L } { \partial x _ { i } } = \left\{ \begin{array} { l l } { \frac { \partial L } { \partial f _ { y _ { i } } } ( s \frac { \sin ( \theta _ { y _ { i } } + m ) } { \sin \theta _ { y _ { i } } } ) W _ { y _ { i } } , } & { j = y _ { i } } \\ { \frac { \partial L } { \partial f _ { j } } s W _ { j } , } & { j \neq y _ { i } , \mathrm { e a s y } , \frac { \partial L } { \partial W _ { j } } = \left\{ \begin{array} { l l } { \frac { \partial L } { \partial f _ { y _ { i } } } ( s \frac { \sin ( \theta _ { y _ { i } } + m ) } { \sin \theta _ { y _ { i } } } ) x _ { i } , } & { j = y _ { i } } \\ { \frac { \partial L } { \partial f _ { j } } s x _ { i } , } & { j \neq y _ { i } , \mathrm { e a s y } } \\ { \frac { \partial L } { \partial f _ { j } } s ( 2 \cos \theta _ { j } + t ) W _ { j } } & { j \neq y _ { i } , \mathrm { h a r d } } \end{array} \right. , } \end{array} \right. +$$ + +Based on the above formulations, we can find the gradient magnitude of the hard sample is determined by two parts, the negative cosine similarity $N ( \cdot )$ and the value of $t$ . + +![](images/6fdc953ddf73803d98dfe75a3455d0cdaea039f32fc11eb887efddabe900eb44.jpg) +Figure 3: Illustrations on (ratio between our loss and ArcFace, maximum $c o s \theta _ { j }$ ) from early (Top) to later (Bottom) training stages. + +Table 1: Decision boundaries of popular loss functions. + +
LossDecision Boundary
SoftmaxcosOy=cos0j
SphereFacecos(m0y)=cos0j
CosFacecosθy-m=cos0j
ArcFacecos(0y;+m)=cos0j
SV-Arc-Softmaxcos(0y+m)=cos0j(easy)cos(0y;+m)=tcos0j+t-i(hard)
CurricularFace (Ours)cos(0yi+m)=cos0j (easy)cos(0y:+m)=(t+cos0j) cos0j(hard)
+ +Table 2: Verification performance of different values of $t$ + +
Dataset (%)t=0t=0.3t=0.7t=1Adaptive t
LFW99.3299.3799.4299.4599.47
CFP-FP95.9096.4796.6693.9496.96
+ +# DISCUSSIONS WITH SOTA LOSS FUNCTIONS + +Comparison with ArcFace and SV-Arc-Softmax We first discuss the difference between our CurricularFace and the two competitors, ArcFace and SV-Arc-Softmax, from the perspective of the decision boundary in Tab. 1. ArcFace introduces a margin function $T ( \cos \theta _ { y _ { i } } ) \dot { ~ = ~ } \dot { \cos ( \theta _ { y _ { i } } + m ) }$ from the perspective of positive cosine similarity. As shown in Fig. 4, its decision condition changes from $\cos \theta _ { y _ { i } } = \cos \theta _ { j }$ (i.e., blue line) to $\cos ( \dot { \theta } _ { y _ { i } } + m ) = \cos \bar { \theta } _ { j }$ (i.e., red line) for each sample. SV-Arc-Softmax introduces additional margin from the perspective of negative cosine similarity for hard samples, and the decision boundary becomes $\cos ( \theta _ { y _ { i } } + m ) = t \cos \theta _ { j } + t - 1$ (i.e., green line). Conversely, we adaptively adjust the weights of hard samples in different training stages. The decision condition becomes $\cos ( \theta _ { y _ { i } } + m ) = ( t + \cos \theta _ { j } ) \cos \theta _ { j }$ (i.e., purple line). During the training stage, the decision boundary for hard samples changes from one purple line (early stage) to another (later stage), which emphasizes easy samples first and hard samples later. + +Comparison with Focal loss Focal loss is a soft mining-based loss, which is formulated as: $G ( \bar { p ( x ) } ) = \alpha ( 1 - p ( x _ { i } ) ) ^ { \beta }$ , where $\alpha$ and $\beta$ are modulating factors that need to be tuned manually. The definition of hard samples in Focal loss is ambiguous, since it always focuses on relatively hard samples by reducing the weight of easier samples during the entire training process. In contrast, the definition of hard samples in our CurricularFace is more clear, i.e., mis-classified samples. Meanwhile, the weights of hard samples are adaptively determined in different training stages. + +# EXPERIMENTS + +# IMPLEMENTATION DETAILS + +Datasets We separately employ CASIA-WebFace (Yi et al., 2014) and refined MS1MV2 (Deng et al., 2019) as our training data for fair comparisons with other methods. We extensively test our method on several popular benchmarks, including LFW (Huang et al., 2007), CFP-FP (Sengupta et al., 2016), CPLFW (Zheng et al., 2018), AgeDB (Moschoglou et al., 2017), CALFW (Zheng et al., 2017), IJB-B (Whitelam et al., 2017), IJB-C (Maze et al., 2018), and MegaFace (KemelmacherShlizerman et al., 2016). + +Training Setting We follow Deng et al. (2019) to generate the normalised faces $( 1 1 2 \times 1 1 2 )$ with five landmarks (Zhang et al., 2016). For the embedding network, we adopt ResNet50 and ResNet100 as in Deng et al. (2019). Our framework is implemented in Pytorch (Paszke et al., 2017). We train models on 4 NVIDIA Tesla P40 (24GB) GPU with batch size 512. The models are trained with SGD algorithm, with momentum 0.9 and weight decay $5 e - 4$ . On CASIA-WebFace, the learning rate starts from 0.1 and is divided by 10 at 28, 38, 46 epochs. The training process is finished at 50 epochs. On MS1MV2, we divide the learning rate at 10, 18, 22 epochs and finish at 24 epochs. We follow the common setting as Deng et al. (2019) to set scale $s = 6 4$ and margin $m = 0 . 5$ , respectively. Last but not least, since we only modify the loss function but use the same backbone as previous methods (e.g., ArcFace), NO additional time complexity is introduced for inference. + +![](images/86c3df2d7b59ac8a5f55c0d97984177013a5da36e1db12403de19ad2a54b37ce.jpg) +Figure 4: From left to right, decision boundaries of ArcFace, SV-Arc-Softmax, and ours. Blue line, red line, green line and purple line denote the decision boundary of Softmax, ArcFace, SV-Arc-Softmax, and ours, respectively. $m$ denotes the angular margin added by ArcFace. $d$ denotes the additional margin of SVArc-Softmax and ours. In SV-Arc-Softmax, $d = ( t - 1 ) \cos \theta _ { j } +$ $t - 1$ . In ours, $d = ( t + \cos \theta _ { j } - 1 ) \cos \theta _ { j }$ . + +Table 3: Verification performance of different strategies for setting t. + +![](images/9afdd5c6df3e867859846790a9f8b63d321161a6b48085b8dba8a391ec959dc7.jpg) +Figure 5: Illustration on convergence issue with small backbone. + +# ABLATION STUDY + +Effects on Fixed vs. Adaptive Parameter $t$ We first investigate the effect of adaptive estimation of $t$ . We choose four fixed values between 0 and 1 for comparison. Specifically, 0 means the modulation coefficient $I ( \cdot )$ of each hard sample’s negative cosine similarity is always reduced based on its difficultness. In contrast, 1 means the hard samples are always emphasized. 0.3 and 0.7 are between the two cases. Tab. 2 shows that it is more effective to learn from easier samples first and hard samples later based on our adaptively estimated parameter $t$ . + +Effects on Different Statistics for Estimating $t$ We now investigate the effects of several other statistics, i.e., mode of positive cosine similarities in a mini-batch, or mean of the predicted ground truth probability for estimating $t$ in our loss. As Tab. 3 shows, on one hand, the mean of positive cosine similarities is better than the mode. On the other hand, the positive cosine similarity is more accurate than the predicted ground truth probability to indicate the training stages. + +Robustness on Training Convergence As claimed in Li (2019), ArcFace exists divergence issue when using small backbones like MobileFaceNet. As the result, softmax loss must be incorporated for pre-training. To illustrate the robustness of our loss function on convergence issue with small backbone, we use the MobileFaceNet as the network architecture and train it on CASIA-WebFace. As shown in Fig. 5, when the margin $m$ is set to 0.5, the model trained with our loss achieves 99.25 accuracy on LFW, while the model trained with ArcFace does not converge and the loss is NAN at about 2, 400-th step. When the margin $m$ is set to 0.45, both losses can converge, but our loss achieves better performance $( 9 9 . 2 0 \%$ vs. $9 9 . 1 0 \%$ ). Comparing the yellow and red curves, since the losses of hard samples are reduced in early training stages, our loss converges much faster in the beginning, leading to lower loss than ArcFace. Later on, the value of our loss is slightly larger than ArcFace, because we emphasize the hard samples in later stages. The results prove that learning from easy samples first and hard samples later is beneficial to model convergence. + +# COMPARISONS WITH SOTA METHODS + +Results on LFW, CFP-FP, CPLFW, AgeDB and CALFW Next, we train our CurricularFace on dataset MS1MV2 with ResNet100, and compare with the SOTA competitors on various benchmarks, including LFW for unconstrained face verification, CFP-FP and CPLFW for large pose variations, AgeDB and CALFW for age variations. As reported in Tab. 4, our CurricularFace achieves comparable result (i.e., $9 9 . 8 0 \%$ ) with the competitors on LFW where the performance is near saturated. While for both CFP-FP and CPLFW, our method shows superiority over the baselines including general methods, e.g., (Wen et al., 2016), (Cao et al., 2018b), and cross-pose methods, e.g., (Tran et al., 2017), (Peng et al., 2017), (Cao et al., 2018a) and (Deng et al., 2018). As a recent face recognition method, SV-Arc-Softmax achieves better performance than ArcFace, but still worse than Our CurricularFace. Finally, for AgeDB and CALFW, as Tab. 4 shows, our CurricularFace again achieves the best performance than all of the other state-of-the-art methods. + +Table 4: Verification comparison with SOTA methods on various small-scale benchmarks. + +
Methods (%)LFWCFP-FPCPLFWAgeDBCALFW
Center Loss (ECCV'16)98.75177.48185.48
SphereFace (CVPR'17)99.2781.4090.30
DRGAN (CVPR'17)193.4111
Peng et al. (ICCV'17)93.76
VGGFace2 (FG'18)99.4384.0090.57
Dream (CVPR'18)193.98
Deng et al.(CVPR'18)99.6094.05
ArcFace (CVPR'19)99.7798.2792.0898.1595.45
SV-Arc-Softmax99.7898.2892.8397.9596.10
CurricularFace (Ours)99.8098.3793.1398.3296.20
+ +Table 5: 1:1 verification TAR ( ${ \bf @ F A R = }$ 1e − 4) on IJB-B and IJB-C. + +
Methods (%)IJB-BIJB-C
SENet50 (FG'18)80.084.1
Multicolumn (BMVC'18)83.186.2
DCN (ECCV'18)84.988.5
ArcFace-R100 (CVPR'19)94.295.6
Adacos (CVPR'19)192.4
P2SGrad (CVPR'19)192.3
PFE (ICCV'19)93.3
SV-Arc-Softmax93.695.2
CurricularFace (Ours)94.896.1
+ +Table 6: Verification comparison with SOTA methods on MegaFace Challenge 1 using FaceScrub as the probe set. Left table: ‘Id’ refers to the rank-1 face identification accuracy with 1M distractors, and ‘Ver’ refers to the face verification TAR at $1 0 ^ { - 6 }$ FAR. ‘R’ refers to data refinement on both probe set and 1M distractors. Right figure: Rank-1 identification results of recent SOTA methods on probe set refined from ArcFace. + +
CASIA(%)IdVerMS1MV2(%)IdVerCosFace(CVPR’18)- 97.91
Contrastive Loss (CVPR'14)65.2178.86CosFace-MS1MV2-R10080.5696.56
Triplet (CVPR'15)64.7978.32CosFace-MS1MV2-R100, R97.9197.91Adacos (CVPR'19)-97.41
Center Loss (ECCV'16)65.4980.14ArcFace-MS1MV2-R10081.0396.98
SphereFace(CVPR'17)72.7385.56ArcFace-MS1MV2-R100, R98.3598.48P2SGrad (CVPR’19)-97.25
CosFace (CVRP'18)77.1189.88PFE (ICCV'19)78.9592.51AreFace (CVPR'19)-98.35
AM-Softmax (SPL'18)72.4784.44Adacos,R(CVPR'19')97.41
ArcFace-CASIA-R50 (CVPR'19)77.5092.34P2SGrad,R(CVPR'19')97.25SV-Arc-Softmax (arXiv'19)- 97.14
ArcFace-CASIA-R50, R91.7593.69SV-Arc-Softmax,R97.1497.57
Ours-CASIA-R5077.6592.91Ours-MS1MV2-R10081.2697.26CurricularFace (Ours)-98.71
Ours-CASIA-R50, R92.4894.55Ours-MS1MV2-R100, R98.7198.6497
+ +Results on IJB-B and IJB-C The IJB-B dataset contains 1, 845 subjects with 21.8K still images and 55K frames from 7, 011 videos. In the 1:1 verification, there are 10, 270 positive matches and 8M negative matches. The IJB-C dataset is a further extension of IJB-B, which contains about 3, 500 identities with a total of 31, 334 images and 117, 542 unconstrained video frames. In the 1:1 verification, there are 19, 557 positive matches and 15, 638, 932 negative matches. On IJB-B and IJB-C datasets, we employ MS1MV2 and the ResNet100 for a fair comparison with recent methods. We follow the testing protocol in ArcFace and take the average of the image features as the corresponding template representation without bells and whistles. Tab. 5 exhibits the performance of different methods, e.g., Multicolumn (Xie & Zisserman, 2018), DCN (Xie et al., 2018), Adacos (Zhang et al., 2019a), P2SGrad (Zhang et al., 2019b), PFE (Shi et al., 2019) and SV-Arc-Softmax (Wang et al., 2018b) on IJB-B and IJB-C 1:1 verification, our method again achieves the best performance. + +Results on MegaFace Finally, we evaluate the performance on the MegaFace Challenge. The gallery set of MegaFace includes 1M images of 690K subjects, and the probe set includes 100K photos of 530 unique individuals from FaceScrub. We report the two testing results under two protocols (large or small training set). Here, we use CASIA-WebFace and MS1MV2 under the small protocol and large protocol, respectively. In Tab. 6, our method achieves the best singlemodel identification and verification performance under both protocols, surpassing the recent strong competitors, e.g., CosFace, ArcFace, Adacos, P2SGrad and PFE. We also report the results following the ArcFace testing protocol, which refines both the probe set and the gallery set. As shown from the figure in Tab. 6, our method still clearly outperforms the competitors and achieves the best performance on both verification and identification. + +# CONCLUSIONS + +In this paper, we propose a novel Adaptive Curriculum Learning Loss that embeds the idea of adaptive curriculum learning into deep face recognition. Our key idea is to address easy samples in the early training stage and hard ones in the later stage. Our method is easy to implement and robust to converge. Extensive experiments on popular facial benchmarks demonstrate the effectiveness of our method compared to the state-of-the-art competitors. Following the main idea of this work, future research can be expanded in various aspects, including designing a better function $N ( \cdot )$ for negative cosine similarity that shares similar adaptive characteristic during training, and investigating the effects of noise samples that could be optimized as hard samples. + +# REFERENCES + +Sumit Basu and Janara Christensen. Teaching classification boundaries to humans. In AAAI, 2013. + +Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ ICML, 2009. + +Kaidi Cao, Yu Rong, Cheng Li, Xiaoou Tang, and Chen Change Loy. Pose-robust face recognition via deep residual equivariant mapping. In CVPR, 2018a. + +Qiong Cao, Li Shen, Weidi Xie, Omkar M. Parkhi, and Andrew Zisserman. Vggface2: A dataset for recognising faces across pose and age. In FG, 2018b. + +Beidi Chen, Weiyang Liu, Animesh Garg, Zhiding Yu, Anshumali Shrivastava, and Anima Anandkumar. Angular visual hardness. In ICML Workshop on Deep Phenomena, 2019. + +Sheng Chen, Yang Liu, Xiang Gao, and Zhen Han. Mobilefacenets: Efficient cnns for accurate real-time face verification on mobile devices. In CCBR, 2018. + +Jiankang Deng, Shiyang Cheng, Niannan Xue, Yuxiang Zhou, and Stefanos Zafeiriou. Uv-gan: Adversarial facial uv map completion for pose-invariant face recognition. In CVPR, 2018. + +Jiankang Deng, Jia Guo, and Stefanos Zafeiriou. ArcFace: Additive angular margin loss for deep face recognition. In CVPR, 2019. + +Gary B. Huang, Manu Ramesh, Tamara Berg, and Erik Learned-Miller. Labeled faces in the wild: A database for studying face recognition in unconstrained environments. Technical Report 07-49, University of Massachusetts, Amherst, October 2007. + +Ira Kemelmacher-Shlizerman, Steven M Seitz, Daniel Miller, and Evan Brossard. The megaface benchmark: 1 million faces for recognition at scale. In CVPR, 2016. + +M Pawan Kumar, Benjamin Packer, and Daphne Koller. Self-paced learning for latent variable models. In NIPS, 2010. + +Buyu Li, Yu Liu, and Xiaogang Wang. Gradient harmonized single-stage detector. In AAAI, 2019. + +Weiyang Li, Yandong Wen, Zhiding Yu, Ming Li, Bhiksha Raj, and Le Song. Sphereface: Deep hypersphere embedding for face recognition. In CVPR, 2017. + +Xianyang Li. Airface: Lightweight and efficient model for face recognition. arXiv:1907.12256, 2019. + +Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. In ICCV, pp. 2980–2988, 2017. + +Weiyang Liu, Yandong Wen, Zhiding Yu, and Meng Yang. Large-margin softmax loss for convolutional neural networks. In ICML, 2016. + +Brianna Maze, Jocelyn Adams, James A Duncan, Nathan Kalka, Tim Miller, Charles Otto, Anil K Jain, W Tyler Niggel, Janet Anderson, Jordan Cheney, et al. Iarpa janus benchmark-c: Face dataset and protocol. In ICB, 2018. + +Stylianos Moschoglou, Athanasios Papaioannou, Christos Sagonas, Jiankang Deng, Irene Kotsia, and Stefanos Zafeiriou. Agedb: the first manually collected, in-the-wild age database. In CVPR Workshops, 2017. + +Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In NIPS Autodiff Workshop, 2017. + +Xi Peng, Xiang Yu, Kihyuk Sohn, Dimitris Metaxas, and Manmohan Chandraker. Reconstructionbased disentanglement for poseinvariant face recognition. In ICCV, 2017. + +Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In CVPR, 2015. + +S. Sengupta, J.-C. Chen, C. Castillo, V. M. Patel, R. Chellappa, and D.W. Jacobs. Frontal to profile face verification in the wild. In WACV, 2016. + +Yichun Shi, Anil K Jain, and Nathan D Kalka. Probabilistic face embeddings. In ICCV, 2019. + +Abhinav Shrivastava, Abhinav Gupta, and Ross Girshick. Training region-based object detectors with online hard example mining. In CVPR, 2016. + +Luan Tran, Xi Yin, and Xiaoming Liu. Disentangled representation learning GAN for pose-invariant face recognition. In CVPR, 2017. + +Hao Wang, Yitong Wang, Zheng Zhou, Xing Ji, Dihong Gong, Jingchao Zhou, Zhifeng Li, and Wei Liu. Cosface: Large margin cosine loss for deep face recognition. In CVPR, 2018a. + +Xiaobo Wang, Shuo Wang, Shifeng Zhang, Tianyu Fu, Hailin Shi, and Tao Mei. Support vector guided softmax loss for face recognition. arXiv:1812.11317, 2018b. + +Yandong Wen, Kaipeng Zhang, Zhifeng Li, and Yu Qiao. A discriminative feature learning approach for deep face recognition. In ECCV, 2016. + +Cameron Whitelam, Emma Taborsky, Austin Blanton, Brianna Maze, Jocelyn Adams, Tim Miller, Nathan Kalka, Anil K Jain, James A Duncan, Kristen Allen, et al. Iarpa janus benchmark-b face dataset. In CVPR Workshops, 2017. + +Weidi Xie and Andrew Zisserman. Multicolumn networks for face recognition. In BMVC, 2018. + +Weidi Xie, Li Shen, and Andrew Zisserman. Comparator networks. In ECCV, 2018. + +Dong Yi, Zhen Lei, Shengcai Liao, and Stan Z. Li. Learning face representation from scratch. arXiv:1411.7923, 2014. + +Kaipeng Zhang, Zhanpeng Zhang, Zhifeng Li, and Yu Qiao. Joint face detection and alignment using multitask cascaded convolutional networks. IEEE Signal Processing Letters, 23(10):1499–1503, 2016. + +Xiao Zhang, Rui Zhao, Yu Qiao, Xiaogang Wang, and Hongsheng Li. Adacos: Adaptively scaling cosine logits for effectively learning deep face representations. In CVPR, 2019a. + +Xiao Zhang, Rui Zhao, Junjie Yan, Mengya Gao, Yu Qiao, Xiaogang Wang, and Hongsheng Li. P2sgrad: Refined gradients for optimizing deep face models. In CVPR, 2019b. + +Tianyue Zheng, Weihong Deng, and Jiani Hu. Cross-age lfw: A database for studying cross-age face recognition in unconstrained environments. arXiv:1708.08197, 2017. + +Tianyue Zheng, Weihong Deng, and Jiani Hu. Cross-pose lfw: A database for studying cross-pose face recognition in unconstrained environments. Technical Report 18-01, Beijing University of Posts and Telecommunications, February 2018. + +Tianyi Zhou and Jeff Bilmes. Minimax curriculum learning: Machine teaching with desirable difficulties and scheduled diversity. In ICLR, 2018. URL https://openreview.net/forum? id $=$ BywyFQlAW. \ No newline at end of file diff --git a/md/train/B1g5sA4twr/B1g5sA4twr.md b/md/train/B1g5sA4twr/B1g5sA4twr.md new file mode 100644 index 0000000000000000000000000000000000000000..e7c0556e31a41dbc3e1bbfff0fd11a331d5e86ae --- /dev/null +++ b/md/train/B1g5sA4twr/B1g5sA4twr.md @@ -0,0 +1,442 @@ +# DEEP DOUBLE DESCENT: WHERE BIGGER MODELS AND MORE DATA HURT + +Preetum Nakkiran∗ Harvard University + +Gal Kaplun† Harvard University + +Yamini Bansal† Harvard University + +Tristan Yang Harvard University + +Boaz Barak Harvard University + +Ilya Sutskever OpenAI + +# ABSTRACT + +We show that a variety of modern deep learning tasks exhibit a “double-descent” phenomenon where, as we increase model size, performance first gets worse and then gets better. Moreover, we show that double descent occurs not just as a function of model size, but also as a function of the number of training epochs. We unify the above phenomena by defining a new complexity measure we call the effective model complexity and conjecture a generalized double descent with respect to this measure. Furthermore, our notion of model complexity allows us to identify certain regimes where increasing (even quadrupling) the number of train samples actually hurts test performance. + +# 1 INTRODUCTION + +![](images/c4a62cbdb7fbeb5034e735ae46b0639e991da1ee0ce7c9ca2623db843dff96c3.jpg) +Figure 1: Left: Train and test error as a function of model size, for ResNet18s of varying width on CIFAR-10 with $15 \%$ label noise. Right: Test error, shown for varying train epochs. All models trained using Adam for 4K epochs. The largest model (width 64) corresponds to standard ResNet18. + +The bias-variance trade-off is a fundamental concept in classical statistical learning theory (e.g., Hastie et al. (2005)). The idea is that models of higher complexity have lower bias but higher variance. According to this theory, once model complexity passes a certain threshold, models “overfit” with the variance term dominating the test error, and hence from this point onward, increasing model complexity will only decrease performance (i.e., increase test error). Hence conventional wisdom in classical statistics is that, once we pass a certain threshold, “larger models are worse.” + +However, modern neural networks exhibit no such phenomenon. Such networks have millions of parameters, more than enough to fit even random labels (Zhang et al. (2016)), and yet they perform much better on many tasks than smaller models. Indeed, conventional wisdom among practitioners is that “larger models are better’’ (Krizhevsky et al. (2012), Huang et al. (2018), Szegedy et al. + +![](images/08ba3538956dd39cc42384ec2f1e07bf08c6fc91c71879c2a0bb15a89998beb1.jpg) +Figure 2: Left: Test error as a function of model size and train epochs. The horizontal line corresponds to model-wise double descent–varying model size while training for as long as possible. The vertical line corresponds to epoch-wise double descent, with test error undergoing double-descent as train time increases. Right Train error of the corresponding models. All models are Resnet18s trained on CIFAR-10 with $15 \%$ label noise, data-augmentation, and Adam for up to 4K epochs. + +(2015), Radford et al. (2019)). The effect of training time on test performance is also up for debate. In some settings, “early stopping” improves test performance, while in other settings training neural networks to zero training error only improves performance. Finally, if there is one thing both classical statisticians and deep learning practitioners agree on is “more data is always better”. + +In this paper, we present empirical evidence that both reconcile and challenge some of the above “conventional wisdoms.” We show that many deep learning settings have two different regimes. In the under-parameterized regime, where the model complexity is small compared to the number of samples, the test error as a function of model complexity follows the U-like behavior predicted by the classical bias/variance tradeoff. However, once model complexity is sufficiently large to interpolate i.e., achieve (close to) zero training error, then increasing complexity only decreases test error, following the modern intuition of “bigger models are better”. Similar behavior was previously observed in Opper (1995; 2001), Advani & Saxe (2017), Spigler et al. (2018), and Geiger et al. (2019b). This phenomenon was first postulated in generality by Belkin et al. (2018) who named it “double descent”, and demonstrated it for decision trees, random features, and 2-layer neural networks with $\ell _ { 2 }$ loss, on a variety of learning tasks including MNIST and CIFAR-10. + +Main contributions. We show that double descent is a robust phenomenon that occurs in a variety of tasks, architectures, and optimization methods (see Figure 1 and Section 5; our experiments are summarized in Table A). Moreover, we propose a much more general notion of “double descent” that goes beyond varying the number of parameters. We define the effective model complexity (EMC) of a training procedure as the maximum number of samples on which it can achieve close to zero training error. The EMC depends not just on the data distribution and the architecture of the classifier but also on the training procedure—and in particular increasing training time will increase the EMC. + +We hypothesize that for many natural models and learning algorithms, double descent occurs as a function of the EMC. Indeed we observe “epoch-wise double descent” when we keep the model fixed and increase the training time, with performance following a classical U-like curve in the underfitting stage (when the EMC is smaller than the number of samples) and then improving with training time once the EMC is sufficiently larger than the number of samples (see Figure 2). As a corollary, early stopping only helps in the relatively narrow parameter regime of critically parameterized models. + +Sample non-monotonicity. Finally, our results shed light on test performance as a function of the number of train samples. Since the test error peaks around the point where EMC matches the number of samples (the transition from the under- to over-parameterization), increasing the number of samples has the effect of shifting this peak to the right. While in most settings increasing the number of samples decreases error, this shifting effect can sometimes result in a setting where more data is worse! For example, Figure 3 demonstrates cases in which increasing the number of samples by a factor of 4.5 results in worse test performance. + +![](images/5c137bc12053fdd4c20394058fe9f6b4430c5f548f5d67abd01978eb2d8cc676.jpg) +Figure 3: Test loss (per-token perplexity) as a function of Transformer model size (embedding dimension $d _ { m o d e l . }$ ) on language translation (IWSLT‘14 German-to-English). The curve for $1 8 \mathrm { k }$ samples is generally lower than the one for $4 \mathrm { k }$ samples, but also shifted to the right, since fitting 18k samples requires a larger model. Thus, for some models, the performance for $1 8 \mathrm { k }$ samples is worse than for $4 \mathrm { k \Omega }$ samples. + +# 2 OUR RESULTS + +To state our hypothesis more precisely, we define the notion of effective model complexity. We define a training procedure $\tau$ to be any procedure that takes as input a set $S = \{ ( x _ { 1 } , y _ { 1 } ) , \dots , ( x _ { n } , y _ { n } ) \}$ of labeled training samples and outputs a classifier $\mathcal { T } ( S )$ mapping data to labels. We define the effective model complexity of $\tau$ (w.r.t. distribution $\mathcal { D }$ ) to be the maximum number of samples $n$ on which $\tau$ achieves on average $\approx 0$ training error. + +Definition 1 (Effective Model Complexity) The Effective Model Complexity (EMC) of a training procedure $\tau$ , with respect to distribution $\mathcal { D }$ and parameter $\epsilon > 0$ , is defined as: + +$$ +\operatorname { E M C } _ { { \mathscr { D } } , \epsilon } ( { \mathscr { T } } ) : = \operatorname* { m a x } \left\{ n \mid \mathbb { E } _ { S \sim { \mathscr { D } } ^ { n } } [ \operatorname { E r r o r } _ { S } ( { \mathscr { T } } ( S ) ) ] \leq \epsilon \right\} +$$ + +where Error $s ( M )$ is the mean error of model $M$ on train samples $S$ . + +Our main hypothesis can be informally stated as follows: + +Hypothesis 1 (Generalized Double Descent hypothesis, informal) For any natural data distribution $\mathcal { D }$ , neural-network-based training procedure $\tau$ , and small $\epsilon > 0$ , if we consider the task of predicting labels based on n samples from $\mathcal { D }$ then: + +Under-paremeterized regime. If $\cdot _ { \mathrm { E M C } _ { { \mathscr D } , \epsilon } } ( \mathcal T )$ is sufficiently smaller than $n _ { \ast }$ , any perturbation of $\tau$ that increases its effective complexity will decrease the test error. + +Over-parameterized regime. If $\mathrm { E M C } _ { { \cal D } , \epsilon } ( T )$ is sufficiently larger than $n$ , any perturbation of $\tau$ that increases its effective complexity will decrease the test error. + +Critically parameterized regime. I $f \mathrm { E M C } _ { \mathcal { D } , \epsilon } ( \mathcal { T } ) \approx n$ , then a perturbation of $\tau$ that increases its effective complexity might decrease or increase the test error. + +Hypothesis 1 is informal in several ways. We do not have a principled way to choose the parameter $\epsilon$ (and currently heuristically use $\epsilon = 0 . 1$ ). We also are yet to have a formal specification for “sufficiently smaller” and “sufficiently larger”. Our experiments suggest that there is a critical interval around the interpolation threshold when $\mathrm { E M C } _ { \mathcal { D } , \epsilon } ( \mathcal { T } ) = n$ : below and above this interval increasing complexity helps performance, while within this interval it may hurt performance. The width of the critical interval depends on both the distribution and the training procedure in ways we do not yet completely understand. + +We believe Hypothesis 1 sheds light on the interaction between optimization algorithms, model size, and test performance and helps reconcile some of the competing intuitions about them. The main result of this paper is an experimental validation of Hypothesis 1 under a variety of settings, where we considered several natural choices of datasets, architectures, and optimization algorithms, and we changed the “interpolation threshold” by varying the number of model parameters, the length of training, the amount of label noise in the distribution, and the number of train samples. + +Model-wise Double Descent. In Section 5, we study the test error of models of increasing size, for a fixed large number of optimization steps. We show that “model-wise double-descent” occurs for various modern datasets (CIFAR-10, CIFAR-100, IWSLT‘14 de-en, with varying amounts of label noise), model architectures (CNNs, ResNets, Transformers), optimizers (SGD, Adam), number of train samples, and training procedures (data-augmentation, and regularization). Moreover, the peak in test error systematically occurs at the interpolation threshold. In particular, we demonstrate realistic settings in which bigger models are worse. + +Epoch-wise Double Descent. In Section 6, we study the test error of a fixed, large architecture over the course of training. We demonstrate, in similar settings as above, a corresponding peak in test performance when models are trained just long enough to reach $\approx 0$ train error. The test error of a large model first decreases (at the beginning of training), then increases (around the critical regime), then decreases once more (at the end of training)—that is, training longer can correct overfitting. + +Sample-wise Non-monotonicity. In Section 7, we study the test error of a fixed model and training procedure, for varying number of train samples. Consistent with our generalized double-descent hypothesis, we observe distinct test behavior in the “critical regime”, when the number of samples is near the maximum that the model can fit. This often manifests as a long plateau region, in which taking significantly more data might not help when training to completion (as is the case for CNNs on CIFAR-10). Moreover, we show settings (Transformers on IWSLT‘14 en-de), where this manifests as a peak—and for a fixed architecture and training procedure, more data actually hurts. + +Remarks on Label Noise. We observe all forms of double descent most strongly in settings with label noise in the train set (as is often the case when collecting train data in the real-world). However, we also show several realistic settings with a test-error peak even without label noise: ResNets (Figure 4a) and CNNs (Figure 20) on CIFAR-100; Transformers on IWSLT‘14 (Figure 8). Moreover, all our experiments demonstrate distinctly different test behavior in the critical regime— often manifesting as a “plateau” in the test error in the noiseless case which develops into a peak with added label noise. See Section 8 for further discussion. + +# 3 RELATED WORK + +Model-wise double descent was first proposed as a general phenomenon by Belkin et al. (2018). Similar behavior had been observed in Opper (1995; 2001), Advani & Saxe (2017), Spigler et al. (2018), and Geiger et al. (2019b). Subsequently, there has been a large body of work studying the double descent phenomenon. A growing list of papers that theoretically analyze it in the tractable setting of linear least squares regression includes Belkin et al. (2019); Hastie et al. (2019); Bartlett et al. (2019); Muthukumar et al. (2019); Bibas et al. (2019); Mitra (2019); Mei & Montanari (2019). Moreover, Geiger et al. (2019a) provide preliminary results for model-wise double descent in convolutional networks trained on CIFAR-10. Our work differs from the above papers in two crucial aspects: First, we extend the idea of double-descent beyond the number of parameters to incorporate the training procedure under a unified notion of “Effective Model Complexity”, leading to novel insights like epoch-wise double descent and sample non-monotonicity. The notion that increasing train time corresponds to increasing complexity was also presented in Nakkiran et al. (2019). Second, we provide an extensive and rigorous demonstration of double-descent in modern deep learning, spanning a variety of architectures, datasets, and optimization procedures. An extended discussion of the related work is provided in Appendix C. + +# 4 EXPERIMENTAL SETUP + +We briefly describe the experimental setup here; full details are in Appendix B 1. We consider three families of architectures: ResNets, standard CNNs, and Transformers. ResNets: We parameterize a family of ResNet18s (He et al. (2016)) by scaling the width (number of filters) of convolutional layers. Specifically, we use layer widths $[ k , 2 k , \bar { 4 } k , 8 k ]$ for varying $k$ . The standard ResNet18 corresponds to $k = 6 4$ . Standard CNNs: We consider a simple family of 5-layer CNNs, with 4 convolutional layers of widths $[ k , 2 k , 4 k , 8 k ]$ for varying $k$ , and a fully-connected layer. For context, the CNN with width $k = 6 4$ , can reach over $9 0 \%$ test accuracy on CIFAR-10 with dataaugmentation. Transformers: We consider the 6 layer encoder-decoder from Vaswani et al. (2017), as implemented by Ott et al. (2019). We scale the size of the network by modifying the embedding dimension $d _ { \mathrm { m o d e l } }$ , and setting the width of the fully-connected layers proportionally $( d _ { \mathrm { f f } } = 4 \cdot d _ { \mathrm { m o d e l } } )$ . + +For ResNets and CNNs, we train with cross-entropy loss, and the following optimizers: (1) Adam with learning-rate 0.0001 for 4K epochs; (2) SGD with learning rate $\propto \frac { 1 } { \sqrt { T } }$ for 500K gradient steps. We train Transformers for 80K gradient steps, with $10 \%$ label smoothing and no drop-out. + +Label Noise. In our experiments, label noise of probability $p$ refers to training on a samples which have the correct label with probability $( 1 - p )$ , and a uniformly random incorrect label otherwise (label noise is sampled only once and not per epoch). Figure 1 plots test error on the noisy distribution, while the remaining figures plot test error with respect to the clean distribution (the two curves are just linear rescaling of one another). + +# 5 MODEL-WISE DOUBLE DESCENT + +![](images/faae61f59becd773c511ccf37b8969226757057fa9adbb5ab757470a3e69071b.jpg) +(a) CIFAR-100. There is a peak in test error even with no label noise. +Figure 4: Model-wise double descent for ResNet18s. Trained on CIFAR-100 and CIFAR-10, with varying label noise. Optimized using Adam with LR 0.0001 for 4K epochs, and data-augmentation. + +![](images/e3fd45bf969858879ad23096c5a3e4c6e094f04bd2b0a277a1d81691dbc44055.jpg) +(b) CIFAR-10. There is a “plateau” in test error around the interpolation point with no label noise, which develops into a peak for added label noise. + +In this section, we study the test error of models of increasing size, when training to completion (for a fixed large number of optimization steps). We demonstrate model-wise double descent across different architectures, datasets, optimizers, and training procedures. The critical region exhibits distinctly different test behavior around the interpolation point and there is often a peak in test error that becomes more prominent in settings with label noise. + +For the experiments in this section (Figures 4, 5, 6, 7, 8), notice that all modifications which increase the interpolation threshold (such as adding label noise, using data augmentation, and increasing the number of train samples) also correspondingly shift the peak in test error towards larger models. Additional plots showing the early-stopping behavior of these models, and additional experiments showing double descent in settings with no label noise (e.g. Figure 19) are in Appendix E.2. We also observed model-wise double descent for adversarial training, with a prominent robust test error peak even in settings without label noise. See Figure 26 in Appendix E.2. + +Discussion. Fully understanding the mechanisms behind model-wise double descent in deep neural networks remains an important open question. However, an analog of model-wise double descent occurs even for linear models. A recent stream of theoretical works analyzes this setting (Bartlett et al. (2019); Muthukumar et al. (2019); Belkin et al. (2019); Mei & Montanari (2019); Hastie et al. (2019)). We believe similar mechanisms may be at work in deep neural networks. + +Informally, our intuition is that for model-sizes at the interpolation threshold, there is effectively only one model that fits the train data and this interpolating model is very sensitive to noise in the train set and/or model mis-specification. That is, since the model is just barely able to fit the train data, forcing it to fit even slightly-noisy or mis-specified labels will destroy its global structure, and result in high test error. (See Figure 28 in the Appendix for an experiment demonstrating this noise sensitivity, by showing that ensembling helps significantly in the critically-parameterized regime). However for over-parameterized models, there are many interpolating models that fit the train set, and SGD is able to find one that “memorizes” (or “absorbs”) the noise while still performing well on the distribution. + +![](images/44d6b8438c0d02d0c76c80ad346b4c82268cb44163651e6cd9d1516b78b9044e.jpg) +Figure 5: Effect of Data Augmentation. 5-layer CNNs on CIFAR10, with and without dataaugmentation. Data-augmentation shifts the interpolation threshold to the right, shifting the test error peak accordingly. Optimized using SGD for 500K steps. See Figure 27 for larger models. + +![](images/8100cdf1068362adc8d85ddd7ddddf0ee7d65cdfb04eb08ce1bab31e8561ac9f.jpg) + +![](images/f4e2caa4b4e7287a955aced3cc3d523468cc0ef98464146881383b6d073e6465.jpg) +Figure 6: SGD vs. Adam. 5-Layer CNNs on CIFAR-10 with no label noise, and no data augmentation. Optimized using SGD for 500K gradient steps, and Adam for 4K epochs. + +![](images/c8160258a06627d94e03682b0cb3a5ea98fb3a6cc2efc061ae766953b89696b3.jpg) +Figure 7: Noiseless settings. 5-layer CNNs on CIFAR-100 with no label noise; note the peak in test error. Trained with SGD and no data augmentation. See Figure 20 for the early-stopping behavior of these models. + +The above intuition is theoretically justified for linear models. In general, this situation manifests even without label noise for linear models (Mei & Montanari (2019)), and occurs whenever there is model mis-specification between the structure of the true distribution and the model family. We believe this intuition extends to deep learning as well, and it is consistent with our experiments. + +![](images/2b473a4c748ee138162c045888f88cd9f7560771b9e3d4fa5dd16e01c2027a36.jpg) +Figure 8: Transformers on language translation tasks: Multi-head-attention encoderdecoder Transformer model trained for $8 0 \mathrm { k }$ gradient steps with labeled smoothed cross-entropy loss on IWSLT‘14 Germanto-English (160K sentences) and WMT‘14 English-to-French (subsampled to 200K sentences) dataset. Test loss is measured as pertoken perplexity. + +# 6 EPOCH-WISE DOUBLE DESCENT + +In this section, we demonstrate a novel form of double-descent with respect to training epochs, which is consistent with our unified view of effective model complexity (EMC) and the generalized double descent hypothesis. Increasing the train time increases the EMC—and thus a sufficiently large model transitions from under- to over-parameterized over the course of training. + +![](images/bdca8d3385fd5d02c8443adb0acbb61793b4152837145966b74e283d6ca4c7db.jpg) +Figure 9: Left: Training dynamics for models in three regimes. Models are ResNet18s on CIFAR10 with $20 \%$ label noise, trained using Adam with learning rate 0.0001, and data augmentation. Right: Test error over (Model size $\times$ Epochs). Three slices of this plot are shown on the left. + +As illustrated in Figure 9, sufficiently large models can undergo a “double descent” behavior where test error first decreases then increases near the interpolation threshold, and then decreases again. In contrast, for “medium sized” models, for which training to completion will only barely reach $\approx 0$ error, the test error as a function of training time will follow a classical U-like curve where it is better to stop early. Models that are too small to reach the approximation threshold will remain in the “under parameterized” regime where increasing train time monotonically decreases test error. Our experiments (Figure 10) show that many settings of dataset and architecture exhibit epoch-wise double descent, in the presence of label noise. Further, this phenomenon is robust across optimizer variations and learning rate schedules (see additional experiments in Appendix E.1). As in modelwise double descent, the test error peak is accentuated with label noise. + +Conventional wisdom suggests that training is split into two phases: (1) In the first phase, the network learns a function with a small generalization gap (2) In the second phase, the network starts to over-fit the data leading to an increase in test error. Our experiments suggest that this is not the complete picture—in some regimes, the test error decreases again and may achieve a lower value at the end of training as compared to the first minimum (see Fig 10 for $10 \%$ label noise). + +![](images/82b708c209b3222a2c568a1bae6bfb22a279f3b426ac29068d13db60405918ac.jpg) +Figure 10: Epoch-wise double descent for ResNet18 and CNN (width $\scriptstyle 1 = 1 2 8$ ). ResNets trained using Adam with learning rate 0.0001, and CNNs trained with SGD with inverse-squareroot learning rate. + +# 7 SAMPLE-WISE NON-MONOTONICITY + +In this section, we investigate the effect of varying the number of train samples, for a fixed model and training procedure. Previously, in model-wise and epoch-wise double descent, we explored behavior in the critical regime, where $\mathrm { E M C } _ { \mathcal { D } , \epsilon } ( \mathcal { T } ) \approx n$ , by varying the EMC. Here, we explore the critical regime by varying the number of train samples $n$ . By increasing $n$ , the same training procedure $\tau$ can switch from being effectively over-parameterized to effectively under-parameterized. + +We show that increasing the number of samples has two different effects on the test error vs. model complexity graph. On the one hand, (as expected) increasing the number of samples shrinks the area under the curve. On the other hand, increasing the number of samples also has the effect of “shifting the curve to the right” and increasing the model complexity at which test error peaks. + +![](images/69cf7d93b6796ff455f7a65cbe3879b86a15c2ae223d5fc03fc1b54ea4f75d5d.jpg) + +![](images/0c5bdb0c4ceaff9263d9a08a26498be4a038c2547b0dcb1c349a3eef853ce750.jpg) + +(a) Model-wise double descent for 5-layer CNNs on CIFAR-10, for varying dataset sizes. Top: There is a range of model sizes (shaded green) where training on $2 \times$ more samples does not improve test error. Bottom: There is a range of model sizes (shaded red) where training on $4 \times$ more samples does not improve test error. + +(b) Sample-wise non-monotonicity. Test loss (per-word perplexity) as a function of number of train samples, for two transformer models trained to completion on IWSLT’14. For both model sizes, there is a regime where more samples hurt performance. Compare to Figure 3, of model-wise double-descent in the identical setting. + +Figure 11: Sample-wise non-monotonicity. + +These twin effects are shown in Figure 11a. Note that there is a range of model sizes where the effects “cancel out”—and having $4 \times$ more train samples does not help test performance when training to completion. Outside the critically-parameterized regime, for sufficiently under- or overparameterized models, having more samples helps. This phenomenon is corroborated in Figure 12, which shows test error as a function of both model and sample size, in the same setting as Figure 11a. + +![](images/67eb2031049b3e7bf4fd7bf3717f93c4f08018a552ffa050f6ba459a5d149a71.jpg) +Figure 12: Left: Test Error as a function of model size and number of train samples, for 5-layer CNNs on CIFAR- $10 + 2 0 \%$ noise. Note the ridge of high test error again lies along the interpolation threshold. Right: Three slices of the left plot, showing the effect of more data for models of different sizes. Note that, when training to completion, more data helps for small and large models, but does not help for near-critically-parameterized models (green). + +In some settings, these two effects combine to yield a regime of model sizes where more data actually hurts test performance as in Figure 3 (see also Figure 11b). Note that this phenomenon is not unique to DNNs: more data can hurt even for linear models (see Appendix D). + +# 8 CONCLUSION AND DISCUSSION + +We introduce a generalized double descent hypothesis: models and training procedures exhibit atypical behavior when their Effective Model Complexity is comparable to the number of train samples. We provide extensive evidence for our hypothesis in modern deep learning settings, and show that it is robust to choices of dataset, architecture, and training procedures. In particular, we demonstrate “model-wise double descent” for modern deep networks and characterize the regime where bigger models can perform worse. We also demonstrate “epoch-wise double descent,” which, to the best of our knowledge, has not been previously proposed. Finally, we show that the double descent phenomenon can lead to a regime where training on more data leads to worse test performance. Preliminary results suggest that double descent also holds as we vary the amount of regularization for a fixed model (see Figure 22). + +We also believe our characterization of the critical regime provides a useful way of thinking for practitioners—if a model and training procedure are just barely able to fit the train set, then small changes to the model or training procedure may yield unexpected behavior (e.g. making the model slightly larger or smaller, changing regularization, etc. may hurt test performance). + +Early stopping. We note that many of the phenomena that we highlight often do not occur with optimal early-stopping. However, this is consistent with our generalized double descent hypothesis: if early stopping prevents models from reaching 0 train error then we would not expect to see doubledescent, since the EMC does not reach the number of train samples. Further, we show at least one setting where model-wise double descent can still occur even with optimal early stopping (ResNets on CIFAR-100 with no label noise, see Figure 19). We have not observed settings where more data hurts when optimal early-stopping is used. However, we are not aware of reasons which preclude this from occurring. We leave fully understanding the optimal early stopping behavior of double descent as an important open question for future work. + +Label Noise. In our experiments, we observe double descent most strongly in settings with label noise. However, we believe this effect is not fundamentally about label noise, but rather about model mis-specification. For example, consider a setting where the label noise is not truly random, but rather pseudorandom (with respect to the family of classifiers being trained). In this setting, the performance of the Bayes optimal classifier would not change (since the pseudorandom noise is deterministic, and invertible), but we would observe an identical double descent as with truly random label noise. Thus, we view adding label noise as merely a proxy for making distributions “harder”— i.e. increasing the amount of model mis-specification. + +Other Notions of Model Complexity. Our notion of Effective Model Complexity is related to classical complexity notions such as Rademacher complexity, but differs in several crucial ways: (1) EMC depends on the true labels of the data distribution, and (2) EMC depends on the training procedure, not just the model architecture. + +Other notions of model complexity which do not incorporate features (1) and (2) would not suffice to characterize the location of the double-descent peak. Rademacher complexity, for example, is determined by the ability of a model architecture to fit a randomly-labeled train set. But Rademacher complexity and VC dimension are both insufficient to determine the model-wise double descent peak location, since they do not depend on the distribution of labels— and our experiments show that adding label noise shifts the location of the peak. + +Moreover, both Rademacher complexity and VC dimension depend only on the model family and data distribution, and not on the training procedure used to find models. Thus, they are not capable of capturing train-time double-descent effects, such as “epoch-wise” double descent, and the effect of data-augmentation on the peak location. + +# ACKNOWLEDGMENTS + +We thank Mikhail Belkin for extremely useful discussions in the early stages of this work. We thank Christopher Olah for suggesting the Model Size $\times$ Epoch visualization, which led to the investigation of epoch-wise double descent, as well as for useful discussion and feedback. We also thank Alec Radford, Jacob Steinhardt, and Vaishaal Shankar for helpful discussion and suggestions. P.N. thanks OpenAI, the Simons Institute, and the Harvard Theory Group for a research environment that enabled this kind of work. + +We thank Dimitris Kalimeris, Benjamin L. Edelman, and Sharon Qian, and Aditya Ramesh for comments on an early draft of this work. + +This work supported in part by NSF grant CAREER CCF 1452961, BSF grant 2014389, NSF USICCS proposal 1540428, a Google Research award, a Facebook research award, a Simons Investigator Award, a Simons Investigator Fellowship, and NSF Awards CCF 1715187, CCF 1565264, CCF 1301976, IIS 1409097, and CNS 1618026. Y.B. would like to thank the MIT-IBM Watson AI Lab for contributing computational resources for experiments. + +# REFERENCES + +Madhu S Advani and Andrew M Saxe. High-dimensional dynamics of generalization error in neural networks. arXiv preprint arXiv:1710.03667, 2017. + +Peter L Bartlett, Philip M Long, Gabor Lugosi, and Alexander Tsigler. Benign overfitting in linear ´ regression. arXiv preprint arXiv:1906.11300, 2019. + +Mikhail Belkin, Daniel Hsu, Siyuan Ma, and Soumik Mandal. Reconciling modern machine learning and the bias-variance trade-off. arXiv preprint arXiv:1812.11118, 2018. + +Mikhail Belkin, Daniel Hsu, and Ji Xu. Two models of double descent for weak features. arXiv preprint arXiv:1903.07571, 2019. + +Koby Bibas, Yaniv Fogel, and Meir Feder. A new look at an old problem: A universal learning approach to linear regression. arXiv preprint arXiv:1905.04708, 2019. + +Mauro Cettolo, Christian Girardi, and Marcello Federico. Wit3: Web inventory of transcribed and translated talks. In Proceedings of the $l 6 ^ { t h }$ Conference of the European Association for Machine Translation (EAMT), pp. 261–268, Trento, Italy, May 2012. + +Robert PW Duin. Small sample size generalization. In Proceedings of the Scandinavian Conference on Image Analysis, volume 2, pp. 957–964. PROCEEDINGS PUBLISHED BY VARIOUS PUBLISHERS, 1995. + +Robert PW Duin. Classifiers in almost empty spaces. In Proceedings 15th International Conference on Pattern Recognition. ICPR-2000, volume 2, pp. 1–7. IEEE, 2000. + +Mario Geiger, Arthur Jacot, Stefano Spigler, Franck Gabriel, Levent Sagun, Stephane d’Ascoli, ´ Giulio Biroli, Clement Hongler, and Matthieu Wyart. Scaling description of generalization with ´ number of parameters in deep learning. arXiv preprint arXiv:1901.01608, 2019a. + +Mario Geiger, Stefano Spigler, Stephane d’Ascoli, Levent Sagun, Marco Baity-Jesi, Giulio Biroli, ´ and Matthieu Wyart. Jamming transition as a paradigm to understand the loss landscape of deep neural networks. Physical Review E, 100(1):012115, 2019b. + +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. + +Trevor Hastie, Robert Tibshirani, Jerome Friedman, and James Franklin. The elements of statistical learning: data mining, inference and prediction. The Mathematical Intelligencer, 27(2):83–85, 2005. + +Trevor Hastie, Andrea Montanari, Saharon Rosset, and Ryan J Tibshirani. Surprises in highdimensional ridgeless least squares interpolation. arXiv preprint arXiv:1903.08560, 2019. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016. + +Yanping Huang, Yonglong Cheng, Dehao Chen, HyoukJoong Lee, Jiquan Ngiam, Quoc V. Le, and Zhifeng Chen. Gpipe: Efficient training of giant neural networks using pipeline parallelism. CoRR, abs/1811.06965, 2018. URL http://arxiv.org/abs/1811.06965. + +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, pp. 1097–1105, 2012. + +Marco Loog and Robert PW Duin. The dipping phenomenon. In Joint IAPR International Workshops on Statistical Techniques in Pattern Recognition (SPR) and Structural and Syntactic Pattern Recognition (SSPR), pp. 310–317. Springer, 2012. + +Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017. + +Song Mei and Andrea Montanari. The generalization error of random features regression: Precise asymptotics and double descent curve. arXiv preprint arXiv:1908.05355, 2019. + +Partha P. Mitra. Understanding overfitting peaks in generalization error: Analytical risk curves for l2 and l1 penalized interpolation. ArXiv, abs/1906.03667, 2019. + +Vidya Muthukumar, Kailas Vodrahalli, and Anant Sahai. Harmless interpolation of noisy data in regression. arXiv preprint arXiv:1903.09139, 2019. + +Preetum Nakkiran, Gal Kaplun, Dimitris Kalimeris, Tristan Yang, Benjamin L Edelman, Fred Zhang, and Boaz Barak. Sgd on neural networks learns functions of increasing complexity. arXiv preprint arXiv:1905.11604, 2019. + +Brady Neal, Sarthak Mittal, Aristide Baratin, Vinayak Tantia, Matthew Scicluna, Simon LacosteJulien, and Ioannis Mitliagkas. A modern take on the bias-variance tradeoff in neural networks. arXiv preprint arXiv:1810.08591, 2018. + +Manfred Opper. Statistical mechanics of learning: Generalization. The Handbook of Brain Theory and Neural Networks, 922-925., 1995. + +Manfred Opper. Learning to generalize. Frontiers of Life, 3(part 2), pp.763-775., 2001. + +Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan $\mathrm { N g }$ , David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL-HLT 2019: Demonstrations, 2019. + +David Page. How to train your resnet. https://myrtle.ai/ how-to-train-your-resnet-4-architecture/, 2018. + +Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In NeurIPS Autodiff Workshop, 2017. + +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019. + +Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pp. 1177–1184, 2008. + +Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. ArXiv, abs/1508.07909, 2015. + +Marina Skurichina and Robert PW Duin. Bagging, boosting and the random subspace method for linear classifiers. Pattern Analysis & Applications, 5(2):121–135, 2002. + +Stefano Spigler, Mario Geiger, Stephane d’Ascoli, Levent Sagun, Giulio Biroli, and Matthieu Wyart.´ A jamming transition from under-to over-parametrization affects loss landscape and generalization. arXiv preprint arXiv:1810.09665, 2018. + +Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Computer Vision and Pattern Recognition (CVPR), 2015. URL http://arxiv.org/abs/ 1409.4842. + +Gerard V Trunk. A problem of dimensionality: A simple example. IEEE Transactions on pattern analysis and machine intelligence, (3):306–307, 1979. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR, abs/1706.03762, 2017. + +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. ICLR, abs/1611.03530, 2016. + +A SUMMARY TABLE OF EXPERIMENTAL RESULTS + +
DatasetArchitectureOpt.Aug.% NoiseDouble-DescentFigure(s)
ModelEpoch
CIFAR 10CNNSGD0X×5,27
10广广5,27,6
205,27
0Xx√5,25
105
205
SGD + w.d.2021
ResNetAdam025
Adam0XX4,10
54
104,10
154,2
Various204,9,10
2016, 17, 18
(subsampled)CNNSGD SGD1011a
2011a, 12
(adversarial)ResNetSGD0Robust err.26
CIFAR 100ResNetAdam0X4,19,10
>>104,10
CNNSGD204,10
0X20
IWSLT '14 de-enTransformerAdam0X8,24
(subsampled)TransformerAdam0X11b,23
WMT'14 en-frTransformerAdam0X8,24
+ +# B APPENDIX: EXPERIMENTAL DETAILS + +# B.1 MODELS + +We use the following families of architectures. The PyTorch Paszke et al. (2017) specification of our ResNets and CNNs are available at https://gitlab.com/ harvard-machine-learning/double-descent/tree/master. + +ResNets. We define a family of ResNet18s of increasing size as follows. We follow the Preactivation ResNet18 architecture of He et al. (2016), using 4 ResNet blocks, each consisting of two BatchNorm-ReLU-Convolution layers. The layer widths for the 4 blocks are $[ k , 2 k , 4 k , 8 k ]$ for varying $k \in \mathbb N$ and the strides are [1, 2, 2, 2]. The standard ResNet18 corresponds to $k = 6 4$ convolutional channels in the first layer. The scaling of model size with $k$ is shown in Figure 13b. Our implementation is adapted from https://github.com/kuangliu/pytorch-cifar. + +Standard CNNs. We consider a simple family of 5-layer CNNs, with four Conv-BatchNormReLU-MaxPool layers and a fully-connected output layer. We scale the four convolutional layer widths as $[ k , 2 k , 4 k , 8 k ]$ . The MaxPool is [1, 2, 2, 8]. For all the convolution layers, the kernel size $= 3$ , stride $= 1$ and padding $^ { = 1 }$ . This architecture is based on the “backbone” architecture from Page (2018). For $k = 6 4$ , this CNN has 1558026 parameters and can reach $> 9 0 \%$ test accuracy on CIFAR-10 (Krizhevsky (2009)) with data-augmentation. The scaling of model size with $k$ is shown in Figure 13a. + +Transformers. We consider the encoder-decoder Transformer model from Vaswani et al. (2017) with 6 layers and 8 attention heads per layer, as implemented by fairseq Ott et al. (2019). We scale the size of the network by modifying the embedding dimension $( d _ { \mathrm { m o d e l } } )$ , and scale the width of the fully-connected layers proportionally $\begin{array} { r } { \dot { \mathcal { d } } _ { \mathrm { f f } } = 4 { d } _ { \mathrm { m o d e l } } ) } \end{array}$ . We train with $10 \%$ label smoothing and no drop-out, for 80 gradient steps. + +![](images/d8516fb233b07ebcdc7f08ef74910030a4bc584afa359c5fbd7737999a56c148.jpg) +Figure 13: Scaling of model size with our parameterization of width & embedding dimension. + +B.2 IMAGE CLASSIFICATION: EXPERIMENTAL SETUP + +We describe the details of training for CNNs and ResNets below. + +Loss function: Unless stated otherwise, we use the cross-entropy loss for all the experiments. + +Data-augmentation: In experiments where data-augmentation was used, we apply RandomCrop(32, padding ${ \cdot = } 4$ ) and RandomHorizontalFlip. In experiments with added label noise, the label for all augmentations of a given training sample are given the same label. + +Regularization: No explicit regularization like weight decay or dropout was applied unless explicitly stated. + +Initialization: We use the default initialization provided by PyTorch for all the layers. + +# Optimization: + +• Adam: Unless specified otherwise, learning rate was set at constant to 1e−4 and all other parameters were set to their default PyTorch values. +SGD: Unless specified otherwise, learning rate schedule inverse-square root (defined below) was used with initial learning rate $\gamma _ { 0 } = 0 . 1$ and updates every $L = 5 1 2$ gradient steps. No momentum was used. + +We found our results are robust to various other natural choices of optimizers and learning rate schedule. We used the above settings because (1) they optimize well, and (2) they do not require experiment-specific hyperparameter tuning, and allow us to use the same optimization across many experiments. + +Batch size: All experiments use a batchsize of 128. + +# Learning rate schedule descriptions: + +• Inverse-square root $( \gamma _ { 0 } , L )$ : At gradient step $t$ , the learning rate is set to $\gamma ( t ) : =$ $\frac { \gamma _ { 0 } } { \sqrt { 1 + \lfloor t / 5 1 2 \rfloor } }$ . We set learning-rate with respect to number of gradient steps, and not epochs, in order to allow comparison between experiments with varying train-set sizes. • Dynamic drop ( $\mathrm { \Delta } \cdot \mathrm { \Delta } \gamma _ { 0 }$ , drop, patience): Starts with an initial learning rate of $\gamma _ { 0 }$ and drops by a factor of ’drop’ if the training loss has remained constant or become worse for ’patience’ number of gradient steps. + +B.3 NEURAL MACHINE TRANSLATION: EXPERIMENTAL SETUP + +Here we describe the experimental setup for the neural machine translation experiments. + +# Training procedure. + +In this setting, the distribution $\mathcal { D }$ consists of triples + +$$ +( x , y , i ) : x \in V _ { s r c } ^ { * } , y \in V _ { t g t } ^ { * } , i \in \{ 0 , \ldots , | y | \} +$$ + +where $V _ { s r c }$ and $V _ { t g t }$ are the source and target vocabularies, the string $x$ is a sentence in the source language, $y$ is its translation in the target language, and $i$ is the index of the token to be predicted by the model. We assume that $i | x , y$ is distributed uniformly on $\{ 0 , \ldots , | y | \}$ . + +A standard probabilistic model defines an autoregressive factorization of the likelihood: + +$$ +p _ { M } ( y | x ) = \prod _ { i = 1 } ^ { | y | } p _ { M } ( y _ { i } | y _ { < i } , x ) . +$$ + +Given a set of training samples $S$ , we define + +$$ +\operatorname { E r r o r } _ { S } ( M ) = { \frac { 1 } { | S | } } \sum _ { ( x , y , i ) \in S } - \log p _ { M } ( y _ { i } | y _ { < i } , x ) . +$$ + +In practice, $S$ is not constructed from independent samples from $D$ , but rather by first sampling $( x , y )$ and then including all $( x , y , 0 ) , \dotsc , ( x , y , | y | )$ in $S$ . + +For training transformers, we replicate the optimization procedure specified in Vaswani et al. (2017) section 5.3, where the learning rate schedule consists of a “warmup” phase with linearly increasing learning rate followed by a phase with inverse square-root decay. We preprocess the data using byte pair encoding (BPE) as described in Sennrich et al. (2015). We use the implementation provided by fairseq (https://github.com/pytorch/fairseq). + +Datasets. The IWSLT ’14 German to English dataset contains TED Talks as described in Cettolo et al. (2012). The WMT ’14 English to French dataset is taken from http://www.statmt. org/wmt14/translation-task.html. + +# B.4 PER-SECTION EXPERIMENTAL DETAILS + +Here we provide full details for experiments in the body, when not otherwise provided. + +Introduction: Experimental Details Figure 1: All models were trained using Adam with learningrate 0.0001 for 4K epochs. Plotting means and standard deviations for 5 trials, with random network initialization. + +Model-wise Double Descent: Experimental Details Figure 7: Plotting means and standard deviations for 5 trials, with random network initialization. + +Sample-wise Nonmonotonicity: Experimental Details Figure 11a: All models are trained with SGD for 500K epochs, and data-augmentation. Bottom: Means and standard deviations from 5 trials with random initialization, and random subsampling of the train set. + +# C EXTENDED DISCUSSION OF RELATED WORK + +Belkin et al. (2018): This paper proposed, in very general terms, that the apparent contradiction between traditional notions of the bias-variance trade-off and empirically successful practices in deep learning can be reconciled under a double-descent curve—as model complexity increases, the test error follows the traditional “U-shaped curve”, but beyond the point of interpolation, the error starts to decrease. This work provides empirical evidence for the double-descent curve with fully connected networks trained on subsets of MNIST, CIFAR10, SVHN and TIMIT datasets. They use the $l _ { 2 }$ loss for their experiments. They demonstrate that neural networks are not an aberration in this regard—double-descent is a general phenomenon observed also in linear regression with random features and random forests. + +Theoretical works on linear least squares regression: A variety of papers have attempted to theoretically analyze this behavior in restricted settings, particularly the case of least squares regression under various assumptions on the training data, feature spaces and regularization method. + +1. Advani & Saxe (2017); Hastie et al. (2019) both consider the linear regression problem stated above and analyze the generalization behavior in the asymptotic limit $N , D \to \infty$ using random matrix theory. Hastie et al. (2019) highlight that when the model is misspecified, the minimum of training error can occur for over-parameterized models +2. Belkin et al. (2019) Linear least squares regression for two data models, where the input data is sampled from a Gaussian and a Fourier series model for functions on a circle. They provide a finite-sample analysis for these two cases +3. Bartlett et al. (2019) provides generalization bounds for the minimum $l _ { 2 }$ -norm interpolant for Gaussian features +4. Muthukumar et al. (2019) characterize the fundamental limit of of any interpolating solution in the presence of noise and provide some interesting Fourier-theoretic interpretations. +5. Mei & Montanari (2019): This work provides asymptotic analysis for ridge regression over random features + +Similar double descent behavior, in restricted settings, was investigated in Trunk (1979); Opper (1995; 2001); Skurichina & Duin (2002). + +Neal et al. (2018) conducts a study of bias and variance in modern neural networks, observing that both bias and variance can decrease with increasing model size, contrary to conventional wisdom. + +Geiger et al. (2019b) showed that deep fully connected networks trained on the MNIST dataset with hinge loss exhibit a “jamming transition” when the number of parameters exceeds a threshold that allows training to near-zero train loss. Geiger et al. (2019a) provide further experiments on CIFAR10 with a convolutional network. They also highlight interesting behavior with ensembling around the critical regime, which is consistent with our informal intuitions in Section 5 and our experiments in Figures 28, 29. + +Advani & Saxe (2017); Geiger et al. (2019b;a) also point out that double-descent is not observed when optimal early-stopping is used. + +The study of sample non-monotonicity in learning algorithms had also existed prior to double descent, including in Duin (1995; 2000); Opper (2001); Loog & Duin (2012). + +![](images/228a2efe993d5a5b8de88a94c4213a4344f8bf8c59e0d4b46ffa29d81cf9c5ed.jpg) +Figure 14: Random Fourier Features on the Fashion MNIST dataset. The setting is equivalent to two-layer neural network with $e ^ { - i x }$ activation, with randomly-initialized first layer that is fixed throughout training. The second layer is trained using gradient flow. + +In this section, for completeness sake, we show that both the model- and sample-wise double descent phenomena are not unique to deep neural networks—they exist even in the setting of Random Fourier Features of Rahimi & Recht (2008). This setting is equivalent to a two-layer neural network with $e ^ { - i x }$ activation. The first layer is initialized with a $\textstyle { \hat { \mathcal { N } } } ( 0 , { \frac { 1 } { d } } )$ Gaussian distribution and then fixed throughout training. The width (or embedding dimension) $\dot { d }$ of the first layer parameterizes the model size. The second layer is initialized with 0s and trained with MSE loss. + +Figure 14 shows the grid of Test Error as a function of both number of samples $n$ and model size $d$ . Note that in this setting $\mathrm { E M C } = d$ (the embedding dimension). As a result, as demonstrated in the figure, the peak follows the path of $n = d$ . Both model-wise and sample-wise (see figure 15) double descent phenomena are captured, by horizontally and vertically crossing the grid, respectively. + +![](images/d3b8ed60787a0868c3f5be52fec305d08ff718efc3f20f3f4f5d527b1d16e3f6.jpg) +Figure 15: Sample-wise double-descent slice for Random Fourier Features on the Fashion MNIST dataset. In this figure the embedding dimension (number of random features) is 1000. + +# E APPENDIX: ADDITIONAL EXPERIMENTS + +E.1 EPOCH-WISE DOUBLE DESCENT: ADDITIONAL RESULTS + +Here, we provide a rigorous evaluation of epoch-wise double descent for a variety of optimizers and learning rate schedules. We train ResNet18 on CIFAR-10 with data-augmentation and $20 \%$ label noise with three different optimizers—Adam, SGD, SGD $^ +$ Momentum (momentum set to 0.9) and three different learning rate schedules—constant, inverse-square root, dynamic drop for differnet values of initial learning rate. We observe that double-descent occurs reliably for all optimizers and learning rate schedules and the peak of the double descent curve shifts with the interpolation point. + +![](images/58c1328435c48b2aab09317e06f4603fa0a9e59b7a92dde853e7a8bf3b824794.jpg) +Figure 16: Epoch-wise double descent for ResNet18 trained with Adam and multiple learning rate schedules + +A practical recommendation resulting from epoch-wise double descent is that stopping the training when the test error starts to increase may not always be the best strategy. In some cases, the test error may decrease again after reaching a maximum, and the final value may be lower than the minimum earlier in training. + +![](images/1008ca2f366058ba1435cf28efaa611f9c9131e1be26e429651a63223e79e1f5.jpg) +Figure 17: Epoch-wise double descent for ResNet18 trained with SGD and multiple learning rate schedules + +![](images/488e30e35257cba7429094f8ccf62b9894c5a64f45fd96a4c9ac9360e41020b6.jpg) +Figure 18: Epoch-wise double descent for ResNet18 trained with $\mathrm { S G D + I }$ Momentum and multiple learning rate schedules + +E.2 MODEL-WISE DOUBLE DESCENT: ADDITIONAL RESULTS + +# E.2.1 CLEAN SETTINGS WITH MODEL-WISE DOUBLE DESCENT + +CIFAR100, ResNet18 + +![](images/5210617de1e3afc414e784be266f4144de44d71b2df97b8df3a125339670d3a0.jpg) +Figure 19: Top: Train and test performance as a function of both model size and train epochs. Bottom: Test error dynamics of the same model (ResNet18, on CIFAR-100 with no label noise, data-augmentation and Adam optimizer trained for $4 \mathrm { k }$ epochs with learning rate 0.0001). Note that even with optimal early stopping this setting exhibits double descent. + +![](images/fb960e5034da77700c7a7fd448a34568a0bb5b897f622766da0a04bb8ae57ec4.jpg) +Figure 20: Top: Train and test performance as a function of both model size and train epochs. Bottom: Test error dynamics of the same models. 5-Layer CNNs, CIFAR-100 with no label noise, no data-augmentation Trained with SGD for 1e6 steps. Same experiment as Figure 7. + +![](images/81c77025d124fca35d30178bb0aa53f7ec90c4883061d61bfdb0b4ef4870d8cc.jpg) +Figure 21: Left: Test error dynamics with weight decay of 5e-4 (bottom left) and without weight decay (top left). Right: Test and train error and test loss for models with varying amounts of weight decay. All models are 5-Layer CNNs on CIFAR-10 with $10 \%$ label noise, trained with data-augmentation and SGD for 500K steps. + +Here, we now study the effect of varying the level of regularization on test error. We train CIFAR10 with data-augmentation and $20 \%$ label noise on ResNet18 for weight decay co-efficients $\lambda$ ranging from 0 to 0.1. We train the networks using $\mathrm { S G D + }$ inverse-square root learning rate. Figure below shows a picture qualitatively very similar to that observed for model-wise double descent wherein ”model complexity” is now controlled by the regularization parameter. This confirms our generalized double descent hypothesis along yet another axis of Effective Model Complexity. + +![](images/2d026f82df05ae4f47eb2f36c18491bb8ff9cd5ddf873d309f4c7bc3b3b3c258.jpg) +Figure 22: Generalized double descent for weight decay. We found that using the same initial learning rate for all weight decay values led to training instabilities. This resulted in some noise in the Test Error (Weight Decay $\times$ Epochs) plot shown above. + +Language models + +![](images/ceaf06ca3257454a126e72ecfe328fbca78241c7e0b1b27a9af01838536e68eb.jpg) +Figure 23: Model-wise test error dynamics for a subsampled IWSLT‘14 dataset. Left: 4k samples, Right: 18k samples. Note that with optimal early-stopping, more samples is always better. + +![](images/548a288bc91ae0609a7c35054d158b13e6149f1b900a2a3870f131fa4fc14015.jpg) +Figure 24: Model-wise test error dynamics for a IWSLT‘14 de-en and subsampled WMT‘14 en-fr datasets. Left: IWSLT‘14, Right: subsampled (200k samples) WMT‘14. Note that with optimal early-stopping, the test error is much lower for this task. + +CIFAR10, $10 \%$ noise, SGD + +![](images/329ab7efcf3819680ed22e9d04f97aecbd6fd2941d5217d8d45d006ce1c162c0.jpg) +Figure 25: Top: Train and test performance as a function of both model size and train epochs. Bottom: Test error dynamics of the same model (CNN, on CIFAR-10 with $10 \%$ label noise, dataaugmentation and SGD optimizer with learning rate $\propto 1 / \sqrt { T } )$ ). + +# E.2.4 TRAINING PROCEDURE + +![](images/cce2a82acf0147228634fdd0581f2e67796b76009678007530194689d914a4f5.jpg) +Figure 26: Model-wise double descent for adversarial training ResNet18s on CIFAR-10 (subsampled to $2 5 \mathrm { k }$ train samples) with no label noise. We train for L2 robustness of radius $\epsilon = 0 . 5$ and $\epsilon = 1 . 0$ , using 10-step PGD (Goodfellow et al. (2014); Madry et al. (2017)). Trained using SGD (batch size 128) with learning rate 0.1 for 400 epochs, then 0.01 for 400 epochs. + +![](images/3f166e910507b6f677862e70ccd9d2fcc5d745118d0ea7693bdfe992dda82c23.jpg) +Figure 27 + +![](images/92155799e3b955426cfd287a4260029a284a4655cd2cd750acbb4e3c8ec8bdcc.jpg) +Figure 28: Effect of Ensembling (ResNets, $15 \%$ label noise). Test error of an ensemble of 5 models, compared to the base models. The ensembled classifier is determined by plurality vote over the 5 base models. Note that emsembling helps most around the critical regime. All models are ResNet18s trained on CIFAR-10 with $15 \%$ label noise, using Adam for 4K epochs (same setting as Figure 1). Test error is measured against the original (not noisy) test set, and each model in the ensemble is trained using a train set with independently-sampled $15 \%$ label noise. + +![](images/b3feb5b8e7fb91ef88b906092c18d0ee5c04fae19b187b34bbe97bc9c5642f30.jpg) +Figure 29: Effect of Ensembling (CNNs, no label noise). Test error of an ensemble of 5 models, compared to the base models. All models are 5-layer CNNs trained on CIFAR-10 with no label noise, using SGD and no data augmentation. (same setting as Figure 7). \ No newline at end of file diff --git a/md/train/B1l08oAct7/B1l08oAct7.md b/md/train/B1l08oAct7/B1l08oAct7.md new file mode 100644 index 0000000000000000000000000000000000000000..60f4ad946f32d03991eae6ecebe8030df0b497fe --- /dev/null +++ b/md/train/B1l08oAct7/B1l08oAct7.md @@ -0,0 +1,659 @@ +# DETERMINISTIC VARIATIONAL INFERENCE FOR ROBUST BAYESIAN NEURAL NETWORKS + +Anqi $\mathbf { W } \mathbf { u } ^ { 1 }$ ∗, Sebastian Nowozin2†, Edward Meeds4, Richard E. Turner3,4, Jose Miguel Hern ´ andez-Lobato ´ 3,4 & Alexander L. Gaunt4 1 Princeton Neuroscience Institute, Princeton University 2 Google AI Berlin 3 Department of Engineering, University of Cambridge 4 Microsoft Research, Cambridge anqiw@princeton.edu, nowozin@google.com, {ret26,jmh233}@cam.ac.uk, {ted.meeds, algaunt}@microsoft.com + +# ABSTRACT + +Bayesian neural networks (BNNs) hold great promise as a flexible and principled solution to deal with uncertainty when learning from finite data. Among approaches to realize probabilistic inference in deep neural networks, variational Bayes (VB) is theoretically grounded, generally applicable, and computationally efficient. With wide recognition of potential advantages, why is it that variational Bayes has seen very limited practical use for BNNs in real applications? We argue that variational inference in neural networks is fragile: successful implementations require careful initialization and tuning of prior variances, as well as controlling the variance of Monte Carlo gradient estimates. We provide two innovations that aim to turn VB into a robust inference tool for Bayesian neural networks: first, we introduce a novel deterministic method to approximate moments in neural networks, eliminating gradient variance; second, we introduce a hierarchical prior for parameters and a novel Empirical Bayes procedure for automatically selecting prior variances. Combining these two innovations, the resulting method is highly efficient and robust. On the application of heteroscedastic regression we demonstrate good predictive performance over alternative approaches. + +# 1 INTRODUCTION + +Bayesian approaches to neural network training marry the representational flexibility of deep neural networks with principled parameter estimation in probabilistic models. Compared to “standard” parameter estimation by maximum likelihood, the Bayesian framework promises to bring key advantages such as better uncertainty estimates on predictions and automatic model regularization (MacKay, 1992; Graves, 2011). These features are often crucial for informing downstream decision tasks and reducing overfitting, particularly on small datasets. However, despite potential advantages, such Bayesian neural networks (BNNs) are often overlooked due to two limitations: First, posterior inference in deep neural networks is analytically intractable and approximate inference with Monte Carlo (MC) techniques can suffer from crippling variance given only a reasonable computation budget (Kingma et al., 2015; Molchanov et al., 2017; Miller et al., 2017; Zhu et al., 2018). Second, performance of the Bayesian approach is sensitive to the choice of prior (Neal, 1993), and although we may have a priori knowledge concerning the function represented by a neural network, it is generally difficult to translate this into a meaningful prior on neural network weights. Sensitivity to priors and initialization makes BNNs non-robust and thus often irrelevant in practice. + +In this paper, we describe a novel approach for inference in feed-forward BNNs that is simple to implement and aims to solve these two limitations. We adopt the paradigm of variational Bayes (VB) for BNNs (Hinton & van Camp, 1993; MacKay, 1995c) which is normally deployed using Monte + +Carlo variational inference (MCVI) (Graves, 2011; Blundell et al., 2015). Within this paradigm we address the two shortcomings of current practice outlined above: First, we address the issue of high variance in MCVI, by reducing this variance to zero through novel deterministic approximations to variational inference in neural networks. Second, we derive a general and robust Empirical Bayes (EB) approach to prior choice using hierarchical priors. By exploiting conjugacy we derive data-adaptive closed-form variance priors for neural network weights, which we experimentally demonstrate to be remarkably effective. + +Combining these two novel ingredients gives us a performant and robust BNN inference scheme that we refer to as “deterministic variational inference” (DVI). We demonstrate robustness and improved predictive performance in the context of non-linear regression models, deriving novel closed-form results for expected log-likelihoods in homoscedastic and heteroscedastic regression (similar derivations for classification can be found in the appendix). + +Experiments on standard regression datasets from the UCI repository, (Dheeru & Karra Taniskidou, 2017), show that for identical models DVI converges to local optima with better predictive loglikelihoods than existing methods based on MCVI. In direct comparisons, we show that our Empirical Bayes formulation automatically provides better or comparable test performance than manual tuning of the prior and that heteroscedastic models consistently outperform the homoscedastic models. + +Concretely, our contributions are: + +• Development of a deterministic procedure for propagating uncertain activations through neural networks with uncertain weights and ReLU or Heaviside activation functions. • Development of an EB method for principled tuning of weight priors during BNN training. • Experimental results showing the accuracy and efficiency of our method and applicability to heteroscedastic and homoscedastic regression on real datasets. + +# 2 VARIATIONAL INFERENCE IN BAYESIAN NEURAL NETWORKS + +We start by describing the inference task that our method must solve to successfully train a BNN. Given a model $\mathcal { M }$ parameterized by weights $\pmb { w }$ and a dataset $\boldsymbol { \mathcal { D } } = ( \boldsymbol { \mathsf { x } } , \boldsymbol { \mathsf { y } } )$ , the inference task is to discover the posterior distribution $p ( \pmb { w } | \pmb { x } , \pmb { y } )$ . A variational approach acknowledges that this posterior generally does not have an analytic form, and introduces a variational distribution $q ( w ; \pmb \theta )$ parameterized by $\pmb \theta$ to approximate $p ( \pmb { w } | \pmb { x } , \pmb { y } )$ . The approximation is considered optimal within the variational family for $\pmb { \theta } ^ { * }$ that minimizes the Kullback-Leibler (KL) divergence between $q$ and the true posterior. + +$$ +\theta ^ { * } = \operatorname * { a r g m i n } _ { \theta } D _ { \mathrm { K L } } \left[ q ( \pmb { w } ; \pmb { \theta } ) | | p ( \pmb { w } | \pmb { x } , \pmb { y } ) \right] . +$$ + +Introducing a prior $p ( \pmb { w } )$ and applying Bayes rule allows us to rewrite this as optimization of the quantity known as the evidence lower bound (ELBO): + +$$ +\pmb { \theta } ^ { * } = \underset { \pmb { \theta } } { \mathrm { a r g m a x } } \left. \mathbb { E } _ { \pmb { w } \sim \ b { q } } \left[ \log p ( \pmb { y } | \pmb { w } , \pmb { x } ) \right] - D _ { \mathrm { K L } } \left[ q ( \pmb { w } ; \pmb { \theta } ) | | p ( \pmb { w } ) \right] \right. . +$$ + +Analytic results exist for the KL term in the ELBO for careful choice of prior and variational distributions (e.g. Gaussian families). However, when $\mathcal { M }$ is a non-linear neural network, the first term in equation 1 (referred to as the reconstruction term) cannot be computed exactly: this is where MC approximations with finite sample size $S$ are typically employed: + +$$ +\mathbb { E } _ { \pmb { w } \sim q } \left[ \log p ( \pmb { y } | \pmb { w } , \pmb { x } ) \right] \approx \frac { 1 } { S } \sum _ { s = 1 } ^ { S } \log p ( \pmb { y } | \pmb { w } ^ { ( s ) } , \pmb { x } ) , \quad \pmb { w } ^ { ( s ) } \sim q ( \pmb { w } ; \pmb { \theta } ) . +$$ + +Our goal in the next section is to develop an explicit and accurate approximation for this expectation, which provides a deterministic, closed-form expectation calculation, stabilizing BNN training by removing all stochasticity due to Monte Carlo sampling. + +# 3 DETERMINISTIC VARIATIONAL APPROXIMATION + +Figure 1 shows the architecture of the computation of $\mathbb { E } _ { { \pmb w } \sim q } \left[ \log p ( \mathcal { D } | { \pmb w } ) \right]$ for a feed-forward neural network. The computation can be divided into two parts: first, propagation of activations though + +![](images/f823ee8b80d28f3cd6a54a6981f773809a05478e546217caec9779615e9538cf.jpg) +Figure 1: Architecture of a Bayesian neural network. Computation is divided into (a) propagation of activations $\mathbf { \Pi } ( \pmb { a } )$ from an input $x$ and (b) computation of a log-likelihood function $\mathcal { L }$ for outputs $y$ . Weights are represented as high dimensional variational distributions (blue) that induce distributions over activations (yellow). MCVI computes using samples (dots); our method propagates a full distribution. + +parameterized layers and second, evaluation of an unparameterized log-likelihood function $( \mathcal { L } )$ . In this section, we describe how each of these stages is handled in our deterministic framework. + +# 3.1 MOMENT PROPAGATION + +We begin by considering activation propagation (figure 1(a)), with the aim of deriving the form of an approximation $\tilde { q } ( \mathbf { \bar { a } } ^ { L } )$ to the final layer activation distribution $q ( \pmb { a } ^ { L } )$ that will be passed to the likelihood computation. We compute $\mathbf { \Pi } _ { \mathbf { a } ^ { L } }$ by sequentially computing the distributions for the activations in the preceding layers. Concretely, we define the action of the $l ^ { \mathrm { t h } }$ layer that maps $\pmb { a } ^ { ( l - 1 ) }$ to $\mathbf { \delta } _ { \mathbf { { a } } } l$ as follows: + +$$ +\begin{array} { l } { { h ^ { l } = f ( { \bf { a } } ^ { ( l - 1 ) } ) , } } \\ { { { \bf { a } } ^ { l } = h ^ { l } W ^ { l } + b ^ { l } , } } \end{array} +$$ + +where $f$ is a non-linearity and $\{ W ^ { l } , b ^ { l } \} \subset w$ are random variables representing the weights and biases of the $l ^ { \mathrm { t h } }$ layer that are assumed independent from weights in other layers. For notational clarity, in the following we will suppress the explicit layer index $l$ , and use primed symbols to denote variables from the $( l - 1 ) ^ { \mathrm { t h } }$ layer, e.g. $\mathbf { { a } ^ { \prime } } = \mathbf { { a } } ^ { \left( l - 1 \right) }$ . Note that we have made the non-conventional choice to draw the boundaries of the layers such that the linear transform is applied after the nonlinearity. This is to emphasize that $\mathbf { \Delta } _ { \mathbf { \alpha } \mathbf { \alpha } \mathbf { \alpha } \mathbf { \alpha } \mathbf { \alpha } \mathbf { \alpha } \mathbf { \alpha } \mathbf { \beta } } \mathbf { \Delta } _ \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathrm \langle \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathbf { \beta } \mathrm { \left. \frac { \partial \mathbf { \alpha } \mathbf { \beta } } { \partial \mathbf { \alpha } \mathbf { \beta } \mathbf { \alpha } \mathrm { \beta \alpha } \mathrm { \beta } } }\right.$ is constructed by linear combination of many distinct elements of $\mathbf { { } } h ^ { \prime }$ , and in the limit of vanishing correlation between terms in this combination, we can appeal to the central limit theorem (CLT). Under the CLT, for a large enough hidden dimension and for variational distributions with finite first and second moments, elements $a _ { i }$ will be normally distributed regardless of the potentially complicated distribution for $h _ { j }$ induced by $f ^ { 1 }$ . We empirically observe that this claim is approximately valid even when (weak) correlations appear between the elements of $^ { h }$ during training (see section 3.1.1). + +Having argued that $^ { a }$ adopts a Gaussian form, it remains to compute the first and second moments. In general, these cannot be computed exactly, so we develop an approximate expression. An overview of this derivation is presented here with more details in appendix A. First, we model $W$ , $^ { b }$ and $^ { h }$ as independent random variables, allowing us to write: + +$$ +\begin{array} { r l } & { \langle a _ { i } \rangle = \langle h _ { j } \rangle \langle W _ { j i } \rangle + \langle b _ { i } \rangle , } \\ & { { \mathrm { C o v } } ( a _ { i } , a _ { k } ) = \langle h _ { j } h _ { l } \rangle { \mathrm { C o v } } ( W _ { j i } , W _ { l k } ) + \langle W _ { j i } \rangle { \mathrm { C o v } } ( h _ { j } , h _ { l } ) \langle W _ { l k } \rangle + { \mathrm { C o v } } ( b _ { i } , b _ { k } ) , } \end{array} +$$ + +where we have employed the Einstein summation convention and used angle brackets to indicate expectation over $q$ . If we choose a variational family with analytic forms for weight means and covariances (e.g. Gaussian with variational parameters $\langle W _ { j i } \rangle$ and $\operatorname { C o v } ( W _ { j i } , W _ { l k } ) ) ,$ ), then the only difficult terms are the moments of $^ { h }$ : + +$$ +\begin{array} { r l } & { \quad \langle h _ { j } \rangle \propto \displaystyle \int f ( \alpha _ { j } ) \exp \left[ - \frac { \left( \alpha _ { j } - \langle a _ { j } ^ { \prime } \rangle \right) ^ { 2 } } { 2 \Sigma _ { j j } ^ { \prime } } \right] \mathrm { d } \alpha _ { j } , } \\ & { \langle h _ { j } h _ { l } \rangle \propto \displaystyle \int f ( \alpha _ { j } ) f ( \alpha _ { l } ) \exp \left[ - \frac { 1 } { 2 } \left( { \alpha _ { l } - \langle a _ { l } ^ { \prime } \rangle } \right) ^ { \top } \left( { \Sigma _ { j j } ^ { \prime } } \Sigma _ { l l } ^ { \prime } \right) ^ { - 1 } \left( { \alpha _ { j } - \langle a _ { l } ^ { \prime } \rangle } \right) \right] \mathrm { d } \alpha _ { j } \mathrm { d } \alpha _ { l } , } \end{array} +$$ + +Table 1: Forms for the components of the approximation in equation 6 for Heaviside and ReLU non-linearities. $\Phi$ is the CDF of a standard Gaussian, SR is a “soft ReLU” that we define as $\operatorname { S R } ( x ) =$ $\phi ( x ) + x \Phi ( x )$ where $\phi$ is a standard Gaussian, $\bar { \rho } = \sqrt { 1 - \rho ^ { 2 } }$ , $g _ { h } = \arcsin \rho$ and $\begin{array} { r } { g _ { r } = g _ { h } + \frac { \rho } { 1 + \bar { \rho } } } \end{array}$ + +
A(μ1,μ2,p)Q(μ1,μ2,p)
HeavisideΦ(μ1)Φ(μ2)-l0g()+2 [²+-Hμ2]+O(μA) p
ReLUSR(μ1)SR(μ2) +Φ(μ1)Φ(μ2)-l0g()+[2[2g(+)(²+)+( grp
+ +where we have used the Gaussian form of $\mathbf { { a } ^ { \prime } }$ parameterized by mean $\langle { a ^ { \prime } } \rangle$ and covariance $\Sigma ^ { \prime }$ , and for brevity we have omitted the normalizing constants. Closed form solutions for the integral in equation 4 exist for Heaviside or ReLU choices of non-linearity $f$ (see appendix A). Furthermore, for these non-linearities, the $\left. a _ { j } ^ { \prime } \right. \to \pm \infty$ and $\langle a _ { l } ^ { \prime } \rangle \to \pm \infty$ asymptotes of the integral in equation 5 have closed form. Figure 2 shows schematically how these asymptotes can be used as a first approximation for equation 5. This approximation is improved by considering that (by definition) the residual decays to zero far from the origin in the $( \langle a _ { j } ^ { \prime } \rangle , \bar { \langle a _ { l } ^ { \prime } \rangle } )$ plane, and so is well modelled by a decaying function $\exp [ - Q ( \left. a _ { j } ^ { \prime } \right. , \left. a _ { l } ^ { \prime } \right. , \bar { \Sigma ^ { \prime } } ) ]$ , where $Q$ is a polynomial in $\langle { a ^ { \prime } } \rangle$ with a dominant positive even term. In practice we truncate $Q$ at the quadratic term, and calculate the polynomial coefficients by matching the moments of the resulting Gaussian with the analytic moments of the residual. Specifically, using dimensionless variables $\mu _ { i } ^ { \prime } = \left. { a _ { i } ^ { \prime } } \right. / \sqrt { \Sigma _ { i i } ^ { \prime } }$ and $\rho _ { i j } ^ { \prime } \doteq \Sigma _ { i j } ^ { \prime } / \sqrt { \Sigma _ { i i } ^ { \prime } \Sigma _ { j j } ^ { \prime } }$ , this improved approximation takes the form + +$$ +\langle h _ { j } h _ { l } \rangle = S _ { j l } ^ { \prime } \left\{ A ( \mu _ { j } ^ { \prime } , \mu _ { l } ^ { \prime } , \rho _ { j l } ^ { \prime } ) + \exp \left[ - Q ( \mu _ { j } ^ { \prime } , \mu _ { l } ^ { \prime } , \rho _ { j l } ^ { \prime } ) \right] \right\} , +$$ + +where the expressions for the dimensionless asymptote $A$ and quadratic $Q$ are given in table table 1 and derived in appendix A.2.1 and A.2.2. The dimensionful scale factor $S _ { j l } ^ { \prime }$ is 1 for a Heaviside non-linearity or $\Sigma _ { j l } ^ { \prime } / \rho _ { j l } ^ { \prime }$ for ReLU. Using equation 6 in equation 3 gives a closed form approximation for the moments of $\textbf { \em a }$ as a function of moments of $\mathbf { { a } ^ { \prime } }$ . Since $\textbf { \em a }$ is approximately normally distributed by the CLT, this is sufficient information to sequentially propagate moments all the way through the network to compute the mean and covariances of $\check { \tilde { q } } ( { \pmb a } ^ { L } )$ , our explicit multivariate Gaussian approximation to $\dot { q } ( \pmb { a } ^ { L } )$ . Any deep learning framework supporting special functions arcsin and $\Phi$ will immediately support backpropagation through the deterministic expressions we have presented. Below we briefly empirically verify the presented approximation, and in section 3.2 we will show how it is used to compute an approximate log-likelihood and posterior predictive distribution for regression and classification tasks. + +# 3.1.1 EMPIRICAL VERIFICATION + +Approximation accuracy The approximation derived above relies on three assumptions. First, that some form of CLT holds for the hidden units during training where the iid assumption of the classic CLT is not strictly enforced; second, that a quadratic truncation of $Q$ is sufficient2; and third that there are only weak correlation between layers so that they can be represented using independent variables in the variational distribution. To provide evidence that these assumptions hold in practice, we train a small ReLU network with two hidden layers each of 128 units to perform 1D heteroscedastic regression on a toy dataset of 500 points drawn from the distribution shown in figure 3(b). Deeper networks and skip connections are considered in appendix C. The training objective is taken from section 4, and the only detail required here is that $\mathbf { \Omega } _ { \pmb { a } } \hat { \bf { \xi } } ^ { L }$ is a 2-element vector where the elements are labelled as $( m , \ell )$ . We use a diagonal Gaussian variational family to represent the weights, but we preserve the full covariance of $\textbf { \em a }$ during propagation. Using an input $x = 0 . 2 5$ (see arrow, Figure 3(b)) we compute the distributions for $m$ and $\ell$ both at the start of training (where we expect the iid assumption to hold) and at convergence (where iid does not necessarily hold). Figure 3(c) shows the comparison between $\pmb { a } ^ { L }$ distributions reported by our deterministic approximation and MC evaluation using $2 0 \mathrm { k }$ samples from $q ( w ; \pmb \theta )$ . This comparison is qualitatively excellent for all cases considered. + +![](images/280d7da53ca65c4ec5b9e7748b43d3dbaade1e2d1cec6da445a4275c619abb80.jpg) +Figure 2: Approximation of $\langle h _ { j } h _ { l } \rangle$ using an asymptote and Gaussian correction for (a) Heaviside and (b) ReLU non-linearities. Yellow functions have closed-forms, and blue indicates residuals. The examples are plotted for $- 6 < \mu ^ { \prime } < 6$ and $\rho _ { j l } ^ { \prime } \stackrel { \cdot } { = } 0 . 5$ , and the relative magnitude of each correction term is indicated on the vertical axis. + +![](images/9b75fe4f6737df488fab5953978aed5e62a832cdfe331549b05ba9be4b514db4.jpg) +Figure 3: Empirical accuracy of our approximation on toy 1-dimensional data. (a) We train a 2 layer ReLU network to perform heteroscedastic regression on the dataset shown in (b) and obtain the fit shown in blue. (c) The output distributions for the activation units $m$ and $\ell$ evaluated at $x = 0 . 2 5$ are in excellent agreement with Monte Carlo (MC) integration with a large number (20k) of samples both before and after training. + +Computational efficiency In traditional MCVI, propagation of $S$ samples of $d$ -dimensional activations through a layer containing a $d \times d .$ -dimensional transformation requires $\mathcal { O } ( S d ^ { 2 } )$ compute and $\mathcal { O } ( S d )$ memory. Our DVI method approximates the $S \to \infty$ limit, while only demanding $\mathcal { O } ( d ^ { 3 } )$ compute and $O ( d ^ { 2 } )$ memory (the additional factor of $d$ arises from manipulation of the quadratically large covariance matrix $\mathrm { C o v } [ h _ { j } , h _ { l } ] )$ . Whereas MCVI can always trade compute and memory for accuracy by choosing a small value for $S$ , the inherent scaling of DVI with $d$ could potentially limit its practical use for networks with large hidden size. To avoid this limitation, we also consider the case where only the diagonal entries $\operatorname { C o v } ( h _ { j } , h _ { j } )$ are computed and stored at each layer. We refer to this method as “diagonal-DVI” (dDVI), and in section 6 we show the surprising result that the strong test performance of DVI is largely retained by dDVI across a range of datasets. Figure 4 shows the time required to propagate activations through a single layer using the MCVI, DVI and dDVI methods on a Tesla V100 GPU. As a rough rule of thumb (on this hardware), for layer sizes of practical relevance, we see that absolute DVI runtimes roughly equate to MCVI with $S = 3 0 0$ and dDVI runtime equates to $S = 1$ . + +![](images/90a9fcf1aaff27033c9cd1710f357a81505d8f63c6d07539a65926205c4b40f3.jpg) +Figure 4: Runtime performance of VI methods. We show the time to propagate a batch of 10 activation vectors through a single $d \times d$ layer. For MCVI we label curves with the number of samples used, and we show quadratic and cubic scaling guides-to-the-eye (black). Black dots indicate where our implementation runs out of memory (16GB). + +# 3.2 LOG-LIKELIHOOD EVALUATION + +To use the moment propagation procedure derived above for training BNNs, we need to build a function $\mathcal { L }$ that maps final layer activations $\pmb { a } ^ { L }$ to the expected log-likelihood term in equation 1 (see figure 1(b)). In appendix B.1 we show the intuitive result that this expected log-likelihood over $q ( w )$ + +can be rewritten as an expectation over $\tilde { q } ( { \pmb a } ^ { L } )$ . + +$$ +\mathbb { E } _ { \pmb { w } \sim q } \left[ \log p ( \pmb { y } | \pmb { x } , \pmb { w } ) \right] = \mathbb { E } _ { \pmb { a } ^ { L } \sim q ( \pmb { a } ^ { L } ) } \left[ \log p ( \pmb { y } | \pmb { a } ^ { L } ) \right] . +$$ + +With this form we can derive closed forms for specific tasks; for brevity we focus on the regression case and refer the reader to appendices B.4 and B.5 for the classification case. + +Regression Case For simplicity we consider scalar $y$ and a Gaussian noise model parameterized by mean $m ( { \pmb x } ; { \pmb w } )$ and heteroscedastic log-variance $\log \sigma _ { y } ^ { 2 } ( \pmb { x } ) = \ell ( \pmb { x } ; \pmb { w } )$ . The parameters of this Gaussian are read off as the elements of a 2-dimensional output layer $\mathbf { \boldsymbol { a } } ^ { L } = \mathbf { \dot { \boldsymbol { ( } } } m , \ell )$ so that $p ( y | \mathbf { a } ^ { L } ) = \mathcal { N } \left[ y | m , e ^ { \ell } \right]$ . Recall that these parameters themselves are uncertain and the statistics $\left. \dot { \pmb { a } } ^ { L } \right.$ and $\Sigma ^ { L }$ can be computed following section 3.1. Inserting the Gaussian forms for $p ( \boldsymbol { y } | \mathbf { \boldsymbol { a } } ^ { L } )$ and $\dot { q } ( \pmb { a } ^ { L } )$ into equation 7 and performing the integral (see appendix B.2) gives a closed form expression for the ELBO reconstruction term: + +$$ +\begin{array} { r } { \mathbb { E } _ { a ^ { L } \sim \widetilde { q } ( a ^ { L } ) } \left[ \log p ( y | a ^ { L } ) \right] = - \frac { 1 } { 2 } \left[ \log 2 \pi + \langle \ell \rangle + \frac { \Sigma _ { m m } + ( \langle m \rangle - \Sigma _ { m \ell } - y ) ^ { 2 } } { e ^ { \langle \ell \rangle - \Sigma _ { \ell \ell } / 2 } } \right] . } \end{array} +$$ + +This heteroscedastic model can be made homoscedastic by setting $\langle \ell \rangle = \Sigma _ { \ell \ell } = \Sigma _ { m \ell } = 0$ . The expression in equation 8 completes the derivations required to implement the closed form approximation to the ELBO reconstruction term for training a network. In addition, we can also compute a closed form approximation to the predictive distribution that is used at test-time to produce predictions that incorporate all parameter uncertainties. By approximating the moments of the posterior predictive and assuming normality (see appendix B.3), we find: + +$$ +p ( y ) \approx \int p ( y | a ^ { L } ) \tilde { q } ( a ^ { L } ) d a ^ { L } \approx \mathcal { N } \left( y \Big | \langle m \rangle , \Sigma _ { m m } + e ^ { \langle \ell \rangle + \Sigma _ { \ell \ell } / 2 } \right) . +$$ + +# 4 EMPIRICAL BAYES FOR VARIATIONAL BNNS + +So far, we have described methods for deterministic approximation of the reconstruction term in the ELBO. We now turn to the KL term. For a $d$ -dimensional Gaussian prior $p ( \pmb { w } ) = \mathcal { N } ( \pmb { \mu } _ { \mathrm { p } } , \pmb { \Sigma } _ { \mathrm { p } } )$ , the KL divergence with the Gaussian variational distribution $q = \mathcal { N } ( \mu _ { \mathrm { q } } , \mathbf { \bar { Z } } _ { \mathrm { q } } )$ has closed form: + +$$ +\begin{array} { r } { D _ { \mathrm { K L } } \left[ q | | p \right] = \frac { 1 } { 2 } \left[ \log \frac { | \Sigma _ { \mathrm { p } } | } { | \Sigma _ { \mathrm { q } } | } - d + \mathrm { T r } \left( \Sigma _ { \mathrm { p } } ^ { - 1 } \Sigma _ { \mathrm { q } } \right) + ( \mu _ { \mathrm { p } } - \mu _ { \mathrm { q } } ) ^ { \top } \Sigma _ { \mathrm { p } } ^ { - 1 } ( \mu _ { \mathrm { p } } - \mu _ { \mathrm { q } } ) \right] . } \end{array} +$$ + +However, this requires selection of $( \mu _ { \mathrm { p } } , \pmb { \Sigma } _ { \mathrm { p } } )$ for which there is usually little intuition beyond arguing $\mu _ { \mathrm { p } } = 0$ by symmetry and choosing $\Sigma _ { \mathrm { p } }$ to preserve the expected magnitude of the propagated activations (Glorot $\&$ Bengio, 2010; He et al., 2015). In practice, variational Bayes for neural network parameters is sensitive to the choice of prior variance parameters, and we will demonstrate this problem empirically in section 6 (figure 5). + +To make variational Bayes robust we parameterize the prior hierarchically, retaining a conditional diagonal Gaussian prior and variational distribution on the weights. The hierarchical prior takes the form $\mathbf { s } \sim p ( \mathbf { s } ) ; w \sim p ( w | \mathbf { s } )$ , using an inverse gamma distribution on s as the conjugate prior to the elements of the diagonal Gaussian variance. We partition the weights into sets $\{ \lambda \}$ that typically coincide with the layer partitioning3, and assign a single element in s to each set: + +$$ +s _ { \lambda } \sim \mathrm { I n v \mathrm { - } G a m m a } ( \alpha , \beta ) , \quad w _ { i } ^ { \lambda } \sim { \mathcal N } ( 0 , s _ { \lambda } ) , +$$ + +for shape $\alpha$ and scale $\beta$ , and where $w _ { i } ^ { \lambda }$ is the $i ^ { \mathrm { t h } }$ weight in set $\lambda$ . + +Rather than taking the fully Bayesian approach, we adopt an empirical Bayes approach (Type-2 MAP), optimizing $s ^ { \lambda }$ , assuming that the integral is dominated by a contribution from this optimal value $s ^ { \lambda } \overset { \cdot } { = } s _ { \ast } ^ { \lambda }$ . We use the data to inform the optimal setting of $s _ { * } ^ { \bar { \lambda } }$ to produce the tightest ELBO: + +$$ +\begin{array} { r l } & { \mathrm { E L B O } = \mathbb { E } _ { w \sim q } \left[ \log p ( y | h ^ { L } ( w ) ) \right] - \left\{ D _ { \mathrm { K L } } \left[ q ( w ; \theta ) | | p ( w | \mathbf { s } _ { \ast } ) p ( \mathbf { s } _ { \ast } ) \right] \right\} } \\ & { \qquad \implies s _ { \ast } ^ { \lambda } = \underset { s ^ { \lambda } } { \mathrm { a r g m i n } } \left\{ D _ { \mathrm { K L } } \left[ q ( w ; \theta ) | | p ( w ^ { \lambda } | s ^ { \lambda } ) \right] - \log p ( s ^ { \lambda } ) \right\} } \end{array} +$$ + +Writing out the integral for the $\mathrm { K L }$ in equation 12, substituting in the forms of the distributions in equation 11 and differentiating to find the optimum gives + +$$ +s _ { * } ^ { \lambda } = \frac { \mathrm { T r } \left[ \Sigma _ { \mathrm { q } } ^ { \lambda } + \pmb { \mu } _ { \mathrm { q } } ^ { \lambda } ( \pmb { \mu } _ { \mathrm { q } } ^ { \lambda } ) ^ { \top } \right] + 2 \beta } { \Omega ^ { \lambda } + 2 \alpha + 2 } , +$$ + +where $\Omega ^ { \lambda }$ is the number of weights in the set $\lambda$ . The influence of the data on the choice of $s _ { * } ^ { \lambda }$ is made explicit here through dependence on the learned variational parameters $\Sigma _ { \mathrm { q } }$ and $\pmb { \mu } _ { \mathrm { q } }$ . Using $s _ { * } ^ { \lambda }$ to populate the elements of the diagonal prior variance $\Sigma _ { \mathrm { p } }$ , we can evaluate the KL in equation 10 under the empirical Bayes prior. Optimization of the resulting ELBO then simultaneously tunes the variational distribution and prior. + +In the experiments we will demonstrate that the proposed empirical Bayes approach works well; however, it only approximates the full Bayesian solution, and it could fail if we were to allow too many degrees of freedom. To see this, assume we were to use one prior per weight element, and we would also define a hyperprior for each prior mean. Then, adjusting both the prior variance and prior mean using empirical Bayes would always lead to a KL-divergence of zero and the ELBO objective would degenerate into maximum likelihood. + +# 5 RELATED WORK + +Bayesian neural networks have a rich history. In a 1992 landmark paper David MacKay demonstrated the many potential benefits of a Bayesian approach to neural network learning (MacKay, 1992); in particular, this work contained a convincing demonstration of naturally accounting for model flexibility in the form of the Bayesian Occam’s razor, facilitating comparison between different models, accurate calibration of predictive uncertainty, and to perform learning robust to overfitting. However, at the time Bayesian inference was achieved only for small and shallow neural networks using a comparatively crude Laplace approximation. Another early review article summarizing advantages and challenges in Bayesian neural network learning is (MacKay, 1995c). + +This initial excitement around Bayesian neural networks led to two main methods being developed; First, Hinton & van Camp (1993) and MacKay (1995b) developed the variational Bayes (VB) approach for posterior inference. Whereas Hinton & van Camp (1993) were motivated from a minimum description length (MDL) compression perspective, MacKay (1995b) motivated his equivalent ensemble learning method from a statistical physics perspective of variational free energy minimization. Barber & Bishop (1998) extended the methodology for two-layer neural networks to use general multivariate Normal variational distributions. Second, Neal (1993) developed efficient gradient-based Monte Carlo methods in the form of “hybrid Monte Carlo”, now known as Hamiltonian Monte Carlo, and also raised the question of prior design and limiting behaviour of Bayesian neural networks. + +Rebirth of Bayesian neural networks. After more than a decade of no further work on Bayesian neural networks Graves (2011) revived the field by using Monte Carlo variational inference (MCVI) to make VB practical and scalable, demonstrating gains in predictive performance on real world tasks. + +Since 2015 the VB approach to Bayesian neural networks is mainstream (Blundell et al., 2015); key research drivers since then are the problems of high variance in MCVI and the search for useful variational families. One approach to reduce variance in feedforward networks is the local reparameterization trick (Kingma et al., 2015) (see appendix E). To enhance the variational families more complicated distributions such as Matrix Gaussian posteriors (Louizos & Welling, 2016), multiplicative posteriors (Kingma et al., 2015), and hierarchical posteriors (Louizos & Welling, 2017) are used. Both our methods, the deterministic moment approximation and the empirical Bayes estimation, can potentially be extended to these richer families. + +Prior choice. Choosing priors in Bayesian neural networks remains an open issue. The hierarchical priors for feedforward neural networks that we use have been investigated before by Neal (1993) and MacKay (1995a), the latter proposing a “cheap and cheerful” heuristic, alternating optimization of weights and inverse variance parameters. Barber & Bishop (1998) also used a hierarchical prior and an efficient closed-form factored VB approximation; our approach can be seen as a point estimate to their approach in order to enable use of our closed-form moment approximation. Note that Barber & Bishop (1998) manipulate an expression for $\langle h _ { j } h _ { l } \rangle$ into a one-dimensional integral, whereas our approach gives closed form approximations for this integral without need for numerical integration. Graves (2011) also used hierarchical Gaussian priors with flat hyperpriors, deriving a closed-form update for the prior mean and variance. Compared to these prior works our approach is rigorous and with sufficient data accurately approximates the Bayesian approach of integrating over the prior parameters. + +Alternative inference procedures. As an alternative to variational Bayes, probabilistic backpropagation (PBP) (Hernandez-Lobato & Adams, 2015) applies approximate inference in the form of ´ assumed density filtering (ADF) to refine a Gaussian posterior approximation. Like in our work, each update to the approximate posterior requires propagating means and variances of activations through the network. (Hernandez-Lobato & Adams, 2015) only consider the diagonal propagation case and ´ homoscedastic regression. Since the original work, PBP has been generalized to classification (Ghosh et al., 2016) and richer posterior families such as the matrix variate Normal posteriors (Sun et al., 2017). Our moment approximation could be used to improve the inference accuracy of PBP, and since we handle minibatches of data rather than processing one data point at a time, our method is more computationally efficient. + +Gaussianity in neural networks. Our demonstration of Gaussianity of ReLU network activations is also directly relevant to recent work on Gaussian process interpretations of deep neural networks (Matthews et al., 2018; Lee et al., 2017), validating the insight that activations in deep neural networks are closely approximated by Gaussian processes. Two recent works derived deterministic moment approximations for deep neural networks: Bibi et al. (2018), using Price’s theorem, derived exact first and second moment expressions for ReLU activations but limit themselves to the case of zero-mean Gaussian activations. Kandemir et al. (2018) also derive closed-form solutions to the ELBO for the case of diagonal Gaussian variational families. However, their approach is limited to linear layers without bias. + +Markov chain Monte Carlo approaches. Another rich class of approximate inference methods for Bayesian neural networks are stochastic gradient Markov chain Monte Carlo (SG-MCMC) methods. These methods allow for approximate posterior parameter inference using unbiased log-likelihood estimates. Stochastic gradient Langevin dynamics (SGLD) was the first method in this class (Welling & Teh, 2011). SGLD is particularly simple and efficient to implement, but recent methods increase efficiency in the case of correlated posteriors by estimating the Fisher information matrix (Ahn et al., 2012) and extend Hamiltonian Monte Carlo to the stochastic gradient case (Chen et al., 2014). A complete characterization of SG-MCMC methods is given by (Ma et al., 2015; Gong et al., 2018). However, despite this progress, important theoretical questions regarding approximation guarantees for practical computational budgets remain (Nagapetyan et al., 2017). Moreover, while SG-MCMC methods work robustly in practice, they remain computationally inefficient, especially because evaluation of the posterior predictive requires evaluating an ensemble of models. + +Wild approximations. The above methods are principled but often require sophisticated implementations; recently, a few methods aim to provide “cheap” approximations to the Bayes posterior. Dropout has been interpreted by Gal & Ghahramani (2016) to approximately correspond to variational inference. Likewise, Bootstrap posteriors (Lakshminarayanan et al., 2017; Fushiki et al., 2005; Harris, 1989) have been proposed as a general, robust, and accurate method for posterior inference. However, obtaining a bootstrap posterior ensemble of size $k$ is computationally intense at $k$ times the computation of training a single model. + +# 6 EXPERIMENTS + +We implement4 deterministic variational inference (DVI) as described above to train small ReLU networks on UCI regression datasets (Dheeru & Karra Taniskidou, 2017). The experiments address the claims that our methods for eliminating gradient variance and automatic tuning of the prior improve the performance of the final trained model. In Appendix D we present extended results to demonstrate that our method is competitive against a variety of models and inference schemes. + +
Dataset|D|dDVIdDVIMCVIhoDVI
bost50613-2.41 ±0.02-2.42 ±0.02-2.46 ±0.02-2.58 ± 0.04
conc10308-3.06 ±0.01-3.07 ±0.02-3.07 ±0.01-3.23 ± 0.01
ener7688-1.01 ±0.06-1.06 ±0.06-1.03 ±0.04-2.09 ±0.06
kin8819281.13 ±0.001.13 ± 0.001.14±0.001.01 ± 0.01
nava11934166.29 ±0.046.22 ±0.065.94 ± 0.055.84±0.06
powe95684-2.80 ±0.00-2.80±0.00-2.80±0.00-2.82 ±0.00
prot457309-2.85 ±0.01-2.84±0.01-2.87 ±0.01-2.94 ± 0.00
wine158811-0.90±0.01-0.91 ±0.02-0.92 ±0.01-0.96 ±0.01
yach3086-0.47± 0.03-0.47±0.03-0.68 ±0.03-1.41 ± 0.03
+ +Table 2: Average test log-likelihood on UCI datasets. $| \mathcal D |$ is the dataset size, and $d _ { x }$ is the input dimension. + +Deterministic vs. Stochastic We compare DVI with MCVI from equation 2 with $S = 1 0$ samples (we consider vanilla MCVI and discuss the local reparameterization trick in appendix E). The same model is used for each inference method: a single hidden layer of 50 units for each dataset considered, extending this to 100 units in the special case of the larger protein structure dataset, prot. Although neither DVI nor MCVI is limited to a particular choice of variational family $q ( w ; \pmb \theta )$ , we use a factorized Gaussian family (i.e. a diagonal $\operatorname { C o v } ( W _ { j i } , W _ { l k } ) )$ . Factorization reduces the computational complexity of terms involving $\operatorname { C o v } ( W _ { j i } , W _ { l k } )$ in $\mathrm { D V I } ^ { 5 }$ from $\mathcal { O } ( N ^ { 2 } )$ to $\mathcal { O } ( N )$ , where $N$ is the number of elements in $W$ (see appendix A.1). Additionally, both methods use the same EB prior from equation 13 with a broad inverse Gamma hyperprior $\langle \alpha = 1$ , $\beta = 1 0 $ ) and an independent $s _ { \lambda }$ for each linear transformation. Each dataset is split into random training and test sets with $90 \%$ and $10 \%$ of the data respectively. This splitting process is repeated 20 times and the average test performance of each method at convergence is reported in table 2 (see also learning curves in appendix F). We see that DVI consistently outperforms MCVI, by up to 0.35 nats per data point on some datasets. The computationally efficient diagonal-DVI (dDVI) surprisingly retains much of this performance. By default we use the heteroscedastic model, and we observe that this uniformly delivers better results than a homoscedastic model (hoDVI; rightmost column in table 2) on these datasets with no overfitting issues6. + +Empirical Bayes In Figure 5 we compare the performance of networks trained with manual tuning of a fixed Gaussian prior to networks trained with the automatic EB tuning. We find that the EB method consistently finds priors that produce models with competitive or significantly improved test log-likelihood relative to the best manual setting. Since this observation holds across all datasets considered, we say that our method is “robust”. Note that the EB method can outperform manual tuning because it automatically finds different prior variances for each weight matrix, whereas in the manual tuning case we search over a single hyperparameter control + +![](images/45c2862c82a0f5a44adf9add464d56fd6c2aab734ecf75679fe120c4afa11730.jpg) +Figure 5: Comparison of converged test log-likelihood with a manually tuned prior variance (orange) or empirical Bayes (blue). + +ling all prior variances. An additional ablation study showing the relative contribution of our deterministic approach and the EB prior are shown in appendix D.1. + +# 7 CONCLUSION + +We introduced two innovations to make variational inference for neural networks more robust: 1. an effective deterministic approximation to the moments of activations of a neural networks; and 2. a simple empirical Bayes hyperparameter update. We demonstrate that together these innovations make variational Bayes a competitive method for Bayesian inference in neural heteroscedastic regression models. + +Bayesian neural networks have been shown to substantially improve upon standard networks in these settings where calibrated predictive uncertainty estimates, sequential decision making, or continual learning without catastrophic forgetting are required (see e.g. Oliveira et al. (2016); Gal et al. (2017); Nguyen et al. (2018)). In future work, the new innovations proposed in this paper can be applied to these areas. In the sequential decision making and continual learning applications, approximate Bayesian inference must be run as an inner loop of a larger algorithm. This requires a robust and automated version of BNN training: this is precisely where we believe the innovations in this paper will have large impact since they pave the way to automated and robust deployment of BBNs that do not involve an expert in-the-loop. + +# REFERENCES + +Sungjin Ahn, Anoop Korattikara, and Max Welling. Bayesian posterior sampling via stochastic gradient Fisher scoring. arXiv preprint arXiv:1206.6380, 2012. + +David Barber and Christopher M Bishop. Ensemble learning in Bayesian neural networks. NATO ASI SERIES F COMPUTER AND SYSTEMS SCIENCES, 168:215–238, 1998. + +Adel Bibi, Modar Alfadly, and Bernard Ghanem. Analytic expressions for probabilistic moments of PL-DNN with Gaussian input. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018. + +Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint arXiv:1505.05424, 2015. + +Thang Bui, Daniel Hernandez-Lobato, Jose Hernandez-Lobato, Yingzhen Li, and Richard Turner. ´ Deep Gaussian processes for regression using approximate expectation propagation. In International Conference on Machine Learning, pp. 1472–1481, 2016. + +Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient Hamiltonian Monte Carlo. In International Conference on Machine Learning, pp. 1683–1691, 2014. + +Dua Dheeru and Efi Karra Taniskidou. UCI machine learning repository, 2017. URL http: //archive.ics.uci.edu/ml. + +Tadayoshi Fushiki, Fumiyasu Komaki, Kazuyuki Aihara, et al. Nonparametric bootstrap prediction. Bernoulli, 11(2):293–307, 2005. + +Yarin Gal and Zoubin Ghahramani. Dropout as a Bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059, 2016. + +Yarin Gal, Riashat Islam, and Zoubin Ghahramani. Deep bayesian active learning with image data. In International Conference on Machine Learning, 2017. + +Soumya Ghosh, Francesco Maria Delle Fave, and Jonathan S Yedidia. Assumed density filtering methods for learning Bayesian neural networks. In AAAI, pp. 1589–1595, 2016. + +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. + +Wenbo Gong, Yingzhen Li, and Jose Miguel Hern ´ andez-Lobato. Meta-learning for stochastic gradient ´ MCMC. arXiv preprint arXiv:1806.04522, 2018. + +Alex Graves. Practical variational inference for neural networks. In Advances in neural information processing systems, pp. 2348–2356, 2011. + +Ian R Harris. Predictive fit for natural exponential families. Biometrika, 76(4):675–684, 1989. + +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. + +Jose Miguel Hern ´ andez-Lobato and Ryan Adams. Probabilistic backpropagation for scalable learning ´ of Bayesian neural networks. In International Conference on Machine Learning, pp. 1861–1869, 2015. + +GE Hinton and Drew van Camp. Keeping neural networks simple by minimising the description length of weights. In Proceedings of COLT-93, pp. 5–13, 1993. + +Melih Kandemir, Manuel Haussmann, and Fred A Hamprecht. Sampling-free variational inference of Bayesian neural nets. arXiv preprint arXiv:1805.07654, 2018. + +Diederik P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Advances in Neural Information Processing Systems, pp. 2575–2583, 2015. + +Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in Neural Information Processing Systems, pp. 6402–6413, 2017. + +Jaehoon Lee, Yasaman Bahri, Roman Novak, Samuel S Schoenholz, Jeffrey Pennington, and Jascha Sohl-Dickstein. Deep neural networks as gaussian processes. arXiv preprint arXiv:1711.00165, 2017. + +Christos Louizos and Max Welling. Structured and efficient variational deep learning with matrix Gaussian posteriors. In International Conference on Machine Learning, pp. 1708–1716, 2016. + +Christos Louizos and Max Welling. Multiplicative normalizing flows for variational Bayesian neural networks. arXiv preprint arXiv:1703.01961, 2017. + +Yi-An Ma, Tianqi Chen, and Emily Fox. A complete recipe for stochastic gradient MCMC. In Advances in Neural Information Processing Systems, pp. 2917–2925, 2015. + +David JC MacKay. A practical Bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992. + +David JC MacKay. Bayesian neural networks and density networks. Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment, 354(1):73–80, 1995a. + +David JC MacKay. Developments in probabilistic modelling with neural networks—ensemble learning. In Neural Networks: Artificial Intelligence and Industrial Applications, pp. 191–198. Springer, 1995b. + +David JC MacKay. Probable networks and plausible predictionsa review of practical Bayesian methods for supervised neural networks. Network: Computation in Neural Systems, 6(3):469–505, 1995c. + +Alexander G de G Matthews, Mark Rowland, Jiri Hron, Richard E Turner, and Zoubin Ghahramani. Gaussian process behaviour in wide deep neural networks. arXiv preprint arXiv:1804.11271, 2018. + +Andrew Miller, Nick Foti, Alexander D’Amour, and Ryan P Adams. Reducing reparameterization gradient variance. In Advances in Neural Information Processing Systems, pp. 3708–3718, 2017. + +Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Variational dropout sparsifies deep neural networks. arXiv preprint arXiv:1701.05369, 2017. + +Tigran Nagapetyan, Andrew B Duncan, Leonard Hasenclever, Sebastian J Vollmer, Lukasz Szpruch, and Konstantinos Zygalakis. The true cost of stochastic gradient Langevin dynamics. arXiv preprint arXiv:1706.02692, 2017. + +Radford M Neal. Bayesian learning via stochastic dynamics. In Advances in neural information processing systems, pp. 475–482, 1993. + +Cuong V Nguyen, Yingzhen Li, Thang D Bui, and Richard E Turner. Variational continual learning. International Conference on Learning Representations (ICLR), 2018. + +Ramon Oliveira, Pedro Tabacof, and Eduardo Valle. Known unknowns: Uncertainty quality in bayesian neural networks. In NIPS Bayesian Deep Learning Workshop, 2016. + +Christopher G. Small. Expansions and Asymptotics for Statistics. CRC Press, 2010. + +Shengyang Sun, Changyou Chen, and Lawrence Carin. Learning structured weight uncertainty in Bayesian neural networks. In Artificial Intelligence and Statistics, pp. 1283–1292, 2017. + +Jarno Vanhatalo and Aki Vehtari. Mcmc methods for MLP-network and Gaussian process and stuff—a documentation for Matlab toolbox MCMCstuff. Laboratory of computational engineering, Helsinki university of technology, 2006. + +Max Welling and Yee W Teh. Bayesian learning via stochastic gradient Langevin dynamics. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 681–688, 2011. + +Zhanxing Zhu, Ruosi Wan, and Mingjun Zhong. Neural control variates for variance reduction. arXiv preprint arXiv:1806.00159, 2018. + +# APPENDIX + +# A MOMENTS OF THE ACTIVATION VARIABLES $a ^ { \ell }$ + +Under assumption of independence of $^ { h }$ , $W$ and $^ { b }$ , we can write: + +$$ +\left. a _ { i } \right. = \left. h _ { j } W _ { j i } \right. + \left. b _ { i } \right. = \left. h _ { j } \right. \left. W _ { j i } \right. + \left. b _ { i } \right. +$$ + +$$ +\begin{array} { r l } & { \mathrm { C o v } ( a _ { i } , a _ { k } ) = \mathrm { C o v } ( h _ { j } W _ { j i } , h _ { l } W _ { l k } ) + \mathrm { C o v } ( b _ { i } , b _ { k } ) } \\ & { \qquad = \langle h _ { j } W _ { j i } h _ { l } W _ { l k } \rangle - \langle h _ { j } W _ { j i } \rangle \langle h _ { l } W _ { l k } \rangle + \mathrm { C o v } ( b _ { i } , b _ { k } ) } \\ & { \qquad = \langle h _ { j } h _ { l } \rangle \langle W _ { j i } W _ { l k } \rangle - \langle h _ { j } \rangle \langle h _ { l } \rangle \langle W _ { j i } \rangle \langle W _ { l k } \rangle + \mathrm { C o v } ( b _ { i } , b _ { k } ) } \\ & { \qquad = \langle h _ { j } h _ { l } \rangle \left[ \mathrm { C o v } ( W _ { j i } W _ { l k } ) + \langle W _ { j i } \rangle \langle W _ { l k } \rangle \right] } \\ & { \qquad - \left. h _ { j } \right. \langle h _ { l } \rangle \left. W _ { j i } \right. \langle W _ { l k } \rangle + \mathrm { C o v } ( b _ { i } , b _ { k } ) } \\ & { \qquad = \langle h _ { j } h _ { l } \rangle \mathrm { C o v } ( W _ { j i } , W _ { l k } ) + \langle W _ { j i } \rangle \mathrm { C o v } ( h _ { j } , h _ { l } ) \langle W _ { l k } \rangle + \mathrm { C o v } ( b _ { i } , b _ { k } ) , } \end{array} +$$ + +which is seen in the main text as equation 3. For Heaviside and ReLU activation functions, closed forms exist for $\langle h _ { j } \rangle$ in equation 14: + +$$ +\begin{array} { r l } { \mathrm { i s i d e } } & { \langle h _ { j } \rangle = \frac { 1 } { \sqrt { 2 \pi \Sigma _ { j j } ^ { \prime } } } \displaystyle \int _ { 0 } ^ { \infty } e ^ { - \frac { 1 } { 2 \Sigma _ { j j } ^ { \prime } } \left( \alpha _ { j } - \left. a _ { j } ^ { \prime } \right. \right) ^ { 2 } } { \mathrm { d } } \alpha _ { j } = \Phi \left( \mu _ { j } ^ { \prime } \right) } \\ { \mathrm { ~ J ~ } } & { \langle h _ { j } \rangle = \frac { 1 } { \sqrt { 2 \pi \Sigma _ { j j } ^ { \prime } } } \displaystyle \int _ { 0 } ^ { \infty } \alpha _ { j } e ^ { - \frac { 1 } { 2 \Sigma _ { j j } ^ { \prime } } \left( \alpha _ { j } - \left. a _ { j } ^ { \prime } \right. \right) ^ { 2 } } { \mathrm { d } } \alpha _ { j } = \sqrt { \Sigma _ { j j } ^ { \prime } } \mathrm { S R } ( \mu _ { j } ^ { \prime } ) , } \end{array} +$$ + +where $\mathrm { S R } ( x ) : = \phi ( x ) + x \Phi ( x )$ is a “soft ReLU”, $\phi$ and $\Phi$ represent the standard Gaussian PDF and ·CDF, and we have introduced the dimensionless variables $\dot { \mu _ { j } ^ { \prime } } = \left. { a _ { j } ^ { \prime } } \right. / \sqrt { \Sigma _ { j j } ^ { \prime } }$ . These results are is sufficient to evaluate equation 14, so in the following sections we turn to each term from equation 15. + +# A.1 EVALUATION OF TERM 1: $\langle h _ { j } h _ { l } \rangle \operatorname { C o v } ( W _ { j i } , W _ { l k } )$ + +In the general case, we can use the results from section A.2 to evaluate off-diagonal $\langle h _ { j } h _ { l } \rangle$ . However, in our experiments we always consider the the special case where $\operatorname { C o v } ( W _ { j i } , W _ { l k } )$ is diagonal. In this case we can write the first term in equation 15 as (reintroducing the explicit summation): + +$$ +\begin{array} { r l } { \displaystyle \sum _ { j l } \left. h _ { j } h _ { l } \right. \mathrm { C o v } ( W _ { j i } , W _ { l k } ) = \displaystyle \sum _ { j l } \left. h _ { j } h _ { l } \right. \delta _ { j l } \delta _ { i k } \mathrm { V a r } ( W _ { j i } ) } & { } \\ { = \delta _ { i k } \displaystyle \sum _ { j } \left. z _ { j } z _ { j } \right. \mathrm { V a r } ( W _ { j i } ) } & { } \\ { = \mathrm { d i a g } \left[ \mathrm { \mathbf { v } V a r } ( W ) \right] } \end{array} +$$ + +i.e. this term is a diagonal matrix with the diagonal given by the left product of the vector $v _ { j } = \langle h _ { j } h _ { j } \rangle$ with the matrix $\mathrm { V a r } ( W _ { k i } )$ . Note that $\langle h _ { j } h _ { j } \rangle$ can be evaluated analytically for Heaviside and ReLU activation functions: + +$$ +\begin{array} { l } { { \langle h _ { j } h _ { j } \rangle = \frac { 1 } { \sqrt { 2 \pi \Sigma _ { j j } ^ { \prime } } } \displaystyle \int _ { 0 } ^ { \infty } e ^ { - \frac { 1 } { 2 \Sigma _ { j j } ^ { \prime } } \left( \alpha _ { j } - \left. a _ { j } ^ { \prime } \right. \right) ^ { 2 } } \mathrm { d } \alpha _ { j } = \Phi \left( \mu _ { j } ^ { \prime } \right) } } \\ { { \langle h _ { j } h _ { j } \rangle = \frac { 1 } { \sqrt { 2 \pi \Sigma _ { j j } ^ { \prime } } } \displaystyle \int _ { 0 } ^ { \infty } \alpha _ { j } ^ { 2 } e ^ { - \frac { 1 } { 2 \Sigma _ { j j } ^ { \prime } } \left( \alpha _ { j } - \left. a _ { j } ^ { \prime } \right. \right) ^ { 2 } } \mathrm { d } \alpha _ { j } = \Sigma _ { j j } ^ { \prime } \left[ \mu _ { j } ^ { \prime } \phi ( \mu _ { j } ^ { \prime } ) + ( 1 + \mu _ { j } ^ { \prime 2 } ) \Phi ( \mu _ { j } ^ { \prime } ) \right] } } \end{array} +$$ + +A.2 EVALUATION OF TERM 2: $\left. W _ { j i } \right. \mathrm { C o v } ( h _ { j } , h _ { l } ) \left. W _ { l k } \right.$ + +Evaluation of $\mathrm { C o v } ( h _ { j } , h _ { l } )$ requires an expression for $\langle h _ { j } h _ { l } \rangle$ . From equation 5, we write: + +$$ +\langle h _ { j } h _ { l } \rangle \propto \int f ( \alpha _ { j } ) f ( \alpha _ { l } ) \exp \left[ - { \textstyle \frac { 1 } { 2 } } P ( \alpha _ { j } , \alpha _ { l } ; a ^ { \prime } , { \Sigma ^ { \prime } } ) \right] \mathrm { d } \alpha _ { j } \mathrm { d } \alpha _ { l } , +$$ + +where $P$ is the quadratic form: + +$$ +\begin{array} { r l } & { P ( \alpha _ { j } , \alpha _ { l } ; \boldsymbol { a } ^ { \prime } , \boldsymbol { \Sigma } ^ { \prime } ) = \left( \begin{array} { l } { \alpha _ { j } - \left. a _ { j } ^ { \prime } \right. } \\ { \alpha _ { l } - \left. a _ { l } ^ { \prime } \right. } \end{array} \right) ^ { \top } \left( \begin{array} { l l } { \Sigma _ { j j } ^ { \prime } } & { \Sigma _ { j l } ^ { \prime } } \\ { \Sigma _ { l j } ^ { \prime } } & { \Sigma _ { l l } ^ { \prime } } \end{array} \right) ^ { - 1 } \left( \begin{array} { l } { \alpha _ { j } - \left. a _ { j } ^ { \prime } \right. } \\ { \alpha _ { l } - \left. a _ { l } ^ { \prime } \right. } \end{array} \right) } \\ & { \qquad = \left( \begin{array} { l } { \eta _ { j } - \mu _ { j } ^ { \prime } } \\ { \eta _ { l } - \mu _ { l } ^ { \prime } } \end{array} \right) ^ { \top } \left( \begin{array} { l l } { 1 } & { \rho _ { j l } ^ { \prime } } \\ { \rho _ { l j } ^ { \prime } } & { 1 } \end{array} \right) ^ { - 1 } \left( \begin{array} { l } { \eta _ { j } - \mu _ { j } ^ { \prime } } \\ { \eta _ { l } - \mu _ { l } ^ { \prime } } \end{array} \right) . } \end{array} +$$ + +Here we have introduced further dimensionless variables ηj = αj /qΣ0jj , ηl = αl/pΣ0ll and $\rho _ { j l } ^ { \prime } = \Sigma _ { j l } ^ { \prime } / \sqrt { \Sigma _ { j j } ^ { \prime } \Sigma _ { l l } ^ { \prime } }$ . We can then rewrite equation 16 in tis 1 for the Heaviside non-linearity or a dimensionless integral for ReLU: $I$ using a $\mathbf { \boldsymbol { S } } _ { j l } ^ { \prime }$ $\Sigma _ { j l } ^ { \prime } / \rho _ { j l } ^ { \prime }$ + +$$ +\langle h _ { j } h _ { l } \rangle = S _ { j l } ^ { \prime } I ( \mu _ { j } ^ { \prime } , \mu _ { l } ^ { \prime } , \rho _ { j l } ^ { \prime } ) \ ; I = \frac { 1 } { Z } \int f ( \eta _ { j } ) f ( \eta _ { l } ) \exp \left[ - \frac { 1 } { 2 } P ( \eta _ { j } , \eta _ { l } ; \mu ^ { \prime } , \rho ^ { \prime } ) \right] \ \mathrm { d } \eta _ { j } \mathrm { d } \eta _ { l } . +$$ + +The normalization constant, $\mathcal { L } ,$ is evaluated by integrating over $e ^ { - P / 2 }$ and is explicitly written as $Z = 2 \pi \bar { \rho } _ { j l } ^ { \prime }$ , where $\bar { \rho } _ { j l } ^ { \prime } = \sqrt { 1 - \rho _ { j l } ^ { \prime 2 } }$ . Now, following equation 6, we have the task to write $I$ as an asymptote $A$ plus a decaying correction $e ^ { - Q }$ . To evaluate $A$ and $Q$ , we have to insert the explicit form of the non-linearity $f$ , which we do for Heaviside and ReLU functions in the next sections. + +# A.2.1 HEAVISIDE NON-LINEARITY + +For the Heaviside activation, we can represent the integral $I$ as the shaded area under the Gaussian in the upper-left quadrant shown below. In general, this integral does not have a closed form. However, for $\mu _ { j } ^ { \prime } \to \infty$ , vanishing weight appears under the Gaussian in the upper-right quadrant, so we can write down the asymptote of the integral in this limit: + +$$ +\operatorname * { l i m } _ { \mu _ { j } \to \infty } I = \frac { 1 } { Z } \int _ { \eta _ { j } = - \infty } ^ { \infty } \int _ { \eta _ { l } = 0 } ^ { \infty } \exp \left[ - \frac { 1 } { 2 } P ( \eta _ { j } , \eta _ { l } ; \mu ^ { \prime } , \rho _ { j l } ^ { \prime } ) \right] \mathrm { d } \eta _ { j } \mathrm { d } \eta _ { l } = \Phi ( \mu _ { l } ^ { \prime } ) +$$ + +![](images/0aad6e98d4b4f32985127c5b0ef1d0b6a9074da1aa40614c524e938d8eb1cad2.jpg) + +Here we performed the integral by noticing that the outer integral over $\eta _ { j }$ marginalizes out $\eta _ { j }$ from the bivariate Gaussian, leaving the inner integral as the definition of the Gaussian CDF. By symmetry, we also have $\begin{array} { r } { \operatorname* { l i m } _ { \mu _ { l } ^ { \prime } \to \infty } I = \Phi ( \mu _ { j } ^ { \prime } ) } \end{array}$ and $\scriptstyle \operatorname* { l i m } _ { \mu _ { j , l } ^ { \prime } \to - \infty } I = 0$ . We can then write down the following symmetrized form that satisfies all the limits required to qualify as an asymptote: + +$$ +A = \Phi ( \mu _ { j } ^ { \prime } ) \Phi ( \mu _ { l } ^ { \prime } ) +$$ + +To compute the correction factor we evaluate the derivatives of $( I - A )$ at the origin up to second order to match the moments of $e ^ { - Q }$ for quadratic $Q$ . Description of this process is found below + +Zeroth derivative At the origin $\mu _ { j } = \mu _ { l } = 0$ , we can diagonalize the quadratic form $P$ : + +$$ +\begin{array} { r } { P ( \eta _ { j } , \eta _ { l } ; \mathbf { 0 } , \rho _ { j l } ^ { \prime } ) = \frac { 1 } { 2 \bar { \rho } _ { j l } ^ { \prime 2 } } \left( \eta _ { j } ^ { 2 } - 2 \rho _ { j l } ^ { \prime } \eta _ { j } \eta _ { l } + \eta _ { l } ^ { 2 } \right) = \frac { 1 } { 4 \bar { \rho } _ { j l } ^ { \prime 2 } } \left( \xi _ { + } ^ { 2 } + \xi _ { - } ^ { 2 } \right) , } \end{array} +$$ + +where $\xi _ { \pm } = \sqrt { 1 \mp \rho } ( \eta _ { 1 } \pm \eta _ { 2 } )$ . Performing this change of variables in the integral gives: + +$$ +I = \frac { 1 } { 4 \pi \bar { \rho } _ { j l } ^ { \prime 2 } } \int _ { \mathcal { H } } \exp \left[ \frac { 1 } { 4 \bar { \rho } _ { j l } ^ { \prime 2 } } \left( \xi _ { + } ^ { 2 } + \xi _ { - } ^ { 2 } \right) \right] \mathrm { d } \xi _ { + } \mathrm { d } \xi _ { - } = \psi / \pi +$$ + +![](images/94f471e5238fdac87a5fa2acb8b7b944a7f9ce4fa10f7899b5afb451c4c14453.jpg) + +where we integrated in polar coordinates over the region $\mathcal { H }$ in which the Heaviside function is non-zero. The angle $\psi$ can be found from the coordinate transform between $\eta$ and $\xi \ : \mathrm { a s } ^ { 7 }$ : + +$$ +\begin{array} { r } { \psi = \arctan \sqrt { \frac { 1 + \rho _ { j l } ^ { \prime } } { 1 - \rho _ { j l } ^ { \prime } } } = \frac { \pi } { 2 } - \frac { 1 } { 2 } \operatorname { a r c c o s } \rho _ { j l } ^ { \prime } . } \end{array} +$$ + +Since $A | _ { \mu ^ { \prime } = { \bf 0 } } = \Phi ( 0 ) \Phi ( 0 ) = 1 / 4$ , we can evaluate: + +$$ +\begin{array} { c } { { ( I - A ) | _ { \mu ^ { \prime } = { \bf 0 } } = \frac { \pi } { 2 } - \frac { 1 } { 2 } \operatorname { a r c c o s } \rho _ { j l } ^ { \prime } - \frac { 1 } { 4 } } } \\ { { = \frac { 1 } { 2 \pi } \arcsin \rho _ { j l } } } \end{array} +$$ + +7Here we use the identity $\cos ( 2 \arctan x ) = \cos ^ { 2 }$ arctan x − sin2 arctan x = 1−x21+x2 + +First derivative Performing a change of variables $x _ { i } = \eta _ { i } - \mu _ { i } ^ { \prime }$ , we can write $I$ as: + +$$ +I = \frac { 1 } { Z } \int H ( x _ { j } + \mu _ { j } ^ { \prime } ) H ( x _ { l } + \mu _ { l } ^ { \prime } ) \exp \left[ - \frac { 1 } { 2 } P ( x _ { j } , x _ { l } ; \mathbf { 0 } , \rho _ { j l } ^ { \prime } ) \right] \ \mathrm { d } x _ { j } \mathrm { d } x _ { l } +$$ + +where $H$ is the Heaviside function. Now, using $\partial _ { x } H ( x ) = \delta ( x )$ , we have: + +$$ +\begin{array} { r } { \frac { \partial } { \partial \mu _ { j } ^ { \prime } } \Big | _ { \mu ^ { \prime } = \mathbf { 0 } } I = \displaystyle \frac { 1 } { Z } \int \delta ( x _ { j } ) H ( x _ { l } ) \exp \left[ - \frac { 1 } { 2 } { \cal P } ( x _ { j } , x _ { l } ; \mathbf { 0 } , \rho _ { j l } ^ { \prime } ) \right] \ \mathrm { d } x _ { j } \mathrm { d } x _ { l } = \frac { 1 } { 2 \sqrt { 2 \pi } } . } \end{array} +$$ + +In addition, using $\partial _ { x } \Phi ( x ) = \phi ( x )$ , we have: + +$$ +\begin{array} { r } { \frac { \partial } { \partial \mu _ { j } ^ { \prime } } \Big | _ { \pmb { \mu } ^ { \prime } = \pmb { 0 } } A = \frac { 1 } { 2 \sqrt { 2 \pi } } \qquad \Longrightarrow \qquad \frac { \partial } { \partial \mu _ { j } ^ { \prime } } \Big | _ { \pmb { \mu } ^ { \prime } = \pmb { 0 } } \left( I - A \right) = 0 . } \end{array} +$$ + +By symmetry $( I - A )$ also has zero gradient with respect to $\mu _ { l } ^ { \prime }$ at the origin. Therefore $Q$ has no linear term in $\mu ^ { \prime }$ . + +Second derivative Taking another derivative in equation 17 gives: + +$$ +\left. \frac { \partial ^ { 2 } } { \partial \mu _ { j } ^ { \prime 2 } } \right| _ { \mu ^ { \prime } = 0 } I = - \frac { 1 } { Z } \int \delta ( x _ { j } ) H ( x _ { l } ) { \frac { \rho _ { j l } ^ { \prime } } { \rho _ { j l } ^ { \prime 2 } } } x _ { l } \exp \left[ - \frac { 1 } { 2 } P ( x _ { j } , x _ { l } ; \mathbf { 0 } , \rho _ { j l } ^ { \prime } ) \right] \mathrm { d } x _ { j } \mathrm { d } x _ { l } = - { \frac { \rho _ { j l } ^ { \prime } } { 2 \pi \tilde { \rho } _ { j l } } } . +$$ + +where we used the identity $\begin{array} { r } { \int f ( x ) \partial _ { x } \delta ( x ) \mathrm { d } x = - \int \delta ( x ) \partial _ { x } f ( x ) \mathrm { d } x } \end{array}$ , which holds for arbitrary $f$ . In addition, we have: + +$$ +\left. \frac { \partial ^ { 2 } } { \partial \mu _ { j } ^ { \prime 2 } } \right| _ { \mu ^ { \prime } = { \bf 0 } } A = 0 \quad \Longrightarrow \quad \left. \frac { \partial ^ { 2 } } { \partial \mu _ { j } ^ { \prime 2 } } \right| _ { \mu ^ { \prime } = { \bf 0 } } ( I - A ) = - \frac { \rho _ { j l } ^ { \prime } } { 2 \pi \bar { \rho } _ { j l } ^ { \prime } } . +$$ + +and the same result holds for the second derivative w.r.t. $\mu _ { l } ^ { \prime }$ . To complete the Hessian, it is a simple extension of previous results to show that: + +$$ +\begin{array} { r } { \left. { \frac { \partial ^ { 2 } } { \partial \mu _ { j } ^ { \prime } \partial \mu _ { l } ^ { \prime } } } \right| _ { \mu ^ { \prime } = 0 } ( I - A ) = \frac { 1 - \bar { \rho } _ { j l } ^ { \prime } } { 2 \pi \bar { \rho } _ { j l } ^ { \prime } } . } \end{array} +$$ + +Now that we have obtained derivatives of the residual $( I - A )$ up to second order we propose a correction factor of the form $e ^ { - Q }$ where $Q$ is truncated at quadratic terms: + +$$ +\begin{array} { r } { Q = - \log \frac { \alpha } { 2 \pi } + \beta \left( \mu _ { j } ^ { \prime 2 } + \mu _ { l } ^ { \prime 2 } \right) + \gamma \mu _ { j } ^ { \prime 2 } \mu _ { l } ^ { \prime 2 } . } \end{array} +$$ + +We then find the coefficients $\{ \alpha , \beta , \gamma \}$ by matching $( \stackrel { ! } { = } )$ derivatives at ${ \pmb \mu } = { \bf 0 }$ : + +$$ +{ \begin{array} { r l r l } & { \quad \left. e ^ { - Q } \right| _ { \mu = 0 } = { \frac { \alpha } { 2 \pi } } } & & { { \begin{array} { l } { \pm \frac { \arcsin \rho _ { j l } ^ { \prime } } { 2 \pi } } \implies \alpha = \arcsin \rho _ { j l } ^ { \prime } } \\ { \left. { \frac { \partial } { \partial \mu _ { i } ^ { \prime } } } e ^ { - Q } \right| _ { \mu = 0 } = 0 } \end{array} } } \\ & { \quad \quad \frac { \partial ^ { 2 } } { \partial \mu _ { i } ^ { \prime 2 } } e ^ { - Q } \Bigr | _ { \mu = 0 } = - 2 \beta \frac { \alpha } { 2 \pi } } & & { { \begin{array} { l } { \pm \frac { \alpha } { 2 \pi \tilde { \rho } _ { j l } ^ { \prime } } } \\ { \left. { \frac { 1 } { 2 \pi \tilde { \rho } _ { j l } ^ { \prime } } } \right. } \end{array} } \Longrightarrow \beta = \frac { \rho _ { j l } ^ { \prime } } { 2 \alpha \tilde { \rho } _ { j l } ^ { \prime } } } \\ & { \left. \frac { \partial ^ { 2 } } { \partial \mu _ { j } ^ { \prime } \partial \mu _ { l } ^ { \prime } } e ^ { - Q } \right| _ { \mu = 0 } = \gamma \frac { \alpha } { 2 \pi } } & & { { \begin{array} { l } { \pm \frac { 1 - \tilde { \rho } _ { j l } ^ { \prime } } { 2 \pi \tilde { \rho } _ { j l } ^ { \prime } } } \\ { \left. { \frac { 1 } { 2 } } \right. } \end{array} } \Longrightarrow \gamma = \frac { 1 - \tilde { \rho } _ { j l } ^ { \prime } } { \alpha \tilde { \rho } _ { j l } ^ { \prime } } } \end{array} +$$ + +This yields the expression seen in table 1 of the main text. + +# A.2.2 RELU NON-LINEARITY + +As in the Heaviside case, we begin by computing the asymptote of $I$ by inspecting the limit as $\mu _ { j } ^ { \prime } \to \infty$ : + +$$ +\begin{array} { l } { \displaystyle \operatorname* { l i m } _ { \mu _ { j } \to \infty } I = \frac { 1 } { Z } \int _ { \eta _ { j } = - \infty } ^ { \infty } \int _ { \eta _ { l } = 0 } ^ { \infty } \eta _ { j } \eta _ { l } \exp \left[ - \frac { 1 } { 2 } P ( \eta _ { j } , \eta _ { l } ; \mu ^ { \prime } , \rho _ { j l } ^ { \prime } ) \right] \ \mathrm { d } \eta _ { j } \mathrm { d } \eta _ { l } } \\ { \displaystyle \qquad = \frac { 1 } { \sqrt { 2 \pi } } \int _ { \eta _ { l } = 0 } ^ { \infty } \mu _ { j } ^ { \prime } \eta _ { l } e ^ { - \frac { 1 } { 2 } ( \eta _ { l } - \mu _ { l } ^ { \prime } ) ^ { 2 } } \mathrm { d } \eta _ { l } + \frac { \rho _ { j l } ^ { \prime } } { \sqrt { 2 \pi } } \int _ { \eta _ { l } = 0 } ^ { \infty } \eta _ { l } ( \eta _ { l } - \mu _ { l } ) e ^ { - \frac { 1 } { 2 } ( \eta _ { l } - \mu _ { l } ^ { \prime } ) ^ { 2 } } \mathrm { d } \eta _ { l } } \\ { \displaystyle \qquad = \mu _ { j } ^ { \prime } \ \mathrm { S R } ( \mu _ { l } ^ { \prime } ) + \rho _ { j l } ^ { \prime } \Phi ( \mu _ { l } ^ { \prime } ) } \end{array} +$$ + +Now, we construct a full 2-dimensional asymptote by symmetrizing equation 18 (using properties $\operatorname { S R } ( x ) \to x$ and $\Phi ( x ) 1$ as $x \infty$ to check that the correct limits are preserved after symmetrizing): + +$$ +A = \mathrm { S R } ( \mu _ { j } ^ { \prime } ) \mathrm { S R } ( \mu _ { l } ^ { \prime } ) + \rho _ { j l } ^ { \prime } \Phi ( \mu _ { j } ^ { \prime } ) \Phi ( \mu _ { l } ^ { \prime } ) +$$ + +Next we compute the correction factor $e ^ { - Q }$ . The details of this procedure closely follow those for the Heaviside non-linearity of the previous section, so we omit them here (and in practice we use Mathematica to perform the intermediate calculations). The final result is presented in table 1 of the main text. + +# B LOG-LIKELIHOOD AND POSTERIOR PREDICTIVE COMPUTATION + +Here we give derivations of expressions quoted in section 3.2. In section B.1 we justify the intuitive result that expectation of the ELBO reconstruction term over $q ( w ; \pmb \theta )$ can be re-written as an expectation over $\tilde { q } ( \grave { a } ^ { L } )$ . We then derive expected log-likelihoods and posterior predictive distributions for the cases of univariate Gaussian regression and classification. The latter sections are arranged as follows: + +
RegressionClassification
Log-likelihood Posterior predictivesection B.2 section B.3section B.4 section B.5
+ +# B.1 LOG-LIKELIHOODS: FROM $\mathbb { E } _ { w }$ TO $\mathbb { E } _ { a ^ { L } }$ + +We begin by rewriting the reconstruction term for data point $\left( \mathbf { x } , y \right)$ in terms of $\pmb { a } ^ { L }$ + +$$ +\mathbb { E } _ { { \pmb { w } } \sim q } \left[ \log p ( y | { \pmb { w } } ) \right] = \int q ( { \pmb { w } } ) \log p ( y | { \pmb { w } } ) \ \mathrm { d } { \pmb { w } } = \int q ( { \pmb { a } } ^ { L } ) q ( { \pmb { w } } | { \pmb { a } } ^ { L } ) \log p ( y | { \pmb { w } } ) \ \mathrm { d } { \pmb { w } } \mathrm { d } { \pmb { a } } ^ { L } +$$ + +where we have suppressed explicit conditioning on $_ { \textbf { \em x } }$ for brevity. Our goal now is to perform the integral over $\pmb { w }$ , leaving the expectation in terms of $\pmb { a } ^ { L }$ only, thus allowing it to be evaluated using the approximation $\tilde { q } ( { \pmb a } ^ { \tilde { L } } )$ from section 3.1. + +To eliminate $\textbf { \em w }$ , consider the case where the output of the model is a distribution $p ( \boldsymbol { y } | \mathbf { \boldsymbol { a } } ^ { L } )$ that is a parameter-free transformation of $\pmb { a } ^ { L }$ (e.g. $\pmb { a } ^ { L }$ are logits of a softmax distribution for classification or the moments of a Gaussian for regression). Since the model output is conditioned only on $\pmb { a } ^ { L }$ , we must have $p ( y | \mathbf { w } ) = p ( y | \mathbf { a } ^ { L } )$ for all configurations $\pmb { w }$ that satisfy the deterministic transformation $\pmb { a } ^ { L } = \mathcal { M } ( \overline { { \mathbf { x } ; \pmb { w } } } )$ , where $\mathcal { M }$ is the neural network (i.e $p ( y | \mathbf { w } ) = p \dot { ( } y | \mathbf { a } ^ { L } )$ for all $\pmb { w }$ where $q ( w | \mathbf { \boldsymbol { a } } ^ { L } )$ is non-zero). This allows us to write: + +$$ +\int q ( { \pmb w } | { \pmb a } ^ { L } ) \log p ( { \pmb y } | { \pmb x } , { \pmb w } ) \mathrm { d } { \pmb w } = \log p ( { \pmb y } | { \pmb a } ^ { L } ) \int q ( { \pmb w } | { \pmb a } ^ { L } ) \mathrm { d } { \pmb w } = \log p ( { \pmb y } | { \pmb a } ^ { L } ) , +$$ + +so the reconstruction term becomes: + +$$ +\operatorname { \mathbb { E } } _ { w \sim q } \left[ \log p ( y | \mathbf { x } , w ) \right] = \int q ( \boldsymbol { a } ^ { L } ) \log p ( y | \boldsymbol { a } ^ { L } ) \mathrm { d } \boldsymbol { a } ^ { L } = \operatorname { \mathbb { E } } _ { \boldsymbol { a } ^ { L } \sim q ( \boldsymbol { a } ^ { L } ) } \left[ \log p ( y | \boldsymbol { a } ^ { L } ) \right] . +$$ + +This establishes the equivalence given in equation 7 in the main text. Since we are using an approximation to $q$ , we will actually compute $\mathbf { \widetilde { E } } _ { \pmb { a } ^ { L } \sim \widetilde { \pmb { q } } \left( \mathbf { a } ^ { L } \right) } \left[ \log p ( y | \mathbf { a } ^ { L } ) \right]$ . + +# B.2 UNIVARIATE REGRESSION: LOG-LIKELIHOOD + +Here we give a derivation of equation 8 from the main text. Throughout this section we label the 2 elements of the final activation vector as $\mathbf { \boldsymbol { a } } ^ { L } = ( m , \ell )$ . We first insert the Gaussian form for $p ( y | \mathbf { a } ^ { L } ) \sim \mathcal { N } \left[ m , e ^ { \ell } \right]$ into the log-likelihood expression: + +$$ +\begin{array} { r l r } & { } & { { \mathbb E } _ { a ^ { L } \sim \tilde { q } ( a ^ { L } ) } \left[ \log p ( y | a ^ { L } ) \right] = - \frac { 1 } { 2 } { \mathbb E } _ { a ^ { L } \sim \tilde { q } ( a ^ { L } ) } \left[ \log \left( 2 \pi \exp ( \ell ) \right) + \exp ( - \ell ) ( y - m ) ^ { 2 } \right] } \\ & { } & { = - \frac { 1 } { 2 } \log 2 \pi - \frac { 1 } { 2 } \left. \ell \right. - { \mathbb E } _ { a ^ { L } \sim \tilde { q } ( a ^ { L } ) } \left[ \exp ( - \ell ) ( y - m ) ^ { 2 } \right] . } \end{array} +$$ + +Now we use the Gaussian form of $\tilde { q } ( { \pmb a } ^ { L } )$ + +$$ +\begin{array} { r } { \tilde { q } ( \pmb { a } ^ { L } ) \propto \mathrm { e x p } \left[ - \frac { 1 } { 2 } \pmb { X } ^ { \top } ( \pmb { \Sigma } ^ { L } ) ^ { - 1 } \pmb { X } \right] ; \quad \pmb { X } = \left( \begin{array} { c } { m - \langle m \rangle } \\ { \ell - \langle \ell \rangle } \end{array} \right) . } \end{array} +$$ + +and note that + +$$ +\begin{array} { r l } & { \quad \displaystyle \int \exp ( - \ell ) \exp \left[ - \frac { 1 } { 2 } { \pmb X } ^ { \top } ( { \pmb \Sigma } ^ { L } ) ^ { - 1 } { \pmb X } \right] \ \mathrm { d } m \mathrm { d } \ell } \\ & { = \exp \left( - \langle \ell \rangle \right) \displaystyle \int \exp \left[ - \frac { 1 } { 2 } { \pmb X } ^ { \top } ( { \pmb \Sigma } ^ { L } ) ^ { - 1 } { \pmb X } - ( \ell - \langle \ell \rangle ) \right] \ \mathrm { d } m \mathrm { d } \ell } \\ & { = \exp \left( - \langle \ell \rangle \right) \displaystyle \int \exp \left[ - \frac { 1 } { 2 } { \pmb X } ^ { \top } ( { \pmb \Sigma } ^ { L } ) ^ { - 1 } { \pmb X } - e _ { \ell } ^ { \top } { \pmb X } \right] \ \mathrm { d } m \mathrm { d } \ell } \\ & { = \exp \left( \frac { \Sigma _ { \ell \ell } } { 2 } - \langle \ell \rangle \right) \displaystyle \int \exp \left[ - \frac { 1 } { 2 } ( { \pmb X } ^ { \top } + e _ { \ell } ^ { \top } { \pmb \Sigma } ^ { L } ) ( { \pmb \Sigma } ^ { L } ) ^ { - 1 } ( { \pmb X } + e _ { \ell } { \pmb \Sigma } ^ { L } ) \right] \ \mathrm { d } m \mathrm { d } \ell , } \end{array} +$$ + +where $\boldsymbol { e } _ { \ell } ^ { \top } = ( 0 , 1 )$ is the unit vector in the $\ell$ coordinate, and we completed the square to obtain the final line. Inserting equation 20 into equation 19 and marginalizing out the $\ell$ coordinate gives: + +$$ +\begin{array} { r } { \tilde { \Sigma } _ { a ^ { L } \sim \tilde { q } ( a ^ { L } ) } \left[ \log p ( y | a ^ { L } ) \right] = - \frac { 1 } { 2 } \left[ \log 2 \pi + \langle \ell \rangle + \frac { e ^ { \Sigma _ { \ell \ell } / 2 - \langle \ell \rangle } } { \sqrt { 2 \pi \Sigma _ { m m } } } \int ( y - m ) ^ { 2 } \exp \left( - \frac { [ m - ( \langle m \rangle - \Sigma _ { m \ell } ) ] ^ { 2 } } { 2 \Sigma _ { m m } } \right) \mathrm { d } m \right] } \end{array} +$$ + +Finally, performing the integral over $m$ gives the result seen in equation 8. + +# B.3 UNIVARIATE REGRESSION: POSTERIOR PREDICTIVE DISTRIBUTION + +Here we give a derivation of equation 9 from the main text. We first calculate the first and second moments of the predictive distribution under the approximation $q ( { \pmb a } ^ { L } ) \approx \tilde { q } ( { \pmb a } ^ { L } )$ : + +$$ +\begin{array} { l l } { \mathbb { E } _ { y \sim p ( y ) } [ y ] = \displaystyle \int y p ( y | a ^ { L } ) \tilde { q } ( a ^ { L } ) \ \mathrm { d } y \mathrm { d } a ^ { L } \quad } & { \mathrm { V a r } [ y ] = \mathrm { V a r } [ \mathbb { E } _ { y \sim p ( y | a ^ { L } ) } ( y ) ] + \mathbb { E } _ { y \sim p ( y ) } \left[ \mathrm { V a r } ( y | a ^ { L } ) \right] } \\ { \displaystyle } & { \qquad = \mathrm { V a r } [ m ] + \mathbb { E } _ { y \sim p ( y ) } \left[ e ^ { \varepsilon } \right] } \\ { \displaystyle } & { \qquad = \displaystyle \int \left[ \int y p ( y | a ^ { L } ) \ \mathrm { d } y \right] \tilde { q } ( a ^ { L } ) \ \mathrm { d } a ^ { L } \quad } & { = \Sigma _ { m m } + \displaystyle \int e ^ { \varepsilon } p ( y | a ^ { L } ) \tilde { q } ( a ^ { L } ) \ \mathrm { d } a ^ { L } \mathrm { d } y } \\ { \displaystyle } & { \qquad = \displaystyle \int m \tilde { q } ( a ^ { L } ) \ \mathrm { d } a ^ { L } \quad } & { = \Sigma _ { m m } + \displaystyle \int e ^ { \varepsilon } \tilde { q } ( a ^ { L } ) \ \mathrm { d } a ^ { L } } \\ { \displaystyle } & { \qquad = \langle m \rangle } \end{array} +$$ + +where the final integral in the variance computation is performed by inserting the Gaussian form for $\tilde { q } ( { \pmb a } ^ { L } )$ and completing the square. Then we assume normality of the predictive distribution to obtain the result in equation 9. + +# B.4 CLASSIFICATION: LOG-LIKELIHOOD + +There is no exact form for the expected log-likelihood for multivariate classification with logits $\pmb { a } ^ { L }$ . However, using the second-order Delta method (Small, 2010), we find the expansion + +$$ +\begin{array} { r l } & { \mathbb { E } _ { a ^ { L } \sim \tilde { q } ( a ^ { L } ) } \left[ \log p ( y | a ^ { L } ) \right] = \langle a ^ { L } \rangle - \mathbb { E } _ { a ^ { L } \sim \tilde { q } ( a ^ { L } ) } \left[ \mathrm { l o g s u m e x p } ( a ^ { L } ) \right] } \\ & { \qquad \approx \langle a ^ { L } \rangle - \mathrm { l o g s u m e x p } ( \langle a ^ { L } \rangle ) - \frac { 1 } { 2 } \left( \mathbf { p } ^ { \top } \mathrm { d i a g } ( \Sigma ^ { L } ) - \mathbf { p } ^ { \top } \Sigma ^ { L } \mathbf { p } \right) , } \end{array} +$$ + +To derive this expansion, we first state the second order expansion for the expectation of a function $g$ of random variable $_ { \textbf { \em x } }$ using the Delta method as follows8: + +$$ +\mathbb { E } \left[ g ( \pmb { x } ) \right] \approx g \left( \mathbb { E } [ \pmb { x } ] \right) + \frac { 1 } { 2 } \sum _ { i j } \left[ C _ { i j } \frac { \partial ^ { 2 } g } { \partial x _ { i } \partial x _ { j } } \right] _ { \pmb { x = \mathbb { E } } [ \pmb { x } ] } , +$$ + +where $C _ { i j } = \mathrm { C o v } ( x _ { i } , x _ { j } )$ . Now we note that the logsumexp function has a simple Hessian + +$$ +\begin{array} { r } { \frac { \partial ^ { 2 } } { \partial x _ { i } \partial x _ { j } } \log \mathrm { s u m e x p } ( \pmb { x } ) = \delta _ { i j } p _ { i } - p _ { i } p _ { j } , } \end{array} +$$ + +where $\pmb { p } = \mathrm { s o f t m a x } ( \pmb { x } )$ . Putting these results together allows us to write: + +$$ +\begin{array} { r } { \mathbb { E } \left[ \mathrm { l o g s u m e x p } ( \pmb { x } ) \right] \approx \mathrm { l o g s u m e x p } \left( \mathbb { E } [ \pmb { x } ] \right) + \frac { 1 } { 2 } \left[ \pmb { p } ^ { \top } \mathrm { d i a g } ( \pmb { C } ) - \pmb { p } ^ { \top } \pmb { C } \pmb { p } \right] _ { \pmb { x } = \mathbb { E } [ \pmb { x } ] } , } \end{array} +$$ + +This result is sufficient to complete the derivation of equation 21 and enable training of a classifier using our method. + +# B.5 CLASSIFICATION: POSTERIOR PREDICTIVE DISTRIBUTION + +Using the same second-order Delta method, we find the following expansion for the posterior predictive distribution: + +$$ +\begin{array} { r } { p ( y ) = \mathbb { E } _ { a ^ { L } \sim \bar { q } ( a ^ { L } ) } \left[ p ( y | a ^ { L } ) \right] \approx \mathbf { p } \odot \left[ 1 + \mathbf { p } ^ { \top } \boldsymbol { \Sigma } ^ { L } \mathbf { p } - \boldsymbol { \Sigma } ^ { L } \mathbf { p } + \frac { 1 } { 2 } \mathrm { d i a g } ( \boldsymbol { \Sigma } ^ { L } ) - \frac { 1 } { 2 } \mathbf { p } ^ { \top } \mathrm { d i a g } ( \boldsymbol { \Sigma } ^ { L } ) \right] . } \end{array} +$$ + +where $\mathbf { p } = \operatorname { s o f t m a x } ( \left. \pmb { a } ^ { L } \right. )$ . + +For this expansion, we begin by computing the Hessian: + +$$ +\begin{array} { r } { \nabla _ { i } \nabla _ { j } [ p ] _ { k } = \frac { \partial ^ { 2 } } { \partial x _ { i } \partial x _ { j } } p _ { k } = [ 2 p _ { i } p _ { j } - ( \delta _ { k i } p _ { j } + \delta _ { k j } p _ { i } ) + \delta _ { i k } \delta _ { j k } - \delta _ { i j } p _ { i } ] p _ { k } , } \end{array} +$$ + +where $\pmb { p } = \mathrm { s o f t m a x } ( \pmb { x } )$ , and we used the intermediate result $\nabla _ { j } [ p ] _ { k } = \delta _ { j k } p _ { k } - p _ { j } p _ { k } .$ . Then we can form the product: + +$$ +\mathrm { T r } \left[ C \nabla \nabla p \right] = p \odot \left[ 2 \mathbf { p } ^ { \top } C \mathbf { p } - 2 C \mathbf { p } + \mathrm { d i a g } ( C ) - \mathbf { p } ^ { \top } \mathrm { d i a g } ( C ) \right] +$$ + +and insert this into equation 22 to obtain equation 23. + +Preliminary experiments show that good results are obtained either using these approximations or a lightweight MC approximation just to perform the mapping of $\pmb { a } ^ { L }$ to $( \log ) { \bf p }$ after the deterministic heavy-lifting of computing $\pmb { a } ^ { L }$ . In this work we are primarily concerned with demonstrating the benefits of the moment propagation method from section 3.1, so we limit our experiments to regression examples without additional complication from approximation of the likelihood function. + +# C DEEPER NETWORKS + +Here we consider the applicability of our method to the regime of deep, narrow networks. This regime is challenging because for small hidden dimension the Gaussian approximation for $\textbf { \em a }$ (reliant on the CLT) breaks down, and these errors accumulate as the net becomes deep. We empirically explore this potential problem by investigating deep networks containing 5 layers of only 5, 25 or 125 units each. Figure 6 shows results analogous to figure 3 that qualitatively illustrate how well our approximation matches the true variational distribution of output activations both at the start and end of training. We see that our CLT-based approximation is good in the 125- and 25-unit cases, but is poor in the 5-unit case. Since it is generally considered that optimization of neural networks only works well in the high dimensional setting with at least a few tens of hidden units, these empirical observations suggest that our approximation is applicable in practically relevant architectures. + +# C.1 SKIP CONNECTIONS + +Training deep networks is considered difficult even in the traditional maximum-likelihood setting due to the problems of exploding and vanishing gradients. A popular approach to combat these issues is to add skip connections to the architecture. Here we derive the necessary results to add skip connections to our deterministic BNN. + +We consider a simple layer with skip connections of the following form: + +$$ +\begin{array} { l } { { { \pmb h } = f ( { \pmb a } ^ { \prime } ) , } } \\ { { \delta = h W + b , } } \\ { { { \pmb a } = { \pmb a } ^ { \prime } + \delta . } } \end{array} +$$ + +The moment propagation expressions for this layer are (using the bilinearity of Cov): + +$$ +\begin{array} { r } { \left. a _ { i } \right. = \left. a _ { i } ^ { \prime } \right. + \left. \delta _ { i } \right. , ~ } \\ { \mathrm { C o v } ( a _ { i } , a _ { k } ) = \mathrm { C o v } ( a _ { i } ^ { \prime } , a _ { k } ^ { \prime } ) + \mathrm { C o v } ( \delta _ { i } , \delta _ { k } ) + \mathrm { C o v } ( a _ { i } ^ { \prime } , \delta _ { k } ) + \mathrm { C o v } ( \delta _ { i } , a _ { k } ^ { \prime } ) , } \end{array} +$$ + +where $\left. { { \delta _ { i } } } \right.$ and $\operatorname { C o v } ( \delta _ { i } , \delta _ { k } )$ can be computed using analogy to equations 14 and 15. This just leaves computation of $\mathrm { C o v } ( a _ { i } ^ { \prime } , \delta _ { k } )$ and its transpose, which can be performed analytically using integral + +results and methods borrowed from appendix A. + +$$ +\begin{array} { r l r } & { } & { \mathrm { C o v } ( a _ { i } ^ { \prime } , \delta _ { k } ) = \mathrm { C o v } ( a _ { i } ^ { \prime } , \underset { j } { \sum } f ( a _ { j } ^ { \prime } ) W _ { j k } ) + \mathrm { C o v } ( a _ { i } ^ { \prime } , b _ { k } ) } \\ & { } & { = \displaystyle \sum _ { j } \left( \left. a _ { i } ^ { \prime } f ( a _ { j } ^ { \prime } ) \right. - \left. a _ { i } ^ { \prime } \right. \left. f ( a _ { j } ^ { \prime } ) \right. \right) \left. W _ { j k } \right. } \\ & { } & { = \displaystyle \sum _ { j } \left. W _ { j k } \right. \left( \Sigma _ { i j } ^ { \prime } \right) \left\{ \begin{array} { l l } { ( \Sigma _ { j j } ^ { \prime } ) ^ { - 1 } \phi ( \mu _ { j } ^ { \prime } ) \mathrm { ~ H e a v i s i d e ~ } } \\ { \qquad \phi ( \mu _ { j } ^ { \prime } ) \qquad \mathrm { R e L U ~ } } \end{array} \right. } \end{array} +$$ + +Using this result, we implement a 5-layer, 25-unit network with skip connections. In figure 6(d) we qualitatively verify the validity of our approximation on this architecture by observing a good match with Monte Carlo simulations using 20k samples. + +![](images/67df07e14fa2788649d3fd409c147568ce2276f5605b7f24c1d19643ea19678b.jpg) +Figure 6: Empirical accuracy of our approximation for 5-layer networks trained analogously to figure 3. Progressively narrower networks of (a) 125 unit (b) 25 unit and (c) 5 unit are trained and our CLT-based approximation is only seen to significantly break down in the 5-unit case. (d) Qualitative verification of our approximation applied to an architecture with skip connections (orange). + +Here we include comparison with a number of different models and inference schemes on the 9 UCI datasets considered in the main text. We report test log-likelihoods at convergence and find that our method is competitive or superior to a range of state-of-the-art techniques (reproduced from Bui et al. (20 1 6)) . + +
Datasetbostconcenerkin8navapoweprotwineyach
D50610307688192119349568457301588308
d138881649116
GP 50-2.22 ± 0.07-2.85 ± 0.02-1.29 ± 0.011.31 ± 0.014.86 ± 0.04-2.66 ± 0.01-2.95±0.05-0.67 ± 0.01-1.15 ± 0.03
DGP-150-2.33 ± 0.06-3.13 ± 0.03-1.32 ± 0.030.68 ±0.073.60 ±0.33-2.81 ± 0.01-2.55 ±0.03-0.35 ± 0.04-1.39 ± 0.14
DGP-2 50-2.17 ±0.10-2.61 ± 0.02-0.95 ±0.011.79 ± 0.024.77 ± 0.32-2.58± 0.01-2.11± 0.04-0.10±0.03-0.99 ±0.07
DGP-3 50-2.09 ± 0.07-2.63 ± 0.03-0.95 ± 0.011.93 ± 0.015.11 ± 0.23-2.58 ± 0.01-2.03 ± 0.07-0.13 ±0.02-0.94± 0.05
GP 100-2.16 ± 0.07-2.65 ± 0.02-1.11 ± 0.021.68 ± 0.015.51 ± 0.03-2.55 ± 0.01-2.52 ± 0.07-0.57 ± 0.02-1.26 ± 0.03
DGP-1 100-2.37± 0.10-2.92 ± 0.03-1.21 ± 0.021.09 ± 0.043.75 ± 0.37-2.67 ± 0.02-2.18±0.060.07± 0.03-1.34± 0.10
DGP-2 100-2.09 ±0.06-2.43 ±0.02-0.90 ±0.012.31±0.015.13 ± 0.27-2.39 ± 0.02-1.51 ± 0.090.37 ± 0.02-0.96 ± 0.06
DGP-3 100-2.13 ± 0.09-2.44± 0.02-0.91 ± 0.012.46 ± 0.015.78 ± 0.05-2.37 ± 0.02-1.32 ± 0.060.25 ± 0.03-0.80 ± 0.04
VI(KW)-2-2.64 ± 0.02-3.07 ± 0.02-1.89 ± 0.072.91±0.106.10 ±0.19-2.28 ±0.02-0.42 ±0.31-0.85 ± 0.01-1.92 ± 0.03
SGLD-2-2.38± 0.06-3.01 ± 0.03-2.21 ± 0.011.68 ± 0.003.21 ± 0.02-2.61 ± 0.01-1.23 ± 0.010.14 ± 0.02-3.23 ± 0.03
SGLD-1-2.40 ± 0.05-3.08 ± 0.03-2.39 ± 0.011.28 ± 0.003.33 ± 0.01-2.67 ± 0.00-3.11 ± 0.02-0.41 ± 0.01-2.90±0.02
HMC-1-2.27 ± 0.03-2.72 ± 0.02-0.93 ± 0.011.35 ± 0.007.31 ± 0.00-2.70±0.00-2.77 ± 0.00-0.91 ± 0.02-1.62 ± 0.01
PBP-1-2.57 ± 0.09-3.16 ± 0.02-2.04 ± 0.020.90± 0.013.73 ± 0.01-2.84± 0.01-2.97 ± 0.00-0.97 ± 0.01-1.63 ± 0.02
VI(G)-1-2.90 ± 0.07-3.39 ± 0.02-2.39 ± 0.030.90± 0.013.73± 0.12-2.89 ± 0.01-2.99 ± 0.01-0.98 ± 0.01-3.44 ± 0.16
VI(KW)-1-2.43 ±0.03-3.04 ± 0.02-2.38 ± 0.022.40± 0.055.87±0.29-2.66 ± 0.01-1.84 ± 0.07-0.78 ± 0.02-1.68 ± 0.04
Dropout-1-2.46 ± 0.25-3.04± 0.09-1.99 ± 0.090.95±0.033.80±0.05-2.89 ± 0.01-2.80± 0.05-0.93 ± 0.06-1.55 ± 0.12
DVI-2.41 ± 0.02-3.06 ± 0.01-1.01 ± 0.061.13 ± 0.006.29 ± 0.04-2.80 ±0.00-2.85± 0.01-0.90 ± 0.01-0.47 ±0.03
dDVI-2.42 ± 0.02-3.07 ± 0.02-1.06 ± 0.061.13 ± 0.006.22 ± 0.06-2.80±0.00-2.84±0.01-0.91± 0.02-0.47 ±0.03
DVI-MC−2.41 ± 0.02-3.05 ± 0.01-1.00 ± 0.061.13 ± 0.006.25±0.03-2.80±0.00-2.85±0.01-0.93 ±0.04-0.55 ± 0.03
DVI-MC-softplus-2.42 ± 0.02-3.06 ± 0.02-1.03 ± 0.051.13 ± 0.006.20± 0.04-2.80 ± 0.01-2.85 ± 0.01-0.89 ± 0.01-0.54± 0.03
MCVI-2.46 ± 0.02-3.07 ± 0.01-1.03 ± 0.041.14± 0.005.94± 0.05-2.80 ±0.00-2.87 ± 0.01-0.92 ± 0.01-0.68 ±0.03
MCVI-softplus-2.47± 0.02-3.08 ± 0.02-1.02 ± 0.051.14 ± 0.005.99 ± 0.02-2.80 ± 0.00-2.85 ± 0.01-0.92 ± 0.01-0.69 ±0.03
+ +Table 3:Average test log likelihood on UCI datasets.See table 4 for model glossary and implementation references. + +Table 4: Glossary of methods displayed in table 3 with references. Note: $\mathrm { { L } = }$ number of hidden layers; N $=$ number of Gaussian process pseudo-points. Please refer to Bui et al. (2016) for more descriptions of other state-of-the-art methods. + +
AbbreviationDescriptionImplementation
GP NGaussian process regressionBui et al. (2016)
DGP-L NDeep Gaussian process regressionBui et al. (2016)
VI(KW)-LBNN with the variational free energy evaluated using the reparameterization trick (KW= Kingma + Welling)Bui et al. (2016)
SGLD-LStochastic Gradient Langevin DynamicsBui et al. (2016)
HMC-LHamiltonian Monte CarloBui et al. (2016) using toolbox Vanhatalo & Vehtari (2006)
PBP-Lprobabilistic back-propagationHernändez-Lobato & Adams (2015)
VI(G)-Lscalable variational inference (VI) method for neural networks (G= Graves)Graves (2011)
Dropout-La technique that employs dropout during training as wellGal & Ghahramani (2016) as at prediction time.
DVIOur methodours
dDVIsame as DVI, but with diagonal activation covarianceours
DVI-MCsame as DVI, but with a light-weight Monte Carlo inte- gration only for computing the predictive distributionours
DVI-MC-softplussame as DVI-MC, but uses softplus(e) to model het- eroscedastic observation variance rather than ee.Note that in this case there is no closed form for the log-ours
MCVI-expour implementation of SVI using eelikelihood, so the lightweight final MC step is required ours
MCVI-softplusour implementation of SVI using softplus(e)ours
+ +# D.1 ABLATION STUDY + +Here we provide an ablation study that indicates the individual contributions of (1) the deterministic approximation and (2) the the empirical Bayes prior. We consider all combinations of DVI or MCVI with and without empirical Bayes. In the DVI-fixed and MCVI-fixed cases without empirical Bayes we use a fixed zero-mean Gaussian prior during training and we perform separate runs to tune the prior variance, reporting the best performance achieved (cf. figure 5)9. Since the EB approach requires no hyperparameter tuning between the datasets shown, these results hide the considerable computational advantaged that the EB approach brings. + +# E VARIANCE REDUCTION AND THE LOCAL REPARAMETERIZATION TRICK + +By eliminating MC sampling and its associated variance entirely, our method directly tackles the problem of high variance gradient estimates that hinder MC approaches to training of BNNs. Alternative methods that only reduce variance have been considered, and among these, the local + +
DatasetDVIDVI-fixedMCVIMCVI-fixed
bost-2.41 ±0.02-2.46 ±0.02-2.46 ±0.02-2.48 ±0.02
conc-3.06 ± 0.01-3.07 ±0.01-3.07 ±0.01-3.07 ±0.01
ener-1.01 ±0.06-1.07 ±0.04-1.03 ± 0.04-1.07 ±0.04
kin81.13 ± 0.001.12 ± 0.001.14 ± 0.001.13 ± 0.00
nava6.29 ± 0.046.32 ±0.045.94± 0.056.00 ±0.02
powe-2.80±0.00-2.80±0.01-2.80±0.00-2.80 ±0.00
prot-2.85 ±0.01-2.84±0.01-2.87 ±0.01-2.89 ±0.01
wine-0.90 ±0.01-0.94 ± 0.01-0.92 ±0.01-0.94 ±0.01
yach-0.47±0.03-0.49 ± 0.03-0.68 ±0.03-0.56 ±0.03
+ +Table 5: Ablation study of all combinations of DVI and MCVI with EB or a fixed prior. One standard deviation error in the last significant digit is shown in paraentheses. + +![](images/0c1541504caf3a010da360ebb8617f83e59371b056090c9a3e9a93b40d68d199.jpg) +Figure 7: Performance of MCVI vs rMCVI. (a) Gradient variance for the model shown in figure 3 with batch size $B = 1$ . Variance values are normalized such that MCVI with 1 sample appears at unit relative variance. For this model, rMCVI achieves the same variance as MCVI with roughly $5 \times$ fewer samples (b) Runtime performance of rMCVI evaluated under the conditions of figure 4. For this model, rMCVI runs with roughly $1 0 \times$ more samples in the same time as MCVI. + +reparameterization trick (Kingma et al., 2015) is particularly popular. Similar to our approach, the local reparameterization trick maps the uncertainty in the weights to an uncertainty in activations, however, unlike the fully deterministic DVI, MC methods are then used to propagate this uncertainty through non-linearities. The benefits of MCVI with the reparameterization trick (rMCVI) over vanilla MCVI are two-fold: + +• The variance of the gradient estimates during back propagation are reduced (see details in Kingma et al. (2015)). Since the sampling dimension in rMCVI only appears on the activations and not on the weights, an $H ^ { \prime } \times H$ linear transform can be implemented using $S B \times H ^ { \prime }$ by $H ^ { \prime } \times H$ matrix multiplies (where $S$ is the number of samples and $B$ is the batch size). This contrasts with the $S \times B \times H ^ { \prime }$ by $S \times H ^ { \prime } \times H$ batched matrix multiply required for MCVI. Although both of these algorithms have the same asymptotic complexity $\mathcal { O } ( S B H ^ { \prime } H )$ , a single large matrix multiplication is generally more efficient on GPUs than smaller batched matrix multiplies. + +Figure 7 shows empirical studies of the gradient variance and runtime for rMCVI vs. MCVI applied to the model described in section 3.1.1 and figure 3. To evaluate the gradient variance, we initialize the model with partially trained weights and measure the variance of the gradient of the ELBO reconstruction term $\mathcal { L }$ with respect to variational parameters. Specifically, we inspect the gradient with respect to the parameters $\dot { \Sigma } _ { q } ^ { L }$ describing the variance of the $q$ distribution for the weight matrix in the final layer. + +$$ +\scriptstyle { \mathrm { G r a d i e n t ~ v a r i a n c e : } } = { \displaystyle \operatorname* { m e a n } _ { s \in \Sigma _ { q } ^ { L } } } \left[ \operatorname { V a r } \left( { \frac { \partial { \mathcal { L } } } { \partial s } } \right) \right] +$$ + +The plots in figure 7 serve to show that rMCVI is not fundamentally different from MCVI, and the performance of one (on either the speed or variance metric) can be transformed into the other by varying the number of samples. A comparison of DVI with rMCVI is included in table 3 using the implementation labelled as “VI(KW)-1”. + +![](images/edf9e9094805bf7a539437677b7f12dba025056b59648cf98654a731ac421758.jpg) +Figure 8: Learning trajectories for the models from table 2. + +# F LEARNING CURVES + +Figure 8 shows the test log-likelihood during the training of the models from table 2 using DVI and MCVI inference algorithms. Since the underlying model is identical, both methods should achieve the same test log-likelihood given infinite time and infinite MC samples (or a suitable learning rate schedule) to mitigate the increased variance of the MCVI method. However, since we use only 10 samples and do not employ a leaning rate schedule, we find that MCVI converges to a log-likelihood that is consistently worse than that achieved by DVI. \ No newline at end of file diff --git a/md/train/B1n8LexRZ/B1n8LexRZ.md b/md/train/B1n8LexRZ/B1n8LexRZ.md new file mode 100644 index 0000000000000000000000000000000000000000..ce0b8e35f229d1662647930de0664a5fb363e55a --- /dev/null +++ b/md/train/B1n8LexRZ/B1n8LexRZ.md @@ -0,0 +1,438 @@ +# GENERALIZING HAMILTONIAN MONTE CARLO WITH NEURAL NETWORKS + +Daniel Levy1∗, Matthew D. Hoffman2, Jascha Sohl-Dickstein3 1Stanford University, 2Google AI Perception , 3Google Brain danilevy@cs.stanford.edu, {mhoffman,jaschasd}@google.com + +# ABSTRACT + +We present a general-purpose method to train Markov chain Monte Carlo kernels, parameterized by deep neural networks, that converge and mix quickly to their target distribution. Our method generalizes Hamiltonian Monte Carlo and is trained to maximize expected squared jumped distance, a proxy for mixing speed. We demonstrate large empirical gains on a collection of simple but challenging distributions, for instance achieving a $1 0 6 \times$ improvement in effective sample size in one case, and mixing when standard HMC makes no measurable progress in a second. Finally, we show quantitative and qualitative gains on a real-world task: latent-variable generative modeling. We release an open source TensorFlow implementation of the algorithm. + +# 1 INTRODUCTION + +High-dimensional distributions that are only analytically tractable up to a normalizing constant are ubiquitous in many fields. For instance, they arise in protein folding (Schutte et al., 1999), physics ¨ simulations (Olsson, 1995), and machine learning (Andrieu et al., 2003). Sampling from such distributions is a critical task for learning and inference (MacKay, 2003), however it is an extremely hard problem in general. + +Markov Chain Monte Carlo (MCMC) methods promise a solution to this problem. They operate by generating a sequence of correlated samples that converge in distribution to the target. This convergence is most often guaranteed through detailed balance, a sufficient condition for the chain to have the target equilibrium distribution. In practice, for any proposal distribution, one can ensure detailed balance through a Metropolis-Hastings (Hastings, 1970) accept/reject step. + +Despite theoretical guarantees of eventual convergence, in practice convergence and mixing speed depend strongly on choosing a proposal that works well for the task at hand. What’s more, it is often more art than science to know when an MCMC chain has converged (“burned-in”), and when the chain has produced a new uncorrelated sample (“mixed”). Additionally, the reliance on detailed balance, which assigns equal probability to the forward and reverse transitions, often encourages random-walk behavior and thus slows exploration of the space (Ichiki & Ohzeki, 2013). + +For densities over continuous spaces, Hamiltonian Monte Carlo (HMC; Duane et al., 1987; Neal, 2011) introduces independent, auxiliary momentum variables, and computes a new state by integrating Hamiltonian dynamics. This method can traverse long distances in state space with a single Metropolis-Hastings test. This is the state-of-the-art method for sampling in many domains. However, HMC can perform poorly in a number of settings. While HMC mixes quickly spatially, it struggles at mixing across energy levels due to its volume-preserving dynamics. HMC also does not work well with multi-modal distributions, as the probability of sampling a large enough momentum to traverse a very low-density region is negligibly small. Furthermore, HMC struggles with ill-conditioned energy landscapes (Girolami & Calderhead, 2011) and deals poorly with rapidly changing gradients (Sohl-Dickstein et al., 2014). + +Recently, probabilistic models parameterized by deep neural networks have achieved great success at approximately sampling from highly complex, multi-modal empirical distributions (Kingma & + +Welling, 2013; Rezende et al., 2014; Goodfellow et al., 2014; Bengio et al., 2014; Sohl-Dickstein et al., 2015). Building on these successes, we present a method that, given an analytically described distribution, automatically returns an exact sampler with good convergence and mixing properties, from a class of highly expressive parametric models. The proposed family of samplers is a generalization of HMC; it transforms the HMC trajectory using parametric functions (deep networks in our experiments), while retaining theoretical guarantees with a tractable Metropolis-Hastings accept/reject step. The sampler is trained to minimize a variation on expected squared jumped distance (similar in spirit to Pasarica & Gelman (2010)). Our parameterization reduces easily to standard HMC. It is further capable of emulating several common extensions of HMC such as withintrajectory tempering (Neal, 1996) and diagonal mass matrices (Bennett, 1975). + +We evaluate our method on distributions where HMC usually struggles, as well as on a the real-world task of training latent-variable generative models. + +Our contributions are as follows: + +• We introduce a generic training procedure which takes as input a distribution defined by an energy function, and returns a fast-mixing MCMC kernel. +• We show significant empirical gains on various distributions where HMC performs poorly. +• We finally evaluate our method on the real-world task of training and sampling from a latent variable generative model, where we show improvement in the model’s log-likelihood, and greater complexity in the distribution of posterior samples. + +# 2 RELATED WORK + +Adaptively modifying proposal distributions to improve convergence and mixing has been explored in the past (Andrieu & Thoms, 2008). In the case of HMC, prior work has reduced the need to choose step size (Neal, 2011) or number of leapfrog steps (Hoffman & Gelman, 2014) by adaptively tuning those parameters. Salimans et al. (2015) proposed an alternate scheme based on variational inference. We adopt the much simpler approach of Pasarica & Gelman (2010), who show that choosing the hyperparameters of a proposal distribution to maximize expected squared jumped distance is both principled and effective in practice. + +Previous work has also explored applying models from machine learning to MCMC tasks. Kernel methods have been used both for learning a proposal distribution (Sejdinovic et al., 2014) and for approximating the gradient of the energy (Strathmann et al., 2015). In physics, Restricted and semiRestricted Boltzmann machines have been used both to build approximations of the energy function which allow more rapid sampling (Liu et al., 2017; Huang & Wang, 2017), and to motivate new hand-designed proposals (Wang, 2017). + +Most similar to our approach is recent work from Song et al. (2017), which uses adversarial training of a volume-preserving transformation, which is subsequently used as an MCMC proposal distribution. While promising, this technique has several limitations. It does not use gradient information, which is often crucial to maintaining high acceptance rates, especially in high dimensions. It also can only indirectly measure the quality of the generated sample using adversarial training, which is notoriously unstable, suffers from “mode collapse” (where only a portion of a target distribution is covered), and often requires objective modification to train in practice (Arjovsky et al., 2017). Finally, since the proposal transformation preserves volume, it can suffer from the same difficulties in mixing across energy levels as HMC, as we illustrate in Section 5. + +To compute the Metropolis-Hastings acceptance probability for a deterministic transition, the operator must be invertible and have a tractable Jacobian. Recent work (Dinh et al., 2016), introduces RNVP, an invertible transformation that operates by, at each layer, modifying only a subset of the variables by a function that depends solely on the remaining variables. This is exactly invertible with an efficiently computable Jacobian. Furthermore, by chaining enough of these layers, the model can be made arbitrarily expressive. This parameterization will directly motivate our extension of the leapfrog integrator in HMC. + +# 3 BACKGROUND + +# 3.1 MCMC METHODS AND METROPOLIS-HASTINGS + +Let $p$ be a target distribution, analytically known up to a constant, over a space $\mathcal { X }$ . Markov chain Monte Carlo (MCMC) methods (Neal, 1993) aim to provide samples from $p$ . To that end, MCMC methods construct a Markov Chain whose stationary distribution is the target distribution $p$ . Obtaining samples then corresponds to simulating a Markov Chain, i.e., given an initial distribution $\pi _ { 0 }$ and a transition kernel $K$ , constructing the following sequence of random variables: + +$$ +X _ { 0 } \sim \pi _ { 0 } , \quad X _ { t + 1 } \sim K ( \cdot | X _ { t } ) . +$$ + +In order for $p$ to be the stationary distribution of the chain, three conditions must be satisfied: $K$ must be irreducible and aperiodic (these are usually mild technical conditions) and $p$ has to be a fixed point of $K$ . This last condition can be expressed as: $\begin{array} { r } { p ( x ^ { \prime } ) = \int K ( x ^ { \prime } | x ) p ( x ) \mathrm { d } x } \end{array}$ . This condition is most often satisfied by satisfying the stronger detailed balance condition, which can be written as: $p ( x ^ { \prime } ) K ( x | x ^ { \prime } ) = p ( x ) \dot { K } ( x ^ { \prime } | \dot { x } )$ . + +Given any proposal distribution $q$ , satisfying mild conditions, we can easily construct a transition kernel that respects detailed balance using Metropolis-Hastings (Hastings, 1970) accept/reject rules. More formally, starting from $x _ { 0 } \sim \pi _ { 0 }$ , at each step $t$ , we sample $x ^ { \prime } \sim q ( \cdot | X _ { t } )$ , and with probability $\begin{array} { r } { A ( x ^ { \prime } | x _ { t } ) = \operatorname* { m i n } \left( 1 , \frac { p ( x ^ { \prime } ) q ( x _ { t } | x ^ { \prime } ) } { p ( x _ { t } ) q ( x ^ { \prime } | x _ { t } ) } \right) } \end{array}$ , accept $x ^ { \prime }$ as the next sample $x _ { t + 1 }$ in the chain. If we reject $x ^ { \prime }$ , then we retain the previous state and $x _ { t + 1 } ~ = ~ x _ { t }$ . For typical proposals this algorithm has strong asymptotic guarantees. But in practice one must often choose between very low acceptance probabilities and very cautious proposals, both of which lead to slow mixing. For continuous state spaces, Hamiltonian Monte Carlo (HMC; Neal, 2011) tackles this problem by proposing updates that move far in state space while staying roughly on iso-probability contours of $p$ . + +# 3.2 HAMILTONIAN MONTE CARLO + +Without loss of generality, we assume $p \left( x \right)$ to be defined by an energy function $U \left( x \right)$ , s.t. $p ( x ) \propto \exp ( - U ( { \bar { x } } ) )$ , and where the state $x \in \mathbb { R } ^ { n }$ . HMC extends the state space with an additional momentum vector $v \in \mathbb { R } ^ { n }$ , where $v$ is distributed independently from $x$ , as $p ( v ) \propto \exp ( - \frac { 1 } { 2 } v ^ { T } v )$ (i.e., identity-covariance Gaussian). From an augmented state $\xi \triangleq ( x , v )$ , HMC produces a proposed state $\xi ^ { \prime } = ( \dot { x } ^ { \prime } , v ^ { \prime } )$ by approximately integrating Hamiltonian dynamics jointly on $x$ and $v$ , with $U \left( x \right)$ taken to be the potential energy, and $\scriptstyle { \frac { 1 } { 2 } } v ^ { \overline { { T } } } v$ the kinetic energy. Since Hamiltonian dynamics conserve the total energy of a system, their approximate integration moves along approximate iso-probability contours of $p \bar { ( \boldsymbol { x } , \boldsymbol { v } ) } = \bar { p } ( \boldsymbol { x } ) p ( \boldsymbol { v } )$ . + +The dynamics are typically simulated using the leapfrog integrator (Hairer et al., 2003; Leimkuhler & Reich, 2004), which for a single time step consists of: + +$$ +\begin{array} { r } { v ^ { \frac { 1 } { 2 } } = v - \frac { \epsilon } { 2 } \partial _ { x } U ( x ) ; \quad x ^ { \prime } = x + \epsilon v ^ { \frac { 1 } { 2 } } ; \quad v ^ { \prime } = v - \frac { \epsilon } { 2 } \partial _ { x } U ( x ^ { \prime } ) . } \end{array} +$$ + +Following Sohl-Dickstein et al. (2014), we write the action of the leapfrog integrator in terms of an operator $\mathbf { L }$ : $\mathbf { L } \boldsymbol { \xi } \triangleq \mathbf { L } ( \boldsymbol { x } , \boldsymbol { v } ) \triangleq ( \boldsymbol { x } ^ { \prime } , \boldsymbol { v } ^ { \prime } )$ , and introduce a momentum flip operator $\mathbf { F }$ : $\mathbf { F } ( x , v ) \triangleq$ $( x , - v )$ . It is important to note two properties of these operators. First, the transformation $\mathbf { F L }$ is an involution, i.e. $\mathbf { F L F L } ( x , v ) = \mathbf { F L } ( x ^ { \prime } , - v ^ { \prime } ) = ( x , v )$ . Second, the transformations from $( x , v )$ to $( x , v ^ { \frac { 1 } { 2 } } )$ , from $( x , v ^ { \frac { 1 } { 2 } } )$ to $( x ^ { \prime } , v ^ { \frac { 1 } { 2 } } )$ , and from $( x ^ { \prime } , v ^ { \frac { 1 } { 2 } } )$ to $( x ^ { \prime } , v ^ { \prime } )$ are all volume-preserving shear transformations i.e., only one of the variables ( $x$ or $v$ ) changes, by an amount determined by the other one. The determinant of the Jacobian, $\left. \frac { \partial [ \mathbf { F } \mathbf { L } \xi ] } { \partial \xi ^ { T } } \right.$ , is thus easy to compute. For vanilla HMC $\begin{array} { r } { \left| \frac { \partial [ \mathbf { F } \mathbf { L } \xi ] } { \partial \xi ^ { T } } \right| = 1 } \end{array}$ , but we will leave it in symbolic form for use in Section 4. The Metropolis-HastingsGreen (Hastings, 1970; Green, 1995) acceptance probability for the HMC proposal is made simple by these two properties, and is + +$$ +\begin{array} { r } { A ( \mathbf { F } \mathbf { L } \xi | \xi ) = \operatorname* { m i n } \left( 1 , \frac { p ( \mathbf { F } \mathbf { L } \xi ) } { p ( \xi ) } \left| \frac { \partial [ \mathbf { F } \mathbf { L } \xi ] } { \partial \xi ^ { T } } \right| \right) . } \end{array} +$$ + +# 4 L2HMC: TRAINING MCMC SAMPLERS + +In this section, we describe our proposed method L2HMC (for ‘Learning To Hamiltonian Monte Carlo’). Given access to only an energy function $U$ (and not samples), L2HMC learns a parametric leapfrog operator $\mathbf { L } _ { \theta }$ over an augmented state space. We begin by describing what desiderata we have for $\mathbf { L } _ { \theta }$ , then go into detail on how we parameterize our sampler. Finally, we conclude this section by describing our training procedure. + +# 4.1 AUGMENTING HMC + +HMC is a powerful algorithm, but it can still struggle even on very simple problems. For example, a two-dimensional multivariate Gaussian with an ill-conditioned covariance matrix can take arbitrarily long to traverse (even if the covariance is diagonal), whereas it is trivial to sample directly from it. Another problem is that HMC can only move between energy levels via a random walk (Neal, 2011), which leads to slow mixing in some models. Finally, HMC cannot easily traverse low-density zones. For example, given a simple Gaussian mixture model, HMC cannot mix between modes without recourse to additional tricks, as illustrated in Figure 1b. These observations determine the list of desiderata for our learned MCMC kernel: fast mixing, fast burn-in, mixing across energy levels, and mixing between modes. + +While pursuing these goals, we must take care to ensure that our proposal operator retains two key features of the leapfrog operator used in HMC: it must be invertible, and the determinant of its Jacobian must be tractable. The leapfrog operator satisfies these properties by ensuring that each sub-update only affects a subset of the variables, and that no sub-update depends nonlinearly on any of the variables being updated. We are free to generalize the leapfrog operator in any way that preserves these properties. In particular, we are free to translate and rescale each sub-update of the leapfrog operator, so long as we are careful to ensure that these translation and scale terms do not depend on the variables being updated. + +# 4.1.1 STATE SPACE + +As in HMC, we begin by augmenting the current state $x \in \mathbb { R } ^ { n }$ with a continuous momentum variable $v \in \mathbb { R } ^ { n }$ drawn from a standard normal. We also introduce a binary direction variable $d \in \{ - 1 , 1 \}$ , drawn from a uniform distribution. We will denote the complete augmented state as $\xi \triangleq ( x , v , d )$ , with probability density $p ( \xi ) = p ( x ) p ( v ) p ( d )$ . Finally, to each step $t$ of the operator $\mathbf { L } _ { \theta }$ we assign a fixed random binary mask $m ^ { t } \in \{ 0 , 1 \} ^ { n }$ that will determine which variables are affected by each sub-update. We draw $m ^ { t }$ uniformly from the set of binary vectors satisfying $\begin{array} { r } { \sum _ { i = 1 } ^ { n } m _ { i } ^ { t } = \lfloor \frac { n } { 2 } \rfloor } \end{array}$ , that is, half of the entries of $m ^ { t }$ are 0 and half are 1. For convenience, we write $\bar { m } ^ { t } = 1 - m ^ { t }$ and $x _ { m ^ { t } } = x \odot m ^ { t }$ $\odot$ denotes element-wise multiplication, and $\mathbb { 1 }$ the all ones vector). + +# 4.1.2 UPDATE STEPS + +We now describe the details of our augmented leapfrog integrator $\mathbf { L } _ { \theta }$ , for a single time-step $t$ , and for direction $d = 1$ . + +We first update the momenta $v$ . This update can only depend on a subset $\zeta _ { 1 } \triangleq ( x , \partial _ { x } U ( x ) , t )$ of the full state, which excludes $v$ . It takes the form + +We have introduced three new functions of $\zeta _ { 1 } \colon T _ { v }$ , $Q _ { v }$ , and $S _ { v }$ . $T _ { v }$ is a translation, $\exp ( Q _ { v } )$ rescales the gradient, and $\exp ( \frac { \epsilon } { 2 } S _ { v } )$ rescales the momentum. The determinant of the Jacobian of this transformation is exp $, \left( \frac { \epsilon } { 2 } \mathbb { 1 } \cdot S _ { v } ( \zeta _ { 1 } ) \right)$ . Note that if $T _ { v }$ , $Q _ { v }$ , and $S _ { v }$ are all zero, then we recover the standard leapfrog momentum update. + +We now update $x$ . As hinted above, to make our transformation more expressive, we first update a subset of the coordinates of $x$ , followed by the complementary subset. The first update, which yields $x ^ { \prime }$ and affects only $x _ { m } t$ , depends on the state subset $\zeta _ { 2 } \triangleq ( x _ { \bar { m } ^ { t } } , v , t )$ . Conversely, with $x ^ { \prime }$ defined below, the second update only affects $\boldsymbol { x } _ { \bar { m } ^ { t } } ^ { \prime }$ and depends only on $\zeta _ { 3 } \triangleq ( x _ { m ^ { t } } ^ { \prime } , v , t )$ : + +$$ +\begin{array} { l } { { x ^ { \prime } = x _ { \bar { m } ^ { t } } + m ^ { t } \odot [ x \odot \exp ( \epsilon S _ { x } ( \zeta _ { 2 } ) ) + \epsilon ( v ^ { \prime } \odot \exp ( \epsilon Q _ { x } ( \zeta _ { 2 } ) ) + T _ { x } ( \zeta _ { 2 } ) ) ] } } \\ { { x ^ { \prime \prime } = x _ { m ^ { t } } ^ { \prime } + \bar { m } ^ { t } \odot [ x ^ { \prime } \odot \exp ( \epsilon S _ { x } ( \zeta _ { 3 } ) ) + \epsilon ( v ^ { \prime } \odot \exp ( \epsilon Q _ { x } ( \zeta _ { 3 } ) ) + T _ { x } ( \zeta _ { 3 } ) ) ] . } } \end{array} +$$ + +Again, $T _ { x }$ is a translation, $\exp ( Q _ { x } )$ rescales the effect of the momenta, $\exp ( \epsilon S _ { x } )$ rescales the positions $x$ , and we recover the original leapfrog position update if $T _ { x } = Q _ { x } = S _ { x } = 0$ . The determinant of the Jacobian of the first transformation is $\bar { \exp { ( \epsilon m ^ { t } \cdot S _ { x } ( \zeta _ { 2 } ) ) } }$ , and the determinant of the Jacobian of the second transformation is $\exp { ( \epsilon \bar { m } ^ { t } \cdot S _ { x } ( \zeta _ { 3 } ) ) }$ . + +Finally, we update $v$ again, based on the subset $\zeta _ { 4 } \triangleq ( x ^ { \prime \prime } , \partial _ { x } U ( x ^ { \prime \prime } ) , t )$ : + +$$ +\begin{array} { r } { v ^ { \prime \prime } = v ^ { \prime } \odot \exp ( \frac { \epsilon } { 2 } S _ { v } ( \zeta _ { 4 } ) ) - \frac { \epsilon } { 2 } ( \partial _ { x } U ( x ^ { \prime \prime } ) \odot \exp ( \epsilon Q _ { v } ( \zeta _ { 4 } ) ) + T _ { v } ( \zeta _ { 4 } ) ) . } \end{array} +$$ + +This update has the same form as the momentum update in equation 4. + +To give intuition into these terms, the scaling applied to the momentum can enable, among other things, acceleration in low-density zones, to facilitate mixing between modes. The scaling term applied to the gradient of the energy may allow better conditioning of the energy landscape (e.g., by learning a diagonal inertia tensor), or partial ignoring of the energy gradient for rapidly oscillating energies. + +The corresponding integrator for $d = - 1$ is given in Appendix A; it essentially just inverts the updates in equations 4, 5 and 6. For all experiments, the functions $Q , S , T$ are implemented using multi-layer perceptrons, with shared weights. We encode the current time step in the MLP input. + +Our leapfrog operator $\mathbf { L } _ { \theta }$ corresponds to running $M$ steps of this modified leapfrog, $\begin{array} { r l } { \mathbf { L } _ { \theta } \boldsymbol { \xi } } & { { } = } \end{array}$ ${ \bf L } _ { \theta } ( x , v , d ) \stackrel { } { = } ( x ^ { \prime \prime \times M } , v ^ { \prime \prime \times M } , d )$ , and our flip operator $\mathbf { F }$ reverses the direction variable $d$ , $\mathbf { F } \xi =$ $( x , v , - d )$ . Written in terms of these modified operators, our proposal and acceptance probability are identical to those for standard HMC. Note, however, that this parameterization enables learning non-volume-preserving transformations, as the determinant of the Jacobian is a function of $S _ { x }$ and $S _ { v }$ that does not necessarily evaluate to 1. This quantity is derived in Appendix B. + +# 4.1.3 MCMC TRANSITIONS + +For convenience, we denote by $\mathbf { R }$ an operator that re-samples the momentum and direction. I.e., given $\xi ~ = ~ ( x , v , d )$ , $\mathbf { R } \xi = ( x , v ^ { \prime } , d ^ { \prime } )$ where $v ^ { \prime } \sim \mathcal { N } ( 0 , I ) , d ^ { \prime } \sim \mathcal { U } \left( \{ - 1 , 1 \} \right)$ . Sampling thus consists of alternating application of the $\mathbf { F L } _ { \theta }$ and $\mathbf { R }$ , in the following two steps each of which is a Markov transition that satisfies detailed balance with respect to $p$ : + +1. $\boldsymbol { \xi } ^ { \prime } = \mathbf { F } \mathbf { L } _ { \boldsymbol { \theta } } \boldsymbol { \xi }$ with probability $A ( \mathbf { F L } _ { \theta } \xi | \xi )$ (Equation 3), otherwise $\xi ^ { \prime } = \xi$ +2. $\boldsymbol { \xi } ^ { \prime } = \mathbf { R } \boldsymbol { \xi }$ + +This parameterization is effectively a generalization of standard HMC as it is non-volume preserving, with learnable parameters, and easily reduces to standard HMC for $Q , S , T = 0$ . + +# 4.2 LOSS AND TRAINING PROCEDURE + +We need some criterion to train the parameters $\theta$ that control the functions $Q , S$ , and $T$ . We choose a loss designed to reduce mixing time. Specifically, we aim to minimize lag-one autocorrelation. This is equivalent to maximizing expected squared jumped distance (Pasarica & Gelman, 2010). For $\xi , \xi ^ { \prime }$ in the extended state space, we define $\delta ( \xi ^ { \bar { \prime } } , \xi ) \ = \ \delta ( ( x ^ { \prime } , v ^ { \prime } , d ^ { \prime } ) , ( x , v , d ) ) \ = \ | | x - x ^ { \prime } | | _ { 2 } ^ { 2 }$ . Expected squared jumped distance is thus $\mathbb { E } _ { \xi \sim p ( \xi ) } \left[ \delta ( \mathbf { F L } _ { \theta } \xi , \xi ) A ( \mathbf { F L } _ { \theta } \xi | \xi ) \right]$ . However, this loss need not encourage mixing across the entire state space. Indeed, maximizing this objective can lead to regions of state space where almost no mixing occurs, so long as the average squared distance traversed remains high. To optimize both for typical and worst case behavior, we include a reciprocal term in the loss, + +$$ +\begin{array} { r } { \ell _ { \lambda } ( \xi , \xi ^ { \prime } , A ( \xi ^ { \prime } | \xi ) ) = \frac { \lambda ^ { 2 } } { \delta ( \xi , \xi ^ { \prime } ) A ( \xi ^ { \prime } | \xi ) } - \frac { \delta ( \xi , \xi ^ { \prime } ) A ( \xi ^ { \prime } | \xi ) } { \lambda ^ { 2 } } , } \end{array} +$$ + +where $\lambda$ is a scale parameter, capturing the characteristic length scale of the problem. The second term encourages typical moves to be large, while the first term strongly penalizes the sampler if it is ever in a state where it cannot move effectively – $\delta ( \xi , \xi ^ { \prime } )$ being small resulting in a large loss value. We train our sampler by minimizing this loss over both the target distribution and initialization distribution. Formally, given an initial distribution $\pi _ { 0 }$ over $\mathcal { X }$ , we define $q ( \xi ) = \pi _ { 0 } ( x ) \mathcal { N } ( v ; 0 , I ) p ( d )$ , and minimize + +$$ +\begin{array} { r } { \mathcal { L } ( \boldsymbol { \theta } ) \triangleq \mathbb { E } _ { p ( \boldsymbol { \xi } ) } \left[ \ell _ { \lambda } ( \boldsymbol { \xi } , \mathbf { F } \mathbf { L } _ { \boldsymbol { \theta } } \boldsymbol { \xi } , A ( \mathbf { F } \mathbf { L } _ { \boldsymbol { \theta } } \boldsymbol { \xi } | \boldsymbol { \xi } ) ) \right] + \lambda _ { b } \mathbb { E } _ { q ( \boldsymbol { \xi } ) } \left[ \ell _ { \lambda } ( \boldsymbol { \xi } , \mathbf { F } \mathbf { L } _ { \boldsymbol { \theta } } \boldsymbol { \xi } , A ( \mathbf { F } \mathbf { L } _ { \boldsymbol { \theta } } \boldsymbol { \xi } | \boldsymbol { \xi } ) ) \right] . } \end{array} +$$ + +The first term of this loss encourages mixing as it considers our operator applied on draws from the distribution; the second term rewards fast burn-in; $\lambda _ { b }$ controls the strength of the ‘burn-in’ regularization. Given this loss, we exactly describe our training procedure in Algorithm 1. It is important to note that each training iteration can be done with only one pass through the network and can be efficiently batched. We further emphasize that this training procedure can be applied to any learnable operator whose Jacobian’s determinant is tractable, making it a general framework for training MCMC proposals. + +# Algorithm 1 Training L2HMC + +Input: Energy function $U : \mathcal { X } \mathbb { R }$ and its gradient $\nabla _ { x } U : x x$ , initial distribution over +the augmented state space $q$ , number of iterations $n _ { \mathrm { i t e r s } }$ , number of leapfrogs $M$ , learning rate +schedule (αt)t≤n , batch size $N$ , scale parameter $\lambda$ and regularization strength $\lambda _ { b }$ . +Initialize the parameters of the sampler $\theta$ . +Initialize $\{ \xi _ { p } ^ { ( i ) } \} _ { i \le N }$ from $q ( \xi )$ . +for $t = 0$ to $n _ { \mathrm { i t e r s } } - 1$ do Sample a minibatch $\{ \xi _ { q } ^ { ( i ) } \} _ { i \leq N }$ from $q ( \xi )$ . $\mathcal { L } 0$ for r $\begin{array} { r l } & { \xi _ { p } ^ { ( i ) } \gets \mathbf { R } \xi _ { p } ^ { ( i ) } } \\ & { \mathcal { L } \gets \mathcal { L } + \ell _ { \lambda } \left( \xi _ { p } ^ { ( i ) } , \mathbf { F L } _ { \theta } \xi _ { p } ^ { ( i ) } , A ( \mathbf { F L } _ { \theta } \xi _ { p } ^ { ( i ) } | \xi _ { p } ^ { ( i ) } ) \right) + \lambda _ { b } \ell _ { \lambda } \left( \xi _ { q } ^ { ( i ) } , \mathbf { F L } _ { \theta } \xi _ { q } ^ { ( i ) } , A ( \mathbf { F L } _ { \theta } \xi _ { q } ^ { ( i ) } | \xi _ { q } ^ { ( i ) } ) \right) } \\ & { } \end{array}$ $i = 1$ to $N$ do $\begin{array} { r } { \xi _ { p } ^ { ( i ) } \mathbf { F L } _ { \theta } \xi _ { p } ^ { ( i ) } } \end{array}$ with probability $A ( \mathbf { F L } _ { \theta } \xi _ { p } ^ { ( i ) } | \xi _ { p } ^ { ( i ) } )$ . end for θ θ α t θ +end for + +# 5 EXPERIMENTS + +We present an empirical evaluation of our trained sampler on a diverse set of energy functions. We first present results on a collection of toy distributions capturing common pathologies of energy landscapes, followed by results on a task from machine learning: maximum-likelihood training of deep generative models. For each, we compare against HMC with well-tuned step length and show significant gains in mixing time. Code implementing our algorithm is available online1. + +# 5.1 VARIED COLLECTION OF ENERGY FUNCTIONS + +We evaluate our L2HMC sampler on a diverse collection of energy functions, each posing different challenges for standard HMC. + +Ill-Conditioned Gaussian (ICG): Gaussian distribution with diagonal covariance spaced loglinearly between $1 0 ^ { - 2 }$ and $1 0 ^ { 2 }$ . This demonstrates that L2HMC can learn a diagonal inertia tensor. + +Strongly correlated Gaussian (SCG): We rotate a diagonal Gaussian with variances $[ 1 0 ^ { 2 } , 1 0 ^ { - 2 } ]$ by $\frac { \pi } { 4 }$ . This is an extreme version of an example from Neal (2011). This problem shows that, although our parametric sampler only applies element-wise transformations, it can adapt to structure which is not axis-aligned. + +Mixture of Gaussians (MoG): Mixture of two isotropic Gaussians with $\sigma ^ { 2 } = 0 . 1$ , and centroids separated by distance 4. The means are thus about 12 standard deviations apart, making it almost impossible for HMC to mix between modes. + +Rough Well: Similar to an example from Sohl-Dickstein et al. (2014), for a given $\eta > 0 , U ( x ) =$ $\begin{array} { r } { \frac { 1 } { 2 } x ^ { T } \overset { \smile } { x } + \eta \sum _ { i } \cos ( \frac { x _ { i } } { \eta } ) } \end{array}$ . For small $\eta$ the energy itself is altered negligibly, but its gradient is perturbed by a high frequency noise oscillating between $- 1$ and 1. In our experiments, we choose $\eta = 1 0 ^ { - 2 }$ . + +For each of these distributions, we compare against HMC with the same number of leapfrog steps and a well-tuned step-size. To compare mixing time, we plot auto-correlation for each method and report effective sample size (ESS). We compute those quantities in the same way as Sohl-Dickstein et al. (2014). We observe that samplers trained with L2HMC show greatly improved autocorrelation and ESS on the presented tasks, providing more than $1 0 6 \times$ improved ESS on the SCG task. In addition, for the MoG, we show that L2HMC can easily mix between modes while standard HMC gets stuck in a mode, unable to traverse the low density zone. Experimental details, as well as a comparison with LAHMC (Sohl-Dickstein et al., 2014), are shown in Appendix C. + +![](images/e878bce92e8dd48bdb837822419a4ea3132437ffdaebbcd93f07f493cdac4546.jpg) +Figure 1: L2HMC mixes faster than well-tuned HMC, and than A-NICE-MC, on a collection of toy distributions. + +Comparison to A-NICE-MC (Song et al., 2017) In addition to the well known challenges associated with adversarial training (Arjovsky et al., 2017), we note that parameterization using a volume-preserving operator can dramatically fail on simple energy landscapes. We build off of the mog2 experiment presented in (Song et al., 2017), which is a 2-d mixture of isotropic Gaussians separated by a distance of 10 with variances 0.5. We consider that setup but increase the ratio of variances: $\dot { \sigma } _ { 1 } ^ { 2 } = 3 , \sigma _ { 2 } ^ { 2 } = 0 . 0 5$ . We show in Figure 1d sample chains trained with L2HMC and A-NICE-MC; A-NICE-MC cannot effectively mix between the two modes as only a fraction of the volume of the large mode can be mapped to the small one, making it highly improbable to traverse. This is also an issue for HMC. On the other hand, L2HMC can both traverse the low-density region between modes, and map a larger volume in the left mode to a smaller volume in the right mode. It is important to note that the distance between both clusters is less than in the mog2 case, and it is thus a good diagnostic of the shortcomings of volume-preserving transformations. + +# 5.2 LATENT-VARIABLE GENERATIVE MODEL + +We apply our learned sampler to the task of training, and sampling from the posterior of, a latentvariable generative model. The model consists of a latent variable $z \sim p ( z )$ , where we choose $p ( z ) = \breve { \mathscr { N } } ( z ; 0 , I )$ , and a conditional distribution $p ( x | z )$ which generates the image $x$ . Given a family of parametric ‘decoders’ $\{ z \mapsto p ( x | z ; \phi ) , \phi \in \Phi \}$ , and a set of samples $\mathcal { D } = \{ x ^ { ( i ) } \} _ { i \leq N }$ training involves finding $\begin{array} { r } { \phi ^ { * } = \arg \operatorname* { m a x } _ { \phi \in \Phi } p ( \mathcal { D } ; \phi ) } \end{array}$ . However, the log-likelihood is intractable as $\begin{array} { r } { p ( x ; \boldsymbol { \phi } ) = \int p ( x | \boldsymbol { z } ; \boldsymbol { \phi } ) p ( \boldsymbol { z } ) \mathrm { d } \boldsymbol { z } } \end{array}$ . To remedy that problem, Kingma $\&$ Welling (2013) proposed jointly training an approximate posterior $q _ { \psi }$ that maximizes a tractable lower-bound on the log-likelihood: + +![](images/250475de256c4eebae15fc4fa637a5547873059d01bec521d1802c331ccf79c1.jpg) +Figure 2: Training and held-out log-likelihood for models trained with L2HMC, HMC, and the ELBO (VAE). + +$$ +\mathcal { L } _ { \mathrm { E L B O } } ( x , \phi , \psi ) = \mathbb { E } _ { q _ { \psi } ( z | x ) } \left[ p ( x | z ; \phi ) \right] - \mathrm { K L } ( q _ { \psi } ( z | x ) | | p ( z ) ) \leq p ( x ) , +$$ + +where $q _ { \psi } ( z | x )$ is a tractable conditional distribution with parameters $\psi$ , typically parameterized by a neural network. Recently, to improve upon well-known pitfalls like over-pruning (Burda et al., 2015) of the VAE, Hoffman (2017) proposed HMC-DLGM. For a data sample $x ^ { ( i ) }$ , after obtaining a sample from the approximate posterior $q _ { \psi } ( \cdot | x ^ { ( i ) } )$ , Hoffman (2017) runs a MCMC algorithm with energy function $U ( z , x ^ { ( i ) } ) = - \log p ( z ) - \log p ( x ^ { ( i ) } | z ; \phi )$ to obtain a more exact posterior sample from $p ( \boldsymbol { z } | \boldsymbol { x } ^ { ( i ) } ; \boldsymbol { \phi } )$ . Given that better posterior sample $z ^ { \prime }$ , the algorithm maximizes $\log p ( x ^ { ( i ) } | z ^ { \prime } ; \phi )$ . + +To show the benefits of L2HMC, we borrow the method from Hoffman (2017), but replace HMC by jointly training an L2HMC sampler to improve the efficiency of the posterior sampling. We call this model L2HMC-DLGM. A diagram of our model and a formal description of our training procedure are presented in Appendix D. We define, for $\xi = \{ z , v , d \} , r ( \xi | x ; \psi ) \triangleq$ $q _ { \psi } ( z | x ) \mathcal { N } ( v ; \bar { 0 , I } ) \mathcal { U } ( d ; \{ - 1 , \bar { 1 } \} )$ . + +In the subsequent sections, we compare our method to the standard VAE model from Kingma & Welling (2013) and HMC-DGLM from Hoffman (2017). It is important to note that, since our sampler is trained jointly with $p _ { \phi }$ and $q _ { \psi }$ , it performs exactly the same number of gradient computations of the energy function as HMC. We first show that training a latent variable generative model with L2HMC results in better generative models both qualitatively and quantitatively. We then show that our improved sampler enables a more expressive, non-Gaussian, posterior. + +Implementation details: Our decoder $( p _ { \phi } )$ is a neural network with 2 fully connected layers, with 1024 units each and softplus non-linearities, and outputs Bernoulli activation probabilities for each pixel. The encoder $( q _ { \psi } )$ has the same architecture, returning mean and variance for the approximate posterior. Our model was trained for 300 epochs with Adam (Kingma & Ba, 2014) and a learning rate $\alpha = 1 0 ^ { - 3 }$ . All experiments were done on the dynamically binarized MNIST dataset (LeCun). + +# 5.2.1 SAMPLE QUALITY AND DATA LIKELIHOOD + +We first present samples from decoders trained with L2HMC, HMC and the ELBO (i.e. vanilla VAE). Although higher log likelihood does not necessarily correspond to better samples (Theis et al., 2015), we can see in Figure 5, shown in the Appendix, that the decoder trained with L2HMC generates sharper samples than the compared methods. + +We now compare our method to HMC in terms of log-likelihood of the data. As we previously stated, the marginal likelihood of a data point $x \in \mathcal { X }$ is not tractable as it requires integrating $p ( x , z )$ over a high-dimensional space. However, we can estimate it using annealed importance sampling (AIS; Neal (2001)). Following Wu et al. (2016), we evaluate our generative models on both training and held-out data. In Figure 2, we plot the data’s log-likelihood against the number of gradient computation steps for both HMC-DGLM and L2HMC-DGLM. We can see that for a similar number of gradient computations, L2HMC-DGLM achieves higher likelihood for both training and held-out data. This is a strong indication that L2HMC provides significantly better posterior samples. + +![](images/fa42f98b9e8fda6e4c48a55741ecf4bec0e430aa2379cfc10ac8d84350687b92.jpg) + +(a) Block Gibbs inpainting of the top half of an MNIST digit, using (top) L2HMC as a posterior sampler, and (bottom) $q _ { \psi }$ as a posterior sampler. + +![](images/3b5a148d0cd5e54e8a2a908b2b63c8ebc00143ad9d41f371e71810f20e32da5a.jpg) +(b) Non-Gaussian posterior +Figure 3: Demonstrations of the value of a more expressive posterior approximation. + +# 5.2.2 INCREASED EXPRESSIVITY OF THE POSTERIOR + +In the standard VAE framework, approximate posteriors are often parametrized by a Gaussian, thus making a strong assumption of uni-modality. In this section, we show that using L2HMC to sample from the posterior enables learning of a richer posterior landscape. + +Block Gibbs Sampling To highlight our ability to capture more expressive posteriors, we in-paint the top of an image using Block Gibbs Sampling using the approximate posterior or L2HMC. Formally, let $x _ { 0 }$ be the starting image. We denote top or bottom-half pixels as $x _ { 0 } ^ { \mathrm { t o p } }$ and $x _ { 0 } ^ { \mathrm { b o t t o m } }$ . At each step $t$ , we sample $z ^ { ( t ) } \sim p ( z | x _ { t } ; \theta )$ , sample $\tilde { x } \sim p ( x | z _ { t } ; \theta )$ . We then set $x _ { t + 1 } ^ { \mathrm { t o p } } = \tilde { x } ^ { \mathrm { t o p } }$ and $x _ { t + 1 } ^ { \mathrm { b o t t o m } } = x _ { 0 } ^ { \mathrm { b o t t o m } }$ . We compare the results obtained by sampling from ior) vs. our trained sampler. The results are reported i $p ( z | x ; \theta )$ using a. We $q _ { \psi }$ (i.e. the see that L2HMC easily mixes between modes (3, 5, 8, and plausibly 9 in the figure) while the approximate posterior gets stuck on the same reconstructed digit (3 in the figure). + +Visualization of the posterior After training a decoder with L2HMC, we randomly choose an element $x _ { 0 } \in \mathcal { D }$ and run 512 parallel L2HMC chains for 20, 000 Metropolis-Hastings steps. We then find the direction of highest variance, project the samples along that direction and show a histogram in Figure 3b. This plot shows non-Gaussianity in the latent space for the posterior. Using our improved sampler enables the decoder to make use of a more expressive posterior, and enables the encoder to sample from this non-Gaussian posterior. + +# 6 FUTURE WORK + +The loss in Section 4.2 targets lag-one autocorrelation. It should be possible to extend this to also target lag-two and higher autocorrelations. It should also be possible to extend this loss to reward fast decay in the autocorrelation of other statistics of the samples, for instance the sample energy as well as the sample position. These additional statistics could also include learned statistics of the samples, combining benefits of the adversarial approach of (Song et al., 2017) with the current work. + +Our learned generalization of HMC should prove complementary to several other research directions related to HMC. It would be interesting to explore combining our work with the use of HMC in a minibatch setting (Chen et al., 2014); with shadow Hamiltonians (Izaguirre & Hampton, 2004); with gradient pre-conditioning approaches similar to those used in Riemannian HMC (Girolami et al., 2009; Betancourt, 2013); with the use of alternative HMC accept-reject rules (Sohl-Dickstein et al., 2014; Berger et al., 2015); with the use of non-canonical Hamiltonian dynamics (Tripuraneni et al., 2016); with variants of AIS adapted to HMC proposals (Sohl-Dickstein & Culpepper, 2012); with the extension of HMC to discrete state spaces (Zhang et al., 2012); and with the use of alternative Hamiltonian integrators (Creutz & Gocksch, 1989; Chao et al., 2015). + +Finally, our work is also complementary to other methods not utilizing gradient information. For example, we could incorporate the intuition behind Multiple Try Metropolis schemes (Martino & Read, 2013) by having several parametric operators and training each one when used. In addition, one could draw inspiration from the adaptive literature (Haario et al., 2001; Andrieu & Thoms, 2008) or component-wise strategies (Gilks & Wild, 1992). + +# 7 CONCLUSION + +In this work, we presented a general method to train expressive MCMC kernels parameterized with deep neural networks. Given a target distribution $p$ , analytically known up to a constant, our method provides a fast-mixing sampler, able to efficiently explore the state space. Our hope is that our method can be utilized in a “black-box” manner, in domains where sampling constitutes a huge bottleneck such as protein foldings (Schutte et al., 1999) or physics simulations (Olsson, 1995). ¨ + +# ACKNOWLEDGMENTS + +We would like to thank Ben Poole, Aditya Grover, David Belanger, and Colin Raffel for insightful comments on the draft, Mohammad Norouzi for support and encouragement launching the project, and Jiaming Song for discussions and help running A-NICE-MC. + +# REFERENCES + +Christophe Andrieu and Johannes Thoms. A tutorial on adaptive MCMC. Statistics and computing, 18(4): 343–373, 2008. + +Christophe Andrieu, Nando De Freitas, Arnaud Doucet, and Michael I Jordan. An introduction to MCMC for machine learning. Machine learning, 50(1-2):5–43, 2003. + +Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein GAN. ´ arXiv preprint arXiv:1701.07875, 2017. + +Yoshua Bengio, Eric Laufer, Guillaume Alain, and Jason Yosinski. Deep generative stochastic networks trainable by backprop. In International Conference on Machine Learning, pp. 226–234, 2014. + +Charles H Bennett. Mass tensor molecular dynamics. Journal of Computational Physics, 19(3):267–279, 1975. + +Andrew B Berger, Mayur Mudigonda, Michael R DeWeese, and Jascha Sohl-Dickstein. A Markov jump process for more efficient Hamiltonian Monte Carlo. arXiv preprint arXiv:1509.03808, 2015. + +Michael Betancourt. A general metric for Riemannian manifold Hamiltonian Monte Carlo. In Geometric science of information, pp. 327–334. Springer, 2013. + +Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015. + +Wei-Lun Chao, Justin Solomon, Dominik Michels, and Fei Sha. Exponential integration for Hamiltonian Monte Carlo. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1142–1151, 2015. + +Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient Hamiltonian Monte Carlo. In International Conference on Machine Learning, pp. 1683–1691, 2014. + +Michael Creutz and Andreas Gocksch. Higher-order hybrid Monte Carlo algorithms. Physical Review Letters, 63(1):9, 1989. + +Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real NVP. arXiv preprint arXiv:1605.08803, 2016. + +Simon Duane, Anthony D Kennedy, Brian J Pendleton, and Duncan Roweth. Hybrid Monte Carlo. Physics letters B, 195(2):216–222, 1987. + +Walter R Gilks and Pascal Wild. Adaptive rejection sampling for gibbs sampling. Applied Statistics, pp. 337–348, 1992. + +Mark Girolami and Ben Calderhead. Riemann manifold Langevin and Hamiltonian Monte Carlo methods. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 73(2):123–214, 2011. + +Mark Girolami, Ben Calderhead, and Siu A Chin. Riemannian manifold Hamiltonian Monte Carlo. arXiv preprint arXiv:0907.1100, 2009. + +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. + +Peter J Green. Reversible jump markov chain monte carlo computation and bayesian model determination. Biometrika, 82(4):711–732, 1995. + +Heikki Haario, Eero Saksman, Johanna Tamminen, et al. An adaptive metropolis algorithm. Bernoulli, 7(2): 223–242, 2001. + +Ernst Hairer, Christian Lubich, and Gerhard Wanner. Geometric numerical integration illustrated by the Stormer–Verlet method. ¨ Acta numerica, 12:399–450, 2003. + +W Keith Hastings. Monte Carlo sampling methods using Markov chains and their applications. Biometrika, 57 (1):97–109, 1970. + +Matthew D Hoffman. Learning deep latent Gaussian models with Markov chain Monte Carlo. In International Conference on Machine Learning, pp. 1510–1519, 2017. + +Matthew D Hoffman and Andrew Gelman. The no-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1):1593–1623, 2014. + +Li Huang and Lei Wang. Accelerated monte carlo simulations with restricted boltzmann machines. Physical Review B, 95(3):035105, 2017. + +Akihisa Ichiki and Masayuki Ohzeki. Violation of detailed balance accelerates relaxation. Physical Review E, 88(2):020101, 2013. + +Jesus A Izaguirre and Scott S Hampton. Shadow hybrid Monte Carlo: an efficient propagator in phase space of ´ macromolecules. Journal of Computational Physics, 200(2):581–604, 2004. + +Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. arXiv preprint arXiv:1312.6114, 2013. + +Yann LeCun. The MNIST database of handwritten digits. http://yann. lecun. com/exdb/mnist/. + +Benedict Leimkuhler and Sebastian Reich. Simulating Hamiltonian dynamics, volume 14. Cambridge University Press, 2004. + +Junwei Liu, Yang Qi, Zi Yang Meng, and Liang Fu. Self-learning monte carlo method. Physical Review B, 95 (4):041101, 2017. + +David JC MacKay. Information theory, inference and learning algorithms. Cambridge university press, 2003. + +Luca Martino and Jesse Read. On the flexibility of the design of multiple try metropolis schemes. Computational Statistics, 28(6):2797–2823, 2013. + +Radford M Neal. Probabilistic inference using Markov chain Monte Carlo methods. 1993. + +Radford M Neal. Sampling from multimodal distributions using tempered transitions. Statistics and computing, 6(4):353–366, 1996. + +Radford M Neal. Annealed importance sampling. Statistics and computing, 11(2):125–139, 2001. + +Radford M Neal. MCMC using Hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2(11), 2011. + +Peter Olsson. Two phase transitions in the fully frustrated XY model. Physical review letters, 75(14):2758, 1995. + +Cristian Pasarica and Andrew Gelman. Adaptively scaling the Metropolis algorithm using expected squared jumped distance. Statistica Sinica, pp. 343–364, 2010. + +Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014. + +Tim Salimans, Diederik Kingma, and Max Welling. Markov chain Monte Carlo and variational inference: Bridging the gap. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1218–1226, 2015. + +Ch Schutte, Alexander Fischer, Wilhelm Huisinga, and Peter Deuflhard. A direct approach to conformational¨ dynamics based on hybrid Monte Carlo. Journal of Computational Physics, 151(1):146–168, 1999. + +Dino Sejdinovic, Heiko Strathmann, Maria Lomeli Garcia, Christophe Andrieu, and Arthur Gretton. Kernel adaptive metropolis-hastings. In International Conference on Machine Learning, pp. 1665–1673, 2014. +Jascha Sohl-Dickstein and Benjamin J Culpepper. Hamiltonian annealed importance sampling for partition function estimation. arXiv preprint arXiv:1205.1925, 2012. +Jascha Sohl-Dickstein, Mayur Mudigonda, and Michael R DeWeese. Hamiltonian Monte Carlo without detailed balance. pp. 719–726, 2014. +Jascha Sohl-Dickstein, Eric A Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. arXiv preprint arXiv:1503.03585, 2015. +Jiaming Song, Shengjia Zhao, and Stefano Ermon. A-nice-mc: Adversarial training for mcmc. In Advances in Neural Information Processing Systems, pp. 5146–5156, 2017. +Heiko Strathmann, Dino Sejdinovic, Samuel Livingstone, Zoltan Szabo, and Arthur Gretton. Gradient-free hamiltonian monte carlo with efficient kernel exponential families. In Advances in Neural Information Processing Systems, pp. 955–963, 2015. +Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. ¨ arXiv preprint arXiv:1511.01844, 2015. +Nilesh Tripuraneni, Mark Rowland, Zoubin Ghahramani, and Richard Turner. Magnetic Hamiltonian Monte Carlo. arXiv preprint arXiv:1607.02738, 2016. +Lei Wang. Can boltzmann machines discover cluster updates? arXiv preprint arXiv:1702.08586, 2017. +Yuhuai Wu, Yuri Burda, Ruslan Salakhutdinov, and Roger Grosse. On the quantitative analysis of decoderbased generative models. arXiv preprint arXiv:1611.04273, 2016. +Yichuan Zhang, Zoubin Ghahramani, Amos J Storkey, and Charles A Sutton. Continuous relaxations for discrete hamiltonian monte carlo. In Advances in Neural Information Processing Systems, pp. 3194–3202, 2012. + +# Appendix + +# A REVERSE LEAPFROG OPERATOR + +Let $\xi = \{ x , v , d \}$ in the extended state space with $d = - 1$ . Here, we describe the leapfrog updates for a single time step $t$ , this consists of inverting the equations presented in the corresponding section. + +Let $\zeta _ { 1 } = \{ x , v , t \}$ , we have: + +$$ +v ^ { \prime } = \left[ v + \frac { \epsilon } { 2 } \left( \partial _ { x } U ( x ) \odot \exp ( \epsilon Q _ { v } ( \zeta _ { 1 } ) ) + T _ { v } ( \zeta _ { 1 } ) \right) \right] \odot \exp ( - S _ { v } ( \zeta _ { 1 } ) ) . +$$ + +With the notation from Section 4, let $\zeta _ { 2 } \triangleq \{ x _ { m ^ { t } } , v , t \}$ + +$$ +x ^ { \prime } = x _ { m ^ { t } } + \bar { m } ^ { t } \odot [ ( x - \epsilon ( \exp ( \epsilon Q _ { x } ( \zeta _ { 2 } ) ) \odot v ^ { \prime } + T _ { x } ( \zeta _ { 2 } ) ) ] \odot \exp ( - \epsilon S _ { v } ( \zeta _ { 2 } ) ) . +$$ + +Let us denote $\zeta _ { 3 } \triangleq \{ x _ { \bar { m } ^ { t } } ^ { \prime } , v , t \}$ : + +$$ +x ^ { \prime \prime } = x _ { \bar { m } ^ { t } } + m ^ { t } \odot [ ( x ^ { \prime } - \epsilon ( \exp ( \epsilon Q _ { x } ( \zeta _ { 3 } ) ) \odot v ^ { \prime } + T _ { x } ( \zeta _ { 3 } ) ) ] \odot \exp ( - \epsilon S _ { v } ( \zeta _ { 3 } ) ) . +$$ + +Finally, the last update, with $\zeta _ { 4 } \triangleq \{ x ^ { \prime \prime } , \partial _ { x } U ( x ^ { \prime \prime } ) , t \}$ : + +$$ +v ^ { \prime } = \left[ v + { \frac { \epsilon } { 2 } } \left( \partial _ { x } U ( x ^ { \prime \prime } ) \odot \exp ( \epsilon Q _ { v } ( \zeta _ { 4 } ) ) + T _ { v } ( \zeta _ { 4 } ) \right) \right] \odot \exp ( - S _ { v } ( \zeta _ { 4 } ) ) . +$$ + +It is important to note that to invert $\mathbf { L } _ { \theta }$ , these steps should be ran for $t$ from $M$ to 1. + +# B DETERMINANT OF THE JACOBIAN + +Given the derivations (and notations) from Section 4, for the forward operator $\mathbf { L } _ { \theta }$ , we can immediately compute the Jacobian: + +$$ +\log \left| \frac { \partial [ \mathbf { F } \mathbf { L } _ { \theta } \boldsymbol { \xi } ] } { \partial \boldsymbol { \xi } ^ { T } } \right| = d \sum _ { t \leq M } \left[ \frac { \epsilon } { 2 } \mathbf { 1 } \cdot S _ { v } ( \boldsymbol { \zeta } _ { 1 } ^ { t } ) + \epsilon m ^ { t } \cdot S _ { x } ( \boldsymbol { \zeta } _ { 2 } ^ { t } ) + \epsilon \bar { m } ^ { t } \cdot S _ { x } ( \boldsymbol { \zeta } _ { 3 } ^ { t } ) + \frac { \epsilon } { 2 } \mathbf { 1 } \cdot S _ { v } ( \boldsymbol { \zeta } _ { 4 } ^ { t } ) \right] . +$$ + +Where $\zeta _ { i } ^ { t }$ denotes the intermediary variable $\zeta _ { i }$ at time step $t$ and $d$ is the direction of $\xi$ i.e. $\xi =$ +$\{ x , v , d \}$ . + +# C EXPERIMENTAL DETAILS OF SECTION 5 + +# C.1 IMPLEMENTATION DETAILS + +First of all, we keep separate parameters for the network responsible for updating $v$ and those updating $x$ . The architectures are the same. Let us take the example of $Q _ { v } , S _ { v } , T _ { v }$ . The time step $t$ is given as input to the MLP, encoded as $\begin{array} { r } { \tau ( t ) = ( \cos ( \frac { 2 \pi t } { M } ) , \sin ( \frac { 2 \pi { \hat { t } } } { M } ) ) } \end{array}$ . $\sigma ( \cdot )$ denotes the ReLU non-linearity. + +For $n _ { h }$ hidden units per layer: + +• We first compute $h _ { 1 } = \sigma ( W _ { 1 } x + W _ { 2 } v + W _ { 3 } \tau ( t ) + b ) ( h \in \mathbb { R } ^ { n _ { h } } ) .$ · $h _ { 2 } = \sigma ( W _ { 4 } h + b _ { 4 } ) \in \mathbb { R } ^ { n _ { h } }$ • $S _ { v } = \lambda _ { s } \mathtt { t a n h } ( W _ { s } h _ { 2 } + b _ { s } ) , Q _ { v } = \lambda _ { q } \mathtt { t a n h } ( W _ { q } h _ { 2 } + b _ { q } ) , T _ { v } = W _ { t } h _ { 2 } + b _ { t } .$ + +In Section 5.1, the $Q , S , T$ are neural networks with 2 hidden layers with 10 (100 for the 50-d ICG) units and ReLU non-linearities. We train with Adam (Kingma & Ba, 2014) and a learning rate $\alpha = 1 0 ^ { - 3 }$ . We train for 5, 000 iterations with a batch size of 200. + +$\lambda _ { b }$ was set to 0 for ICG and SCG and to 1 for MoG and Rough Well. For the MoG tasks, we train our sampler with a temperature parameter that we continuously anneal; we evaluate the trained sampler without using temperature. + +![](images/ce0d3b31ad5969a1d38e2d717519f244a5cf9175ca9b22c578fb2f7627737684.jpg) +Figure 4: Diagram of our L2HMC-DGLM model. Nodes are functions of their parents. Round nodes are deterministic, diamond nodes are stochastic and the doubly-circled node is observed. + +# C.2 AUTO-CORRELATION AND ESS + +Let $( x _ { \tau } ) _ { \tau \leq T }$ be a set of correlated samples converging to the distribution $p$ with mean $\mu$ and covariance $\Sigma$ . We define auto-correlation at time $t$ as: + +$$ +\rho _ { t } \triangleq \frac { 1 } { \mathrm { T r a c e } ( \Sigma ) ( T - t ) } \sum _ { \tau \leq T - t - 1 } ( x _ { \tau } - \mu ) ^ { T } ( x _ { \tau + t } - \mu ) . +$$ + +We can now define effective sample size (ESS) as: + +$$ +\mathrm { E S S } \left( ( x _ { \tau } ) _ { \tau \leq T } \right) \triangleq \frac { 1 } { 1 + 2 \sum _ { t } \rho _ { t } } . +$$ + +Similar to Hoffman & Gelman (2014), we truncate the sum when the auto-correlation goes below 0.05. + +# C.3 COMPARISON WITH LAHMC + +We compare our trained sampler with LAHMC (Sohl-Dickstein et al., 2014). Results are reported in Table 1. L2HMC largely outperforms LAHMC on all task. LAHMC is also unable to mix between modes for the MoG task. We also note that L2HMC could be easily combined with LAHMC, by replacing the leapfrog integrator of LAHMC with the learned one of L2HMC. + +Table 1: ESS for a fixed number of gradient evaluations. + +
DistributionGradient EvaluationsESS-L2HMCESS-LAHMCRatio
50-d ICG2000156.621.47.3
Rough Well20012.58.61.5
2-d SCG500011616.714.9
MoG20,00065.0<0.53> 123.5
+ +# D L2HMC-DGLM + +# D.1 TRAINING ALGORITHM + +In this section, we present our training algorithm as well as a diagram explaining L2HMC-DGLM. For conciseness, given our operator $\mathbf { L } _ { \theta }$ , we denote by $\mathbf { K } _ { \theta } ( \cdot | x )$ the distribution over next state given sampling of a momentum and direction and the Metropolis-Hastings step. + +# D.2 IMPLEMENTATION DETAILS OF L2HMC-DGLM + +Similar to our L2HMC training on unconditional sampling, we share weights across $Q , S$ and $T$ . In addition, the auxiliary variable $x$ (here the image from MNIST) is first passed through a 2-layer neural network, with softplus non-linearities and 512 hidden units. This input is given to both + +# Algorithm 2 L2HMC for latent variable generative models + +Input: dataset $\mathcal { D }$ , number of iterations $n _ { \mathrm { i t e r s } }$ , number of Metropolis-Hastings step $J$ , number of +leapfrogs M , and learning rate schedule (αt)t≤niters . +Randomly initialize the decoder’s parameters $\phi$ and the approximate posterior $\psi$ . Initialize the +parameters of the sampler $\theta$ with $M$ leapfrog steps. +for $t = 0$ to $n _ { \mathrm { i t e r s } } - 1$ do Randomly sample a minibatch $\boldsymbol { B }$ from the dataset $\mathcal { D }$ . $\mathcal { L } _ { \mathrm { E L B O } } , \mathcal { L } _ { \mathrm { S a m p l e r } } , \mathcal { L } _ { \mathrm { D e c o d e r } } 0$ for $\boldsymbol { x } ^ { ( b ) } \in B \mathrm { d } \mathbf { 0 }$ ∈Sample $\xi _ { 0 } ^ { ( b ) } \sim r ( \cdot | x ^ { ( b ) } ; \psi )$ . $\mathcal { L } _ { \mathrm { E L B O } } p ( x ^ { ( b ) } | z _ { 0 } ^ { ( b ) } ; \phi ) - \mathrm { K L } ( q _ { \psi } ( z | x ^ { ( b ) } ) | | p ( z ) )$ . With ξ(b)0 = {z(b)0 , v(b)0 , d(b)0 } Define the energy function $U _ { x ^ { ( b ) } } ( z ) = - \log p ( x ^ { ( b ) } | z ; \theta ) - \log p ( z )$ $\mathcal { L } _ { \mathrm { S a m p l e r } } 0$ $\lambda \sqrt { \mathrm { V a r } ( q _ { \psi } ( z _ { 0 } ^ { ( b ) } | x ^ { ( b ) } ) }$ for $j = 0$ to $J - 1$ do ξ (j −b) ← Rξ(b)j LSampler ← LSampler + \`λ(ξ(b)j , FLθξ(b)j , A(FLθξ(b)j |ξ(b)j )) Set $\xi _ { j + 1 } ^ { ( b ) }$ to $\mathbf { F L } _ { \theta } \boldsymbol { \xi } _ { j } ^ { ( b ) }$ with probability $A ( \mathbf { F L } _ { \theta } \xi _ { j } ^ { ( b ) } | \xi _ { j } ^ { ( b ) } )$ . $\begin{array} { r } { \begin{array} { l l } { \frac { \operatorname { c a s s a } ^ { \ast } \operatorname { s o r } } { \mathcal { L } _ { \mathrm { D e c o d e r } } } \mathcal { L } _ { \mathrm { D e c o d e r } } + \log p ( x ^ { ( b ) } | z _ { J } ^ { ( s ) } ; \phi ) } & { \qquad \mathrm { ~ s ~ W i t h ~ } \xi _ { J } ^ { ( b ) } = \{ z _ { J } ^ { ( b ) } , v _ { J } ^ { ( b ) } , d _ { J } ^ { ( b ) } \} } \end{array} } \end{array}$ end for $\begin{array} { l } { \phi \phi + \alpha _ { t } \nabla _ { \phi } \mathcal { L } _ { \mathrm { D e c o d e r } } } \\ { \psi \psi + \alpha _ { t } \nabla _ { \psi } \mathcal { L } _ { \mathrm { E L B O } } } \\ { \theta \theta + \alpha _ { t } \nabla _ { \theta } \mathcal { L } _ { \mathrm { S a m p l e r } } } \end{array}$ +end for +$\begin{array} { r l } { 3 } & { 0 } & { 1 \leq 9 \leq 9 \leq 2 \leq 9 \leq 5 } \\ { 2 } & { 4 \times 1 \leq 2 \leq 3 \leq 6 } \\ { 6 } & { 5 \leq 2 \leq 3 \leq 5 } \\ { 3 } & { 6 \leq 8 \leq 7 \leq 3 \leq 4 } \\ { 4 \leq 9 \leq 4 \leq 9 \leq 4 } \\ { 7 \geq 5 \leq 5 \leq 5 \leq 2 \leq 4 \leq 6 } \\ { 0 \leq 6 \leq 1 \leq 2 \leq 2 \leq 4 \leq 6 } \\ { 3 \geq 6 \leq 8 \leq 5 \leq 4 } \end{array}$ 644又9 7 1 9 9 3 / 2 3 S 6 a a 8 7 2 4 一 6 8 9 9 4 D 4 B 7 5 3 6 9 7 7 9 2 4 6 7 0 8 7 ?6 4S q 1 1 23 3 7 9 1 972 076997 090q499 65『6630295147309 h0?b414593&84076 (a) L2HMC (b) HMC (c) VAE + +networks $\{ \cdot \} _ { x }$ and $\{ \cdot \} _ { v }$ . The architecture then consists of 2 hidden layers of 200 units and ReLU non-linearities. For $\lambda$ (scale parameter of the loss), we use the standard deviation of the approximate posterior. + +AIS Evaluation For each data point, we run 20 Markov Chains in parallel, 10, 000 annealing steps with 10 leapfrogs per step and choose the step size for an acceptance rate of 0.65. + +# D.3 MNIST SAMPLES + +We show in Figure 5 samples from the three evaluated models: VAE (Kingma & Welling, 2013), HMC-DGLM (Hoffman, 2017) and L2HMC-DGLM. \ No newline at end of file diff --git a/md/train/BJ5UeU9xx/BJ5UeU9xx.md b/md/train/BJ5UeU9xx/BJ5UeU9xx.md new file mode 100644 index 0000000000000000000000000000000000000000..f80065652ca6b9ca58c4fbb2595fa751704c420d --- /dev/null +++ b/md/train/BJ5UeU9xx/BJ5UeU9xx.md @@ -0,0 +1,236 @@ +# VISUALIZING DEEP NEURAL NETWORK DECISIONS: PREDICTION DIFFERENCE ANALYSIS + +Luisa M Zintgraf1,3, Taco S Cohen1, Tameem Adel1, Max Welling1,2 1University of Amsterdam, 2Canadian Institute of Advanced Research, 3Vrije Universiteit Brussel {lmzintgraf,tameem.hesham}@gmail.com, {t.s.cohen, m.welling}@uva.nl + +# ABSTRACT + +This article presents the prediction difference analysis method for visualizing the response of a deep neural network to a specific input. When classifying images, the method highlights areas in a given input image that provide evidence for or against a certain class. It overcomes several shortcoming of previous methods and provides great additional insight into the decision making process of classifiers. Making neural network decisions interpretable through visualization is important both to improve models and to accelerate the adoption of black-box classifiers in application areas such as medicine. We illustrate the method in experiments on natural images (ImageNet data), as well as medical images (MRI brain scans). + +# 1 INTRODUCTION + +Over the last few years, deep neural networks (DNNs) have emerged as the method of choice for perceptual tasks such as speech recognition and image classification. In essence, a DNN is a highly complex non-linear function, which makes it hard to understand how a particular classification comes about. This lack of transparency is a significant impediment to the adoption of deep learning in areas of industry, government and healthcare where the cost of errors is high. + +In order to realize the societal promise of deep learning - e.g., through self-driving cars or personalized medicine - it is imperative that classifiers learn to explain their decisions, whether it is in the lab, the clinic, or the courtroom. In scientific applications, a better understanding of the complex dependencies learned by deep networks could lead to new insights and theories in poorly understood domains. + +In this paper, we present a new, probabilistically sound methodology for explaining classification decisions made by deep neural networks. The method can be used to produce a saliency map for each (instance, node) pair that highlights the parts (features) of the input that constitute most evidence for or against the activation of the given (internal or output) node. See figure 1 for an example. + +In the following two sections, we review related work and then present our approach. In section 4 we provide several demonstrations of our technique for deep convolutional neural networks (DCNNs) trained on ImageNet data, and further how the method can be applied when classifying MRI brain scans of HIV patients with neurodegenerative disease. + +![](images/5ced911aed2598832e28ff23d1a96c2876006712933b86acb08f35ad61dec9e2.jpg) +Figure 1: Example of our visualization method: explains why the DCNN (GoogLeNet) predicts "cockatoo". Shown is the evidence for (red) and against (blue) the prediction. We see that the facial features of the cockatoo are most supportive for the decision, and parts of the body seem to constitute evidence against it. In fact, the classifier most likely considers them evidence for the second-highest scoring class, white wolf. + +# 2 RELATED WORK + +Broadly speaking, there are two approaches for understanding DCNNs through visualization investigated in the literature: find an input image that maximally activates a given unit or class score to visualize what the network is looking for (Erhan et al., 2009; Simonyan et al., 2013; Yosinski et al., 2015), or visualize how the network responds to a specific input image in order to explain a particular classification made by the network. The latter will be the subject of this paper. + +One such instance-specific method is class saliency visualization proposed by Simonyan et al. (2013) who measure how sensitive the classification score is to small changes in pixel values, by computing the partial derivative of the class score with respect to the input features using standard backpropagation. They also show that there is a close connection to using deconvolutional networks for visualization, proposed by Zeiler & Fergus (2014). Other methods include Shrikumar et al. (2016), who compare the activation of a unit when a specific input is fed forward through the net to a reference activation for that unit. Zhou et al. (2016) and Bach et al. (2015) also generate interesting visualization results for individual inputs, but are both not as closely related to our method as the two papers mentioned above. The idea of our method is similar to another analysis Zeiler & Fergus (2014) make: they estimate the importance of input pixels by visualizing the probability of the (correct) class as a function of a gray patch occluding parts of the image. In this paper, we take a more rigorous approach at both removing information from the image and evaluating the effect of this. + +In the field of medical image classification specifically, a widely used method for visualizing feature importances is to simply plot the weights of a linear classifier (Klöppel et al., 2008; Ecker et al., 2010), or the p-values of these weights (determined by permutation testing) (Mourao-Miranda et al., 2005; Wang et al., 2007). These are independent of the input image, and, as argued by Gaonkar & Davatzikos (2013) and Haufe et al. (2014), interpreting these weights can be misleading in general. + +The work presented in this paper is based on an instance-specific method by Robnik-Šikonja & Kononenko (2008), the prediction difference analysis, which is reviewed in the next section. Our main contributions are three substantial improvements of this method: conditional sampling (section 3.1), multivariate analysis (section 3.2), and deep visualization (section 3.3). + +# 3 APPROACH + +Our method is based on the technique presented by Robnik-Šikonja & Kononenko (2008), which we will now review. For a given prediction, the method assigns a relevance value to each input feature with respect to a class $c$ . The basic idea is that the relevance of a feature $x _ { i }$ can be estimated by measuring how the prediction changes if the feature is unknown, i.e., the difference between $p ( c | \mathbf { x } )$ and $p ( c | \mathbf { x } _ { \backslash i } )$ , where $\mathbf { x } _ { \backslash i }$ denotes the set of all input features except $x _ { i }$ . + +To find $p ( c | \mathbf { x } _ { \backslash i } )$ , i.e., evaluate the prediction when a feature is unknown, the authors propose three strategies. The first is to label the feature as unknown (which only few classifiers allow). The second is to re-train the classifier with the feature left out (which is clearly infeasible for DNNs and high-dimensional data like images). The third approach is to simulate the absence of a feature by marginalizing the feature: + +$$ +p ( c | \mathbf { x } _ { \backslash i } ) = \sum _ { x _ { i } } p ( x _ { i } | \mathbf { x } _ { \backslash i } ) p ( c | \mathbf { x } _ { \backslash i } , x _ { i } ) +$$ + +(with the sum running over all possible values for $x _ { i }$ ). However, modeling $p ( x _ { i } | \mathbf { x } _ { \backslash i } )$ can easily become infeasible with a large number of features. Therefore, the authors approximate equation (1) by assuming that feature $x _ { i }$ is independent of the other features, $\mathbf { x } _ { \backslash i }$ : + +$$ +p ( c | \mathbf { x } _ { \backslash i } ) \approx \sum _ { x _ { i } } p ( x _ { i } ) p ( c | \mathbf { x } _ { \backslash i } , x _ { i } ) . +$$ + +The prior probability $p ( x _ { i } )$ is usually approximated by the empirical distribution for that feature. + +Once the class probability $p ( c | \mathbf { x } _ { \backslash i } )$ is estimated, it can be compared to $p ( c | \mathbf { x } )$ . We stick to an evaluation proposed by the authors referred to as weight of evidence, given by + +$$ +\begin{array} { r } { \mathbf { W E } _ { i } ( c | \mathbf { x } ) = \log _ { 2 } \left( \operatorname { o d d s } ( c | \mathbf { x } ) \right) - \log _ { 2 } \left( \operatorname { o d d s } ( c | \mathbf { x } _ { \backslash i } ) \right) , } \end{array} +$$ + +![](images/2d3615626674c157c6eefb119008f778803ca19b3e3f4b0516ad65688ee3ec04.jpg) +Figure 2: Simple illustration of the sampling procedure in algorithm 1. Given the input image $x$ , we select every possible patch $x _ { w }$ (in a sliding window fashion) of size $k \times k$ and place a larger patch $\hat { x } _ { w }$ of size $l \times l$ around it. We can then conditionally sample $x _ { w }$ by conditioning on the surrounding patch $\hat { x } _ { w }$ . + +Algorithm 1 Evaluating the prediction difference using conditional and multivariate sampling Input: classifier with outputs $\mathsf { p } ( \mathsf { c } | \mathbf { x } )$ , input image $\mathbf { x }$ of size $n \times n$ , inner patch size $k$ , outer patch size $l > k$ , class of interest $c$ , probabilistic model over patches of size $l \times l$ , number of samples $S$ Initialization: $\mathrm { W E = z e r o s ( n ^ { * } n ) }$ , counts $\mathbf { \mu } _ { \mathrm { : } } = \mathbf { Z } \mathbf { e }$ ros $( \mathfrak { n } ^ { * } \mathfrak { n } )$ for every patch $\mathbf { x } _ { w }$ of size $k \times k$ in $\mathbf { x }$ do $\mathbf { x } ^ { \prime } = { \bar { \mathrm { c o p y } } } ( \mathbf { x } )$ $\mathrm { s u m } _ { w } = 0$ define patch $\hat { \mathbf { x } } _ { w }$ of size $l \times l$ that contains $\mathbf { x } _ { w }$ for $s = 1$ to $S$ do $\mathbf { x } _ { w } ^ { \prime } \gets \mathbf { x } _ { w }$ sampled from $p ( \mathbf { x } _ { w } | \hat { \mathbf { x } } _ { w } \backslash \mathbf { x } _ { w } )$ $\mathrm { s u m } _ { w } \mathrel { + { = } } p ( c | \mathbf { x } ^ { \prime } )$ . evaluate classifier end for $p ( c | \mathbf x \backslash \mathbf x _ { w } ) : = \mathtt { s u m } _ { w } / S$ WE[coordinates of $\mathbf { x } _ { w } ] + = \log _ { 2 } ( \operatorname { o d d s } ( c | \mathbf { x } ) ) - \log _ { 2 } ( \operatorname { o d d s } ( c | \mathbf { x } \backslash \mathbf { x } _ { w } ) )$ counts[coordinates of $\mathbf { x } _ { w } ] + = 1$ end for Output: WE / counts . point-wise division where $\mathrm { o d d s } ( c | \mathbf { x } ) = p ( c | \mathbf { x } ) / ( 1 - p ( c | \mathbf { x } ) )$ . To avoid problems with zero probabilities, Laplace correction $p \gets ( p N + 1 ) / ( N + K )$ is used, where $N$ is the number of training instances and $K$ the number of classes. + +The method produces a relevance vector $( \mathrm { W E } _ { i } ) _ { i = 1 \dots m }$ ( $\textbar { m }$ being the number of features) of the same size as the input, which reflects the relative importance of all features. A large prediction difference means that the feature contributed substantially to the classification, whereas a small difference indicates that the feature was not important for the decision. A positive value $\mathrm { W E } _ { i }$ means that the feature has contributed evidence for the class of interest: removing it would decrease the confidence of the classifier in the given class. A negative value on the other hand indicates that the feature displays evidence against the class: removing it also removes potentially conflicting or irritating information and the classifier becomes more certain in the investigated class. + +# 3.1 CONDITIONAL SAMPLING + +In equation (3), the conditional probability $p ( x _ { i } | \mathbf { x } _ { \backslash i } )$ of a feature $x _ { i }$ is approximated using the marginal distribution $p ( x _ { i } )$ . This is a very crude approximation. In images for example, a pixel’s value is highly dependent on other pixels. We propose a much more accurate approximation, based on the following two observations: a pixel depends most strongly on a small neighborhood around it, and the conditional of a pixel given its neighborhood does not depend on the position of the pixel in the image. For a pixel $x _ { i }$ , we can therefore find a patch $\hat { \mathbf { x } } _ { i }$ of size $l \times l$ that contains $x _ { i }$ , and condition on the remaining pixels in that patch: + +$$ +p ( x _ { i } | \mathbf { x } _ { \backslash i } ) \approx p ( x _ { i } | \hat { \mathbf { x } } _ { \backslash i } ) . +$$ + +This greatly improves the approximation while remaining completely tractable. + +For a feature to become relevant when using conditional sampling, it now has to satisfy two conditions: being relevant to predict the class of interest, and be hard to predict from the neighboring pixels. Relative to the marginal method, we therefore downweight the pixels that can easily be predicted and are thus redundant in this sense. + +# 3.2 MULTIVARIATE ANALYSIS + +Robnik-Šikonja & Kononenko (2008) take a univariate approach: only one feature at a time is removed. However, we would expect that a neural network is relatively robust to just one feature of a high-dimensional input being unknown, like a pixel in an image. Therefore, we will remove several features at once by again making use of our knowledge about images by strategically choosing these feature sets: patches of connected pixels. Instead of going through all individual pixels, we go through all patches of size $k \times k$ in the image ( $k \times k \times 3$ for RGB images and $k \times k \times k$ for 3D images like MRI scans), implemented in a sliding window fashion. The patches are overlapping, so that ultimately an individual pixel’s relevance is obtained by taking the average relevance obtained from the different patches it was in. + +Algorithm 1 and figure 2 illustrate how the method can be implemented, incorporating the proposed improvements. + +# 3.3 DEEP VISUALIZATION OF HIDDEN LAYERS + +When trying to understand neural networks and how they make decisions, it is not only interesting to analyze the input-output relation of the classifier, but also to look at what is going on inside the hidden layers of the network. We can adapt the method to see how the units of any layer of the network influence a node from a deeper layer. Mathematically, we can formulate this as follows. Let h be the vector representation of the values in a layer $H$ in the network (after forward-propagating the input up to this layer). Further, let $z = z ( \mathbf { h } )$ be the value of a node that depends on $\mathbf { h }$ , i.e., a node in a subsequent layer. Then the analog of equation (2) is given by the expectation: + +$$ +g ( z | \mathbf { h } _ { \setminus i } ) \equiv \mathbb { E } _ { p ( h _ { i } | \mathbf { h } _ { \setminus i } ) } \left[ z ( \mathbf { h } ) \right] = \sum _ { h _ { i } } p ( h _ { i } | \mathbf { h } _ { \setminus i } ) z ( \mathbf { h } _ { \setminus i } , h _ { i } ) , +$$ + +which expresses the distribution of $z$ when unit $h _ { i }$ in layer $H$ is unobserved. The equation now works for arbitrary layer/unit combinations, and evaluates to the same as equation (1) when the input-output relation is analyzed. To evaluate the difference between $g ( z | \mathbf { h } )$ and $g ( z | \mathbf { h } _ { \backslash i } )$ , we will in general use the activation difference, $\mathrm { A D } _ { i } ( z | \mathbf { h } ) = g ( z | \mathbf { h } ) - g ( z | \mathbf { h } _ { \backslash i } )$ , for the case when we are not dealing with probabilities (and equation (3) is not applicable). + +# 4 EXPERIMENTS + +In this section, we illustrate how the proposed visualization method can be applied, on the ImageNet dataset of natural images when using DCNNs (section 4.1), and on a medical imaging dataset of MRI scans when using a logistic regression classifier (section 4.2). For marginal sampling we always use the empirical distribution, i.e., we replace a feature (patch) with samples taken directly from other images, at the same location. For conditional sampling we use a multivariate normal distribution. For both sampling methods we use 10 samples to estimate $p ( c | \mathbf { x } _ { \backslash i } )$ (since no significant difference was observed with more samples). Note that all images are best viewed digital and in color. + +Our implementation is available at github.com/lmzintgraf/DeepVis-PredDiff. + +# 4.1 IMAGENET: UNDERSTANDING HOW A DCNN MAKES DECISIONS + +We use images from the ILSVRC challenge (Russakovsky et al., 2015) (a large dataset of natural images from 1000 categories) and three DCNNs: the AlexNet (Krizhevsky et al., 2012), the GoogLeNet (Szegedy et al., 2015) and the (16-layer) VGG network (Simonyan & Zisserman, 2014). We used the publicly available pre-trained models that were implemented using the deep learning framework caffe (Jia et al., 2014). Analyzing one image took us on average 20, 30 and 70 minutes for the respective classifiers AlexNet, GoogLeNet and VGG (using the GPU implementation of caffe and mini-batches with the standard settings of 10 samples and a window size of $k = 1 0$ ). + +The results shown here are chosen from among a small set of images in order to show a range of behavior of the algorithm. The shown images are quite representative of the performance of the method in general. Examples on randomly selected images, including a comparison to the sensitivity analysis of Simonyan et al. (2013), can be seen in appendix A. + +![](images/06d03ab00e42b16d0dc1187d88a9d265f3ce56aff123688d917d4d208fc132ae.jpg) +Figure 3: Visualization of the effects of marginal versus conditional sampling using the GoogLeNet classifier. The classifier makes correct predictions (ostrich and saxophone), and we show the evidence for (red) and against (blue) this decision at the output layer. We can see that conditional sampling gives more targeted explanations compared to marginal sampling. Also, marginal sampling assigns too much importance on pixels that are easily predictable conditioned on their neighboring pixels. + +![](images/6455e925ac116e0d784784daf0f8afd0f43f4ad88880d94d1d98f4fa761d3377.jpg) +Figure 4: Visualization of how different window sizes influence the visualization result. We used the conditional sampling method and the AlexNet classifier with $l = k + 4$ and varying $k$ . We can see that even when removing single pixels $k = 1 ,$ ), this has a noticeable effect on the classifier and more important pixels get a higher score. By increasing the window size we can get a more easily interpretable, smooth result until the image gets blurry for very large window sizes. + +We start this section by demonstrating our proposed improvements (sections 3.1 - 3.3). + +# Marginal vs Conditional Sampling + +Figure 3 shows visualizations of the spatial support for the highest scoring class, using marginal and conditional sampling (with $k = 1 0$ and $l = 1 4$ ). We can see that conditional sampling leads to results that are more refined in the sense that they concentrate more around the object. We can also see that marginal sampling leads to pixels being declared as important that are very easily predictable conditioned on their neighboring pixels (like in the saxophone example). Throughout our experiments, we have found that conditional sampling tends to give more specific and fine-grained results than marginal sampling. For the rest of our experiments, we therefore show results using conditional sampling only. + +# Multivariate Analysis + +For ImageNet data, we have observed that setting $k = 1 0$ gives a good trade-off between sharp results and a smooth appearance. Figure 4 shows how different window sizes influence the resolution of the visualization. Surprisingly, removing only one pixel does have a measurable effect on the prediction, and the largest effect comes from sensitive pixels. We expected that removing only one pixel does not have any effect on the classification outcome, but apparently the classifier is sensitive even to these small changes. However when using such a small window size, it is difficult to make sense of the sign information in the visualization. If we want to get a good impression of which parts in the image are evidence for/against a class, it is therefore better to use larger windows. If $k$ is chosen too large however, the results tend to get blurry. Note that these results are not just simple averages of one another, but a multivariate approach is indeed necessary to observe the presented results. + +# Deep Visualization of Hidden Network Layers + +Our third main contribution is the extension of the method to neural networks; to understand the role of hidden layers in a DNN. Figure 5 shows how different feature maps in three different layers of the GoogLeNet react to the input of a tabby cat (see figure 6, middle image). For each feature map in a convolutional layer, we first compute the relevance of the input image for each hidden unit in that map. To estimate what the feature map as a whole is doing, we show the average of the relevance vectors over all units in that feature map. The first convolutional layer works with different types of simple image filters (e.g., edge detectors), and what we see is which parts of the input image respond positively or negatively to these filters. The layer we picked from somewhere in the middle of the network is specialized to higher level features (like facial features of the cat). The activations of the last convolutional layer are very sparse across feature channels, indicating that these units are highly specialized. + +![](images/9aa2911fd8a20fff6a6cd4bba440ba720e6df920436632ccf296d971d05fc662.jpg) +Figure 5: Visualization of feature maps from thee different layers of the GoogLeNet (l.t.r.: ”conv $1 / 7 \mathrm { x } 7 \_ \mathrm { s } 2 ^ { \cdot \prime }$ , ”inception_3a/output”, ”inception_5b/output”), using conditional sampling and patch sizes $k = 1 0$ and $l = 1 4$ (see alg. 1). For each feature map in the convolutional layer, we first evaluate the relevance for every single unit, and then average the results over all the units in one feature map to get a sense of what the unit is doing as a whole. Red pixels activate a unit, blue pixels decreased the activation. + +![](images/fcc833d94084792a985ed7f2b47caa4c514cc946c9f6110859c390c1249dbbb6.jpg) +Figure 6: Visualization of three different feature maps, taken from the ”inception_ $3 \mathrm { a } I$ output” layer of the GoogLeNet (from the middle of the network). Shown is the average relevance of the input features over all activations of the feature map. We used patch sizes $k = 1 0$ and $l = 1 4$ (see alg. 1). Red pixels activate a unit, blue pixels decreased the activation. + +To get a sense of what single feature maps in convolutional layers are doing, we can look at their visualization for different input images and look for patterns in their behavior. Figure 6 shows this for four different feature maps from a layer from the middle of the GoogLeNet network. We can directly see which kind of features the model has learned at this stage in the network. For example, one feature map is mostly activated by the eyes of animals (third row), and another is looking mostly at the background (last row). + +# Penultimate vs Output Layer + +If we visualize the influence of the input features on the penultimate (pre-softmax) layer, we show only the evidence for/against this particular class, without taking other classes into consideration. After the softmax operation however, the values of the nodes are all interdependent: a drop in the probability for one class could be due to less evidence for it, or because a different class becomes more likely. Figure 7 compares visualizations for the last two layers. By looking at the top three scoring classes, we can see that the visualizations in the penultimate layer look very similar if the classes are similar (like different dog breeds). When looking at the output layer however, they look rather different. Consider the case of the elephants: the top three classes are different elephant subspecies, and the visualizations of the penultimate layer look similar since every subspecies can be identified by similar characteristics. But in the output layer, we can see how the classifier decides for one of the three types of elephants and against the others: the ears in this case are the crucial difference. + +![](images/482164df5c34ceee133e9014c442da8bd23bc4dbcb0b6b265127f97c1db9629a.jpg) +Figure 7: Visualization of the support for the top-three scoring classes in the penultimate- and output layer. Next to the input image, the first row shows the results with respect to the penultimate layer; the second row with respect to the output layer. For each image, we additionally report the values of the units. We used the AlexNet with conditional sampling and patch sizes $k = 1 0$ and $l = 1 4$ (see alg. 1). Red pixels are evidence for a class, and blue against it. + +![](images/b8082c60373251d3deb98376d94efd6c054cce69550e78b6f91354800c5bb442.jpg) +Figure 8: Comparison of the prediction visualization of different DCNN architectures. For two input images, we show the results of the prediction difference analysis when using different neural networks - the AlexNet, GoogLeNet and VGG network. + +# Network Comparison + +When analyzing how neural networks make decisions, we can also compare how different network architectures influence the visualization. Here, we tested our method on the AlexNet, the GoogLeNet and the VGG network. Figure 8 shows the results for the three different networks, on two input images. The AlexNet seems to more on contextual information (the sky in the balloon image), which could be attributed to it having the least complex architecture compared to the other two networks. It is also interesting to see that the VGG network deems the basket of the balloon as very important compared to all other pixels. The second highest scoring class in this case was a parachute - presumably, the network learned to not confuse a balloon with a parachute by detecting a square basket (and not a human). + +# 4.2 MRI DATA: EXPLAINING CLASSIFIER DECISIONS IN MEDICAL IMAGING + +To illustrate how our visualization method can also be useful in a medical domain, we show some experimental results on an MRI dataset of HIV and healthy patients. In such settings, it is crucial that the practitioner has some insight into the algorithm’s decision when classifying a patient, to weigh this information and incorporate it in the overall diagnosis process. + +The dataset used here is referred to as the COBRA dataset. It contains 3D MRIs from $1 0 0 \ \mathrm { H I V }$ patients and 70 healthy individuals, included in the Academic Medical Center (AMC) in Amsterdam, The Netherlands. Of these subjects, diffusion weighted MRI data were acquired. Preprocessing of the data was performed with software developed in-house, using the HPCN-UvA Neuroscience Gateway and using resources of the Dutch e-Science Grid Shahand et al. (2015). As a result, Fractional Anisotropy (FA) maps were computed. FA is sensitive to microstructural damage and therefore expected to be, on average, decreased in patients. Subjects were scanned on two 3.0 Tesla scanner systems, 121 subjects on a Philips Intera system and 39 on a Philips Ingenia system. Patients and controls were evenly distributed. FA images were spatially normalized to standard space Andersson et al. (2007), resulting in volumes with $9 1 \times 1 0 9 \times 9 1 = 9 0 2 , 6 2 9$ voxels. + +We trained an L2-regularized Logistic Regression classifier on a subset of the MRI slices (slices 29-40 along the first axis) and on a balanced version of the dataset (by taking the first 70 samples of the HIV class) to achieve an accuracy of $6 9 . 3 \%$ in a 10-fold cross-validation test. Analyzing one image took around half an hour (on a CPU, with $k = 3$ and $l = 7$ , see algorithm 1). For conditional sampling, we also tried adding location information in equation (2), i.e., we split up the 3D image into a $2 0 \times 2 0 \times 2 0$ grid and also condition on the index in that grid. We found that this slightly improved the interpretability of the results, since the pixel values in the special case of MRI scans does depend on spacial location as well. + +Figure 9 (first row) shows one way via which the prediction difference results could be presented to a physician, for an HIV sample. By overlapping the prediction difference and the MRI image, the exact regions can be pointed out that are evidence for (red parts) or against (blue parts) the classifier’s decision. The second row shows the results using the weights of the logistic regression classifier, which is a commonly used method in neuroscientific literature. We can see that they are considerably noisier (in the sense that, compared to our method, the voxels relevant for the classification decisions are more scattered), and also, they are not specific to the given image. Figure 10 shows the visualization results for four healthy, and four HIV samples. We can clearly see that the patterns for the two classes are distinct, and there is some pattern to the decision of the classifier, but which is still specific to the input image. Figure 11 shows the same (HIV) sample as in figure 9 along different axes, and figure 12 shows how the visualization changes with different patch sizes. We believe that both varying the slice and patch size can give different insights to a clinician, and in clinical practice, a 3D animation where these parameters can be adjusted would be very useful for analyzing the visualization result. + +In general we can assume that the better the classifier, the closer the explanations for its decisions are to the true class difference. For clinical practice it is therefore crucial to have very good classifiers. This will increase computation time, but in many medical settings, longer waiting times for test results are common and worth the wait if the patient is not in an acute life threatening condition (e.g., when predicting HIV or Alzheimer from MRI scans, or the field of cancer diagnosis and detection). The presented results here are for demonstration purposes of the visualization method, and we claim no medical validity. A thorough qualitative analysis incorporating expert knowledge was outside the scope of this paper. + +# 5 FUTURE WORK + +In our experiments, we used a simple multivariate normal distribution for conditional sampling. We can imagine that using more sophisticated generative models will lead to better results: pixels that are easily predictable by their surrounding are downweighted even more. However this will also significantly increase the computational resources needed to produce the explanations. Similarly, we could try to modify equation (4) to get an even better approximation by using a conditional distribution that takes more information about the whole image into account (like adding spatial information for the MRI scans). + +To make the method applicable for clinical analysis and practice, a better classification algorithm is required. Also, software that visualizes the results as an interactive 3D model will improve the usability of the system. + +# 6 CONCLUSION + +We presented a new method for visualizing deep neural networks that improves on previous methods by using a more powerful conditional, multivariate model. The visualization method shows which pixels of a specific input image are evidence for or against a node in the network. The signed information offers new insights - for research on the networks, as well as the acceptance and usability in domains like healthcare. While our method requires significant computational resources, real-time 3D visualization is possible when visualizations are pre-computed. With further optimization and powerful GPUs, pre-computation time can be reduced a lot further. In our experiments, we have presented several ways in which the visualization method can be put into use for analyzing how DCNNs make decisions. + +![](images/a85509f7394141043b2a833c061d51d93e6f419f4ea44470573238dd279a77ee.jpg) +Figure 9: Visualization of the support for the correct classification ”HIV”, using the Prediction Difference method and Logistic Regression Weights. For an HIV sample, we show the results with the prediction difference (first row), and using the weights of the logistic regression classifier (second row), for slices 29 and 40 (along the first axis). Red are positive values, and blue negative. For each slice, the left image shows the original image, overlaid with the relevance values. The right image shows the original image with reversed colors and the relevance values. Relevance values are shown only for voxels with (absolute) relevance value above $1 5 \%$ of the (absolute) maximum value. + +![](images/95924f4010f91217380b1bc9eb550b78acaba90e69477baca5ed190bd7d9cf28.jpg) +Figure 10: Prediction difference visualization for different samples. The first four samples are of the class ”healthy”; the last four of the class ”HIV”. All images show slice 39 (along the first axis). All samples are correctly classified, and the results show evidence for (red) and against (blue) this decision. Prediction differences are shown only for voxels with (absolute) relevance value above $1 5 \%$ of the (absolute) maximum value. + +![](images/20456acef76521d1fe14e977d7395f11d399ffa099efda55adcbe4c412677c10.jpg) +Figure 11: Visualization results across different slices of the MRI image, using the same input image as shown in 9. Prediction differences are shown only for voxels with (absolute) relevance value above $1 5 \%$ of the (absolute) maximum value. + +![](images/58c146db5b6150e3d5cdfc12aaa56836d4ba0d268953eea18fd7e26b54b572a3.jpg) +Figure 12: How the patch size influences the visualization. For the input image (HIV sample, slice 39 along the first axis) we show the visualization with different patch sizes $k$ in alg. 1). Prediction differences are shown only for voxels with (absolute) relevance value above $1 5 \%$ of the (absolute) maximum (for $k = 2$ it is $10 \%$ ). + +# ACKNOWLEDGMENTS + +This work was supported by AWS in Education Grant award. We thank Facebook and Google for financial support, and our reviewers for their time and valuable, constructive feedback. + +This work was also in part supported by: Innoviris, the Brussels Institute for Research and Innovation, Brussels, Belgium; the Nuts-OHRA Foundation (grant no. 1003-026), Amsterdam, The Netherlands; The Netherlands Organization for Health Research and Development (ZonMW) together with AIDS Fonds (grant no 300020007 and 2009063). Additional unrestricted scientific grants were received from Gilead Sciences, ViiV Healthcare, Janssen Pharmaceutica N.V., Bristol-Myers Squibb, Boehringer Ingelheim, and Merck&Co. + +We thank Barbara Elsenga, Jane Berkel, Sandra Moll, Maja Totté, and Marjolein Martens for running the AGEhIV study program and capturing our data with such care and passion. We thank Yolanda Ruijs-Tiggelman, Lia Veenenberg-Benschop, Sima Zaheri, and Mariska Hillebregt at the HIV Monitoring Foundation for their contributions to data management. We thank Aafien Henderiks and Hans-Erik Nobel for their advice on logistics and organization at the Academic Medical Center. We thank all HIV-physicians and HIV-nurses at the Academic Medical Center for their efforts to include the HIV-infected participants into the AGEhIV Cohort Study, and the Municipal Health Service Amsterdam personnel for their efforts to include the HIV-uninfected participants into the AGEhIV Cohort Study. We thank all study participants without whom this research would not be possible. + +AGEhIV Cohort Study Group. Scientific oversight and coordination: P. Reiss (principal investigator), F.W.N.M. Wit, M. van der Valk, J. Schouten, K.W. Kooij, R.A. van Zoest, E. Verheij, B.C. Elsenga (Academic Medical Center (AMC), Department of Global Health and Amsterdam Institute for Global Health and Development (AIGHD)). M. Prins (co-principal investigator), M.F. Schim van der Loeff, M. Martens, S. Moll, J. Berkel, M. Totté, G.R. Visser, L. May, S. Kovalev, A. Newsum, M. Dijkstra (Public Health Service of Amsterdam, Department of Infectious Diseases). Datamanagement: S. Zaheri, M.M.J. Hillebregt, Y.M.C. Ruijs, D.P. Benschop, A. el Berkaoui (HIV Monitoring Foundation). Central laboratory support: N.A. Kootstra, A.M. Harskamp-Holwerda, I. Maurer, T. Booiman, M.M. Mangas Ruiz, A.F. Girigorie, B. Boeser-Nunnink (AMC, Laboratory for Viral Immune Pathogenesis and Department of Experimental Immunology). Project management and administrative support: W. Zikkenheiner, F.R. Janssen (AIGHD). Participating HIV physicians and nurses: S.E. Geerlings, M.H. Godfried, A. Goorhuis, J.W.R. Hovius, J.T.M. van der Meer, F.J.B. Nellen, T. van der Poll, J.M. Prins, P. Reiss, M. van der Valk, W.J. Wiersinga, M. van Vugt, G. de Bree, F.W.N.M. Wit; J. van Eden, A.M.H. van Hes, M. Mutschelknauss , H.E. Nobel, F.J.J. Pijnappel, M. Bijsterveld, A. Weijsenfeld, S. Smalhout (AMC, Division of Infectious Diseases). Other collaborators: J. de Jong, P.G. Postema (AMC, Department of Cardiology); P.H.L.T. Bisschop, M.J.M. Serlie (AMC, Division of Endocrinology and Metabolism); P. Lips (Free University Medical Center Amsterdam); E. Dekker (AMC, Department of Gastroenterology); N. van der Velde (AMC, Division of Geriatric Medicine); J.M.R. Willemsen, L. Vogt (AMC, Division of Nephrology); J. Schouten, P. Portegies, B.A. Schmand, G.J. Geurtsen (AMC, Department of Neurology); F.D. Verbraak, N. Demirkaya (AMC, Department of Ophthalmology); I. Visser (AMC, Department of Psychiatry); A. Schadé (Free University Medical Center Amsterdam, Department of Psychiatry); P.T. Nieuwkerk, N. Langebeek (AMC, Department of Medical Psychology); R.P. van Steenwijk, E. Dijkers (AMC, Department of Pulmonary medicine); C.B.L.M. Majoie, M.W.A. Caan, T. Su (AMC, Department of Radiology); H.W. van Lunsen, M.A.F. Nievaard (AMC, Department of Gynaecology); B.J.H. van den Born, E.S.G. Stroes, (AMC, Division of Vascular Medicine); W.M.C. Mulder (HIV Vereniging Nederland). + +# REFERENCES + +Jesper LR Andersson, Mark Jenkinson, and Stephen Smith. Non-linear optimisation. fmrib technical report tr07ja1. University of Oxford FMRIB Centre: Oxford, UK, 2007. + +Sebastian Bach, Alexander Binder, Grégoire Montavon, Frederick Klauschen, Klaus-Robert Müller, and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 10(7):e0130140, 2015. + +Christine Ecker, Andre Marquand, Janaina Mourão-Miranda, Patrick Johnston, Eileen M Daly, Michael J Brammer, Stefanos Maltezos, Clodagh M Murphy, Dene Robertson, Steven C Williams, et al. Describing the brain in autism in five dimensions—magnetic resonance imaging-assisted diagnosis of autism spectrum disorder using a multiparameter classification approach. The Journal of Neuroscience, 30(32):10612–10623, 2010. + +Dumitru Erhan, Yoshua Bengio, Aaron Courville, and Pascal Vincent. Visualizing higher-layer features of a deep network. Dept. IRO, Université de Montréal, Tech. Rep, 4323, 2009. + +Bilwaj Gaonkar and Christos Davatzikos. Analytic estimation of statistical significance maps for support vector machine based multi-variate image analysis and classification. NeuroImage, 78:270–283, 2013. + +Stefan Haufe, Frank Meinecke, Kai Görgen, Sven Dähne, John-Dylan Haynes, Benjamin Blankertz, and Felix Bießmann. On the interpretation of weight vectors of linear models in multivariate neuroimaging. Neuroimage, 87:96–110, 2014. + +Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe: Convolutional architecture for fast feature embedding. arXiv preprint arXiv:1408.5093, 2014. + +Stefan Klöppel, Cynthia M Stonnington, Carlton Chu, Bogdan Draganski, Rachael I Scahill, Jonathan D Rohrer, Nick C Fox, Clifford R Jack, John Ashburner, and Richard SJ Frackowiak. Automatic classification of mr scans in alzheimer’s disease. Brain, 131(3):681–689, 2008. + +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. + +Janaina Mourao-Miranda, Arun LW Bokde, Christine Born, Harald Hampel, and Martin Stetter. Classifying brain states and determining the discriminating activation patterns: Support vector machine on functional mri data. NeuroImage, 28(4):980–995, 2005. + +Marko Robnik-Šikonja and Igor Kononenko. Explaining classifications for individual instances. Knowledge and Data Engineering, IEEE Transactions on, 20(5):589–600, 2008. + +Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y. + +Shayan Shahand, Ammar Benabdelkader, Mohammad Mahdi Jaghoori, Mostapha al Mourabit, Jordi Huguet, Matthan WA Caan, Antoine HC Kampen, and Sílvia D Olabarriaga. A data-centric neuroscience gateway: design, implementation, and experiences. Concurrency and Computation: Practice and Experience, 27(2): 489–506, 2015. + +Avanti Shrikumar, Peyton Greenside, Anna Shcherbina, and Anshul Kundaje. Not just a black box: Learning important features through propagating activation differences. arXiv preprint arXiv:1605.01713, 2016. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. + +Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013. + +Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–9, 2015. + +Ze Wang, Anna R Childress, Jiongjiong Wang, and John A Detre. Support vector machine learning-based fmri data group analysis. NeuroImage, 36(4):1139–1151, 2007. + +Jason Yosinski, Jeff Clune, Anh Nguyen, Thomas Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. arXiv preprint arXiv:1506.06579, 2015. + +Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Computer vision–ECCV 2014, pp. 818–833. Springer, 2014. + +Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2921–2929, 2016. + +# A RANDOM RESULTS + +![](images/56046904ef7dc7617dbe0e10eb3d4bc0cf57ee2e68dd29905815aada30679ce8.jpg) +Figure 13: Results on 34 randomly chosen ImageNet images. Middle columns: original image; left columns: sensitivity maps (Simonyan et al., 2013) where the red pixels indicate high sensitivity, and white pixels mean no sensitivity (note that we show the absolute values of the partial derivatives, since the sign cannot be interpreted like in our method); right columns: results from our method. For both methods, we visualize the results with respect to the correct class which is given above the image. In brackets we see how the classifier ranks this class, i.e., a (1) means it was correctly classified, whereas a (4) means that it was misclassified, and the correct class was ranked fourth. For our method, red areas show evidence for the correct class, and blue areas show evidence against the class (e.g., the scuba diver looks more like a tea pot to the classifier). \ No newline at end of file diff --git a/md/train/BJlahxHYDS/BJlahxHYDS.md b/md/train/BJlahxHYDS/BJlahxHYDS.md new file mode 100644 index 0000000000000000000000000000000000000000..919433dababce313d43f1960ba81f76505a414df --- /dev/null +++ b/md/train/BJlahxHYDS/BJlahxHYDS.md @@ -0,0 +1,567 @@ +# CONSERVATIVE UNCERTAINTY ESTIMATION BY FITTING PRIOR NETWORKS + +Kamil Ciosek1, Vincent Fortuin1,2, Ryota Tomioka1, Katja Hofmann1, Richard Turner1,3 + +# ABSTRACT + +Obtaining high-quality uncertainty estimates is essential for many applications of deep neural networks. In this paper, we theoretically justify a scheme for estimating uncertainties, based on sampling from a prior distribution. Crucially, the uncertainty estimates are shown to be conservative in the sense that they never underestimate a posterior uncertainty obtained by a hypothetical Bayesian algorithm. We also show concentration, implying that the uncertainty estimates converge to zero as we get more data. Uncertainty estimates obtained from random priors can be adapted to any deep network architecture and trained using standard supervised learning pipelines. We provide experimental evaluation of random priors on calibration and out-of-distribution detection on typical computer vision tasks, demonstrating that they outperform deep ensembles in practice. + +# 1 INTRODUCTION + +Deep learning has achieved huge success in many applications. In particular, increasingly often, it is used as a component in decision-making systems. In order to have confidence in decisions made by such systems, it is necessary to obtain good uncertainty estimates, which quantify how certain the network is about a given output. In particular, if the cost of failure is large, for example where the automated system has the capability to accidentally hurt humans, the availability and quality of uncertainty estimates can determine whether the system is safe to deploy at all (Carvalho, 2016; Leibig et al., 2017; Michelmore et al., 2018). Moreover, when decisions are made sequentially, good uncertainty estimates are crucial for achieving good performance quickly (Bellemare et al., 2016; Houthooft et al., 2016; Ostrovski et al., 2017; Burda et al., 2018). + +Because any non-Bayesian inference process is potentially sub-optimal (De Finetti, 1937), these uncertainty estimates should ideally be relatable to Bayesian inference with a useful prior. Deep ensembles (Lakshminarayanan et al., 2017), one of the most popular methods available for uncertainty estimation in deep networks today, struggle with this requirement. While deep ensembles can be related (Rubin, 1981) to Bayesian inference in settings where the individual models are trained on subsets of the data, this is not how they are used in practice. In order to improve data efficiency, all ensembles are typically trained using the same data (Lakshminarayanan et al., 2017), resulting in a method which does not have a theoretical justification. Moreover, deep ensembles can give overconfident uncertainty estimates in practice. On the other hand, Monte-Carlo dropout can be viewed (Gal & Ghahramani, 2016) as a certain form of Bayesian inference. However, doing so requires requires either a limit to be taken or a generalization of variational inference to a quasi-KL divergence (Hron et al., 2018). In practice, MC dropout can give arbitrarily overconfident estimates (Foong et al., 2019). More broadly, a category of approaches, known as Bayesian Neural Networks (Blundell et al., 2015; Welling & Teh, 2011; Neal, 1996), maintains a distribution over the weights of the neural network. These methods have a sound Bayesian justification, but training them is both difficult and carries an accuracy penalty, particularly for networks with convolutional architectures (Osawa et al., 2019). Moreover, tuning BNNs is hard and achieving a good approximation to the posterior is difficult (Brosse et al., 2018). + +We use another way of obtaining uncertainties for deep networks, based on fitting random priors (Osband et al., 2018; 2019). Random priors are easy to train and were found to work very well in practice (Burda et al., 2018). To obtain the uncertainty estimates, Affiliations: 1. Microsoft Research Cambridge; 2. ETH Zurich; 3. University of Cambridge. The second author was an intern at Microsoft when contributing to this work. + +we first train a predictor network to fit a prior. Two examples of prior-predictor pairs are shown in the top two plots of Figure 1.Faced with a novel input point, we obtain an uncertainty (Figure 1, bottom plot) by measuring the error of the predictor network against this pattern. Intuitively, these errors will be small close to the training points, but large far from them. The patterns themselves are drawn from randomly initialized (and therefore untrained) neural networks. While this way of estimating uncertainties was known before (Osband et al., 2019), it did not have a theoretical justification beyond Bayesian linear regression, which is too limiting for modern applications. + +Contributions We provide a sound theoretical framework for obtaining uncertainty estimates by fitting random priors, a method previously lacking a principled justification. Specifically, we justify estimates in the uncertainty of the output of neural networks with any architecture. In particular, we show in Lemma 1 and Proposition 1 that these uncertainty estimates are conservative, meaning they are never more certain than a Bayesian algorithm would be. Moreover, in Proposition 2 we show concentration, i.e. that the uncertainties become zero with infinite data. Empirically, we evaluate the calibration and out-of-distribution performance of our uncertainty estimates on typical computer vision tasks, showing a practical benefit over deep ensembles and MC dropout. + +# 2 PRELIMINARIES + +We are going to reason about uncertainty within the formal framework of stochastic processes. We now introduce the required notations. + +![](images/72e507b1e860e955bda2dcb5bfc322bc28efaf943b4a3f3262f3bfa2c0328aa5.jpg) +Figure 1: On top, two predictors (green) were trained to fit two randomlygenerated priors (red). On the bottom, we obtain uncertainties from the difference between predictors and priors. Dots correspond to training points $x _ { i }$ . + +A stochastic process is a collection of random variables $\{ f ( x ) \}$ . We consider processes where $\boldsymbol { x } \in \mathbb { R } ^ { K }$ and the random-variable $f ( x )$ takes values in $\mathbb { R } ^ { M }$ . A stochastic process has exchangeable outputs if the distribution does not change when permuting the $M$ entries in the output vector. Allowing a slight abuse of notation, we denote the finite-dimensional distribution of the process $\{ f ( x ) \}$ for the set $X =$ $\{ x _ { i } \} _ { i = 1 , \ldots , N }$ as $f ( x _ { 1 } , \dots , x _ { N } ) = f ( X )$ . In practice, the finite-dimensional distribution reflects the idea of restricting the process to points $x _ { 1 } , \ldots , x _ { N }$ and marginalizing over all the other points. Inference can be performed on stochastic processes similarly to probability distributions. In particular, we can start with some prior process $\{ f ( x ) \}$ , observe a set of $N$ training points $X = \{ x _ { i } \} _ { i = 1 , \dots , N }$ and labels $y = \{ y _ { i } \} _ { i = 1 , \dots , N }$ and then consider the posterior process $\{ f _ { X y } ( x ) \}$ , whose finite-dimensional distributions are given by $f _ { X y } ( x _ { 1 } ^ { \star } \ldots x _ { N ^ { \prime } } ^ { \star } ) = f ( x _ { 1 } ^ { \star } \ldots x _ { N ^ { \prime } } ^ { \star } | x _ { 1 } , \ldots , x _ { N } , y _ { 1 } , \ldots , y _ { N } )$ for any set of testing points $x _ { 1 } ^ { \star } \ldots x _ { N ^ { \prime } } ^ { \star }$ . We use subscripts to denote conditioning on the dataset throughout the paper. We denote the variance of $f _ { X y } ( x _ { \star } )$ with $\sigma _ { X f } ^ { 2 } ( x _ { \star } )$ . A stochastic process is called Gaussian if if all its finite-dimensional distributions are Gaussian. Given a test point $x _ { \star }$ , we denote the posterior GP mean with $\mu _ { X y } ( x _ { \star } )$ and posterior GP variance with $\sigma _ { X } ^ { 2 } ( x _ { \star } )$ . We provide more background on GPs in Appendix D. + +# 3 ESTIMATING UNCERTAINTY FROM RANDOM PRIORS + +Intuition Uncertainties obtained from random priors have an appealing intuitive justification. Consider the networks in the top part of Figure 1. We start with a randomly initialized prior network, shown in red. Whenever we see a datapoint, we train the predictor network (green) to match this prior. Uncertainties can then be obtained by considering the squared error between the prior and the predictor at a given point. An example uncertainty estimate is shown as the shaded blue area in the bottom of Figure 1. While it may at first seem that the squared error is a poor measure of uncertainty because it can become very small by random chance, we formally show in Section 4.1 that this is very improbable. In Section 4.2, we show that this error goes down to zero as we observe more data. Similarly to GP inference, uncertainty estimation in our framework does not depend on the regression label. The prediction mean (blue curve in the bottom part of Figure 1) is obtained by fitting a completely separate neural network. In section 6, we discuss how this framework avoids the overconfidence characteristic of deep ensembles (Lakshminarayanan et al., 2017). + +Prior The process of obtaining network uncertainties involves randomly initialized prior networks, which are never trained. While this may at first appear very different from they way deep learning is normally done, these random networks are a crucial component of our method. We show in Section 4.1 that the random process that corresponds to initializing these networks can be interpreted as a prior of a Bayesian inference procedure. A prior conveys the information about how the individual data points are related. The fact that we are using random networks has both practical and theoretical benefits. Practically, since the prior does not depend on the data, there is no way that it can overfit. The use of random priors also has strong empirical support – randomly initialized networks have been recently used as priors to obtain state-of-the-art performance on computer vision tasks (Ulyanov et al., 2018; Cheng et al., 2019). Theoretically, using random priors satisfies the likelihood principle (Robert, 2007). Moreover, random priors can be viewed as a safe choice since they make the minimum reasonable assumption that the network architecture is appropriate for the task. In fact, whenever deep learning is used, with or without uncertainty estimates, practitioners are already implicitly making that assumption. + +Algorithm The process of training the predictor networks is shown in Algorithm 1. The function TRAIN-UNCERTAINTIES first generates random priors, i.e. neural networks with random weights. In our notation, it corresponds to sampling functions from the prior process $\{ f ( x ) \}$ . These priors, evaluated at points from the dataset $X = \{ x _ { i } \} _ { i = 1 , \dots , N }$ are then used as labels for supervised learning, performed by the function FIT. After training, when we want to obtain an uncertainty estimate $\phi$ at a given test point $x _ { \star }$ , we use the formula + +
Algorithm 1 Training the predictors.
function TRAIN-UNCERTAINTIES(X) fori=1...Bdo fi~{f(x)} > random prior hxfi ←FIT(X,fi(X)) end for
return fi,hx fi end function
function FIT(X, fi(X))
L(h)=∑x∈x If²(x)-h(x)ll² h xfi← OPTIMIZE(L)>SGD or similar return h x fi >return trained predictor
+ +$$ +\hat { \sigma } ^ { 2 } ( x _ { \star } ) = \operatorname* { m a x } ( 0 , \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) + \beta \hat { v } _ { \sigma } ( x _ { \star } ) - \sigma _ { A } ^ { 2 } ) . +$$ + +Here, the quantity $\hat { \sigma } _ { \mu } ^ { 2 }$ is the sample mean of the squared error. We will show in Section 4 that it is an unbiased estimator of a variable that models the uncertainty. On the other hand, $\hat { v } _ { \sigma }$ is the samplebased estimate of the standard deviation of squared error across bootstraps, needed to quantify our uncertainty about what the uncertainty is. The hyper-parameter $\beta$ controls the degree to which this uncertainty is taken into account. Formally, the quantities are defined as + +$$ +\begin{array} { r l } & { \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \triangleq \sum _ { i = 1 } ^ { B } \frac { 1 } { M B } \| f ( x _ { \star } ) - h _ { X f _ { i } } ( x _ { \star } ) \| ^ { 2 } , } \\ & { \hat { v } _ { \sigma } ( x _ { \star } ) \triangleq \sqrt { \sum _ { i = 1 } ^ { B } \frac { 1 } { B } ( \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) - \frac { 1 } { M } \| f ( x _ { \star } ) - h _ { X f _ { i } } ( x _ { \star } ) \| ^ { 2 } ) ^ { 2 } } . } \end{array} +$$ + +In the above equations, $B$ is the number of prior functions and each prior and predictor network has $M$ outputs. Because the predictors are trained independently, uncertainty estimates obtained from each of the $B$ predictor-prior pairs are independent. We defer the discussion of details of network architecture to Section 5. Our experiments (Section 7) show that it is often sufficient to use $B = 1$ in practice. + +# 4 THEORETICAL RESULTS + +In Section 3, we introduced a process for obtaining uncertainties in deep learning. We now seek to provide a formal justification. We define the expected uncertainties as + +$$ +\begin{array} { r } { \tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \triangleq \operatorname { E } _ { f } \left[ \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \right] = \operatorname { E } _ { f } \left[ \frac { 1 } { M } \lVert f ( x _ { \star } ) - h _ { X f } ( x _ { \star } ) \rVert ^ { 2 } \right] . } \end{array} +$$ + +In other words, $\tilde { \sigma } _ { \mu } ^ { 2 }$ is the expected version of the sample-based uncertainties $\hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } )$ introduced in equation 2. Since Bayesian inference is known to be optimal (De Finetti, 1937; Jaynes, 2003; Robert, 2007), the most appealing way of justifying uncertainty estimates ${ \tilde { \sigma } } _ { \mu } ^ { 2 }$ and $\hat { \sigma } _ { \mu } ^ { 2 }$ is to relate them to a Bayesian posterior $\sigma _ { X f } ^ { 2 } ( x _ { \star } )$ . We do this in two stages. First, in Section 4.1, we prove that the obtained uncertainties are larger than ones arrived at by Bayesian inference. This means that our uncertainties are conservative, ensuring that our algorithm is never more certain than it should be. Next, in Section 4.2, we show that uncertainties concentrate, i.e., they become small as we get more and more data. These two properties are sufficient to justify the use of our uncertainties in many applications. + +# 4.1 UNCERTAINTIES FROM RANDOM PRIORS ARE CONSERVATIVE + +From the point of view of safety, it is preferable to overestimate the ground truth uncertainty than to underestimate it. We now show that this property holds for uncertainties obtained from random priors. We first justify conservatism for the expected uncertainty ${ \tilde { \sigma } } _ { \mu } ^ { 2 }$ defined in equation 4 and then for the sampled uncertainty $\hat { \sigma } _ { \mu } ^ { 2 }$ defined in equation 2. + +Amortized Conservatism We first consider a weak form of this conservatism, which we call amortized. It guarantees that ${ \tilde { \sigma } } _ { \mu } ^ { 2 }$ is never smaller than the average posterior uncertainty across labels sampled from the prior. Formally, amortized conservatism holds if for any test point $x _ { \star }$ we have + +$$ +\tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \geq \mathrm { E } _ { f ( X ) } \left[ \sigma _ { X f } ^ { 2 } ( x _ { \star } ) \right] . +$$ + +Here $\sigma _ { X f } ^ { 2 }$ corresponds to the second moment of the posterior process $\{ f _ { X f } ( x ) \}$ . We will introduce a stronger version of conservatism, which does not have an expectation on the right-hand side, later in this section (eq. 8). For now, we concentrate on amortized conservatism. In Lemma 1 (proof in appendix), we show that it holds under very general conditions. + +Lemma 1. For any function $h : \mathbb { R } ^ { N \times ( K + 1 ) } \mathbb { R } ^ { M }$ , for any test point $\boldsymbol { x } _ { \star } ~ \in ~ \mathbb { R } ^ { K }$ and for any stochastic process $\{ f ( x ) \} _ { x \in \mathbb { R } ^ { K } }$ with all second moments finite and exchangeable outputs + +$$ +\begin{array} { r } { \tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) = \mathrm { E } _ { f ( X ) } \left[ \sigma _ { X f } ^ { 2 } ( x _ { \star } ) + \frac { 1 } { M } \| \mu _ { X f } ( x _ { \star } ) - h _ { X f } ( x _ { \star } ) \| ^ { 2 } \right] . } \end{array} +$$ + +Relation to a GP Lemma 1 holds for any prior process $\{ f ( x ) \}$ . However, the prior process used by Algorithm 1 is not completely arbitrary. The fact that prior samples are obtained by initializing neural networks with independently sampled weights gives us additional structure. In fact, it can be shown that randomly initialized neural networks become close to GPs as the width of the layers increases. While the original result due to Neal (1996) held for a simple network with one hidden layer, it has been extended to a wide class of popular architectures, including to CNNs and RNNs of arbitrary depth (Matthews et al., 2018; Lee et al., 2018; Novak et al., 2019; Williams, 1997; Le Roux & Bengio, 2007; Hazan & Jaakkola, 2015; Daniely et al., 2016; Garriga-Alonso et al., 2019). Recently, it has been shown to hold for a broad class of functions trainable by gradient descent (Yang, 2019). While the precise statement of these results involves technicalities which fall beyond the scope of this paper, we recall the key insight. For a family of neural networks $\{ f ^ { W } ( x ) \}$ , where the weights are sampled independently and $W$ is the width of the hidden layers, there exists a limiting kernel function $k _ { \infty }$ such that + +$$ +\operatorname* { l i m } _ { W \infty } [ \{ f ^ { W } ( x ) \} ] = \mathcal { G P } ( 0 , k _ { \infty } ) . +$$ + +In other words, as the size of the hidden layers increases, the stochastic process obtained by initializing networks randomly converges in distribution to a GP. In the context of our uncertainty estimates, this makes it reasonable for $W$ large enough to consider the prior to be a GP. We stress that the GP assumption has to hold only for the prior network, which is never trained. We do not make any assumptions about connections between the predictor training process and GPs. + +Strict Conservatism Denoting the posterior GP variance with $\sigma _ { X } ^ { 2 } ( x _ { \star } )$ , we define uncertainty estimates to be strictly conservative when + +$$ +\tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \geq \sigma _ { X } ^ { 2 } ( x _ { \star } ) . +$$ + +This statement is stronger than the amortized conservatism in equation 5. Intuitively, equation 8 can be interpreted as saying that our uncertainty estimates are never too small. This confirms the intuition expressed by Burda et al. (2018) that random priors do not overfit. Below, in Proposition 1, we outline how to guarantee strict conservatism formally. It is proved in Appendix F.1. + +Proposition 1 (Strict Conservatism in Expectation). Assume that $f$ is a GP. Then for any function $h : \bar { \mathbb { R } } ^ { N \times K } \to \bar { \mathbb { R } } ^ { M }$ , we have + +$$ +\tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) = \sigma _ { X } ^ { 2 } ( x _ { \star } ) + \underbrace { { \mathrm E } _ { f ( X ) } \left[ \frac { 1 } { M } \| \mu _ { X f } ( x _ { \star } ) - h _ { X f } ( x _ { \star } ) \| ^ { 2 } \right] } _ { \geq 0 } . +$$ + +Moreover, equality holds if and only if $h _ { X f } ( x _ { \star } ) = \mu _ { X f } ( x _ { \star } )$ . + +Conservatism with Finite Bootstraps Lemma 1 above shows conservatism for expected uncertainties, i.e. ${ \tilde { \sigma } } _ { \mu } ^ { 2 }$ introduced in equation 5. However, in practice we have to estimate this expectation using a finite number of bootstraps, and use the sampled uncertainties $\hat { \sigma } _ { \mu } ^ { 2 }$ defined in equation 2. We now state a conservatism guarantee that holds even in the case of just one bootstrap $B = 1$ ). The proof is deferred to Appendix F.1. + +Corollary 1 (Strict Conservatism for Finite Bootstraps). Assume that $f$ is a GP. Assume that the random variable $\hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } )$ has finite variance upper bounded by vUB. Then with probability $1 - \delta$ , for any function $h : \mathbb { R } ^ { N \times K } \to \mathbb { R } ^ { M }$ , we have + +$$ +\begin{array} { r } { \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) + \frac { 1 } { \sqrt { \delta } } v _ { U B } \geq \tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \geq \sigma _ { X } ^ { 2 } ( x _ { \star } ) . } \end{array} +$$ + +However, applying Corollary 1 requires the knowledge of $v _ { \mathrm { U B } }$ . We now provide an upper bound. + +Lemma 2. Assume that the GP $\{ f ( x ) \}$ is zero mean with exchangeable outputs and the function $h _ { X f }$ takes values in $[ - U , U ] ^ { M }$ . Assume that permuting the outputs of $f$ produces the same permutation in the outputs of $h _ { X f }$ . With probability $1 - \delta$ , we have + +$$ +\operatorname { V a r } _ { f _ { 1 } , \dots , f _ { B } } \left[ \widehat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \right] \leq v _ { U B } , +$$ + +where vUB is expressible in terms of observable quantities. + +The proof and the explicit formula for $v _ { \mathrm { U B } }$ is deferred to Appendix F.1. In cases where conservatism is desired, but not absolutely essential, we can avoid the torturous calculation of Lemma 2 and replace $v _ { \mathrm { U B } }$ with the sample-based estimate $\hat { v } _ { \sigma } ( x _ { \star } )$ , defined in equation 2. In this case, the conservatism guarantee is only approximate. This is how we obtained equation 1, used by the algorithm in practice. + +# 4.2 UNCERTAINTIES FROM RANDOM PRIORS CONCENTRATE + +While the conservatism property in Proposition 1 is appealing, it is not sufficient on its own for the uncertainty estimates to be useful. We also need concentration, i.e. a guarantee that the uncertainties $\hat { \sigma } ^ { 2 }$ become small with more data. We can gurantee this formally by assuming that the class of neural networks being fitted is Lipschitz-continuous and bounded. Intuitively, by assumption of Lipschitz continuity, the predictors $h _ { X f }$ cannot behave very differently on points from the training and test sets, since both come from the same data distribution. We can then show concentration by using standard Rademacher tools to obtain a bound on the expected uncertainty in terms of the squared error on the training set. This process is formalized in Proposition 2. + +Proposition 2. If the training converges, i.e. the training loss $\begin{array} { r } { \frac { 1 } { M N } \sum _ { i = 1 } ^ { N } \| f ( x _ { i } ) - h _ { X f } ( x _ { i } ) \| ^ { 2 } = \sigma _ { A } ^ { 2 } } \end{array}$ for arbitrarily large training sets, then assuming the predictors $h _ { X f }$ are bounded and Lipschitz continuous with constant $L _ { i }$ , then under technical conditions the uncertainties concentrate, i.e. $\hat { \sigma } ^ { 2 } ( x _ { \star } ) 0$ as $N \to \infty$ and $B \infty$ with probability $^ { l }$ . + +![](images/deb13d37a38edcab03bbd4d7c252af69ea1b5d9696ab8c3bce34ccd68d5ebc20.jpg) +Figure 2: Architecture of the random prior networks $f$ and predictor networks $h _ { X f }$ . The predictor networks $h _ { X f }$ typically share the same architectural core, but have additional layers relative to the prior networks. Both the green and red parts of the predictor networks are trained. + +The proof and the technical conditions are given in Appendix F. Proposition 2 assumes that the training error is zero for arbitrarily large training sets, which might at first seem unrealistic. We argue that this assumption is in fact reasonable. The architecture of our predictor networks (Figure 2, right diagram) is a superset of the prior architecture (Figure 2, left diagram), guaranteeing the existence of weight settings for the predictor that make the training loss zero. Recent results on deep learning optimization (Du et al., 2019; Allen-Zhu et al., 2019) have shown that stochastic gradient descent can in general be expected to find representable functions. + +# 5 PRACTICAL CONCLUSIONS FROM THE THEORY + +We now re-visit the algorithm we defined in Section 3, with the aim of using the theory above to obtain practical improvements in the quality of the uncertainty estimates. + +Architecture and Choosing the Number of Bootstraps Our conservatism guarantee in Proposition 1 holds for any architecture for the predictor $h _ { X f }$ . In theory, the predictor could be completely arbitrary and does not even have to be a deep network. In particular, there is no formal requirement for the predictor architecture to be the same as the prior. On the other hand, to show concentration in Proposition 2, we had to ensure that the prior networks are representable by the predictor. In practice, we use the architecture shown in Figure 2, where the predictor mirrors the prior, but has additional layers, giving it more representational power. Moreover, the architecture requires choosing the number of bootstraps $B$ . Our experiments in Section 7 show that even using $B = 1$ , i.e. one bootstrap, produces uncertainty estimates of high quality in practice. + +Modeling Epistemic and Aleatoric Uncertainty Proposition 1 and Proposition 2 hold for any Gaussian Process prior. By choosing the process appropriately, we can model both epistemic and aleatoric uncertainty. Denote by $\{ n ( x ) \}$ a stochastic process obtained by randomly initializing neural networks and denote by $\bar { \{ \epsilon ( x ) \sigma _ { A } ^ { 2 } \} }$ the noise term, modeling the aleatoric (observation) noise, where samples are obtained from $\mathsf { \bar { \epsilon } } ( x ) \sim \mathcal { N } ( 0 , 1 )$ at each $x$ independently (see Appendix D for more background on aleatoric noise). We can now choose the prior process as a sum $\dot { \{ f ( x ) \} } = \{ n ( x ) + \epsilon ( \bar { x ) } \sigma _ { A } ^ { 2 } \}$ of epistemic component $\{ n ( x ) \}$ and the noise term. The amount of aleatoric uncertainty can be adjusted by choosing $\sigma _ { A } ^ { 2 }$ . + +Prior Choice, Weight Copying and Conservatism One question that can be asked about our architecture (Figure 2) is whether it is possible for the predictor to exactly copy the prior weights, giving zero uncertainty everywhere. A useful edge case to consider here is when we are solving a one-dimensional regression problem, $\sigma _ { A } ^ { 2 } = 0$ and the both the priors and predictors are linear functions. In this case, after training on two points, the predictors will agree with the priors everywhere and uncertainty estimates will be zero. However, this is still consistent with our conservatism guarantee The reason for this is once we assume such a linear prior, we are comparing to a GP with a linear kernel. But a GP with that kernel will also have zero uncertainty after seeing two samples. + +In practice, this means that we have to choose the architecture of the prior networks be expressive enough, which is no different from choosing a reasonable prior for Bayesian inference. Empirically, the tested network architecture did not show weight copying. + +# 6 PRIOR WORK + +Randomized Prior Functions (RPFs) Our work was inspired by, and builds on, Randomised Prior Functions (Osband et al., 2019; 2018), but it is different in two important respects. First, the existing theoretical justification for RPFs only holds for Bayesian linear regression (Osband et al., 2018, equation 3) with non-zero noise1 added to the priors. In contrast, our results are much more general and hold for any deep network with or without added aleatoric noise. Second, we are targeting a different setting. While RPFs were designed as a way of sampling functions from the posterior, we provide estimates of posterior uncertainty at a given test point. Our algorithm is based on the work by Burda et al. (2018), who applied RPFs to exploration in MDPs, obtaining state-of-the art results, but without justifying their uncertainty estimates formally. Our paper provides this missing justification, while also introducing a way of quantifying the error in estimating the uncertainty itself. Moreover, since Burda et al. (2018) focused on the application of RPFs to Reinforcement Learning, they only performed out-of-distribution evaluation on the relatively easy MNIST dataset (LeCun, 1998). In contrast, in Section 7 we evaluate the uncertainties on more complex vision tasks. The term prior networks has also been used (Malinin & Gales, 2018) to denote deep networks that output the parameters of a prior distribution, an approach fundamentally different from our work. + +Deep Ensembles The main alternative approach for obtaining uncertainties in deep learning are deep ensembles (Lakshminarayanan et al., 2017). Building on the bootstrap (Efron & Tibshirani, 1994), deep ensembles maintain several models and quantify epistemic uncertainty by measuring how their outputs vary. Crucially, deep ensembles use representations trained on regression labels, and tend to learn similar representations for different inputs with similar labels, which can lead to over-fitting the uncertainty estimates. A useful edge case to consider is if the each of the models in the ensemble is convex in the weights. In this case, models in a deep ensemble will all converge to the same weights and produce zero uncertainty. While deep learning models used in practice aren’t normally convex, we show empirically in section 7 that deep ensembles can give overconfident uncertainty estimates in practical vision tasks, particularly on points that have the same label as points in the training set. Since our method avoids overconfidence, it can be understood as complementary to deep ensembles, to be used in situations where obtaining conservative estimates is more important than the representational benefit of using labels. In practice, deep ensembles also require using more bootstraps to achieve the same OOD performance. Moreover, they do not have theoretical support in the case when all the members of the ensemble are trained on the same data, which is how they are used in practice (Lakshminarayanan et al., 2017). + +Dropout In cases where it is not economical to train more than one network, uncertainties can be obtained with dropout (Srivastava et al., 2014; Gal & Ghahramani, 2016). Monte-Carlo dropout can be viewed (Gal & Ghahramani, 2016) as a form of approximate Bayesian inference. However, to do so requires a rather unnatural approximating family from the perspective of approximate inference. Also, one has then either to take a limit or generalize variational inference to a quasi-KL (Hron et al., 2018) divergence. In addition, dropout can be interpreted in terms of MAP inference (Nalisnick et al., 2019). Another alternative view of MC dropout is as an ensemble method in which the ensemble members have shared parameters (which means they are trained together) and where the ensembling is applied at test time too. This latter view is arguably as natural as the Bayesian interpretation. For this reason we discuss MC dropout separately from BNNs. Since dropout implicitly approximates non-Gaussian weight distribution with Gaussians, it exhibits spurious patterns in the obtained uncertainties, which can lead to arbitrarily overconfident estimates (Foong et al., 2019). In contrast, due to the conservatism property, random priors avoid such overconfidence. + +Bayesian Neural Networks (BNNs) Bayesian Neural Networks (Blundell et al., 2015; Kingma & Welling, 2014; Rezende et al., 2014; Welling & Teh, 2011; Brosse et al., 2018) explicitly model the distribution over weights of a neural network. While BNNs provide a link between deep learning and Bayesian inference, they are very slow to train. Even recent tuned implementations of BNNs (Osawa et al., 2019) are several times slower than supervised learning. This happens despite using a battery of technical optimizations, including distributed training and batch normalization. Moreover, modern convolutional BNNs still carry a significant accuracy penalty when deployed with realistic settings of prior variance.2 + +# 7 EXPERIMENTS + +Encouraged by the huge empirical success of random priors in Reinforcement Learning (Burda et al., 2018), we wanted to provide an evaluation in a more typical supervised learning setting. We tested the uncertainties in two ways. First, we investigated calibration, i.e. whether we can expect a higher accuracy for more confident estimates. Next, we checked whether the uncertainties can be used for out-of-distribution detection. We compared to two competing approaches for uncertainty detection: deep ensembles (Lakshminarayanan et al., 2017) and spatial concrete dropout (Gal et al., 2017). The same ResNet architecture served as a basis for all methods. Details of the implementation are provided in Appendix A. + +Out-Of-Distribution Detection We evaluated the uncertainty estimates on out-ofdistribution detection. To quantify the results, we evaluated the area under the ROC curve (AUROC) for the task of deciding whether a given image comes from the same distribution or not. All methods were trained on four classes from the CIFAR-10 (Krizhevsky et al., 2009) dataset (training details are provided in Appendix A). We then tested the resulting networks on images from withheld classes and on the SVHN dataset (Netzer et al., 2011), which contains completely different images. Results are shown in Table 1. Considering the statistical errors (see Appendix B), random priors performed slightly better than deep ensembles with adversarial training for $B = 1$ and about the same for $B ~ = ~ 1 0$ . For dropout, $B$ refers to the number of dropout samples. Dropout per + +Table 1: Out-of-distribution AUROC for random priors (RP), deep ensembles (DE), deep ensembles with adversarial training $( \mathrm { D E + A T } )$ and spatial concrete dropout (DR). Estimated confidence intervals are provided in Appendix B. + +
RPDEDE+ATDR
B=1
Train v. cat/deerTrain v. vehiclesTrain v. excludedTrain v. SVHN0.991.001.000.950.830.960.960.960.960.810.760.770.86
0.820.820.88
B=10
Train v.cat/deerTrain v. vehiclesTrain v. excludedTrain v. SVHN1.000.950.990.980.980.990.820.780.790.87
1.001.000.970.920.930.94
+ +formed worse, but was cheaper to train. In order to gain a more finely-grained insight into the quality of the uncertainties, we also show uncertainty histograms in Figure 3. The figure shows the distribution of uncertainty estimates for seen data (top row) vs. unseen data (bottom row) for bootstrap sizes $B = \{ 1 , 5 , 1 0 \}$ . The main conclusion is that uncertainties obtained from random priors are already well-separated with $B = 1$ , while deep ensembles need more bootstraps to achieve the full separation between test and train examples. We provide additional experimental results, showing OOD accuracy and an evaluation on CIFAR 100 in Appendix B. + +Calibration Good uncertainty estimates have the property that accuracy increases as we become more certain, a property known as calibration. We measured it by evaluating average accuracy on the subset of images with uncertainty smaller than a given value. We trained on four classes from the CIFAR-10 (Krizhevsky et al., 2009) dataset. We then tested the resulting networks on the whole dataset, which included both the seen and unseen classes. Results are shown in Figure 4. Ideally, in a calibrated method, these curves should be increasing, indicating that a method always becomes more accurate as it becomes more confident. In coarse terms, Figure 4 confirms that all methods except a degenerate deep ensemble with only one bootstrap are roughly monotonic. However, uncertainty estimates from random priors are more stable, showing monotonicity on a finer scale as well as on a large scale. Interestingly, calibration improved only slightly when increasing the number of bootstraps $B$ . + +![](images/fad25e12f616cdb903b045e4aa5d15622aa98b5dd0d235fb19dd843588397f7f.jpg) +Figure 3: Distribution of uncertainty estimates for various algorithms. Top row shows seen data, bottom row shows unseen data from CIFAR-10. For random priors (RP), uncertainties are $\hat { \sigma } ^ { 2 }$ . For other algorithms, they are $1 - \operatorname* { m a x } ( p _ { \mu } )$ , where $p _ { \mu }$ is the averaged output of models in ensemble (Lakshminarayanan et al., 2017). + +![](images/6e275b5efb24cd972dda330e863bcf93f808c773c2bf5e6179fbf23383875457.jpg) +Figure 4: Calibration curves showing the relationship between uncertainty (horizontal axis) and accuracy (vertical axis) for $B = 1 , 5 , 1 0$ on CIFAR-10. + +Subsampling Ablation In the previous experiment, we kept the architectural and optimization choices fixed across algorithms. This ensured a level playing field, but meant that we were not able to obtain zero training error on the predictor networks used by random priors. However, we also wanted to evaluate random priors in the setting of near-zero training error. To do this, we used a smaller set of training images, while still keeping the network architecture the same. This allowed us to obtain nearcomplete convergence (details in Appendix A). + +Table 2: Out-of-distribution AUROC for the same models as above (see Tab. 1) on subsampled data. Numbers are accurate up to $\pm 0 . 0 1$ . + +
RPDEDE +ATDR
B=1
Train v.excluded1.000.900.890.91
Train v. SVHN1.000.950.940.97
B=10
Train v.excluded1.000.940.900.92
Train v. SVHN1.000.970.950.97
+ +Results of this ablation are shown in Figures 5 and 6, as well as Table 2, analogous to our results on the full dataset presented above. In this sub-sampled regime, the random prior method easily outperformed competing approaches, showing better calibration (Fig. 5). The histograms in Figure 6 also demonstrate good separation between seen and unseen data. In the out-of-distribution benchmarks reported in Table 2, the random prior method has comfortably outperformed the baselines. While this training regime is not practical for real-life tasks, it demonstrates the potential performance of random priors when trained to full convergence. + +Sensitivity to Initialization Scale We performed an ablation to test the robustness of our algorithm to the scaling of the weight initialization in the prior. Results are shown in Figure 7, where we plot the relationship between initialization scale (taken from the set $\{ 0 . 0 1 , 0 . 1 , 1 . 0 , 2 . 0 , 5 . 0 , 1 0 . 0 \} )$ and AUROC performance on the CIFAR-10 task. OOD performance is relatively robust with respect to the weight initialization within one order of magnitude. + +![](images/36755507c7104ee21945c0cdf3eee0d26c11370b33c5f9f4f51c68b680004687.jpg) +Figure 5: The relationship between uncertainty (horizontal axis) and accuracy (vertical axis) for $B =$ 1, 5, 10 on a subset of 75 samples from CIFAR-10. In well-calibrated models, accuracy increases as uncertainty declines. + +![](images/b78899119a4b20ae3f133d68ba30e990c2006d3d2f30e175953bf92864a18898.jpg) +Figure 6: Distribution of uncertainty estimates for various algorithms. Top row shows seen data, bottom row shows unseen data from CIFAR-10, where we trained on a sample of 75 images from the training set. For random priors (RP), uncertainties are $\hat { \sigma } ^ { 2 }$ . For other algorithms, they are $1 -$ $\operatorname* { m a x } ( p _ { \mu } )$ , where $p _ { \mu }$ is the averaged output of models in ensemble (Lakshminarayanan et al., 2017). + +Summary of experiments We have shown that uncertainties obtained from random priors achieve competitive performance with fewer bootstraps in a regime where the network architecture is typical for standard supervised learning workloads. Random priors showed superior performance in a regime where the predictors can be trained to near-zero loss. + +# 8 CONCLUSIONS + +We provided a theoretical justification for the use of random priors for obtaining uncertainty estimates in the context of deep learning. We have shown that the obtained uncertainties are conservative and that they concentrate for any neural network architecture. We performed an extensive empirical comparison, showing that random priors perform similarly to deep ensembles in a typical supervised training setting, while outperforming them in a regime where we are able to accomplish near-zero training loss for the predictors. + +![](images/7502efd5a6409e3459946834e136cd7056579a0b4377618100afc6b5d3991105.jpg) +Figure 7: Robustness of OOD perfromance to initialization scale. Conf. bars present, but small, denoting high confidence. Horizontal axis is logarithmic. + +# REFERENCES + +Zeyuan Allen-Zhu, Yuanzhi Li, and Zhao Song. A convergence theory for deep learning via overparameterization. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 242–252, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings. mlr.press/v97/allen-zhu19a.html. + +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. + +Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint arXiv:1505.05424, 2015. + +Nicolas Brosse, Alain Durmus, and Eric Moulines. The promises and pitfalls of stochastic gradient langevin dynamics. In Advances in Neural Information Processing Systems, pp. 8268–8278, 2018. + +Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018. + +Ashwin Mark Carvalho. Predictive Control under Uncertainty for Safe Autonomous Driving: Integrating DataDriven Forecasts with Control Design. PhD thesis, UC Berkeley, 2016. + +Zezhou Cheng, Matheus Gadelha, Subhransu Maji, and Daniel Sheldon. A bayesian perspective on the deep image prior. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5443–5451, 2019. + +Amit Daniely, Roy Frostig, and Yoram Singer. Toward deeper understanding of neural networks: The power of initialization and a dual view on expressivity. In Advances In Neural Information Processing Systems, pp. 2253–2261, 2016. + +Bruno De Finetti. La prevision: ses lois logiques, ses sources subjectives. In ´ Annales de l’institut Henri Poincare´, pp. 1–68, 1937. + +Simon Du, Jason Lee, Haochuan Li, Liwei Wang, and Xiyu Zhai. Gradient descent finds global minima of deep neural networks. In International Conference on Machine Learning, pp. 1675–1685, 2019. + +John Duchi. Probability bounds, 2009. + +Bradley Efron and Robert J. Tibshirani. An Introduction to the Bootstrap. SIAM Review, 36(4):677–678, 1994. doi: 10.1137/1036171. + +Andrew YK Foong, David R Burt, Yingzhen Li, and Richard E Turner. Pathologies of factorised gaussian and mc dropout posteriors in bayesian neural networks. arXiv preprint arXiv:1909.00719, 2019. + +Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, pp. 1050–1059, 2016. URL http://proceedings.mlr. press/v48/gal16.html. + +Yarin Gal, Jiri Hron, and Alex Kendall. Concrete dropout. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA, pp. 3581–3590, 2017. + +Adri Garriga-Alonso, Carl Edward Rasmussen, and Laurence Aitchison. Deep convolutional networks as shallow gaussian processes. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $\equiv$ Bklfsi0cKm. + +Tamir Hazan and Tommi Jaakkola. Steps toward deep kernel methods from infinite neural networks. arXiv preprint arXiv:1508.05133, 2015. + +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. + +Jiri Hron, Alexander G. de G. Matthews, and Zoubin Ghahramani. Variational bayesian dropout: pitfalls and fixes. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018 ¨ , pp. 2024–2033, 2018. URL http: //proceedings.mlr.press/v80/hron18a.html. + +Edwin T Jaynes. Probability theory: The logic of science. Cambridge university press, 2003. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014. URL http://arxiv.org/abs/1312.6114. + +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. + +Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in Neural Information Processing Systems, pp. 6402–6413, 2017. + +Nicolas Le Roux and Yoshua Bengio. Continuous neural networks. In Artificial Intelligence and Statistics, pp. 404–411, 2007. + +Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998. + +Jaehoon Lee, Jascha Sohl-dickstein, Jeffrey Pennington, Roman Novak, Sam Schoenholz, and Yasaman Bahri. Deep neural networks as gaussian processes. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\equiv$ B1EA-M-0Z. + +Christian Leibig, Vaneeda Allken, Murat Sec¸kin Ayhan, Philipp Berens, and Siegfried Wahl. Leveraging uncertainty information from deep neural networks for disease detection. Scientific reports, 7(1):17816, 2017. + +Ulrike von Luxburg and Olivier Bousquet. Distance-based classification with lipschitz functions. Journal of Machine Learning Research, 5(Jun):669–695, 2004. + +Andrey Malinin and Mark Gales. Predictive uncertainty estimation via prior networks. In Advances in Neural Information Processing Systems, pp. 7047–7058, 2018. + +AGDG Matthews, M Rowland, J Hron, RE Turner, and Z Ghahramani. Gaussian process behaviour in wide deep neural networks. In Proceedings of the 6th International Conference on Learning Representations., 2018. + +Rhiannon Michelmore, Marta Kwiatkowska, and Yarin Gal. Evaluating uncertainty quantification in end-to-end autonomous driving control. arXiv preprint arXiv:1811.06817, 2018. + +Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of machine learning. MIT press, 2018. + +Kevin P Murphy. Machine learning: a probabilistic perspective. MIT press, 2012. + +Eric Nalisnick, Jose Miguel Hernandez-Lobato, and Padhraic Smyth. Dropout as a structured shrinkage prior. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 4712–4722, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/ nalisnick19a.html. + +Radford M Neal. Bayesian learning for neural networks. Phd Thesis, 1996. + +Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011. + +Roman Novak, Lechao Xiao, Yasaman Bahri, Jaehoon Lee, Greg Yang, Daniel A. Abolafia, Jeffrey Pennington, and Jascha Sohl-dickstein. Bayesian deep convolutional networks with many channels are gaussian processes. In International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id=B1g30j0qF7. + +K. Osawa, S. Swaroop, A. Jain, R. Eschenhagen, R. E. Turner, R. Yokota, and M. E. Khan. Practical deep learning with bayesian principles. In The 33rd Conference on Neural Information Processing Systems (NeurIPS 2019), Vancouver, Canada, Dec. 8-14 2019. + +Ian Osband, John Aslanides, and Albin Cassirer. Randomized prior functions for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 8617–8629, 2018. + +Ian Osband, Benjamin Van Roy, Daniel J. Russo, and Zheng Wen. Deep exploration via randomized value functions. Journal of Machine Learning Research, 20(124):1–62, 2019. URL http://jmlr.org/papers/ v20/18-339.html. + +Georg Ostrovski, Marc G Bellemare, Aaron van den Oord, and R ¨ emi Munos. Count-based exploration with ´ neural density models. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2721–2730. JMLR. org, 2017. + +F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011. + +Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Eric P. Xing and Tony Jebara (eds.), Proceedings of the 31st International Conference on Machine Learning, volume 32 of Proceedings of Machine Learning Research, pp. 1278–1286, Bejing, China, 22–24 Jun 2014. PMLR. URL http://proceedings.mlr.press/v32/ rezende14.html. + +Christian Robert. The Bayesian choice: from decision-theoretic foundations to computational implementation. Springer Science & Business Media, 2007. + +Donald B Rubin. The bayesian bootstrap. The annals of statistics, pp. 130–134, 1981. + +Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1): 1929–1958, 2014. + +Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Deep image prior. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9446–9454, 2018. + +Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 681–688, 2011. + +Christopher KI Williams. Computing with infinite networks. In Advances in neural information processing systems, pp. 295–301, 1997. + +Christopher KI Williams and Carl Edward Rasmussen. Gaussian processes for machine learning. MIT press Cambridge, MA, 2006. + +Greg Yang. Wide feedforward or recurrent neural networks of any architecture are gaussian processes. In Neural Information Processing Systems (NeurIPS), 2019. + +# APPENDICES + +APPENDIX A REPRODUCIBILITY AND DETAILS OF EXPERIMENTAL SETUP + +APPENDIX A.1 SYNTHETIC DATA + +For the 1D regression experiment on synthetic data (Fig 1), we used feed-forward neural networks with 2 layers of 128 units each and a 1-dimensional output layer. We used an ensemble size of 5. The network was trained on 20 points sampled from the negative domain of a sigmoid function and tested on 20 points sampled from the positive domain. + +APPENDIX A.2 EXPERIMENTAL SETUP + +Model architecture For the CIFAR-10 experiments, we adapted the setup from the cifar10-fast model.3 For the network predicting the mean, we used the exact same architecture as in this model. For the prior networks in our uncertainty estimators, the architecture for the prior network was the same as the mean network, but using a final linear layer instead of the softmax layer. We used squared error on that last layer to get the uncertainties. For the predictor networks in the uncertainty estimators, we added two additional layers at the end to make sure the prior functions are learnable (see Fig. 2). + +We followed Burda et al. (2018) in choosing the output size to be $M = 5 1 2$ and using the Adam optimizer (Kingma & Ba, 2014) with a learning rate of 0.0001. We optimized the initialization scale of our networks as a hyperparameter on the grid $\{ 0 . 0 1 , 0 . 1 , 1 . 0 , 2 . 0 , 1 0 . 0 \}$ and chose 2.0. We chose a scaling factor of $\beta = 1 . 0$ for the uncertainty bonus of the random priors and fixed it for all experiments. + +Data For the CIFAR-10 experiment, we trained on the classes {bird, dog, frog, horse} and excluded {cat, deer, airplane, automobile, ship, truck}. For the small CIFAR-10 ablation experiment, we trained on 75 images sampled from the classes $\{ { \mathrm { s h i p } } , { \mathrm { t r u c k } } \}$ and excluded the remaining classes. + +Training Error The training error was $0 . 5 7 \pm 0 . 2 0$ on the CIFAR experiment and $0 . 0 3 \pm 0 . 0 2$ on the sub-sampled ablation (the symbol $\pm$ denotes $90 \%$ confidence intervals). + +Out-of-distribution classification For computing the areas under the receiver-operator characteristic curves (AUROC) in the OOD classification tables, we used the roc auc score function from the Python package sklearn (Pedregosa et al., 2011), using the predicted uncertainties as predicted label scores and binary labels for whether or not the samples were from the training set. + +APPENDIX B ADDITIONAL RESULTS + +# APPENDIX B.1 CONFIDENCE INTERVALS FOR AUROCS + +We provide confidence intervals for AUROC measurements in Table 3. + +
RPDEDE +ATDR
B=1
Train v. cat/deer0.99 ± 0.0020.83± 0.0650.96± 0.0080.81 ± 0.001
Train v. vehicles1.00 ± 0.0000.82 ± 0.0700.96 ± 0.0070.76 ± 0.001
Train v. excluded1.00 ± 0.0010.82 ± 0.0690.96 ± 0.0070.77 ± 0.002
Train v. SVHN0.95 ± 0.0130.88 ± 0.1010.96 ± 0.0090.86 ± 0.002
+ +Table 3: Out-of-distribution AUROC for random priors (RP), deep ensembles (DE), deep ensembles with adversarial training $( \mathrm { D E + A T } )$ and spatial concrete dropout (DR). The errors are computed from ten samples each in the $B = 1$ case. The $\pm$ symbol denotes one standard error. + +# APPENDIX B.2 OOD CLASSIFICATION ACCURACIES + +In addition to AUROC results, we also provide accuracy figures on the same OOD tasks. The thresholding for classification was obtained by cross-validation. + +They are in Table 4 and 5. + +
RPDEDE +ATDR
B=1
Train v.cat/deer0.97 ± 0.0010.83 ±0.0080.97 ± 0.0060.82±0.000
Train v.vehicles0.99 ± 0.0010.81 ± 0.0080.96 ± 0.0040.86 ± 0.000
Train v. excluded0.98 ± 0.0010.87 ± 0.0220.97 ± 0.0070.70 ± 0.002
Train v. SVHN0.91 ± 0.0060.91 ± 0.0250.96 ± 0.0080.78 ± 0.001
B=10
Trainv.cat/deer0.980.880.960.82
Train v.vehicles0.990.870.950.86
Train v. excluded0.990.890.960.71
Train v. SVHN0.920.880.960.78
+ +Table 4: Out-of-distribution classification accuracy for random priors (RP), deep ensembles (DE), deep ensembles with adversarial training $( \mathrm { D E + A T } )$ and spatial concrete dropout (DR). These values augment the AUROC values reported in Table 1. The $\pm$ symbol denotes one standard error. + +
RPDEDE +ATDR
B=1
Train v.excluded1.000.900.880.91
Train v. SVHN1.000.950.900.97
B=10
Trainv. excluded1.000.950.890.91
Train v. SVHN1.000.970.950.96
+ +Table 5: Out-of-distribution accuracy for the same models as above (see Tab. 4) on subsampled data. +These values augment the AUROC values reported in Table 2. + +APPENDIX B.3 SUPERVISED IN-DISTRIBUTION CLASSIFICATION ACCURACIES + +
RP*DEDE +ATDR
CIFAR-100.860.880.860.86
Subsampled CIFAR-100.820.810.820.75
CIFAR-1000.900.910.900.89
+ +Table 6: In-distribution supervised classification accuracies on the respective test sets of the different data sets for random priors (RP), deep ensembles (DE), deep ensembles with adversarial training $( \mathrm { D E + A T } )$ ) and spatial concrete dropout (DR). + +\*Since random priors do not have an intrinsic supervised prediction model, we used the predictions from the $\mathrm { D E + A T }$ model in all our experiments instead, setting $B = 1$ . + +# APPENDIX B.4 CIFAR100 EXPERIMENT + +As additional empirical support for our method, we ran experiments on another data set, namely CIFAR-100 (Krizhevsky et al., 2009). Again, we include 5 classes in the training set and exclude the remaining classes. The results are reported in the following (Figs. 8, 9; Tabs. 7, 8). They qualitatively and quantitatively support the same conclusions as our previous experiments. + +# APPENDIX C BACKGROUND ON BAYES RISK + +For completeness, we recall the definition of Bayes Risk. We are often interested in minimizing the Mean Squared Error $\mathrm { E } _ { f } \left[ ( f ( x _ { \star } ) - w ) ^ { 2 } \right]$ , where $x _ { \star }$ is a given test point and $w$ is a variable we are + +![](images/c368b9af024b99dab3e4ca6ca18c058ecdf9d5c899c55953ec0519c0d7e41e5b.jpg) +Figure 8: Distribution of uncertainty estimates for various algorithms. Top row shows seen data, bottom row shows unseen data from CIFAR-100. For random priors (RP), uncertainties are $\hat { \sigma } ^ { 2 }$ . For other algorithms, they are $1 - \operatorname* { m a x } ( p _ { \mu } )$ , where $p _ { \mu }$ is the averaged output of models in ensemble (Lakshminarayanan et al., 2017). + +![](images/e81b6f8a02d771b5175479d16b1924a64d693205158a44da357e1b0f377fd85a.jpg) +Figure 9: The relationship between uncertainty (horizontal axis) and accuracy (vertical axis) for $B =$ 1, 5, 10 on samples from CIFAR-100. In well-calibrated models, accuracy increases as uncertainty declines. + +allowed to adjust. A known result of Bayesian decision theory (Robert, 2007; Murphy, 2012) is that the minimizer of the MSE is given by the expected value of $f$ , i.e. + +$$ +\underset { w } { \arg \operatorname* { m i n } } \mathrm { E } _ { f } \left[ ( f ( x _ { \star } ) - w ) ^ { 2 } \right] = \mathrm { E } _ { f } \left[ f ( x _ { \star } ) \right] . +$$ + +Equation 12 holds for any stochastic process $f$ , including when $f$ is a posterior process obtained by conditioning on some dataset. A consequence of equation 12 is that it is impossible to obtain a MSE lower than the one obtained by computing the posterior mean of $f$ . + +# APPENDIX D GAUSSIAN PROCESSES + +A stochastic process is Gaussian (Williams & Rasmussen, 2006), if all its finite-dimensional distributions are Gaussian. The main advantage of GPs is that the posterior process can be expressed in a tractable way. GPs are often used for regression, where we are learning an unknown function4 $\phi : \mathbb { R } ^ { K } \mathbb { R }$ from noisy observations. Since a Gaussian distribution is completely identified by its first two moments, a GP can be defined by a mean function and a covariance function. Formally, the notation $\mathcal { G P } ( \mu , k )$ refers to a GP with with mean function $\mu : \mathbb { R } ^ { K } \mathbb { R }$ , a positive-definite kernel function $\boldsymbol { k } : \dot { \mathbb { R } ^ { K } } \times \mathbb { R } ^ { K } \mathbb { R }$ . GPs can be used to model two kinds of uncertainty: epistemic uncertainty, which reflects lack of knowledge about unobserved values of $\phi$ and aleatoric uncertainty, which reflects measurement noise. When performing regression, we start with a zero-mean prior $\mathcal { G P } ( 0 , k )$ and then observe $N$ training points $X = \{ x _ { i } \} _ { i = 1 , \dots , N }$ and labels $y = \{ y _ { i } \} _ { i = 1 , \dots , N }$ where $y _ { i } = \phi ( x _ { i } ) + \epsilon _ { i }$ . Here, the i.i.d. random variables $\epsilon _ { i } \sim \mathcal { N } ( 0 , \sigma _ { A } ^ { 2 } )$ model the aleatoric noise. We obtain the posterior process on $\mathcal { G P } ( \mu _ { X y } , k _ { X } )$ . For GPs, the mean and covariance of the posterior GP on $y$ evaluated at $x _ { \star }$ can be expressed as + +
RPDEDE+ATDR
B=1
Train v. excludedTrain v. SVHN1.00± 0.0001.00 ± 0.0000.93± 0.0030.96 ± 0.0040.98 ± 0.0010.99 ± 0.0010.88±0.0020.82 ±0.002
B=10
Trainv.excludedTrain v. SVHN1.001.000.960.990.991.000.900.82
+ +Table 7: Out-of-distribution classification AUROCs on CIFAR-100 for random priors (RP), deep ensembles (DE), deep ensembles with adversarial training $( \mathrm { D E + A T } )$ and spatial concrete dropout (DR). The $\pm$ symbol denotes one standard error. +Table 8: Out-of-distribution classification accuracy on CIFAR-100 for random priors (RP), deep ensembles (DE), deep ensembles with adversarial training $( \mathrm { D E + A T } )$ and spatial concrete dropout (DR). The $\pm$ symbol denotes one standard error. These values augment the AUROC values reported in Table 7. + +
RPDEDE +ATDR
B=1
Train v.excluded Train v. SVHN1.00 ± 0.001 0.97 ± 0.0030.91 ±0.002 0.95 ± 0.0030.97 ± 0.001 0.99 ± 0.0010.82±0.003 0.74 ± 0.003
B=10
Trainv.excluded1.000.940.980.83
Train v. SVHN0.980.980.990.74
+ +$$ +\begin{array} { r } { \mu _ { X y } ( x _ { \star } ) = k _ { \star } ^ { \top } ( K + \sigma _ { A } ^ { 2 } I ) ^ { - 1 } y \quad \mathrm { a n d } \qquad } \\ { \sigma _ { X } ^ { 2 } ( x _ { \star } ) \triangleq k _ { X } ( x _ { \star } , x _ { \star } ) + \sigma _ { A } ^ { 2 } = k _ { \star \star } - k _ { \star } ^ { \top } ( K + \sigma _ { A } ^ { 2 } I ) ^ { - 1 } k _ { \star } + \sigma _ { A } ^ { 2 } . } \end{array} +$$ + +In particular, the posterior covariance does not depend on $y$ . In the formula above, we use the kernel matrix $K \in \mathbb { R } ^ { N } \times \mathbb { R } ^ { N }$ defined as $K _ { i j } = k ( x _ { i } , x _ { j } )$ , where $x _ { i }$ and $x _ { j }$ are in the training set. We also use the notation $\boldsymbol { k } _ { \star } \in \mathbb { R } ^ { N }$ for the vector of train-test correlations $\{ k _ { \star } \} _ { i } = k ( x _ { i } , x ^ { \star } )$ , where $x _ { i }$ is in the training set and $k ( x ^ { \star } , x ^ { \star } )$ is similarly defined. The shorthand $\sigma _ { X } ^ { 2 } ( x _ { \star } )$ introduced in equation 14 denotes the posterior variance at a single point. + +# APPENDIX E LIST OF SYMBOLS DENOTING VARIANCE + +Below, we give a list of symbols used for variance of various random variables. + +
0 .2 O X 8posterior variance of stochastic process posterior variance of Gaussian process prior variance of stochastic process sample-based estimate of prior GP variance combined uncertainty estimate (see equation 1) sample-based mean part of uncertainty estimate (see equation 2) Ef[o2]
+ +# APPENDIX F PROOFS + +We now give formal proofs for the results in the paper. + +# APPENDIX F.1 PROOFS RELATING TO CONSERVATISM + +Lemma 1. For any function $h : \mathbb { R } ^ { N \times ( K + 1 ) } \mathbb { R } ^ { M }$ , for any test point $\boldsymbol { x } _ { \star } ~ \in ~ \mathbb { R } ^ { K }$ and for any stochastic process $\{ f ( x ) \} _ { x \in \mathbb { R } ^ { K } }$ with all second moments finite and exchangeable outputs + +$$ +\begin{array} { r } { \tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) = \mathrm { E } _ { f ( X ) } \left[ \sigma _ { X f } ^ { 2 } ( x _ { \star } ) + \frac { 1 } { M } \| \mu _ { X f } ( x _ { \star } ) - h _ { X f } ( x _ { \star } ) \| ^ { 2 } \right] . } \end{array} +$$ + +Proof. We prove the statement by re-writing the expression on the left. + +$$ +\begin{array} { r l r } { \bar { \sigma } _ { \mu } ^ { 2 } ( { \boldsymbol x } _ { \star } ) = \frac { 1 } { M } { \mathrm { ~ E } } _ { f } ( { \boldsymbol x } ) , f ( | | f ( { \boldsymbol x } _ { \star } ) - h _ { X } f ( { \boldsymbol x } _ { \star } ) | | ^ { 2 } ] } & { \mathrm { ( I 5 ) } } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array} +$$ + +Here, the equality in (16) holds by definition of conditional probability. The equality in (19) holds by definition of posterior mean and the equality 21 follows by assumption that the process has exchangeable outputs. While this argument follows a similar pattern to a standard result about Bayesian Risk (see Appendix Appendix C), it is not identical because the function $h _ { X f }$ depends on $f$ . □ + +Proposition 1 (Strict Conservatism in Expectation). Assume that $f$ is a GP. Then for any function $h : \bar { \mathbb { R } } ^ { N \times K } \to \bar { \mathbb { R } } ^ { M }$ , we have + +$$ +\tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) = \sigma _ { X } ^ { 2 } ( x _ { \star } ) + \underbrace { { \mathrm E } _ { f ( X ) } \left[ \frac { 1 } { M } \| \mu _ { X f } ( x _ { \star } ) - h _ { X f } ( x _ { \star } ) \| ^ { 2 } \right] } _ { \geq 0 } . +$$ + +Moreover, equality holds if and only if $h _ { X f } ( x _ { \star } ) = \mu _ { X f } ( x _ { \star } )$ . + +Proof. We instantiate Lemma 1 by setting $f$ to be a GP. By equation 14, the posterior covariance of a GP does not depend on the target values, i.e. $\sigma _ { X f } ^ { 2 } ( x _ { \star } ) \dot { } = \dot { \sigma } _ { X } ^ { 2 } ( x _ { \star } )$ . The first part of the result can be shown by pulling $\sigma _ { X } ^ { 2 } ( x _ { \star } )$ out of the expectation. Moreover, since $\| \cdot \|$ is a norm and hence positive semi-definite, equality holds if and only if $h _ { X f } ( x _ { \star } ) = \mu _ { X f } ( x _ { \star } )$ . □ + +Lemma 3. Assume that the random variable $\hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } )$ has finite variance upper bounded by vUB. +With probability $1 - \delta$ , we have $\begin{array} { r } { \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) + \frac { 1 } { \sqrt { \delta } } v _ { U B } \ge \tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) } \end{array}$ . + +Proof. The proof is standard, but we state it in our notation for completeness. Applying Chebyshev’s inequality to the random variable $\hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } )$ , we have that $\begin{array} { r } { \mathrm { P r o b } \left( | \tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) - \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) | \ge \frac { 1 } { \sqrt { \delta } } v _ { \mathrm { U B } } \right) \le \delta , } \end{array}$ , implying the statement. □ + +Corollary 1 (Strict Conservatism for Finite Bootstraps). Assume that $f$ is a GP. Assume that the random variable $\hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } )$ has finite variance upper bounded by vUB. Then with probability $1 - \delta$ , for any function $h : \mathbb { R } ^ { \dot { N } \times K } \to \mathbb { R } ^ { M }$ , we have + +$$ +\begin{array} { r } { \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) + \frac { 1 } { \sqrt { \delta } } v _ { U B } \geq \tilde { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \geq \sigma _ { X } ^ { 2 } ( x _ { \star } ) . } \end{array} +$$ + +Proof. Combine Lemma 3 and Proposition 1. + +Lemma 2. Assume that the GP $\{ f ( x ) \}$ is zero mean with exchangeable outputs and the function $h _ { X f }$ takes values in $[ - U , U ] ^ { M }$ . Assume that permuting the outputs of $f$ produces the same permutation in the outputs of $h _ { X f }$ . With probability $1 - \delta$ , we have + +$$ +\operatorname { V a r } _ { f _ { 1 } , \dots , f _ { B } } \left[ \widehat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) \right] \leq v _ { U B } , +$$ + +where vUB is expressible in terms of observable quantities. + +Proof. We seek to decompose the variance of $\hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } )$ into the part that comes from the prior and the part that comes from the fitted function $h _ { X f ^ { m } }$ . + +$$ +\begin{array} { r l } & { \operatorname { V a r } _ { f _ { 1 } , \ldots , f _ { D } } \big [ \widehat { \mathcal { O } } _ { \sharp } ^ { \sharp } ( x , x ) \big ] } \\ & { = \operatorname { V a r } _ { f _ { 1 } , \ldots , f _ { D } } \bigg [ \sum _ { i = 1 } ^ { B } \frac { 1 } { M L ^ { D } } \big \lVert f ( x , x ) - h _ { X , f _ { i } } ( x , x ) \big \rVert ^ { 2 } \bigg ] } \\ & { = \frac { 1 } { R } \operatorname { V o r } _ { f } \Big [ \frac { 1 } { M } \big \lVert f ( x , x ) - h _ { X , f _ { i } } ( x , x ) \big \rVert ^ { 2 } \Big ] } \\ & { = \frac { 1 } { B } \frac { 1 } { M } \operatorname { V a r } _ { f } \Big [ \big ( \sum _ { m = 1 } ^ { M } \big ( f ^ { m } ( x , x ) - h _ { X , f ^ { m } } ( x , x ) \big ) ^ { 2 } \Big ] } \\ & { = \frac { 1 } { B } \frac { 1 } { M ^ { 2 } } \sum _ { m = 1 } ^ { M } \sum _ { i = 1 } ^ { M } \operatorname { C o r } _ { f } \big [ \big ( f ^ { m } ( x , x ) - h _ { X , f ^ { m } } ( x , x ) \big ) ^ { 2 } , ( f ^ { t } ( x , x ) - h _ { X , f ^ { i } } ( x , x ) \big ) ^ { 2 } \big ] } \\ & { \leq \frac { 1 } { B } \frac { 1 } { M ^ { 2 } } M ^ { 2 } \operatorname { V a r } _ { f } \big [ \big ( f ^ { m } ( x , x ) - h _ { X , f ^ { m } } ( x , x ) \big ) ^ { 2 } \big ] } \\ & { = \frac { 1 } { B } \operatorname { V a r } _ { f } \big [ \big ( f ^ { m } ( x , x ) - h _ { X , f ^ { m } } ( x , x ) \big ) ^ { 2 } \big ] } \\ & { \leq \frac { 1 } { B } \operatorname { E a r } _ { f } \big [ \big ( f ^ { m } ( x , x ) - h _ { X , f ^ { m } } ( x , x ) \big ) ^ { 2 } \big ] } \\ & { = \frac { 1 } { B } \operatorname { V a r } _ { f } \big [ \big ( f ^ { m } ( x , x ) - h _ { X , f ^ { m } } ( x , x ) \big ) ^ { 3 } \big ] } \\ & = \frac { 1 } { B } \operatorname { V a r } _ { f } \big [ \big ( f ^ { m } ( x , x ) - h _ X , f \end{array} +$$ + +Here, line 27 holds by exchangeability of outputs and the Cauchy-Schwarz inequality. + +Since $h _ { X f ^ { m } } ( x _ { \star } )$ is has support in $[ - U , U ]$ , we have + +$$ +\begin{array} { r } { \mathrm { E } _ { f } \left[ \left( h _ { X f ^ { m } } ( x _ { \star } ) ) ^ { 2 } ) \right] \leq U ^ { 2 } , \mathrm { E } _ { f } \left[ \left( h _ { X f ^ { m } } ( x _ { \star } ) \right) ^ { 4 } ) \right] \leq U ^ { 4 } , \mathrm { E } _ { f } \left[ \left( h _ { X f ^ { m } } ( x _ { \star } ) \right) ^ { 6 } \right) \right] \leq U ^ { 6 } . } \end{array} +$$ + +Moreover, since $f ( x _ { \star } )$ is Gaussian and zero mean, we can write out the moments explicitly. + +$$ +\begin{array} { r } { \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 4 } ) \right] = 3 ( \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 2 } ) \right] ) ^ { 2 } } \\ { \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 6 } ) \right] = 1 5 ( \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 2 } ) \right] ) ^ { 3 } } \end{array} +$$ + +Since $f ( x _ { \star } )$ is Gaussian, we can use a sample-based estimate of the prior variance and obtain an probabilistic confidence interval. In particular, we know that $\begin{array} { r } { \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 2 } ) \right] \leq \hat { \sigma } _ { 0 } ^ { 2 } ( x _ { \star } ) \frac { B _ { 0 } - 1 } { \chi _ { I } ^ { 2 } ( \delta ) } } \end{array}$ with probability $1 - \delta$ , where $\chi _ { I } ^ { 2 }$ denotes the inverse CDF of the Chi-Squared distribution with $B _ { 0 } - 1$ degrees of freedom. We denote this upper bound with $\begin{array} { r } { w _ { \mathrm { U B } } = \hat { \sigma } _ { 0 } ^ { 2 } ( x _ { \star } ) \frac { B _ { 0 } - 1 } { \chi _ { I } ^ { 2 } ( \delta ) } } \end{array}$ . + +We proceed by bounding the individual terms in equation 30 separately. + +$$ +\begin{array} { r l } & { \quad \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 4 } \right] = 3 ( \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 2 } \right] ) ^ { 2 } } \\ & { - \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 3 } h _ { X f ^ { m } } ( x _ { \star } ) \right] \leq \sqrt { \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 6 } \right] \mathrm { E } _ { f } \left[ ( h _ { X f ^ { m } } ( x _ { \star } ) ) ^ { 2 } \right] } } \\ & { \quad \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 2 } ( h _ { X f ^ { m } } ( x _ { \star } ) ) ^ { 2 } \right] \leq \sqrt { \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 4 } \right] \mathrm { E } _ { f } \left[ ( h _ { X f ^ { m } } ( x _ { \star } ) ) ^ { 4 } \right] } } \\ & { - \mathrm { E } _ { f } \left[ f ^ { m } ( x _ { \star } ) ( h _ { X f ^ { m } } ( x _ { \star } ) ) ^ { 3 } \right] \leq \sqrt { \mathrm { E } _ { f } \left[ ( f ^ { m } ( x _ { \star } ) ) ^ { 2 } \right] \mathrm { E } _ { f } \left[ ( h _ { X f ^ { m } } ( x _ { \star } ) ) ^ { 6 } \right] } } \end{array} +$$ + +Combining the above, equation 30 and the bounds on individual moments in equations 31 and 32, we obtain + +$$ +\begin{array} { r } { \operatorname { V a r } _ { f _ { 1 } , \ldots , f _ { B } } \left[ \widehat \sigma _ { \mu } ^ { 2 } ( x _ { \star } ) \right] \leq \underbrace { \frac { 1 } { B } \left( 3 w _ { \mathrm { U B } } ^ { 2 } + 4 \sqrt { 1 5 w _ { \mathrm { U B } } ^ { 3 } U ^ { 2 } } + 6 \sqrt { 3 w _ { \mathrm { U B } } ^ { 2 } U ^ { 4 } } + 4 \sqrt { w _ { \mathrm { U B } } U ^ { 6 } } + U ^ { 4 } \right) } _ { v _ { \mathrm { U B } } } . } \end{array} +$$ + +Here, $\begin{array} { r } { w _ { \mathrm { U B } } = \hat { \sigma } _ { 0 } ^ { 2 } ( x _ { \star } ) \frac { B _ { 0 } - 1 } { \chi _ { I } ^ { 2 } ( \delta ) } } \end{array}$ , $\hat { \sigma } _ { 0 } ^ { 2 } ( x _ { \star } )$ is a sample-based estimate of the prior variance obtained with $B _ { 0 }$ samples, where $\chi _ { I } ^ { 2 }$ denotes the inverse CDF of the Chi-Squared distribution with $B _ { 0 } - 1$ degrees of freedom. + +# APPENDIX F.2 PROOFS RELATING TO CONCENTRATION + +We now proceed to the proofs showing concentration. We begin by formally defining a class of predictor networks. + +Definition 1 (Class $\mathcal { H } _ { U }$ of Lipschitz networks). Consider functions $h ~ : ~ \mathbb { R } ^ { K } ~ \to ~ \mathbb { R } ^ { M }$ . Let $j , j ^ { \prime } \ = \ 1 , \ldots , M$ , index the outputs of the function. We define $\mathcal { H } _ { U }$ so that each $\textit { h } \in \ \mathcal { H } _ { U }$ has the following properties for each ${ j , j ^ { \prime } }$ . $\mathbf { ( P 1 }$ ) $h _ { j }$ is Lipschitz continuous with constant $L ,$ i.e. $\| h _ { j } ( x ) - h _ { j } ( x ^ { \prime } ) \| _ { 2 } \leq L \| x - x ^ { * } \| _ { 2 }$ for all $x , x ^ { \prime }$ with $\| x \| _ { \infty } \leq 1$ and $\| x ^ { \prime } \| _ { \infty } \leq 1$ , $( \mathbf { P } 2 )$ outputs are exchangeable, i.e. $\{ h _ { j } : h \in \mathcal { H } _ { U } \} = \{ h _ { j ^ { \prime } } : h \in \mathcal { H } _ { U } \}$ , (P3) the class is symmetric around zero, i.e. $h _ { j } \ \in \ \{ h _ { j } \ : \ \bar { h } \ \in \ \mathcal { H } _ { U } \}$ implies $- \bar { h } _ { j } \in \lbrace h _ { j } : h \in \rbrace { \mathcal { H } } _ { U } \rbrace$ . (P4) $h _ { j }$ is bounded, i.e. $\operatorname* { m a x } _ { \| x \| _ { \infty } \leq 1 } | h _ { j } ( x ) | \leq U$ . + +While the conditions in Definition 1 look complicated, they are in fact easy to check for predictor networks that follow the architecture in Figure 2. In particular, Lipschitz continuity $( \mathbf { P 1 } )$ has to hold in practice because its absence would indicate extreme sensitivity to input perturbations. Output exchangeability $( \mathbf { P } 2 )$ holds since reordering the outputs does not change our architecture. Symmetry around zero $( { \bf P } { \bf 3 } )$ holds by flipping the sign in the last network layer. Boundedness $\mathbf { ( P 4 ) }$ is easy to ensure by clipping outputs. In the following Lemma, we obtain a bound on the expected uncertainty. + +Lemma 4. Consider a target function $f : \mathbb { R } ^ { K } \to \mathbb { R } ^ { M }$ , where $j = 1 , \dots , M$ , with the domain restricted to $\| x \| _ { \infty } \leq 1$ . Introduce a constant $U$ such that $\operatorname* { m a x } _ { \| x \| \infty \leq 1 } | f _ { j } ( x ) | \leq U$ . Denote the data distribution with support on $\{ x : \| x \| _ { \infty } \leq 1 \}$ as $\mathcal { D }$ . Moreover, assume $K \geq 3 .$ . For $h _ { X f } \in \mathcal { H } _ { U }$ , with probability $1 - \delta$ we have + +$$ +\begin{array} { r } { \mathrm { E } _ { x _ { \star } \sim { D } } [ \frac { 1 } { M } \| f ( x _ { \star } ) - h _ { X f } ( x _ { \star } ) \| ^ { 2 } ] \le \frac { 1 } { M N } \sum _ { i = 1 } ^ { N } \| f ( x _ { i } ) - h _ { X f } ( x _ { i } ) \| ^ { 2 } + L U { \cal O } \Big ( \frac { 1 } { \sqrt [ { k _ { \sqrt { N } } } ] { \frac { \log ( 1 / \delta ) } { N } } } \Big ) . } \end{array} +$$ + +Proof. The proof uses standard Rademacher tools. To avoid confusion across several conventions, we explicitly define the Rademacher complexity of a function class $\mathcal { G }$ as: + +$$ +\begin{array} { r } { \hat { \mathfrak { R } } _ { N } ( \mathcal { G } ) \triangleq \mathrm { E } _ { u _ { i } } \left[ \operatorname* { s u p } _ { g \in \mathcal { G } } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } u _ { i } g ( x _ { i } ) \right] = \mathrm { E } _ { u _ { i } } \left[ \operatorname* { s u p } _ { g \in \mathcal { G } } \frac { 1 } { N } \left| \sum _ { i = 1 } ^ { N } u _ { i } ^ { j } g ( x _ { i } ) \right| \right] . } \end{array} +$$ + +Here, the random variables $u _ { i }$ are sampled i.i.d. using a discrete distribution with $\mathrm { P r o b } ( u _ { i } ~ =$ $- 1 ) \ = \ \mathrm { P r o b } ( u _ { i } \ = \ 1 ) \ = \ { \textstyle { \frac { 1 } { 2 } } }$ and the the second equality follows by using property (P3). We start by applying the generic Rademacher bound (Mohri et al., 2018) to the function class $\mathcal { M } =$ $\begin{array} { r } { \{ x _ { 1 } , \ldots , \overset { \left. \right.} { x _ { N } } , t _ { 1 } \ldots , t _ { N } \frac { 1 } { U ^ { 2 } } \frac { 1 } { M } \| t _ { i } - h ( x _ { i } ) \| ^ { 2 } , h \in \mathcal { H } _ { U } \} . } \end{array}$ , which contains the possible errors of the predictor. + +$$ +\begin{array} { r l } & { \mathrm { E } _ { x _ { \star } \sim \mathcal { D } } [ \frac { 1 } { B ^ { 2 } } \frac { 1 } { M } \| f ( x _ { \star } ) - h _ { X f } ( x _ { \star } ) \| ^ { 2 } ] } \\ & { \phantom { \frac { 1 } { \theta } } \leq \frac { 1 } { M N } \frac { 1 } { B ^ { 2 } } \sum _ { i = 1 } ^ { N } \| f ( x _ { i } ) - h _ { X f } ( x _ { i } ) \| ^ { 2 } + \widehat { \mathfrak { R } } _ { N } ( \mathcal { M } ) + O \left( \sqrt { \frac { \log ( 1 / \delta ) } { N } } \right) . } \end{array} +$$ + +We now introduce the function class $\begin{array} { r } { \mathcal { M } ^ { \prime } = \{ x _ { 1 } , \ldots , x _ { N } , t _ { 1 } \ldots , t _ { N } \frac { 1 } { B ^ { 2 } } ( t _ { i } ^ { j } - h ^ { j } ( x _ { i } ) ) ^ { 2 } , h \in \mathcal { H } _ { U } \} } \end{array}$ which models the per-output squared error. Because of property (P2), ${ \bar { \mathcal { M } } } ^ { \prime }$ does not depend on the output index $j$ . By pulling out the sum outside the supremum in equation 35, we get + +$$ +\hat { \Re } _ { N } ( \mathcal { M } ) \leq \hat { \Re } _ { N } ( \mathcal { M } ^ { \prime } ) . +$$ + +by Talagrand’s Lemma (Mohri et al., 2018; Duchi, 2009), we also have + +$$ +\hat { \mathfrak { R } } _ { N } ( \mathcal { M } ^ { \prime } ) \leq 4 \hat { \mathfrak { R } } _ { N } ( \mathcal { H } _ { 1 } ) . +$$ + +Here, $\mathcal { H } _ { 1 } \ = \ \{ \frac { 1 } { \pi } h ^ { j } \ : \ h \in \ \mathcal { H } _ { U } \}$ . By property $( \mathbf { P 1 } )$ , functions in $\mathcal { H } _ { 1 }$ are Lipschitz continuous with constant $L / U$ . Instantiating a known bound for Lipschitz-continuous functions (Luxburg $\&$ Bousquet, 2004, Theorem 18 and Example 4), and using the assumption $K \geq 3$ , we get $\hat { \mathfrak { R } } _ { N } ( \varkappa _ { 1 } ) \leq$ $\begin{array} { r } { \frac { L } { U } O \left( \frac { 1 } { \sqrt [ K ] { N } } \right) } \end{array}$ . The Lemma follows by combining this with equation 37 and equation 38, plugging into equation 36 and re-scaling by $U ^ { 2 }$ . □ + +Lemma 4 allowed us to relate the error on the training set to the expected error on the test set. It also shows that the two will be closer for small values of the Lipschitz constant $L$ . We now use this Lemma to show our main concentration result (Proposition 2). + +Proposition 2. If the training converges, i.e. the training loss $\begin{array} { r } { \frac { 1 } { M N } \sum _ { i = 1 } ^ { N } \| f ( x _ { i } ) - h _ { X f } ( x _ { i } ) \| ^ { 2 } = \sigma _ { A } ^ { 2 } } \end{array}$ for arbitrarily large training sets, then assuming the predictors $h _ { X f }$ are bounded and Lipschitz continuous with constant $L ,$ , then under technical conditions the uncertainties concentrate, i.e. $\hat { \sigma } ^ { 2 } ( x _ { \star } ) 0$ as $N \to \infty$ and $B \infty$ with probability $^ { l }$ . + +Proof. We are assuming the technical conditions of Lemma 4. Instantiating Lemma 4, setting the training loss to $\sigma _ { A } ^ { 2 }$ in the RHS of equation 34 and letting $N \infty$ , we obtain the following with probability 1: + +$$ +\operatorname * { l i m } _ { N \infty } \mathrm { E } _ { x _ { \star } \sim \mathcal { D } } [ \widehat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) ] = \sigma _ { A } ^ { 2 } . +$$ + +This implies: + +$$ +\operatorname* { l i m } _ { N \infty } \mathrm { E } _ { x _ { \star } \sim \mathcal { D } } [ \operatorname* { m a x } ( 0 , \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) - \sigma _ { A } ^ { 2 } ) ] = 0 . +$$ + +From the continuity of $f$ and $h _ { X f }$ we have that $\hat { \sigma } _ { \mu } ^ { 2 }$ is continuous in $x _ { \star }$ . Together with the property that the expression under the expectation is non-negative, this gives that for every $x _ { \star }$ . + +$$ +\operatorname * { l i m } _ { N \infty } \operatorname * { m a x } ( 0 , \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) - \sigma _ { A } ^ { 2 } ) = 0 . +$$ + +Since the right-hand side does not depend on $B$ , we also have + +$$ +\operatorname * { l i m } _ { B \to \infty } \operatorname * { l i m } _ { N \to \infty } \operatorname * { m a x } ( 0 , \hat { \sigma } _ { \mu } ^ { 2 } ( x _ { \star } ) - \sigma _ { A } ^ { 2 } ) = 0 . +$$ + +From the definition of $\hat { v } _ { \sigma }$ , we have that + +$$ +\operatorname * { l i m } _ { B \infty } \operatorname * { l i m } _ { N \infty } \hat { v } _ { \sigma } = 0 . +$$ + +We show the Lemma by combining equation 42 and equation 43 with equation 1. \ No newline at end of file diff --git a/md/train/BJuysoFeg/BJuysoFeg.md b/md/train/BJuysoFeg/BJuysoFeg.md new file mode 100644 index 0000000000000000000000000000000000000000..1ae27bf5a6ce313596e421349abb00894f204c94 --- /dev/null +++ b/md/train/BJuysoFeg/BJuysoFeg.md @@ -0,0 +1,240 @@ +# REVISITING BATCH NORMALIZATION FORPRACTICAL DOMAIN ADAPTATION + +Yanghao $\mathbf { L i } ^ { \dagger }$ , Naiyan Wang‡, Jianping $\mathbf { S h i } ^ { \circ }$ , Jiaying $\mathbf { L } \mathbf { i } \mathbf { u } ^ { \dagger }$ , Xiaodi Hou‡ + +† Institute of Computer Science and Technology, Peking University +‡ TuSimple  SenseTime +lyttonhao@pku.edu.cn winsty@gmail.com shijianping5000@gmail.com +liujiaying@pku.edu.cn xiaodi.hou@gmail.com + +# ABSTRACT + +Deep neural networks (DNN) have shown unprecedented success in various computer vision applications such as image classification and object detection. However, it is still a common annoyance during the training phase, that one has to prepare at least thousands of labeled images to fine-tune a network to a specific domain. Recent study (Tommasi et al., 2015) shows that a DNN has strong dependency towards the training dataset, and the learned features cannot be easily transferred to a different but relevant task without fine-tuning. In this paper, we propose a simple yet powerful remedy, called Adaptive Batch Normalization (AdaBN) to increase the generalization ability of a DNN. By modulating the statistics from the source domain to the target domain in all Batch Normalization layers across the network, our approach achieves deep adaptation effect for domain adaptation tasks. In contrary to other deep learning domain adaptation methods, our method does not require additional components, and is parameter-free. It archives stateof-the-art performance despite its surprising simplicity. Furthermore, we demonstrate that our method is complementary with other existing methods. Combining AdaBN with existing domain adaptation treatments may further improve model performance. + +# 1 INTRODUCTION + +Training a DNN for a new image recognition task is expensive. It requires a large amount of labeled training images that are not easy to obtain. One common practice is to use labeled data from other related source such as a different public dataset, or harvesting images by keywords from a search engine. Because 1) the distributions of the source domains (third party datasets or Internet images) are often different from the target domain (testing images); and 2) DNN is particularly good at capturing dataset bias in its internal representation (Torralba & Efros, 2011), which eventually leads to overfitting, imperfectly paired training and testing sets usually leads to inferior performance. + +Known as domain adaptation, the effort to bridge the gap between training and testing data distributions has been discussed several times under the context of deep learning (Tzeng et al., 2014; Long et al., 2015; Tzeng et al., 2015; Ganin & Lempitsky, 2015). To make the connection between the domain of training and the domain of testing, most of these methods require additional optimization steps and extra parameters. Such additional computational burden could greatly complicate the training of a DNN which is already intimidating enough for most people. + +In this paper, we propose a simple yet effective approach called AdaBN for batch normalized DNN domain adaptation. We hypothesize that the label related knowledge is stored in the weight matrix of each layer, whereas domain related knowledge is represented by the statistics of the Batch Normalization (BN) (Ioffe & Szegedy, 2015) layer. Therefore, we can easily transfer the trained model to a new domain by modulating the statistics in the BN layer. This approach is straightforward to implement, has zero parameter to tune, and requires minimal computational resources. Moreover, our AdaBN is ready to be extended to more sophisticated scenarios such as multi-source domain adaptation and semi-supervised settings. Fig. 1 illustrates the flowchart of AdaBN. To summarize, our contributions are as follows: + +![](images/fb3bd16dd2ead98b3b1710a9d87b797a6dd41fd7ffe45f68b0b0df6a8ca63bb9.jpg) +Figure 1: Illustration of the proposed method. For each convolutional or fully connected layer, we use different bias/variance terms to perform batch normalization for the training domain and the test domain. The domain specific normalization mitigates the domain shift issue. + +1. We propose a novel domain adaptation technique called Adaptive Batch Normalization (AdaBN). We show that AdaBN can naturally dissociate bias and variance of a dataset, which is ideal for domain adaptation tasks. +2. We validate the effectiveness of our approach on standard benchmarks for both single source and multi-source domain adaptation. Our method outperforms the state-of-the-art methods. +3. We conduct experiments on the cloud detection for remote sensing images to further demonstrate the effectiveness of our approach in practical use. + +# 2 RELATED WORK + +Domain transfer in visual recognition tasks has gained increasing attention in recent literature (Beijbom, 2012; Patel et al., 2015). Often referred to as covariate shift (Shimodaira, 2000) or dataset bias (Torralba & Efros, 2011), this problem poses a great challenge to the generalization ability of a learned model. One key component of domain transfer is to model the difference between source and target distributions. In Khosla et al. (2012), the authors assign each dataset with an explicit bias vector, and train one discriminative model to handle multiple classification problems with different bias terms. A more explicit way to compute dataset difference is based on Maximum Mean Discrepancy (MMD) (Gretton et al., 2012). This approach projects each data sample into a Reproducing Kernel Hilbert Space, and then computes the difference of sample means. To reduce dataset discrepancies, many methods are proposed, including sample selections (Huang et al., 2006; Gong et al., 2013), explicit projection learning (Pan et al., 2011; Gopalan et al., 2011; Baktashmotlagh et al., 2013) and principal axes alignment (Fernando et al., 2013; Gong et al., 2012; Aljundi et al., 2015). + +All of these methods face the same challenge of constructing the domain transfer function – a highdimensional non-linear function. Due to computational constraints, most of the proposed transfer functions are in the category of simple shallow projections, which are typically composed of kernel transformations and linear mapping functions. + +In the field of deep learning, feature transferability across different domains is a tantalizing yet generally unsolved topic (Yosinski et al., 2014; Tommasi et al., 2015). To transfer the learned representations to a new dataset, pre-training plus fine-tuning (Donahue et al., 2014) have become de facto procedures. However, adaptation by fine-tuning is far from perfect. It requires a considerable amount of labeled data from the target domain, and non-negligible computational resources to retrain the whole network. + +A series of progress has been made in DNN to facilitate domain transfer. Early works of domain adaptation either focus on reordering fine-tuning samples (Chopra et al., 2013), or regularizing MMD (Gretton et al., 2012) in a shallow network (Ghifary et al., 2014). It is only until recently that the problem is directly attacked under the setting of classification of unlabeled target domain using modern convolutional neural network (CNN) architecture. DDC (Tzeng et al., 2014) used the classical MMD loss to regularize the representation in the last layer of CNN. DAN (Long et al., 2015) further extended the method to multiple kernel MMD and multiple layer adaptation. Besides adapting features using MMD, RTN (Long et al., 2016) also added a gated residual layer for classifier adaptation. RevGrad (Ganin & Lempitsky, 2015) devised a gradient reversal layer to compensate the back-propagated gradients that are domain specific. Recently, by explicitly modeling both private and shared components of the domain representations in the network, Bousmalis et al. (2016) proposed a Domain Separation Network to extract better domain-invariant features. + +Another related work is CORAL (Sun et al., 2016). This model focuses on the last layer of CNN. CORAL whitens the data in source domain, and then re-correlates the source domain features to target domain. This operation aligns the second order statistics of source domain and target domain distributions. Surprisingly, such simple approach yields state-of-the-arts results in various text classification and visual recognition tasks. Recently, Deep CORAL (Sun & Saenko, 2016) also extends the method into DNN by incorporating a CORAL loss. + +# 2.1 BATCH NORMALIZATION + +In this section, we briefly review Batch Normalization (BN) (Ioffe & Szegedy, 2015) which is closely related to our AdaBN. The BN layer is originally designed to alleviate the issue of internal covariate shifting – a common problem while training a very deep neural network. It first standardizes each feature in a mini-batch, and then learns a common slope and bias for each mini-batch. Formally, given the input to a BN layer $\mathbf { X } \in \mathbb { R } ^ { n \times p }$ , where $n$ denotes the batch size, and $p$ is the feature dimension, BN layer transforms a feature $j \in \{ 1 \ldots p \}$ into: + +$$ +\begin{array} { r l } & { \hat { x } _ { j } = \frac { x _ { j } - \mathbb { E } \left[ \mathbf { X } _ { \cdot j } \right] } { \sqrt { \operatorname { V a r } [ \mathbf { X } _ { \cdot j } ] } } , } \\ & { y _ { j } = \gamma _ { j } \hat { x } _ { j } + \beta _ { j } , } \end{array} +$$ + +where $x _ { j }$ and $y _ { j }$ are the input/output scalars of one neuron response in one data sample; $\mathbf { X } _ { \cdot j }$ denotes the $j ^ { t h }$ column of the input data; and $\gamma _ { j }$ and $\beta _ { j }$ are parameters to be learned. This transformation guarantees that the input distribution of each layer remains unchanged across different mini-batches. For Stochastic Gradient Descent (SGD) optimization, a stable input distribution could greatly facilitate model convergence, leading to much faster training speed for CNN. Moreover, if training data are shuffled at each epoch, the same training sample will be applied with different transformations, or in other words, more comprehensively augmented throughout the training. During the testing phase, the global statistics of all training samples is used to normalize every mini-batch of test data. + +Extensive experiments have shown that Batch Normalization significantly reduces the number of iteration to converge, and improves the final performance at the same time. BN layer has become a standard component in recent top-performing CNN architectures, such as deep residual network (He et al., 2016), and Inception V3 (Szegedy et al., 2015). + +# 3 THE MODEL + +In Sec. 3.1, we first analyze the domain shift in deep neural network, and reveal two key observations. Then in Sec. 3.2, we introduce our Adaptive Batch Normalization (AdaBN) method based on these observations. + +# 3.1 A PILOT EXPERIMENT + +The Batch Normalization (BN) technique is originally proposed to help SGD optimization by aligning the distribution of training data. From this perspective, it is interesting to examine the BN parameters (batch-wise mean and variance) over different dataset at different layers of the network. + +In this pilot experiment, we use MXNet implementation (Chen et al., 2016b) of the Inception-BN model (Ioffe & Szegedy, 2015) pre-trained on ImageNet classification task (Russakovsky et al., 2015) as our baseline DNN model. Our image data are drawn from (Bergamo & Torresani, 2010), which contains the same classes of images from both Caltech-256 dataset (Griffin et al., 2007) and Bing image search results. For each mini-batch sampled from one dataset, we concatenate the mean and variance of all neurons from one layer to form a feature vector. Using linear SVM, we can almost perfectly classify whether the mini-batch feature vector is from Caltech-256 or Bing dataset. Fig. 2 visualizes the distributions of mini-batch feature vectors from two datasets in 2D. It is clear that BN statistics from different domains are separated into clusters. + +![](images/8b54780b4e6ce548bc8d94465b49fff9fe6bc3aabb422481c6a6d0103c5b24d7.jpg) +(a) Shallow layer distributions + +![](images/e8e71c21882fe636329b7efe3cc59f5ab6d48265cdca17c5b9fcc74c721044ce.jpg) +(b) Deep layer distributions +Figure 2: t-SNE (Van der Maaten & Hinton, 2008) visualization of the mini-batch BN feature vector distributions in both shallow and deep layers, across different datasets. Each point represents the BN statistics in one mini-batch. Red dots come from Bing domain, while the blue ones are from Caltech-256 domain. The size of each mini-batch is 64. + +This pilot experiment suggests: + +1. Both shallow layers and deep layers of the DNN are influenced by domain shift. Domain adaptation by manipulating the output layer alone is not enough. +2. The statistics of BN layer contain the traits of the data domain. + +Both observations motivate us to adapt the representation across different domains by BN layer. + +# 3.2 ADAPTIVE BATCH NORMALIZATION + +Given the pre-trained DNN model and a target domain, our Adaptive Batch Normalization algorithm is as follows1: + +
Algorithm1 Adaptive Batch Normalization (AdaBN)
for neuron jinDNN do Concatenate neuron responses on all images of tar-
get domain t: xj =[...,xj(m),...] Compute the mean and variance of the target do-
main: μ =E(x),=√Var(x).
end for
for neuron j in DNN, testing image m in target domain do
(aj(m)-μ) Compute BN output yj(m) := γj +βj
g end for
+ +The intuition behind our method is straightforward: The standardization of each layer by domain ensures that each layer receives data from a similar distribution, no matter it comes from the source domain or the target domain. Although modulating statistics in one BN layer by AdaBN is a simple translation and scaling operation, such linear transformation in one layer can achieve a highly nonlinear transformation through the whole deep CNN architecture. Thus, we believe this AdaBN process could approximate the intrinsically non-linear domain transfer function. + +For $K$ domain adaptation where $K > 2$ , we standardize each sample by the statistics in its own domain. During training, the statistics are calculated for every mini-batch, the only thing that we need to make sure is that the samples in every mini-batch are from the same domain. For (semi)supervised domain adaptation, we may use the labeled data to fine-tune the weights as well. As a result, our method could fit in all different settings of domain adaptation with minimal effort. + +Compared with CORAL (Sun et al., 2016), one natural question is why we transform the neuron responses independently, not decorrelate and then re-correlate the responses together as suggested in Sun et al. (2016). Under certain conditions, decorrelation could improve the performance. However, in CNN, the mini-batch size is usually smaller than the feature dimension, leading to singular covariance matrices that is hard to be inversed. As a result, the covariance matrix is always singular. In addition, decorrelation requires to compute the inverse of the covariance matrix which is computationally intensive, especially if we plan to apply AdaBN to all layers of the network. + +# 4 EXPERIMENTS + +In this section, we demonstrate the effectiveness of AdaBN on standard domain adaptation datasets, and empirically analyze our AdaBN model. We also evaluation our method on a practical application with remote sensing images. + +# 4.1 EXPERIMENTAL SETTINGS + +We first introduce our experiments on two standard datasets: Office (Saenko et al., 2010) and Caltech-Bing (Bergamo & Torresani, 2010). + +Office (Saenko et al., 2010) is a standard benchmark for domain adaptation, which is a collection of 4652 images in 31 classes from three different domains: Amazon $\mathbf { \Pi } ^ { ( \mathbf { A } ) }$ , $D S R L ( \mathbf { D } )$ and Webcam(W). Similar to (Tzeng et al., 2014; Sun et al., 2016; Long et al., 2015), we evaluate the pairwise domain adaption performance of AdaBN on all six pairs of domains. For the multi-source setting, we evaluate our method on three transfer tasks $\{ \mathbf { A } , \bar { \mathbf { W } } \} \to \mathbf { D }$ , $\{ \mathbf { A } , \mathbf { D } \} \to \mathbf { W }$ , $\{ \mathbf { D } , \mathbf { W } \} \mathbf { A }$ . + +Caltech-Bing (Bergamo & Torresani, 2010) is a much larger domain adaptation dataset, which contains 30,607 and 121,730 images in 256 categories from two domains Caltech-256(C) and Bing(B). The images in the Bing set are collected from Bing image search engine by keyword search. Apparently Bing data contains noise, and its data distribution is dramatically different from that of Caltech-256. + +We compare our approach with a variety of methods, including four shallow methods: SA (Fernando et al., 2013), LSSA (Aljundi et al., 2015), GFK (Gong et al., 2012), CORAL (Sun et al., 2016), and four deep methods: DDC (Tzeng et al., 2014), DAN (Long et al., 2015), RevGrad (Ganin & Lempitsky, 2015), Deep CORAL (Sun & Saenko, 2016). Specifically, GFK models domain shift by integrating an infinite number of subspaces that characterize changes in statistical properties from the source to the target domain. SA, LSSA and CORAL align the source and target subspaces by explicit feature space transformations that would map source distribution into the target one. DDC and DAN are deep learning based methods which maximize domain invariance by adding to AlexNet one or several adaptation layers using MMD. RevGrad incorporates a gradient reversal layer in the deep model to encourage learning domain-invariant features. Deep CORAL extends CORAL to perform end-to-end adaptation in DNN. It should be noted that these deep learning methods have the adaptation layers on top of the output layers of DNNs, which is a sharp contrast to our method that delves into early convolution layers as well with the help of BN layers. + +We follow the full protocol (Donahue et al., 2014) for the single source setting; while for multiple sources setting, we use all the samples in the source domains as training data, and use all the samples in the target domain as testing data. We fine-tune the Inception-BN (Ioffe & Szegedy, 2015) model on source domain in each task for 100 epochs. The learning rate is set to 0.01 initially, and then is dropped by a factor 0.1 every 40 epochs. Since the office dataset is quite small, following the best practice in Long et al. (2015), we freeze the first three groups of Inception modules, and set the learning rate of fourth and fifth group one tenth of the base learning rate to avoid overfitting. For Caltech-Bing dataset, we fine-tune the whole model with the same base learning rate. + +Table 1: Single source domain adaptation results on Office-31 (Saenko et al., 2010) dataset with standard unsupervised adaptation protocol. + +
Method A→W D→W W→D A→D D→A W→A Avg
AlexNet (Krizhevsky et al.,2012)61.695.499.063.851.149.8 70.1
DDC (Tzeng et al., 2014)61.895.098.564.4 52.152.270.6
DAN (Long et al., 2015)68.596.099.067.0 54.053.172.9
Deep CORAL (Sun & Saenko, 2016)66.495.799.266.852.8 51.572.1
RevGrad (Ganin & Lempitsky,2015)73.096.499.21 111
Inception BN (Ioffe & Szegedy, 2015)70.394.310070.560.1 57.975.5
SA (Fernando et al., 2013)69.895.599.071.359.4 56.975.3
GFK (Gong et al., 2012)66.797.099.470.158.0 56.974.7
LSSA (Aljundi et al., 2015)67.796.198.471.357.8 57.874.9
CORAL (Sun et al., 2016)70.995.799.871.959.0 60.276.3
AdaBN74.295.799.873.159.8 57.476.7
AdaBN + CORAL75.496.299.672.759.0 60.577.2
+ +# 4.2 RESULTS + +# 4.2.1 OFFICE DATASET + +Our results on Office dataset is reported in Table 1 and Table 2 for single/multi source(s), respectively. Note that the first 5 models of the Table 1 are pre-trained on AlexNet (Krizhevsky et al., 2012) instead of the Inception-BN (Ioffe & Szegedy, 2015) model, due to the lack of publicly available pre-trained Inception BN model in Caffe (Jia et al., 2014). Thus, the relative improvements over the baseline (AlexNet/Inception BN) make more sense than the absolute numbers of each algorithm. + +From Table 1, we first notice that the Inception-BN indeed improves over the AlexNet on average, which means that the CNN pre-trained on ImageNet has learned general features, the improvements on ImageNet can be transferred to new tasks. Among the methods based on Inception-BN features, our method improves the most over the baseline. Moreover, since our method is complementary to other methods, we can simply apply CORAL on the top of AdaBN. Not surprisingly, this simple combination exhibits $0 . 5 \%$ increase in performance. This preliminary test reveals further potential of AdaBN if combined with other advanced domain adaptation methods. Finally, we could improve $1 . 7 \%$ over the baseline, and advance the state-of-the-art results for this dataset. + +None of the compared methods has reported their performance on multi-source domain adaptation. To demonstrate the capacity of AdaBN under multi-domain settings, we compare it against CORAL, which is the best performing algorithm in the single source setting. The result is reported in Table 2. We find that simply combining two domains does not lead to better performance. The result is generally worse compared to the best performing single domain between the two. This phenomenon suggests that if we cannot properly cope with domain bias, the increase of training samples may be reversely affect to the testing performance. This result confirms the necessity of domain adaptation. In this more challenging setting, AdaBN still outperforms the baseline and CORAL on average. Again, when combined with CORAL, our method demonstrates further improvements. At last, our method archives $2 . 3 \%$ gain over the baseline. + +
MethodA,D→WA,W→D D,W→AAvg
Inception BN (Ioffe & Szegedy,2015)90.895.460.282.1
CORAL (Sun et al., 2016)92.196.461.483.3
AdaBN94.297.259.383.6
AdaBN + CORAL95.097.860.584.4
+ +Table 2: Multi-source domain adaptation results on Office-31 (Saenko et al., 2010) dataset with standard unsupervised adaptation protocol. + +# 4.2.2 CALTECH-BING DATASET + +To further evaluate our method on the large-scale dataset, we show our results on Caltech-Bing Dataset in Table 3. Compared with CORAL, AdaBN achieves better performance, which improves $1 . 8 \%$ over the baseline. Note that all the domain adaptation methods show minor improvements over the baseline in the task $\mathbf { C } \mathbf { B }$ . One of the hypotheses to this relatively small improvement is that the images in Bing dataset are collected from Internet, which are more diverse and noisier (Bergamo & Torresani, 2010). Thus, it is not easy to adapt on the Bing dataset from the relatively clean dataset Caltech-256. Combining CORAL with our method does not offer further improvements. This might be explained by the noise of the Bing dataset and the imbalance of the number of images in the two domains. + +Table 3: Single source domain adaptation results on Caltech-Bing (Bergamo & Torresani, 2010) dataset. + +
MethodC→B B→C Avg
Inception BN (Ioffe& Szegedy,2015)35.164.649.9
CORAL (Sun et al., 2016)35.367.2 51.3
AdaBN35.268.151.7
AdaBN + CORAL35.067.551.2
+ +# 4.3 EMPIRICAL ANALYSIS + +In this section, we investigate the influence of the number of samples in target domain to the performance and empirically analyze the adaptation effect of different BN layers. + +# 4.3.1 SENSITIVITY TO TARGET DOMAIN SIZE. + +Since the key of our method is to calculate the mean and variance of the target domain on different BN layers, it is very natural to ask how many target images is necessary to obtain stable statistics. In this experiment, we randomly select a subset of images in target domain to calculate the statistics and then evaluate the performance on the whole target set. Fig. 3 illustrates the effect of using different number of batches. The results demonstrate that our method can obtain good results when using only a small part of the target examples. It should also be noted that in the extremal case of one batch of target images, our method still achieves better results than the baseline. This is valuable in practical use since a large number of target images are often not available. + +![](images/496f3f9cc7373771a6785c1983a9a46a95324b04f4a9fb6a0c2342e83b75e6af.jpg) +Figure 3: Accuracy when varying the number of mini-batches used for calculating the statistics of BN layers in $\mathbf A \to \mathbf W$ and $\mathbf { B } \mathbf { C }$ , respectively. For $\mathbf B \to \mathbf C$ , we only show the results of using less than 100 batches, since the results are very stable when adding more examples. The batch size is 64 in this experiment. For even smaller number of examples, the performance may be not consistent and drop behind the baseline (e.g. 0.652 with 16 samples, 0.661 with 32 samples). + +![](images/ae6f16be07fe0af154144a608f7cb13eb98945cd3405d52036b5bc9286acf302.jpg) +Figure 4: Accuracy when adapting with different BN blocks in $\mathbf B \to \mathbf C$ . $x = 0$ corresponds to the result with non-adapt method, and 1, 2, 3a, $_ { 3 b }$ , 4a, $4 b$ , 4c, 5a, $5 b$ correspond to the nine different blocks in Inception-BN network.. + +# 4.3.2 ADAPTATION EFFECT FOR DIFFERENT BN LAYERS. + +In this experiment, we analyze the effect of adapting on different BN layers with our AdaBN method. According to the structure of Inception-BN network Ioffe & Szegedy (2015), we categorize the BN layers into 9 blocks: 1, 2, 3a, 3b, 4a, 4b, 4c, 5a, 5b. Since the back BN layers are influenced by the outputs of previous BN layers, when adapting a specific block we adapted all the blocks before it. Fig. 4 illustrates the adaptation effect for different BN layers. It shows that adapting BN layers consistently improves the results over the baseline method in most cases. Specifically, when incorporating more BN layers in the adaptation, we could achiever better transfer results. + +# 4.4 PRACTICAL APPLICATION FOR CLOUD DETECTION IN REMOTE SENSING IMAGES + +In this section, we further demonstrate the effectiveness of AdaBN on a practical problem: Cloud Detection in Remote Sensing Images. Since remote sensing images are taken by different satellites with different sensors and resolutions, the captured images are visually different in texture, color, and value range distributions, as shown in Fig. 5. How to adapt a model trained on one satellite to another satellite images is naturally a domain adaptation problem. + +Our task here is to identify cloud from the remote sensing images, which can be regarded as a semantic segmentation task. The experiment is taken under a self-collected dataset, which includes three image sets, from GF2, GF1 and Tianhui satellites. Each image set contains 635, 324 and 113 images with resolution over $6 0 0 0 { \times } 6 0 0 0$ pixels respectively. We name the three different datasets following the satellite names. GF2 dataset is used as the training dataset while GF1 and Tianhui datasets are for testing. We use a state-of-art semantic segmentation method (Chen et al., 2016a) as our baseline model. + +
MethodGF1Tianhui
Baseline38.95%14.54%
AdaBN64.50%29.66%
+ +Table 4: Domain adaptation results (mIOU) on GF1 and Tianhui datasets training on GF2 datasets. + +The results on GF1 and Tianhui datasets are shown in Table 4. The relatively low results of the baseline method indicate that there exists large distribution disparity among images from different satellites. Thus, the significant improvement after applying AdaBN reveals the effectiveness of our method. Some of the visual results are shown in Fig. 6. Since other domain adaptation methods require either additional optimization steps and extra components (e.g. MMD) or post-processing distribution alignment (like CORAL), it is very hard to apply these methods from image classification to this large-size $( 6 0 0 0 \times 6 0 0 0 )$ segmentation problem. Comparatively, besides the effective performance, our method needs no extra parameters and very few computations over the whole adaptation process. + +![](images/f297e25a4dfe06baa9619e485ecd47aef546efbc1802ef59bdb62cce63c4fb42.jpg) +Figure 5: Remote sensing images in different domains. + +![](images/f0e93f1f24071fb5ac37bd0c96690996da8f1c1d75523e251fd7caed483d04b1.jpg) +Figure 6: Visual cloud detection results on GF1 dataset. White pixels in (b) and (c) represent the detected cloud regions. + +# 5 CONCLUSION AND FUTURE WORKS + +In this paper, we have introduced a simple yet effective approach for domain adaptation on batch normalized neural networks. Besides its original uses, we have exploited another functionality of Batch Normalization (BN) layer: domain adaptation. The main idea is to replace the statistics of each BN layer in source domain with those in target domain. The proposed method is easy to implement and parameter-free, and it takes almost no effort to extend to multiple source domains and semi-supervised settings. Our method established new state-of-the-art results on both single and multiple source(s) domain adaptation settings on standard benchmarks. At last, the experiments on cloud detection for large-size remote sensing images further demonstrate the effectiveness of our method in practical use. We believe our method opens up a new direction for domain adaptation. + +In contrary to other methods that use Maximum Mean Discrepancy (MMD) or domain confusion loss to update the weights in CNN for domain adaptation, our method only modifies the statistics of BN layer. Therefore, our method is fully complementary to other existing deep learning based methods. It is interesting to see how these different methods can be unified under one framework. + +# REFERENCES + +Rahaf Aljundi, Remi Emonet, Damien Muselet, and Marc Sebban. Landmarks-based kernelized ´ subspace alignment for unsupervised domain adaptation. In CVPR, 2015. +Mahsa Baktashmotlagh, Mehrtash Harandi, Brian Lovell, and Mathieu Salzmann. Unsupervised domain adaptation by domain invariant projection. In ICCV, pp. 769–776, 2013. +Oscar Beijbom. Domain adaptations for computer vision applications. arXiv preprint arXiv:1211.4860, 2012. +Alessandro Bergamo and Lorenzo Torresani. Exploiting weakly-labeled web images to improve object classification: a domain adaptation approach. In NIPS, pp. 181–189, 2010. +Konstantinos Bousmalis, George Trigeorgis, Nathan Silberman, Dilip Krishnan, and Dumitru Erhan. Domain separation networks. NIPS, 2016. +Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. arXiv preprint arXiv:1606.00915, 2016a. +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. NIPS Workshop on Machine Learning Systems, 2016b. +Sumit Chopra, Suhrid Balakrishnan, and Raghuraman Gopalan. DLID: Deep learning for domain adaptation by interpolating between domains. In ICML Workshop on Challenges in Representation Learning, volume 2, 2013. +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 ICML, pp. 647–655, 2014. +E Knuth Donald. The art of computer programming. Sorting and searching, 3:426–458, 1999. +Basura Fernando, Amaury Habrard, Marc Sebban, and Tinne Tuytelaars. Unsupervised visual domain adaptation using subspace alignment. In ICCV, pp. 2960–2967, 2013. +Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In ICML, pp. 1180–1189, 2015. +Muhammad Ghifary, W Bastiaan Kleijn, and Mengjie Zhang. Domain adaptive neural networks for object recognition. In PRICAI: Trends in Artificial Intelligence, pp. 898–904. 2014. +Boqing Gong, Yuan Shi, Fei Sha, and Kristen Grauman. Geodesic flow kernel for unsupervised domain adaptation. In CVPR, pp. 2066–2073, 2012. + +Boqing Gong, Kristen Grauman, and Fei Sha. Connecting the dots with landmarks: Discriminatively learning domain-invariant features for unsupervised domain adaptation. In ICML, pp. 222–230, 2013. + +Raghuraman Gopalan, Ruonan Li, and Rama Chellappa. Domain adaptation for object recognition: An unsupervised approach. In ICCV, pp. 999–1006, 2011. + +Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Scholkopf, and Alexander Smola. ¨ A kernel two-sample test. The Journal of Machine Learning Research, 13(1):723–773, 2012. + +Gregory Griffin, Alex Holub, and Pietro Perona. Caltech-256 object category dataset. 2007. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2016. + +Jiayuan Huang, Arthur Gretton, Karsten M Borgwardt, Bernhard Scholkopf, and Alex J Smola. ¨ Correcting sample selection bias by unlabeled data. In NIPS, pp. 601–608, 2006. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pp. 448–456, 2015. + +Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe: Convolutional architecture for fast feature embedding. In ACM MM, pp. 675–678, 2014. + +Aditya Khosla, Tinghui Zhou, Tomasz Malisiewicz, Alexei A Efros, and Antonio Torralba. Undoing the damage of dataset bias. In ECCV, pp. 158–171. 2012. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1097–1105, 2012. + +Mingsheng Long, Yue Cao, Jianmin Wang, and Michael Jordan. Learning transferable features with deep adaptation networks. In ICML, pp. 97–105, 2015. + +Mingsheng Long, Jianmin Wang, and Michael I Jordan. Unsupervised domain adaptation with residual transfer networks. In NIPS, 2016. + +Sinno Jialin Pan, Ivor W Tsang, James T Kwok, and Qiang Yang. Domain adaptation via transfer component analysis. IEEE Transactions on Neural Networks, 22(2):199–210, 2011. + +Vishal M Patel, Raghuraman Gopalan, Ruonan Li, and Rama Chellappa. Visual domain adaptation: A survey of recent advances. IEEE Signal Processing Magazine, 32(3):53–69, 2015. + +Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. ImageNet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015. + +Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In ECCV, pp. 213–226. 2010. + +Hidetoshi Shimodaira. Improving predictive inference under covariate shift by weighting the loglikelihood function. Journal of statistical planning and inference, 90(2):227–244, 2000. + +Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. arXiv preprint arXiv:1607.01719, 2016. + +Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. AAAI, 2016. + +Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. arXiv preprint arXiv:1512.00567, 2015. + +Tatiana Tommasi, Novi Patricia, Barbara Caputo, and Tinne Tuytelaars. A deeper look at dataset bias. German Conference on Pattern Recognition, 2015. + +Antonio Torralba and Alexei A Efros. Unbiased look at dataset bias. In CVPR, pp. 1521–1528, 2011. + +Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014. + +Eric Tzeng, Judy Hoffman, Trevor Darrell, and Kate Saenko. Simultaneous deep transfer across domains and tasks. In ICCV, pp. 4068–4076, 2015. + +Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(2579-2605):85, 2008. + +Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In NIPS, pp. 3320–3328, 2014. \ No newline at end of file diff --git a/md/train/BJxH22EKPS/BJxH22EKPS.md b/md/train/BJxH22EKPS/BJxH22EKPS.md new file mode 100644 index 0000000000000000000000000000000000000000..d7deba2d9be535b2d1f4b06120a3daea846900f9 --- /dev/null +++ b/md/train/BJxH22EKPS/BJxH22EKPS.md @@ -0,0 +1,390 @@ +# UNDERSTANDING ARCHITECTURES LEARNT BY CELL-BASED NEURAL ARCHITECTURE SEARCH + +Yao Shu, Wei Wang & Shaofeng Cai + +School of Computing +National University of Singapore +{shuyao,wangwei,shaofeng}@comp.nus.edu.sg + +# ABSTRACT + +Neural architecture search (NAS) searches architectures automatically for given tasks, e.g., image classification and language modeling. Improving the search efficiency and effectiveness has attracted increasing attention in recent years. However, few efforts have been devoted to understanding the generated architectures. In this paper, we first reveal that existing NAS algorithms (e.g., DARTS, ENAS) tend to favor architectures with wide and shallow cell structures. These favorable architectures consistently achieve fast convergence and are consequently selected by NAS algorithms. Our empirical and theoretical study further confirms that their fast convergence derives from their smooth loss landscape and accurate gradient information. Nonetheless, these architectures may not necessarily lead to better generalization performance compared with other candidate architectures in the same search space, and therefore further improvement is possible by revising existing NAS algorithms. + +# 1 INTRODUCTION + +Various neural network architectures (Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; He et al., 2016; Huang et al., 2017) have been devised over the past decades, achieving superhuman performance for a wide range of tasks. Designing these neural networks typically takes substantial efforts from domain experts by trial and error. Recently, there is a growing interest in neural architecture search (NAS), which automatically searches for high-performance architectures for the given task. The searched NAS architectures (Zoph et al., 2018; Real et al., 2019; Pham et al., 2018; Liu et al., 2019; Xie et al., 2019b; Luo et al., 2018; Cai et al., 2019; Akimoto et al., 2019; Nayman et al., 2019) have outperformed best expert-designed architectures on many computer vision and natural language processing tasks. + +Mainstream NAS algorithms typically search for the connection topology and transforming operation accompanying each connection from a predefined search space. Tremendous efforts have been exerted to develop efficient and effective NAS algorithms (Liu et al., 2019; Xie et al., 2019b; Luo et al., 2018; Akimoto et al., 2019; Nayman et al., 2019). However, less attention has been paid to these searched architectures for further insight. To our best knowledge, there is no related work in the literature examining whether these NAS architectures share any pattern, and how the pattern may impact the architecture search if there exists the pattern. These questions are fundamental to understand and improve existing NAS algorithms. In this paper, we endeavour to address these questions by examining the popular NAS architectures1. + +The recent work (Xie et al., 2019a) shows that the architectures with random connection topologies can achieve competitive performance on various tasks compared with expert-designed architectures. Inspired by this result, we examine the connection topologies of the architectures generated by popular NAS algorithms. In particular, we find a connection pattern of the popular NAS architectures. These architectures tend to favor wide and shallow cells, where the majority of intermediate nodes are directly connected to the input nodes. + +To appreciate this particular connection pattern, we first visualize the training process of the popular NAS architectures and their randomly connected variants. Fast and stable convergence is observed for the architectures with wide and shallow cells. We further empirically and theoretically show that the architectures with wider and shallower cells consistently enjoy a smoother loss landscape and smaller gradient variance than their random variants, which helps explain their better convergence and consequently the selection of these NAS architectures during the architecture search. + +We finally evaluate the generalization performance of the popular NAS architectures and their randomly connected variants. We find that the architectures with wide and shallow cells may not generalize better than other candidate architectures despite their faster convergence. We therefore believe that rethinking NAS from the perspective of the true generalization performance rather than the convergence of candidate architectures should potentially help generate better architectures. + +# 2 RELATED WORKS + +Neural Architecture Search Neural architecture search (NAS) searches for best-performing architectures automatically for a given task. It has received increasing attention in recent years due to its outstanding performance and the demand for automated machine learning (AutoML). There are three major components in NAS as summarized by Elsken et al. (2019), namely search space, search policy (or strategy, algorithm), and performance evaluation (or estimation). To define the search space, the prior knowledge extracted from expert-designed architectures is typically exploited. As for the search policy, different algorithms are proposed to improve the effectiveness (Zoph et al., 2018; Real et al., 2019; Tan et al., 2019; Cai et al., 2019) and the efficiency (Pham et al., 2018; Liu et al., 2019; Xie et al., 2019b; Luo et al., 2018; Nayman et al., 2019; Akimoto et al., 2019) of the architecture search. However, no effort has been devoted to understanding the best architectures generated by various NAS approaches. Detailed analysis of these architectures may give insights about the further improvement of existing NAS algorithms. + +Evaluation of NAS algorithms Recent works evaluate NAS algorithms by comparing them with random search. Li & Talwalkar (2019) and Sciuto et al. (2019) compare the generalization performance of architectures generated from random search and existing NAS algorithms. Interestingly, the random search can find architectures with comparable or even better generalization performance. Particularly, Sciuto et al. (2019) show empirically that the ineffectiveness of some NAS algorithms (Pham et al., 2018) could be the consequence of the weight sharing mechanism during the architecture search. While these evaluations help understand the general disadvantages of NAS algorithms, what kind of architectures the NAS algorithms are learning and why they learn these specific architectures are still not well understood. + +# 3 THE CONNECTION PATTERN OF POPULAR NAS CELLS + +Mainstream NAS algorithms (Zoph et al., 2018; Real et al., 2019; Pham et al., 2018; Liu et al., 2019; Xie et al., 2019b; Luo et al., 2018) typically search for the cell structure, including the connection topology and the corresponding operation (transformation) coupling each connection. The generated cell is then replicated to construct the entire neural network. We therefore mainly investigate these cell-based NAS architectures. In this section, we first introduce the commonly adopted cell representation, which is useful to understand the connection and computation in a cell space. We then sketch the connection topologies of popular cell-based NAS architectures to investigate their connection patterns. By comparison, we show that there is a common connection pattern among the cells learned by different NAS algorithms; particularly, these cells tend to be wide and shallow. + +# 3.1 CELL REPRESENTATION + +Following DARTS (Liu et al., 2019), we represent the cell topology as a directed acyclic graph (DAG) consisting of $N$ nodes, including $M$ input nodes, one output node and $( N - M - 1 )$ intermediate nodes. Each node forms a latent representation of the input instance. The input nodes consist of the outputs from $M$ preceding cells. And the output node aggregates (e.g., concatenate) the representations from all intermediate nodes. Each intermediate node is connected to $M$ proceeding nodes in the same cell. Each connection transforms the representation from one node via an operation from a predefined operation set, e.g., $3 \times 3$ convolution, $3 \times 3$ max pooling, etc. The target of NAS algorithm is to search for the best $M$ source nodes for each intermediate node and the best operation for each of the connections between nodes. In the literature, the searched cell is then replicated by $L$ times to build the entire neural network architecture2. + +![](images/34d71c834fcfb8840a6e01da4e102841579f1b781529f141661a58f7af780b9c.jpg) +Figure 1: Cell topologies of popular NAS architectures. Each sub-figure has three sets of nodes from left to right, i.e., the input nodes, intermediate nodes, and output node. The arrows (i.e., operations of the cell) represent the direction of information flow. The caption of each sub-figure reports the name of the architecture, width and depth of a cell following our definition. The width of a cell is computed with the assumption that all intermediate nodes share the same width $c$ . + +![](images/d9d135a75eadf88017dd1bc6a918c60302e5f2d074f53f8da16413b1615c3d40.jpg) +Figure 2: Topologies of DARTS (Liu et al., 2019) cell (leftmost) and its variants with random connections. The cell depth is increasing and width decreasing from left to right. In particular, the original DARTS cell $C ^ { d \bar { a } r t s }$ is widest and shallowest among these cells. + +We abuse the notation $C$ to denote a cell and also the architecture built with the specific cell in the following sections. Besides, we shall use $C ^ { A }$ to denote the best architecture (or cell) searched with the NAS algorithm $A$ (e.g., DARTS (Liu et al., 2019), ENAS (Pham et al., 2018)). Details on how to build the architecture with given cells are provided in Appendix A.3. + +# 3.2 THE COMMON CONNECTION PATTERN + +Recently, Xie et al. (2019a) shows that neural networks constructed by cells with random connection patterns can achieve compelling performance on multiple tasks. Taking this a step further, we wonder whether cells generated from popular NAS algorithms share any connection patterns, which may explain why these cells are chosen during the architecture search. To investigate the connection patterns, we sketch the topologies of the popular NAS cells with detailed operations omitted. + +Figure 1 illustrates topologies of 5 popular NAS cells3. To examine the connection pattern formally, we introduce the concept of ‘depth’ and ‘width’ for a cell. The depth of a cell is defined as the number of connections along the longest path from input nodes to the output node. The width of a cell is defined as the total width of the intermediate nodes that are connected to the input nodes. In particular, if some intermediate nodes are only partially connected to input nodes (i.e., have connections to other intermediate nodes), their width is reduced by the percentage of the number of connections to intermediate nodes over all connections. The width of a node is the number of channels for convolution operations; and the width is the dimension of the features for linear operations. Supposing that the width of each intermediate node is $c$ , as shown in Figure 1, the width and depth of the DARTS (Liu et al., 2019) cell are $3 . 5 c$ and 3 respectively, and the width and depth of the AmoebaNet (Real et al., 2019) cell are $_ { 4 c }$ and 4 correspondingly. + +Following the above definitions, the smallest depth and largest width for a cell with $N = 7$ and $M = 2$ are 2 and $_ { 4 c }$ respectively. Similarly, for a cell with $N = 8$ and $M = 2$ , the smallest depth and largest width are 2 and $5 c$ respectively. In Figure 1, we can observe that cells from popular NAS architectures tend to be the widest and shallowest ones (with width close to $4 c / 5 c$ and depth close to 2) among all candidate cells in the same search space. Regarding this as the common connection pattern, we have the following observation: + +Observation 3.1 (The Common Connection Pattern) NAS architectures generated by popular NAS algorithms tend to have the widest and shallowest cells among all candidate cells in the same search space. + +# 4 THE IMPACTS OF CELL WIDTH AND DEPTH ON OPTIMIZATION + +Given that popular NAS cells share the common connection pattern, we then explore the impact of this common connection pattern from the optimization perspective to answer the question: why the wide and shallow cells are selected during the architecture search? We sample and train variants of popular NAS architectures with random connections. Comparing randomly connected variants with the popular NAS architectures, we find that architectures with wider and shallower cells indeed converge faster so that they are selected by NAS algorithms (Section 4.1). To understand why the wider and shallower cell contributes to faster convergence, we further investigate the loss landscape and gradient variance of popular NAS architectures and their variants via both empirical experiments (Section 4.2) and theoretical analysis (Section 4.3). + +# 4.1 CONVERGENCE + +Popular NAS algorithms typically evaluate the performance of a candidate architecture prematurely before the convergence of its model parameters during the search process. For instance, DARTS (Liu et al., 2019), SNAS (Xie et al., 2019b) and ENAS (Pham et al., 2018) optimize hyper-parameters of architectures and model parameters concurrently. The amortized training time of each candidate architecture is insufficient and therefore far from the requirement for the full convergence. Likewise, AmoebaNet (Real et al., 2019) evaluates the performance of candidate architectures with the training of only a few epochs. In other words, these candidate architectures are not evaluated based on their generalization performance at convergence. As a result, architectures with faster convergence rates are more likely to be selected by existing NAS algorithms because they can obtain better evaluation performance given the same training budget. We therefore hypothesize that the popular NAS architectures may converge faster than other candidate architectures, which largely contributes to the selection of these architectures during the search. + +To support the hypothesis above, we compare the convergence of original NAS architectures and their variants with random connections via empirical studies. We first sample variants of popular NAS cells following the sampling method in Appendix A.2. Then, we train both original NAS architectures and their random variants on CIFAR-10 and CIFAR-100 following the training details in Appendix A.3. During training, we evaluate the testing loss and accuracy of these architectures. Since the convergence is dependent on optimization settings, we also evaluate the convergence performance under different learning rates. + +Take DARTS (Liu et al., 2019) for example, Figure 2 shows the connection topology of the original DARTS cell and its random variants. Figure 3 reports the test loss and accuracy curves of these architectures during training. As illustrated in Figure 3, the original cell $C ^ { d a r t s }$ , known as the widest and shallowest cell, has the fastest and most stable convergence compared with its variants. Further, as the width of a cell increases and the depth decreases (i.e., from $C _ { 4 }$ to $C _ { 1 }$ ), the convergence becomes faster. The results of other popular NAS architectures and their randomly connected variants are reported in Appendix B.2. + +![](images/4b7f687a7d11d4c2522cdab2c13528a5bfe595b3572f60a2628356f4c9f981fd.jpg) +Figure 3: Test loss and test accuracy $( \% )$ curves of DARTS and its randomly connected variants on CIFAR-10 and CIFAR-100 during training. The default learning rate is 0.025. + +![](images/310bd6537370e75f03d04960c20edab18f1af3b42e5dd70e3518656a25772dda.jpg) +Figure 4: Test accuracy $( \% )$ curves of DARTS and its randomly connected variants on CIFAR-10 and CIFAR-100 during training under different learning rates (0.0025 and 0.25). We only evaluate $C ^ { d a r t s }$ , $C _ { 1 } ^ { d a r t s }$ and $C _ { 3 } ^ { \breve { d } a r t s }$ for illustration. The caption of each sub-figure reports the dataset and the learning rate. + +Figure 4 further validates the difference of convergence under different learning rates. The original cell $C ^ { d a r t s }$ enjoys the fastest and the most stable convergence among these cells under various learning rates. The difference in terms of convergence rate and stability is more obvious between $C ^ { d a r t s }$ and its variants with a larger learning rate as shown in Figure 4. Interestingly, $C _ { 3 } ^ { d a r t s }$ completely fails to converge on both CIFAR-10 and CIFAR-100 with a larger learning rate of 0.25. While there is a minor difference among these cells with a lower learning rate of 0.0025, we still find that there is a decreasing performance of convergence (i.e., convergence rate and stability) from $C ^ { d a r t s }$ , $C _ { 1 } ^ { d a r t s }$ $C _ { 3 } ^ { d a r t s }$ . Overall, the observations are consistent with the results in Figure 3. + +We have also compared the convergence of popular NAS architectures and their random variants of different operations. Similarly, we sample and train the random variants of operations for popular NAS architectures following the details in Appendix A.2 and Appendix A.3. Figure 5 illustrates the convergence of these architectures. Surprisingly, with the same connection topologies as the popular NAS cells but different operations, all random variants achieve nearly the same convergence as these popular NAS architectures. Consistent results can be found in Figure 12 of Appendix B.2. We therefore believe that the types of operations have limited impacts on the convergence of NAS architectures and the connection topologies affect the convergence more significantly. + +With these observations, we conclude that the popular NAS architectures with wider and shallower cells indeed converge faster and more stably, which explains why these popular NAS cells are selected during the architecture search. The next question is then why the wider and shallower cell leads to a faster and more stable convergence? + +# 4.2 EMPIRICAL STUDY OF FACTORS AFFECTING CONVERGENCE + +Since the wide and shallow cell is related to fast convergence, we further conduct the theoretical convergence analysis to investigate the cause of fast convergence. In this section, we first introduce the convergence analysis (i.e., Theorem 4.1) of non-convex optimization with the randomized stochastic gradient method (Ghadimi & Lan, 2013). Based on the analysis, we introduce the possible factors related to the common connection pattern that may affect the convergence. We then examine these factors empirically in the following subsections. + +![](images/e5b4fedc6536d070c98dd2c26b526f2168abb1ab6798ff5d8d266659dd17e0b7.jpg) +Figure 5: Test accuracy $( \% )$ curves of DARTS, ENAS, AmoebaNet, NASNet and their random variants of operations on CIFAR-10 during training. The parameter size is attached in Table 3 of Appendix B.2. + +Theorem 4.1 (Ghadimi & Lan, 2013) Let $f$ be a $L$ -smooth non-convex function, and let $f ^ { * }$ be the minimal. Given repeated, independent accesses to stochastic gradients with variance bound $\sigma ^ { 2 }$ for $f ( w )$ , SGD with initial ${ \pmb w } _ { 0 }$ , total iterations $N > 0$ and learning rate $\begin{array} { r } { \gamma _ { k } \ < \ \frac { 1 } { L } } \end{array}$ achieves the following convergence by randomly choosing ${ \pmb w } _ { k }$ as the final output ${ \pmb w } _ { R }$ with probability $\frac { \gamma _ { k } } { H }$ where $\begin{array} { r } { H = \sum _ { k = 1 } ^ { N } \gamma _ { k } } \end{array}$ : + +$$ +\mathbb { E } [ \nabla f ( { \pmb w } _ { R } ) ^ { 2 } ] \le \frac { 2 ( f ( { \pmb w } _ { 0 } ) - f ^ { * } ) } { H } + \frac { L \sigma ^ { 2 } } { H } \sum _ { k = 1 } ^ { N } \gamma _ { k } ^ { 2 } +$$ + +In this paper, $f$ and $\pmb { w }$ denote the objective (loss) function and model parameters respectively. Based on the above theorem, Lipschitz smoothness $L$ and gradient variance $\bar { \sigma } ^ { 2 }$ significantly affect the convergence, including the rate and the stability of convergence. Particularly, given a specific number of iterations $N$ , a smaller Lipschitz constant $L$ or smaller gradient variance $\bar { \sigma } ^ { 2 }$ would lead to a smaller convergence error and less damped oscillations, which indicates a faster and more stable convergence. Since the Lipschitz constant $L$ and gradient variance $\sigma ^ { 2 }$ are highly related to the objective function, different NAS architectures result in different $L$ and $\sigma ^ { 2 }$ . In the following subsections, we therefore conduct empirical analysis for the impacts of the cell with and depth on the Lipschitz smoothness and gradient variance. + +# 4.2.1 LOSS LANDSCAPE + +The constant $L$ of Lipschitz smoothness is closely correlated with the Hessian matrix of the objective function as shown by Nesterov (2004), which requires substantial computation and can only represent the global smoothness. The loss contour, which has been widely adopted to visualize the loss landscape of neural networks by Goodfellow & Vinyals (2015); Li et al. (2018), is instead computationally efficient and is able to report the local smoothness of the objective function. To explore the loss landscape of different architectures, we adopt the method in Li et al. (2018) to plot the loss contour $s ( \alpha , \beta ) \ = \mathbb { E } _ { i \sim P } \big [ f _ { i } ( \pmb { w } ^ { * } + \alpha \pmb { w } _ { 1 } + \beta \pmb { w } _ { 2 } ) \big ]$ . The notation $f _ { i } ( \cdot )$ denotes the loss evaluated at $i _ { t h }$ instance in the dataset and $P$ denotes the distribution of dataset. The notation $\pmb { w } ^ { * }$ , ${ \pmb w } _ { 1 }$ and ${ \pmb w } _ { 2 }$ denote the (local) optimal and two direction vectors randomly sampled from Gaussian distribution respectively. And $\alpha$ , $\beta$ , which are the $x$ and $y$ axis of the plots, denote the step sizes to perturb $\boldsymbol { w } ^ { * }$ . The loss contour plotted here is therefore a two-dimensional approximation of the truly highdimensional loss contour. However, as shown in Li et al. (2018), the approximation is valid and effective to characterize the property of the true loss contour. + +To study the impact of the cell width and depth on Lipschitz smoothness, we compare the loss landscape between popular NAS architectures and their randomly connected variants trained in Section 4.1 on CIFAR-10 and CIFAR-100. Due to the space limitation, we only plot the loss landscape of DARTS (Liu et al., 2019) and its randomly connected variants in Figure 6. We observe that the connection topology has a significant influence on the smoothness of the loss landscape. With the widest and shallowest cell, $\bar { C } ^ { d a r t s }$ has a fairly benign and smooth landscape along with the widest near-convex region around the optimal. With a deeper and narrower cell, $\dot { C } _ { 1 } ^ { d a r t s }$ and $C _ { 2 } ^ { d a r t s }$ have a more agitated loss landscape compared with $C ^ { d \bar { a } r t s }$ . Further, $C _ { 3 } ^ { d a r t s }$ , with the smallest width and largest depth among these cells, has the most complicated loss landscape and the narrowest and steepest near-convex region around the optimum. The largest eigenvalue of the Hessian matrix, which indicates the maximum curvature of the objective function, is positively correlated with Lipschitz constant as shown by Nesterov (2004). A smoother loss landscape therefore corresponds to a smaller Lipschitz constant $L$ . $C ^ { d a r t s }$ is likely to achieve the smallest Lipschitz constant among these cells. + +![](images/bdd123502ed284d32fac3ada394817ba339128dee2582d9b5c2cd226f6fe60a2.jpg) +Figure 6: Loss contours of DARTS and its variants with random connections on the test dataset of CIFAR-10. The lighter color of the contour lines indicates a larger loss. Notably, the loss of the blank area, around the corners of each plot, is extremely large. Besides, the area with denser contour lines indicates a steeper loss surface. + +![](images/be3cf2e0de30d67001a33ff6c77f1f311b660ff7782ca80203d6c51b16ea2edb.jpg) +Figure 7: Heat maps of the gradient variance from DARTS and its randomly connected variants around the optimal on the test dataset of CIFAR-10. The lighter color indicates a larger gradient variance. Notably, the gradient variance of the yellow area, around the corners of each plot, is extremely large. Obviously, the region with relatively small gradient variance becomes smaller from left to right. + +Consistent results can be found in Appendix B.3 for the loss landscape of other popular NAS cells and their variants. Based on these results, we conclude that increasing the width and decreasing the depth of a cell widens the near-convex region around the optimal and smooths the loss landscape. The constant $L$ of Lipschitz smoothness therefore becomes smaller locally and globally. Following Theorem 4.1, architectures with wider and shallower cells shall converge faster and more stably. + +# 4.2.2 GRADIENT VARIANCE + +The gradient variance indicates the noise level of gradient by randomly selecting training instances in stochastic gradient descent (SGD) method. Large gradient variance indicates large noise in the gradient, which typically results in unstable updating of model parameters. Following Ghadimi $\&$ Lan (2013), gradient variance is defined as $\mathbf { \bar { V } a r } ( \bar { \nabla } f _ { i } ( \pmb { w } ) )$ . Similar to the visualization of loss landscape in Section 4.2.1, we visualize the gradient variance by $g ( \alpha , \beta ) = \mathrm { V a r } ( \nabla f _ { i } ( { \pmb w } ^ { * } + \alpha { \pmb w } _ { 1 } +$ $\beta \pmb { w } _ { 2 } )$ ). All other notations follow Section 4.2.1. + +To study the impact of the width and depth of a cell on the gradient variance, we compare the gradient variance between popular NAS architectures and their randomly connected variants trained in Section 4.1 on CIFAR-10 and CIFAR-100. We visualize the gradient variance of DARTS (Liu et al., 2019) and its randomly connected variants in Figure 7 and Figure 8. For better visualization, we plot the figures using the standard deviation (i.e., $\sqrt { g ( \alpha , \beta ) } )$ to avoid extremely large values in the visualization of DARTS. Obviously, as the cell width decreases and the cell depth increases (i.e., from $C ^ { d a r t s }$ to $C _ { 4 } ^ { d a r t s }$ ), the region with relatively small gradient variance becomes smaller as shown in Figure 7. Consistently, the gradient variance generally shows an increasing trend from $C ^ { d a r t s }$ to + +![](images/9f267a62ba4182f35a16326d86f8d819146fc3e2bf6de2627d1327ca6cb89bcd.jpg) +Figure 8: 3D surfaces of the gradient variance from DARTS and its randomly connected variants around the optimal on the test dataset of CIFAR-100. The height of the surface indicates the value of gradient variance. Notably, the height of the gradient variance surface is gradually increasing from left to right. Especially, $C ^ { d a r t s }$ has the smoothest and lowest surface of gradient variance among these architectures. + +$C _ { 4 } ^ { d a r t s }$ in Figure 8. Consequently, the gradient becomes noisier in the neighborhood of the optimal, which typically makes the optimization harder and unstable. + +Similar results from other popular NAS architectures and their random variants are provided in Appendix B.4. Based on these results, we conclude that the increase in width and the decrease in depth of a cell result in a smaller gradient variance, which makes the optimization process less noisy and more efficient. The convergence of wide and shallow cells therefore shall be fast and stable following Theorem 4.1. + +# 4.3 THEORETICAL ANALYSIS OF FACTORS AFFECTING CONVERGENCE + +Our empirical study so far suggests that larger cell width and smaller cell depth smooth the loss landscape and decrease the gradient variance. Consequently, popular NAS architectures with wide and shallow cells converge fast. In this section, we investigate the impacts of the cell width and depth on Lipschitz smoothness and gradient variance from a theoretical perspective. + +# 4.3.1 SETUP + +We analyze the impact of the cell width and depth by comparing architectures with the widest cell and the narrowest cell as shown in Figure 26 of Appendix C. To simplify the analysis, the cells we investigate contain only one input node $_ { \textbf { \em x } }$ and one output node. The input node may be training instances or output node from any proceeding cell. All operations in the cell are linear operations without any non-linearity. Suppose there are $n$ intermediate nodes in a cell, the $i _ { t h }$ intermediate node and its associated weight matrix are denoted as $\mathbf { \boldsymbol { y } } ^ { ( i ) }$ and $W ^ { ( i ) } ( i = 1 , \cdots , n )$ respectively. The output node $_ z$ denotes the concatenation of all intermediate nodes. Both cells have the same arbitrary objective function $f$ following the output node, which shall consist of the arbitrary number of activation functions and cells. For clarity, we refer to the objective function, intermediate nodes and output node of the architecture with the narrowest cell as $\hat { \widehat { f } } , \widehat { \pmb { y } } ^ { ( i ) }$ and $\widehat { z }$ respectively. As shown in Figure 26, the intermediate node $\mathbf { \boldsymbol { y } } ^ { ( i ) }$ and $\widehat { \pmb y } ^ { ( i ) }$ bcan be computed by $\mathbf { \boldsymbol { y } } ^ { ( i ) } \equiv W ^ { ( i ) } \dot { \mathbf { \boldsymbol { x } } }$ and $\begin{array} { r } { \widehat { \pmb y } ^ { ( i ) } = \prod _ { k = 1 } ^ { i } W ^ { ( k ) } \pmb x } \end{array}$ b respectively. Particularly, we set $\begin{array} { r } { \prod _ { k = 1 } ^ { i } W ^ { ( k ) } = W ^ { ( i ) } W ^ { ( i - 1 ) } \cdot \cdot \cdot W ^ { ( 1 ) } } \end{array}$ . And ball the related proofs of following theorems can be found in Appendix C. + +# 4.3.2 THEORETICAL RESULTS + +Due to the complexity of the standard Lipschitz smoothness, we instead investigate the block-wise Lipschitz smoothness (Beck & Tetruashvili, 2013) of the two cases shown in Figure 26. In Theo$\mathrm { r e m } 4 . 2$ , we show that the block-wise Lipschitz constant of the narrowest cell is scaled by the largest eigenvalues of the model parameters (i.e., $W ^ { ( i ) } ( i = 1 , \cdots , n ) )$ . Notably, the Lipschitz constant of the narrowest cell can be significantly larger than the one of the widest cell while most of the largest eigenvalues are larger than 1, which slows down the convergence substantially. The empirical study in Section 4.2.1 has validated the results. + +Theorem 4.2 (The impact of cell width and depth on block-wise Lipschitz smoothness ) Let $\lambda ^ { ( i ) }$ be the largest eigenvalue of $W ^ { ( i ) }$ . Given the widest cell with objective function $f$ and the narrowest cell with objective function ${ \widehat { f } } ,$ , by assuming the block-wise Lipschitz smoothness of the widest cell as $\begin{array} { r l r } { \left\| \frac { \partial f } { \partial W _ { 1 } ^ { ( i ) } } - \frac { \partial f } { \partial W _ { 2 } ^ { ( i ) } } \right\| } & { { } \le L ^ { ( i ) } \left\| W _ { 1 } ^ { ( i ) } - W _ { 2 } ^ { ( i ) } \right\| } & { } \end{array}$ for any $W _ { 1 } ^ { ( i ) }$ and $W _ { 2 } ^ { ( i ) }$ , the block-wise Lipschitz smoothness of the narrowest cell then can be represented as + +![](images/b2f93e7fd07134c171ffa0c6ff624333f895073657b036203d51f387940193f2.jpg) +Figure 9: Comparison of the test accuracy at the convergence between popular NAS architectures and their randomly connected variants on CIFAR-10. Each popular NAS architecture (index 0 on the $x$ -axis) is followed by 13 randomly connected variants (from index 1 to index 13 on the $x$ -axis), corresponding to $C _ { 1 }$ to $C _ { 1 3 }$ respectively. The width and depth of these random variants are shown in Table 2 in Appendix B.2. The dashed lines report the accuracy of the popular NAS architectures. + +$$ +\left\| \frac { \partial \widehat { f } } { \partial W _ { 1 } ^ { ( i ) } } - \frac { \partial \widehat { f } } { \partial W _ { 2 } ^ { ( i ) } } \right\| \leq ( \prod _ { j = 1 } ^ { i - 1 } \lambda ^ { ( j ) } ) L ^ { ( i ) } \left\| W _ { 1 } ^ { ( i ) } - W _ { 2 } ^ { ( i ) } \right\| +$$ + +We then compare the gradient variance of the two cases shown in Figure 26. Interestingly, gradient variance suggests a similar but more significant difference between the two cases compared with their difference in Lipschitz smoothness. As shown in Theorem 4.3, the gradient variance of the narrowest cell is not only scaled by the square of the largest eigenvalue of the weight matrix but also is scaled by the number of intermediate nodes (i.e., $n$ ). Moreover, the upper bound of its gradient variance has numbers of additional terms, leading to a significantly larger gradient variance. The empirical study in Section 4.2.2 has confirmed the results. + +Theorem 4.3 (The impact of cell width and depth on gradient variance ) Let $\lambda ^ { ( i ) }$ be the largest eigenvalue of $\dot { W } ^ { ( i ) }$ . Given the widest cell with objective function $f$ and the narrowest cell with objective function $\widehat { f } _ { \mathrm { i } }$ , by assuming the gradient variance of the widest cell as $\begin{array} { r } { \mathbb { E } \left\| \frac { \partial f } { \partial W ^ { ( i ) } } - \mathbb { E } \frac { \partial f } { \partial W ^ { ( i ) } } \right\| ^ { 2 } \leq } \end{array}$ $( \sigma ^ { ( i ) } ) ^ { 2 }$ for any $W ^ { ( i ) }$ , the gradient variance of the narrowest cell is then bounded by + +$$ +\mathbb { E } \left\| \frac { \partial \widehat { f } } { \partial W ^ { ( i ) } } - \mathbb { E } \frac { \partial \widehat { f } } { \partial W ^ { ( i ) } } \right\| ^ { 2 } \leq n \sum _ { k = i } ^ { n } ( \frac { \sigma ^ { ( k ) } } { \lambda ^ { ( i ) } } \prod _ { j = 1 } ^ { k } \lambda ^ { ( j ) } ) ^ { 2 } +$$ + +# 5 GENERALIZATION BEYOND THE COMMON CONNECTIONS + +Our empirical and theoretical results so far have demonstrated that the common connection pattern helps to smooth the loss landscape and make the gradient more accurate. Popular NAS architectures with wider and shallower cells therefore converge faster, which explains why popular NAS architectures are selected by the NAS algorithms. Nonetheless, we have ignored the generalization performance obtained by popular NAS architectures and their random variants. We therefore wonder whether popular NAS architectures with wide and shallow cells generalize better. + +In Figure 9, we visualize the test accuracy of popular NAS architectures and their randomly connected variants trained in Section 4.1. Notably, the popular NAS architectures can achieve competitive accuracy compared with most of the random variants. However, there are some random variants, which achieve higher accuracy than the popular architectures. Interestingly, there seems to be an optimal choice of depth and width for a cell to achieve higher test accuracy (i.e., $C _ { 7 }$ for DARTS and $C _ { 4 }$ for ENAS). Popular NAS architectures with wide and shallow cells therefore are not guaranteed to generalize better, although they typically converge faster than other random variants. + +We also adapt the connections of popular NAS architectures to obtain their widest and shallowest variants. The adaption is possible due to the fact that the cells (including normal and reduction cell) + +Table 1: Comparison of the test error at the convergence between the original and the adapted NAS architectures on CIFAR-10/100 and Tiny-ImageNet-200. The entire networks are constructed and trained following the experimental settings reported in Appendix A.3, which may slightly deviate from the original ones. The test errors (or the parameter sizes) of original and adapted architectures are reported on the left and right hand-side of slash respectively. + +
ArchitectureCIFAR-10CIFAR-100Tiny-ImageNet-200
Error(%)Params(M)Error(%)Params(M)Error(%)Params(M)
NASNet (Zoph et al., 2018)2.65/2.804.29/4.3217.06/16.864.42/4.4531.88/32.054.57/4.60
AmoebaNet (Real etal.,2019)2.76/2.913.60/3.6017.55/17.283.71/3.7132.22/33.163.83/3.83
ENAS (Pham et al., 2018)2.64/2.764.32/4.3216.67/16.044.45/4.4530.68/31.364.60/4.60
DARTS (Liu et al., 2019)2.67/2.733.83/3.9016.41/16.153.95/4.0330.58/31.334.08/4.16
SNAS (Xie et al., 2019b)2.88/2.693.14/3.1917.78/17.203.26/3.3132.40/32.613.39/3.45
+ +of popular NAS architectures are generally not widest and narrowest as shown in Figure 1. While there are various widest and shallowest cells following our definition of cell width and depth, we apply the connection pattern of SNAS cell shown in Figure 1(e) to obtain the widest and shallowest cells. The adapted topologies are shown in Figure 25 of Appendix B.5. + +Table 1 illustrates the comparison of the test accuracy between our adapted NAS architectures and the original ones. As shown in Table 1, the adapted architectures achieve smaller test error on CIFAR-100. Nevertheless, most of the adapted architectures, obtain larger test error than the original NAS architectures on both CIFAR-10 and Tiny-ImageNet- $2 0 0 ^ { 4 }$ . The results again suggest that the widest and shallowest cells may not help architectures generalize better, while these architectures typically achieve compelling generalization performance. + +The results above have revealed that the architectures with wide and shallow cells may not generalize better despite their fast convergence. To improve current NAS algorithms, we therefore need to rethink the evaluation of the performance of candidate architectures during architecture search since the current NAS algorithms are not based on the generalization performance at convergence as mentioned in Section 4.1. Nonetheless, architectures with the wide and shallow cells usually guarantee a stable and fast convergence along with competitive generalization performance, which should be good prior knowledge for designing architectures and NAS algorithms. + +# 6 CONCLUSION AND DISCUSSION + +Recent works have been focusing on the design and evaluation of NAS algorithms. We instead endeavour to examine the architectures selected by the various popular NAS algorithms. Our study is the first to explore the common structural patterns selected by existing algorithms, why these architectures are selected, and why these algorithms may be flawed. In particular, we reveal that popular NAS algorithms tend to favor architectures with wide and shallow cells, which typically converge fast and consequently are likely be selected during the search process. However, these architectures may not generalize better than other candidates of narrow and deep cells. + +To further improve the performance of the selected NAS architectures, one promising direction for the current NAS research is to evaluate the generalization performance of candidate architectures more accurately and effectively. While popular NAS architectures appreciate fast and stable convergence along with competitive generalization performance, we believe that the wide and shallow cells are still useful prior knowledge for the design of the search space. We hope this work can attract more attention to the interpretation and understanding of existing popular NAS algorithms. + +# ACKNOWLEDGEMENT + +This research is supported by the National Research Foundation Singapore under its AI Singapore Programme [Award No. AISG-GC-2019-002] and Singapore Ministry of Education Academic Research Fund Tier 3 under MOEs official grant number MOE2017-T3-1-007. + +# REFERENCES + +Youhei Akimoto, Shinichi Shirakawa, Nozomu Yoshinari, Kento Uchida, Shota Saito, and Kouhei Nishida. Adaptive stochastic natural gradient method for one-shot neural architecture search. In ICML, volume 97 of Proceedings of Machine Learning Research, pp. 171–180. PMLR, 2019. + +Amir Beck and Luba Tetruashvili. On the convergence of block coordinate descent type methods. SIAM Journal on Optimization, 23(4):2037–2060, 2013. + +Han Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. In ICLR (Poster). OpenReview.net, 2019. + +Terrance Devries and Graham W. Taylor. Improved regularization of convolutional neural networks with cutout. CoRR, abs/1708.04552, 2017. + +Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Neural architecture search: A survey. Journal of Machine Learning Research, 20(55):1–21, 2019. + +Saeed Ghadimi and Guanghui Lan. Stochastic first- and zeroth-order methods for nonconvex stochastic programming. SIAM Journal on Optimization, 23(4):2341–2368, 2013. + +Ian J. Goodfellow and Oriol Vinyals. Qualitatively characterizing neural network optimization problems. In ICLR, 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. + +Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks. In CVPR, pp. 2261–2269. IEEE Computer Society, 2017. + +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1106–1114, 2012. + +Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. In ICLR (Poster). OpenReview.net, 2017. + +Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In NeurIPS, pp. 6391–6401, 2018. + +Liam Li and Ameet Talwalkar. Random search and reproducibility for neural architecture search. In UAI, pp. 129. AUAI Press, 2019. + +Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: differentiable architecture search. In ICLR (Poster). OpenReview.net, 2019. + +Renqian Luo, Fei Tian, Tao Qin, Enhong Chen, and Tie-Yan Liu. Neural architecture optimization. In NeurIPS, pp. 7827–7838, 2018. + +Niv Nayman, Asaf Noy, Tal Ridnik, Itamar Friedman, Rong Jin, and Lihi Zelnik-Manor. XNAS: neural architecture search with expert advice. CoRR, abs/1906.08031, 2019. + +Yurii Nesterov. Introductory Lectures on Convex Optimization - A Basic Course, volume 87 of Applied Optimization. Springer, 2004. + +Hieu Pham, Melody Y. Guan, Barret Zoph, Quoc V. Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. In ICML, volume 80 of Proceedings of Machine Learning Research, pp. 4092–4101. PMLR, 2018. + +Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V. Le. Regularized evolution for image classifier architecture search. In AAAI, pp. 4780–4789. AAAI Press, 2019. + +Christian Sciuto, Kaicheng Yu, Martin Jaggi, Claudiu Musat, and Mathieu Salzmann. Evaluating the search phase of neural architecture search. arXiv preprint arXiv:1902.08142, 2019. +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015. +Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, pp. 1–9. IEEE Computer Society, 2015. +Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, and Quoc V. Le. Mnasnet: Platform-aware neural architecture search for mobile. In CVPR, pp. 2820– 2828. Computer Vision Foundation / IEEE, 2019. +Saining Xie, Alexander Kirillov, Ross Girshick, and Kaiming He. Exploring randomly wired neural networks for image recognition. arXiv preprint arXiv:1904.01569, 2019a. +Sirui Xie, Hehui Zheng, Chunxiao Liu, and Liang Lin. SNAS: stochastic neural architecture search. In ICLR (Poster). OpenReview.net, 2019b. +Zirui Zhou, Qi Zhang, and Anthony Man-Cho So. 1,p-norm regularization: Error bounds and convergence rate analysis of first-order methods. In ICML, pp. 1501–1510, 2015. +Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V. Le. Learning transferable architectures for scalable image recognition. In CVPR, pp. 8697–8710. IEEE Computer Society, 2018. + +# APPENDIX A EXPERIMENTAL SETUP + +# A.1 DATA PRE-PROCESSING AND AUGMENTATION + +Our experiments are conducted on CIFAR-10/100 (Krizhevsky et al., 2009) and Tiny-ImageNet200. CIFAR-10/100 contains 50,000 training images and 10,000 test images of $3 2 \times 3 2$ pixels in 10 and 100 classes respectively. Tiny-ImageNet-200 consists of 100,000 training images, 10,000 validation images and 10,000 test images5 in 200 classes. We adopt the same data pre-processing and argumentation as described in DARTS (Liu et al., 2019): zero padding the training images with 4 pixels on each side and then randomly cropping them back to $3 2 \times 3 2$ on CIFAR-10/100 and $6 4 \times 6 4$ on Tiny-ImageNet-200; randomly flipping training images horizontally; normalizing training images with the means and standard deviations along the channel dimension. + +# A.2 SAMPLING OF RANDOM VARIANTS + +For a $N$ -node NAS cell, there are $\frac { ( N - 2 ) ! } { ( M - 1 ) ! }$ possible connections with $M$ input nodes and one output node. There are therefore hundreds to thousands of possible randomly connected variants for each popular NAS cell. The random variants of operations consist of a similar or even higher amount of architectures. Due to the prohibitive cost of comparing popular NAS cells with all variants, we randomly sample some variants to understand why the popular NAS cells are selected. + +Given a NAS cell $C$ , we fix the partial order of intermediate nodes and their accompanying operations. We then replace the source node of their associated operations by uniformly randomly sampling a node from their proceeding nodes in the same cell to get their randomly connected variants. Similarly, given a NAS cell $C$ , we fix the partial order of intermediate nodes and their connection topologies. We then replace the operations couping each connection by uniformly randomly sampling from candidate operations to get their random variants of operations. + +# A.3 ARCHITECTURES AND TRAINING DETAILS + +For experiments on CIFAR-10/100 and Tiny-ImageNet-200, the neural network architectures are constructed by stacking $L = 2 0$ cells. Feature maps are down-sampled at the $L / 3$ -th and $2 L / 3$ -th cell of the entire architecture with stride 2. For Tiny-ImageNet-200, the stride of the first convolutional layer is adapted to 2 to reduce the input resolution from $6 4 \times 6 4$ to $3 2 \times 3 2$ . A more detailed building scheme can be found in DARTS (Liu et al., 2019). + +In the default training setting, we apply stochastic gradient descent (SGD) with learning rate 0.025, momentum 0.9, weight decay $3 \times \bar { 1 0 ^ { - 4 } }$ and batch size 80 to train the models for 600 epochs on CIFAR10/100 and 300 epochs on Tiny-ImageNet-200 to ensure the convergence. The learning rate is gradually annealed to zero following the standard cosine annealing schedule. To compare the convergence under different learning rates in Section 4.1, we change the initial learning rate from 0.025 to 0.25 and 0.0025 respectively. + +# A.4 REGULARIZATION + +Since regularization mechanisms shall affect the convergence (Zhou et al., 2015), architectures are trained without regularization for a neat empirical study in Section 4. The regularization mechanisms are only used in Section 5 to get the converged generalization performance of the original and adapted NAS architectures on CIFAR-10/100 and Tiny-ImageNet-200 as shown in Table 1. + +There are three adopted regularization mechanisms on CIFAR-10/100 and Tiny-ImageNet-200 in this paper: cutout (Devries & Taylor, 2017), auxiliary tower (Szegedy et al., 2015) and drop path (Larsson et al., 2017). We apply standard cutout regularization with cutout length 16. Moreover, the auxiliary tower is located at $2 L / 3$ -th cell of the entire architecture with weight 0.4. We apply the same linearly-increased drop path schedule as in NASNet (Zoph et al., 2018) with the maximum probability of 0.2. + +# APPENDIX B MORE RESULTS + +# B.1 NAS ARCHITECTURES AND THEIR VARIANTS + +We compare the width and depth of popular NAS architectures and their variants of random connections in Table 2. The random variants are sampled following the method in Appendix A.2. We further show the connection topologies of popular NAS and their partial random variants of connections in Figure 10 and Figure 11. + +Table 2: Comparison of the width and depth of popular NAS cells and their randomly variants of connections. The name of the popular NAS cell is followed by its width and depth, which is separated by a comma. The width of a cell is conventionally computed by assuming that each intermediate node shares the same width $c$ . Notably, the width and depth of random variants are in ascending and descending order respectively from $C _ { 1 }$ to $C _ { 1 3 }$ . Moreover, the popular NAS architectures achieve the largest width and nearly the smallest depth among all the variants. + +
Base CellCCC3C4C5C6C7C8CgC10C11C12C13
DARTS (3.5c,3)2c,42c,42c,42.5c,42.5c,42.5c,32.5c,32.5c,33c,33c,33c,33.5c,33.5c,3
ENAS (5c,2)1.5c,61.5c,52c,62c,62.5c,52.5c,53c,43c,33.5c,53.5c,43.5c,43.5c,33.5c,3
AmoebaNet (4c,4)1.5c,61.5c,51.5c,51.5c,32c,62c,62c,42.5c,52.5c,32.5c,33c,33.5c,43.5c,3
NASNet (5c,2)1.5c,61.5c,52c,62c,62.5c,52.5c,53c,43c,33.5c,53.5c,43.5c,43.5c,33.5c,3
+ +![](images/a7724974f63a6383403c4197297b234eadbbcf9e3272f88ee3d7fee52dc17f18.jpg) +Figure 10: Connection topology of AmoebaNet cell (Real et al., 2019) and its part of randomly connected variants. Each sub-figure reports the width and depth of a cell separated by a comma. The leftmost one is the original connection from AmoebaNet normal cell and others are the ones randomly sampled. The width of a cell is also computed by assuming that each intermediate node shares the same width $c$ . Notably, the original AmoebaNet cell has the largest width and almost the smallest depth among these cells. + +![](images/10ea54e0cac420bdd8e6e4a738562dc8c0e5a49d8f8e7e7e6aa5361d57f5afdd.jpg) +Figure 11: Connection topology of SNAS cell under mild constraint (Xie et al., 2019b) and its part of randomly connected variants. The width and depth of a cell are reported in the title of each plot. The leftmost one is the original connection from SNAS normal cell and others are the ones randomly sampled. The width of a cell is conventionally computed by assuming that each intermediate node shares the same width $c$ . Notably, the original SNAS cell has the largest width and the smallest depth among these cells. + +![](images/e6bd76aa9ea1e1bd74ad8e8e0b948d49fafddabbbaa73dfc8479eac00f6288e8.jpg) +Figure 12: More test accuracy $( \% )$ curves of DARTS, ENAS, AmoebaNet, NASNet and their random variants of operations on CIFAR-10 during training. + +Table 3: Comparison of the parameter size (MB) of popular NAS cells and their randomly variants of operations. $C _ { 0 }$ denotes the original NAS cell and $C _ { 1 }$ to $C _ { 1 0 }$ denote the random variants. Notably, there is a gap of $\sim 3 0 \%$ between the parameter size of the smallest architecture and one of the largest architecture. + +
Base cellCC1CC3C4C5C6C7C8CC10
DARTS3.353.372.842.702.983.192.433.492.883.312.81
ENAS3.863.453.192.982.703.673.033.853.263.813.29
AmoebaNet3.152.862.622.412.103.102.463.282.693.422.75
NASNet3.833.453.192.982.703.673.033.853.263.813.29
+ +# B.2 CONVERGENCE + +In this section, we plot more test loss curves on CIFAR-10 (Krizhevsky et al., 2009) for original popular NAS architectures and their (12) randomly connected variants, as shown in Figure 13, Figure 14 and Figure 16. The depth and width of these 12 randomly connected variants can be found in Table 2. Notably, the width and depth of random variants (from $C _ { 1 }$ to $C _ { 1 2 }$ ) are in ascending and descending order respectively. Moreover, the popular NAS architectures achieve the largest width and nearly the smallest depth among all the variants. As shown in the following figures, the popular NAS cells, with larger width and smaller depth, typically achieve faster and more stable convergence than the random variants. Furthermore, with the increasing width and the decreasing depth, the convergence of random variants approaches to the original NAS architecture. + +![](images/a384e1b60ab3e477781a18041ad38cc4ed2f7071ced0d7f39f04d4a76ec0934b.jpg) +Figure 13: Test loss curves of DARTS and its variants on CIFAR-10 during training. + +![](images/2168351c98794c46ee4df88ceb09d96318ae37c2a8e767cd36bc3e9a1682598e.jpg) +Figure 14: Test loss curves of AmoebaNet and its variants on CIFAR-10 during training. + +![](images/5f07f0851085941cf22b4bc27af53caa0775369f959768e77ad1675dbd744317.jpg) +Figure 15: Test loss curves of ENAS and its variants on CIFAR-10 suring training. + +![](images/c12424586e5abfcec9920010a3461298db226a4841f82664368eb6a54eeb2dd8.jpg) +Figure 16: Test loss curves of NASNet and its variants on CIFAR-10 suring training. + +# B.3 LOSS LANDSCAPE + +In this section, we visualize loss landscapes for popular NAS architectures and their randomly connected variants. The depth and width of a cell are highly correlated. For example, the depth and width cannot reach their maximum simultaneously. With the increasing width, the average depth of cells grouped by the same width is decreasing as shown in Table 2. We therefore only group the results (including the ones from original NAS architectures) with various width levels of a cell for a better comparison. Notably, the architectures with wider and shallower cells have a smoother and benigner loss landscape, as shown in Figure 17, Figure 18, Figure 19 and Figure 20, which further supports the results in Section 4.2.1. + +![](images/d79e3165ac742d039b7801b7371e89d9c453596c9a0b9eb6655da27f4189a93e.jpg) +Figure 17: Loss contours of DARTS and its variants with random connections on the test dataset of CIFAR-10. + +![](images/60da9820e9d0dcbec387aaceb9c4b5ac1668ac2eb9eaee76f132c69ccd50826c.jpg) +Figure 18: Loss contours of AmoebaNet and its randomly connected variants on the test dataset of CIFAR-10. + +(a) 1.5c (b) 2c (c) 2.5c (d) 3c (e) 3.5c (a) 1.5c (b) 2c (c) 2.5c (d) 3c (e) 3.5c (a) 1.5c (b) 2c (c) 2.5c (d) 3c (e) 3.5c + +![](images/a39ea854736dc3fe04f8d3a558c095d617ac5d3f594a3affb6c4d9b31f3ec309.jpg) +Figure 19: Loss contours of ENAS and its randomly connected variants on the test dataset of CIFAR10. + +![](images/c7221a93195c9e8704d541292671df729c52182a14a87f5689b62a59eb96d9fb.jpg) +Figure 20: Loss contours of NASNet and its randomly connected variants on the test dataset of CIFAR-10. + +# B.4 GRADIENT VARIANCE + +In this section, we visualize the gradient variance (i.e., $g ( \alpha , \beta )$ as defined in Section 4.2.2) for the popular NAS architectures as well as their variants with random connection, such as AmoebaNet in Figure 21, DARTS in Figure 22, ENAS in Figure 23 and NASNet in Figure 23. The $z$ -axis has been scaled by $1 0 ^ { - 5 }$ for a better visualization. Similarly, we group the results based on the width of cells. Notably, architectures with wider and shallower cells achieve relatively smaller gradient variance, which further confirms the results in Section 4.2.2. + +![](images/6a67fdc40cdb4d5ffb4ee1e0d39c85baf4f3dd7956a3e28b2e760818c2bcdef3.jpg) +Figure 21: 3D surfaces of the gradient variance from AmoebaNet and its randomly connected variants on the test dataset of CIFAR-10. + +![](images/d7da322a4b900bf8b806504ba850de15ec9a3a68de9b0c58a6ff916c75179aa6.jpg) +Figure 22: 3D surfaces of the gradient variance from DARTS and its randomly connected variants on the test dataset of CIFAR-10. + +![](images/a873988d3264bf1bc288edc692cf810709287f9d2c206603ae04c540a64ea032.jpg) +Figure 23: 3D surfaces of the gradient variance from ENAS and its randomly connected variants on the test dataset of CIFAR-10. + +![](images/a52643ef9cedfd6008f7a9e1c67627c6fab5a49108f90964359bb86544cb73ae.jpg) +Figure 24: 3D surfaces of the gradient variance from NASNet and its randomly connected variants on the test dataset of CIFAR-10. + +# B.5 ADAPTED TOPOLOGIES + +In this section, we visualize the adapted architectures (in Figure 25) we investigate on in Section 5. Notably, The adapted connection topologies are not only applied in the normal cell but also the reduction cell. The adapted architectures are compared with popular NAS architectures to examine the impacts of the common connection pattern on generalization. + +![](images/86bd77ba63203744c1ff4e86e573165cc042d5d806aa8afbe1e03f058d334c89.jpg) +Figure 25: Adapted topologies of cells from popular NAS architectures. The title of each sub-figure includes the name of the architecture, width and depth of the cell following our definition. Notably, these cells achieve the largest width and smallest depth in their original search space. + +# APPENDIX C THEORETICAL ANALYSIS + +# C.1 SETUP + +![](images/86ac76a358165de58586c7f5f30f688e340f4cd4df0470f664c56902c0beb65b.jpg) +Figure 26: Two architectures to compare in the theoretical analysis: (a) architecture with widest cell; (b) architecture with narrowest cell. The notation $l$ and $\widehat { l }$ denote the values of objective function $f$ and $\widehat { f }$ evaluated at input $_ { \textbf { \em x } }$ respectively. + +# C.2 BASICS + +We firstly compare the gradient of case I and case $\mathrm { I I }$ shown in Figure 26. For case I, since $\begin{array} { r l } { \mathbf { \boldsymbol { y } } ^ { ( i ) } = } & { { } } \end{array}$ $W ^ { ( i ) } { \pmb x }$ , the gradient to each weight matrix $W ^ { ( i ) }$ is denoted by + +$$ +\frac { \partial f } { \partial W ^ { ( i ) } } = \frac { \partial f } { \partial \pmb { y } ^ { ( i ) } } \pmb { x } ^ { T } +$$ + +Similarly, since $\begin{array} { r } { \widehat { \pmb { y } } ^ { ( i ) } = \prod _ { k = 1 } ^ { i } W ^ { ( k ) } \pmb { x } } \end{array}$ for the case II, the gradient to each weight matrix $W ^ { ( i ) }$ is denoted by + +$$ +\begin{array} { l } { \displaystyle \frac { \partial \widehat { f } } { \partial W ^ { ( i ) } } = \sum _ { k = i } ^ { n } ( \prod _ { j = i + 1 } ^ { k } W ^ { ( j ) } ) ^ { T } \displaystyle \frac { \partial \widehat { f } } { \partial \widehat { y } ^ { ( k ) } } ( \prod _ { j = 1 } ^ { i - 1 } W ^ { ( j ) } { \pmb x } ) ^ { T } } \\ { = \sum _ { k = i } ^ { n } ( \prod _ { j = i + 1 } ^ { k } W ^ { ( j ) } ) ^ { T } \displaystyle \frac { \partial \widehat { f } } { \partial \widehat { y } ^ { ( k ) } } { \pmb x } ^ { T } ( \prod _ { j = 1 } ^ { i - 1 } W ^ { ( j ) } ) ^ { T } } \\ { = \displaystyle \sum _ { k = i } ^ { n } ( \prod _ { j = i + 1 } ^ { k } W ^ { ( j ) } ) ^ { T } \displaystyle \frac { \partial { f } } { \partial W ^ { ( k ) } } ( \prod _ { j = 1 } ^ { i - 1 } W ^ { ( j ) } ) ^ { T } } \end{array} +$$ + +Exploring the fact that $\begin{array} { r } { \frac { \partial \widehat { f } } { \partial \widehat { \pmb { y } } ^ { ( i ) } } = \frac { \partial f } { \partial \pmb { y } ^ { ( i ) } } } \end{array}$ ∂f∂y(i) , we get (4) by inserting (1) into (3). + +# C.3 PROOF OF THEOREM 4.2 + +Due to the complexity of comparing the standard Lipschitz constant of the smoothness for these two cases, we instead investigate the block-wise Lipschitz constant (Beck & Tetruashvili, 2013). In other words, we evaluate the Lipschitz constant for each weight matrix $W ^ { ( i ) }$ while fixing all other matrices. Formally, we assume the block-wise Lipschitz smoothness of case I as + +$$ +\left\| \frac { \partial f } { \partial W _ { 1 } ^ { ( i ) } } - \frac { \partial f } { \partial W _ { 2 } ^ { ( i ) } } \right\| \leq L ^ { ( i ) } \left\| W _ { 1 } ^ { ( i ) } - W _ { 2 } ^ { ( i ) } \right\| \quad \forall W _ { 1 } ^ { ( i ) } , W _ { 2 } ^ { ( i ) } +$$ + +The default matrix norm we adopted is 2-norm. And $W _ { 1 } ^ { ( i ) } , W _ { 2 } ^ { ( i ) }$ denote possible assignments for $W ^ { ( i ) }$ . + +Denoting that $\lambda ^ { ( i ) } = \left\| W ^ { ( i ) } \right\|$ , which is the largest eigenvalue of matrix $W ^ { ( i ) }$ , we can get the smoothness of case $\mathrm { I I }$ as + +$$ +\begin{array} { r l } { \left| \frac { \partial \hat { f } } { \partial W _ { 1 } ^ { ( i ) } } - \frac { \partial \hat { f } } { \partial W _ { 2 } ^ { ( i ) } } \right| \Bigg | = \left| \displaystyle \sum _ { k = i } ^ { n } ( \displaystyle \prod _ { j = i + 1 } ^ { k } W ^ { ( j ) } ) ^ { T } \big ( \frac { \partial f } { \partial W _ { 1 } ^ { ( k ) } } - \frac { \partial f } { \partial W _ { 2 } ^ { ( k ) } } ) ( \displaystyle \prod _ { j = 1 } ^ { i - 1 } W ^ { ( j ) } ) ^ { T } \right| } & { } \\ { \displaystyle } & { \leq \displaystyle \sum _ { k = i } ^ { n } \left\| \big ( \displaystyle \prod _ { j = i + 1 } ^ { k } W ^ { ( j ) } \big ) ^ { T } \big ( \frac { \partial f } { \partial W _ { 1 } ^ { ( k ) } } - \frac { \partial f } { \partial W _ { 2 } ^ { ( k ) } } \big ) ( \displaystyle \prod _ { j = 1 } ^ { i - 1 } W ^ { ( j ) } ) ^ { T } \right| } \\ & { \displaystyle \leq \displaystyle \sum _ { k = i } ^ { n } ( \displaystyle \frac { 1 } { \lambda ^ { ( i ) } } \displaystyle \prod _ { j = 1 } ^ { k } \lambda ^ { ( j ) } ) L ^ { ( k ) } \left\| W _ { 1 } ^ { ( k ) } - W _ { 2 } ^ { ( k ) } \right\| } \\ & { \displaystyle \leq ( \displaystyle \prod _ { j = 1 } ^ { i - 1 } \lambda ^ { ( j ) } ) L ^ { ( i ) } \left\| W _ { 1 } ^ { ( i ) } - W _ { 2 } ^ { ( k ) } \right\| } \end{array} +$$ + +We get the equality in (6) since $j > i$ and $W ^ { ( j ) }$ keeps the same for the computation of block-wise Lipschitz constant of $W ^ { ( i ) }$ . Based on the triangle inequality of norm, we get (7) from (6). We get (8) from (7) based on the inequality $\lVert W V \rVert \leq \lVert W \rVert \lVert V \rVert$ and the assumption of the smoothness for case I in (5). Finally, since we are evaluating the block-wise Lipschitz constant for $W ^ { ( i ) }$ , $W _ { 1 } ^ { ( k ) } = W _ { 2 } ^ { ( k ) }$ while $k \neq i$ , which leads to the final inequality (9). + +# C.4 PROOF OF THEOREM 4.3 + +Similarly, we assume the gradient variance of case I is bounded as + +$$ +\mathbb { E } \left\| \frac { \partial f } { \partial W ^ { ( i ) } } - \mathbb { E } \frac { \partial f } { \partial W ^ { ( i ) } } \right\| ^ { 2 } \leq ( \sigma ^ { ( i ) } ) ^ { 2 } +$$ + +The gradient variance of case $\mathrm { I I }$ is then bounded by + +$$ +\begin{array} { r l } { \mathbb { E } \left\| \displaystyle \frac { \partial \hat { f } } { \partial W ^ { ( i ) } } - \mathbb { E } \frac { \partial \hat { f } } { \partial W ^ { ( i ) } } \right\| ^ { 2 } = \mathbb { E } \left\| \displaystyle \sum _ { k = i } ^ { n } ( \displaystyle \prod _ { j = i + 1 } ^ { k } W ^ { ( j ) } ) ^ { T } ( \displaystyle \frac { \partial f } { \partial W ^ { ( k ) } } - \mathbb { E } \frac { \partial f } { \partial W ^ { ( k ) } } ) ( \displaystyle \prod _ { j = 1 } ^ { i - 1 } W ^ { ( j ) } ) ^ { T } \right\| ^ { 2 } } & { } \\ { \leq n \mathbb { E } \displaystyle \sum _ { k = i } ^ { n } \left\| ( \displaystyle \prod _ { j = i + 1 } ^ { k } W ^ { ( j ) } ) ^ { T } ( \displaystyle \frac { \partial f } { \partial W ^ { ( k ) } } - \mathbb { E } \frac { \partial f } { \partial W ^ { ( k ) } } ) ( \displaystyle \prod _ { j = 1 } ^ { i - 1 } W ^ { ( j ) } ) ^ { T } \right\| ^ { 2 } } & { } \\ { \leq n \displaystyle \sum _ { k = i } ^ { n } ( \displaystyle \frac { \sigma ^ { ( k ) } } { \lambda ^ { ( i ) } } \displaystyle \prod _ { j = 1 } ^ { k } \lambda ^ { ( j ) } ) ^ { 2 } } & { } \end{array} +$$ + +We get (12) from (11) based on Cauchy-Schwarz inequality. Based on the inequality $\| W V \| \leq$ $\| W \| \| V \|$ and the assumption of bounded gradient variance for case I in (10), we get the final inequality. \ No newline at end of file diff --git a/md/train/BJxpIJHKwB/BJxpIJHKwB.md b/md/train/BJxpIJHKwB/BJxpIJHKwB.md new file mode 100644 index 0000000000000000000000000000000000000000..db41d82f37fd8364e7cb2c0f730fb059c3535c75 --- /dev/null +++ b/md/train/BJxpIJHKwB/BJxpIJHKwB.md @@ -0,0 +1,417 @@ +# ATTENTIVE WEIGHTS GENERATION FOR FEW SHOTLEARNING VIA INFORMATION MAXIMIZATION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Few shot image classification aims at learning a classifier from limited labeled data. Generating the classification weights has been applied in many metalearning approaches for few shot image classification due to its simplicity and effectiveness. However, we argue that it is difficult to generate the exact and universal classification weights for all the diverse query samples from very few training samples. In this work, we introduce Attentive Weights Generation for few shot learning via Information Maximization (AWGIM), which addresses current issues by two novel contributions. i) AWGIM generates different classification weights for different query samples by letting each of query samples attends to the whole support set. ii) To guarantee the generated weights adaptive to different query sample, we re-formulate the problem to maximize the lower bound of mutual information between generated weights and query as well as support data. As far as we can see, this is the first attempt to unify information maximization into few shot learning. Both two contributions are proved to be effective in the extensive experiments and we show that AWGIM is able to achieve state-of-the-art performance on benchmark datasets. + +# 1 INTRODUCTION + +While deep learning methods achieve great success in domains such as computer vision (He et al., 2016), natural language processing (Devlin et al., 2018), reinforcement learning (Silver et al., 2018), their hunger for large amount of labeled data limits the application scenarios where only a few data are available for training. Humans, in contrast, are able to learn from limited data, which is desirable for deep learning methods. Few shot learning is thus proposed to enable deep models to learn from very few samples (Fei-Fei et al., 2006). + +Meta learning is by far the most popular and promising approach for few shot problems (Vinyals et al., 2016; Finn et al., 2017; Snell et al., 2017; Ravi & Larochelle, 2016; Rusu et al., 2019). In meta learning approaches, the model extracts high level knowledge across different tasks so that it can adapt itself quickly to a new-coming task (Schmidhuber, 1987; Andrychowicz et al., 2016). There are several kinds of meta learning methods for few shot learning, such as gradient-based (Finn et al., 2017; Ravi & Larochelle, 2016) and metric-based (Snell et al., 2017; Sung et al., 2018). Weights generation, among these different methods, has shown effectiveness with simple formulation (Qi et al., 2018; Qiao et al., 2018; Gidaris & Komodakis, 2018; 2019). In general, weights generation methods learn to generate the classification weights for different tasks conditioned on the limited labeled data. However, fixed classification weights for different query samples within one task might be sub-optimal, due to the few shot challenge. + +We introduce Attentive Weights Generation for few shot learning via Information Maximization (AWGIM) in this work to address these limitations. In AWGIM, the classification weights are generated for each query sample specifically. This is done by two encoding paths where the query sample attends to the task context. However, we show in experiments that simple cross attention between query samples and support set fails to guarantee classification weights fitted to diverse query data since the query-specific information is lost during weights generation. Therefore, we propose to maximize the lower bound of mutual information between generated weights and query, support data. As far as we know, AWGIM is the first work introducing Variational Information Maximization in few shot learning. The induced computational overhead is minimal due to the nature of few shot problems. Furthermore, by maximizing the lower bound of mutual information, AWGIM gets rid of inner update without compromising performance. + +AWGIM is evaluated on two benchmark datasets and shows state-of-the-art performance. We also conducted detailed analysis to validate the contribution of each component in AWGIM. + +# 2 RELATED WORKS + +# 2.1 FEW SHOT LEARNING + +Learning from few labeled training data has received growing attentions recently. Most successful existing methods apply meta learning to solve this problem and can be divided into several categories. In the gradient-based approaches, an optimal initialization for all tasks is learned (Finn et al., 2017). Ravi & Larochelle (2016) learned a meta-learner LSTM directly to optimize the given fewshot classification task. Sun et al. (2019) learned the transformation for activations of each layer by gradients to better suit the current task. + +In the metric-based methods, a similarity metric between query and support samples is learned. (Koch et al., 2015; Vinyals et al., 2016; Snell et al., 2017; Sung et al., 2018; Li et al., 2019a). Spatial information or local image descriptors are also considered in some works to compute richer similarities (Lifchitz et al., 2019; Li et al., 2019b; Wertheimer & Hariharan, 2019). + +Generating the classification weights directly has been explored by some works. Gidaris & Komodakis (2018) generated classification weights as linear combinations of weights for base and novel classes. Similarly, Qiao et al. (2018) and Qi et al. (2018) both generated the classification weights from activations of a trained feature extractor. Graph neural network denoising autoencoders are used in (Gidaris & Komodakis, 2019). Munkhdalai & Yu (2017) proposed to generate “fast weights” from the loss gradient for each task. All these methods do not consider generating different weights for different query examples, nor maximizing the mutual information. + +There are some other methods for few-shot classification. Generative models are used to generate or hallucinate more data in (Zhang et al., 2018; Wang et al., 2018; Chen et al., 2019). Bertinetto et al. (2019) and Lee et al. (2019) used the closed-form solutions directly for few shot classification. Liu et al. (2019) integrated label propagation on a transductive graph to predict the query class label. + +# 2.2 ATTENTION + +Attention mechanism shows great success in computer vision (Xu et al., 2015; Parmar et al., 2018) and natural language processing (Bahdanau et al., 2015; Vaswani et al., 2017). It is effective in modeling the interaction between queries and key-value pairs from certain context. Based on the fact that keys and queries point to the same entities or not, people refer to attention as self attention or cross attention. In this work, we use both types of attention to encode the task and query-task information. The work most similar to ours is Attentive Neural Processes (Kim et al., 2019), which also employs self and cross attention. However, we are using attention for few-shot image classification via maximizing the mutual information. In stark contrast, Kim et al. (2019) worked on regression from the perspective of a stochastic process and the variational objective is optimized. + +# 2.3 MUTUAL INFORMATION + +Given two random variables $\mathbf { X }$ and $\mathsf { y }$ , mutual information $I ( { \bf x } ; { \bf y } )$ measures the decrease of uncertainty in one random variable when another is known. It is defined as the Kullback-Leibler divergence between joint distribution $p ( \mathbf { x } , \mathbf { y } )$ and product of marginal distributions $p ( \mathbf { x } ) \otimes p ( \mathbf { y } )$ , + +$$ +I ( \mathbf { x } ; \mathbf { y } ) = D _ { \mathrm { K L } } ( p ( \mathbf { x } , \mathbf { y } ) \| p ( \mathbf { x } ) \otimes p ( \mathbf { y } ) ) . +$$ + +When x and y are independent, $p ( \mathbf { x } , \mathbf { y } ) = p ( \mathbf { x } ) \otimes p ( \mathbf { y } )$ so that $I ( { \bf x } , { \bf y } ) = 0$ , indicating that knowing $\mathbf { X }$ does not reveal any information about y. When y is a deterministic function of $\mathbf { X }$ , $I ( \mathbf { x } , \mathbf { y } )$ achieves its maximum value. Mutual information has been widely applied in applications such as Generative Adversarial Networks(Chen et al., 2016), self-supervised learning(Hjelm et al., 2019), visual question generation Krishna et al. (2019) and so on. + +![](images/1337a8d6253363eec5b99fdb1e3eb590ae641d0447bd8c18d057cba309ac3b81.jpg) +Figure 1: The overview of our proposed AWGIM. The input task is 5-way 1-shot with $\mathbf { X }$ as support set and $\hat { \bf x }$ as one query example. Different colors of the data in support set indicate different categories. The encoding process in contextual path produces context-aware support representations $\mathbf { X } ^ { c p }$ . Similarly, the attentive path enables the query sample $\hat { \bf x }$ to be equipped with task knowledge. Both paths are achieved by attention mechanism. $\hat { \mathbf { x } } ^ { a p }$ is repeated to concatenate with $\mathbf { X } ^ { c p }$ . The weight generator $g$ takes these concatenated representations as input to generate classification weights W specific for $\hat { \bf x }$ , denoted by the colorful matrix with slash. It can be used to predict the class label for $\hat { \bf x }$ and X. W is also used to reconstruct the inputs of the generator $g$ by two networks $r _ { 1 }$ and $r _ { 2 }$ . In this way, the lower bound of mutual information is maximized and $g$ is forced to generate classification weights sensitive to different query samples. + +# 3 PROPOSED METHOD + +In this section, we provide the problem formulation first. Then the proposed model is described in Sec. 3.3. The objective function, which maximizes the mutual information between certain variables, and theoretical analysis are provided in Sec. 3.4. + +# 3.1 PROBLEM FORMULATION + +Following many popular meta-learning methods for few shot classification, we formulate the problem under episodic training paradigm (Vinyals et al., 2016; Finn et al., 2017). One $N$ -way $K$ -shot task sampled from an unknown task distribution $P ( \tau )$ includes support set and query set: + +$$ +{ \mathcal { T } } = ( { \mathcal { S } } , { \mathcal { Q } } ) , +$$ + +where $\mathcal { S } = \{ ( \mathbf { x } ^ { c _ { n } ; k } , \mathbf { y } ^ { c _ { n } ; k } ) | k = 1 , . . . , K ; n = 1 , . . . , N \}$ , $\mathcal { Q } = \{ ( \hat { \mathbf { x } } _ { 1 } , . . . , \hat { \mathbf { x } } _ { | \mathcal { Q } | } ) \}$ . Support set $s$ contains $N K$ labeled samples. Query set $\mathcal { Q }$ includes $\hat { \bf x }$ and we need to predict label $\hat { \mathbf { y } }$ for $\hat { \bf x }$ based on $s$ . During meta-training, the meta-loss is estimated on $\mathcal { Q }$ to optimize the model. During metatesting, the performance of meta-learning method is evaluated on $\mathcal { Q }$ , provided the labeled $s$ . The classes used in meta-training and meta-testing are disjoint so that the meta-learned model needs to learn the knowledge transferable across tasks and adapt itself quickly to novel tasks. + +Our proposed approach follows the general framework to generate the classification weights (Qi et al., 2018; Qiao et al., 2018; Rusu et al., 2019; Gidaris & Komodakis, 2018; 2019). In this framework, there is a feature extractor to output image feature embeddings. The meta-learner needs to generate the classification weights for different tasks. + +# 3.2 LATENT EMBEDDING OPTIMIZATION + +Latent Embedding Optimization (LEO) (Rusu et al., 2019) is one of the weights generation methods that is most related to our work. In LEO, the latent code $_ z$ is generated by $h$ conditioned on support set $s$ , described as $z = h ( S )$ . $h$ is instantiated as relation networks (Santoro et al., 2017). Classification weights $\pmb { w }$ can be decoded from $_ { z }$ with $l$ , $w = l ( z )$ . In the inner loop, we use $\pmb { w }$ to compute the loss (usually cross entropy) on the support set and then update $_ z$ : + +$$ +\begin{array} { r } { z ^ { \prime } = z - \eta \nabla _ { z } \mathcal { L } _ { \mathcal { S } } ( \pmb { w } ) , } \end{array} +$$ + +where $\mathcal { L } _ { S }$ indicates that the loss is evaluated on $s$ only. The updated latent code $z ^ { \prime }$ is used to decode new classification weights $\mathbf { \Delta } \mathbf { w ^ { \prime } }$ with generating function $l$ . $\mathbf { \Delta } _ { \mathbf { \ b { w } } ^ { \prime } }$ is adopted in the outer loop for query set $\mathcal { Q }$ and the objective function of LEO then can be written as + +$$ +\operatorname* { m i n } _ { \theta } \mathcal { L } _ { \mathcal { Q } } ( w ^ { \prime } ) . +$$ + +Here $\theta$ stands for the parameters of $h$ and $l$ and we omit the regularization terms for clarity. LEO avoids updating high-dimensional $\textbf { \em w }$ in the inner loop by learning a lower-dimensional latent space, from which sampled $_ z$ can be used to generate $\pmb { w }$ . The most significant difference between LEO and AWGIM is that we do not need inner updates to adapt the model. Instead, AWGIM is a feedforward network trained to maximize the mutual information so that it fits to different tasks well. On the other hand, AWGIM learns to generate optimal classification weights for each query sample while LEO generates fixed weights conditioned on the support set within one task. In Section 3.4 we will show LEO can be casted as a special case of AWGIM under certain conditions. + +# 3.3 ATTENTIVE WEIGHTS GENERATION + +The framework of our proposed method is shown in Figure 1. Assume that we have a feature extractor, which can be a simple 4-layer Convnet or a deeper Resnet. All the images included in the sampled task $\tau$ are processed by this feature extractor and represented as $d$ -dimensional vectors afterwards, i.e., $\mathbf { x } ^ { c _ { n } ; k } , \hat { \mathbf { x } } \in \mathbb { R } ^ { d }$ . There are two paths to encode the task context and the individual query sample respectively, which are called contextual path and attentive path. The outputs of both paths are concatenated together as input to the generator for classification weights. Generated classification weights are used to not only predict the label of $\hat { \bf x }$ , but also maximize the lower bound of mutual information between itself and other variables, which will be discussed in the following section 3.4. + +# 3.3.1 CONTEXTUAL AND ATTENTIVE PATHS + +The encoding process includes two paths, namely the contextual path and attentive path. The contextual path aims at learning representations for only the support set with a multi-head self-attention network $f _ { s a } ^ { c p }$ (Vaswani et al., 2017). The outputs of contextual path ${ \bf X } ^ { c p } \in \mathbb { R } ^ { N K \times d _ { h } }$ 1 thus contain richer information about the task and can be used later for weights generation. + +Existing weights generation methods generate the classification weights conditioned on the support set only, which is equivalent to using contextual path. However, the classification weights generated in this way might be sub-optimal. This is because estimating the exact and universal classification weights from very few labeled data in the support set is difficult and sometimes impossible. The generated weights are usually in lack of adaptation to different query samples. We address this issue by introducing attentive path, where the individual query example attends to the task context and then is used to generate the classification weights. Therefore, the classification weights are adaptive to different query samples and aware of the task context as well. + +In the attentive path, a new multi-head self-attention network $f _ { s a } ^ { a p }$ on the support set is employed to encode the global task information. $f _ { s a } ^ { a p }$ is different from $f _ { s a } ^ { c p }$ in contextual path because the selfattention network in contextual path emphasizes on generating the classification weights. On the contrary, outputs of self-attention here plays the role of providing the V alue context for different query samples to attend in the following cross attention. Sharing the same self-attention networks might limit the expressiveness of learned representations in both paths. The cross attention network $f _ { c a } ^ { a p }$ applied on each query sample and task-aware support set is followed to produce $\hat { \bf X } ^ { a p } \in \mathbb { R } ^ { | \mathcal { Q } | \times d _ { h } }$ . + +We use multi-head attention with $h$ heads in both paths. In one attention block, we produce $h$ different sets of queries, keys and values. Multi-head attention is claimed to be able to learn more comprehensive and expressive representations from $h$ different subspaces (Vaswani et al., 2017; Voita et al., 2019). More details of these two paths can be found in A.2. + +# 3.3.2 WEIGHTS GENERATOR + +We replicate them afterwa ${ \bf X } ^ { c p } \in \mathbb { R } ^ { N K \times d _ { h } }$ anve $\hat { \bf X } ^ { a p } \in \mathbb { R } ^ { | \mathcal { Q } | \times d _ { h } }$ r $| \mathcal { Q } |$ $N K$ ectively and reshape. These two tensors $\pmb { \chi } ^ { c p } \in \mathbb { R } ^ { | \mathcal { Q } | \times N K \times d _ { h } }$ $\hat { \pmb { \mathsf { X } } } ^ { a p } \in \mathbb { R } ^ { | \mathcal { Q } | \times N K \times d _ { h } }$ + +$d _ { h } < d$ is the hidden dimension. We use matrix form here to be consistent with the description in 3.3.2. + +are concatenated to become $\pmb { \chi } ^ { c p \oplus a p } \in \mathbb { R } ^ { | \mathcal { Q } | \times N K \times 2 d _ { h } }$ . $\mathbf { \pmb { \chi } } ^ { c p \oplus a p }$ can be interpreted that each query sample has its own latent representations for support set to generate specific classification weights, which are both aware of the task-context and adaptive to individual query sample. + +$\mathbf { X } ^ { c p \oplus a p }$ is decoded by the weights generator $g : \mathbb { R } ^ { 2 d _ { h } } \mathbb { R } ^ { 2 d }$ . We assume that the classification weights follow Gaussian distribution with diagonal covariance. $g$ outputs the distribution parameters and we sample the weights from learned distribution during meta-training. The sampled classification weights are represented as $\pmb { \mathsf { W } } \in \mathbb { R } ^ { | \mathcal { Q } | \times N K \times d }$ . To reduce complexity, we compute the mean value on $K$ classification weights for each class to have ${ \pmb W } ^ { f i n a l } \in \mathbb { R } ^ { | \mathcal { Q } | \times N \times d }$ . Therefore, ith query sample has its specifican be computed by c classifica Wf inali,:,: tion weight matrix . The support data $\pmb { \mathsf { W } } _ { i , : , : } ^ { f i n a l } \in \mathbb { R } ^ { N \times d }$ . Th for rediction for query datatimes and reshaped as $\hat { \mathbf { X } } \mathbf { W } ^ { f i n a l \mathbf { T } }$ $\mathbf { X }$ $| \mathcal { Q } |$ $\pmb { \chi } _ { s } \in \mathbb { R } ^ { | \mathcal { Q } | \times N K \times d }$ . So the prediction for support data can also be computed as ${ \pmb x } _ { s } { \pmb w } ^ { f i n a l { \bf T } }$ . + +Besides the weights generator $g$ , we have another two decoders $r _ { 1 } : \mathbb { R } ^ { d } \mathbb { R } ^ { d _ { h } }$ and $r _ { 2 } : \mathbb { R } ^ { d } $ $\mathbb { R } ^ { d _ { h } }$ . They both take the generated weights $\boldsymbol { \mathsf { W } }$ as inputs and learn to reconstruct $\mathbf { X } ^ { c p }$ and ${ \hat { \mathbf { X } } } ^ { a p }$ respectively. The outputs of $r _ { 1 }$ and $r _ { 2 }$ are denoted as $\bar { \pmb { \chi } } _ { r e } ^ { c p } , \hat { \pmb { \chi } } _ { r e } ^ { a p } \in \mathbb { R } ^ { | \mathcal { Q } | \times N K \times d _ { h } }$ . The reason we are using reconstruction as auxiliary tasks will be discussed in following Sec. 3.4. + +# 3.4 INFORMATION MAXIMIZATION + +In this section, we perform the analysis for one query sample without loss of generality. The subscripts for classification weights are omitted for clarity. In general, we use $\displaystyle ( \mathbf { x } , \mathbf { y } )$ and $( \hat { \mathbf { x } } , \hat { \mathbf { y } } )$ to represent support and query samples respectively. + +Since the classification weights w generated from $g$ are encoded with attentive path and contextual path, it is expected that we can directly have the query-specific weights. However, we show in the experiments that simply doing this does not outperform a weight generator conditioned only on the $s$ significantly, which implies that the generated classification weights from two paths are not sensitive to different query samples. In other words, the information from attentive path is not kept well during the weights generation. + +To address this limitation, we propose to maximize the mutual information between generated weights w and support as well as query data. The objective function can be described as + +$$ +\operatorname* { m a x } I ( ( \hat { \mathbf { x } } , \hat { \mathbf { y } } ) ; \mathbf { w } ) + \sum _ { ( \mathbf { x } , \mathbf { y } ) \in S } I ( ( \mathbf { x } , \mathbf { y } ) ; \mathbf { w } ) +$$ + +According to the chain rule of mutual information, we have + +$$ +I ( ( \hat { \mathbf { x } } , \hat { \mathbf { y } } ) ; \mathbf { w } ) = I ( \hat { \mathbf { x } } ; \mathbf { w } ) + I ( \hat { \mathbf { y } } ; \mathbf { w } | \hat { \mathbf { x } } ) . +$$ + +Equation 6 stands for both terms in 5. So the objective function can be written as + +$$ +\operatorname* { m a x } I ( \hat { \mathbf { x } } ; \mathbf { w } ) + I ( \hat { \mathbf { y } } ; \mathbf { w } | \hat { \mathbf { x } } ) + \sum _ { ( \mathbf { x } , \mathbf { y } ) \in \mathcal { S } } [ I ( \mathbf { x } ; \mathbf { w } ) + I ( \mathbf { y } ; \mathbf { w } | \mathbf { x } ) ] . +$$ + +Directly computing the mutual information in Equation 7 is intractable since the true posteriori distributions like $p ( \hat { \mathbf { y } } | \hat { \mathbf { x } } , \mathbf { w } )$ , $p ( \hat { \mathbf { x } } | \mathbf { w } )$ are still unknown. Therefore, we use Variational Information Maximization (Barber & Agakov, 2003; Chen et al., 2016) to compute the lower bound of Equation 5. We use $p _ { \theta } ( \hat { \mathbf { x } } | \mathbf { w } )$ to approximate the true posteriori distribution, where $\theta$ represents the model parameters. As a result, we have + +$$ +\begin{array} { r c l } { I ( \hat { \mathbf { x } } ; \mathbf { w } ) } & { = } & { H ( \hat { \mathbf { x } } ) - H ( \hat { \mathbf { x } } | \mathbf { w } ) } \\ & { = } & { H ( \hat { \mathbf { x } } ) + \mathbb { E } _ { \mathbf { w } \sim p ( \mathbf { w } | \hat { \mathbf { x } } , S ) } [ \mathbb { E } _ { \hat { \mathbf { x } } \sim p ( \hat { \mathbf { x } } | \mathbf { w } ) } [ \log p ( \hat { \mathbf { x } } | \mathbf { w } ) ] ] } \\ & { = } & { H ( \hat { \mathbf { x } } ) + \mathbb { E } _ { \mathbf { w } \sim p ( \mathbf { w } | \hat { \mathbf { x } } , S ) } [ D _ { \mathrm { K L } } ( p ( \hat { \mathbf { x } } | \mathbf { w } ) | | p \theta ( \hat { \mathbf { x } } | \mathbf { w } ) ) + \mathbb { E } _ { \hat { \mathbf { x } } \sim p ( \hat { \mathbf { x } } | \mathbf { w } ) } [ \log p _ { \theta } ( \hat { \mathbf { x } } | \mathbf { w } ) ] ] } \\ & { \geq } & { H ( \hat { \mathbf { x } } ) + \mathbb { E } _ { \mathbf { w } \sim p ( \mathbf { w } | \hat { \mathbf { x } } , S ) } [ \mathbb { E } _ { \hat { \mathbf { x } } \sim p ( \hat { \mathbf { x } } | \mathbf { w } ) } [ \log p \theta ( \hat { \mathbf { x } } | \mathbf { w } ) ] ] } \end{array} +$$ + +$H ( \cdot )$ is the entropy of a random variable. $H ( { \hat { \mathbf { x } } } )$ is a constant value for given data. We can maximize this lower bound as the proxy for the true mutual information. + +Similar to $I ( \hat { \mathbf { x } } ; \mathbf { w } )$ + +$$ +I ( \hat { \mathbf { y } } ; \mathbf { w } | \hat { \mathbf { x } } ) \geq H ( \hat { \mathbf { y } } | \hat { \mathbf { x } } ) + \mathbb { E } _ { \mathbf { w } \sim p ( \mathbf { w } | \hat { \mathbf { x } } , S ) } [ \mathbb { E } _ { \hat { \mathbf { y } } \sim p ( \hat { \mathbf { y } } | \hat { \mathbf { x } } , \mathbf { w } ) } [ \log p _ { \theta } ( \hat { \mathbf { y } } | \hat { \mathbf { x } } , \mathbf { w } ) ] ] , +$$ + +$$ +\begin{array} { r } { \displaystyle \sum _ { \mathbf { x } , \mathbf { y } ) \in S } I ( ( \mathbf { x } , \mathbf { y } ) ; \mathbf { w } ) \geq \displaystyle \sum _ { ( \mathbf { x } , \mathbf { y } ) \in S } H ( ( \mathbf { x } , \mathbf { y } ) ) + \mathbb { E } _ { \mathbf { w } \sim p ( \mathbf { w } | \hat { \mathbf { x } } , S ) } [ \mathbb { E } _ { ( \mathbf { x } , \mathbf { y } ) \sim p ( ( \mathbf { x } , \mathbf { y } ) | \mathbf { w } ) } [ \log p _ { \theta } ( \mathbf { x } | \mathbf { w } ) + \log p _ { \theta } ( \mathbf { y } | \mathbf { x } , \mathbf { w } ) ] , } \end{array} +$$ + +$p _ { \theta } ( \hat { \mathbf { x } } | \mathbf { w } ) , p _ { \theta } ( \mathbf { x } , \mathbf { y } | \mathbf { w } )$ are used to approximate the true posteriori distribution $p ( \hat { \mathbf { x } } | \mathbf { w } )$ and $p ( \mathbf { x } , \mathbf { y } | \mathbf { w } )$ . + +Put the lower bounds back into Equation 7. Omit the constant entropy terms and the expectation subscripts for clarity, we have the new objective function as + +$$ +\operatorname* { m a x } _ { \theta } \mathbb { E } [ \log p _ { \theta } ( \hat { \mathbf { y } } | \hat { \mathbf { x } } , \mathbf { w } ) + \log p _ { \theta } ( \mathbf { y } | \mathbf { x } , \mathbf { w } ) + \log p _ { \theta } ( \mathbf { x } | \mathbf { w } ) + \log p _ { \theta } ( \hat { \mathbf { x } } | \mathbf { w } ) ] . +$$ + +The first two terms are maximizing the log likelihood of label for both support and query data with respective to the network parameters, given the generated classification weights. This is equivalent to minimizing the cross entropy between prediction and ground-truth. We assume that $p _ { \theta } ( \hat { \mathbf { x } } | \mathbf { w } )$ and $p _ { \theta } ( \mathbf { x } | \mathbf { w } )$ are Gaussian distributions. $r _ { 1 }$ and $r _ { 2 }$ are used to approximate the mean of these two Gaussian distributions. Therefore maximizing the log likelihood is equivalent to reconstruct $\mathbf { x } ^ { c p }$ and $\hat { \mathbf { x } } ^ { a p }$ with $L 2$ loss. Thus the loss function to train the network can be written as + +$$ +L = \mathrm { C E } ( \hat { \bf y } _ { p r e d } , \hat { \bf y } ) + \lambda _ { 1 } \sum _ { { \bf y } \in \mathcal { S } } \mathrm { C E } ( { \bf y } _ { p r e d } , { \bf y } ) + \lambda _ { 2 } \sum _ { { \bf x } ^ { c p } \in \mathcal { S } } | | { \bf x } ^ { c p } - { \bf x } _ { r e } ^ { c p } | | _ { 2 } + \lambda _ { 3 } | | \hat { \bf x } ^ { a p } - \hat { \bf x } _ { r e } ^ { a p } | | _ { 2 } . +$$ + +CE here stands for cross entropy. $\mathbf { x } ^ { c p }$ and $\hat { \mathbf { x } } ^ { a p }$ are the inputs to weights generator $g$ . $\mathbf { x } _ { r e } ^ { c p } \sim p _ { \theta } ( \mathbf { x } | \mathbf { w } )$ and $\hat { \mathbf { x } } _ { r e } ^ { a p } \sim p _ { \theta } ( \hat { \mathbf { x } } | \mathbf { w } )$ are the reconstruction of $\mathbf { x } ^ { c p }$ and $\hat { \mathbf { x } } ^ { a p }$ . Since we convert the log likelihood in Equation 14 to mean square error or cross entropy in Equation 15 to optimize, the value of each term in Equation 15 is not equal to real log likelihood and we have to decide the weightage for each one. $\lambda _ { 1 } , \lambda _ { 2 } , \lambda _ { 3 }$ are thus hyper-parameters for trade-off of different terms. With the help of last three terms, the generated classification weights are forced to carry information about the support data and the specific query sample. + +In LEO (Rusu et al., 2019), the inner update loss is computed as cross entropy on support data. If we merge the inner update into outer loop, then the loss becomes the summation of first two terms in Equation 15. However, the weight generation in LEO does not involve specific query samples, thus making reconstructing $\hat { \mathbf { x } } ^ { a p }$ impossible. In this sense, LEO can be regarded as a special case of our proposed method, where (1) only contextual path exits and (2) $\lambda _ { 2 } = \lambda _ { 3 } = 0$ . + +# 3.5 COMPLEXITY ANALYSIS + +The encoding process in contextual path results in computational complexity $O ( ( N K ) ^ { 2 } )$ due to self-attention. Similarly, the computational complexity of attentive path is $O ( ( N K ) ^ { 2 } + | \mathcal { Q } | ( N K ) )$ . In total, the complexity is ${ \cal O } ( ( \bar { N } K ) ^ { 2 } + | \mathcal { Q } | ( \bar { N ^ { } } K ) )$ . However, because of the nature of few-shot learning problem, the value of $( N K ) ^ { 2 }$ is usually negligible. The value of $| \mathcal { Q } |$ depends on the setting and the cross attention can be implemented parallelly via matrix multiplication. Therefore, the induced computational overhead will be negligible. AWGIM avoids the inner update without compromising the performance, which furthers reduces both training and inference time significantly. The empirical evaluation is presented in A.3.4. + +# 4 EXPERIMENTS + +# 4.1 DATASETS AND PROTOCOLS + +We conduct experiments on miniImageNet (Vinyals et al., 2016) and tieredImageNet (Ren et al., 2018), two commonly used benchmark datasets, to compare with other methods and analyze our model. Both datasets are subsets of ILSVRC-12 dataset (Russakovsky et al., 2015). miniImageNet contains 100 randomly sampled classes with 600 images per class. We follow the train/test split in (Ravi & Larochelle, 2016), where 64 classes are used for meta-training, 16 for meta-validation and 20 for meta-testing. tieredImageNet is a larger dataset compared to miniImageNet. There are 608 classes and 779,165 images in total. They are selected from 34 higher level nodes in ImageNet (Deng et al., 2009) hierarchy. 351 classes from 20 high level nodes are used for meta-training, 97 from 6 nodes for meta-validation and 160 from 8 nodes for meta-testing. + +We use the image features in LEO (Rusu et al., 2019) provided by the authors 2. They trained a 28-layer Wide Residual Network (Zagoruyko & Komodakis, 2016) on the meta-training set. Each image then is represented by a 640 dimensional vector, which is used as the input to our model. + +For $N$ -way $K$ -shot experiments, we randomly sample $N$ classes from meta-training set and each of them contains $K$ samples as the support set and 15 as query set. Similar to other works, we train 5-way 1-shot and 5-shot models on two dataset. During meta-testing, 600 $N$ -way $K$ -shot tasks are sampled from meta-testing set and the average accuracy for query set is reported with $9 5 \%$ confidence interval, as done in recent works (Finn et al., 2017; Snell et al., 2017; Rusu et al., 2019). + +# 4.2 IMPLEMENTATION DETAILS + +We use TensorFlow (Abadi et al., 2016) to implement our method and the code will be made available. $d = 6 4 0$ is the dimension of feature embeddings. $d _ { h }$ is set to be 128. The number of heads $h$ in attention module is set to be 4. $g , r _ { 1 }$ and $r _ { 2 }$ are 2-layer MLPs with 256 hidden units. We decide $\lambda _ { 1 } = 1$ , $\lambda _ { 2 } = \lambda _ { 3 } = 0 . 0 0 1$ by meta-validation performance. + +Table 1: Accuracy comparison with other approaches on miniImageNet. The results are averaged on 600 tasks from meta-testing set with $9 5 \%$ confidence interval. Best results are highlighted. + +
ModelFeature Extractor5-way 1-shot5-way 5-shot
Matching Networks (Vinyals et al., 2016)Conv-446.6060.00
MAML(Finn et al.,2017)Conv-448.70 ± 1.84%63.11 ± 0.92%
Meta LSTM (Ravi & Larochelle, 2016)Conv-443.44 ± 0.77%60.60 ± 0.71%
Prototypical Nets (Snell et al.,2017)Conv-449.42 ± 0.78%68.20 ± 0.66%
Relation Nets (Sung et al.,2018)Conv-450.44 ± 0.82%65.32 ± 0.70%
SNAIL (Mishra et al., 2018)Resnets-1255.71 ± 0.99%68.88 ± 0.92%
TPN (Liu et al., 2019)Resnets-1259.4675.65
MTL (Sun et al., 2019)Resnets-1261.20 ± 1.80%75.50 ± 0.80
Dynamic (Gidaris & Komodakis,2018)WRN-28-1060.06 ± 0.14%76.39 ± 0.11%
Prediction (Qiao et al., 2018)WRN-28-1059.60 ± 0.41%73.74 ± 0.19%
DAE-GNN (Gidaris & Komodakis,2019)WRN-28-1062.96 ± 0.15%78.85 ± 0.10%
LEO (Rusu et al., 2019)WRN-28-1061.76 ± 0.08%77.59 ± 0.12%
AWGIM (ours)WRN-28-1063.12 ± 0.08%78.40 ± 0.11%
+ +Table 2: Accuracy comparison with other approaches on tieredImageNet. The results are averaged on 600 tasks from meta-testing set with $9 5 \%$ confidence interval. Best results are highlighted. + +
ModelFeature Extractor5-way 1-shot5-way 5-shot
MAML (Finn et al., 2017)Conv-451.67 ± 1.81%70.30 ± 1.75%
Prototypical Nets (Snell et al., 2017)Conv-453.31± 0.89%72.69 ± 0.74%
Relation Nets (Sung et al., 2018)Conv-454.48 ± 0.93%71.32 ± 0.78%
TPN (Liu et al., 2019)Conv-459.91 ± 0.96%72.85 ± 0.74%
MetaOptNet (Lee et al., 2019)Resnets-1265.81 ± 0.74%81.75 ± 0.53%
LEO (Rusu et al., 2019)WRN-28-1066.33 ± 0.05%81.44 ± 0.09%
AWGIM (ours)WRN-28-1067.69 ± 0.11%82.82 ± 0.13%
+ +ADAMW Loshchilov & Hutter (2017) is used to optimize the network with weight decay $1 \times 1 0 ^ { - 6 }$ . The initial learning rate is set to 0.0002 for 5-way 1-shot and 0.001 for 5-way 5-shot, which is decayed by 0.2 for every 15,000 iterations. We train the model for 50,000 iterations. Batch size is 64 for 5-way 1-shot and 32 for 5-way 5-shot. Similar to LEO (Rusu et al., 2019), we first train the model on meta-training set and choose the optimal hyper-parameters by validation results. Then we train the model on meta-training and meta-validation sets together using fixed hyper-parameters. + +# 4.3 COMPARISON WITH OTHER METHODS + +We compare the performance of our approach AWGIM on two datasets with several state-of-theart methods proposed in recent years. The results of MAML, Prototypical Nets, Relation Nets on tieredImageNet are evaluated by Liu et al. (2019). The results of Dynamic on miniImageNet with WRN-28-10 as the feature extractor is reported in (Gidaris & Komodakis, 2019). The other results are reported in the corresponding original papers. We also include the backbone network structure of the used feature extractor for reference. The results on miniImageNet and tieredImageNet are shown in Table 1 and 2 respectively. + +The top half parts of Table 1 and 2 display the methods belonging with different meta learning categories, such as metric-based(Matching Networks, Prototypical Nets), gradient-based (MAML, MTL), graph-based (TPN). The bottom part shows the classification weights generation approaches including Dynamic, Prediction, DAE-GNN, LEO and our proposed AWGIM. + +AWGIM can outperform all the methods in top parts of two table. Comparing with other classification weights generation methods in the bottom part, AWGIM still shows very competitive performance, namely the best on tieredImageNet and close to the state-of-the-art on miniImageNet. We note that all the classification weights generation methods are using WRN-28-10 as backbone network, which makes the comparison fair. In particular, AWGIM can outperform LEO in all settings. + +# 4.4 ANALYSIS + +Table 3: Analysis of our proposed AWGIM. In the top half, the attentive path is removed to compare with LEO. In the bottom part, ablation analysis with respective to different components is provided. We also shuffle the generated classification weights randomly to show that they are indeed optimal for different query samples. + +
ModelminiImageNettieredImageNet
5-way 1-shot5-way 5-shot 5-way 1-shot5-way 5-shot
LEO61.76 %77.59 %66.33%81.44 %
Generator in LEO60.33 %74.53 %65.17%78.77 %
Generator conditioned on S only61.02%74.33%66.22%79.66%
Generator conditioned on S with IM62.04%77.54%66.43%81.73%
MLP encoding,入1 = 入2= 入3=058.95%71.68%63.92%75.80%
MLP encoding62.26%76.91%65.84%79.24%
入1=λ2=λ3=061.61%74.14%65.65%79.93%
入1=入2=062.06%74.18%65.85%80.42%
入3=062.91%77.88%67.27%81.67%
入1=062.19%74.21%66.82%80.61%
2=入g=062.12%77.65%66.86%81.03%
random shuffle in class62.87%77.48%67.52%82.55%
random shuffle between classes61.20%77.48%66.55%82.53%
AWGIM (ours)63.12%78.40%67.69 %82.82%
+ +We perform detailed analysis on AWGIM, shown in Table 3. We include the results of LEO Rusu et al. (2019) for reference. “Generator in LEO” means that there is no inner update in LEO. In the upper part of the table, we first studied the effect of attentive path. We implemented two generators including only the contextual path during encoding. “Generator conditioned on $s$ with IM” indicates that we add the cross entropy loss and reconstruction loss for support set. It can be observed that “Generator conditioned on $s$ only” is trained with cross entropy on query set, which is similar to “Generator in LEO” without inner update. It is able to achieve similar or slightly better results than “Generator in LEO”, which implies that self-attention is no worse than relation networks used in LEO to model task-context. With information maximization, our generator is able to obtain slightly better performance than LEO. + +The effect of attention is investigated by replacing the attention modules with 2-layer MLPs, which is shown as “MLP encoding”. More specifically, one MLP in contextual path is used for support set and another MLP in attentive path for query samples. We can see that even without attention to encode the task-contextual information, “MLP encoding” can achieve accuracy close to LEO, for the sake of information maximization. However, if we let $\lambda _ { 1 } = \lambda _ { 2 } = \lambda _ { 3 } = 0$ for MLP encoding, the performance drops significantly, which demonstrates the importance of maximizing the information. + +We conducted ablation analysis with respective to $\lambda _ { 1 } , \lambda _ { 2 }$ and $\lambda _ { 3 }$ to investigate the effect of information maximization. First, $\lambda _ { 1 }$ , $\lambda _ { 2 }$ and $\lambda _ { 3 }$ are all set to be 0. In this case, the accuracy is similar to “generator conditioned on $s$ only”, showing that the generated classification weights are not fitted for different query samples, even with the attentive path. It can also be observed that maximizing the mutual information between weights and support is more crucial since $\lambda _ { 1 } = \lambda _ { 2 } = 0$ degrades accuracy significantly, comparing with $\lambda _ { 3 } = 0$ . We further investigate the relative importance of the classification on support as well as reconstruction. $\lambda _ { 1 } = 0$ affects the performance noticeably. We conjecture that the support label prediction is more critical for information maximization. + +The classification weights are generated specifically for each query sample in AWGIM. To this point, we shuffle the classification weights between query samples within the same classes and between different classes as well to study whether the classification weights are adapted for different query samples. Assume there are T query samples per class in one task. Wf inal ∈ R|Q|×N×d can be reshaped into Wf inal $\mathbf { W } ^ { f i n a l } \in \mathbb { R } ^ { N \times T \times N \times \bar { d } }$ . Then we shuffle this weight tensor along the first and second axis randomly. The results are shown as “random shuffle between classes” and “random shuffle in class” in Table 3. For 5-way 1-shot experiments, the random shuffle between classes degrades the accuracy noticeably while the random shuffle in class dose not affect too much. This indicates that when the support data are very limited, the generated weights for query samples from the same class are very similar to each other while distinct for different classes. When there are more labeled data in support set, two kinds of random shuffle show very close or even the same results in 5-way 5-shot experiments, which are both worse than the original ones. This implies that the generated classification weights are more diverse and specific for each query sample in 5-way 5-shot setting. The possible reason is that larger support set provides more knowledge to estimate the optimal classification weights for each query example. + +More analysis is provided in Appendix A.3. + +# 5 CONCLUSION + +In this work, we introduce Attentive Weights Generation via Information Maximization (AWGIM) for few shot image classification. AWGIM learns to generate optimal classification weights for each query sample within the task by two encoding paths. To guarantee this, the lower bound of mutual information between generated weights and query, support data is maximized. As far as we know, AWGIM is the first work utilizing mutual information techniques for few shot learning. The effectiveness of AWGIM is demonstrated by state-of-the-art performance on two benchmark datasets and extensive 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. +Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando De Freitas. Learning to learn by gradient descent by gradient descent. In NeurIPS, 2016. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015. +David Barber and Felix V Agakov. The im algorithm: a variational approach to information maximization. In NeurIPS, 2003. +Luca Bertinetto, Joao F Henriques, Philip Torr, and Andrea Vedaldi. Meta-learning with differentiable closed-form solvers. In ICLR, 2019. +Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In NeurIPS, 2016. +Zitian Chen, Yanwei Fu, Yu-Xiong , Lin Ma, Wei Liu, and Martial Hebert. Image deformation meta-networks for one-shot learning. In CVPR, 2019. + +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. + +Li Fei-Fei, Rob Fergus, and Pietro Perona. One-shot learning of object categories. TPAMI, 2006. + +Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, 2017. + +Spyros Gidaris and Nikos Komodakis. Dynamic few-shot visual learning without forgetting. In CVPR, 2018. + +Spyros Gidaris and Nikos Komodakis. Generating classification weights with gnn denoising autoencoders for few-shot learning. In CVPR, 2019. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. + +R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. ICLR, 2019. + +Hyunjik Kim, Andriy Mnih, Jonathan Schwarz, Marta Garnelo, Ali Eslami, Dan Rosenbaum, Oriol Vinyals, and Yee Whye Teh. Attentive neural processes. In ICLR, 2019. + +Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML Deep Learning Workshop, 2015. + +Ranjay Krishna, Michael Bernstein, and Li Fei-Fei. Information maximizing visual question generation. In CVPR, 2019. + +Kwonjoon Lee, Subhransu Maji, Avinash Ravichandran, and Stefano Soatto. Meta-learning with differentiable convex optimization. In CVPR, 2019. + +Hongyang Li, David Eigen, Samuel Dodge, Matthew Zeiler, and Xiaogang Wang. Finding taskrelevant features for few-shot learning by category traversal. In CVPR, 2019a. + +Wenbin Li, Lei Wang, Jinglin Xu, Jing Huo, Yang Gao, and Jiebo Luo. Revisiting local descriptor based image-to-class measure for few-shot learning. In CVPR, 2019b. + +Yann Lifchitz, Yannis Avrithis, Sylvaine Picard, and Andrei Bursuc. Dense classification and implanting for few-shot learning. In CVPR, 2019. + +Yanbin Liu, Juho Lee, Minseop Park, Saehoon Kim, Eunho Yang, Sung Ju Hwang, and Yi Yang. Learning to propagate labels: Transductive propagation network for few-shot learning. In ICLR, 2019. + +Ilya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. arXiv preprint arXiv:1711.05101, 2017. + +Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 2008. + +Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A simple neural attentive metalearner. In ICLR, 2018. + +Tsendsuren Munkhdalai and Hong Yu. Meta networks. In ICML, 2017. + +Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Łukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. ICML, 2018. + +Hang Qi, Matthew Brown, and David G Lowe. Low-shot learning with imprinted weights. In CVPR, 2018. + +Siyuan Qiao, Chenxi Liu, Wei Shen, and Alan L Yuille. Few-shot image recognition by predicting parameters from activations. In CVPR, 2018. + +Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In ICLR, 2016. + +Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell, Kevin Swersky, Joshua B Tenenbaum, Hugo Larochelle, and Richard S Zemel. Meta-learning for semi-supervised few-shot classification. In ICLR, 2018. + +Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. IJCV, 2015. + +Andrei A Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. In ICLR, 2019. + +Adam Santoro, David Raposo, David G Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. In NeurIPS, 2017. + +Jurgen Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to¨ learn: the meta-meta-... hook. PhD thesis, 1987. + +David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. A general reinforcement learning algorithm that masters chess, shogi, and go through self-play. Science, 362(6419):1140– 1144, 2018. + +Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In NeurIPS, 2017. + +Qianru Sun, Yaoyao Liu, Tat-Seng Chua, and Bernt Schiele. Meta-transfer learning for few-shot learning. In CVPR, 2019. + +Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In CVPR, 2018. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017. + +Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In NeurIPS, 2016. + +Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. arXiv preprint arXiv:1905.09418, 2019. + +Yu-Xiong Wang, Ross Girshick, Martial Hebert, and Bharath Hariharan. Low-shot learning from imaginary data. In CVPR, 2018. + +Davis Wertheimer and Bharath Hariharan. Few-shot learning with localization in realistic settings. In CVPR, 2019. + +Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, 2015. + +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. + +Ruixiang Zhang, Tong Che, Zoubin Ghahramani, Yoshua Bengio, and Yangqiu Song. Metagan: An adversarial approach to few-shot learning. In NeurIPS, 2018. + +# A APPENDIX + +# A.1 MUTLI-HEAD ATTENTION IN AWGIM + +The multi-head attention can be described as + +$$ +M u l t i H e a d ( Q , K , V ) = C o n c a t ( h e a d _ { 1 } , . . . , h e a d _ { H } ) W ^ { O } , +$$ + +$$ +h e a d _ { i } ( Q ^ { i } , K ^ { i } , V ^ { i } ) = A t t e n t i o n ( Q ^ { i } , K ^ { i } , V ^ { i } ) , +$$ + +$$ +A t t e n t i o n ( Q , K , V ) = s o f t m a x ( \frac { Q K ^ { T } } { \sqrt { d _ { k } } } V ) , +$$ + +$$ +Q ^ { i } = Q W _ { Q } ^ { i } , K ^ { i } = K W _ { K } ^ { i } , V ^ { i } = V W _ { V } ^ { i } , +$$ + +Here $Q , K , V$ are query, key, value matrices. $W _ { Q } ^ { i } , W _ { K } ^ { i } , W _ { V } ^ { i }$ are the weight matrices for $i$ th head. $W ^ { O }$ is the weight matrix for output. $d _ { k }$ is the dimension of keys. Original $Q$ is added to the output of Equation 16 to stabilize the training as residual learning. + +# A.2 MODEL DETAILS + +# A.2.1 CONTEXTUAL PATH + +The encoding process in contextual path is realized by a simple multi-head self-attention network on support data. First, ${ \bf x } ^ { c _ { n } ; k }$ are mapped to a lower dimensional hidden space by a MLP $f _ { 1 } : \mathbb { R } ^ { d } $ $\mathbb { R } ^ { d _ { h } }$ to reduce the computation complexity. Then the low-dimensional representations $\mathbf { x } _ { h 1 } ^ { c _ { n } ; k }$ are processed by the -head self-attention network $f _ { c p } ^ { s a } : \mathbb { R } ^ { d _ { h } } \mathbb { R } ^ { d _ { h } }$ , + +$$ +{ \bf X } ^ { c p } = M u l t i H e a d A t t e n t i o n ( Q = { \bf X } _ { h 1 } , K = { \bf X } _ { h 1 } , V = { \bf X } _ { h 1 } ) . +$$ + +$\mathbf { X } _ { h 1 } \in \mathbb { R } ^ { N K \times d _ { h } }$ is the matrix where each row stands for one support sample $\mathbf { x } _ { h 1 } ^ { c _ { n } ; k }$ . For one $N$ -way $K$ -shot task, the outputs of $f _ { c p } ^ { s a }$ . + +# A.2.2 ATTENTIVE PATH + +The attentive path is instantiated by attention, similar to contextual path. First, a MLP $f _ { 2 } : \mathbb { R } ^ { d } $ $\mathbb { R } ^ { d _ { h } }$ is used to map both ${ \bf x } ^ { c _ { n } ; k }$ and $\hat { \bf x }$ to $\mathbf { x } _ { h 2 } ^ { c _ { n } ; k }$ and $\hat { \mathbf { x } } _ { h 2 }$ . Then we employ another $H$ -head selfattention network $f _ { a p } ^ { s a } : \mathbb { R } ^ { d _ { h } } \mathbb { R } ^ { d _ { h } }$ on $\mathbf { x } _ { h 2 } ^ { c _ { n } ; k }$ to encode the global task information to each support sample, + +$$ +{ \bf X } ^ { a p } = M u l t i H e a d A t t e n t i o n ( Q = { \bf X } _ { h 2 } , K = { \bf X } _ { h 2 } , V = { \bf X } _ { h 2 } ) . +$$ + +The cross attention between query and context-aware support samples are computed as + +$$ +{ \hat { \bf X } } ^ { a p } = M u l t i H e a d A t t e n t i o n ( Q = { \hat { \bf X } } _ { h 2 } , K = { \bf X } _ { h 2 } , V = { \bf X } ^ { a p } ) . +$$ + +Here $\hat { \mathbf { X } } ^ { a p } \in \mathbb { R } ^ { | \mathcal { Q } | \times d _ { h } }$ is the matrix form of $\hat { \mathbf { x } } _ { q }$ , where each query sample is context-aware. + +# A.2.3 WEIGHT GENERATOR + +Assume $\mathbf { x } ^ { c p \oplus a p } = \mathbf { X } _ { i , j , : } ^ { c p \oplus a p } \in \mathbb { R } ^ { 2 d _ { h } }$ , where $i , j$ stands for $i$ th query sample and $j$ th support sample. $\mathbf { x } ^ { c p \oplus a p }$ is decoded by the weights generator $g : \mathbb { R } ^ { 2 d _ { h } } \mathbb { R } ^ { 2 d }$ . We assume that the classification weights follow Gaussian distribution with diagonal covariance and we sample the weights from this distribution during meta-training, shown in Equation 23 and 24. + +$$ +\mu _ { \mathbf { w } } , \sigma _ { \mathbf { w } } = g ( \mathbf { z } ) +$$ + +$$ +\mathbf { w } \sim \mathcal { N } ( \mu _ { \mathbf { w } } , \pmb { \Sigma } _ { \mathbf { w } } ) +$$ + +# A.3 EXPERIMENTAL ANALYSIS + +# A.3.1 FEW SHOT REGRESSION + +AWGIM can be applied to few shot regression task by slight modification. During meta-training, we set the number of classes $N$ equal to 1 and adapt the cross entropy loss to mean square error. We use the data points $( x , y )$ as inputs to AWGIM and generate weight as well as bias parameters for a three layer MLP with hidden dimension 40. This is consistent with few shot regression experimental setting in LEO. + +The few shot regression tasks are constructed as either sinusoidal or linear regression tasks. For sinusoidal regression tasks, the amplitude range is [0.1, 5], phase range $[ 0 , 2 \pi ]$ , frequency range [0.5, 2.0]. For linear regression tasks, the slope range is $[ - 1 , 1 ]$ , intercept range $[ - 5 , 5 ]$ . Input $x$ is randomly sample from $[ - 5 , 5 ]$ . Gaussian noise with standard deviation 0.3 is added to $y$ during meta-training. We show some qualitative results in Figure 2. (a) and (b) are examples that can be tackled easily. For some non-trivial cases such as (c) and (d), AWGIM produces predictions slightly mixing with another regression family, despite that overall results are still faithful. + +![](images/df7812dbdfdc7c5baf047dcc3b50d4a47220543c760af8eaedde57f4917c7892.jpg) +Figure 2: 5-shot regression results for a multi-modal task distribution. Regression targets are plotted in red and prediction in black. 5 training samples per task are plotted with blue solid circles. + +# A.3.2 EFFECT OF MULTI-HEAD ATTENTION + +We replace the multi-head attention in the two paths with single-head attention and conduct the 5- way 1-shot and 5-way 5-shot experiments on miniImageNet dataset. The results are shown in Table 4. We can see clearly that multi-head attention improve the performance. In particular, for 5-way 1-shot experiment, single head attention gives results close to MLP encoding, which indicates that single head attention struggles when data are extremely scarce. + +Table 4: Accuracy results on miniImageNet with 4 heads or single head in attention networks. + +
Method5-way 1 -shot 5-way 5-shot
4 heads63.12%78.40%
single head62.35%77.75%
+ +# A.3.3 CONVERGENCE + +We compare AWGIM with LEO in terms of convergence speed. The batch size is set to be 16 for both methods. We use the hyper-parameters tuned by authors to train LEO. The accuracy of metavalidation set during meta-training on 5-way 1-shot miniImageNet is plotted, shown in Figure 3. we can see clearly that AWGIM converges faster than LEO and outperforms LEO except for the first few iterations. + +![](images/70012493ad6568c4a0bf7152014453a6a19cdde405da29751675aab5579ea992.jpg) +Figure 3: The meta-validation accuracy during meta-training. + +# A.3.4 INFERENCE TIME + +We measure the inference time of AWGIM to show that it induces minimal computational overhead. In comparison, we use “MLP encoding” in two paths, which has time complexity $O ( N K + | \mathcal { Q } | )$ . We use two set-ups on miniImageNet and the batch size is set to be 64. 100 batches are processed and we report the average consumed time for one batch. All these experiments on done with the same GPU and workstation. The results are shown in Table 5. It can be observed that the usage of self-attention and cross attention in AWGIM occurs negligible overhead, compared with MLP encoding. This is because the values of $N , K , | \mathcal { Q } |$ are all relatively small and matrix multiplication further can be processed very fast by GPU. + +Table 5: The comparison of inference time between AWGIM and MLP encoding. + +
Method5-way 1 -shot5-way 5-shot
AWGIM0.036s0.093s
MLP encoding0.033s0.093s
+ +# A.3.5 VISUALIZATION + +We visualize the generated classification weights by t-SNE (Maaten & Hinton, 2008). First we sample 400 tasks from meta-validation set of 5-way 1-shot miniImageNet experiment. Each task contains 5 query samples from 5 different classes. Thus in total there are $4 0 0 \times 5 \times 5 = 1 0 , 0 0 0$ weight vectors to visualize. As comparison, inputs to the generator $g$ are also plotted. The visualization results are shown in Figure 4. The inputs to $g$ are displayed in (a, b) and the generated classification weights in (c, d). From the comparison between (a) and (c), we can see the decoded weights for each class in (c) are clustered closer than (a) in general. Red and blue dots in (b, d) denotes the classification weights for two query samples from two classes within one task. It can be observed that $g$ can generate adapted weights for different query samples. This is consistent with Table 3, where the results of “random shuffle between classes” suggest that query samples from different class have distinct classification weights. + +![](images/7279dd6a6dd60341910d31f04f08cc86bd5dc1b2d43395c825b56188a42d47cb.jpg) +Figure 4: t-SNE visualization of the inputs to $g$ in (a, b) and the generated classification weights in (c, d). Blue and red dots in (b) and (d) are the classification weights for two query samples in the same task. \ No newline at end of file diff --git a/md/train/BklIxyHKDr/BklIxyHKDr.md b/md/train/BklIxyHKDr/BklIxyHKDr.md new file mode 100644 index 0000000000000000000000000000000000000000..c138228cd9eb30e874259b60894212d66e54677a --- /dev/null +++ b/md/train/BklIxyHKDr/BklIxyHKDr.md @@ -0,0 +1,466 @@ +# DEEP K-NN FOR NOISY LABELS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Modern machine learning models are often trained on examples with noisy labels that hurt performance and are hard to identify. In this paper, we provide an empirical study showing that a simple $k$ -nearest neighbor-based filtering approach on the logit layer of a preliminary model can remove mislabeled training data and produce more accurate models than some recently proposed methods. We also provide new statistical guarantees into its efficacy. + +# 1 INTRODUCTION + +Machine learned models can only be as good as the data they were used to train on. With increasingly large modern datasets and automated and indirect labels like clicks, it is becoming ever more important to investigate and provide effective techniques to handle noisy labels. + +We revisit the classical method of filtering out suspicious training examples using $k$ -nearest neighbors ( $k$ -NN) (Wilson, 1972). Like Papernot & McDaniel (2018), we apply $k$ -NN on the learned intermediate representation of a preliminary model, which adds robustness. In fact, the $k$ -nearest neighbor approach has recently been receiving attention for its robustness properties (Wang et al., 2018; Reeve & Kaban, 2019) and as an auxiliary strategy for modern machine learning (Jiang et al., 2018). + +The main contributions of this paper are: + +• Experimentally showing that identifying mislabeled examples by $k$ -NN executed on an intermediate layer of a preliminary deep model works well compared to state-of-art methods for handling noisy labels across noise levels, and is robust to the choice of $k$ . • Theoretically showing that $k$ -NN’s predictions will only identify a training example as clean if its label is the Bayes-optimal label. We also provide finite-sample analysis in terms of the margin and how spread out the corrupted labels are (Theorem 1), rates of convergence for the margin (Theorem 2) and rates under Tsybakov’s noise condition (Theorem 3) with all rates matching minimax-optimal rates in the noiseless setting. + +Our work shows that even though the preliminary neural network is trained with corrupted labels, it still yields intermediate representations that are useful for $k$ -nearest neighbor filtering. Given labels which are in high disagreement, one can either automatically remove them and retrain on the remaining, or send to a human operator for further review. This strategy is also be useful in human-in-the-loop systems where one can warn the human annotator that a label is suspicious, and automatically propose new labels based on its nearest neighbors’ labels. + +In addition to strong empirical performance, deep $k$ -NN filtering has a couple of advantages. Firstly, many methods require a clean set of samples whose labels can be trusted. Here we show that the $k$ -NN based method is robust and does not require such a clean set of samples. Second, while $k$ -NN does introduce the hyperparameter $k$ , we will show that deep $k$ -NN filtering is stable to the choice of $k$ : such robustness to hyperparameters is highly desirable as optimal tuning for this problem is often not available in practice (i.e. when no clean validation set is available). + +# 2 RELATED WORK + +We review relevant prior work in training on noisy labels and related $k$ -NN theory. + +# 2.1 TRAINING WITH NOISY LABELS + +Methods to handle label noise can be classified into two main strategies: (i) explicitly identify and remove the noisy examples, and (ii) indirectly handle the noise with robust training methods. + +Data Cleaning This proposal fits into the broad family of data cleaning methods, in that our proposal detects and filters dirty data (see Chu et al. (2016) for a recent survey). The use of $k$ -NN to “edit” training data has been popular since Wilson (1972) used it to throw away training examples that were not consistent with their $k = 3$ nearest neighbors. The idea of using a preliminary model to help identify mislabeled examples dates to at least Guyon et al. (1994), who proposed using the model to compute an information gain for each example and then suspecting ones with high gain. Other early work used a cross-validation set-up to train a classifier on part of the data, then use it to make a prediction on held-out training examples, and remove any examples if the prediction disagrees with the label; ensembles of models can also be used for the predictions. (Brodley & Freidl, 1999). + +Noise Corruption Estimation For multi-class problems, a popular approach is to account for noisy labels by applying a confusion matrix after the model’s softmax layer (Sukhbaatar et al., 2014). Such methods rely on a confusion matrix which is often unknown and must be estimated. Patrini et al. (2017) suggest deriving it from the softmax distribution of the model trained on noisy data while Goldberger & Ben-Reuven (2016); Jindal et al. (2016); Han et al. (2018) give alternatives. Accurate estimates are generally hard to attain when only untrusted data is available. Hendrycks et al. (2018) achieves more accurate estimates in the setting where some amount of known clean, trusted data is available. Xiao et al. (2015); Khetan et al. (2017); Vahdat (2017) use EM-type algorithms to estimate the clean label distribution. + +Noise-Robust Training Natarajan et al. (2013) propose a method to make any surrogate loss function noise-robust given knowledge of the corruption rates. Ghosh et al. (2017) proves that losses like mean absolute error (MAE) are inherently robust under symmetric or uniform label noise while Zhang & Sabuncu (2018) shows that training with MAE results in poor convergence and accuracy. They propose a new loss function based on the negative Box-Cox transformation that trades off the noise-robustness of MAE with the training efficiency of cross-entropy. Lastly, the ramp, unhinged, and savage losses have been proposed and theoretically justified to be noise-robust for support vector machines (Brooks, 2011; Van Rooyen et al., 2015; Masnadi-Shirazi & Vasconcelos, 2009). Rolnick et al. (2017) empirically shows that deep learning models are robust to noise when there are enough correctly labeled examples and when the model capacity and training batch size are sufficiently large. + +Auxiliary Models Veit et al. (2017) propose learning a label cleaning network on trusted data by predicting the differences between clean and noisy labels. Li et al. (2017) suggests training on a weighted average between noisy labels and distilled predictions of an auxiliary model trained on trusted data. + +Example Weighting Here we make a hard decision about whether to keep a training example, but one can also adapt the weights on training examples based on the confidence in their labels. Liu & Tao (2015) provides an importance-weighting scheme for binary classification. Ren et al. (2018) suggests upweighting examples whose loss gradient is aligned with those of trusted examples at every step in training. Jiang et al. (2017) investigates a recurrent network that learns a sample weighting scheme to give to the base model. + +# 2.2 $k$ -NEAREST NEIGHBOR THEORY + +The theory of $k$ -nearest neighbor classification has a long history, for example: Fix & Hodges Jr (1951); Cover (1968); Stone (1977); Devroye et al. (1994); Chaudhuri & Dasgupta (2014). Much of the prior work focuses on $k$ -NN’s statistical consistency properties. However, with the growing interest in adversarial examples and learning with noisy labels, there have recently been analyses of $k$ -nearest neighbor methods in these settings. Wang et al. (2018) analyze the robustness of $k$ -NN classification and provide a robust variant of 1-NN classification where their notion of robustness is that predictions of nearby points should be similar. Gao et al. (2016) provides an analysis of the $k$ -NN classifier under noisy labels and like us, show that $k$ -NN can attain similar rates in the noisy setting as in the noiseless setting. Gao et al. (2016) assumes a noise model where labels are corrupted uniformly at random, while we assume an arbitrary corruption pattern and provide results based on a notion of how spread out the corrupted points are. Moreover, we provide finite-sample bounds borrowing recent advances in $k$ -NN convergence theory in the noiseless setting (Jiang, 2019) while the guarantees of Gao et al. (2016) are asymptotic. Reeve & Kaban (2019) provide stronger guarantees on a robust modification of $k$ -NN proposed by Gao et al. (2016). To the best of our knowledge, we provide the first finite-sample rates of consistency for the classical $k$ -NN method in the noisy setting with very little assumptions on the label noise. + +# 3 ALGORITHM + +We first define the $k$ -nearest neighbor classifier: + +Definition 1 ( $k$ -NN). Let the $k$ -NN radius of $x \in \mathcal { X }$ be $r _ { k } ( x ) : = \operatorname* { i n f } \{ r : | B ( x , r ) \cap X | \geq k \}$ where $B ( x , r ) : = \{ x ^ { \prime } \in \mathcal { X } : | x - x ^ { \prime } | \leq r \}$ and the $k$ -NN set of $x \in \mathcal { X }$ be $N _ { k } ( x ) : = B ( x , r _ { k } ( x ) ) \cap X$ . Then for all $x \in \mathcal { X }$ , the $k$ -NN classifier function w.r.t. $X$ has discriminant function + +$$ +\eta _ { k } ( y ; x ) : = \frac { 1 } { \vert N _ { k } ( x ) \vert } \sum _ { i = 1 } ^ { n } 1 \left[ y _ { i } = y , x _ { i } \in N _ { k } ( x ) \right] , +$$ + +with prediction $\eta _ { k } ( x ) : = \arg \operatorname* { m a x } _ { y } \eta _ { k } ( y ; x )$ . + +Our method Algorithm 1 assumes a dataset $\mathcal { D } _ { \mathrm { n o i s y } }$ with potentially noisy labels, along with a dataset $\mathcal { D } _ { \mathrm { c l e a n } }$ consisting of clean or trusted labels. Note that we allow $\mathcal { D } _ { \mathrm { c l e a n } }$ to be empty (i.e. in instances where no such trusted data is available). We have found that having $\mathcal { D } _ { \mathrm { c l e a n } }$ becomes important when $\mathcal { D } _ { \mathrm { n o i s y } }$ has a high corruption rate; otherwise the representations learned by training on $\mathcal { D } _ { \mathrm { n o i s y } }$ alone are often reasonable enough. The procedure begins by training on either $\mathcal { D } _ { \mathrm { n o i s y } } \cup \mathcal { D } _ { \mathrm { c l e a n } }$ or $\mathcal { D } _ { \mathrm { c l e a n } }$ . For our experiments, we partition $\mathcal { D } _ { \mathrm { c l e a n } }$ into a training set $\mathcal { D } _ { c t }$ and validation set $\mathcal { D } _ { c v }$ and train models on $\mathcal { D } _ { c t }$ and $\mathcal { D } _ { \mathrm { n o i s y } } \cup \mathcal { D } _ { c t }$ and choose the one that performs better on $\mathcal { D } _ { c v }$ . + +We then filter examples that disagree with the $k$ -NN classifier prediction, where the $k$ -NN is computed on the final logit layer of the trained model (i.e. the layer right before softmax). + +# Algorithm 1 Filtering datapoints via deep $k$ -NN. + +
Inputs: Dnoisy, Dclean, k
Train model M on either Dnoisy U Dclean Or Dclean·
Let N be the activations of Dnoisy U Dclean on the logit layer of M.
Dfiltered := {(x,y) ∈ N : nk(x) = y},where nk is computed w.r.t. N. Train final model on Dfiltered UDc.
+ +# 4 THEORETICAL ANALYSIS + +For the theoretical analysis, we assume the binary classification problem with the features defined on compact set $\mathcal { X } \subseteq \mathbb { R } ^ { D }$ . We assume that points are drawn according to distribution $\mathcal { F }$ as follows: the features come from distribution $\mathbb { P } _ { \mathcal { X } }$ on $\mathcal { X }$ and the labels are distributed according to the measurable conditional probability function $\eta : \mathcal { X } [ 0 , 1 ]$ . That is, a sample $( X , Y )$ is drawn from $\mathcal { F }$ as follows: $X$ is drawn according to $\mathbb { P } _ { \mathcal { X } }$ and $Y$ is chosen according to $\mathbb { P } ( Y = 1 | X = x ) = \eta ( x )$ . + +The goal will be to show that given corrupted examples, the $k$ -NN disagreement method is still able to identify the examples whose labels do not match that of the Bayes-optimal label. + +We will make a few regularity assumptions for our analysis to hold. The first regularity assumption ensures that the support $\mathcal { X }$ does not become arbitrarily thin anywhere. This is a standard nonparametric assumption (e.g. Singh et al. (2009); Jiang (2019)). + +Assumption 1 (Support Regularity). There exists $\omega > 0$ and $r _ { 0 } > 0$ such that ${ V o l } ( \mathcal { X } \cap B ( x , r ) ) \geq$ $\boldsymbol { \omega } \cdot V o l ( B ( x , r ) )$ for all $x \in \mathcal { X }$ and $0 < r < r _ { 0 }$ , where $B ( x , r ) : = \{ x ^ { \prime } \in \mathcal { X } : | x - x ^ { \prime } | \leq r \}$ . + +Let $p _ { \mathcal { X } }$ be the density function corresponding to $\mathbb { P } _ { \mathcal { X } }$ . The next assumption ensures that with a sufficiently large sample, we will obtain a good covering of the input space. + +Assumption 2 $\overset { \cdot } { p } _ { \mathcal { X } }$ bounded from below). $p _ { X , 0 } : = \operatorname* { i n f } _ { x \in \mathcal { X } } p _ { X } ( x ) > 0 .$ . + +Finally, we make a smoothness assumption on $\eta$ , as done in other analyses of $k$ -NN classification (e.g. Chaudhuri & Dasgupta (2014); Reeve & Kaban (2019)) + +Assumption 3 $\overline { { \eta } }$ Holder continuous) ¨ . There exists $0 \textless \alpha \leq 1$ and $C _ { \alpha } \ > \ 0$ such that $| \eta ( x ) -$ $\eta ( x ^ { \prime } ) \vert \leq C _ { \alpha } \vert x - x ^ { \prime } \vert ^ { \alpha }$ for all $x , x ^ { \prime } \in { \mathcal { X } }$ . + +We propose a notion of how spread out a set of points is based on the minimum pairwise distance between the points. This will be a quantity in the finite-sample bounds we will present. Intuitively, the more spread out a contaminated set of points is, the less clean samples we will be needed to overcome the contamination of that set. + +Definition 2 (Minimum pairwise distance). + +$$ +S _ { 2 } ( C ) : = \operatorname* { m i n } _ { \substack { x , x ^ { \prime } \in C , x \neq x ^ { \prime } } } | x - x ^ { \prime } | . +$$ + +Also define the $\Delta$ -interior region of $\mathcal { X }$ where there is at least $\Delta$ margin in the probabilistic label: + +Definition 3. Let $\Delta \geq 0$ . Define $\begin{array} { r } { \mathcal { X } ^ { \Delta } : = \{ x \in \mathcal { X } : \left| \frac { 1 } { 2 } - \eta ( x ) \right| \geq \Delta \} . } \end{array}$ + +We now state the result, which says that with high probability uniformly on $\chi ^ { \Delta }$ when $\Delta > 0$ is known, we have that the label disagrees with the $k$ -NN classifier if and only if the label is not the Bayes-optimal prediction. Due to space, all of the proofs have been deferred to the Appendix. + +Theorem 1 (Fixed $\Delta$ ). Let $\Delta , \delta \ > \ 0$ and suppose Assumptions 1, 2, and $^ 3$ hold. There exists constants $K _ { l } , K _ { u } > 0$ depending only on $\mathcal { F }$ such that the following holds with probability at least $1 - \delta$ . Let $X _ { [ n ] }$ be $n$ (uncorrupted) examples drawn from the $\mathcal { F }$ and $C$ be a set of points with corrupted labels and denote our sample $X : = X _ { [ n ] } \cup C$ . Suppose $k$ lies in the following range + +$$ +K _ { l } \cdot \frac { 1 } { \Delta ^ { 2 } } \cdot \log ^ { 2 } ( 1 / \delta ) \cdot \log n \leq k \leq K _ { u } \cdot \operatorname* { m i n } \{ S _ { 2 } ( C ) ^ { D } , \Delta ^ { D / \alpha } \} \cdot n , +$$ + +then the following holds uniformly over $x \in \mathcal { X } ^ { \Delta }$ : the $k$ -NN prediction computed w.r.t. $X$ agrees with the label if and only if the label is the Bayes-optimal label $\eta ^ { * } ( x ) : = 1 [ \eta ( x ) \geq \frac { 1 } { 2 } ]$ . + +In the last result, we assumed that $\Delta$ was fixed. We next show how we can make a similar guarantee but show that we can take $\Delta 0$ as we choose $k , n \infty$ appropriately and provide rates of convergence. + +Theorem 2 (Rates of convergence for $\Delta$ ). Let $\delta > 0$ and suppose Assumptions 1, 2, and 3 hold. There exist constants $K _ { l } , K _ { u } , K ~ > ~ 0$ depending only on $\mathcal { F }$ such that the following holds with probability at least $1 - \delta$ . Let $X _ { [ n ] }$ be $n$ (uncorrupted) examples drawn from $\mathcal { F }$ , and $C$ be a set of points with corrupted labels and denote our sample $X : = X _ { [ n ] } \cup C$ . Suppose $k$ lies in the following range + +$$ +K _ { l } \cdot \log ^ { 2 } ( 1 / \delta ) \cdot n ^ { \frac { \alpha } { \alpha + D } } \leq k \leq K _ { u } \cdot S _ { 2 } ( C ) ^ { D } \cdot n , +$$ + +then the following holds uniformly over $x \in \mathcal { X } ^ { \Delta }$ : the $k$ -NN prediction computed w.r.t. $X$ agrees with the label if and only if the label is the Bayes-optimal label $\eta ^ { * } ( x ) : = 1 [ \eta ( x ) \geq \frac { 1 } { 2 } ]$ where + +$$ +\Delta = K \cdot \left( \sqrt { \frac { \log n + \log ( 1 / \delta ) } { k } } + \left( \frac { k } { n } \right) ^ { \alpha / D } \right) . +$$ + +Remark 1. Choosing $k = { \cal { O } } ( n ^ { 2 \alpha / ( 2 \alpha + D ) } )$ in the above result gives us $\Delta = \widetilde { \cal O } ( n ^ { - \alpha / ( 2 \alpha + D ) } )$ . This rate for $\Delta$ is the minimax-optimal rate for $k$ -nearest neighbor classification on $\chi ^ { \Delta }$ given a sample of size $n$ (Chaudhuri $\&$ Dasgupta, 2014) in the uncorrupted setting. Thus, our analysis is tight up to logarithmic factors. + +We next give results with an additional margin assumption, also known as Tsybakov’s noise condition (Mammen et al., 1999; Tsybakov et al., 2004): + +Assumption 4 (Tsybakov Noise Condition). The following holds for some $C _ { \beta }$ and $\beta$ and all $\Delta > 0$ + +$$ +\mathbb { P } _ { \mathcal { X } } ( x \notin \mathcal { X } ^ { \Delta } ) \le C _ { \beta } \cdot \Delta ^ { \beta } . +$$ + +![](images/8f5d14565231eee3a4d1721452ac5e2d673cb663116c96625aa285a76e171a1e.jpg) +Figure 1: Left: training samples. We observe that test accuracy improves as $S _ { 2 } ( C )$ increases (middle) and that fewer clean training samples are needed to achieve an accuracy of $90 \%$ (right). + +Theorem 3 (Rates under Tsybakov Noise Condition). Let $\delta > 0$ and suppose Assumptions 1, 2, 3 and 4 hold. There exists constants $K _ { l } , K _ { u } , K , K ^ { \prime } > 0$ depending only on $\mathcal { F }$ such that the following holds with probability at least $1 - \delta$ . Let $X _ { [ n ] }$ be $n$ (uncorrupted) examples drawn from the $\mathcal { F }$ and $C$ be a set of points with corrupted labels and denote our sample $X : = X _ { [ n ] } \cup C$ . Suppose $k$ lies in the following range + +$$ +K _ { l } \cdot \log ^ { 2 } ( 1 / \delta ) \cdot n ^ { \frac { \alpha } { \alpha + D } } \leq k \leq K _ { u } \cdot S _ { 2 } ( C ) ^ { D } \cdot n , +$$ + +and define $\eta _ { k } ( x ) : = \arg \operatorname* { m a x } _ { y } \eta _ { k } ( y ; x )$ . Then, + +$$ +\begin{array} { r } { \mathbb { P } \left( \eta _ { k } ( x ) \neq \eta ^ { * } ( x ) \right) \leq K \cdot \left( \sqrt { \frac { \log n + \log ( 1 / \delta ) } { k } } + \left( \frac { k } { n } \right) ^ { \alpha / D } \right) ^ { \beta } , } \\ { \quad R _ { X } - R ^ { * } \leq K ^ { \prime } \cdot \left( \sqrt { \frac { \log n + \log ( 1 / \delta ) } { k } } + \left( \frac { k } { n } \right) ^ { \alpha / D } \right) ^ { \beta + 1 } } \end{array} +$$ + +where $R _ { X } : = \mathbb { E } _ { \mathcal { F } } [ g _ { k } ( x ) \neq y ]$ and $R ^ { * } : = \mathbb { E } _ { \mathcal { F } } [ g ^ { * } ( x ) \neq y ]$ denote the risk of the $k$ -NN method and Bayes optimal classifier, respectively. + +Remark 2. Choosing $k = { \cal { O } } ( n ^ { 2 \alpha / ( 2 \alpha + D ) } )$ in the above gives us a rate of $\widetilde { O } ( n ^ { - \alpha ( \beta + 1 ) / ( 2 \alpha + D ) } ) f o r$ the excess risk. This matches the lower bounds of Audibert et al. (2007) up to logarithmic factors. + +# 4.1 IMPACT OF MINIMUM PAIRWISE DISTANCE + +The minimum pairwise distance across corrupted samples, $S _ { 2 } ( C )$ , is a key quantity in the theory presented in the previous section. We now empirically study its significance in a simulated binary classification task in 2 dimensions. Clean samples with label $L$ are generated by sampling i.i.d from $\mathcal { N } ( \mu _ { L } , I _ { 2 \times 2 } )$ , where $\mu _ { 0 } = ( 0 , - 2 )$ and $\mu _ { 1 } = ( 0 , 2 )$ . The decision boundary is the line $y = 0$ . We take 100 samples uniformly spaced on a square grid centered about $( 0 , 0 )$ and corrupt them by flipping their true label. With this construction, $S _ { 2 } ( C )$ is precisely the grid width, which we let vary. The training set is a union of 100 clean samples and the 100 corrupted samples. Using 1000 clean samples as a test set we study the classification performance of a majority vote $k$ -NN classifier, where $k = 1 0$ . Results are shown in Figure 1. As expected, we see that as $S _ { 2 } ( C )$ decreases, so does test accuracy and we need more clean training samples to compensate. + +# 5 EXPERIMENTS + +We evaluate the effectiveness of our algorithm as follows. We split each dataset’s training set into two parts, $\mathcal { D } _ { \mathrm { c l e a n } }$ and $\mathcal { D } _ { \mathrm { n o i s y } }$ . We then corrupt the labels of some fraction of examples in $\mathcal { D } _ { \mathrm { n o i s y } }$ by applying a corruption matrix prescribed by one of the following methods. + +• Uniform: The label is flipped to any one of the labels (including itself) with equal probability. +• Flip: The label is flipped to any other label with equal probability. +• Hard Flip: With probability $\begin{array} { l } { { \frac { 1 } { 2 } } } \end{array}$ , we flip the label $m$ to $\pi ( m )$ where $\pi$ is some predefined permutation of the labels. + +![](images/db6948e845dbf16cb5ceaf8bc97b4c7b425d9f348eafc23dac76a170c412b75a.jpg) +Figure 2: UCI Results. Error plots against amount of noise applied to the labels of $\mathcal { D } _ { \mathrm { n o i s y } }$ . $\mathcal { D } _ { \mathrm { c l e a n } }$ contains $5 \%$ of the data. Each column is a different corruption and each row is for a different dataset. We see that the $k$ -NN method consistently chooses the best datapoints to filter leading to lower error. More results are in the Appendix. + +We compare against the following baselines: + +• Gold Loss Correction (GLC) (Hendrycks et al., 2018) estimates the corruption matrix by averaging the softmax outputs of the clean examples on a model trained on noisy data. +• Distill (Li et al., 2017) assigns each example in the combined dataset a “soft” label that is a convex combination of its label and its softmax output from a model trained solely on clean data. +• Forward (Patrini et al., 2017), similar in spirit to GLC, estimates the corruption matrix by training a model on noisy data and using the softmax output for prototype examples for each class. It does not require a clean dataset like other methods. +• Clean. We define this as training on the clean data only. +• Full. We define this as training on the full (clean and noisy) data. +• $k$ -NN Classify is like “Full” except we use $k$ -NN majority voting on the logits layer for classification at test time. + +We report test errors and show the average across multiple runs with standard error bands shaded. Errors are computed on 11 uniformly distributed noise rates between 0 and 1 inclusive. For the results shown in the main text, we have that $\mathcal { D } _ { \mathrm { c l e a n } }$ is randomly selected and is $5 \%$ of the data. In the Appendix, we show results over different sizes of $\mathcal { D } _ { \mathrm { c l e a n } }$ . We implement all methods using the Tensorflow 2.0 Keras API and Scikit-Learn. We use the Adam optimizer with default learning rate 0.001 and a batch size of 128 across all experiments. For the UCI datasets, we set $k = 5 0$ and set $k = 5 0 0$ for all other datasets. We chose $k = 5 0$ for the UCI datasets because some of the datasets were of small size. However, we found that the $k$ -NN method’s performance was quite stable to the choice of $k$ , which we show in Section 5.4. We describe the permutations used for hard flipping in the Appendix. + +# 5.1 UCI AND MNIST RESULTS + +We show the results for one of the UCI datasets in Figure 2 and Fashion MNIST in Figure 3. Due to space, results for MNIST and the remaining UCI datasets are in the Appendix. For UCI, we use a fully-connected neural network with a single hidden layer of dimension 100 with ReLU activations and train for 100 epochs. For both MNIST datasets, we use is a two hidden-layer fully-connected neural network where each layer has 256 hidden units with ReLU activations. We train the model for 20 epochs. We see that the $k$ -NN approach attains models with a low error rate across noise rates and either outperforms or is competitive with the next best method, GLC. + +# 5.2 CIFAR RESULTS + +For CIFAR10/100 we use ResNet-20, which we train from scratch on single NVIDIA P100 GPUs. We train CIFAR10 for 100 epochs and CIFAR100 for 150 epochs. We show results for CIFAR10 in Figure 4 and results for CIFAR100 in the Appendix, due to space. We see that the $k$ -NN method performs competitively. It generally outperforms on the uniform and flip noise types but performs worse for the hard flip noise type. It is not too surprising that $k$ -NN would be weaker in the presence of hard flip noise (i.e. where labels are mapped based on a pre-determined mapping between labels) as the noise is much more structured in that case making it more difficult to be filtered out by majority vote among the neighbors. In other words, unlike the uniform and flip noise types, we are no longer dealing with white label noise in the hard flip noise type. + +![](images/312706a78cc7c160ddad0e89bd31a29ff4a93351ba6a1ac92263d88c89c7ba79.jpg) +Figure 3: Fashion MNIST. Each column is a different corruption method. We see that the $k$ -NN approach performs competitively. More results are in the Appendix. + +![](images/b7d76dd9aa6b326755cadb438856000b7506701285e9e97645a9bb2a89a3bd15.jpg) +Figure 4: CIFAR10. Each column is a different corruption method. We see that our $k$ -NN method performs competitively or outperforms on the uniform and flip noise types but performs worse for the hard flip noise type. More results are in the Appendix. + +# 5.3 SVHN RESULTS + +We show the results in Figure 5. We train ResNet-20 from scratch on NVIDIA P100 GPUs for 100 epochs. As in the CIFAR experiments, we see that the $k$ -NN method tends to be competitive in the uniform and flip noise types but does slightly worse in the hard flip. + +# 5.4 ROBUSTNESS TO $k$ + +In this section, we show that our procedure is stable in its hyperparameter $k$ . The theoretical results suggest that a wide range of $k$ can give us statistical consistency guarantees and we show that in practice a wide range of $k$ gives us similar results for Algorithm 1 (Figure 6). Such robustness in + +![](images/4a5abd7b9ad8d2349b2c22bb201363a659e9004d7ee623fdc9c0987ff6afa4b7.jpg) +Figure 5: SVHN. We see that the $k$ -NN method performs competitively on the uniform and flip noise types but performs worse for the hard flip noise type. More results in the Appendix. + +
Letters10204.554.283.7722.062.482.051.762.331.911.572.051.781.562.191.791.3421.854.834.453.853.162.522.072.962.121.782.351.921.562.11.81.582.522.061.4221.933.63.353.172.522.052.11.851.621.831.61.381.821.61.411.821.641.422.522.362.04
Phonemes510207.897.867.721.911.541.341.791.531.332.121.671.351.261.161.132.582.281.7632.852.247.917.957.891.931.541.343.212.751.972.161.691.351.341.221.163.973.642.874.313.963.286.66.736.361.921.551.331.771.611.451.961.61.31.21.151.141.781.621.382.72.582.28
Wilt10205.184.684.310.560.430.360.850.750.860.540.450.350.390.320.320.930.770.571.861.771.55.275.635.180.560.440.343.893.142.670.530.430.350.520.410.345.154.864.234.954.844.324.64.785.630.550.430.340.730.660.610.580.430.360.390.310.30.980.780.571.91.811.49
Seeds10203.293.432.994.223.042.693.712.842.274.22.992.743.082.141.722.872.742.44新2.25.135.024.414.333.382.565.564.583.574.393.192.653.642.652.095.114.94.234.884.733.862.942.752.854.063.422.533.632.962.253.913.142.572.992.251.622.842.692.433.012.862.49
Iris1020292.463.232.481.853.482.591.973.972.251.522.461.320.61.721.260.962.051.551.325.255.064.463.382.531.515.154.583.454.032.241.383.022.171.464.323.983.364.434.083.532.92.62.513.292.341.843.132.021.484.11.861.342.321.150.581.140.910.651.351.161
Parkinsons5102055.354.883.463.263.013.263.223.084.223.453.13.43.212.983.263.222.973.763.823.525.175.435.193.553.383.024.494.253.944.13.443.053.363.322.955.345.274.995.355.135.064.985.245.1362.983.563.13.014.593.372.983.683.112.963.283.122.913.633.823.47
MNIST5102022.070.690.50.351.030.850.690.50.410.340.40.330.272.722.421.972.752.452.0332.480.690.50.351.911.50.860.50.420.340.440.350.273.463.12.363.493.142.412.031.861.540.690.50.350.780.670.530.220.210.20.290.260.220.650.480.362.141.981.67
Fashion MNIST5102022.071.881.711.561.731.61.481.591.521.451.561.521.442.532.211.952.542.32.053.553.142.381.871.711.562.552.131.541.591.531.461.61.541.463.32.922.173.312.992.2721.921.871.711.561.621.521.431.441.411.381.481.461.412.312.192.042.42.221.97
CIFAR1052006.746.586.476.585.526.866.325.665.435.395.115.035.274.576.346.115.936.746.556.367.146.826.627.26.565.597.126.725.95.525.625.165.355.324.856.716.486.17.126.836.565.084.894.777.136.535.455.855.34.683.763.913.514.274.43.824.334.214.034.964.894.75
CIFAR100110.810.7910.7810.229.949.389.989.79.159.599.429.579.639.179.098.929.299.259.0710.7910.8110.810.249.899.4410.039.689.139.649.468.979.669.639.179.29.18.929.299.259.0910.6410.6510.6610.239.899.419.889.388.658.588.568.078.989.198.817.487.447.338.047.997.9
SVHN10205.044.984.323.522.21.833.563.22.671.992.272.141.621.341.24.644.513.964.954.824.4134.85281.834.093.723.092.172.291.92.051.481.195.234.964.345.525.294.8282.74.172.411.852.162.011.540.890.880.981.351.040.982.322.161.833.042.982.74
+ +hyperparameter is highly desirable because optimal tuning is often not available, especially when no sufficient clean validation set is available. + +![](images/cc3f0ef9ebdd700a9e99e73d8e7b38944f29088a3964f5ce3ba39ec5cde051ae.jpg) +Table 1: Area under the test error vs noise rate curve. Each row corresponds to a dataset and size of clean dataset $\mathcal { D } _ { \mathrm { c l e a n } }$ pair, where the size is a percentage of the total training set $5 \%$ , $10 \%$ , $20 \%$ ). Each column shows the area under the error curve across noise rates for a particular method and noise type (Uniform, Flip, Hard Flip). We see that the $k$ -NN method consistently outperforms the other methods for Uniform and Flip and outperforms the other methods on Hard Flip on the smaller datasets. +Figure 6: Performance across different values of $k$ . Here we show that on a UCI dataset, the performance of Algorithm 1 is stable when varying its hyperparameter $k$ . Note that the $y$ -axis has been zoomed in to better see the differences between the curves. + +# 5.5 AREA UNDER ERROR VS NOISE LEVEL CURVE ACROSS DATASETS + +In the figures shown so far, it may be difficult to compare the curves in some cases so we report an area under the curve metric in Table 1. + +Conclusions and Open Questions We conclude from our experiments and theory that the $k$ -NN based method (Algorithm 1) is a relatively safe method to remove problematic training examples before training. While $k$ -NN methods can be sensitive to the choice of $k$ when used with small datasets (Garcia et al., 2009), we hypothesize that with today’s large datasets one can blithely set $k$ to a fixed practically medium-sized value (e.g. $k = 5 0 0$ ) as done here and expect reasonable performance. Theoretically we provided some new results for how well $k$ -NN can identify clean versus corrupted labels. Open theoretical questions are whether there are alternate notions of how to characterize the difficulty of a particular configuration of corrupted examples and whether we can provide both upper and lower learning bounds under these noise conditions. + +# REFERENCES + +Jean-Yves Audibert, Alexandre B Tsybakov, et al. Fast learning rates for plug-in classifiers. The Annals of Statistics, 35(2):608–633, 2007. + +Carla E. Brodley and Mark A. Freidl. Identifying mislabeled training data. Journal Artificial Intelligence Research, 1999. + +J Paul Brooks. Support vector machines with the ramp loss and the hard margin loss. Operations Research, 59(2):467–479, 2011. + +Kamalika Chaudhuri and Sanjoy Dasgupta. Rates of convergence for nearest neighbor classification. In Advances in Neural Information Processing Systems, pp. 3437–3445, 2014. + +Xu Chu, Ilhab F. Ilyas, Sanjay Krishnan, and Jiannan Wan. Data cleaning: Overview and emerging challenges. In SIGMOD, 2016. + +Thomas M Cover. Rates of convergence for nearest neighbor procedures. In Proceedings of the Hawaii International Conference on Systems Sciences, pp. 413–415, 1968. + +Luc Devroye, Laszlo Gyorfi, Adam Krzyzak, Gabor Lugosi, et al. On the strong universal consis- ´ tency of nearest neighbor regression function estimates. The Annals of Statistics, 22(3):1371– 1385, 1994. + +Evelyn Fix and Joseph L Hodges Jr. Discriminatory analysis-nonparametric discrimination: consistency properties. Technical report, California Univ Berkeley, 1951. + +Wei Gao, Xin-Yi Niu, and Zhi-Hua Zhou. On the consistency of exact and approximate nearest neighbor with noisy data. arXiv preprint arXiv:1607.07526, 2016. + +E. K. Garcia, S. Feldman, M. R. Gupta, and S. Srivastava. Completely lazy learning. IEEE Trans. on Knowledge and DataEngineering, 2009. + +Aritra Ghosh, Himanshu Kumar, and PS Sastry. Robust loss functions under label noise for deep neural networks. In Thirty-First AAAI Conference on Artificial Intelligence, 2017. + +Jacob Goldberger and Ehud Ben-Reuven. Training deep neural-networks using a noise adaptation layer. 2016. + +I. Guyon, N. Matic, and V. Vapnik. Discovering informative patterns and data cleaning. In AAAI Workshop on Knowledge Discovery in Databases, 1994. + +Bo Han, Jiangchao Yao, Gang Niu, Mingyuan Zhou, Ivor Tsang, Ya Zhang, and Masashi Sugiyama. Masking: A new perspective of noisy supervision. In Advances in Neural Information Processing Systems, pp. 5836–5846, 2018. + +Dan Hendrycks, Mantas Mazeika, Duncan Wilson, and Kevin Gimpel. Using trusted data to train deep networks on labels corrupted by severe noise. In Advances in neural information processing systems, pp. 10456–10465, 2018. + +H. Jiang, B. Kim, M. Y. Guan, and M. R. Gupta. To trust or not to trust a classifier. In Advances in Neural Information Processing Systems (NeurIPS), 2018. + +Heinrich Jiang. Non-asymptotic uniform rates of consistency for k-nn regression. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3999–4006, 2019. + +Lu Jiang, Zhengyuan Zhou, Thomas Leung, Li-Jia Li, and Li Fei-Fei. Mentornet: Regularizing very deep neural networks on corrupted labels. arXiv preprint arXiv:1712.05055, 4, 2017. + +Ishan Jindal, Matthew Nokleby, and Xuewen Chen. Learning deep networks from noisy labels with dropout regularization. In 2016 IEEE 16th International Conference on Data Mining (ICDM), pp. 967–972. IEEE, 2016. + +Ashish Khetan, Zachary C Lipton, and Anima Anandkumar. Learning from noisy singly-labeled data. arXiv preprint arXiv:1712.04577, 2017. + +Yuncheng Li, Jianchao Yang, Yale Song, Liangliang Cao, Jiebo Luo, and Li-Jia Li. Learning from noisy labels with distillation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1910–1918, 2017. +Tongliang Liu and Dacheng Tao. Classification with noisy labels by importance reweighting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 38(3):447–461, 2015. +Enno Mammen, Alexandre B Tsybakov, et al. Smooth discrimination analysis. The Annals of Statistics, 27(6):1808–1829, 1999. +Hamed Masnadi-Shirazi and Nuno Vasconcelos. On the design of loss functions for classification: theory, robustness to outliers, and savageboost. In Advances in Neural Information Processing Systems, pp. 1049–1056, 2009. +Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with noisy labels. In Advances in Neural Information Processing Systems, pp. 1196–1204, 2013. +Nicolas Papernot and Patrick McDaniel. Deep k-nearest neighbors: Towards confident, interpretable and robust deep learning. arXiv preprint arXiv:1803.04765, 2018. +Giorgio Patrini, Alessandro Rozza, Aditya Krishna Menon, Richard Nock, and Lizhen Qu. Making deep neural networks robust to label noise: A loss correction approach. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1944–1952, 2017. +Henry WJ Reeve and Ata Kaban. Fast rates for a kNN classifier robust to unknown asymmetric label noise. arXiv preprint arXiv:1906.04542, 2019. +Mengye Ren, Wenyuan Zeng, Bin Yang, and Raquel Urtasun. Learning to reweight examples for robust deep learning. arXiv preprint arXiv:1803.09050, 2018. +David Rolnick, Andreas Veit, Serge Belongie, and Nir Shavit. Deep learning is robust to massive label noise. arXiv preprint arXiv:1705.10694, 2017. +Aarti Singh, Clayton Scott, Robert Nowak, et al. Adaptive Hausdorff estimation of density level sets. The Annals of Statistics, 37(5B):2760–2782, 2009. +Charles J Stone. Consistent nonparametric regression. The Annals of Statistics, pp. 595–620, 1977. +Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. arXiv preprint arXiv:1406.2080, 2014. +Alexander B Tsybakov et al. Optimal aggregation of classifiers in statistical learning. The Annals of Statistics, 32(1):135–166, 2004. +Arash Vahdat. Toward robustness against label noise in training deep discriminative neural networks. In Advances in Neural Information Processing Systems, pp. 5596–5605, 2017. +Brendan Van Rooyen, Aditya Menon, and Robert C Williamson. Learning with symmetric label noise: The importance of being unhinged. In Advances in Neural Information Processing Systems, pp. 10–18, 2015. +Andreas Veit, Neil Alldrin, Gal Chechik, Ivan Krasin, Abhinav Gupta, and Serge Belongie. Learning from noisy large-scale datasets with minimal supervision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 839–847, 2017. +Yizhen Wang, Somesh Jha, and Kamalika Chaudhuri. Analyzing the robustness of nearest neighbors to adversarial examples. In International Conference on Machine Learning, pp. 5120–5129, 2018. +D. Wilson. Asymptotic properties of nearest neighbor rules using edited data. IEEE Trans. on Systems, Man and Cybernetics, 1972. +Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2691–2699, 2015. +Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In Advances in Neural Information Processing Systems, pp. 8778–8788, 2018. + +# A PROOFS + +A.1 SUPPORTING THEORETICAL RESULTS + +The following bounds $r _ { k } ( x )$ uniformly in $x \in \mathcal { X }$ . Lemma 1 (Lemma 2 of Jiang (2019)). The following holds with probability at least $1 - \delta / 2$ . If + +$$ +2 ^ { 8 } \cdot D \log ^ { 2 } ( 4 / \delta ) \cdot \log n \leq k \leq { \frac { 1 } { 2 } } \cdot \omega \cdot p _ { X , 0 } \cdot v _ { D } \cdot r _ { 0 } ^ { D } \cdot n , +$$ + +then $\begin{array} { r } { \operatorname* { s u p } _ { x \in \mathcal { X } } r _ { k } ( x ) \leq \left( \frac { 2 k } { \omega \cdot v _ { D } \cdot n \cdot p _ { X , 0 } } \right) ^ { 1 / D } } \end{array}$ , where $v _ { D }$ is the volume of the unit ball in $\mathbb { R } ^ { D }$ . + +The next result bounds the number of distinct $k$ -NN sets over $\mathcal { X }$ . + +Lemma 2 (Lemma 3 of Jiang (2019)). Let $M$ be the number of distinct $k$ -NN sets over $\mathcal { X }$ , that is, $M : = | \{ N _ { k } ( x ) : x \in \mathcal { X } \} |$ . Then $M \leq D \cdot n ^ { D }$ . + +# A.2 MINIMUM $k$ -NN SPREAD + +We propose a more notion of how spread out a set of points is than $S _ { 2 }$ which will be used in the theoretical analysis. This will allow us to more precisely characterize how difficult a configuration of incorrectly labeled examples will be to work with in the $k$ -NN context. For example, if such examples are spread out far apart, then there will be many correctly labeled examples nearby for the $k$ -NN approach to identify the incorrectly labeled examples. On the other hand, if the corrupted examples are all close together, then it will be more difficult to identify them without many uncorrected examples in that region. To this end, we define the minimum $k$ -NN spread: + +Definition 4 (minimum $k$ -NN spread). + +$$ +S _ { k } ( C ) : = \operatorname* { m i n } _ { x \in C } r _ { k } ( x , C ) , +$$ + +where $r _ { k } ( x , C )$ denotes the distance from $x$ to the $k$ -th closest neighbor in $C$ . + +Note that this definition is consistent with the earlier definition of $S _ { 2 }$ . + +# A.3 PROOF OF THEOREM 1 + +Proof of Theorem $^ { l }$ . Let $\tau , \gamma , \epsilon > 0$ be quantities that will be determined later. Suppose that for some $\dot { x } \in \mathcal { X } ^ { \Delta }$ , we have $r _ { k } ( x ) \ \leq \ \tau$ and $S _ { \mathrm { \lfloor ( \frac { 1 } { 2 } - \gamma ) \cdot k \rfloor } } ( C ) \geq \tau$ . Then, at least $\textstyle { \frac { 1 } { 2 } } + \gamma$ fraction of the points within $x$ ’s $k$ -nearest neighbors are not in the corrupted set $C$ . Let $A _ { x } : = N _ { k } ( x ) \backslash C$ , that is, the $k$ -nearest neighbors of $x$ that are not in $C$ . Then it is clear that $A _ { x }$ is a $k _ { 0 }$ -nearest neighbor set of $x$ relative to $X \backslash C$ for some $k _ { 0 } \geq \lceil ( \frac { 1 } { 2 } + \gamma ) \cdot k \rceil$ . We have that $A _ { x } \subseteq \mathcal { X } ^ { \Delta } \oplus \tau$ where $\begin{array} { r } { A _ { \mathbf { \lambda } } \oplus { } r : = \{ x \in \mathcal { X } : \operatorname* { i n f } _ { a \in A } | x - a | \leq r \} . } \end{array}$ . Let us consider without loss of generality that $\eta ( x ) \ge \frac { 1 } { 2 } + \Delta$ (call this set $\chi \Delta , +$ ). The case $\begin{array} { r } { \mathring { \mathcal { X } } ^ { \Delta , - } : = \{ { x } \in \mathcal { X } ^ { \Delta } : \eta ( { x } ) \leq \frac { 1 } { 2 } - \breve { \Delta } \} } \end{array}$ follows by symmetry. Thus, we have $\eta ( x ^ { \prime } ) \geq \frac { 1 } { 2 } + \Delta - C _ { \alpha } \tau ^ { \alpha }$ for all $x ^ { \prime } \in A _ { x }$ . By Hoeffing’s inequality, we have + +$$ +\mathbb { P } \left( \frac { 1 } { \lvert A _ { x } \rvert } \sum _ { x ^ { \prime } \in A _ { x } } y ( x ^ { \prime } ) < \frac { 1 } { 2 } + \Delta - C _ { \alpha } \tau ^ { \alpha } - \epsilon \right) \le \exp ( - 2 \epsilon ^ { 2 } \cdot k _ { 0 } ) , +$$ + +where $y ( x )$ is the label corresponding to sample $x$ . By Lemma 2, we have that there are at most $\boldsymbol { D } \cdot \boldsymbol { n } ^ { D }$ such $k _ { 0 }$ -nearest neighbor sets across all $k _ { 0 }$ in $X \backslash C$ . That is, this is also a bound on the number of distinct $A _ { x }$ for $x \in \mathcal { X }$ . Therefore, if we set + +$$ +\epsilon = \sqrt { \frac { D \log n + \log ( 4 D / \delta ) } { ( 1 + 2 \gamma ) \cdot k } } , +$$ + +then by union bound, we have that + +$$ +\mathbb { P } \left( \operatorname* { i n f } _ { x \in \mathcal { X } ^ { \Delta , + } } \frac { 1 } { \left| A _ { x } \right| } \sum _ { x ^ { \prime } \in A _ { x } } y ( x ^ { \prime } ) < \frac { 1 } { 2 } + \Delta - C _ { \alpha } \tau ^ { \alpha } - \epsilon \right) \leq \frac { \delta } { 4 } . +$$ + +and thus, with probability at least $1 - \delta / 4$ , we have that $\begin{array} { r } { \frac { 1 } { | A _ { x } | } \sum _ { x ^ { \prime } \in A _ { x } } y ( x ^ { \prime } ) \ \geq \ \frac { 1 } { 2 } + \Delta - } \end{array}$ $C _ { \alpha } \tau ^ { \alpha } - \epsilon$ uniformly over $x \in \mathcal { X } ^ { \Delta , + }$ . Similarly, with probability at least $1 - \delta / 4$ we have that 1|A | Px0∈A y(x0) ≤ 12 − ∆ + Cατ α +  uniformly over x ∈ X ∆,−. + +Hence, in order for $k$ -nearest neighbor prediction to predict the Bayes-optimal label on $\chi ^ { \Delta }$ , it suffices that + +$$ +k _ { 0 } \left( \frac { 1 } { 2 } + \Delta - C _ { \alpha } { \tau } ^ { \alpha } - \epsilon \right) \geq \frac { k } { 2 } . +$$ + +Since $k _ { 0 } \geq ( \frac { 1 } { 2 } + \gamma ) \cdot k$ , we have that the above holds if + +$$ +\Delta \ge C _ { \alpha } \tau ^ { \alpha } + \epsilon + \frac { 1 - 2 \gamma } { 2 ( 1 + 2 \gamma ) } . +$$ + +We now choose the values of $\tau , \gamma , \epsilon$ to upper bound each of the terms on the R.H.S. by $\Delta / 3$ so that the above holds. + +We can bound the last term by $\Delta / 3$ by setting: + +$$ +\gamma = \frac { 1 } { 2 } \cdot \frac { 3 - 2 \Delta } { 3 + 2 \Delta } . +$$ + +Next, taking + +$$ +\displaystyle { k \geq \frac { 3 ( 3 + 2 \Delta ) } { 2 \Delta ^ { 2 } } \left( D \log n + \log ( 4 D / \delta ) \right) , } +$$ + +we have that $\epsilon \leq \Delta / 3$ . Now, by Lemma 1, we have that setting + +$$ +\tau = \left( \frac { 2 k } { \omega \cdot v _ { D } \cdot n \cdot p _ { X , 0 } } \right) ^ { 1 / D } +$$ + +gives us that $r _ { k } ( x ) \leq \tau$ for all $x \in \mathcal { X }$ with probability at least $1 - \delta / 2$ . It thus suffices to take + +$$ +k \leq { \frac { 1 } { 2 } } \left( { \frac { \Delta } { 3 \cdot C _ { \alpha } } } \right) ^ { D / \alpha } \cdot \omega \cdot v _ { D } \cdot p _ { X , 0 } \cdot n +$$ + +so that $C _ { \alpha } \tau ^ { \alpha } \leq \Delta / 3$ . Now in order for $S _ { \left\lfloor \left( { \frac { 1 } { 2 } } - \gamma \right) \cdot k \right\rfloor } ( C ) \geq \tau$ , it suffices to have $S _ { 2 } ( C ) \geq \tau$ . This can be accomplished by having the following hold: + +$$ +k \leq \frac 1 2 \cdot S _ { 2 } ( C ) ^ { D } \cdot \omega \cdot v _ { D } \cdot p _ { X , 0 } \cdot n . +$$ + +Thus, there exists positive constants $K _ { l }$ and $K _ { u }$ depending only on $\mathcal { F }$ such that if + +$$ +K _ { u } \cdot \frac { 1 } { \Delta ^ { 2 } } \cdot ( \log ^ { 2 } ( 1 / \delta ) \cdot \log n ) \le k \le K _ { u } \cdot \operatorname* { m i n } \{ S _ { 2 } ( C ) ^ { D } , \Delta ^ { D / \alpha } \} \cdot n , +$$ + +then the desired conditions hold. + +# A.4 PROOF OF THEOREM 2 + +Proof of Theorem 2. The proof begins in the same way as the proof of Theorem 1. As before, let $\tau , \gamma , \epsilon > 0$ be quantities that will be determined later. Like before, we are reduced to showing + +$$ +\Delta \ge C _ { \alpha } \tau ^ { \alpha } + \epsilon + \frac { 1 - 2 \gamma } { 2 ( 1 + 2 \gamma ) } , +$$ + +as long as the conditions for Lemma 1 and 2 hold and $S _ { 2 } ( x ) \geq \tau$ and $r _ { k } ( x ) \leq \tau$ where we choose + +$$ +\epsilon = \sqrt { \frac { D \log n + \log ( 4 D / \delta ) } { ( 1 + 2 \gamma ) \cdot k } } , \quad \gamma = \frac { 1 } { 2 } \cdot \frac { 3 - 2 \Delta } { 3 + 2 \Delta } , \quad \tau = \left( \frac { 2 k } { \omega \cdot v _ { D } \cdot n \cdot p _ { X , 0 } } \right) ^ { 1 / D } . +$$ + +These conditions hold for some $K _ { u }$ and $K _ { l }$ depending on $\mathcal { F }$ . Then we are reduced to having + +$$ +\frac 2 3 \Delta \geq \sqrt { \frac { D \log n + \log ( 4 D / \delta ) } { ( 1 + 2 \gamma ) \cdot k } } + C _ { \alpha } \left( \frac { 2 k } { \omega \cdot v _ { D } \cdot n \cdot p _ { X , 0 } } \right) ^ { \alpha / D } . +$$ + +Since $\gamma \geq 0$ , it suffices to have + +$$ +\frac 2 3 \Delta \geq \sqrt { \frac { D \log n + \log ( 4 D / \delta ) } { k } } + C _ { \alpha } \left( \frac { 2 k } { \omega \cdot v _ { D } \cdot n \cdot p _ { X , 0 } } \right) ^ { \alpha / D } . +$$ + +The desired form for $\Delta$ clearly follows for some choice of $K$ depending only on $D , \omega , p _ { X , 0 } , C _ { \alpha }$ , all of which depend only on $\mathcal { F }$ . + +Finally, we must ensure that $\begin{array} { r } { \lfloor \left( \frac { 1 } { 2 } - \gamma \right) \cdot k \rfloor \ge 2 } \end{array}$ so that $S _ { \lfloor ( \frac { 1 } { 2 } - \gamma ) \cdot k \rfloor } ( C ) \geq S _ { 2 } ( x )$ . Given the expression for $\gamma$ , it is equivalent to have $\begin{array} { r } { \lfloor \left( \frac { 2 \Delta } { 3 + 2 \Delta } \right) \cdot k \rfloor \ge 2 } \end{array}$ . It suffices to show that $k \geq \frac { 3 ( 3 + 2 \Delta ) } { 2 \Delta }$ . Given the form of $\Delta$ in terms of $n$ and $k$ , we see that it suffices to have that + +$$ +k \geq \frac { 9 } { 2 } \cdot K \cdot \left( \left( \sqrt { \frac { \log n + \log ( 1 / \delta ) } { k } } + \left( \frac { k } { n } \right) ^ { \alpha / D } \right) \right) ^ { - 1 } + 3 , +$$ + +which holds when $k \geq K _ { 0 } \cdot n ^ { 2 \alpha / ( 2 \alpha + D ) }$ for some $K _ { 0 }$ depending only on $\mathcal { F }$ , as desired. + +# A.5 PROOF OF THEOREM 3 + +Proof of Theorem 3. The first part follows from Theorem 2. For the second part, we have by Theorem 2 that if $x \in \mathcal { X } ^ { \Delta }$ , then the $k$ -NN classifier and the Bayes-optimal classifier match with probability $1 - \delta$ uniformly. Thus, we have + +$$ +\begin{array} { r l } & { { R _ { X } } - { R ^ { * } } \leq \mathbb { P } ( x \notin \mathcal { X } ^ { \Delta } ) \left( \mathbb { E } _ { \mathcal { F } } [ g _ { k } ( x ) \neq y | x \notin \mathcal { X } ^ { \Delta } ] - \mathbb { E } _ { \mathcal { F } } [ g ^ { * } ( x ) \neq y | x \notin \mathcal { X } ^ { \Delta } ] \right) } \\ & { \qquad \leq { C _ { \beta } } \cdot \Delta ^ { \beta } \cdot \left( \mathbb { E } _ { \mathcal { F } } [ g _ { k } ( x ) \neq y | x \notin \mathcal { X } ^ { \Delta } ] - \mathbb { E } _ { \mathcal { F } } [ g ^ { * } ( x ) \neq y | x \notin \mathcal { X } ^ { \Delta } ] \right) \leq { C _ { \beta } } \cdot \Delta ^ { \beta } \cdot 2 \Delta . } \end{array} +$$ + +The result follows immediately from Theorem 2. + +# B HARD FLIP PERMUTATIONS + +For Fashion MNIST we hard flip by swapping the following classes: TSHIRT $\mathbf { \Gamma } \mathbf { S } \mathbf { H }$ IRT, TROUSER DRESS, PULLOVER $ { \mathrm { C O A T } }$ , SANDAL BAG, SNEAKER ANKLEBOOT. For CIFAR10 we swap the pairs: TRUCK AUTOMOBILE, BIRD AIRPLANE, DEER HORSE, $\mathrm { \Delta ^ { \circ } A T D O G , F R O G S H I P } .$ For CIFAR100, we hard flip circularly (i.e. $\pi ( i ) = ( i + 1 )$ mod $K$ ) within each of the 20 superclasses. For all other datasets, we hard flip circularly. + +# C ADDITIONAL PLOTS + +We provide the plots that were ommitted from the main text due to space constraints. + +![](images/b0ed2ba266c60068ff3dae602d3d366a40e369b698f23e630d34c9e7b16d4df8.jpg) +Figure 7: Plots for UCI Phonemes dataset at 10, $20 \%$ clean data and all corruption types. + +![](images/fd301d7489d6add70bc32fbe9265693de52d35eca6d46192660c844e5416755d.jpg) +Figure 8: Plots for UCI Letters dataset at 5, 10, $20 \%$ clean data and all corruption types. + +![](images/c0d10fb72c0b3b5dc5b529f44b659f73f34c05578981e9e26e61865617eed400.jpg) +Figure 9: Plots for UCI Wilt dataset at 5, 10, $20 \%$ clean data and all corruption types. + +![](images/ea06ad567bbd80dd5b68f9fe8543665e26ca734fb806c30253701095ede62375.jpg) +Figure 10: Plots for UCI Parkinsons dataset at 5, 10, $20 \%$ clean data and all corruption types. + +![](images/ce100b40cecb10eb16eff221e51aa01cb4216b22193f021cf47e2d4cc84e9408.jpg) +Figure 11: Plots for UCI Seeds dataset at 5, 10, $20 \%$ clean data and all corruption types. + +![](images/05c83fe46ff4716a25cef2e1e4bb007a173762ca1659150ed5fcf62e93e05d9a.jpg) +Figure 12: Plots for UCI Iris dataset at 5, 10, $20 \%$ clean data and all corruption types. + +![](images/4a13dafd39d618711450e4058f06039030bb1d53dbeb9a251b02ff4ac419826c.jpg) +Figure 13: Plots for MNIST at 5, 10, $20 \%$ clean data and all corruption types. + +![](images/bd19bff29a042b137d3bdd4407bd1715b4d20fd550306ef6305f63ed2a56322c.jpg) +Figure 14: Plots for Fashion MNIST at 10, $20 \%$ clean data and all corruption types. + +![](images/c366826de5a31989b69401d8e19ffe7414d00102cc30dfc39d51738ab71efc7c.jpg) +Figure 15: Plots for CIFAR10 at 10, $20 \%$ clean data and all corruption types. + +![](images/9aa4caec2501672a4d8f41830c32c189465affdae13c054e170beb53e4729c7b.jpg) +Figure 16: Plots for CIFAR100 at 5, 10, $20 \%$ clean data and all corruption types. + +![](images/30dbe53aacfa2b2e841b9b4bab8f42690c5b9a2261f927822c52c9ebfee45559.jpg) +Figure 17: Plots for SVHN at 10, $20 \%$ clean data and all corruption types. \ No newline at end of file diff --git a/md/train/By4HsfWAZ/By4HsfWAZ.md b/md/train/By4HsfWAZ/By4HsfWAZ.md new file mode 100644 index 0000000000000000000000000000000000000000..726c9ce2323afee00a1260ac641c433fdfd7c369 --- /dev/null +++ b/md/train/By4HsfWAZ/By4HsfWAZ.md @@ -0,0 +1,313 @@ +# DEEP LEARNING FOR PHYSICAL PROCESSES: INCORPORATING PRIOR SCIENTIFIC KNOWLEDGE + +Emmanuel de Bezenac ´ ∗, Arthur Pajot ∗, Patrick Gallinari emmanuel.de-bezenac, arthur.pajot, patrick.gallinari @lip6.fr Sorbonne Universites, UMR 7606, LIP6, F-75005 Paris, France ´ + +# ABSTRACT + +We consider the use of Deep Learning methods for modeling complex phenomena like those occurring in natural physical processes. With the large amount of data gathered on these phenomena the data intensive paradigm could begin to challenge more traditional approaches elaborated over the years in fields like maths or physics. However, despite considerable successes in a variety of application domains, the machine learning field is not yet ready to handle the level of complexity required by such problems. Using an example application, namely Sea Surface Temperature Prediction, we show how general background knowledge gained from the physics could be used as a guideline for designing efficient Deep Learning models. In order to motivate the approach and to assess its generality we demonstrate a formal link between the solution of a class of differential equations underlying a large family of physical phenomena and the proposed model. Experiments and comparison with series of baselines including a state of the art numerical approach is then provided. + +# 1 INTRODUCTION + +A physical process is a sustained phenomenon marked by gradual changes through a series of states occurring in the physical world. Physicists and environmental scientists attempt to model these processes in a principled way through analytic descriptions of the scientist’s prior knowledge of the underlying processes. Conservation laws, physical principles or phenomenological behaviors are generally formalized using differential equations. This physical paradigm has been, and still is the main framework for modeling complex natural phenomena like e.g. those involved in climate. With the availability of very large datasets captured via different types of sensors, this physical modeling paradigm is being challenged by the statistical Machine Learning (ML) paradigm, which offers a prior-agnostic approach. However, despite impressive successes in a variety of domains as demonstrated by the deployment of Deep Learning methods in fields such as vision, language, speech, etc, the statistical approach is not yet ready to challenge the physical paradigm for modeling complex natural phenomena, or at least it has not demonstrated how to. This is a new challenge for this field and an emerging research direction in the ML community. We believe that knowledge and techniques accumulated for modeling physical processes in well developed fields such as maths or physics could be useful as a guideline to design efficient learning systems and conversely, that the ML paradigm could open new directions for modeling such complex phenomena. In this paper we then raise two issues: 1) are modern ML techniques ready to be used to model complex physical phenomena, and 2) how general knowledge gained from the physical modeling paradigm could help designing efficient ML models. + +In this work, we tackle these questions by considering a specific physical modeling problem: forecasting sea surface temperature (SST). SST plays a significant role in analyzing and assessing the dynamics of weather and other biological systems. Accurately modeling and predicting such dynamics is critical in various applications such as weather forecasting, or planning of coastal activities. Since 1982, weather satellites have made huge quantities of very high resolution SST data available Bernstein (1982). Standard physical methods for forecasting SST use coupled ocean-atmosphere prediction systems, based on the Navier Stokes equations. These models rely on multiple physical hypotheses and do not optimally exploit the information available in the data. On the other hand, despite the availability of large amounts of data, direct applications of ML methods do not lead to competitive state of the art results, as will be seen in section 4. + +We use SST as a typical and representative problem of intermediate complexity. Our goal is not to offer one more solution to this problem, but to use it as an illustration for advancing on the challenges mentioned above. The way we handle this problem is general enough to be transfered to a more general class of transport problems. + +We propose a Deep Neural Network (NN) model, inspired from general physical motivations which offers a new approach for solving this family of problems. We first motivate our approach by introducing in section 2 the solution of a general class of partial differential equations (PDE) which is a core component of a large family of transport and propagation phenomena in physics. This general solution is used as a guideline for introducing a Deep Learning architecture for SST prediction which is described in section 3. Experiments and comparison with a series of baselines is introduced in section 4. A review of related work is finally presented in section 5. + +The main contributions of this work are: 1) an example showing how to incorporate general physical background for designing a NN aimed at modeling a relatively complex prediction task. We believe the approach to be general enough to be used for a family of transport problems obeying general advection-diffusion principles. 2) formal links between our model’s prediction and the solution of a general advection diffusion PDE 3) an unsupervised model for estimating motion fields, given a sequence of images. 4) a proof, on a relatively complex physical modeling problem, that full data intensive approaches based on deep architectures can be competitive with state of the art dedicated numerical methods. + +# 2 PHYSICAL MOTIVATION + +Forecasting consists in predicting future temperature maps using past records. Temperatures are acquired via satellite imagery. If we focus on a specific area, we can formulate the problem as prediction of future temperature images of this area using past images. The classical approach to forecasting SST consists in using numerical models representing prior knowledge on the conservation laws and physical principles, which take the form of PDEs. These models are then coupled with SST data using assimilation techniques in order to adjust to initial conditions. It is then integrated forward in time to predict SST evolution. For the sea surface, temperature variation is related to a fluid transport problem. In fluids, transport occurs through the combination of two principles: advection and diffusion. During advection, a fluid transports some conserved quantity $I$ (the temperature for SST) or material via bulk motion, i.e.for small variations $\Delta x , \Delta t$ , conservation is expressed as: + +$$ +I ( x , t ) = I ( x + \Delta x , t + \Delta t ) +$$ + +applying a first order approximation of the right hand side and moving the resulting terms to the left hand side of equation 1, we obtain the advection equation, known also as the Brightness Constancy Constraint Equation (BCCE): + +$$ +\frac { \partial I } { \partial t } + ( w . \nabla ) I = 0 +$$ + +where $\nabla$ denotes the gradient operator, and $w$ the motion vector $\textstyle { \frac { \Delta x } { \Delta t } }$ . This equation describes the temporal evolution of quantity $I$ for displacement $w$ . Note that this equation is also the basis for many variational methods for Optical Flow. To retrieve the motion, numerical schemes are applied, and the resulting system of equations, along with a an additional constraint on $w$ is solved for $w$ . This motion can then be used to forecast the future value of $I$ . + +$$ +\frac { \partial I } { \partial t } + ( w . \nabla ) I = D \nabla ^ { 2 } I +$$ + +$\nabla ^ { 2 }$ denotes the Laplacian operator and $D$ the diffusion coefficient. Note that when $D \to 0$ , we recover the advection equation 2. + +This equation describes a large family of physical processes (e.g. fluid dynamics, heat conduction, wind dynamics, etc). Let us now state a result, characterizing the general solutions of equation 3. + +Theorem 1. 1 For any initial condition $I _ { 0 } \in L ^ { 1 } ( \mathbb { R } ^ { 2 } )$ with $I _ { 0 } ( \pm \infty ) = 0$ , there exists a unique global solution $I ( x , t )$ to the advection-diffusion equation 3: + +$$ +I ( x , t ) = \int _ { \mathbb { R } ^ { 2 } } k ( x - w , y ) I _ { 0 } ( y ) d y +$$ + +where $\begin{array} { r } { k ( u , v ) = \frac { 1 } { 4 \pi D t } e ^ { - \frac { 1 } { 4 D t } \left. u - v \right. ^ { 2 } } } \end{array}$ is a radial basis function kernel, or alternatively, a 2 dimensional Gaussian probability density with mean $u$ and variance $2 D t$ . + +Equation 4 provides a principled way to calculate $I ( x , t )$ for any time $t$ using the initial condition $I _ { 0 }$ , provided the motion $w$ and the diffusion coefficient $D$ are known. It states that quantity $I ( x , t )$ can be computed from the initial condition $I _ { 0 }$ via a convolution with a Gaussian probability density function. In other words, if $I$ was used as a model for the evolution of the SST and the surface’s underlying advecting mechanisms were known, future surface temperatures could be predicted from previous ones. Unfortunately neither the initial conditions, the motion vector nor the diffusion coefficient are known. They have to be estimated from the data. Inspired from the general form of solution 4, we propose a ML method, expressed as a Deep Learning architecture for predicting SST. This model will learn to predict a motion field analog to the $w$ in equation 4, which will be used to predict future images. + +# 3 MODEL + +![](images/723d416121047ed73a5ae5137105467c9d588884d82dff94268dd9f826d12a3b.jpg) +Figure 1: Motion is estimated from the input images $( I _ { t - k - 1 : t } )$ with a convolutional neural network (top left CDNN component). A warping scheme then displaces the last input image along this motion estimate to produce the future image. The error signal is calculated using the target future image $I _ { t + 1 }$ , and is backprogated through the warping scheme to correct the CDNN. To produce multiple time-step forecasts, the predicted image is fed back in the CDNN in an autoregressive manner. + +The model consists of two main components, as illustrated in Figure 1. One predicts the motion field from a sequence of past input images, this is convolutional-deconvolutional (CDNN) module on the top of figure 1, and the other warps the last input image using the motion field from the first component, in order to produce an image forecast. The entire system is trained in an end-to-end fashion, using only the supervision from the target SST image. By doing so, we are able to produce an interpretable latent state which corresponds in our problem to the velocity field advecting the temperatures. + +Let us first introduce some notations. Each SST image $I _ { t }$ is acquired on a bounded rectangle of $\mathbb { R } ^ { 2 }$ , named $\Omega$ . We denote $I _ { t } ( x )$ and $w _ { t } ( x )$ the sea surface temperature and the two-dimensional motion vector at time $t \in \mathbb { R }$ at position $x \in \Omega$ . $I _ { t } : \Omega \to \mathbb { R }$ and $\dot { w } _ { t } : \Omega \to \mathbb { R } ^ { 2 }$ represent the temperatures and the motion vector field at time $t$ defined on $\Omega$ . When time $t$ and position $x$ are available from the context, we will drop the subscript $t$ from $w _ { t } ( x )$ and $I _ { t } ( x )$ , along with $x$ for clarity. Given a sequence of $k$ consecutive SST images $\{ I _ { t - k - 1 } , . . . , I _ { t } \}$ (also denoted as $I _ { t - k - 1 : t } )$ , our goal is to predict the next image $I _ { t + 1 }$ . + +![](images/fdfbc089060a5d4b341bb93d8bfc0394e30c6e4e3b5ae9494dd7e8d78b641924.jpg) +Figure 2: Architecture of the CDNN motion estimation component. For the estimated motion flow $\hat { w } _ { t }$ , colours correspond to the flow orientation and colour intensity to the flow intensity + +As indicated in section 2, provided the underlying motion field is known, one can compute SST forecasts. Let us introduce how the motion field is estimated in our architecture. We are looking for a vector field $w$ which when applied to the geometric space $\Omega$ renders $I _ { t }$ close to $I _ { t + 1 }$ , i.e. $I _ { t + 1 } ( \bar { x } ) \simeq$ $I _ { t } ( x + w ( x ) )$ , $\forall x \in \Omega$ . If $I _ { t + 1 }$ were known, we could estimate $w$ , but $I _ { t + 1 }$ is precisely what we are looking for. Instead, we choose to use a convolutional-deconvolutional architecture to predict a motion vector for each pixel. As shown in figure 2, this network makes use of skip connections He et al. (2015), allowing fine grained information from the first layers to flow through in a more direct manner. We use a Batch Normalization layer between each convolution, and Leaky $R e L U$ (with parameter value set to 0.1) non-linearities between convolutions and transposed-convolutions. We used $k = 4$ concatenated images $I _ { t - k - 1 : t }$ as input for training. We have selected this architecture experimentally, testing different state-of-the-art convolution-deconvolution network architectures. Let $\hat { w } \in \mathbb { R } ^ { 2 \times \mathbf { \bar { W } } \times H }$ be the output of the network, where $W$ and $H$ are respectively the width and height of the images, and $\mathit { \Omega } ^ { , }$ corresponds to the two components of the flow at each point of the motion field. + +Generally, and this is the case for our problem, we do not have a direct supervision on the motion vector field, since the target motion is usually not available. Using the warping scheme introduced below, we will nonetheless be able to (weakly) supervise $w$ , based on the discrepancy of the warped version of the $I _ { t }$ image and the target image $I _ { t + 1 }$ . + +# 3.2 WARPING SCHEME + +![](images/f26b7c0fe8bb8e32a7af7bd237402c2fba74592354a184042a168128f6b08f8e.jpg) +Figure 3: Warping scheme. To calculate the pixel value for time $t + 1$ at position $x$ , we first compute its previous position at time $t$ , i.e. $x - w$ . We then center a Gaussian in that position in order to obtain a weight value for each pixel in $I _ { t }$ based on its distance with $x - w$ , and compute a weighted average of the pixel values of $I _ { t }$ . This weighted average will correspond to the new pixel value at $x$ in $I _ { t + 1 }$ . + +Discretizing the solution of the advection-diffusion equation in section 2 by replacing the integral with a sum, and setting image $I _ { t }$ as the initial condition, we obtain a method to calculate the future image, based on the motion field estimate $\hat { w }$ . The latter is used as a warping scheme: + +$$ +\hat { I } _ { t + 1 } ( x ) = \sum _ { y \in \Omega } k ( x - \hat { w } ( x ) , y ) I _ { t } ( y ) +$$ + +where $\begin{array} { r } { k ( x - \underset { . } { \hat { w } } , y ) = \underset { . } { \frac { 1 } { 4 \pi D \Delta t } } e ^ { - \frac { 1 } { 4 D \Delta t } \| x - \hat { w } - y \| ^ { 2 } } } \end{array}$ is a radial basis function kernel, as in equation 4, parameterized by the diffusion coefficient $D$ and the time step value $\Delta t$ between $t$ and $t + 1$ and $\hat { w }$ is the estimated value of the vector flow $w$ . To calculate the temperature for time $t + 1$ at position $x$ , we compute the scalar product between $k ( x - { \hat { w } } , . )$ , a Gaussian centered in $x - \hat { w }$ , and the previous image $I _ { t }$ . Simply put, it is a weighted average of the temperatures $I _ { t }$ , where the weight values are larger when the pixel’s positions that are closer to $x - \hat { w }$ . Informally, $x - \hat { w }$ corresponds to the pixel’s previous position at time $t$ . See figure 3. + +As seen by the relation with the solution of the advection-diffusion equation, the proposed warping mechanism is then clearly adapted to the modeling of phenomena governed by the advectiondiffusion equation. SST forecasting is a particular case, but the proposed scheme can be used for any problems in which advection and diffusion are occurring. Moreover, this warping scheme is entirely differentiable, allowing backpropagation of the error signal to the motion fireld estimating module. + +This warping mechanism has been inspired by the Spatial Transformer Network (STN) Jaderberg et al. (2015), originally designed to be incorporated as a layer in a convolutional neural network architecture in order to gain invariance under geometric transformations. Using the notations in Jaderberg et al. (2015), when the inverse geometric transformation $\mathcal { T } _ { \theta }$ of the grid generator step is set to $\mathcal { T } _ { \theta } ( x ) = x - \hat { w } ( x )$ , and the kernels $k ( . ; \Phi _ { x } )$ and $k ( . ; \Phi _ { y } )$ in the sampling step are radial basis function kernels, we recover our warping scheme. The latter can be seen as a specific case of the STN, without the localization step. This result theoretically grounds the use of the STN for Optical Flow in many recent articles Zhu et al. (2017), Yu et al. (2016), Patraucean et al. (2015), Finn et al. (2016): in equation 3, when $D \to 0$ , we recover the brightness constancy constraint equation, used in the latter. + +For training, supervision is provided at the output of the warping module. It consists in minimizing the discrepancy between the warped image $\hat { I } _ { t + 1 }$ and the target image $I _ { t + 1 }$ . The loss is measured via a differentiable function and the gradient is back propagated through the warping function in order to adjust the parameters of the convolutional-deconvolutional module generating the vector field. This is detailed in the next section. + +# 3.3 LOSS FUNCTION + +At each iteration, the model aims at forecasting the next observation, given the previous ones. We evaluate the discrepancy between the warped image $\hat { I } _ { t + 1 }$ and the target image $I _ { t + 1 }$ using the Charbonnier penalty function $\rho ( x ) = ( x + \epsilon ) ^ { \frac { 1 } { \alpha } }$ , where $\epsilon$ and $\alpha$ are parameters to be set. Note that with $\epsilon = 0$ and $\alpha \stackrel { \cdot } { = } \frac { 1 } { 2 }$ , we recover the $\ell _ { 2 }$ loss. The Charbonnier penalty function is known to reduce the influence of outliers compared to an $l _ { 2 }$ norm. We have also tested the Laplacian pyramid loss Ling & Okada (2006), where we enforce convolutions of all deconvolutional layers to be close to down-sampled versions of the target image in the Charbonnier penalty sense, but we have observed an overall decrease in generalization performance. + +The proposed NN model has been designed according to the intuition gained from general background knowledge of a physical phenomenon, here advection-diffusion equations. Additional prior knowledge – expressed as partial differential equations, or through constraints – can be easily incorporated in our model, by adding penalty terms in the loss function. As the displacement $w$ is explicitly part of our model, one strength of our model is its capacity to apply some regularization term directly on the motion field. In our experiments, we tested the influence of different terms: divergence $\nabla . w _ { t } ( x ) ^ { 2 }$ , magnitude $\| w _ { t } ( x ) \| ^ { 2 }$ and smoothness $\Vert \nabla w _ { t } ( x ) \Vert ^ { 2 }$ . + +$$ +L _ { t } = \sum _ { x \in \Omega } \rho ( \hat { I } _ { t + 1 } ( x ) - I _ { t + 1 } ( x ) ) + \lambda _ { \mathrm { d i v } } ( \nabla . w _ { t } ( x ) ) ^ { 2 } + \lambda _ { \mathrm { m a g n } } \left\| w _ { t } ( x ) \right\| ^ { 2 } + \lambda _ { \mathrm { g r a d } } \left\| \nabla w _ { t } ( x ) \right\| ^ { 2 } +$$ + +# 4 EXPERIMENTS + +# 4.1 DATASET DESCRIPTION + +Since 1982, high resolution SST data has been made available by the NOAA6 weather satellite, Bernstein (1982). Dealing directly with these data requires a lot of preprocessing (e.g. some regions are not available due to clouds, hindering temperature acquisition). In order to avoid such complications which are beyond the scope of this work, we used synthetic but realistic SST data of the Atlantic ocean generated by a sophisticated simulation engine: NEMO (Nucleus for European Modeling of the Ocean) engine 2, Madec (2008). NEMO is a state-of-the-art modelling framework of ocean related engines. It is a primitive equation model adapted to the regional and global ocean circulation problems. Historical data is accumulated in the model to generate a synthesized estimate of the states of the system using data analysis, a specific data assimilation scheme, which means that the data does follow the true temperatures. The resulting dataset is constituted of daily temperature acquisitions of 481 by 781 pixels, from 2006-12-28 to 2017-04-05 (3734 acquisitions). + +We extract 64 by 64 pixel sized sub-regions as indicated in figure 4.1. We use data from years 2006 to 2015 for training and validation (94743 training examples), and years 2016 to 2017 for testing. We withhold $20 \%$ of the training data for validation, selected uniformly at random at the beginning of each experiment. For the tests we used sub-regions enumerated 17 to 20 in figure 4.1, where the interactions between hot and cold waters make the dynamics interesting to study. All the regions numbered in figure 4.1, from 2006 to 2015 where used for training 3. Each sequence of images used for training or for evaluation corresponds to a specific numbered sub-region. We make the simplifying hypothesis that the data in a single sub-region contains enough information to forecast the future of the sub-region. As the forecast is for a small temporal horizon we can assume that the influence from outside the region is small enough. + +![](images/855f62d169f130a18846bdb7f728e625abf257f5ee4968a7803f13618e9171a8.jpg) +Figure 4: Sub regions extracted for the dataset. Test regions are regions 17 to 20. + +We normalize the daily SST acquisitions of each sub region using the mean and the standard deviation of all the SST data of the sub-region acquired on the same day of the year for all the years in the training set, i.e. the SST acquisition of sub-region 2 on date September 8th 2017 is standardized using the data of all the September 8th available in the dataset. This removes the seasonal component from SST data. + +# 4.2 BASELINE COMPARISON + +We compare our model with several baselines. Each model is evaluated with a mean square error metric, forecasting images on a horizon of 6 (we forecast from $I _ { t + 1 }$ to $I _ { t + 6 }$ and then average the MSE). The hyperparameters are tuned using the validation set. Neural network based models are run on a Titan $\mathrm { X p }$ GPU, and runtime is given for comparison purpose. + +Concerning the constraints on the vector field $w$ (equation 6. the regularization coefficients selected via validation are $\lambda _ { \mathrm { d i v } } = 1$ , $\lambda _ { \mathrm { { m a g n } } } = - 0 . 0 3$ and $\lambda _ { \mathrm { g r a d } } = 0 . 4$ . The coefficient diffusion $D$ was set to 0.45 by cross validation. We also compare the results with the model without any regularization. + +Our reference model for forecasting is Ber´ eziat & Herlin (2015), a numerical assimilation model ´ which relies on data assimilation. In Ber´ eziat & Herlin (2015), the ocean’s dynamics are modeled ´ using shallow water equations Vallis (2017) and the initial conditions, along with other terms, are estimated using assimilation techniques Tremolet (2006). This is a state of the art assimilation model ´ for predicting ocean dynamics, here SST. + +The other baselines are 1) an autoregressive convolutional-deconvolutional NN (ACNN), with an architecture similar to our CDNN module, but trained to predict the future image directly, without explicitly representing the motion vector field. Each past observation is used as an input channel (the 4 input images used in the experiments are concatenated), and the output is used as new input for multi step forecasting, 2) a ConvLSTM model Shi et al. (2015), which uses convolutional transitions in the inner LSTM module, and 3) the model in Mathieu et al. (2015) which is a multi-scale ACNN trained as a Generative Adversial Network (GAN). We have used a non-official code for Mathieu et al. (2015), which is made available at https://github.com/dyelax/Adversarial_ Video_Generation. For Ber´ eziat & Herlin (2015), the code has been provided by the authors ´ of the paper. We have implemented the ACNN and ConvLSTM models ourselves. The code for our models, along with these baselines will be made available. + +# 4.3 QUANTITATIVE RESULTS + +
ModelAverage Score (MSE)Average Time
Numerical model Béréziat & Herlin (2015)1.994.8 s
ConvLSTM Shi et al. (2015)5.760.018 s
ACNN15.840.54 s
GAN Video Generation (Mathieu et al. (2015))4.730.096 s
Proposed model with regularization1.420.040 s
Proposed model without regularization2.010.040 s
+ +Table 1: Average score and average time on test data. Average score is calculated using the mean square error metric (MSE), time is in seconds. The regularization coefficients for our model have been set using a validation set with $\lambda _ { \mathrm { d i v } } = 1$ , $\lambda _ { \mathrm { { m a g n } } } = - 0 . 0 3$ and $\lambda _ { \mathrm { g r a d } } = 0 . 4$ . + +Quantitatively, our model performs well. The MSE score is better than any of the baselines. The closest NN baseline is Mathieu et al. (2015) which regularizes a regression convolutiondeconvolution model with a GAN. The performance is however clearly below the proposed model and it does not allow to easily incorporate prior constraints inspired from the physics of the phenomenon. ACNN is a direct predictor of the image sequence, implemented via a CDNN module identical to the one used in our model. Its performance is poor. Clearly, a straightforward use of prediction models is not adapted to the complexity of the phenomenon. ConvLSTM performs better: as opposed to the ACNN, it seems to be able to capture a dynamic, although not very accurately. Overall, direct prediction models are not able to capture the complex underlying dynamics and they produce blurry sequences of images. The GAN explicitly forces the network output to eliminate the blurring effect and then makes it able to capture short term dynamics. The state of the art numerical model Ber´ eziat & Herlin (2015), performs well but has a slighthly lower performance than our reg- ´ ularized model, although it incorporates more prior constraints. This shows that pure ML models, when conceived adequately and when trained with enough data, can be competitive with state of the art dedicated models. Regularizing the motion vector $w$ notably increases the performance w.r.t. to the unregularized model. The choice of the constraints (divergence, magnitude and smoothness) inspired here by physical background correspond to relevant priors on the dynamics of the model. + +![](images/0538e3fec59746d81f644731393a61c8431a5d123666afbf52804482ea01d9d5.jpg) +Figure 5: From top to bottom: target, our model prediction, our model flow, numerical assimilation model , ACNN, ConvLSTM. Data correspond to daily temperatures from January 17 to January 23, 2017 + +As for the running time, the proposed model is extremely fast, being just above the ConvLSTM model of Shi et al. (2015). The running time of Ber´ eziat & Herlin (2015)’s model is not comparable ´ to the others. It was run on a CPU (no GPU code) when all the others were run on Titan $\mathrm { X p }$ GPU. However, an optimization procedure is required to estimate the motion field, and it is clearly slower than the straightforward NN predictions. Moreover, in order to prevent the numerical scheme from diverging, multiple intermediate forecasts are required. + +Besides MSE, we need to analyze the prediction samples qualitatively. Figure 4.3 shows the predictions obtained by the different models. On the top row, the ground truth for a sequence of 4 temperature images corresponding to time $t .$ , $t + 1$ , $t + 3$ and $t + 6$ . The second row corresponds to our regularized model prediction at times $t + 1 , t + 3$ and $t + 6$ (time $t$ corresponds to the last input image, it is repeated on each row). The model seems to conserve temperatures. The prediction is close to the target for $t + 1 , t + 3$ and starts to move away at time $t + 6$ . The third row shows the motion flow estimated by the model. Each color in the flow images corresponds to a motion vector. There is clearly a strong evolving dynamic captured for this sequence. Row 4 is the numerical assimilation model of Ber´ eziat & Herlin (2015). It also clearly captures some dynamics and shows ´ interesting patterns, but it tends to diverge when the prediction horizon increases. The ACNN model (row 5) rapidly produces blurry images; it does not preserve the temperatures and does not seem to capture any dynamics. On row 6 are plotted the predictions of the ConvLSTM model. Temperature is not preserved and although a dynamic is captured, it does not correspond to the target. Overall, the proposed model seems to forecast SST quite accurately, while retrieving a coherent motion vector field. + +# 5 RELATED WORK + +ML for Physical modeling Close to this work is the field of spatio-temporal statistics. In their reference book Cressie & Wikle (2015) also advocate the use of physical background knowledge to build statistical models. They show how the design of statistical models can be inspired from partial differential equations linked to an observed physical phenomenon. They mainly consider auto-regressive models within a hierarchical Bayesian framework. In Raissi et al. (2017), Archambeau et al. (2007) and Alvarez et al. (2011) the author use PDE-inspired gaussian process to model physical process. Even if the methods and the application are different, the motivation and arguments are similar to the ones developed here. + +Another interesting research direction is the use of NNs for reducing the complexity of numerical simulation for physical processes. Generally, in these approaches statistical models are used in place of a computational demanding component of the numerical simulation process. For example in the domain of fluid dynamics, Tompson et al. (2017) and Ladicky et al. (2015) propose to use regressors ´ for simulating fluid and smoke animation. Ladicky et al. (2015) use a random forest to compute ´ particle location and Tompson et al. (2017) use a CNN to approximate part of a numerical PDE scheme. In these approaches, ML is only a component of a numerical simulation scheme whereas we aim at modeling the whole physical process via a Deep Learning approach. Farther to our objective, Rudy et al. (2017) make use of a sparse regression method for discovering the governing partial differential equation(s) of a given system by time series measurements in the spatial domain. Other works have suggested using neural networks for physical process forecast, such as Brajard et al. (2017). + +Our work is also related to recent developments in computer vision, in the related but distinct fields of video prediction and motion estimation in videos. Our goal and the domain of application are clearly different from video modeling, but since our solution involves predicting a motion field and the next SST image, the solutions share some similarities. Motion estimation and video predictions by deep architectures have motivated a series of work over the last two years. We briefly review them below and outline the differences. + +Optical Flow Optical flow consists in retrieving the apparent motion of objects, surfaces, or particles between two consecutive frames of a video. The extracted motion can be used in many areas such as object detection, object tracking, movement detection, robot navigation and visual odometry. In the vision community, this is considered as a problem by itself and several papers are dedicated to this topic. Classical methods rely on the brightness constancy constrain equation (BCCE) (equation 2), derived from the observation that surfaces usually persist over time and hence the intensity value of a small region remains the same despite its position change Sun et al. (2008). Since using BCCE directly leads to complicated optimizing issues, classic approaches – namely differential methods – approximate BCCE using a first order Taylor expansion and develop variational methods. + +As an alternative to these methods, Deep Learning models have been recently proposed for estimating the optical flow between 2 images. Fischer et al. (2015) formulate optical flow as a supervised regression problem, using a CNN to predict motion. Ilg et al. (2016) build on this approach and propose to use an ensemble of these CNN architectures. They assess results on par with state of the art methods for optical flow, while maintaining a small computational overhead. The difficulty here is that these methods require a notable quantity of target data, i.e. optical flow images, while because of the complexity of manually annotating flow images, there are only a few small annotated collections available. Fischer et al. (2015) and Ilg et al. (2016) chose to pretrain their model on a synthetic dataset made of computer animations and their associated motion and show that this information transfers well to real videos. Yu et al. (2016) demonstrate that it is possible to predict the optical flow between two input images in an unsupervised way using a CNN and a Spatial Transformer Network. This is however not extensible for prediction as is done in our setting since this requires the two images $I _ { t }$ and $I _ { t + 1 }$ as input while $I _ { t + 1 }$ is not available at inference time for prediction. + +# Video prediction + +It is only very recently that video prediction emerged as a task in the Deep Learning community. For this task, people are generally interested at predicting accurately the displacement/ emergence/ disappearing of objects in the video. In our application, the goal is clearly different since we are interested into modeling the whole dynamics behind image changes and not at following moving objects. Let us first introduce some methods that perform prediction by computing optical flow or a similar transformation. Both Patraucean et al. (2015) and Finn et al. (2016) use some form of motion flow estimation. For next frame prediction Patraucean et al. (2015) introduce a STN module at the hidden layer of a LSTM in order do estimate a motion field in this latent space. The resulting image is then decoded in the original image space for prediction. This approach clearly does not allow introducing prior knowledge on the field vector as this has been done in our work. Finn et al. (2016) learn affine transformations on image parts in order to predict object displacement and Van Amersfoort et al. (2017) proposed a similar model. + +Let us now consider models that directly attempt to predict the next frame without estimating a motion field. As shown in the experimental section, plain application of autoregressive models produces blurred images. Mathieu et al. (2015), one of our baseline proposed to use different loss functions and a GAN regularization of a CDNN predictor which led to sharper and higher quality predictions. Significant improvements have been obtained with the Video Pixel Network of Kalchbrenner et al. (2016), which is a sophisticated architecture composed of resolution preserving CNN encoders, LSTM and PixelCNN decoders which form a conditional Spatio-temporal video autoencoder with differentiable memory. This model is probably state of the art today for video prediction, They reach a high accuracy on moving MNIST and good performance on a robot video dataset. A drawback is the complexity of the model and the number of parameters: they are using respectively $2 0 \bf { M }$ and $1 \textbf { M }$ frames on these two datasets. We did not test this model since up to our knowledge no code was available. + +# 6 CONCLUSION AND FUTURE WORK + +The evolution in time of the proposed model is deterministic. Predicting future observations should also deal with the inherent ambiguity and lack of information for the prediction task. A natural future direction would be to incorporate uncertainty in the model’s evolution in the proposed framework. We can extend the proposed model by incorporating a stochastic latent variable in the flow field generation process. A promising direction is the development of generative models which has become popular in Deep Learning, leading to different families of innovative models. For example, the Stochastic Gradient Variational Bayes algorithm (SGVB) Kingma & Welling (2014) provides a framework for learning stochastic latent variables with deep neural networks, and has recently been used by some authors to model time series Karl et al. (2016); Chung et al. (2015); Krishnan et al. (2015). A recent work where both spatial and temporal information are considered is Walker et al. (2016) who model pixel trajectories in a video. As a follow up of our work, we plan to consider such extensions in the future. + +The data intensive paradigm offers alternative directions to the classical physical approaches for modeling complex natural processes. Our belief is that cross fertilization of both paradigms is essential for pushing further the frontier of complex data modeling. By using as an example application a relatively complex problem concerning ocean dynamics, we proposed a principled way to design Deep Learning models using inspiration from the physics. The proposed approach can be easily generalized to a class of problems for which the underlying dynamics follow advection-diffusion principles. We have compared the proposed approach to a series of baselines. It is able to reach performance comparable to a state of the art numerical model and clearly outperform alternative NN models used as baselines. + +# ACKNOWLEDGMENTS + +This work was partially funded by ANR project LOCUST - ANR-15-CE23-0027 and by CLEAR - Center for LEArning & data Retrieval - joint lab. With Thales (www.thalesgroup.com). + +# REFERENCES + +Mauricio A Alvarez, David Luengo, and Neil D Lawrence. Linear latent force models using gaussian processes. 2011. + +Cedric Archambeau, Dan Cornford, Manfred Opper, and John Shawe-Taylor. Gaussian process approximations of stochastic differential equations. In Gaussian Processes in Practice, pp. 1–16, 2007. + +Dominique Ber´ eziat and Isabelle Herlin. ´ Coupling Dynamic Equations and Satellite Images for Modelling Ocean Surface Circulation, pp. 191–205. Springer International Publishing, Cham, 2015. ISBN 978-3-319-25117-2. doi: 10.1007/978-3-319-25117-2 12. URL https://doi. org/10.1007/978-3-319-25117-2_12. + +R. L. Bernstein. Sea surface temperature estimation using the noaa 6 satellite advanced very high resolution radiometer. Journal of Geophysical Research: Oceans, 87(C12):9455–9465, 1982. ISSN 2156-2202. doi: 10.1029/JC087iC12p09455. URL http://dx.doi.org/10.1029/ JC087iC12p09455. + +Julien Brajard, Anastase Alexandre Charantonis, and F Jourdin. Predicting ocean dynamics through machine learning: Application on sea-surface suspended particulate mater. In American Meteorological Society Annual Meeting 2017, 2017. + +Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 29802988. Curran Associates, Inc., 2015. URL http://papers.nips.cc/paper/ 5653-a-recurrent-latent-variable-model-for-sequential-data.pdf. + +N. Cressie and C.K. Wikle. Statistics for Spatio-Temporal Data. Wiley, 2015. ISBN 9781119243045. URL https://books.google.fr/books?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 4L_dCgAAQBAJ. + +Chelsea Finn, Ian J. Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. CoRR, abs/1605.07157, 2016. URL http://arxiv.org/abs/ 1605.07157. + +Philipp Fischer, Alexey Dosovitskiy, Eddy Ilg, Philip Hausser, Caner Hazirbas, Vladimir Golkov, ¨ Patrick van der Smagt, Daniel Cremers, and Thomas Brox. Flownet: Learning optical flow with convolutional networks. CoRR, abs/1504.06852, 2015. URL http://arxiv.org/abs/ 1504.06852. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. URL http://arxiv.org/abs/1512.03385. + +Eddy Ilg, Nikolaus Mayer, Tonmoy Saikia, Margret Keuper, Alexey Dosovitskiy, and Thomas Brox. Flownet 2.0: Evolution of optical flow estimation with deep networks. CoRR, abs/1612.01925, 2016. URL http://arxiv.org/abs/1612.01925. + +Max Jaderberg, Karen Simonyan, Andrew Zisserman, and Koray Kavukcuoglu. Spatial transformer networks. CoRR, abs/1506.02025, 2015. URL http://arxiv.org/abs/1506.02025. + +Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex ¨ Graves, and Koray Kavukcuoglu. Video pixel networks. CoRR, abs/1610.00527, 2016. URL http://arxiv.org/abs/1610.00527. + +Maximilian Karl, Maximilian Soelch, Justin Bayer, and Patrick van der Smagt. Deep variational bayes filters: Unsupervised learning of state space models from raw data. ICLR 2017, 2016. + +Diederik P Kingma and Max Welling. Auto-encoding variational bayes. ICLR 2014, 2014. + +Rahul G Krishnan, Uri Shalit, and David Sontag. Deep kalman filters. arXiv preprint arXiv:1511.05121, 2015. + +L’ubor Ladicky, SoHyeon Jeong, Barbara Solenthaler, Marc Pollefeys, and Markus Gross. Data- ´ driven fluid simulations using regression forests. ACM Trans. Graph., 34(6):199:1–199:9, October 2015. ISSN 0730-0301. doi: 10.1145/2816795.2818129. URL http://doi.acm.org/ 10.1145/2816795.2818129. + +Haibin Ling and K. Okada. Diffusion distance for histogram comparison. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), volume 1, pp. 246– 253, June 2006. doi: 10.1109/CVPR.2006.99. + +G. Madec. NEMO ocean engine. Note du Pole de mod ˆ elisation, Institut Pierre-Simon Laplace ´ (IPSL), France, No 27, ISSN No 1288-1619, 2008. + +Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond ¨ mean square error. CoRR, abs/1511.05440, 2015. URL http://arxiv.org/abs/1511. 05440. + +Viorica Patraucean, Ankur Handa, and Roberto Cipolla. Spatio-temporal video autoencoder with differentiable memory. CoRR, abs/1511.06309, 2015. URL http://arxiv.org/abs/ 1511.06309. + +Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Numerical gaussian processes for time-dependent and non-linear partial differential equations. arXiv preprint arXiv:1703.10230, 2017. + +Samuel H. Rudy, Steven L. Brunton, Joshua L. Proctor, and J. Nathan Kutz. Data-driven discovery of partial differential equations. SCIENCE ADVANCES —, 3(April), 2017. URL http://arxiv. org/abs/1607.01067. + +Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. CoRR, abs/1506.04214, 2015. URL http://arxiv.org/abs/1506.04214. + +Deqing Sun, Stefan Roth, J. P. Lewis, and Michael J. Black. Learning Optical Flow, pp. 83–97. Springer Berlin Heidelberg, Berlin, Heidelberg, 2008. ISBN 978-3-540-88690-7. doi: 10.1007/ 978-3-540-88690-7 7. URL https://doi.org/10.1007/978-3-540-88690-7_7. + +Jonathan Tompson, Kristofer Schlachter, Pablo Sprechmann, and Ken Perlin. Accelerating Eulerian fluid simulation with convolutional networks. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 3424–3433, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http://proceedings.mlr.press/v70/ tompson17a.html. + +Yannick Tremolet. Accounting for an imperfect model in 4d-var. ´ Quarterly Journal of the Royal Meteorological Society, 132(621):2483–2504, 2006. + +Geoffrey K Vallis. Atmospheric and oceanic fluid dynamics. Cambridge University Press, 2017. + +Joost Van Amersfoort, Anitha Kannan, Marc’Aurelio Ranzato, Arthur Szlam, Du Tran, and Soumith Chintala. Transformation-Based Models of Video Sequences. In CoRR abs/1701.08435 (2017), pp. 1–11, 2017. URL http://arxiv.org/abs/1701.08435. + +Jacob Walker, Carl Doersch, Abhinav Gupta, and Martial Hebert. An uncertain future: Forecasting from static images using variational autoencoders. In European Conference on Computer Vision, 2016. + +Jason J. Yu, Adam W. Harley, and Konstantinos G. Derpanis. Back to Basics: Unsupervised Learning of Optical Flow via Brightness Constancy and Motion Smoothness, pp. 3–10. Springer International Publishing, Cham, 2016. ISBN 978-3-319-49409-8. doi: 10.1007/978-3-319-49409-8 1. URL https://doi.org/10.1007/978-3-319-49409-8_1. + +Yi Zhu, Zhen-Zhong Lan, Shawn D. Newsam, and Alexander G. Hauptmann. Guided optical flow learning. CoRR, abs/1702.02295, 2017. URL http://arxiv.org/abs/1702.02295. + +# A PROOF OF THE THEOREM IN SECTION 2 1 + +Proof. In the following, bold $\mathbf { x }$ and $\mathbf { y }$ will denote vectors of $\mathbb { R } ^ { 2 }$ , while $x$ and $y$ will correspond to the first and second components of $\mathbf { x }$ , respectively. Analogously, $u$ and $v$ will correspond to the components of $w$ . The 2D Fourier Transformation $\mathcal { F }$ of $f : \bar { \mathbb { R } } ^ { 2 } \bar { \mathbb { R } }$ is defined as + +$$ +\begin{array} { l } { \displaystyle \mathcal { F } ( f ) = \int _ { \mathbb { R } ^ { 2 } } f ( \mathbf { x } ) e ^ { - i < \xi , \mathbf { x } > } d \mathbf { x } } \\ { \displaystyle \ = \int _ { \mathbb { R } } \int _ { \mathbb { R } } f ( x , y ) e ^ { - i x \xi _ { 1 } - i y \xi _ { 2 } } d x d y } \end{array} +$$ + +We apply the Fourier Transform $\mathcal { F }$ to both sides of 3. As consequence of the linearity of the Fourier transform, we can calculate decompose the Fourier transform of the left hand side in the sum of the transforms of each term. We have three terms: $\begin{array} { r } { \frac { \partial I } { \partial t } , ( w . \nabla ) I } \end{array}$ and $- D \nabla ^ { 2 } I$ . + +$$ +\begin{array} { l } { \displaystyle \mathcal { F } ( \frac { \partial I } { \partial t } ) = \int _ { \mathbb { R } ^ { 2 } } \frac { \partial I } { \partial t } e ^ { - i < \mathbf { x } , \xi > } d \mathbf { x } } \\ { \displaystyle \ = \int _ { \mathbb { R } ^ { 2 } } \frac { \partial } { \partial t } ( I e ^ { - i < \mathbf { x } , \xi > } ) d \mathbf { x } } \\ { \displaystyle \ = \frac { \partial } { \partial t } \int _ { \mathbb { R } ^ { 2 } } I e ^ { - i < \mathbf { x } , \xi > } d \mathbf { x } } \\ { \displaystyle \ = \frac { \partial \mathcal { F } ( I ) } { \partial t } } \end{array} +$$ + +$$ +\begin{array} { r l } { F ( ( w , \nabla ) I ) = \displaystyle \int _ { \mathbb { R } ^ { 2 } } ( w , \nabla ) I e ^ { - i \omega \cdot \xi } d x } \\ { = \displaystyle \int _ { \mathbb { R } } \int _ { \mathbb { R } } ( w \frac { \partial I } { \partial x } + v \frac { \partial I } { \partial y } ) e ^ { - i x \xi _ { 1 } - \mathrm { i } y \xi _ { 2 } } d x d y } \\ { = \displaystyle \mu \int _ { \mathbb { R } } e ^ { - i \psi \cdot \xi } \int _ { \mathbb { R } } \frac { \partial I } { \partial x } e ^ { - i \xi _ { 1 } } d x d y + v \displaystyle \int _ { \mathbb { R } } e ^ { - i \psi \xi _ { 1 } } \int _ { \mathbb { R } } \frac { \partial I } { \partial y } e ^ { - i y \xi _ { 2 } } d y d x } \\ { = \displaystyle i \xi _ { 1 } w \int _ { \mathbb { R } } e ^ { - i \psi \xi _ { 2 } } \int _ { x } [ e ^ { - i \psi \xi _ { 1 } } d x d y + i \xi _ { 2 } v \int _ { \mathbb { R } } e ^ { - i \psi \xi _ { 1 } } \int _ { \mathbb { R } } \frac { \partial I } { \partial y } e ^ { - i y \xi _ { 2 } } d y d x } \\ { = \displaystyle \tilde { U } _ { \mathbb { R } } \int _ { \mathbb { R } } \int _ { \mathbb { R } } e ^ { - i \psi \xi _ { 1 } - \mathrm { i } \psi _ { \xi } } d x d y + v \xi _ { 2 } v \int _ { \mathbb { R } } \int _ { \mathbb { R } } I _ { \mathbb { R } } e ^ { - i \omega \xi _ { 1 } - y \psi } d x d y } \\ { = ( \xi _ { 1 } w + i \xi _ { 2 } v ) \int _ { \mathbb { R } } \int _ { \mathbb { R } } \int _ { \mathbb { R } } \int _ { \mathbb { R } } - i \omega \xi _ { 1 } - i \psi \xi _ { 2 } d x d y } \\ { = i \ < \xi , w > F ( I ) } \end{array} +$$ + +$$ +\begin{array} { r l } { \mathcal { F } ( - D \nabla ^ { 2 } I ) = - \int _ { \mathbb { R } ^ { 2 } } D \nabla ^ { 2 } I c ^ { - i \nu \xi } s c ^ { - \alpha } k s ^ { \zeta } d x } \\ { = - \int _ { \mathbb { R } ^ { 2 } } \int _ { \mathbb { R } ^ { 0 } } D \big ( \hat { \partial } \hat { \partial } ^ { 2 } I + \hat { \partial } \hat { \partial } ^ { 2 } I \big ) e ^ { - i \alpha \zeta _ { 1 } - i \psi \xi } d x d y } \\ { } & { = - D \int _ { \mathbb { R } ^ { 2 } } e ^ { - i \nu \xi } \int _ { \mathbb { R } ^ { 2 } } \frac { \partial ^ { 2 } I } { \partial x ^ { 2 } } e ^ { - i \alpha \zeta _ { 1 } } d x d y - D \int _ { \mathbb { R } ^ { \epsilon } } e ^ { - i \alpha \zeta _ { 1 } } \int _ { \mathbb { R } } \frac { \partial ^ { 2 } I } { \partial y ^ { 2 } } e ^ { - i \nu \xi \epsilon } d y d x } \\ { } & { = - ( \delta _ { 1 } ) ^ { 2 } D \int _ { \mathbb { R } ^ { 2 } } e ^ { - i \nu \zeta _ { 1 } } \int _ { \mathbb { R } } { F } ^ { - i \nu \zeta _ { 1 } } d x d y d y - ( \delta _ { 2 } ) ^ { 2 } D \int _ { \mathbb { R } ^ { \epsilon } } e ^ { - i \alpha \zeta _ { 1 } } \int _ { \mathbb { R } } { F } ^ { - i \nu \zeta _ { 2 } } d y d x } \\ { } & { = D \mathfrak { L } _ { 1 } ^ { 2 } \int _ { \mathbb { R } ^ { \epsilon } } e ^ { - i \alpha \zeta _ { 2 } } \int _ { \mathbb { R } } { F } ^ { - i \nu \zeta _ { 2 } } d x d y + D \mathfrak { L } _ { 2 } ^ { 2 } \int _ { \mathbb { R } ^ { \epsilon } } e ^ { - i \kappa \zeta _ { 1 } } \int _ { \mathbb { R } } { F } ^ { i \nu \zeta - i \psi \zeta _ { 2 } } d y d x } \\ { } & { = D \mathfrak { L } _ { 2 } ^ { 3 } \int _ { \mathbb { R } ^ { 2 } } \int _ { \mathbb { R } } { F } ^ { - i \nu \zeta _ { 2 } } d x d y + D \mathfrak { L } _ { 2 } ^ { 2 } \int _ { \mathbb { R } } { F } ^ { - i \nu \zeta _ { 1 } } d x d y d x } \\ { } & = D \mathfrak { L } _ { 1 } ^ { 3 } \int _ \mathbb \end{array} +$$ + +Regrouping all three previously calculated terms, we obtain + +$$ +\frac { \partial \mathcal { F } ( I ) } { \partial t } + ( i < \xi , w > + D \left\| \xi \right\| ^ { 2 } ) \mathcal { F } ( I ) = 0 +$$ + +This is a first order ordinary differential equation of the form $f ^ { \prime } ( t ) + a f ( t ) = 0$ , which admits a known solution $f ( t ) = f ( 0 ) { e ^ { - a t } }$ . Thus, the solution of 11 is + +$$ +\begin{array} { r } { \mathcal { F } ( I ) = \mathcal { F } ( I ) _ { 0 } e ^ { - ( i < \xi , w > + D \| \xi \| ^ { 2 } ) t } } \\ { = \mathcal { F } ( I ) _ { 0 } e ^ { - i < \xi , w > t } e ^ { - D t \| \xi \| ^ { 2 } } } \end{array} +$$ + +where $\mathcal { F } ( I ) _ { 0 }$ denotes the initial condition of the advection diffusion equation in the frequency domain. In order to obtain a solution of 3 in the spatial domain, we calculate the inverse Fourier Transform ${ \mathcal { F } } ^ { - 1 }$ of 12. The multiplication of two functions in the frequency domain is equivalent to their convolution in the spatial domain, i.e. ${ \mathcal { F } } ( f * g ) = { \mathcal { F } } ( f ) { \mathcal { F } } ( g )$ . Hence, the inverse of both terms $\mathcal { F } ( I ) _ { 0 } e ^ { - i < \xi , w > t }$ and $e ^ { - D t \| \boldsymbol { \xi } \| ^ { 2 } }$ can be calculated separately: + +Multiplication by a complex exponential in the frequency domain is equivalent to a shift in the spatial domain : $\bar { e } ^ { - i < \xi , w \bar { > } } \mathcal { F } ( f ( \bar { \mathbf { x } } ) ) = \mathcal { F } ( f ( \mathbf { x } - w ) )$ , for $\boldsymbol { v } \in \mathbb { R } ^ { 2 }$ . Thus, for the first term, + +$$ +\mathcal { F } ^ { - 1 } ( \mathcal { F } ( I ) _ { 0 } e ^ { - ( i < \xi , w > ) t } ) = I _ { 0 } ( \mathbf { x } - w ) +$$ + +For the second term, we use the fact that the Fourier Transform of a Gaussian function also is a Gaussian function, i.e. $\begin{array} { r } { \mathcal { F } \big ( \frac { 1 } { 2 \pi \sigma ^ { 2 } } e ^ { - \frac { 1 } { 2 \sigma ^ { 2 } } \| \mathbf { x } \| ^ { 2 } } \big ) = e ^ { - \frac { 1 } { 2 } \sigma ^ { 2 } \| \boldsymbol { \xi } \| ^ { 2 } } } \end{array}$ . Identifying $\sigma ^ { 2 }$ with $2 D t$ , we have: + +$$ +\mathcal { F } ^ { - 1 } ( e ^ { - D t \| \boldsymbol { \xi } \| ^ { 2 } } ) = \frac { 1 } { 4 \pi D t } e ^ { - \frac { 1 } { 4 D t } \| \mathbf { x } \| ^ { 2 } } +$$ + +As has been stated above, the solution is a convolution of both previously calculated terms: + +$$ +\begin{array} { r } { I ( \mathbf { x } , t ) = \displaystyle \int _ { \mathbb { R } ^ { 2 } } \frac { 1 } { 4 \pi D t } e ^ { - \frac { 1 } { 4 D t } \| \mathbf { y } \| ^ { 2 } } I _ { 0 } ( \mathbf { x } - w - \mathbf { y } ) d y } \\ { = \displaystyle \int _ { \mathbb { R } ^ { 2 } } \frac { 1 } { 4 \pi D t } e ^ { - \frac { 1 } { 4 D t } \| \mathbf { x } - w - \mathbf { y } \| ^ { 2 } } I _ { 0 } ( \mathbf { y } ) d \mathbf { y } } \end{array} +$$ + +# B ON THE GENERALIZATION IN SPACE AND TIME + +The ability of the model to adapt to other conditions should be evaluated on other regions. This, however, requires a complete study by itself and is beyond the scope of this paper. We, however, present below complementary experiments aimed at assessing the potential of the proposed model for forecasting SST on sequences distant in time and space from the ones used for training. + +# B.1 TEMPORAL DIMENSION + +In section 4, training has been performed on data from 2006 - 2015 and testing on the period 2016- 2017. In order to provide some indication of the model behavior on more distant time intervals between train and test data, we have performed experiments using the same regions (17 to 20) as in section 4, but using the period 2011 to 2017 for training and period 2006 to 2010 for testing. Figure B.1 shows the MSE curve on this test set, each point corresponding to the mean MSE on predictions performed on 6 days ahead the current date. The most important conclusion is probably that the MSE error remains in the same range for all these years. All the yearly error curve show a clear seasonal phenomenon with a higher prediction error during summer. A similar behavior has been observed when exchanging train and test data. + +![](images/528806e279e8e0cafff934b99238f30f79d4eaee57852dbf4a070720a4a6a49c.jpg) +Figure 6: Evaluation of our model’s accuracy in time on data from 2006 to 2010 using data from 2011 to 2017 for training. Regions 17 to 20 were used for both periods. Each day, we produce daily forecasts for 6 days ahead and calculate the associated mean square error. + +# B.2 SPATIAL DIMENSION + +In the experiments, the models have been trained and evaluated on selected regions (numbered 17 to 20 in Figure 4.1), considered as the most interesting for the observed dynamics. + +
Test Regions 17&18Test Regions 8&9
Model trained on Regions 17 & 181.431.22
Model trained on Regions 8&91.901.19
+ +Table 2: Evaluation of our model’s spatial generalization ability. We train our model on two distinct regions and calculate the MSE on both regions for each trained model. + +We describe below some results providing indications on how the model performs on regions different from the training ones. For these experiments, the model has been trained on regions 17 and 18 in Figure 4.1 and tested on two other regions (regions 8 and 9), and vice versa (trained on 8 and 9 and tested on 17 and 18). The two couples of regions have been selected so as to have different latitude and longitude. The underlying physical processes generating the data are known to be different in these regions: the overall motion in regions 17 and 18 is greater, and the difference between extreme temperature is larger, compared to regions 8 and 9. Experimental conditions are similar to the one described in section 4, i.e. 2006-2015 have been used for training and 2016-1017 for testing. + +Results in Table B.2 show that the model generalizes reasonably well to unseen data from distant spatial regions, with a slight decrease in performance when training and test regions do not correspond. The performance loss is 0.47 for regions (17, 18) which show a strong dynamics, whereas it is only 0.03 for regions (8, 9) for which the dynamics are more stable. Most notably, MSE performance depends more on the region itself than on the train/ test conditions. Error is always higher in regions with strong dynamics (17, 18) than on more stable regions (8, 9) whatever the train/ test conditions are. Note that to further improve the results on distant data, it is possible to fine-tune the model using data from the studied regions. + +![](images/7fa34cba44f56995c4ccd948262fe818c202d7bb2038a7cc5cbd04fe8d410b0f.jpg) +Figure 7: Output for the 6 of May to the 9 of May 2016, Output , From top to bottom: target, our model prediction, our model flow + +![](images/4ffe62ca072ede6593044ce1af87b6350592816bc760f6a707c20a78f7a4aa63.jpg) +Figure 8: Output for the 6 of January to the 9 of January 2016. From top to bottom: target, our model prediction, our model flow \ No newline at end of file diff --git a/md/train/ByJWeR1AW/ByJWeR1AW.md b/md/train/ByJWeR1AW/ByJWeR1AW.md new file mode 100644 index 0000000000000000000000000000000000000000..0baf28cf3c49653e4d4281bfde78437c091e3a54 --- /dev/null +++ b/md/train/ByJWeR1AW/ByJWeR1AW.md @@ -0,0 +1,288 @@ +# DATA AUGMENTATION INSTEAD OFEXPLICIT REGULARIZATION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Modern deep artificial neural networks have achieved impressive results through models with very large capacity—compared to the number of training examples— that control overfitting with the help of different forms of regularization. Regularization can be implicit, as is the case of stochastic gradient descent or parameter sharing in convolutional layers, or explicit. Most common explicit regularization techniques, such as dropout and weight decay, reduce the effective capacity of the model and typically require the use of deeper and wider architectures to compensate for the reduced capacity. Although these techniques have been proven successful in terms of results, they seem to waste capacity. In contrast, data augmentation techniques reduce the generalization error by increasing the number of training examples and without reducing the effective capacity. In this paper we systematically analyze the effect of data augmentation on some popular architectures and conclude that data augmentation alone—without any other explicit regularization techniques—can achieve the same performance or higher as regularized models, especially when training with fewer examples. + +# 1 INTRODUCTION + +Regularization plays a central role in machine learning. Loosely defined, regularization is any modification applied to a learning algorithm that helps prevent overfitting and improve generalization. Whereas in simple machine learning algorithms the sources of regularization can be easily identified as explicit terms in the objective function, in modern deep neural networks the sources of regularization are multiple and some of them are not explicit, but implicit. + +Although the terms explicit and implicit regularization have been used recently in the literature (Neyshabur et al., 2014; Zhang et al., 2017), their distinction is rather subjective. We propose the following definitions: + +• Explicit regularization techniques are those specifically and solely designed to constrain the effective capacity of a given model in order to reduce overfitting. Furthermore, explicit regularizers are not a structural or essential part of the network architecture, the data or the learning algorithm and can typically be added or removed easily. Implicit regularization is the reduction of the generalization error or overfitting provided by characteristics of the network architecture, the training data or the learning algorithm, which are not specifically designed to constrain the effective capacity of the given model. + +Examples of explicit regularizers are weight decay (Hanson & Pratt, 1989), which penalizes large parameters; dropout (Srivastava et al., 2014), which randomly removes a fraction of the neural connections during training; or stochastic depth (Huang et al., 2016), which drops whole layers instead. Implicit regularization effects are provided by the popular stochastic gradient descent (SGD) algorithm, which tends to converge to solutions with small norm (Zhang et al., 2017); convolutional layers, which impose parameter sharing based on prior knowledge about the data; batch normalization (Ioffe & Szegedy, 2015), whose main goal is reducing the the internal covariate shift, but also implicitly regularizes the model due to the noise in the batch estimates for mean and variance. + +Driven by the efficient use and development of GPUs, much research efforts have been devoted to finding ways of training deeper and wider networks of larger capacity (Simonyan & Zisserman, + +2014; He et al., 2016; Zagoruyko & Komodakis, 2016), Ironically, their effective capacity is eventually reduced in practice by the use of weight decay and dropout, among other explicit regularizers. It is known, for instance, that the gain in generalization provided by dropout comes at the cost of using larger models and training for longer (Goodfellow et al., 2016). Hence, it seems that with such an approach deep networks are wasting capacity (Dauphin & Bengio, 2013). As a matter of fact, unlike traditional machine learning models, deep neural networks seem not to need explicit regularizers to generalize well, as recently suggested by Zhang et al. (2017). + +One popular technique that also improves generalization is data augmentation. Importantly, it differs from explicit regularizers mainly in that it does not reduce the effective capacity of the model. Data augmentation is a very old practice in machine learning (Simard et al., 1992) and it has been identified as a critical component of many models (Ciresan et al., 2010; Krizhevsky et al., 2012; LeCun et al., 2015). However, although some authors have reported the impact of data augmentation on the performance of their models and, in some cases, a comparison of different amount of augmentation (Graham, 2014) the literature lacks, to our knowledge, a systematic analysis of the impact of data augmentation on deep neural networks compared to the most popular regularization techniques. + +# 1.1 OUR CONTRIBUTIONS + +In this paper, we systematically analyze the role of data augmentation in deep neural networks for object recognition, compare it to some popular explicit regularization techniques, discuss its relationship with model capacity and test its potential to enhance learning from less training data and adapt to different architectures. + +# 1.1.1 DATA AUGMENTATION AND EXPLICIT REGULARIZATION + +Zhang et al. (2017) recently raised the thought-provoking idea that explicit regularization may improve generalization performance, but is neither necessary nor by itself sufficient for controlling generalization error. The authors came to this conclusion from the observation that turning off the explicit regularizers of a model does not prevent the model from generalizing—although the performance does become degraded. This contrasts with traditional machine learning involving convex optimization, where regularization is necessary to avoid overfitting and generalize. + +However, Zhang et al. (2017) consider data augmentation an explicit form of regularization comparable to weight decay and dropout. We argue instead that data augmentation deserves a different classification due to some fundamental properties: Notably, data augmentation does not reduce the effective capacity of the model. Explicit regularizers are often used to counteract overfitting, but as a side effect the architecture needs to be larger and the training longer (Krizhevsky et al., 2012; Goodfellow et al., 2016). In contrast, data augmentation increases the number of training examples— although not in an independently distributed way—and the robustness against input variability. This has the welcome side-effect of implicitly regularizing the model and improving generalization. + +Here, we build upon some of the ideas and procedures from Zhang et al. (2017) and perform some experiments to assess the role of data augmentation in deep neural networks and in particular in contrast to explicit regularizers (weight decay and dropout). In our experiments, we consider two levels of augmentation, light and heavier, as well as no augmentation at all. Then, we test them on two popular successful network architectures: the relatively shallow all convolutional network net (Springenberg et al., 2014) and the deeper wide residual network (Zagoruyko & Komodakis, 2016), trained on CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009), with and and without explicit regularization. Our central conclusion can be summarized as: + +In a deep convolutional neural network trained with sufficient level of data augmentation, optimized by SGD, explicit regularizers (weight decay and dropout) might not provide any additional generalization improvement. + +# 1.1.2 DATA AUGMENTATION AND TRAINING WITH FEWER EXAMPLES + +Augmented data might be regarded as artificial and very similar to the source examples, therefore with limited contribution for making a network learn more useful representations. However, it has proven to be very useful in extreme cases such as one-shot learning, where only one or few training examples are available (Vinyals et al., 2016). + +In order to provide a better insight of the usefulness of data augmentation, we train the networks with only $80 \%$ , $50 \%$ , $10 \%$ and $1 \%$ of the available training data and test the effect of data augmentation, again in contrast to explicit regularizers. The summary of our findings in this regard can be summarized as: + +When a deep neural network is trained with a subset of the training data, heavier data augmentation achieves a smaller gap with respect to the baseline model, especially if no explicit regularization is used. Thus, data augmentation seems to serve as true data to a great extent. + +# 1.1.3 DATA AUGMENTATION AND ADAPTABILITY + +One of the disadvantages of explicit regularization is that the parameters highly depend on the network architecture, the amount of training data and other factors. Therefore, if the architecture or other factors change, one has to tune the regularization hyperparameters to achieve comparable results. In order to analyze how data augmentation adapts to different architectures, we test several augmentation schemes on shallower and deeper versions of the network, with and without explicit regularization. Our finding is the following: + +Data augmentation easily adapts to different depths without tuning its parameters. If no explicit regularization is used, we observe that a shallower network achieves slightly worse results and a deeper architecture achieves better results. + +# 1.2 RELATED WORK + +Regularization is a central research topic in machine learning as it is a key component for ensuring good generalization (Girosi et al., 1995; Muller, 2012). In the case of deep learning, where networks ¨ tend to have several orders of magnitude more parameters than training examples, statistical learning theory (Vapnik & Chervonenkis, 1971) indicates that regularization becomes even more crucial. Accordingly, a myriad of tools and techniques have been proposed as regularizers: early stopping (Plaut et al., 1986), weight decay (Hanson & Pratt, 1989) and other $L ^ { p }$ penalties, dropout (Srivastava et al., 2014) and stochastic depth (Huang et al., 2016), to name a few examples. Besides, other successful techniques have been studied for their regularization effect, despite not being explicitly intended as such. That is the case of unsupervised pre-training (Erhan et al., 2010), multi-task learning (Caruana, 1998), convolutional layers (LeCun et al., 1990), batch normalization (Ioffe & Szegedy, 2015) or adversarial training (Szegedy et al., 2013). + +Data augmentation is another almost ubiquitous technique in deep learning, especially for computer vision tasks, which can be regarded as an implicit regularizer because it improves regularization. It was already used in the late 80’s and early 90’s for handwritten digit recognition (Simard et al., 1992) and it has been identified as a very important element of many modern successful models, like AlexNet (Krizhevsky et al., 2012), All-CNN (Springenberg et al., 2014) or ResNet (He et al., 2016), for instance. In some cases, data augmentation has been applied heavily with successful results (Wu et al., 2015). In domains other than computer vision, data augmentation has also been proven effective, for example in speech recognition (Jaitly & Hinton, 2013), music source separation (Uhlich et al., 2017) or text categorization (Lu et al., 2006). + +Bengio et al. (2011) focused on the importance of data augmentation for recognizing handwritten digits (MNIST) through greedy layer-wise unsupervised pre-training (Bengio et al., 2007). The main conclusion of that work was that deeper architectures benefit more from data augmentation than shallow networks. Zhang et al. (2017) included data augmentation in their analysis of the role of regularization in the generalization of deep networks, although it was considered an explicit regularizer similar to weight decay and dropout. A few works have reported the performance of their models when trained with different types of data augmentation levels, as is the case of Graham (2014). Recently, the deep learning community seems to have become more aware of the importance of data augmentation and new techniques, such as cutout (DeVries & Taylor, 2017a) or augmentation in the feature space (DeVries & Taylor, 2017b), have been proposed. Very interestingly, models that automatically learn useful data transformations have also been published recently (Hauberg et al., 2016; Lemley et al., 2017; Ratner et al., 2017). + +# 2 EXPERIMENTS AND RESULTS + +This section describes the experimental setup for systematically analyzing the role of data augmentation in modern deep neural networks and presents the most relevant and interesting results. + +# 2.1 SETUP + +All the experiments are performed on the neural networks API Keras (Chollet et al., 2015) on top of TensorFlow (Abadi et al., 2015) and on a single GPU NVIDIA GeForce GTX 1080 Ti. + +# 2.1.1 NETWORK ACRCHITECTURES + +We perform our experiments on two popular architectures that have achieved successful results in object recognition tasks: the all convolutional network, All-CNN (Springenberg et al., 2014) and the wide residual network, WRN (Zagoruyko & Komodakis, 2016). We choose these networks not only because of their effectiveness, but also because they have simple architectures, which is convenient for drawing clearer conclusions. All-CNN has a relatively small number of layers and parameters, whereas WRN is rather deep and has many more parameters. + +All convolutional net. All-CNN consists of only convolutional layers with ReLU activations (Glorot et al., 2011), it is relatively shallow (12 layers) and has about $1 . 3 { \bf M }$ parameters. The architecture can be described as follows: + +where $K C D ( S )$ is a $D \times D$ convolutional layer with $K$ channels and stride $S$ , followed by batch normalization and a ReLU non-linearity. $N . C l .$ is the number of classes and Gl.Avg. refers to global average pooling. The network is identical to the All-CNN-C architecture in the original paper, except for the introduction of the batch normalization layers. We set the same training parameters as in the original paper in the cases they are reported. Specifically, in all experiments the All-CNN networks are trained using stochastic gradient descent with batch size of 128, during 350 epochs, with fixed momentum 0.9 and learning rate of 0.01 multiplied by 0.1 at epochs 200, 250 and 300. The kernel parameters are initialized according to the Xavier uniform initialization (Glorot & Bengio, 2010). + +Wide Residual Network. WRN is a modification of ResNet (He et al., 2016) that achieves better performance with fewer layers, but more units per layer. Although in the original paper several combinations of depth and width are tested, here we choose for our experiments the WRN-28-10 version (28 layers and about $3 6 . 5 \mathrm { ~ M ~ }$ parameters), which is reported to achieve the best results on CIFAR. It has the following architecture: + +# 16C3(1)–4×160R–4×320R–4×640R–BN–ReLU–Avg.(8)–FC–Softmax + +where $K \mathbf { R }$ is a residual block with residual function BN–ReLU–KC3(1)–BN–ReLU–KC3(1). BN is batch normalization, Avg.(8) is spatial average pooling of size 8 and FC is a fully connected layer. The stride of the first convolution within the residual blocks is 1 except in the first block of the series of 4, where it is 2 to subsample the feature maps. As before, we try to replicate the training parameters of the original paper: we use SGD with batch size of 128, during 200 epochs, with fixed Nesterov momentum 0.9 and learning rate of 0.1 multiplied by 0.2 at epochs 60, 120 and 160. The kernel parameters are initialized according to the He normal initialization (He et al., 2015). + +# 2.1.2 DATA + +We perform the experiments on the two highly benchmarked data sets CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009), which are labeled according to 10 and 100 object classes respectively. Both data sets consist of $6 0 , 0 0 0 \ 3 2 \mathrm { ~ x ~ } \ 3 2$ color images split into 50,000 for training and 10,000 for testing. In all our experiments, the input images are fed into the network with pixel values normalized to the range $[ 0 , 1 ]$ and with floating precision of 32 bits. So as to analyze the role of data augmentation, we test the network architectures presented above with two different augmentation schemes as well as with no data augmentation at all: + +![](images/cd3cbfd948a1943779f97b4a51f142e747f15f667a9bf6c5d60e6f0854cea858.jpg) +Figure 1: Random images from CIFAR10 transformed according to the augmentation schemes used in our experiments, choosing extreme values from the augmentation parameters. Note that these images are very unlikely to be used during training. + +Table 1: Description and range of possible values of the parameters used for the heavier augmentation. $B ( p )$ denotes a Bernouilli distribution and $\textstyle { \mathcal { U } } ( a , b )$ a uniform distribution. + +
ParameterDescriptionRange
Horizontal flip1-2B(0.5)
fh tHorizontal translationu(-0.1,0.1)
tyVertical translationu(-0.1,0.1)
Horizontal scaleu(0.85,1.15)
2xVertical scaleu(0.85,1.15)
Rotation angle
?Shear angle(22.5,22.5)
Contrastu(-0.15,0.15)
8u(0.5,1.5)
BrightnessU(-0.25,0.25)
+ +Light augmentation. This scheme is adopted from the literature, for example (Goodfellow et al., 2013; Springenberg et al., 2014), and performs only horizontal flips and horizontal and vertical translations of $10 \%$ of the image size. + +Heavier augmentation. This scheme performs a larger range of affine transformations, as well as contrast and brightness adjustment: + +• Affine transformatio $\operatorname { n s : } \left[ { y ^ { \prime } } \right] = { \left[ \begin{array} { l l l } { f _ { h } z _ { x } \cos ( \theta ) } & { - z _ { y } \sin ( \theta + \phi ) } & { t _ { x } } \\ { z _ { x } \sin ( \theta ) } & { \ : z _ { y } \cos ( \theta + \phi ) } & { t _ { y } } \\ { 0 } & { 0 } & { 1 } \end{array} \right] } { \left[ \begin{array} { l } { x } \\ { y } \\ { 1 } \end{array} \right] }$ +• Contrast adjustment: $x ^ { \prime } = \gamma ( x - { \overline { { x } } } ) + { \overline { { x } } }$ +• Brightness adjustment: $x ^ { \prime } = x + \delta$ + +The description and range of values of the parameters are specified in Table 1 and some examples of transformed images with extreme values of the parameters are provided in Figure 1. The choice of the parameters is arbitrary and the only criterion was that the objects are still recognizable, by visually inspecting a few images. We deliberately avoid designing a particularly successful scheme. + +# 2.2 A SUBSTITUTE FOR EXPLICIT REGULARIZATION + +![](images/af0d73144298b60f98d1c6d008990d676327a81a2be64210dafc6cd7ccc0e2d8.jpg) +Figure 2: Test accuracy of the networks All-CNN and WRN on CIFAR-10 and CIFAR-100, trained without any explicit regularization (upper groups of bars) and with both dropout and weight decay (lower groups), as in the original papers. The different bars represent different models (original, deeper and shallower) and different percentage of training images (100, 50 and $10 \%$ ). The different shades within each bar show the result of training with each data augmentation scheme (none, light and heavier). In most cases, the models trained without regularization achieve the same performance as the explicitly regularized models, or even significantly higher accuracy, as is the case of the shallower and deeper models and when training with fewer examples. + +In order to analyze the role of data augmentation and test the hypothesis that it might serve as a substitute for explicit regularization techniques, we first try to replicate the results of All-CNN and WRN provided in the original papers, achieved with both weight decay and dropout. Then, we train the models without weight decay and finally without neither weight decay nor dropout. We test all these different models with the three data augmentation schemes: light, heavier and no augmentation. Additionally, we test the effect of removing the batch normalization (see Appendix A). + +As reported by previous works (Krizhevsky et al., 2012; Simonyan & Zisserman, 2014), when the models are trained with data augmentation, at test time slightly better results are obtained by augmenting the test set as well. Therefore, the test accuracy reported here comes from averaging the softmax posteriors over 10 random light augmentations. + +The main results of the different experiments are shown in Figure 2 (blue bars) and the full report of all experiments can be found in Table 2 of the Appendix A. As expected, both explicit regularization —weight decay and dropout—and data augmentation are successful in reducing the generalization error. However, some relevant observations can be made. Most notably, it seems that data augmentation alone is able to regularize the model as much as in combination with weight decay and dropout and in some cases it clearly achieves better performance, as in the case of All-CNN. Another observation is that without explicit regularization, heavier augmentation always provides better results than light augmentation, whereas with regularization this effect is counterintuitively not consistent. + +# 2.3 FEWER AVAILABLE TRAINING EXAMPLES + +We extend the analysis of the data augmentation role by training the same networks with fewer training examples. Similarly, we also analyze the combination of data augmentation and explicit regularization in this case. All models are trained with the same random subset of data and tested in the same test set as the previous experiments in order to enable fairer comparisons. Figure 2 (green and red bars) shows the main results with $50 \%$ and $10 \%$ of the available data and the full report, as well as additional experiments with $80 \%$ and $1 \%$ of the data, is given in Table 3 of the Appendix A. + +As expected, the performance decays with the number of available training examples. However, as the level of data augmentation increases, the difference with respect to the baseline performance (by training with all examples) significantly decreases. This indicates that data augmentation serves, to a great extent, as true data. Therefore, this confirms the effectiveness of this technique when not many training examples are available. + +Furthermore, in all the experiments with a reduced set of the available data, the observations presented above become even clearer. It seems that if explicit regularization is removed, data augmentation alone better resists the lack of data. This can probably be explained by the fact that explicit regularization reduces the effective capacity, preventing the model from taking advantage of the augmented data. + +# 2.4 SHALLOWER AND DEEPER ARCHITECTURES + +Finally, we perform the same experiments on shallower and deeper versions of All-CNN, so as to analyze how data augmentation and regularization are handled by architectures of different depth. We test a shallower network with 9 layers instead of 12 and $3 7 4 \mathrm { K }$ parameters instead of $1 . 3 { \bf M }$ : + +and a deeper network with 15 layers and $2 . 4 \mathbf { M }$ parameters: + +2×96C3(1)–96C3(2)–2×192C3(1)–192C3(2)–2×192C3(1)–192C3(2)–192C3(1)–192C1(1) –N.Cl.C1(1)–Gl.Avg.–Softmax + +The results in Figure 2 (purple and brown bars) together with the detailed report of results in Table 4 of the Appendix A show that if the explicit regularization is removed and data augmentation applied, the shallower network achieves slightly worse results and the deeper network slightly better results than the original network. This behavior can be explained by the reduced or increased depth and number of parameters. However, with the explicit regularization active, the results dramatically decrease in both cases. The most probable explanation is that the regularization parameters are not adjusted to the architecture, whereas in the original models the parameters where finely tuned by the authors to obtain state of the art results. This highlights another important advantage of data augmentation: the adjustment of its parameters depends mostly on the training data, rather than on the particular architecture, which offers much more flexibility compared to using explicit regularization. In Appendix B we provide ananalysis of the norm of the weight matrices that helps shed some more light on how the different levels of regularization and data augmentation affect the learned models. + +# 3 DISCUSSION AND CONCLUSION + +In this work, we have presented a systematic analysis of the role of data augmentation in deep neural networks for object recognition, focusing on the comparison with popular techniques of explicit regularization. We have built upon the work by Zhang et al. (2017), where the authors concluded that explicit regularization is not necessary, although it improves generalization performance. Here, we have shown that it is not only unnecessary, but also that the generalization gain provided by explicit regularization can be achieved by data augmentation alone. + +The importance of these results lies in the fact that explicit regularization is the standard tool to enable the generalization of most machine learning methods. However, according to Zhang et al. (2017), explicit regularization plays a different role in deep learning, not explained by statistical learning theory (Vapnik & Chervonenkis, 1971). We argue instead that the theory still holds in deep learning, but one has to properly consider the crucial role of implicit regularization. Explicit regularization is no longer necessary because its contribution is already provided by the many elements that implicitly regularize the models: SGD, convolutional layers or data augmentation, among others. + +Whereas explicit regularizers, such as weight decay and dropout, succeed in mitigating overfitting by blindly reducing the effective capacity of a model, implicit regularization operates more effectively at capturing important characteristics of the data (Neyshabur et al., 2014). For instance, convolutional layers successfully reduce the capacity of a model by imposing a parameter sharing strategy that incorporates some essential prior domain knowledge, as well as data augmentation by transforming the training examples in a meaningful and plausible way. + +In this regard it is worth highlighting some of the advantages of data augmentation: Not only does it not reduce the effective capacity of the model, but it increases the number of training examples, which, according to statistical learning theories, reduces the generalization error. Furthermore, if the transformations are such that they reflect plausible variations of the real objects, it increases the robustness of the model and it can be regarded as a data-dependent prior, similarly to unsupervised pre-training (Erhan et al., 2010). Besides, unlike explicit regularization techniques, data augmentation does not increase the computational complexity because it can be performed in parallel to the gradient updates on the CPU, making it a computationally free operation. Finally, in Section 2.4 we have shown how data augmentation transparently adapts to architectures of different depth, whereas explicitly regularized models need manual adjustment of the regularization parameters. + +Deep neural networks can especially benefit from data augmentation because they do not rely on precomputed features and because the large number of parameters allows them to shatter the augmented training set. Actually, if data augmentation is included for training, we might have to reconsider whether deep learning operates in an overparameterization regime, since the model capacity should take into account the amount of training data, which is exponentially increased by augmentation. + +Some argue that despite these advantages, data augmentation is a highly limited approach because it depends on some prior expert knowledge and it cannot be applied to all domains. However, we argue instead that expert knowledge should not be disregarded but exploited. A single data augmentation scheme can be designed for a broad family of data, e.g. natural images, and effectively applied to a broad set of tasks, e.g. object recognition, segmentation, localization, etc. Besides, some recent works show that it is possible to learn the data augmentation strategies (Lemley et al., 2017; Ratner et al., 2017) and future research will probably yield even better results in different domains. + +Finally, it is important to note that, due to computational limitations, we have performed a systematic analysis only on CIFAR-10 and CIFAR-100, which consist of very small images. These data sets do not allow performing more agressive data augmentation since the low resolution images can easily show distortions that hinder the recognition of the object. However, some previous works (Graham, 2014; Springenberg et al., 2014) have shown impressive results by performing heavier data augmentation on higher resolution versions on CIFAR-10. We plan to extend this analysis to higher resolution data sets such as ImageNet and one could expect even more benefits from data augmentation compared to explicit regularization techniques. + +# ACKNOWLEDGMENTS + +This project has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Sklodowska-Curie grant agreement No 641805. + +# REFERENCES + +Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org. + +Yoshua Bengio, Pascal Lamblin, Dan Popovici, and Hugo Larochelle. Greedy layer-wise training of deep networks. In Advances in neural information processing systems, pp. 153–160, 2007. + +Yoshua Bengio, Arnaud Bergeron, Nicolas Boulanger-Lewandowski, Thomas Breuel, Youssouf Chherawala, Moustapha Cisse, Dumitru Erhan, Jeremy Eustache, Xavier Glorot, Xavier Muller, et al. Deep learners benefit more from out-of-distribution examples. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 164–172, 2011. + +Rich Caruana. Multitask learning. In Learning to learn, pp. 95–133. Springer, 1998. + +Franc¸ois Chollet et al. Keras. https://github.com/fchollet/keras, 2015. + +Dan Claudiu Ciresan, Ueli Meier, Luca Maria Gambardella, and Jurgen Schmidhuber. Deep big¨ simple neural nets excel on handwritten digit recognition. arXiv preprint arXiv:1003.0358, 2010. + +Yann N Dauphin and Yoshua Bengio. Big neural networks waste capacity. In International Conference on Learning Representations, ICLR, arXiv: 1301.3583, 2013. + +Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017a. + +Terrance DeVries and Graham W Taylor. Dataset augmentation in feature space. In International Conference on Learning Representations, ICLR, arXiv:1702.05538, 2017b. + +Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, 11(Feb):625–660, 2010. + +Federico Girosi, Michael Jones, and Tomaso Poggio. Regularization theory and neural networks architectures. Neural computation, 7(2):219–269, 1995. + +Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In JMLR W&CP: Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics (AISTATS 2010), volume 9, pp. 249–256, may 2010. + +Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 315–323, 2011. + +Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016. + +Ian J. Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron C. Courville, and Yoshua Bengio. Maxout networks. In Proceedings of the 30th International Conference on Machine Learning, ICML, pp. 1319–1327, 2013. + +Benjamin Graham. Fractional max-pooling. arXiv preprint arXiv:1412.6071, 2014. + +Stephen Jose Hanson and Lorien Y Pratt. Comparing biases for minimal network construction with´ back-propagation. In Advances in neural information processing systems, pp. 177–185, 1989. + +Søren Hauberg, Oren Freifeld, Anders Boesen Lindbo Larsen, John Fisher, and Lars Hansen. Dreaming more data: Class-dependent distributions over diffeomorphisms for learned data augmentation. In Artificial Intelligence and Statistics, pp. 342–350, 2016. + +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. + +Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European Conference on Computer Vision, pp. 646–661. Springer, 2016. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015. + +Navdeep Jaitly and Geoffrey E Hinton. Vocal tract length perturbation (vtlp) improves speech recognition. In Proc. ICML Workshop on Deep Learning for Audio, Speech and Language, pp. 625– 660, 2013. + +Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. + +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 LeCun, Bernhard E Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne E Hubbard, and Lawrence D Jackel. Handwritten digit recognition with a back-propagation network. In Advances in neural information processing systems, pp. 396–404, 1990. + +Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015. + +Joseph Lemley, Shabab Bazrafkan, and Peter Corcoran. Smart augmentation-learning an optimal data augmentation strategy. IEEE Access, 2017. + +Xinghua Lu, Bin Zheng, Atulya Velivelli, and ChengXiang Zhai. Enhancing text categorization with semantic-enriched representation and training data augmentation. Journal of the American Medical Informatics Association, 13(5):526–535, 2006. + +Klaus-Robert Muller. Regularization techniques to improve generalization. In ¨ Neural Networks: Tricks of the Trade, pp. 49–51. Springer, 2012. + +Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. In International Conference on Learning Representations, ICLR, arXiv: 1412.6614, 2014. + +D. C. Plaut, S. J. Nowlan, and G. E Hinton. Experiments on learning by back propagation. ERIC, 1986. + +Alexander J Ratner, Henry R Ehrenberg, Zeshan Hussain, Jared Dunnmon, and Christopher Re.´ Learning to compose domain-specific transformations for data augmentation. In Advances in Neural Information Processing Systems, pp. 3239–3249, 2017. + +Patrice Simard, Bernard Victorri, Yann LeCun, and John Denker. Tangent prop-a formalism for specifying selected invariances in an adaptive network. In Advances in neural information processing systems, pp. 895–903, 1992. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. + +Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. In International Conference on Learning Representations, ICLR, arXiv:1412.6806, 2014. + +Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of machine learning research, 15(1):1929–1958, 2014. + +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. + +Stefan Uhlich, Marcello Porcu, Franck Giron, Michael Enenkl, Thomas Kemp, Naoya Takahashi, and Yuki Mitsufuji. Improving music source separation based on deep neural networks through data augmentation and network blending. Submitted to ICASSP, 2017. + +V. N. Vapnik and A. Y. Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. Theory of Probab. and its Applications, 16(2):264–280, 1971. + +Oriol Vinyals, Charles Blundell, Tim Lillicrap, koray kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In Advances in Neural Information Processing Systems 29, pp. 3630–3638, 2016. + +Ren Wu, Shengen Yan, Yi Shan, Qingqing Dang, and Gang Sun. Deep image: Scaling up image recognition. arXiv preprint arXiv:1501.02876, 7(8), 2015. + +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In Proceedings of the British Machine Vision Conference, BMVC, pp. 87.1–87.12, 2016. + +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations, ICLR, arXiv:1611.03530, 2017. + +# A DETAILED AND EXTENDED EXPERIMENTAL RESULTS + +This appendix details the results of the main experiments shown in Figure 2 and provides the results of many other experiments. For example, the results of the models trained with dropout, but without weight decay and the results of training with $80 \%$ and $1 \%$ of the data are not shown in Figure 2 in order not to clutter the visualization. + +Additionally, for most experiments we train a version of the network without batch normalization. These results are provided within brackets in the tables. Note that the original All-CNN results published by Springenberg et al. (2014) did not include batch normalization. In the case of WRN, we remove all batch normalization layers except the top-most one, before the spatial average pooling, since otherwise many models would not converge. + +Table 2: Test accuracy of the networks All-CNN and WRN on CIFAR-10 and CIFAR-100, comparing the performance with and without explicit regularizers and the different augmentation schemes. Results within brackets show the performance of the models without batch normalization + +
NetworkWDDropoutAug.schemeTest CIFAR-10Test CIFAR-100
All-CNNyesyesno90.04 (88.35)66.50 (60.54)
yesyeslight93.26 (91.97)70.85 (65.57)
yesyesheavier93.08 (92.44)70.59 (68.62)
noyesno77.99 (87.59)52.39 (60.96)
noyeslight77.20 (92.01)69.71 (68.01)
noyesheavier88.29 (92.18)70.56 (68.40)
nonono84.53 (71.98)57.99 (39.03)
nonolight93.26 (90.10)69.26 (63.00)
nonoheavier93.55 (91.48)71.25 (71.46)
WRNyesyesno91.44 (89.30)71.67 (67.42)
yesyeslight95.01 (93.48)77.58 (74.23)
yesyesheavier95.60 (94.38)76.96 (74.79)
noyesno91.47 (89.38)71.31 (66.85)
noyeslight94.76 (93.52)77.42 (74.62)
noyesheavier95.58 (94.52)77.47 (73.96)
nonono89.56 (85.45)68.16 (59.90)
nonolight94.71 (93.69)77.08 (75.27)
nonoheavier95.47 (94.95)77.30 (75.69)
+ +An important observation from Table 2 is that the interaction of weight decay and dropout is not always consistent, since in some cases better results are obtained with both explicit regularizers active and in other cases, only dropout achieves better generalization. However, the effect of data augmentation seems to be clearer: just some light augmentation achieves much better results than training only with the original data set and performing heavier augmentation almost always further improves the test accuracy, without the need for explicit regularization. + +Not surprisingly, batch normalization also contributes to improve the generalization of All-CNN and it seems to combine well with data augmentation. On the contrary, when combined with explicit regularization the results are interestingly not consistent in the case of All-CNN: it seems to improve the generalization of the model trained with both weight decay and dropout, but it drastically reduces the performance with only dropout, in the case of CIFAR-10 and CIFAR-100 without augmentation. A probable explanation is, again, that the regularization hyperparameteres would need to be readjusted with a change of the architecture. + +Furthermore, it seems that the gap between the performance of the models trained with and without batch normalization is smaller when they are trained without explicit regularization and when they include heavier data augmentation. This can be observed in both Table 2 and Table 3, which contains the results of the models trained with fewer examples. It is important to note as well the benefits of batch normalization for obtaining better results when training with fewer examples. However, it is surprising that there is only a small drop in the performance of WRN— $9 5 . 4 7 \ \%$ to $9 4 . 9 5 ~ \%$ without regularization— from removing the batch normalization layers of the residual blocks, given + +that they were identified as key components for training deep residual networks (He et al., 2016; +Zagoruyko & Komodakis, 2016). + +Table 3: Test accuracy when training with only $80 \%$ , $50 \%$ , $10 \%$ and $1 \%$ of the available training examples. Results within brackets show the performance of the models without batch normalization + +
NetworkPct. DataExplicit Reg.Aug. schemeTest CIFAR-10 89.41 (86.61)Test CIFAR-100
80 %yes yesno light92.20 (91.25)63.93 (52.51) 67.63 (63.24)
yesheavier92.83 (91.42)68.01 (65.89)
nono83.04 (75.00)55.78 (35.95)
nolight92.25 (88.75)69.05 (56.81)
noheavier92.80 (90.55)69.40 (63.57)
yesno85.88 (82.33)58.24 (44.94)
yeslight90.30 (87.37)61.03 (54.68)
heavier90.09 (88.94)63.25 (57.91)
yes nono78.61 (69.46)48.62 (31.81)
nolight90.21 (84.38)62.83 (47.84)
All-CNN 10 %heavier90.76 (87.44)64.41 (55.27)
no yesno
light67.19 (61.61)33.77 (19.79) 38.51 (22.79)
yesheavier76.03 (69.18)38.34 (26.29)
yes no78.69 (64.14) 60.97 (41.07)26.05 (17.55)
nono light78.29 (67.65)37.84 (24.34)
1%noheavier79.87 (70.64)39.85 (26.31)
yesno9.16 (3.60)
light27.53 (29.90) 37.18 (26.85)9.64 (3.65)
yes yesheavier42.73 (26.87)9.14 (2.52)
nono38.89 (35.68)9.50 (5.51)
nolight44.35 (29.29)9.87 (5.36)
80% 50%heavier47.60 (33.72)11.45 (3.57)
yesno90.2770.41
yeslight94.0775.66
yesheavier94.5775.51
nono88.9866.10
no light93.9775.07
no heavier94.8475.38
yes no86.9663.60
yeslight92.6570.83
yes noheavier92.8670.33
WRNno85.5660.64
no69.97
nolight91.8770.72
heavier92.77
yesno70.7334.11
yeslight76.0036.65
10 %yesheavier78.1038.93
nono60.3923.65
nolight79.1939.24
noheavier80.2941.44
yes33.457.47
no34.137.50
1%yeslight
yesheavier41.028.37
nono38.639.47
nolight43.849.91
noheavier47.1411.03
+ +The results in Table 3 clearly support the conclusion presented in Section 2.3: data augmentation alone resists better the lack of training data compared to explicit regularizers. Already with $80 \%$ and + +Table 4: Test accuracy of the shallower and deeper versions of the All-CNN network on CIFAR-10 and CIFAR-100. Results in parentheses show the difference with respect to the original model. + +
NetworkExplicit Reg.Aug. schemeTest CIFAR-10Test CIFAR-100
All-CNN shalloweryesno76.45 (-13.59)51.31 (-9.23)
yeslight82.02 (-11.24)56.81 (-8.76)
yesheavier86.66 (-6.42)58.64 (-9.98)
nono85.22 (+0.69)58.95 (+0.96)
nolight90.02 (-3.24)65.51 (-3.75)
All-CNN deepernoheavier90.34 (-3.21)65.87 (-5.38)
yesno86.26 (-3.78)49.06 (-11.48)
yeslight85.04 (-8.22)52.03 (-13.54)
yesheavier88.46 (-4.62)51.78 (-16.84)
nono83.30 (-1.23)54.22 (-3.77)
no nolight heavier93.46 (+0.20) 94.19 (+0.64)72.16 (+2.90) 73.30 (+2.35)
+ +$50 \%$ of the data better results are obtained in some cases, but the differences become much bigger when training with only $10 \%$ and $1 \%$ of the available data. It seems that explicit regularization prevents the model from both fitting the data and generalizing well, whereas data augmentation provides useful transformed examples. Interestingly, with only $1 \%$ of the data, even without data augmentation the models without explicit regularization perform better. + +The same effect can be observed in Table 4, where both the shallower and deeper versions of AllCNN perform much worse when trained with explicit regularization, even when trained without data augmentation. This is another piece of evidence that explicit regularization needs to be used very carefully, it requires a proper tuning of the hyperparameters and is not always benefitial. + +# B NORM OF THE WEIGHT MATRIX + +Table 5: Frobenius norm of the weight matrices learned by the networks All-CNN and WRN on CIFAR-10 and CIFAR-100, trained with and without explicit regularizers and the different augmentation schemes. Norms within brackets correspond to the models without batch normalization + +
NetworkWDDropoutAug. schemeNorm CIFAR-10Norm( CIFAR-100
All-CNNyesyesno48.7 (64.9)76.5 (97.9)
yesyeslight52.7 (63.2)77.6 (86.8)
yesyesheavier57.6 (62.8)78.1 (83.1)
noyesno52.4 (70.5)79.7 (103.3)
noyeslight57.0 (67.9)83.6 (93.0)
noyesheavier62.8 (67.5)84.0 (88.0)
nonono37.3 (63.7)47.6 (102.7)
nonolight47.0 (69.5)80.0 (108.9)
nonoheavier62.0 (71.7)91.7 (91.7)
WRNyesyesno101.4 (122.6)134.8 (126.5)
yesyeslight106.1 (123.9)140.8 (129.3)
yesyesheavier119.3 (125.3)164.2 (132.5)
noyesno153.3 (122.5)185.1 (126.5)
noyeslight160.6 (123.9)199.0 (129.4)
noyesheavier175.1 (125.2)225.4 (132.5)
nonono139.0 (120.4)157.9 (122.0)
nonolight153.6 (123.2)187.0 (127.2)
nonoheavier170.4 (125.4)217.6 (132.9)
+ +One of the simplest way of getting a rough idea of the complexity of the learned models is computing the norm of the weight matrix. Table 5 shows the Frobenius norm of the weight matrices of the models trained with different levels of explicit regularization and data augmentation. The clearest conclusion is that heavier data augmentation seems to yield solutions with larger norm. This is always true except in some All-CNN models trained without batch normalization. Another observation is that, as expected, weight decay constrains the norm of the learned function. Besides, the models trained without batch normalization exhibit smaller differences between different levels of regularization and augmentation and, in the case of All-CNN, less consistency. + +Table 6: Frobenius norm of the weight matrices learned by the shallower and deeper versions of the All-CNN network on CIFAR-10 and CIFAR-100. + +
NetworkExplicit Reg.Aug.schemeNorm CIFAR-10Norm CIFAR-100
All-CNN shalloweryesno47.968.9
yeslight49.767.1
yesheavier51.966.2
nono34.864.7
nolight45.668.8
noheavier53.168.3
All-CNN deeperyesno62.392.1
yeslight66.595.7
yesheavier71.596.9
nono45.453.4
nolight57.377.3
noheavier70.797.5
+ +One of the relevant results presented in this paper is the poor performance of the regularized models on the shallower and deeper versions of All-CNN, compared to the models without explicit regularization (see Table 4). One hypothesis is that the amount of regularization is not properly adjusted through the hyperparameters. This could be reflected in the norm of the learned weights, shown in Table 6. However, the norm alone does not seem to fully explain the large performance differences between the different models. Finding the exact reasons why the regularized models not able to generalize well might require a much thourough analysis and we leave it as future work. \ No newline at end of file diff --git a/md/train/Byg9A24tvB/Byg9A24tvB.md b/md/train/Byg9A24tvB/Byg9A24tvB.md new file mode 100644 index 0000000000000000000000000000000000000000..86026414bc4f212d7d2b0d2f6bbd7b5d83f8d8f9 --- /dev/null +++ b/md/train/Byg9A24tvB/Byg9A24tvB.md @@ -0,0 +1,515 @@ +# RETHINKING SOFTMAX CROSS-ENTROPY LOSS FOR ADVERSARIAL ROBUSTNESS + +Tianyu Pang, Kun Xu, Yinpeng Dong, Chao Du, Ning Chen, Jun Zhu∗ Dept. of Comp. Sci. & Tech., BNRist Center, Institute for AI, Tsinghua University; RealAI {pty17,xu-k16,dyp17,du-c14}@mails.tsinghua.edu.cn, {ningchen,dcszj}@tsinghua.edu.cn + +# ABSTRACT + +Previous work shows that adversarially robust generalization requires larger sample complexity, and the same dataset, e.g., CIFAR-10, which enables good standard accuracy may not suffice to train robust models. Since collecting new training data could be costly, we focus on better utilizing the given data by inducing the regions with high sample density in the feature space, which could lead to locally sufficient samples for robust learning. We first formally show that the softmax cross-entropy (SCE) loss and its variants convey inappropriate supervisory signals, which encourage the learned feature points to spread over the space sparsely in training. This inspires us to propose the Max-Mahalanobis center (MMC) loss to explicitly induce dense feature regions in order to benefit robustness. Namely, the MMC loss encourages the model to concentrate on learning ordered and compact representations, which gather around the preset optimal centers for different classes. We empirically demonstrate that applying the MMC loss can significantly improve robustness even under strong adaptive attacks, while keeping high accuracy on clean inputs comparable to the SCE loss with little extra computation. + +# 1 INTRODUCTION + +The deep neural networks (DNNs) trained by the softmax cross-entropy (SCE) loss have achieved state-of-the-art performance on various tasks (Goodfellow et al., 2016). However, in terms of robustness, the SCE loss is not sufficient to lead to satisfactory performance of the trained models. It has been widely recognized that the DNNs trained by the SCE loss are vulnerable to adversarial attacks (Carlini & Wagner, 2017a; Goodfellow et al., 2015; Kurakin et al., 2017; Moosavi-Dezfooli et al., 2016; Papernot et al., 2016), where human imperceptible perturbations can be crafted to fool a high-performance network. To improve adversarial robustness of classifiers, various kinds of defenses have been proposed, but many of them are quickly shown to be ineffective to the adaptive attacks, which are adapted to the specific details of the proposed defenses (Athalye et al., 2018). + +Besides, the methods on verification and training provably robust networks have been proposed (Dvijotham et al., 2018a;b; Hein & Andriushchenko, 2017; Wong & Kolter, 2018). While these methods are exciting, the verification process is often slow and not scalable. Among the previously proposed defenses, the adversarial training (AT) methods can achieve state-of-the-art robustness under different adversarial settings (Madry et al., 2018; Zhang et al., 2019b). These methods either directly impose the AT mechanism on the SCE loss or add additional regularizers. Although the AT methods are relatively strong, they could sacrifice accuracy on clean inputs and are computationally expensive (Xie et al., 2019). Due to the computational obstruction, many recent efforts have been devoted to proposing faster verification methods (Wong et al., 2018; Xiao et al., 2019) and accelerating AT procedures (Shafahi et al., 2019; Zhang et al., 2019a). However, the problem still remains. + +Schmidt et al. (2018) show that the sample complexity of robust learning can be significantly larger than that of standard learning. Given the difficulty of training robust classifiers in practice, they further postulate that the difficulty could stem from the insufficiency of training samples in the commonly used datasets, e.g., CIFAR-10 (Krizhevsky & Hinton, 2009). Recent work intends to solve this problem by utilizing extra unlabeled data (Carmon et al., 2019; Stanforth et al., 2019), while we focus on the complementary strategy to exploit the labeled data in hand more efficiently. Note that although the samples in the input space are unchangeable, we could instead manipulate the local sample distribution, i.e., sample density in the feature space via appropriate training objectives. Intuitively, by inducing high-density feature regions, there would be locally sufficient samples to train robust classifiers and return reliable predictions (Schmidt et al., 2018). + +Similar to our attempt to induce high-density regions in the feature space, previous work has been proposed to improve intra-class compactness. Contrastive loss (Sun et al., 2014) and triplet loss (Schroff et al., 2015) are two classical objectives for this purpose, but the training iterations will dramatically grow to construct image pairs or triplets, which results in slow convergence and instability. The center loss (Wen et al., 2016) avoids the pair-wise or triplet-wise computation by minimizing the squared distance + +![](images/cd21ca49c496b899fcd796cd244157363d97f6d237c3a499c74d82c8e7cc0796.jpg) +Figure 1: Intuitive illusion of how training data moves and how sample density varies in a two-dimensional feature space during the training procedure. + +between the features and the corresponding class centers. However, since the class centers are updated w.r.t. the learned features during training, the center loss has to be jointly used with the SCE loss to seek for a trade-off between inter-class dispersion and intra-class compactness. Therefore, the center loss cannot concentrate on inducing strong intra-class compactness to construct high-density regions and consequently could not lead to reliable robustness, as shown in our experiments. + +In this paper, we first formally analyze the sample density distribution induced by the SCE loss and its other variants (Pang et al., 2018; Wan et al., 2018) in Sec. 3.2, which demonstrates that these previously proposed objectives convey unexpected supervisory signals on the training points, which make the learned features tend to spread over the space sparsely. This undesirable behavior mainly roots from applying the softmax function in training, which makes the loss function only depend on the relative relation among logits and cannot directly supervise on the learned representations. + +We further propose a novel training objective which can explicitly induce high-density regions in the feature space and learn more structured representations. To achieve this, we propose the MaxMahalanobis center (MMC) loss (detailed in Eq. (8)) as the substitute of the SCE loss. Specifically, in the MMC loss, we first preset untrainable class centers with optimal inter-class dispersion in the feature space according to Pang et al. (2018), then we encourage the features to gather around the centers by minimizing the squared distance similar with the center loss. The MMC loss can explicitly control the inter-class dispersion by a single hyperparameter, and further concentrate on improving intra-class compactness in the training procedure to induce high-density regions, as intuitively shown in Fig. 1. Behind the simple formula, the MMC loss elegantly combines the favorable merits of the previous methods, which leads to a considerable improvement on the adversarial robustness. + +In experiments, we follow the suggestion by Carlini et al. (2019) that we test under different threat models and attacks, including the adaptive attacks (Athalye et al., 2018) on MNIST, CIFAR-10, and CIFAR-100 (Krizhevsky & Hinton, 2009; LeCun et al., 1998). The results demonstrate that our method can lead to reliable robustness of the trained models with little extra computation, while maintaining high clean accuracy with faster convergence rates compared to the SCE loss and its variants. When combined with the existing defense mechanisms, e.g., the AT methods (Madry et al., 2018), the trained models can be further enhanced under the attacks different from the one used to craft adversarial examples for training. + +# 2 PRELIMINARIES + +This section first provides the notations, then introduces the adversarial attacks and threat models. + +# 2.1 NOTATIONS + +In this paper, we use the lowercases to denote variables and the uppercases to denote mappings. Let $L$ be the number of classes, we define the softmax function softmax ${ \bf \Phi } : \mathbb { R } ^ { L } \to \dot { \mathbb { R } } ^ { L }$ as so $\mathrm { \ t m a x } ( h ) _ { i } = \exp ( h _ { i } ) / { \sum _ { l = 1 } ^ { L } \exp ( h _ { l } ) } , i \in [ L ]$ , where $[ L ] : = \{ 1 , \cdots , L \}$ and $h$ is termed as logit. + +A deep neural network (DNN) learns a non-linear mapping from the input $x \in \mathbb { R } ^ { p }$ to the feature $z = \dot { Z ( x ) } \in \mathbb { R } ^ { d }$ . One common training objective for DNNs is the softmax cross-entropy (SCE) loss: + +$$ +\mathcal { L } _ { \mathrm { S C E } } ( Z ( x ) , y ) = - 1 _ { y } ^ { \top } \log { [ \mathrm { s o f t m a x } ( W z + b ) ] } , +$$ + +for a single input-label pair $( x , y )$ , where $1 _ { y }$ is the one-hot encoding of $y$ and the logarithm is defined as element-wise. Here $W$ and $b$ are the weight matrix and bias vector of the SCE loss, respectively. + +# 2.2 ADVERSARIAL ATTACKS AND THREAT MODELS + +Previous work has shown that adversarial examples can be easily crafted to fool DNNs (Biggio et al., 2013; Nguyen et al., 2015; Szegedy et al., 2014). A large amount of attacking methods on generating adversarial examples have been introduced in recent years (Carlini & Wagner, 2017a; Chen et al., 2017; Dong et al., 2018; Goodfellow et al., 2015; Ilyas et al., 2018; Kurakin et al., 2017; Madry et al., 2018; Moosavi-Dezfooli et al., 2016; Papernot et al., 2016; Uesato et al., 2018). Given the space limit, we try to perform a comprehensive evaluation by considering five different threat models and choosing representative attacks for each threat model following Carlini et al. (2019): + +White-box $l _ { \infty }$ distortion attack: We apply the projected gradient descent (PGD) (Madry et al., 2018) method, which is efficient and widely studied in previous work (Pang et al., 2019). + +White-box $l _ { 2 }$ distortion attack: We apply the C&W (Carlini & Wagner, 2017a) method, which has a binary search mechanism on its parameters to find the minimal $l _ { 2 }$ distortion for a successful attack. + +Black-box transfer-based attack: We use the momentum iterative method (MIM) (Dong et al., 2018) that is effective on boosting adversarial transferability (Kurakin et al., 2018). + +Black-box gradient-free attack: We choose SPSA (Uesato et al., 2018) since it has broken many previously proposed defenses. It can still perform well even when the loss is difficult to optimize. + +General-purpose attack: We also evaluate the general robustness of models when adding Gaussian noise (Gilmer et al., 2019) or random rotation (Engstrom et al., 2019) on the input images. + +Furthermore, to exclude the false robustness caused by, e.g., gradient mask (Athalye et al., 2018), we modify the above attacking methods to be adaptive attacks (Carlini & Wagner, 2017b; Carlini et al., 2019; Herley & Van Oorschot, 2017) when evaluating on the robustness of our method. The adaptive attacks are much more powerful than the non-adaptive ones, as detailed in Sec. 4.2. + +# 3 METHODOLOGY + +Various theoretical explanations have been developed for adversarial examples (Fawzi et al., 2016; 2018; Ilyas et al., 2019; Papernot et al., 2018). In particular, Schmidt et al. (2018) show that training robust classifiers requires significantly larger sample complexity compared to that of training standard ones, and they further postulate that the difficulty of training robust classifiers stems from, at least partly, the insufficiency of training samples in the common datasets. Recent efforts propose alternatives to benefit training with extra unlabeled data (Carmon et al., 2019; Stanforth et al., 2019), while we explore the complementary way to better use the labeled training samples for robust learning. + +Although a given sample is fixed in the input space, we can instead manipulate the local sample distribution, i.e., sample density in the feature space, via designing appropriate training objectives. Intuitively, by inducing high-density regions in the feature space, it can be expected to have locally sufficient samples to train robust models that are able to return reliable predictions. In this section, we first formally define the notion of sample density in the feature space. Then we provide theoretical analyses of the sample density induced by the SCE loss and its variants. Finally, we propose our new Max-Mahalanobis center (MMC) loss and demonstrate its superiority compared to previous losses. + +# 3.1 SAMPLE DENSITY IN THE FEATURE SPACE + +Given a training dataset $\mathcal { D }$ with $N$ input-label pairs, and the feature mapping $Z$ trained by the objective $\bar { \mathcal { L } } ( Z ( \bar { x } ) , y )$ on this dataset, we define the sample density nearby the feature point $z = Z ( x )$ + +following the similar definition in physics (Jackson, 1999) as + +$$ +\mathbb { S D } ( z ) = \frac { \Delta N } { \mathrm { V o l } ( \Delta B ) } . +$$ + +Here $\operatorname { v o l } ( \cdot )$ denotes the volume of the input set, $\Delta B$ is a small neighbourhood containing the feature point $z$ , and $\Delta N = | Z ( \mathcal { D } ) \cap \Delta B |$ is the number of training points in $\Delta B$ , where $Z ( \mathcal { D } )$ is the set of all mapped features for the inputs in $\mathcal { D }$ . Note that the mapped feature $z$ is still of the label $y$ . + +In the training procedure, the feature distribution is directly induced by the training loss $\mathcal { L }$ , where minimizing the loss value is the only supervisory signal for the feature points to move (Goodfellow et al., 2016). This means that the sample density varies mainly along the orthogonal direction w.r.t. the loss contours, while the density along a certain contour could be approximately considered as the same. For example, in the right panel of Fig. 1, the sample density induced by our MMC loss (detailed in Sec. 3.3) changes mainly along the radial direction, i.e., the directions of red arrows, where the loss contours are dashed concentric circles. Therefore, supposing $\mathcal { L } ( z , y ) = C$ , we choose $\Delta B = \{ \mathbf { z } \in \mathbb { R } ^ { d } | { \mathcal { L } } ( \mathbf { z } , y ) \in [ C , C + \Delta C ] \}$ , where $\Delta C > 0$ is a small value. Then $\mathrm { V o l } ( \Delta B )$ is the volume between the loss contours of $C$ and $C + \Delta C$ for label $y$ in the feature space. + +# 3.2 THE SAMPLE DENSITY INDUCED BY THE GENERALIZED SCE LOSS + +Generalized SCE loss. To better understand how the SCE loss and its variants (Pang et al., 2018; Wan et al., 2018) affect the sample density of features, we first generalize the definition in Eq. (1) as: + +$$ +\mathcal { L } _ { \mathrm { g - S C E } } ( Z ( x ) , y ) = - 1 _ { y } ^ { \top } \log { [ \mathrm { s o f t m a x } ( h ) ] } , +$$ + +where the logit $h = H ( z ) \in \mathbb { R } ^ { L }$ is a general transformation of the feature $z$ , for example, $h = W z + b$ in the SCE loss. We call this family of losses as the generalized SCE $\scriptstyle ( { \bf g } - { \bf S } { \bf C } { \bf E } )$ loss. Wan et al. (2018) propose the large-margin Gaussian Mixture (L-GM) loss, where $h _ { i } = { \breve { - } } ( z - \mu _ { i } ) ^ { \top } \Sigma _ { i } ( z - \mu _ { i } ) - m \delta _ { i , y }$ under the assumption that the learned features $z$ distribute as a mixture of Gaussian. Here $\mu _ { i }$ and $\Sigma _ { i }$ are extra trainable means and covariance matrices respectively, $m$ is the margin, and $\delta _ { i , y }$ is the indicator function. Pang et al. (2018) propose the Max-Mahalanobis linear discriminant analysis (MMLDA) loss, where $h _ { i } = - \| z - \mu _ { i } ^ { * } \| _ { 2 } ^ { 2 }$ under the similar mixture of Gaussian assumption, but the main difference is that $\mu _ { i } ^ { * }$ are not trainable, but calculated before training with optimal inter-class dispersion. These two losses both fall into the family of the $\mathbf { g }$ -SCE loss with quadratic logits: + +$$ +h _ { i } = - ( z - \mu _ { i } ) ^ { \top } \Sigma _ { i } ( z - \mu _ { i } ) + B _ { i } , +$$ + +where $B _ { i }$ are the bias variables. Besides, note that for the SCE loss, there is + +$$ +\mathrm { s o f t m a x } ( W z + b ) _ { i } = \frac { \exp ( W _ { i } ^ { \top } z + b _ { i } ) } { \sum _ { l \in [ L ] } \exp ( W _ { l } ^ { \top } z + b _ { l } ) } = \frac { \exp ( - \| z - \frac { 1 } { 2 } W _ { i } \| _ { 2 } ^ { 2 } + b _ { i } + \frac { 1 } { 4 } \| W _ { i } \| _ { 2 } ^ { 2 } ) } { \sum _ { l \in [ L ] } \exp ( - \| z - \frac { 1 } { 2 } W _ { l } \| _ { 2 } ^ { 2 } + b _ { l } + \frac { 1 } { 4 } \| W _ { l } \| _ { 2 } ^ { 2 } ) } . +$$ + +According to Eq. (4), the SCE loss can also be regraded as a special case of the $\mathrm { g - S C E }$ loss with quadratic logits, where $\begin{array} { r } { \mu _ { i } = \frac { 1 } { 2 } W _ { i } } \end{array}$ , $\begin{array} { r } { B _ { i } = b _ { i } + \frac 1 4 \| \dot { W _ { i } } \| _ { 2 } ^ { 2 } } \end{array}$ and $\Sigma _ { i } = I$ are identity matrices. Therefore, later when we refer to the g-SCE loss, we assume that the logits are quadratic as in Eq. (4) by default. + +The contours of the g-SCE loss. To provide a formal representation of the sample density induced by the $\mathrm { g - S C E }$ loss, we first derive the formula of the contours, i.e., the closed-form solution of $\mathcal { L } _ { \mathrm { g - S C E } } ( Z ( x ) , y ) = C$ in the space of $z$ , where $C \in ( 0 , + \infty )$ is a given constant. Let $C _ { e } = \exp ( C ) \in$ $( 1 , + \infty )$ , from Eq. (3), we can represent the contours as the solution of + +$$ +\log \left( 1 + \frac { \sum _ { l \neq y } \exp ( h _ { l } ) } { \exp ( h _ { y } ) } \right) = C \implies h _ { y } = \log \left[ \sum _ { l \neq y } \exp ( h _ { l } ) \right] - \log ( C _ { e } - 1 ) . +$$ + +The function in Eq. (5) does not provide an intuitive closed-form solution for the contours, since the existence of the term $\begin{array} { r } { \log \left[ \sum _ { l \neq y } \exp ( h _ { l } ) \right] } \end{array}$ . However, note that this term belongs to the family of Log-Sum-Exp (LSE) function, which is a smooth approximation to the maximum function (Nesterov, 2005; Nielsen & Sun, 2016). Therefore, we can locally approximate the function in Eq. (5) with + +$$ +h _ { y } - h _ { \tilde { y } } = - \log ( C _ { e } - 1 ) , +$$ + +![](images/e8eff5603d86340f061e410cce3ffe57b54ed800936ba7ac11e6c26cc797d7d6.jpg) +Figure 2: Intuitive illustration on the inherent limitations of the $\mathbf { g } { - } \mathbf { S } \mathbf { C } \mathbf { E }$ loss. Reasonably learned features for a classification task should distribute in clusters, so it is counter-intuitive that the feature points tend to move to infinity to pursue lower loss values when applying the $\mathbf { g }$ -SCE loss. In contrast, MMC induces models to learn more structured and orderly features. + +where $\tilde { y } = \mathrm { a r g } \operatorname* { m a x } _ { l \neq y } h _ { l }$ . In the following text, we apply colored characters with tilde like $\tilde { y }$ to better visually distinguish them. According to Eq. (6), we can define $\mathcal { L } _ { y , \tilde { y } } ( z ) = \log [ \exp ( h _ { \tilde { y } } - h _ { y } ) + 1 ]$ as the local approximation of the $\mathrm { g - S C E }$ loss nearby the feature point $z$ , and substitute the neighborhood ∆B by ∆By,y˜ $\Delta \bar { B } _ { y , \mathrm { ~ \scriptsize ~ = ~ } } \{ \mathbf { z } \in \mathbb { R } ^ { d } | \mathcal { L } _ { y , \mathrm { ~ \scriptsize ~ ( ~ \mathbf { z } ) ~ \in ~ } [ C , C \dot { ~ } + \Delta C ] \} }$ . For simplicity, we assume scaled identity covariance matrix in Eq. (4), i.e., $\Sigma _ { i } = \sigma _ { i } I$ , where $\sigma _ { i } > 0$ are scalars. Through simple derivations (detailed in Appendix A.1), we show that if $\sigma _ { y } \neq \sigma$ , the solution of $\mathcal { L } _ { y , \textit { \textbf { ( z ) } } } = C$ is a $( d - 1 )$ - dimensional hypersphere with the center $\mathbf { M } _ { y , \mathbf { \Omega } } = ( \sigma _ { y } - \sigma \mathbf { \Omega } ) ^ { - 1 } ( \sigma _ { y } \mu _ { y } - \sigma \mathbf { \Omega } \mu \mathbf { \Sigma } )$ ; otherwise if $\sigma _ { y } = \sigma$ , the hypersphere-shape contour will degenerate to a hyperplane. + +The induced sample density. Since the approximation in Eq. (6) depends on the specific $y$ and $\cdot$ , we define the training subset $\mathcal { D } _ { k , \tilde { k } } = \{ ( x , y ) \in \mathcal { D } | y = k$ , $\tilde { y } = \tilde { k } \}$ and $N _ { k , \tilde { k } } = | \mathcal { D } _ { k , \tilde { k } } |$ . Intuitively, Dk,k˜ includes the data with the true label of class $k$ , while the highest prediction returned by the classifier is class $\tilde { k }$ among other classes. Then we can derive the approximated sample density in the feature space induced by the $\mathbf { g }$ -SCE loss, as stated in the following theorem: + +Theorem 1. (Proof in Appendix A.1) Given $( x , y ) \in \mathcal { D } _ { k , \tilde { k } }$ , $z = Z ( x )$ and $\mathcal { L } _ { g - S C E } ( z , y ) = C$ , if there are $\Sigma _ { k } = \sigma _ { k } I$ , $\Sigma _ { \tilde { k } } = \sigma _ { \tilde { k } } I$ , and $\sigma _ { k } \neq \sigma _ { \tilde { k } }$ , then the sample density nearby the feature point $z$ based on the approximation in Eq. (6) is + +$$ +\begin{array} { r } { \mathbb { S } \mathbb { D } ( z ) \propto \frac { N _ { k , \tilde { k } } \cdot p _ { k , \tilde { k } } ( C ) } { \left[ \mathbf { B } _ { k , \tilde { k } } + \frac { \log ( C _ { e } - 1 ) } { \sigma _ { k } - \sigma _ { \tilde { k } } } \right] ^ { \frac { d - 1 } { 2 } } } , a n d \mathbf { B } _ { k , \tilde { k } } = \frac { \sigma _ { k } \sigma _ { \tilde { k } } \| \mu _ { k } - \mu _ { \tilde { k } } \| _ { 2 } ^ { 2 } } { ( \sigma _ { k } - \sigma _ { \tilde { k } } ) ^ { 2 } } + \frac { B _ { k } - B _ { \tilde { k } } } { \sigma _ { k } - \sigma _ { \tilde { k } } } , } \end{array} +$$ + +where for the input-label pair in $\mathcal { D } _ { k , \tilde { k } }$ , there is $\mathcal { L } _ { g - S C E } \sim p _ { k , \tilde { k } } ( c )$ . + +Limitations of the $\mathbf { g }$ -SCE loss. Based on Theorem 1 and the approximation in Eq. (6), let $C ^ { * } =$ $\mathrm { l o g } ( 1 + \exp ( \mathbf { B } _ { k , \tilde { k } } ( \sigma _ { \tilde { k } } - \sigma _ { k } ) ) )$ and $C _ { e } ^ { * } = \exp ( C ^ { * } )$ , such that $\begin{array} { r } { \bar { \mathbf { B } } _ { k , \tilde { k } } + \frac { \log ( C _ { e } ^ { * } - 1 ) } { \sigma _ { k } - \sigma _ { \tilde { k } } } \bar { = } \bar { 0 } } \end{array}$ = 0. According to Appendix A.1, if $\sigma _ { k } > \sigma _ { \tilde { k } }$ , then $C ^ { * }$ will act as a tight lower bound for $C$ , i.e., the solution set of $C < C ^ { * }$ is empty. This will make the training procedure tend to avoid this case since the loss $C$ cannot be further minimized to zero, which will introduce unnecessary biases on the returned predictions. On the other hand, if $\sigma _ { k } < \sigma _ { \tilde { k } }$ , $C$ could be minimized to zero. However, when $C 0$ , the sample density will also tend to zero since there is $\begin{array} { r } { \mathbf { B } _ { k , \tilde { k } } + \frac { \log ( C _ { e } - 1 ) } { \sigma _ { k } - \sigma _ { \tilde { k } } } \infty } \end{array}$ , which means the feature point will be encouraged to go further and further from the hypersphere center $\mathbf { M } _ { k , \tilde { k } }$ only to make the loss value $C$ be lower, as intuitively illustrated in Fig. 2(a). + +This counter-intuitive behavior mainly roots from applying the softmax function in training. Namely, the softmax normalization makes the loss value only depend on the relative relation among logits. This causes indirect and unexpected supervisory signals on the learned features, such that the points with low loss values tend to spread over the space sparsely. Fortunately, in practice, the feature point will not really move to infinity, since the existence of batch normalization layers (Ioffe & Szegedy, 2015), and the squared radius from the center $\mathbf { M } _ { k , \tilde { k } }$ increases as $\mathcal { O } ( | \log C | )$ when minimizing the loss $C$ These theoretical conclusions are consistent with the empirical observations on the two-dimensional features in previous work (cf. Fig. 1 in Wan et al. (2018)). + +Another limitation of the $\mathbf { g }$ -SCE loss is that the sample density is proportional to $N _ { k , \tilde { k } }$ , which is on average $N / L ^ { 2 }$ . For example, there are around 1.3 million training data in ImageNet (Deng et al., 2009), but with a large number of classes $L = 1 , 0 0 0$ , there are averagely less than two samples in each $\mathcal { D } _ { k , \tilde { k } }$ . These limitations inspire us to design the new training loss as in Sec 3.3. + +Remark 1. If $\sigma _ { k } = \sigma _ { \tilde { k } }$ (e.g., as in the SCE loss), the features with loss values in $[ C , C + \Delta C ]$ will be encouraged to locate between two hyperplane contours without further supervision, and consequently there will not be explicit supervision on the sample density as shown in the left panel of Fig. 1. + +Remark 2. Except for the $\mathbf { g }$ -SCE loss, Wen et al. (2016) propose the center loss in order to improve the intra-class compactness of learned features, formulated as $\begin{array} { r } { \mathcal { L } _ { \mathrm { C e n t e r } } ( Z ( x ) , y ) = \frac { 1 } { 2 } \| z - \mu _ { y } \| _ { 2 } ^ { 2 } } \end{array}$ . Here the center $\mu _ { y }$ is updated based on a mini-batch of learned features with label $y$ in each training iteration. The center loss has to be jointly used with the SCE loss as $\mathcal { L } _ { \mathrm { S C E } } + \lambda \mathcal { L } _ { \mathrm { C e n t e r } } ,$ , since simply supervise the DNNs with the center loss term will cause the learned features and centers to degrade to zeros (Wen et al., 2016). This makes it difficult to derive a closed-form formula for the induced sample density. Besides, the center loss method cannot concentrate on improving intra-class compactness, since it has to seek for a trade-off between inter-class dispersion and intra-class compactness. + +# 3.3 MAX-MAHALANOBIS CENTER LOSS + +Inspired by the above analyses, we propose the Max-Mahalanobis center (MMC) loss to explicitly learn more structured representations and induce high-density regions in the feature space. The MMC loss is defined in a regression form without the softmax function as + +$$ +\mathcal { L } _ { \mathrm { M M C } } ( Z ( x ) , y ) = \frac { 1 } { 2 } \| z - \mu _ { y } ^ { * } \| _ { 2 } ^ { 2 } . +$$ + +Here $\mu ^ { * } = \{ \mu _ { l } ^ { * } \} _ { l \in [ L ] }$ are the centers of the Max-Mahalanobis distribution (MMD) (Pang et al., 2018). The MMD is a mixture of Gaussian distribution with identity covariance matrix and preset centers $\mu ^ { * }$ , where $\| \mu _ { l } ^ { * } \| _ { 2 } = C _ { \mathrm { M M } }$ for any $l \in [ L ]$ , and $C _ { \mathrm { M M } }$ is a hyperparameter. These MMD centers are invariable during training, which are crafted according to the criterion: $\begin{array} { r } { \mu ^ { * } = \arg \operatorname* { m i n } _ { \mu } \operatorname* { m a x } _ { i \neq j } \langle \mu _ { i } , \mu _ { j } \rangle } \end{array}$ . Intuitively, this criterion is to maximize the minimal angle between any two centers, which can provide optimal inter-class dispersion as shown in Pang et al. (2018). In Appendix B.1, we provide the generation algorithm for $\mu ^ { * }$ in MMC. We derive the sample density induced by the MMC loss in the feature space, as stated in Theorem 2. Similar to the previously introduced notations, here we define the subset $\mathcal { D } _ { k } = \{ ( x , y ) \in \mathcal { D } | y = k \}$ and $N _ { k } = | \mathcal { D } _ { k } |$ . + +Theorem 2. (Proof in Appendix A.2) Given $( x , y ) \in \mathcal { D } _ { k }$ , $z = Z ( x )$ and $\mathcal { L } _ { M M C } ( z , y ) = C$ , the sample density nearby the feature point $z$ is + +$$ +\mathbb { S D } ( z ) \propto \frac { N _ { k } \cdot p _ { k } ( C ) } { C ^ { \frac { d - 1 } { 2 } } } , +$$ + +where for the input-label pair in $\mathcal { D } _ { k }$ , there is $\mathcal { L } _ { M M C } \sim p _ { k } ( c )$ + +According to Theorem 2, there are several attractive merits of the MMC loss, as described below. + +Inducing higher sample density. Compared to Theorem 1, the sample density induced by MMC is proportional to $N _ { k }$ rather than $N _ { k , \tilde { k } }$ , where $N _ { k }$ is on average $N / L$ . It facilitates producing higher sample density. Furthermore, when the loss value $C$ is minimized to zero, the sample density will exponentially increase according to Eq. (9), as illustrated in Fig. 2(b). The right panel of Fig. 1 also provides an intuitive insight on this property of the MMC loss: since the loss value $C$ is proportional to the squared distance from the preset center $\mu _ { y } ^ { * }$ , the feature points with lower loss values are certain to locate in a smaller volume around the center. Consequently, the feature points of the same class are encouraged to gather around the corresponding center, such that for each sample, there will be locally enough data in its neighborhood for robust learning (Schmidt et al., 2018). The MMC loss value also becomes a reliable metric of the uncertainty on returned predictions. + +Better exploiting model capacity. Behind the simple formula, the MMC loss can explicitly monitor inter-class dispersion by the hyperparameter $C _ { \mathrm { M M } }$ , while enabling the network to concentrate on minimizing intra-class compactness in training. Instead of repeatedly searching for an internal tradeoff in training as the center loss, the monotonicity of the supervisory signals induced by MMC can better exploit model capacity and also lead to faster convergence, as empirically shown in Fig. 3(a). + +![](images/deb36c75e4c426d6fca32c84344f3da984c10ed3738d645212bd66306431ea0d.jpg) +Figure 3: (a) Test error rates on clean images w.r.t training time on CIFAR-10. Here AT refers to 10-steps targeted PGD adversarial training, i.e., $\mathsf { A T } _ { 1 0 } ^ { \mathsf { t a r } }$ . (b) Two-dimensional visualization of the attacks on trained MMC networks in the feature space of MNIST. For each attack there is $\epsilon = 0 . 3$ with step size of 0.01. The total number of iteration steps is 50, where Iter- indicates the perturbed features at -th iteration step. + +Avoiding the degradation problem. The MMC loss can naturally avoid the degradation problem encountered in Wen et al. (2016) when the center loss is not jointly used with the SCE loss, since the preset centers $\mu ^ { * }$ for MMC are untrainable. In the test phase, the network trained by MMC can still return a normalized prediction with the softmax function. More details about the empirical superiorities of the MMC loss over other previous losses are demonstrated in Sec. 4. + +Remark 3. In Appendix B.2, we discuss on why the squared-error form in Eq. (8) is preferred compared to, e.g., the absolute form or the Huber form in the adversarial setting. We further introduce flexible variants of the MMC loss in Appendix B.3, which can better adapt to various tasks. + +Remark 4. Pang et al. (2018) propose a Max-Mahalanobis linear discriminant analysis (MMLDA) method, which assumes the features to distribute as an MMD. Due to the Gaussian mixture assumption, the training loss for the MMLDA method is obtained by the Bayes’ theorem as + +$$ +{ \mathcal { L } } _ { \mathrm { M M L D A } } ( Z ( x ) , y ) = - \log \left[ \frac { \exp ( - \frac { \| z - \mu _ { y } ^ { * } \| _ { 2 } ^ { 2 } } { 2 } ) } { \sum _ { l \in [ L ] } \exp ( - \frac { \| z - \mu _ { l } ^ { * } \| _ { 2 } ^ { 2 } } { 2 } ) } \right] = - \log \left[ \frac { \exp ( z ^ { \top } \mu _ { y } ^ { * } ) } { \sum _ { l \in [ L ] } \exp ( z ^ { \top } \mu _ { l } ^ { * } ) } \right] . +$$ + +Note that there is $\Sigma _ { i } = { \textstyle { \frac { 1 } { 2 } } } I$ in Eq. (4) for the MMLDA loss, similar with the SCE loss. Thus the MMLDA method cannot explicitly supervise on the sample density and induce high-density regions in the feature space, as analyzed in Sec. 3.2. Compared to the MMLDA method, the MMC loss introduces extra supervision on intra-class compactness, which facilitates better robustness. + +# 4 EXPERIMENTS + +In this section, we empirically demonstrate several attractive merits of applying the MMC loss. We experiment on the widely used MNIST, CIFAR-10, and CIFAR-100 datasets (Krizhevsky & Hinton, 2009; LeCun et al., 1998). The main baselines for the MMC loss are SCE (He et al., 2016), Center loss (Wen et al., 2016), MMLDA (Pang et al., 2018), and L-GM (Wan et al., 2018). The codes are provided in https://github.com/P2333/Max-Mahalanobis-Training. + +# 4.1 PERFORMANCE ON THE CLEAN INPUTS + +The network architecture applied is ResNet-32 with five core layer blocks (He et al., 2016). Here we use MMC-10 to indicate the MMC loss with $C _ { \mathrm { M M } } = 1 0$ , where $C _ { \mathrm { M M } }$ is assigned based on the cross-validation results in Pang et al. (2018). The hyperparameters for the center loss, L-GM loss and the MMLDA method all follow the settings in the original papers (Pang et al., 2018; Wan et al., 2018; Wen et al., 2016). The pixel values are scaled to the interval $[ 0 , 1 ]$ . For each training loss with or without the AT mechanism, we apply the momentum SGD (Qian, 1999) optimizer with the initial learning rate of 0.01, and train for 40 epochs on MNIST, 200 epochs on CIFAR-10 and CIFAR-100. The learning rate decays with a factor of 0.1 at 100 and 150 epochs, respectively. + +![](images/e6b6d6470ddff993a11f795965a5941102ba2c93b6e9021a09ce2e30fab9d9af.jpg) +Figure 4: Classification accuracy under the black-box transfer-based attacks on the test set of CIFAR-10. The substitute model one used to craft adversarial examples, and the target model is the one that an adversary actually intends to fool. Here AT refers to $\mathbf { A T _ { 1 0 } ^ { t a r } }$ to the. + +When applying the AT mechanism (Madry et al., 2018), the adversarial examples for training are crafted by 10-steps targeted or untargeted PGD with $\epsilon = 8 / 2 5 5$ . In Fig. 3(a), we provide the curves of the test error rate w.r.t. the training time. Note that the MMC loss induces faster convergence rate and requires little extra computation compared to the SCE loss and its variants, while keeping comparable performance on the clean images. In comparison, implementing the AT mechanism is computationally expensive in training and will sacrifice the accuracy on the clean images. + +# 4.2 ADAPTIVE ATTACKS FOR THE MMC LOSS + +As stated in Athalye et al. (2018), only applying the existing attacks with default hyperparameters is not sufficient to claim reliable robustness. Thus, we apply the adaptive versions of existing attacks when evading the networks trained by the MMC loss (detailed in Appendix B.4). For instance, the non-adaptive objectives for PGD are variants of the SCE loss (Madry et al., 2018), while the adaptive objectives are $- \mathcal { L } _ { \mathrm { M M C } } ( z , y )$ and $\mathcal { L } _ { \mathrm { M M C } } ( z , y _ { t } )$ in the untargeted and targeted modes for PGD, respectively. Here $y _ { t }$ is the target label. To verify that the adaptive attacks are more effective than the non-adaptive ones, we modify the network architecture with a two-dimensional feature layer and visualize the PGD attacking procedure in Fig. 3(b). The two panels separately correspond to two randomly selected clean inputs indicated by black stars. The ten colored clusters in each panel consist of the features of all the 10,000 test samples in MNIST, where each color corresponds to one class. We can see that the adaptive attacks are indeed much more efficient than the non-adaptive one. + +# 4.3 PERFORMANCE UNDER THE WHITE-BOX ATTACKS + +We first investigate the white-box $l _ { \infty }$ distortion setting using the PGD attack, and report the results in Table 1. According to Carlini et al. (2019), we evaluate under different combinations of the attacking parameters: the perturbation $\epsilon$ , iteration steps, and the attack mode, i.e., targeted or untargeted. + +Table 2: Experiments on CIFAR-10. Part I: Averaged $l _ { 2 }$ distortion of the white-box adversarial examples crafted by C&W with 1,000 iteration steps. Part II: Classification accuracy $( \% )$ under the block-box SPSA attack. Part III: Classification accuracy $( \% )$ under general transformations. The standard deviation $\sigma$ for the Gaussian noise is 0.05, the degree range is $\pm 3 0 ^ { \circ }$ for random rotation. + +
MethodsPart IC& Wtar C& WunPart II (ε=8/255)SPSA10 SPSA10Part II (e=16/255)SPSA10 SPSA10Part IIINoise Rotation
SCECenter lossMMLDAL-GMMMC-100.120.0712.31.25.1≤152.083.5
S0.130.0721.26.0
10.62.055.484.9
0.170.1025.613.211.35.757.984.8
0.230.1261.945.946.128.259.282.4
0.340.1769.556.957.241.569.387.2
AT10 (SCE)AT10 (MMC-10)1.191.910.6381.167.877.959.482.283.576.0
0.8579.169.274.562.775.2
AT10 (SCE)AT10(MMC-10)1.260.6878.867.073.760.378.973.7
1.550.7380.469.674.662.480.375.8
+ +Following the setting in Madry et al. (2018), we choose the perturbation $\epsilon = 8 / 2 5 5$ and 16/255, with the step size be $2 / 2 5 5$ . We have also run PGD-100 and PGD-200 attacks, and find that the accuracy converges compared to PGD-50. In each PGD experiment, we ran several times with different random restarts to guarantee the reliability of the reported results. + +Ablation study. To investigate the effect on robustness induced by high sample density in MMC, we substitute uniformly sampled center set (Liu et al., 2018; Duan et al., 2019), i.e., $\mu ^ { r } = \{ \mu _ { l } ^ { r } \} _ { l \in [ L ] }$ for the MM center set $\mu ^ { * }$ , and name the resulted method as "MMC-10 (rand)" as shown in Table 1. There is also $\| \mu _ { l } ^ { r } \| _ { 2 } = C _ { \mathrm { M M } }$ , but $\mu ^ { r }$ is no longer the solution of the min-max problem in Sec. 3.3. + +From the results in Table 1, we can see that higher sample density alone in "MMC-10 (rand)" can already lead to much better robustness than other baseline methods even under the adaptive attacks, while using the optimal center set $\mu ^ { * }$ as in "MMC-10" can further improve performance. When combining with the AT mechanism, the trained models have better performance under the attacks different from the one used to craft adversarial examples for training, e.g, $\mathrm { P G D } _ { 5 0 } ^ { \mathbf { u n } }$ with $\epsilon = 1 6 / 2 5 5$ . + +Then we investigate the white-box $l _ { 2 }$ distortion setting. We apply the C&W attack, where it has a binary search mechanism to find the minimal distortion to successfully mislead the classifier under the untargeted mode, or lead the classifier to predict the target label in the targeted mode. Following the suggestion in Carlini & Wagner (2017a), we set the binary search steps to be 9 with the initial constant $c = 0 . 0 1$ . The iteration steps for each value of $c$ are set to be 1,000 with the learning rate of 0.005. In the Part I of Table 2, we report the minimal distortions found by the C&W attack. As expected, it requires much larger distortions to successfully evade the networks trained by MMC. + +# 4.4 PERFORMANCE UNDER THE BLACK-BOX ATTACKS + +Table 3: Accuracy $( \% )$ of MMC-10 under SPSA with different batch sizes. + +
CIFAR-10Batch SPSA10 SPSA
BatchSPSA10
12857.069.0
409641.052.0
819237.049.0
+ +As suggested in Carlini et al. (2019), providing evidence of being robust against the black-box attacks is critical to claim reliable robustness. We first perform the transfer-based attacks using PGD and MIM. Since the targeted attacks usually have poor transferability (Kurakin et al., 2018), we only focus on the untargeted mode in this case, and the results are shown in Fig. 4. We further perform the gradient-free attacks using the SPSA method and report the results in the Part II of Table 2. To perform numerical approximations on gradients in SPSA, we set the batch size to be 128, the learning rate is 0.01, and the step size of the finite difference is $\delta = 0 . 0 1$ , as suggested by Uesato et al. (2018). We also evaluate under stronger + +SPSA attacks with batch size to be 4096 and 8192 in Table 3, where the $\epsilon = 8 / 2 5 5$ . With larger batch sizes, we can find that the accuracy under the black-box SPSA attacks converges to it under the white-box PGD attacks. These results indicate that training with the MMC loss also leads to robustness under the black-box attacks, which verifies that our method can induce reliable robustness, rather than the false one caused by, e.g., gradient mask (Athalye et al., 2018). + +Table 4: Experiments on CIFAR-100. Part I: Classification accuracy $( \% )$ on the clean test samples. Part II: Classification accuracy $( \% )$ under the white-box PGD attacks and the block-box SPSA attack. The attacks are adaptive for MMC. Here the batch size for SPSA is 128. Part III: Averaged $l _ { 2 }$ distortion of the white-box adversarial examples crafted by C&W with 1,000 iteration steps and 9 binary search epochs. + +
MethodsPart I CleanPart II(ε = 8/255)Part I
PGDPGD10SPSASPSA10C&WtarC&Wun
SCE72.9≤18.014.01.90.160.047
Center72.8≤110.214.72.30.180.048
MMLDA72.2≤113.918.55.60.210.050
L-GM71.315.815.322.87.60.310.063
MMC-1071.923.923.433.415.80.370.085
+ +# 4.5 PERFORMANCE UNDER THE GENERAL-PURPOSE ATTACKS + +To show that our method is generally robust, we further test under the general-purpose attacks (Carlini et al., 2019). We apply the Gaussian noise (Fawzi et al., 2016; Gilmer et al., 2019) and rotation transformation (Engstrom et al., 2019), which are not included in the data augmentation for training. The results are given in the Part III of Table 2. Note that the AT methods are less robust to simple transformations like rotation, as also observed in previous work (Engstrom et al., 2019). In comparison, the models trained by the MMC loss are still robust to these easy-to-apply attacks. + +# 4.6 EXPERIMENTS ON CIFAR-100 + +In Table 4 and Table 5, we provide the results on CIFAR-100 under the white-box PGD and C&W attacks, and the black-box gradient-free SPSA attack. The hyperparameter setting for each attack is the same as it on CIFAR-10. Compared to previous defense strategies which also evaluate on CIFAR-100 (Pang et al., 2019; Mustafa et al., 2019), MMC can improve robustness more significantly, while keeping better performance on the clean inputs. Compared to the results on CIFAR-10, the averaged distortion of C&W on CIFAR-100 is larger for a successful targeted attack and is much smaller for a successful untargeted attack. This is because when only the number of classes increases, e.g., from 10 to 100, it is easier to achieve a coarse untargeted attack, but harder to make a subtle targeted attack. Note that in Table 5, we also train on the ResNet-110 model with eighteen core block layers except for the ResNet-32 model. The results show that MMC can further benefit from deep network architectures and better exploit model capacity to improve robustness. Similar properties are also observed in previous work when applying the AT methods (Madry et al., 2018). In contrast, as shown in Table 5, the models trained by SCE are comparably sensitive to adversarial perturbations for different architectures, which demonstrates that SCE cannot take full advantage of the model capacity to improve robustness. This verifies that MMC provides effective robustness promoting mechanism like the AT methods, with much less computational cost. + +# 5 CONCLUSION + +In this paper, we formally demonstrate that applying the softmax function in training could potentially lead to unexpected supervisory signals. To solve this problem, we propose the MMC loss to learn more structured representations and induce high-density regions in the feature space. In our experiments, we empirically demonstrate several favorable merits of our method: (i) Lead to reliable robustness even under strong adaptive attacks in different threat models; (ii) Keep high performance on clean inputs comparable to SCE; (iii) Introduce little extra computation compared to the SCE loss; (iv) Compatible with the existing defense mechanisms, e.g., the AT methods. Our analyses in this paper also provide useful insights for future work on designing new objectives beyond the SCE framework. + +# ACKNOWLEDGEMENTS + +This work was supported by the National Key Research and Development Program of China (No. 2017YFA0700904), NSFC Projects (Nos. 61620106010, U19B2034, U1811461), Beijing NSF Project (No. L172037), Beijing Academy of Artificial Intelligence (BAAI), Tsinghua-Huawei Joint Research Program, a grant from Tsinghua Institute for Guo Qiang, Tiangong Institute for Intelligent Computing, the JP Morgan Faculty Research Program and the NVIDIA NVAIL Program with GPU/DGX Acceleration. + +# REFERENCES + +Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International Conference on Machine Learning (ICML), 2018. + +Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Šrndic, Pavel Laskov, Giorgio ´ Giacinto, and Fabio Roli. Evasion attacks against machine learning at test time. In Joint European conference on machine learning and knowledge discovery in databases, pp. 387–402. Springer, 2013. + +Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In IEEE Symposium on Security and Privacy (S&P), 2017a. + +Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In ACM Workshop on Artificial Intelligence and Security (AISec), 2017b. + +Nicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras, Ian Goodfellow, Aleksander Madry, and Alexey Kurakin. On evaluating adversarial robustness. arXiv preprint arXiv:1902.06705, 2019. + +Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, Percy Liang, and John C Duchi. Unlabeled data improves adversarial robustness. In Advances in Neural Information Processing Systems (NeurIPS), 2019. + +Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security (AISec), pp. 15–26. ACM, 2017. + +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 248–255. IEEE, 2009. + +Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4690–4699, 2019. + +Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018. + +Yueqi Duan, Jiwen Lu, and Jie Zhou. Uniformface: Learning deep equidistributed representation for face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3415–3424, 2019. + +Krishnamurthy Dvijotham, Sven Gowal, Robert Stanforth, Relja Arandjelovic, Brendan O’Donoghue, Jonathan Uesato, and Pushmeet Kohli. Training verified learners with learned verifiers. arXiv preprint arXiv:1805.10265, 2018a. + +Krishnamurthy Dvijotham, Robert Stanforth, Sven Gowal, Timothy Mann, and Pushmeet Kohli. A dual approach to scalable verification of deep networks. In Annual Conference on Uncertainty in Artificial Intelligence (UAI), 2018b. + +Logan Engstrom, Brandon Tran, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. A rotation and a translation suffice: Fooling cnns with simple transformations. In International Conference on Machine Learning (ICML), 2019. + +Alhussein Fawzi, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Robustness of classifiers: from adversarial to random noise. In Advances in Neural Information Processing Systems (NeurIPS), pp. 1632–1640, 2016. + +Alhussein Fawzi, Hamza Fawzi, and Omar Fawzi. Adversarial vulnerability for any classifier. In Advances in Neural Information Processing Systems (NeurIPS), 2018. + +Jerome Friedman, Trevor Hastie, and Robert Tibshirani. The elements of statistical learning, volume 1. Springer series in statistics New York, 2001. + +Justin Gilmer, Nicolas Ford, Nicolas Carlini, and Ekin Cubuk. Adversarial examples are a natural consequence of test error in noise. In International Conference on Machine Learning (ICML), 2019. + +Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org. + +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations (ICLR), 2015. + +Yandong Guo and Lei Zhang. One-shot face recognition by promoting underrepresented classes. arXiv preprint arXiv:1707.05574, 2017. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision (ECCV), pp. 630–645. Springer, 2016. + +Matthias Hein and Maksym Andriushchenko. Formal guarantees on the robustness of a classifier against adversarial manipulation. In Advances in Neural Information Processing Systems (NeurIPS), pp. 2266–2276, 2017. + +Cormac Herley and Paul C Van Oorschot. Sok: Science, security and the elusive goal of security as a scientific pursuit. In 2017 IEEE Symposium on Security and Privacy (S&P), pp. 99–120. IEEE, 2017. + +Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Black-box adversarial attacks with limited queries and information. In International Conference on Machine Learning (ICML), 2018. + +Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Logan Engstrom, Brandon Anish Athalye, Tran, and Aleksander Madry. Adversarial examples are not bugs, they are features. In Advances in Neural Information Processing Systems (NeurIPS), 2019. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning (ICML), pp. 448–456, 2015. + +John David Jackson. Classical electrodynamics. American Journal of Physics, 1999. + +Harini Kannan, Alexey Kurakin, and Ian Goodfellow. Adversarial logit pairing. arXiv preprint arXiv:1803.06373, 2018. + +Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. + +Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In The International Conference on Learning Representations (ICLR) Workshops, 2017. + +Alexey Kurakin, Ian Goodfellow, Samy Bengio, Yinpeng Dong, Fangzhou Liao, Ming Liang, Tianyu Pang, Jun Zhu, Xiaolin Hu, Cihang Xie, et al. Adversarial attacks and defences competition. arXiv preprint arXiv:1804.00097, 2018. + +Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. + +Xuezhi Liang, Xiaobo Wang, Zhen Lei, Shengcai Liao, and Stan Z Li. Soft-margin softmax for deep classification. In International Conference on Neural Information Processing (ICNIP), pp. 413–421. Springer, 2017. + +Weiyang Liu, Yandong Wen, Zhiding Yu, and Meng Yang. Large-margin softmax loss for convolutional neural networks. In International Conference on Machine Learning (ICML), 2016. + +Weiyang Liu, Yandong Wen, Zhiding Yu, Ming Li, Bhiksha Raj, and Le Song. Sphereface: Deep hypersphere embedding for face recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR), pp. 212–220, 2017. + +Weiyang Liu, Rongmei Lin, Zhen Liu, Lixin Liu, Zhiding Yu, Bo Dai, and Le Song. Learning towards minimum hyperspherical energy. In Advances in Neural Information Processing Systems (NeurIPS), pp. 6222–6233, 2018. + +Pavel Loskot and Norman C. Beaulieu. On monotonicity of the hypersphere volume and area. Journal of Geometry, 2007. + +Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations (ICLR), 2018. + +Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2574–2582, 2016. + +Aamir Mustafa, Salman Khan, Munawar Hayat, Roland Goecke, Jianging Shen, and Ling Shao. Adversarial defense by restricting the hidden space of deep neural networks. In International Conference on Computer Vision (ICCV), 2019. + +Yu Nesterov. Smooth minimization of non-smooth functions. Mathematical programming, 103(1): 127–152, 2005. + +Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 427–436, 2015. + +Frank Nielsen and Ke Sun. Guaranteed bounds on the kullback–leibler divergence of univariate mixtures. IEEE Signal Processing Letters, 23(11):1543–1546, 2016. + +Tianyu Pang, Chao Du, and Jun Zhu. Max-mahalanobis linear discriminant analysis networks. In International Conference on Machine Learning (ICML), 2018. + +Tianyu Pang, Kun Xu, Chao Du, Ning Chen, and Jun Zhu. Improving adversarial robustness via promoting ensemble diversity. In International Conference on Machine Learning (ICML), 2019. + +Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In IEEE European Symposium on Security and Privacy (EuroS&P), pp. 372–387. IEEE, 2016. + +Nicolas Papernot, Patrick McDaniel, Arunesh Sinha, and Michael Wellman. Towards the science of security and privacy in machine learning. In European Symposium on Security and Privacy (EuroS&P), 2018. + +Xianbiao Qi and Lei Zhang. Face recognition via centralized coordinate learning. arXiv preprint arXiv:1801.05678, 2018. + +Ning Qian. On the momentum term in gradient descent learning algorithms. Neural networks, 12(1): 145–151, 1999. + +Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. In Advances in Neural Information Processing Systems (NeurIPS), pp. 5019–5031, 2018. + +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 (CVPR), pp. 815–823, 2015. + +Ali Shafahi, Mahyar Najibi, Amin Ghiasi, Zheng Xu, John Dickerson, Christoph Studer, Larry S Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! In Advances in Neural Information Processing Systems (NeurIPS), 2019. + +Robert Stanforth, Alhussein Fawzi, Pushmeet Kohli, et al. Are labels required for improving adversarial robustness? In Advances in Neural Information Processing Systems (NeurIPS), 2019. + +Yi Sun, Yuheng Chen, Xiaogang Wang, and Xiaoou Tang. Deep learning face representation by joint identification-verification. In Advances in Neural Information Processing Systems (NeurIPS), pp. 1988–1996, 2014. + +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations (ICLR), 2014. + +Jonathan Uesato, Brendan O’Donoghue, Aaron van den Oord, and Pushmeet Kohli. Adversarial risk and the dangers of evaluating against weak attacks. In International Conference on Machine Learning (ICML), 2018. + +Weitao Wan, Yuanyi Zhong, Tianpeng Li, and Jiansheng Chen. Rethinking feature distribution for loss functions in image classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9117–9126, 2018. + +Feng Wang, Xiang Xiang, Jian Cheng, and Alan Loddon Yuille. Normface: l 2 hypersphere embedding for face verification. In Proceedings of the 25th ACM international conference on Multimedia (ACM MM), pp. 1041–1049. ACM, 2017. + +Hao Wang, Yitong Wang, Zheng Zhou, Xing Ji, Dihong Gong, Jingchao Zhou, Zhifeng Li, and Wei Liu. Cosface: Large margin cosine loss for deep face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5265–5274, 2018. + +Yandong Wen, Kaipeng Zhang, Zhifeng Li, and Yu Qiao. A discriminative feature learning approach for deep face recognition. In European Conference on Computer Vision (ECCV), pp. 499–515. Springer, 2016. + +Eric Wong and Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In International Conference on Machine Learning (ICML), pp. 5283–5292, 2018. + +Eric Wong, Frank Schmidt, Jan Hendrik Metzen, and J Zico Kolter. Scaling provable adversarial defenses. In Advances in Neural Information Processing Systems (NeurIPS), pp. 8400–8409, 2018. + +Kai Y Xiao, Vincent Tjeng, Nur Muhammad Shafiullah, and Aleksander Madry. Training for faster adversarial robustness verification via inducing relu stability. In International Conference on Learning Representations (ICLR), 2019. + +Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019. + +Dinghuai Zhang, Tianyuan Zhang, Yiping Lu, Zhanxing Zhu, and Bin Dong. You only propagate once: Accelerating adversarial training via maximal principle. In Advances in Neural Information Processing Systems (NeurIPS), 2019a. + +Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric P Xing, Laurent El Ghaoui, and Michael I Jordan. Theoretically principled trade-off between robustness and accuracy. In International Conference on Machine Learning (ICML), 2019b. + +# A PROOF + +In this section, we provide the proof of the theorems proposed in the paper. + +A.1 PROOF OF THEOREM 1 + +According to the definition of sample density + +$$ +\mathbb { S D } ( z ) = \frac { \Delta N } { \mathrm { V o l } ( \Delta B ) } , +$$ + +we separately calculate $\Delta N$ and $\mathrm { V o l } ( \Delta B )$ . Since $\mathcal { L } _ { \mathrm { g - S C E } } \sim p _ { k , \tilde { k } } ( c )$ for the data points in $\mathcal { D } _ { k , \tilde { k } }$ , recall that $\Delta B = \{ z \in \mathbb { R } ^ { d } | { \mathcal { L } } _ { \mathrm { g - S C E } } \in [ C , C + \Delta C ] \}$ , then there is + +$$ +\begin{array} { r l } & { \Delta N = | Z ( \mathcal { D } _ { k , \tilde { k } } ) \cap \Delta B | } \\ & { \qquad = N _ { k , \tilde { k } } \cdot p _ { k , \tilde { k } } ( C ) \cdot \Delta C . } \end{array} +$$ + +Now we calculate $\mathrm { V o l } ( \Delta B )$ by approximating it with $\mathrm { V o l } ( \Delta B _ { y , \tilde { y } } )$ . We first derive the solution of $\begin{array} { r l } { \mathcal { L } _ { y , } } & { { } = ~ C } \end{array}$ . For simplicity, we assume scaled identity covariance matrix, i.e., $\Sigma _ { i } = \sigma _ { i } I $ , where $\sigma _ { i } > 0$ are scalars. Then $\forall i , j \in [ L ]$ , $c$ is any constant, if $\sigma _ { i } \neq \sigma _ { j }$ , the solution of $h _ { i } - h _ { j } = c$ is a $( d \mathrm { - } 1 )$ -dimensional hypersphere embedded in the $d$ -dimensional space of the feature $z$ : + +$$ +\| z - \mathbf { M } _ { i , j } \| _ { 2 } ^ { 2 } = \mathbf { B } _ { i , j } - { \frac { c } { \sigma _ { i } - \sigma _ { j } } } , { \mathrm { w h e r e } } \mathbf { M } _ { i , j } = { \frac { \sigma _ { i } \mu _ { i } - \sigma _ { j } \mu _ { j } } { \sigma _ { i } - \sigma _ { j } } } , \ \mathbf { B } _ { i , j } = { \frac { \sigma _ { i } \sigma _ { j } \| \mu _ { i } - \mu _ { j } \| _ { 2 } ^ { 2 } } { ( \sigma _ { i } - \sigma _ { j } ) ^ { 2 } } } + { \frac { B _ { i } - B _ { j } } { \sigma _ { i } - \sigma _ { j } } } . +$$ + +Note that each value of $c$ corresponds to a specific contour, where $\mathbf { M } _ { i , j }$ and $\mathbf { B } _ { i , j }$ can be regraded as constant w.r.t. $c$ . When $\mathbf { B } _ { i , j } < ( \sigma _ { i } - \sigma _ { j } ) ^ { - 1 } c$ , the solution set becomes empty. Specially, if $\sigma _ { i } = \sigma _ { j } = \sigma$ , the hypersphere-shape contour will degenerate to a hyperplane: $z ^ { \top } ( \mu _ { i } - \mu _ { j } ) =$ $\begin{array} { r } { \frac { 1 } { 2 } \left[ \| \mu _ { i } \| _ { 2 } ^ { 2 } - \| \mu _ { j } \| _ { 2 } ^ { 2 } + \sigma ^ { - 1 } ( B _ { j } - B _ { i } + c ) \right] } \end{array}$ . For example, for the SCE loss, the solution of the contour is $z ^ { \top } ( W _ { i } - W _ { j } ) = b _ { j } - b _ { i } + c$ . For more general $\Sigma _ { i }$ , the conclusions are similar, e.g., the solution in Eq. (12) will become a hyperellipse. Now it easy to show that the solution of $\begin{array} { r l } { \mathcal { L } _ { y , } } & { { } = C } \end{array}$ when $y = k , \tilde { y } = \tilde { k }$ is the hypersphere: + +$$ +\| z - \mathbf { M } _ { k , \tilde { k } } \| _ { 2 } ^ { 2 } = \mathbf { B } _ { k , \tilde { k } } + \frac { \log ( C _ { e } - 1 ) } { \sigma _ { k } - \sigma _ { \tilde { k } } } . +$$ + +According to the formula of the hypersphere surface area (Loskot & Beaulieu, 2007), the volume of $\Delta B _ { y , }$ is + +$$ +\mathrm { V o l } ( \Delta B _ { y , \tilde { y } } ) = \frac { 2 \pi ^ { \frac { d } { 2 } } } { \Gamma ( \frac { d } { 2 } ) } \left( \mathbf { B } _ { k , \tilde { k } } + \frac { \log ( C _ { e } - 1 ) } { \sigma _ { k } - \sigma _ { \tilde { k } } } \right) ^ { \frac { d - 1 } { 2 } } \cdot \Delta C , +$$ + +where $\Gamma ( \cdot )$ is the gamma function. Finally we can approximate the sample density as + +$$ +\begin{array} { l } { \displaystyle \mathbb { S } \mathbb { D } ( z ) \approx \frac { \Delta N } { \Delta B _ { y , } } } \\ { \displaystyle \propto \frac { N _ { k , \tilde { k } } \cdot p _ { k , \tilde { k } } ( C ) } { \left[ \mathbf { B } _ { k , \tilde { k } } + \frac { \log ( C _ { e } - 1 ) } { \sigma _ { k } - \sigma _ { \tilde { k } } } \right] ^ { \frac { d - 1 } { 2 } } } . } \end{array} +$$ + +# A.2 PROOF OF THEOREM 2 + +Similar to the proof of Theorem 1, there is + +$$ +\begin{array} { r l } { \Delta N = | Z ( \mathcal { D } _ { k } ) \cap \Delta B | } & { } \\ { = N _ { k } \cdot p _ { k } ( C ) \cdot \Delta C . } \end{array} +$$ + +Unlike for the $\mathbf { g }$ -SCE, we can exactly calculate $\mathrm { V o l } ( \Delta B )$ for the MMC loss. Note that the solution of $\mathcal { L } _ { \mathrm { M M C } } = C$ is the hypersphere: + +$$ +\| z - \mu _ { y } ^ { * } \| _ { 2 } ^ { 2 } = 2 C . +$$ + +![](images/fc359600e0ce617edfc8fda9b8b820f6b274065866c605fee7023165506c1f86.jpg) +Figure 5: Intuitive illustration of the Max-Mahalanobis centers in the cases of $L = 2 , 3 , 4$ . + +According to the formula of the hypersphere surface area (Loskot & Beaulieu, 2007), we have + +$$ +\operatorname { V o l } ( \Delta B ) = { \frac { 2 ^ { \frac { d + 1 } { 2 } } \pi ^ { \frac { d } { 2 } } C ^ { \frac { d - 1 } { 2 } } } { \Gamma ( { \frac { d } { 2 } } ) } } \cdot \Delta C , +$$ + +where $\Gamma ( \cdot )$ is the gamma function. Finally we can obtain the sample density as + +$$ +\begin{array} { l } { \displaystyle \mathbb { S D } ( z ) = \frac { \Delta N } { \Delta B } } \\ { \displaystyle \propto \frac { N _ { k } \cdot p _ { k } ( C ) } { C ^ { \frac { d - 1 } { 2 } } } . } \end{array} +$$ + +# B TECHNICAL DETAILS + +In this section, we provide more technical details we applied in our paper. Most of our experiments are conducted on the NVIDIA DGX-1 server with eight Tesla P100 GPUs. + +# B.1 GENERATION ALGORITHM FOR THE MAX-MAHALANOBIS CENTERS + +We give the generation algorithm for crafting the Max-Mahalanobis Centers in Algorithm 1, proposed by Pang et al. (2018). Note that there are two minor differences from the originally proposed algorithm. First is that in Pang et al. (2018) they use $C = \| \mu _ { i } \| _ { 2 } ^ { 2 }$ , while we use $C _ { \bf M M } = \| \mu _ { i } \| _ { 2 }$ . Second is that we denote the feature $z \in \mathbb { R } ^ { d }$ , while they denote $z \in \mathbb { R } ^ { p }$ . The Max-Mahalanobis centers generated in the low-dimensional cases are quite intuitive and comprehensible as shown in Fig. 5. For examples, when $L = 2$ , the Max-Mahalanobis centers are the two vertexes of a line segment; when $L = 3$ , they are the three vertexes of an equilateral triangle; when $L = 4$ , they are the four vertexes of a regular tetrahedron. + +# Algorithm 1 GenerateMMcenters + +
Input: The constant CMm,the dimension of vectors d and the number of classes L.(L ≤d +1) Initialization: Let the L mean vectors be μ* = e1 and μ* = Od,i ÷ 1. Here e1 and Od separately
denote the first unit basis vector and the zero vector in Rd. fori=2 toL do
for j=1 toi-1 doμ*(j)=-[1+(μ*,μ>·(L-1)]/[μ(j)·(L-1)]
end for
H(i=√1-1*12
end for
for k = 1 to L do
H=CMM·μ
end for
Return: The optimal mean vectors μ*,i ∈ [L].
+ +# B.2 WHY THE SQUARED-ERROR FORM IS PREFERRED + +In the feature space, penalizing the distance between the features and the prefixed centers can be regarded as a regression problem. In the MMC loss, we apply the squared-error form as $\| \boldsymbol { z } - \boldsymbol { \mu } _ { y } ^ { * } \| _ { 2 } ^ { 2 }$ Other substitutes could be the absolute form $\lVert \boldsymbol { z } - \boldsymbol { \mu } _ { y } ^ { * } \rVert _ { 2 }$ or the Huber form. As stated in Friedman et al. (2001), the absolute form and the Huber form are more resistant to the noisy data (outliers) or the misspecification of the class labels, especially in the data mining applications. However, in the classification tasks that we focus on in this paper, the training data is clean and reliable. Thus the squared-error form can lead to high accuracy with faster convergence rate compared to other forms. Furthermore, in the adversarial setting, the adversarial examples have similar properties as the outliers. When we apply the AT mechanism in the training procedure, we expect the classifiers to pay more attention to the adversarial examples, i.e., the outliers. Note that this goal is the opposite of it in the data mining applications, where outliers are intended to be ignored. Therefore, due to the sensitivity to the outliers, the squared-error form can better collaborate with the AT mechanism to improve robustness. + +Besides, the MMC loss can naturally perform stronger AT mechanism without additional regularizer term. Specifically, let $x$ be the clean input, $x ^ { * }$ be the adversarial example crafted based on $x$ , then in the adversarial logit pairing (ALP) method (Kannan et al., 2018), there is an extra regularizer except for SCE as: + +$$ +\| z ( x ) - z ( x ^ { * } ) \| _ { 2 } ^ { 2 } . +$$ + +When adding $x ^ { * }$ as an extra training point for MMC, then the MMC loss will minimize $\| z ( x ) - \mu _ { y } ^ { * } \| _ { 2 } ^ { 2 } +$ $\| z ( x ^ { * } ) - \mu _ { y } ^ { * } \| _ { 2 } ^ { 2 }$ , which is an upper bound for $\begin{array} { r } { \frac { 1 } { 2 } \| z ( x ) - z ( x ^ { * } ) \| _ { 2 } ^ { 2 } } \end{array}$ . Thus performing naive adversarial training (Goodfellow et al., 2015; Madry et al., 2018) with MMC is equivalent to performing stronger adversarial training variants like ALP. As analyzed above, the squared-error form in the MMC loss can accelerate the convergence of the AT mechanism, since the objective is sensitive to the crafted adversarial examples. + +# B.3 VARIANTS OF THE MMC LOSS + +In the MMC loss, we encourage the features to gather around the preset Max-Mahalanobis (MM) centers $\mu ^ { * } = \{ \mu _ { l } ^ { * } \} _ { l \in [ L ] }$ , which leads to many attractive properties. However, this ’hard’ supervision, which induces quite an orderly feature distribution may beyond the reach of the model capability, especially when the classification tasks themselves are already challenging to learn, e.g., ImageNet (Deng et al., 2009). Therefore, we propose potential variants of the MMC loss that could probably solve the problem and make our method more adaptable. We leave the experimental investigations as future work. + +Note that the MMC loss can be regarded as minimizing the negative log likelihood (NLL) of $- \log ( P ( z | y ) )$ , where the conditional feature distribution is modeled as $\mathsf { \bar { z } } | y \sim \mathcal N ( \mu _ { y } ^ { * } , I )$ . As described above, this distribution model may not be easy to learn by the DNNs in some cases. Thus, we construct a softer model: $z | y , \mu _ { y } \sim \mathcal { N } ( \mu _ { y } , I )$ and $\mu _ { y } \sim \mathcal { N } ( \mu _ { y } ^ { * } , \alpha I )$ , where $\alpha > 0$ is a scalar. Here we give the feature center $\mu _ { y }$ a prior distribution, while the prior is centered at $\mu _ { y } ^ { * }$ . Intuitively, we relax the constraint that the features have to gather around $\mu _ { y } ^ { * }$ . Instead, we encourage the features to gather around a substitute $\mu _ { y }$ , while $\mu _ { y }$ should be in the vicinity of $\mu _ { y } ^ { * }$ . In the training, we minimize the joint NLL of $- \log ( P ( z , \mu _ { y } | y ) ) = - \log ( P ( z | y , \mu _ { y } ) ) - \log ( \tilde { P ( \mu _ { y } ) } )$ , which is equivalent to minimize the what we call elastic Max-Mahalanobis center (EMC) loss as: + +$$ +\mathcal { L } _ { \mathrm { E M C } } ( Z ( x ) , y ) = \frac { 1 } { 2 } \| z - \mu _ { y } \| ^ { 2 } + \frac { 1 } { 2 \alpha } \| \mu _ { y } - \mu _ { y } ^ { * } \| ^ { 2 } . +$$ + +Here $\mu = \{ \mu _ { l } \} _ { l \in [ L ] }$ are simply extra trainable parameters, the prior variance $\alpha$ is a hyperparameter. When $\alpha 0$ , the EMC loss degenerates to the MMC loss. Note that although $\mu _ { l } ^ { * }$ are all on the hypersphere $\{ \mathbf { z } \in \mathbb { R } ^ { d } | \| \mathbf { z } \| = C _ { \mathrm { M M } } \}$ , the support sets of $\mu _ { l }$ are the entire feature space $\mathbb { R } ^ { d }$ . + +Further improvement can be made w.r.t. the MM centers $\mu ^ { * }$ . An implicit assumption behind the generation process of $\mu ^ { * }$ is that any two classes are mutually independent. This assumption could be approximately true for MNIST and CIFAR-10, but for more complex datasets, e.g., CIFAR-100 or ImageNet, this assumption may not be appropriate since there are structures in the relation among classes. These structures can usually be visualized by a tree. To solve this problem, we introduce the hierarchical Max-Mahalanobis (HM) centers $\mu ^ { \mathrm { H } } = \{ \mu _ { l } ^ { \mathrm { H } } \} _ { l \in [ L ] }$ , which adaptively craft the centers according to the tree structure. Specifically, we first assign a virtual center (i.e., the origin) to the root node. For any child node $n _ { c }$ in the tree, we denote its parent node as $n _ { p }$ , and the number of its brother nodes as $L _ { c }$ . We locally generate a set of MM centers as $\mu ^ { ( s , L _ { c } ) } =$ GenerateMMcenters $\left( C ^ { s } , d , L _ { c } \right)$ , where $s$ is the depth of the child node $n _ { c }$ , $C ^ { s }$ is a constant with smaller values for larger $s$ . Then we assign the virtual center to each child node of $n _ { p }$ from $\mu _ { n _ { p } } + \mu ^ { ( s , L _ { c } ) }$ , i.e., a shifted set of crafted MM centers, where $\mu _ { n _ { p } }$ is the virtual center assigned to $n _ { p }$ . If the child node $n _ { c }$ is a leaf node, i.e., it correspond to a class label $l$ , then there is $\mu _ { l } ^ { \mathrm { H } } = \mu _ { n _ { c } }$ . For example, in the CIFAR-100 dataset, there are 20 superclasses, with 5 classes in each superclass. We first craft $2 0 ~ \mathrm { M M }$ centers as $\mu ^ { ( 1 , 2 0 ) } =$ GenerateMMcenters $( C ^ { 1 } , d , 2 0 )$ and 5 MM centers as $\mu ^ { ( 2 , 5 ) } =$ GenerateMMcenters $( C ^ { 2 } , d , 5 )$ , where $C ^ { 2 } \ll C ^ { 1 }$ . Note that $\mu ^ { ( 2 , 5 ) }$ could be different for each superclass, e.g., by a rotation transformation. Then if the label $l$ is the $j$ -th class in the $i$ -th superclass, there is $\mu _ { l } ^ { \mathrm { H } } = \mu _ { i } ^ { ( 1 , 2 0 ) } + \mu _ { j } ^ { ( 2 , 5 ) }$ + +![](images/12115ca27ef382b159499c70ff9ac449304cf0ff874ada634c975c571f3793f7.jpg) +Figure 6: Intuitive demonstration of the attacking mechanisms under different adaptive objectives. Here $_ y$ is the original label, $\begin{array} { r l } { \tilde { y } } & { { } = } \end{array}$ arg $\operatorname* { m a x } _ { l \neq y } h _ { l }$ is the label of the nearest other decision region w.r.t. the feature $_ z$ , and $y _ { t }$ is the target label of targeted attacks. + +# B.4 ADAPTIVE OBJECTIVES AND THE INDUCED ATTACKING MECHANISMS + +We apply the adaptive versions of existing attacks when evading the networks trained by the MMC loss. Wmode: $\mathcal { L } _ { \mathrm { A d a } } ^ { \bf u \bar { n } , 1 } = - \dot { \mathcal { L } } _ { \mathrm { M M C } } ( z , y )$ a; $\mathcal { L } _ { \mathrm { A d a } } ^ { \bar { \bf u n } , 2 } = \mathcal { L } _ { \mathrm { M M C } } ( z , \tilde { y } ) - \mathcal { L } _ { \mathrm { M M C } } ( z , y )$ $\mathcal { L } _ { \mathrm { { A d a } } }$ o minimize under the untargeted, and under the targeted mode: $\mathcal { L } _ { \mathrm { A d a } } ^ { \mathrm { t a r } , 1 } { = } \mathcal { L } _ { \mathrm { M M C } } ( z , y _ { t } )$ ; $\mathcal { L } _ { \mathrm { A d a } } ^ { \mathrm { t a r } , 2 } = \mathcal { L } _ { \mathrm { M M C } } ( z , y _ { t } ) { - \mathcal { L } _ { \mathrm { M M C } } ( z , y ) }$ , where $y _ { t }$ is the targeted label, $\tilde { y }$ is generally the highest predicted label except for by Carlini & Wagner (2017a;b). Spe $y$ as defined in Sec. 3.2. These ofically, the adaptive objectives ves rand previous workare used in the $\bar { \mathcal { L } } _ { \mathrm { A d a } } ^ { \mathrm { t a r } , 1 }$ $\mathcal { L } _ { \mathrm { A d a } } ^ { \mathbf { u n } , 1 }$ PGD, MIM and SPSA attacks, while the objectives Ltar,2Ada and $\mathcal { L } _ { \mathrm { A d a } } ^ { \mathbf { u n } , 2 }$ Ada Ada are used in the C&W attacks. + +In Fig. 6, we demonstrate the attacking mechanisms induced by different adaptive adversarial objectives. Note that we only focus on the gradients and ignore the specific method which implements the attack. Different adaptive objectives are preferred under different adversarial goals. For examples, when decreasing the confidence of the true label is the goal, $\mathcal { L } _ { \mathrm { A d a } } ^ { \mathbf { u n } , 1 }$ is the optimal choice; in order to mislead the classifier to predict an untrue label or the target label, $\mathcal { L } _ { \mathrm { A d a } } ^ { \mathbf { u n } , 2 }$ and $ { \mathcal { L } } _ { \mathrm { A d a } } ^ { \mathrm { t a r } , 2 }$ are the optimal choices, respectively. Sometimes there are additional detectors, then the adversarial examples generated by $\mathcal { L } _ { \mathrm { A d a } } ^ { \mathrm { t a r } , 1 }$ could be assigned to the target label with high confidence by the classifiers. + +# B.5 RELATED WORK IN THE FACE RECOGNITION AREA + +There are many previous work in the face recognition area that focus on angular margin-based softmax (AMS) losses (Liu et al., 2016; 2017; Liang et al., 2017; Wang et al., 2018; Deng et al., 2019). They mainly exploit three basic operations: weight normalization (WN), feature normalization (FN), and angular margin (AN). It has been empirically shown that WN can benefit the cases with unbalanced data (Guo & Zhang, 2017); FN can encourage the models to focus more on hard examples (Wang et al., 2017); AN can induce larger inter-class margins and lead to better generalization in different facial tasks (Wang et al., 2018; Deng et al., 2019). However, there are two critical differences between our MMC loss and these AMS losses: + +Table 5: Classification accuracy $( \% )$ on the white-box adversarial examples crafted on the test set of CIFAR-10 and CIFAR-100. The results w.r.t the MMC loss are reported under the adaptive versions of different attacks. MMC can better exploit deep architectures, while SCE cannot. + +
MethodsCle.Perturbation ε = 8/255Perturbation ε = 16/255
PGDPGD1PGD5PGD50PGDPGDPGD5PGD3
CIFAR-10
SCE (Res.32)93.6<13.7<13.6<12.7<12.9
MMC (Res.32)92.748.736.026.624.836.125.213.417.5
SCE (Res.110) MMC (Res.110)94.7 93.6≤1 54.73.0 46.0≤1 34.42.9 31.4<1 41.02.1 30.7≤1 16.22.0 21.6
CIFAR-100
SCE (Res.32)72.3<17.8<17.4<14.8<14.7
MMC (Res.32)71.923.923.415.121.916.416.78.015.7
SCE (Res.110)74.8≤17.5≤17.3≤14.7≤14.5
MMC (Res.110)73.234.622.423.716.524.114.913.910.5
+ +# Difference one: The inter-class margin + +• The AMS losses induce the inter-class margins mainly by encouraging the intra-class compactness, while the weights are not explicitly forced to have large margins (Qi & Zhang, 2018). + +• The MMC loss simultaneously fixes the class centers to be optimally dispersed and encourages the intra-class distribution to be compact. Note that both of the two mechanisms can induce inter-class margins, which can finally lead to larger inter-class margins compared to the AMS losses. + +# Difference two: The normalization + +• The AMS losses use both WN and FN to exploit the angular metric, which makes the normalized features distribute on hyperspheres. The good properties of the AMS losses are at the cost of abandoning the radial degree of freedom, which may reduce the capability of models. + +• In the MMC loss, there is only WN on the class centers, i.e., $\| \mu _ { y } ^ { * } \| = C _ { \mathrm { M M } }$ , and we leave the degree of freedom in the radial direction for the features to keep model capacity. However, note that the MMC loss $\| z - \mu _ { y } ^ { * } \| _ { 2 } ^ { 2 } \geq ( \| z \| _ { 2 } - C _ { \mathrm { M M } } ) ^ { 2 }$ is a natural penalty term on the feature norm, which encourage $\left. z \right. _ { 2 }$ to not be far from $C _ { \mathrm { M M } }$ . This prevents models from increasing feature norms for easy examples and ignoring hard examples, just similar to the effect caused by FN but more flexible. \ No newline at end of file diff --git a/md/train/BygFVAEKDH/BygFVAEKDH.md b/md/train/BygFVAEKDH/BygFVAEKDH.md new file mode 100644 index 0000000000000000000000000000000000000000..1d33610f1af2e2ded9f30debc044bd7600f48f98 --- /dev/null +++ b/md/train/BygFVAEKDH/BygFVAEKDH.md @@ -0,0 +1,376 @@ +# UNDERSTANDING KNOWLEDGE DISTILLATION IN NON-AUTOREGRESSIVE MACHINE TRANSLATION + +Chunting Zhou1∗, Jiatao $\mathbf { G u ^ { 2 * } }$ , Graham Neubig1 + +Language Technologies Institute, Carnegie Mellon University Facebook AI Research2 {chuntinz, gneubig}@cs.cmu.edu, jgu@fb.com + +# ABSTRACT + +Non-autoregressive machine translation (NAT) systems predict a sequence of output tokens in parallel, achieving substantial improvements in generation speed compared to autoregressive models. Existing NAT models usually rely on the technique of knowledge distillation, which creates the training data from a pretrained autoregressive model for better performance. Knowledge distillation is empirically useful, leading to large gains in accuracy for NAT models, but the reason for this success has, as of yet, been unclear. In this paper, we first design systematic experiments to investigate why knowledge distillation is crucial in NAT training. We find that knowledge distillation can reduce the complexity of data sets and help NAT to model the variations in the output data. Furthermore, a strong correlation is observed between the capacity of an NAT model and the complexity of the distilled data that provides the best translation quality. Based on these findings, we further propose several approaches that can alter the complexity of data sets to improve the performance of NAT models. We achieve state-of-theart performance for NAT-based models, and close the gap with the autoregressive baseline on the WMT14 En-De benchmark.1 + +# 1 INTRODUCTION + +Traditional neural machine translation (NMT) systems (Bahdanau et al., 2015; Gehring et al., 2017; Vaswani et al., 2017) generate sequences in an autoregressive fashion; each target token is predicted step-by-step by conditioning on the previous generated tokens in a monotonic (e.g. left-to-right) order. While such autoregressive translation (AT) models have proven successful, the sequential dependence of decisions precludes taking full advantage of parallelism afforded by modern hardware (e.g. GPUs) at inference time. In contrast, non-autoregressive translation (NAT) models (Gu et al., 2018; Lee et al., 2018) predict the whole sequence or multi-token chunks of the sequence simultaneously, alleviating this problem by trading the model’s capacity for decoding efficiency. Such a non-autoregressive factorization assumes that the output tokens are independent from each other. However, this assumption obviously does not hold in reality and as a result NAT models generally perform worse than standard AT models. + +One key ingredient in the training recipe for NAT models that is used in almost all existing works (Gu et al. (2018); Lee et al. (2018); Stern et al. (2019), inter alia) is creation of training data through knowledge distillation (Hinton et al., 2015). More precisely, sequence-level knowledge distillation (Kim & Rush, 2016) – a special variant of the original approach – is applied during NAT model training by replacing the target side of training samples with the outputs from a pre-trained AT model trained on the same corpus with a roughly equal number of parameters. It is usually assumed (Gu et al., 2018) that knowledge distillation’s reduction of the “modes” (alternative translations for an input) in the training data is the key reason why distillation benefits NAT training. However, this intuition has not been rigorously tested, leading to three important open questions: + +• Exactly how does distillation reduce the “modes”, and how we could we measure this reduction quantitatively? Why does this reduction consistently improve NAT models? • What is the relationship between the NAT model (student) and the AT model (teacher)? Are different varieties of distilled data better for different NAT models? • Due to distillation, the performance of NAT models is largely bounded by the choice of AT teacher. Is there a way to further close the performance gap with standard AT models? + +In this paper, we aim to answer the three questions above, improving understanding of knowledge distillation through empirical analysis over a variety of AT and NAT models. Specifically, our contributions are as follows: + +• We first visualize explicitly on a synthetic dataset how modes are reduced by distillation (§3.1). Inspired by the synthetic experiments, we further propose metrics for measuring complexity and faithfulness for a given training set. Specifically, our metrics are the conditional entropy and KL-divergence of word translation based on an external alignment tool, and we show that these metrics are correlated with NAT model performance (§3.2). We conduct a systematic analysis (§4) over four AT teacher models and six NAT student models with various architectures on the standard WMT14 English-German translation benchmark. These experiments find a strong correlation between the capacity of an NAT model and the optimal dataset complexity that results in the best translation quality. +• Inspired by these observations, we propose approaches to further adjust the complexity of the distilled data in order to match the model’s capacity (§5). We also show that we can achieve the state-of-the-art performance for NAT models and largely match the performance of the AT model. + +# 2 BACKGROUND + +# 2.1 NON-AUTOREGRESSIVE NEURAL MACHINE TRANSLATION + +In order to model the joint probability of the output sequence $\textbf { { y } }$ , NMT models usually generate each output token conditioned on the previously generated ones $\begin{array} { r } { p ( \pmb { y } | \pmb { x } ) = \prod _ { t = 1 } ^ { T } p ( y _ { t } | \pmb { y } _ { < t } , \pmb { x } ) } \end{array}$ . This is known as the autoregressive factorization. To generate a translation from this model, one could predict one token at a time from left to right and greedily take arg max over each output probability distribution, or use beam search to consider a fixed number of hypotheses. In this work, we study non-autoregressive translation (NAT), a special subset of NMT models with an additional restriction (the zeroth-order Markov assumption) upon the output predictions or a subset thereof. The simplest formulation of an NAT model independently factors the conditional distribution: $\begin{array} { r } { p ( \pmb { y } | \pmb { x } ) = \overline { { \prod _ { t = 1 } ^ { T } p ( y _ { t } | \pmb { x } ) } } } \end{array}$ . + +Standard NAT models (Gu et al., 2018) adopt an architecture similar to the Transformer (Vaswani et al., 2017) and make non-autoregressive predictions for the entire sequence with one forward pass of the decoder. However, because multiple translations are possible for a single input sentence (the so-called multi-modality problem; Gu et al. (2018)), vanilla NAT models can fail to capture the dependencies between output tokens. As a result, they tend to make egregious mistakes such as outputting tokens repeatedly. To improve the model’s ability to handle multi-modality, recent works have incorporated approaches including (1) relaxing the fully non-autoregressive restriction and adopting $K$ decoding passes (instead of just one) to iteratively refine the generated outputs (Lee et al., 2018; Ghazvininejad et al., 2019; Wang et al., 2018; Stern et al., 2018; 2019; Gu et al., 2019); (2) using latent variables (Kaiser et al., 2018; Ma et al., 2019; Shu et al., 2019) or structured information such as syntax trees (Akoury et al., 2019) to capture translation variation; (3) training NAT models with objectives other than maximum likelihood (Wang et al., 2019; Wei et al., 2019; Shao et al., 2019) which ameliorates the effects of multi-modality. However, to achieve competitive performance with the autoregressive model, almost all existing NAT models rely on training using data distilled from a pre-trained AT model instead of the real parallel training set, as described below. + +# 2.2 SEQUENCE-LEVEL KNOWLEDGE DISTILLATION + +Knowledge distillation (Liang et al., 2008; Hinton et al., 2015) was originally proposed for training a weaker student classifier on the targets predicted from a stronger teacher model. A typical approach is using the label probabilities produced by the teacher as “soft targets” $q _ { i } =$ $\mathrm { e x p } ( z _ { i } \bar { / \tau } ) / { \sum _ { j } \mathrm { e x p } ( z _ { j } \bar { / \tau } ) }$ for training the student model, where $q _ { i }$ and $z _ { i }$ are the probability and the logit of class $i$ respectively and $\tau$ is the temperature. Prior work has shown the effectiveness of adopting knowledge distillation in adversarial defense (Papernot et al., 2016), neural network compression (Howard et al., 2017), and fast inference for speech synthesis (Oord et al., 2018). + +In the context of sequence generation, Kim & Rush (2016) extend knowledge distillation to the sentence level using “hard targets” from a pretrained large teacher model to train a small sequence generation model. More precisely, the teacher distribution $q ( t | x )$ is approximated by its mode: $\begin{array} { r } { \bar { q } ( { \pmb t } | { \pmb x } ) \approx \mathbb { 1 } \{ { \pmb t } = \arg \operatorname* { m a x } _ { { \pmb t } \in { \mathcal T } } q ( { \pmb t } | { \pmb x } ) \} } \end{array}$ with the following objectives: + +$$ +\mathcal { L } _ { \mathrm { s e q } , \mathrm { K D } } = - \mathbb { E } _ { \mathbf { x } \sim \mathrm { d a t a } } \sum _ { t \in \mathcal { T } } q ( t | x ) \log p ( t | x ) \approx - \mathbb { E } _ { \mathbf { x } \sim \mathrm { d a t a } , \hat { y } = \mathbf { a r g } \operatorname* { m a x } _ { t \in \mathcal { T } } \mathbf { \Phi } } q ( t | x ) \left[ \log p ( t = \hat { y } | x ) \right] , +$$ + +where $t \in \tau$ is the space of possible target sequences. This can also be seen as a special case of standard distillation over the sentence space when the temperature $\tau$ approaches 0, which is equivalent to taking the arg max over all feasible translations. While the “hard target” $\hat { y }$ is the most likely translation predicted by the teacher, in practice we use beam search as an approximation. As mentioned earlier, almost all the existing literature trains NAT models using sequence-level knowledge distillation from a pre-trained AT model to achieve competitive performance. Particularly, it is common to train the teacher model as a standard autoregressive Transformer (Vaswani et al., 2017) with a roughly equal number of trainable parameters as the desired NAT model on the real data. Next, we will first study how this knowledge distillation process affects the behavior of NAT models. + +# 3 HOW DOES DISTILLATION IMPROVE NAT? + +In this section, we start from an introductory example to illustrate how NAT models fail to capture the multi-modality of data. Then we propose a metric to assess the multi-modality of a data set and use it to test our hypothesis about how knowledge distillation affects NAT models. + +# 3.1 SYNTHETIC EXPERIMENT FOR MULTI-MODALITY + +Dataset. We start by investigating NAT’s difficulties in modeling multi-modality in output data using a synthetic setup where we explicitly include multiple modes in the training data. More specifically, we utilize three language pairs – English-German (En-De), English-French (En-Fr), and English-Spanish (En-Es) – from the Europarl parallel corpus.2 We extract sentences that have aligned sentences for all languages, and create a multi-target En-De/Es/Fr corpus. In this case every English input sentence always corresponds to target sentences in three different languages, which forms three explicit output modes. Notably, this is similar to the one-to-many translation setting in Johnson et al. (2017) but in our case we do not have an explicit signal (e.g. target language tag) to tell the NMT model which target language to translate to. + +Models. We train both the AT and NAT models on this concatenated data set, then compare the distributions of translations with each other. We use the standard Transformer(base) model (Vaswani et al., 2017) as the AT model, and a simplified version of Gu et al. (2018) as the NAT model where the decoder’s inputs are monotonically copied from the encoder embeddings and a length predictor is learned to predict the target sentence length. Both models are trained for 300, 000 steps using maximum likelihood. After training, we use both models to translate the English sentences in the validation and test sets. + +Visualization of AT Outputs. The synthetic setup enables us to better understand and visualize the modes in the outputs more easily. First, we visualize the outputs from the AT model. For every translated sentence, we visualize the estimated probability distribution of language classes as a point in Fig. 1 (a). This probability is calculated as the average of the posterior probability of each token, and it is estimated based on the Bayes’ law: + +$$ +p ( l _ { i } | \pmb { y } ) \approx \frac { 1 } { T } \sum _ { t = 1 } ^ { T } p ( l _ { i } | y _ { t } ) = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \frac { p ( y _ { t } | l _ { i } ) p ( l _ { i } ) } { \sum _ { k } p ( y _ { t } | l _ { k } ) p ( l _ { k } ) } +$$ + +![](images/04bb8eff87b145aae5ac0c3657d855270a0514db707480b75e062d08f96c9c87.jpg) +Figure 1: Posterior distribution of language IDs for the outputs from different models. Each translation is represented as a point inside the simplex $\Delta ^ { 2 } = \{ ( p _ { \mathrm { d e } } , p _ { \mathrm { e s } } , p _ { \mathrm { f r } } ) | p _ { k } \in ( 0 , 1 ) , p _ { \mathrm { d e } } + p _ { \mathrm { e s } } + p _ { \mathrm { f r } } = 1 \}$ where $p _ { k }$ is the estimated probability of being translated into language $k \in ( \mathrm { d e } , \mathrm { e s } , \mathrm { f r } )$ . We distinguish the language that has the largest probability with different colors. + +where $l _ { i }$ denotes the language class $i$ , and $p ( y _ { t } | l _ { i } )$ is the token frequency of $y _ { t }$ in language $l _ { i }$ . We assume $p ( l _ { i } )$ follows a uniform distribution. As shown in Fig. 1 (a), points of the AT outputs are clustered closely to each vertex of the simplex, indicating that the AT model prefers to generate the whole sequence in one language. This phenomenon verifies our assumption that decoding with the AT model (distillation) is essentially selecting “modes” over the real data. + +Visualization of NAT Outputs. We visualize outputs for the NAT model trained on the same data in Fig. 1 (b). In contrast to the AT results, the NAT points are scattered broadly inside the simplex, indicating that the NAT model fails to capture the mode of language types. Instead, it predicts tokens mixed with multiple languages, which corroborates our hypothesis that the NAT model has trouble consistently selecting a single mode when multiple modes exist. + +Next, we create two datasets that have fewer modes than the original dataset. First, we randomly select a single target sentence from one of the three languages for each source sentence. Second, we perform distillation, decoding from the AT model trained on the combined training set. As noted in the AT results, distillation will also roughly be selecting a language mode, but we conjecture that this selection may be more systematic, selecting a particular language for a particular type of training sentence. As shown in Fig. 1(c) (d), NAT models trained on both of these datasets are more likely to choose one mode (language) when generating translations, showing that training with reduced modes is essential for NAT model. Furthermore, points in Fig. 1 (d) are clearly clustered better than (c) indicating that modes selected by AT models are indeed likely more systematic and easy to capture than those generated by randomly assigning a language for each sentence. + +# 3.2 QUANTITATIVE MEASURES FOR PARALLEL DATA + +To better study why distillation is crucial for NAT models, in this section, we propose quantitative measures for analyzing the complexity and faithfulness of parallel data, two properties that we hypothesize are important for NAT training. + +Measure of Complexity. Inspired by the observations in the synthetic experiments, we propose to use a measure of translation uncertainty, specifically operationalized as conditional entropy, as the measurement of complexity $C ( d )$ for any given dataset $d = \{ ( \pmb { x } _ { 1 } , \pmb { y } _ { 1 } ) , . . . , ( \pmb { x } _ { N } , \pmb { y } _ { N } ) \}$ , where $( { \pmb x } , { \pmb y } )$ is sentence pair instantiation of $( \mathbf { \bar { X } } , \mathbf { Y } )$ and $\mathbf { X } \in { \mathcal { X } } , \mathbf { Y } \in { \mathcal { Y } }$ : + +asm.1: conditional independence + +$$ +\begin{array} { r l } { \mathcal { H } ( { \mathbf { Y } } | { \mathbf { X } } = x ) = \displaystyle \sum _ { y \in \mathcal { Y } } p ( y | x ) \log p ( y | x ) } \\ & { ~ \mathrm { ~ } } \\ { \approx \displaystyle \sum _ { y \in \mathcal { Y } } ( \displaystyle \prod _ { \substack { l = 1 } } ^ { T _ { y } } p ( y | x ) ) ( \displaystyle \sum _ { t = 1 } ^ { T _ { y } } \log p ( y _ { t } | x ) ) } \\ & { ~ \approx \displaystyle \sum _ { t = 1 } ^ { T _ { y } } \displaystyle \sum _ { y _ { t } < A ( x ) } p ( y _ { t } | \mathrm { A l i g n } ( y _ { t } ) ) \log p ( y _ { t } | \mathrm { A l i g n } ( y _ { t } ) ) } \\ & { ~ = \displaystyle \sum _ { t = 1 } ^ { T _ { x } } \mathcal { H } ( y | x = x _ { t } ) } \end{array} +$$ + +
dEn-DeEn-EsEn-Fr丨Full Real DataRandom SelectionDistillation
C(d)3.122.812.893.673.302.64
+ +Table 1: Complexity $C ( d )$ $\uparrow$ more complex) of the Europarl data set of different settings in $\ S 3 . 1$ . + +where we use $x$ and $y$ to denote a word in the source and target vocabulary respectively. $T _ { x }$ and $T _ { y }$ denote the length of the source and target sentences. To make the computation tractable, we make two additional assumptions on the conditional distribution $p ( \pmb { y } | \pmb { x } )$ : + +• Assumption 1: We assume the target tokens are independent given the source sentence. Then the conditional entropy of a sentence can be converted into the sum of entropy of target words conditioned on the source sentence $_ { \textbf { \em x } }$ . +• Assumption 2: We assume the distribution of $p ( y _ { t } | \pmb { x } )$ follows an alignment model (Dyer et al., $2 0 1 3 ) ^ { \bar { 3 } }$ where $y _ { t }$ is is generated from the word alignment distribution $p ( y _ { t } | \mathrm { A l i g n ( y _ { t } ) } )$ . This makes it possible to simplify the conditional entropy to the sum of entropy of target words conditioned on the aligned source words denoted $\mathcal { H } ( y \vert x = x _ { t } )$ ). + +The corpus level complexity $C ( d )$ is then calculated by adding up the conditional entropy $\mathcal { H } ( \mathbf { Y } | \mathbf { X } =$ ${ \pmb x } )$ of all sentences. To prevent $C ( d )$ from being dominated by frequent words, we calculate $\ddot { C } ( d )$ by averaging the entropy of target words conditioned on a source word, denoted $C ( d ) \ =$ $\begin{array} { r } { \frac { 1 } { | \mathcal { V } _ { x } | } \overset { \cdot } { \sum _ { x \in \mathcal { V } _ { x } } } \mathcal { H } ( y | x ) } \end{array}$ . + +To illustrate that the proposed metric is a reasonable measure of complexity of a parallel corpus, in Tab. 1 we compute $C ( d )$ for parallel data from different language pairs, the concatenated data set, and the data distilled from the AT model described in $\ S 3 . 1$ . We observe that the conditional entropy of the distilled data is much smaller than that of the concatenated or randomly selected data mentioned above. Additionally, we find that the conditional entropy of En-Es and En-Fr are similar but that of En-De is relatively larger, which can also explain why the student NAT model prefers to predict the modes of Es or Fr more often than De as shown in Fig. 1(d). + +Measure of Faithfulness. $C ( d )$ reflects the level of multi-modality of a parallel corpus, and we have shown that a simpler data set is favorable to an NAT model. However, it is not fair to assess the data set only by its complexity; we can trivially construct a simple data set with no variations in the output, which obviously won’t be useful for training. The other important measurement of the data set is its faithfulness to the real data distribution. To measure the faithfulness of a parallel corpus $d$ , we use KL-divergence of the alignment distribution between the real parallel data set $r$ and an altered parallel data set $d$ , denoted $F ( d )$ : + +$$ +F ( d ) = \frac { 1 } { | \mathcal { V } _ { x } | } \sum _ { x \in \mathcal { V } _ { x } } \sum _ { y \in \mathcal { V } _ { y } } p _ { r } ( y | x ) \log \frac { p _ { r } ( y | x ) } { p _ { d } ( y | x ) } +$$ + +# 4 EMPIRICAL STUDY + +In this section, we perform an extensive study over a variety of non-autoregressive (NAT) models trained from different autoregressive (AT) teacher models to assess how knowledge distillation affects the performance of NAT models. + +# 4.1 EXPERIMENTAL SETTINGS + +Data. We use the data set commonly used by prior work as our evaluation benchmark: WMT14 English-German $( \mathrm { E n - D e } ) ^ { 4 }$ . We use newstest2013 as the validation set for selecting the best model, and newstest2014 as the test set. We learn a byte-pair encoding (BPE, Sennrich et al., 2016) vocabulary of 37,000 on the tokenized data. + +AT Models. We set up four Transformer models with different parameter sizes: Transformertiny/small/base/big denoted as tiny, small, base, big respectively. We build base and big models following settings described in Vaswani et al. (2017), and reduce the model sizes for tiny, small to create weaker teacher models. Details of the model architectures can be found in Appendix A. + +All the models are trained using the Adam optimizer (Kingma & Ba, 2014) with the maximum number of steps set to 300, 000. After training, we use the resulting AT models to decode the whole training set with beam size 5 and replace the real target sentences to create a new parallel corpus. + +NAT Models. We consider the following NAT models, from vanilla to state-of-the-art. All the models are using the Transformer as the basic backbone and are (re-)implemented based on Fairseq5 except for FlowSeq. We briefly outline the methods and parameters here, and describe detailed settings in the Appendix A. + +• Vanilla NAT (Gu et al., 2018): Similarly to $\ S 3 . 1$ , we use a simplified version where the decoder’s inputs are directly copied from the encoder without considering latent variables. +• FlowSeq (Ma et al., 2019): FlowSeq adopts normalizing flows (Kingma & Dhariwal, 2018) as the latent variables to model the mappings from source sentences to a latent space. +• NAT with Iterative Refinement (iNAT, Lee et al., 2018): iNAT extends the vanilla NAT by iteratively reading and refining the translation. The number of iterations is set to 10 for decoding. +• Insertion Transformer (InsT, Stern et al., 2019): InsT adopts a similar architecture as iNAT while generating the sequence by parallel insertion operations. Here, we only consider InsT trained with uniform loss as described in the original paper. +• MaskPredict (MaskT, Ghazvininejad et al., 2019): MaskT adopts a masked language model (Devlin et al., 2018) to progressively generate the sequence from an entirely masked input. The number of iterations is set to be 10. +• Levenshtein Transformer (LevT, Gu et al., 2019): LevT uses similar architectures as in InsT and MaskT while generating based on both insertion and deletion operations. We experiment with a base and big LevT model (LevT and LevT-big in Tab. 2). + +We also summarize the parameter size, performance and relative decoding speed of the NAT models introduced in Tab. 2. We use the decoding time of vanilla NAT to represent one unit of time, and $\mathtt { I t e r s } \times \mathtt { P a s s }$ represents the relative time units used for each model. + +As mentioned earlier, we analyze each model by training from both the real and 4 distilled targets. We train the NAT models for the same number of steps as the AT models. For a fair comparison of the actual ability of each NAT-based model, we test all the models based on greedy decoding without any advanced search algorithms (e.g. length beam (Ghazvininejad et al., 2019), noisy parallel decoding (Ma et al., 2019), or re-ranking from the teacher model (Gu et al., 2018)). Notably, the vanilla NAT and FlowSeq output translations with single forward pass, while the remaining models are based on the iterative refinement. + +# 4.2 ANALYSIS OF THE DISTILLED DATA + +Table 2: AT and NAT models. Number of parameters and test BLEU when trained on the real data demonstrate model capacity. Iters is number of passes used in decoding for output length $n$ and hyperparameter $k$ . Pass is relative time used for one pass of decoding. + +
ModelsParamsBLEUPassIters
AT models
AT-tiny16M23.3n
AT-small37M25.6n
AT-base65M27.1n
AT-big218M28.2n
NAT models
vanilla71M11.411
FlowSeq73M18.6131
iNAT66M19.31k<n
InsT66M20.91~ log2 n
MaskT66M23.5110
LevT66M25.213k<n
LevT-big220M26.5~33k<n
+ +We compare different dimensions of the data generated by the four AT models and the real data set in Fig. 3. First, Fig. 3 (a) shows that as the capacity of the AT model increases, the + +complexity $\dot { C } ( d )$ of the distilled data increases, which indicates that the multi-modality increases as well. At the same time, we observe that $F ( d )$ defined in $\ S 3 . 2$ also decreases, showing that the distilled data more faithfully represents the word-level translation distribution of the original data. + +Source For more than 30 years , Josef Winkler has been writing from the heart , telling of the hardships of his childhood and youth . Distilled Target Seit mehr als 30 Jahren schreibt Josef Winkler aus dem Herzen und erzählt von der Not seiner Kindheit und Jugend . Real Target Josef Winkler schreibt sich seit mehr als 30 Jahren die Nöte seiner Kindheit und Jugend von der Seele . + +![](images/9d2dae1ad08ba3f51683aa3a4a8e8fbbf67cb76c9b3302cdae14915855e67e63.jpg) +Figure 2: A sampled pair together with its real target from the distilled data of the base-AT model. Chunks annotated in the same colors are approximately aligned with each other. +Figure 3: Complexity $C ( d )$ (↑ more complex), faithfulness $F ( d )$ ( $\downarrow$ more faithful), training BLEU, and reordering score $\uparrow$ more monotonic alignment) of different distilled sets of WMT14-ENDE. + +Second, we plot the BLEU score of the distilled data w.r.t to the real data set in (b) and we observe that the BLEU score of the distilled data from a higher-capacity teacher model is higher, which is both intuitive and in agreement with the results on KL divergence. + +We also investigate how the relative ordering of words in the source and target sentences is changed during distillation. We use the fuzzy reordering score proposed in Talbot et al. (2011). A larger fuzzy reordering score indicates the more monotonic alignments. As shown in Fig 3 (c), the distilled data has significantly less reordering compared to the real parallel sentences, and the distilled data from a weaker AT teacher is more monotonic than a stronger AT teacher. We also show a randomly sampled example in Fig. 2 where compared to the real translation, the AT distilled target is much more monotonically aligned to the source sentence. This has potential benefits in that these simpler reordering patterns may be easier to learn for NAT models, but also disadvantages in that it may prevent NAT models from learning complex reordering patterns. + +# 4.3 ANALYSIS OF DISTILLATION STRATEGIES + +In $\ S 4 . 2$ , we have shown that decoding with an AT model reduces the conditional entropy of the parallel data set, which mitigates multi-modality in the output data. But does the decoding method of the AT model affect this change in the data set? We also investigate different decoding strategies when creating distilled data, using the base Transformer model as the teacher and the vanilla NAT model as the student. In Tab. 3, four decoding methods are presented: sampling, sampling within the top-10 candidates, beam search, and greedy decoding. With the same AT model, the performance of the NAT model differs widely depending on the decoding approach, where distillation with beam search results in the best performance. + +We can see that beam search or greedy decoding can reduce the complexity of the real data the most while maintaining high faithfulness. In contrast, sampling based decoding methods less aggressively reduce the modes in the output sequence. This finding is in concert with Ott et al. (2018), who demonstrate that because beam search approximately selects the most probable translation, it effectively reduces diversity in the output translations compared to sampling or the true distribution. + +Table 3: Comparisons of decoding methods on WMT14-ENDE newstest 2014 test set. + +
Decoding MethodC(d)F(d)BLEU
sampling3.6233.3546.6
sampling (Top 10)2.4112.93214.6
greedy1.9602.95918.9
beam search1.9022.94819.5
+ +# 4.4 DISTILLED DATA V.S. NAT MODELS + +We next examine the relationship between the NAT students and distilled training data from different AT models. In Fig. 4, we demonstrate results for the NAT models listed in $\ S 4 . 1$ . We use the test set performance on real data as a simple metric to measure the capacity of the NAT model and arrange the subfigures in an increasing order of the performance (left-to-right, top-to-bottom). The results in the figure demonstrate that, interestingly, weaker NAT students prefer distilled data with smaller complexity as measured above in $\ S 4 . 2$ . The best performance of NAT models – from lower capacity ones to higher capacity ones – is achieved with distilled data of lower complexity to higher complexity, i.e. the vanilla NAT model performs best when using the distilled data from a small Transformer whereas LevT achieves the best performance when training with the distilled data from a big Transformer. Third, and notably, by simply changing the distilled data set upon which the models are trained, we are able to significantly improve the state-of-the-art results for models in a particular class. For example, FlowSeq increased to 22, by simply changing from the distilled data of Transformer(base) to Transformer(small). Finally, we find that by distilling from a big AT model, LevT is able to close the gap with the Transformer (base) with a similar number of parameters. Both LevT and LevT-big achieve the state-of-the-art performance for NAT-based models. + +![](images/8c8bc95789674f33498144f066b57d9e7e1a9e111bba99613a08d8b91a621590.jpg) +Figure 4: The performance of NAT models of varying capacity trained on both the real and the distilled data from tiny, small, base and big AT models on WMT14-ENDE newstest 2014 test sets. + +# 5 IMPROVEMENTS TO KNOWLEDGE DISTILLATION + +The previous section shows that the optimal complexity of the dataset is highly correlated with the capacity of the NAT model. In this section, we introduce three techniques that can be used to alter the distilled data to match the capacity of NAT model. Specifically, these techniques can be used to simplify the data further (BANs, MoE) for a lower-capacity student model or increase faithfulness of the data set (Interpolation) for a higher-capacity student model. + +Born-Again Networks. We apply Born-Again neworks (BANs) to create a simplified dataset for NAT models. BANs were originally proposed as a self-distillation technique (Furlanello et al., 2018) that uses the output distribution of a trained model to train the original model. Starting from the real data, we repeatedly train new AT models with decoded sentences from the AT model at the previous iteration. This process is repeated for $k$ times and yields $k$ distilled data sets, upon which we perform NAT training and examine how the $k$ born-again teachers affect the performance of NAT students. + +We conduct experiments using the vanilla NAT model (Gu et al., 2018) (which achieved the best performance with distilled data from a small Transformer in $\ S 4 . 4 )$ and the base Transformer as the AT model. As shown in Fig. 5, we can make the following observations: (i) The performance of the base AT model almost remains unchanged during the reborn iterations. (ii) The performance of the vanilla NAT model can be improved by 2 BLEU when using the distilled data from reborn iteration 6. (iii) As the reborn iterations continue, the complexity of the distilled data decreases and becomes constant eventually. Meanwhile, the quality of the distilled data compared to the real data decreases. + +![](images/c7ab20bb73c27a4ac97a5717c91102afc55b5a1abcb6a9e767b6f2f3eed361cc.jpg) +Figure 5: Reborn experiments: (from left to right) performance of the base AT model, performance of the vanilla NAT model, $C ( d )$ and $F ( d )$ of distilled data sets. R-i denotes the $i$ -th reborn iteration. + +![](images/03d4b5c7927e24575af28a689c18d019d84c75e0dab3808abe1e78b6906ae218.jpg) +Figure 6: MoE experiments: (from left to right) performance of the base AT model, performance of the vanilla NAT model, $C ( d )$ and $F ( d )$ of distilled data sets w.r.t the number of experts. + +Mixture-of-Experts. The mixture-of-expert model (MoE; Shen et al. (2019)) learns different experts for diverse machine translation, and different mixture components were shown to capture consistent translation styles across examples. Inspired by this, we use one expert from the mixture model to translate the training data, which is supposed to generate a single style of translation and reduce the diversity in the original data set. Then we use the best single-expert translations as the distilled data to train the vanilla NAT model. Specifically, we follow Shen et al. (2019)’s setup, using the base Transformer model and uniform hard mixture model, varying the number of experts. + +In Fig. 6, we observe that the performance of the best expert of MoE tends to decrease as the number of experts increases. However, the complexity $( C ( d ) )$ and faithfulness $( F ( D ) )$ of distilled data from different MoE models has a relatively large variance. Compared to using the distilled data from a plain base AT model, the performance of NAT model is improved by 1.21 BLEU when using the distilled data from the MoE model with the number of experts of 3 which produces the distilled data with the least complexity. + +
dC(d)F(d)BLEU
base1.9022.94826.94
base-inter1.9082.91627.32
+ +Sequence-Level Interpolation. $\ S 4 . 4$ shows stronger NAT models (e.g. MaskT, LevT) have the ability to learn from the dataset that is closer to the real data, and achieve better performance. We adopt the sequence-level interpolation proposed in Kim & Rush (2016) as a natural way to create a better dataset. Different from distillation, interpolation picks the sentence with the highest sentence-level BLEU score w.r.t. the ground truth from $K$ −best beam search hy + +Table 4: Results w/ and w/o sequencelevel interpolation with LevT. + +potheses. In our experiments, we first run beam search using the base Transformer model with a beam size of 5 then select the sentences with the highest BLEU score from the top-3 candidates. + +Tab. 4 compares the performance of LevT trained with distilled data from the AT model with the standard distillation or interpolation. We observe that selection with BLEU score from the base AT model (base-inter) improves the performance of LevT $\sim 0 . 4$ BLEU while the dataset complexity $C ( d )$ does not increase much. + +# 6 CONCLUSION + +In this paper, we first systematically examine why knowledge distillation improves the performance of NAT models. We conducted extensive experiments with autoregressive teacher models of different capacity and a wide range of NAT models. Furthermore, we defined metrics that can quantitatively measure the complexity of a parallel data set. Empirically, we find that a higher-capacity + +NAT model requires a more complex distilled data to achieve better performance. Accordingly, we propose several techniques that can adjust the complexity of a data set to match the capacity of an NAT model for better performance. + +# REFERENCES + +Nader Akoury, Kalpesh Krishna, and Mohit Iyyer. Syntactically supervised transformers for faster neural machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1269–1281, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1122. URL https://www.aclweb.org/ anthology/P19-1122. + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations (ICLR), 2015. + +Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, pp. 65–72, 2005. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018. URL http://arxiv.org/abs/1810.04805. + +Chris Dyer, Victor Chahuneau, and Noah Smith. A simple, fast, and effective reparameterization of IBM Model 2. In NAACL, 2013. + +Tommaso Furlanello, Zachary Lipton, Michael Tschannen, Laurent Itti, and Anima Anandkumar. Born-again neural networks. In International Conference on Machine Learning, pp. 1602–1611, 2018. + +Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1243–1252. JMLR. org, 2017. + +Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. Constant-time machine translation with conditional masked language models. arXiv preprint arXiv:1904.09324, 2019. + +Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li, and Richard Socher. Non-autoregressive neural machine translation. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, Canada, April 30-May 3, 2018, Conference Track Proceedings, 2018. + +Jiatao Gu, Changhan Wang, and Jake Zhao. Levenshtein transformer. In Advances in Neural Information Processing Systems 33. 2019. + +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. + +Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017. + +Hideki Isozaki, Tsutomu Hirao, Kevin Duh, Katsuhito Sudoh, and Hajime Tsukada. Automatic evaluation of translation quality for distant language pairs. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pp. 944–952. Association for Computational Linguistics, 2010. + +Melvin Johnson, Mike Schuster, Quoc V. Le, Maxim Krikun, Yonghui Wu, Zhifeng Chen, Nikhil Thorat, Fernanda Viegas, Martin Wattenberg, Greg Corrado, Macduff Hughes, and Jeffrey Dean. ´ Google’s multilingual neural machine translation system: Enabling zero-shot translation. Transactions of the Association for Computational Linguistics, 5:339–351, 2017. + +Lukasz Kaiser, Samy Bengio, Aurko Roy, Ashish Vaswani, Niki Parmar, Jakob Uszkoreit, and Noam Shazeer. Fast decoding in sequence models using discrete latent variables. In International Conference on Machine Learning, pp. 2395–2404, 2018. + +Yoon Kim and Alexander M Rush. Sequence-level knowledge distillation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1317–1327, 2016. + +Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems, pp. 10215–10224, 2018. + +Jason Lee, Elman Mansimov, and Kyunghyun Cho. Deterministic non-autoregressive neural sequence modeling by iterative refinement. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1173–1182, 2018. + +Percy Liang, Hal Daume III, and Dan Klein. Structure compilation: trading structure for features. ´ In ICML, pp. 592–599, 2008. + +Xuezhe Ma, Pengcheng Yin, Jingzhou Liu, Graham Neubig, and Eduard Hovy. Softmax qdistribution estimation for structured prediction: A theoretical interpretation for raml. arXiv preprint arXiv:1705.07136, 2017. + +Xuezhe Ma, Chunting Zhou, Xian Li, Graham Neubig, and Eduard Hovy. Flowseq: Nonautoregressive conditional sequence generation with generative flow. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing, Hong Kong, November 2019. + +Aaron Oord, Yazhe Li, Igor Babuschkin, Karen Simonyan, Oriol Vinyals, Koray Kavukcuoglu, George Driessche, Edward Lockhart, Luis Cobo, Florian Stimberg, et al. Parallel wavenet: Fast high-fidelity speech synthesis. In International Conference on Machine Learning, pp. 3915–3923, 2018. + +Myle Ott, Michael Auli, David Grangier, and Marc’Aurelio Ranzato. Analyzing uncertainty in neural machine translation. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018 ¨ , pp. 3953–3962, 2018. URL http://proceedings.mlr.press/v80/ott18a.html. + +Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan $\mathrm { N g }$ , David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL-HLT 2019: Demonstrations, 2019. + +Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In 2016 IEEE Symposium on Security and Privacy (SP), pp. 582–597. IEEE, 2016. + +Maja Popovic. chrf: character n-gram f-score for automatic mt evaluation. In ´ Proceedings of the Tenth Workshop on Statistical Machine Translation, pp. 392–395, 2015. + +Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1715–1725, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1162. URL https://www.aclweb. org/anthology/P16-1162. + +Chenze Shao, Yang Feng, Jinchao Zhang, Fandong Meng, Xilin Chen, and Jie Zhou. Retrieving sequential information for non-autoregressive neural machine translation. arXiv preprint arXiv:1906.09444, 2019. + +Tianxiao Shen, Myle Ott, Michael Auli, et al. Mixture models for diverse machine translation: Tricks of the trade. In International Conference on Machine Learning, pp. 5719–5728, 2019. + +Raphael Shu, Jason Lee, Hideki Nakayama, and Kyunghyun Cho. Latent-variable nonautoregressive neural machine translation with deterministic inference using a delta posterior. arXiv preprint arXiv:1908.07181, 2019. + +Matthew Snover, Bonnie Dorr, Richard Schwartz, Linnea Micciulla, and John Makhoul. A study of translation edit rate with targeted human annotation. In In Proceedings of Association for Machine Translation in the Americas, pp. 223–231, 2006. + +Milos Stanojevic and Khalil Simaan. Beer: Better evaluation as ranking. In Proceedings of the Ninth Workshop on Statistical Machine Translation, pp. 414–419, 2014. + +Mitchell Stern, Noam Shazeer, and Jakob Uszkoreit. Blockwise parallel decoding for deep autoregressive models. In Advances in Neural Information Processing Systems, pp. 10107–10116, 2018. + +Mitchell Stern, William Chan, Jamie Kiros, and Jakob Uszkoreit. Insertion transformer: Flexible sequence generation via insertion operations. arXiv preprint arXiv:1902.03249, 2019. + +David Talbot, Hideto Kazawa, Hiroshi Ichikawa, Jason Katz-Brown, Masakazu Seno, and Franz J Och. A lightweight evaluation framework for machine translation reordering. In Proceedings of the Sixth Workshop on Statistical Machine Translation, pp. 12–21. Association for Computational Linguistics, 2011. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017. + +Chunqi Wang, Ji Zhang, and Haiqing Chen. Semi-autoregressive neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 479–488, 2018. + +Yiren Wang, Fei Tian, Di He, Tao Qin, ChengXiang Zhai, and Tie-Yan Liu. Non-autoregressive machine translation with auxiliary regularization. arXiv preprint arXiv:1902.10245, 2019. + +Bingzhen Wei, Mingxuan Wang, Hao Zhou, Junyang Lin, and Xu Sun. Imitation learning for nonautoregressive neural machine translation. arXiv preprint arXiv:1906.02041, 2019. + +# A EXPERIMENTAL DETAILS + +# A.1 AT MODELS + +Model All the AT models are implemented based on the Transformer model using fairseq (Ott et al., 2019), and we basically follow the fairseq examples to train the transformers6. Following the notation from Vaswani et al. (2017), we list the basic parameters of all the AT model we used: + +Table 5: Basic hyper-parameters of architecture for AT models. + +
Modelstinysmallbasebig
dmodel2565125121024
dhidden1024102420484096
nlayers3366
nheads48816
Pdropout0.10.10.30.3
+ +Training For all experiments, we adopt the Adam optimizer (Kingma & Ba, 2014) using $\beta _ { 1 } =$ $0 . 9 , \beta _ { 2 } = 0 . 9 8$ , $\epsilon = 1 e - 8$ . The learning rate is scheduled using inverse sqrt with a maximum learning rate 0.0005 and 4000 warmup steps. We set the label smoothing as 0.1. All the models are run on 8 GPUs for 300, 000 updates with an effective batch size of 32, 000 tokens. The best model is selected based on the validation loss except for FlowSeq which uses valid BLEU score. + +Decoding After training, we use beam-search with a fixed beam size 5 for all AT models to create the distilled dataset. We use length normalization without length penalty. + +# A.2 NAT MODELS + +Model Tab. 2 also lists all the NAT models we test in this work. In general, all the NAT models except FlowSeq and LevT-big adopts a similar architecture and hyper-parameters as the Transformerbase (see Tab. 5). LevT-big is a naive extension of the original LevT model with a comparable parameter setting as Transformer-big (Tab. 5). For FlowSeq, we use the base model (FlowSeq-base) described in (Ma et al., 2019). We re-implemented the vanilla NAT as a simplified version of Gu et al. (2018) where instead of modeling fertility as described in the original paper, we monotonically copy the encoder embeddings to the input of the decoder. All the models except InsT require the additional module to predict the length of the output sequence, or the number of placeholders to be inserted, which is implemented as a standard softmax classifier over the lengths of [0, 256). For LevT, we also have a binary classifier to predict the deletion of the incorrect tokens. + +Training Similar to the AT models, all the NAT models are trained using the Adam optimizer with the same learning rate scheduler, in which the warmup steps are set to 10, 000. We train the FlowSeq model on 32 GPUs with a batch size as 2048 sentences, while all the other models are trained on 8 GPUs with an effective batch size of 64, 000 tokens. Note that, the batch sizes for training NAT is typically larger than the AT model, which improves final results. There are also specialized training settings for each models: + +• iNAT (Lee et al., 2018): following the original paper, we train the iNAT model jointly with 4 iterations of refinement during training. For each iteration, the model has the $5 0 \%$ probability to learn as a denoising autoencoder, and the rest of the probability to learn from the model’s own prediction. +• InsT (Stern et al., 2019): in this work, we only consider training the Insertion Transformer (InsT) using the slot-loss based on the uniform loss function (Stern et al., 2019). That is, we assign equal probabilities to all the insertable tokens inside each slot. +• MaskT (Ghazvininejad et al., 2019): following the original paper, we train the model as a typical masked language model where the ratio of masked tokens is sampled from $0 \sim 1 0 0 \%$ . + +• LevT (Gu et al., 2019): in this work, we only consider sequence generation tasks, which means the training of LevT is very similar to InsT. We use sentences with randomly deleted tokens to learn insertion, and learn deletion based on the model’s own prediction. + +Decoding For a fair comparison over all the NAT models, we use greedy decoding for all the models without considering any advanced decoding methods such as searching or re-ranking from a teacher model. For the vanilla NAT and FlowSeq, decoding is quite straight-forward and simply picks the arg max at every position. For iNAT and MaskT, we fix the decoding steps to 10. Both InsT and LevT decode in an adaptive number of iterations, and we set the maximum iterations for both models to be 10. A special EOS penalty that penalizes generating too short sequences is tuned based on the validation set for both InsT and LevT. + +For all models, final results are calculated using tokenized BLEU score. + +# B REAL DATA STATISTICS + +The detailed dataset split for WMT14 En-De is shown in Tab. 6. In Fig. 7, we also plot the histogram of the conditional entropy of each pair of sentences $\scriptstyle { \mathcal { H } } ( y | x )$ in the real parallel data and different distilled data sets from the big-AT, base-AT, small-AT and tiny-AT respectively. It shows that the distribution of the sentence-level conditional entropy differs widely. The mode of $\scriptstyle { \mathcal { H } } ( y | x )$ in the real data is the highest and follows by distilled data from the big-AT, base-AT, small-AT and tiny-AT. This observation aligns with the complexity value $C ( d )$ proposed in $\ S 3 . 2$ . + +Table 6: Dataset statistics for WMT14 En-De. + +
DatasetTrainValidTestVocabulary
WMT'14 En-De4,500,9663000300337,009
+ +![](images/4d3419abecf8394d78b6372a60c65aa9278b66cf583d10b8e357ecdc3d8b1693.jpg) +Figure 7: Density of conditional entropy $C ( d )$ of each sentence pairs in different distilled data sets and the real data. + +# C ADDITIONAL METRICS + +In Figure 8, we also showed results with different metrics together with BLEU scores considering that BLEU scores sometimes cannot fully capture the changes in the system. We considered 5 additional metrics in our experiments: METEOR (Banerjee & Lavie, 2005), RIBES (Isozaki et al., 2010), ChrF (Popovic, 2015) TER (Snover et al., 2006), and BEER (Stanojevic & Simaan, 2014). ´ Not surprisingly, we find that all the metrics are correlated with the original BLEU scores quite well showing a similar trend as discussed earlier. + +![](images/59acb8be944f9e6e1e36b5c6446334fbf6fe467a12c68af3b40f6b72d132ecf5.jpg) +Figure 8: The performance of variant measure (BLEU $\uparrow$ , METEOR $\uparrow$ , RIBES $\uparrow$ , ChrF $\uparrow$ , TER $\downarrow$ BEER $\uparrow$ ) for the vanilla NAT model trained on the distilled data from tiny, small, base and big AT models on WMT14-ENDE newstest 2014 test sets. + +# D SYNTHETIC DATA WITH ACCESS TO THE TRUE DISTRIBUTION + +D.1 BACKGROUND: BAYESIAN DECISION THEORY + +Bayesian decision theory is a fundamental statistical approach to the problem of pattern classification, which provides a principled rule of finding the optimal classification decision using probability and losses that accompany such decisions. + +In the problem of structured prediction (Ma et al., 2017), let $_ { \textbf { \em x } }$ denote the input sequence and $\textbf { { y } }$ denote the output label sequence. Let $\mathcal { H }$ denote all the possible hypothesis functions from the input to the output space: $\mathcal { H } = \{ h : \mathcal { X } \mathcal { Y } \}$ . Let $r ( \pmb { y } | \pmb { x } )$ denote the conditional risk on the input $_ { \textbf { \em x } }$ , which is the expected loss of predicting $\textbf { { y } }$ based on the posterior probabilities: + +$$ +r ( { \pmb y } | { \pmb x } ) = \mathbb { E } _ { P ( { \pmb y } ^ { \prime } | { \pmb x } ) } [ L ( { \pmb y } , { \pmb y } ^ { \prime } ) ] , +$$ + +, where $L ( \boldsymbol { y } , \boldsymbol { y } ^ { \prime } )$ is the loss function that penalizes predicting the true target $\boldsymbol { y } ^ { \prime }$ as $\textbf { { y } }$ . The classification task aims to find a hypothesis function $h$ that minimizes the overall risk $R$ given by + +$$ +R ( h ) = \mathbb { E } _ { P ( \pmb { x } ) } [ r ( h ( \pmb { x } ) | \pmb { x } ) ] +$$ + +This is known as the Bayes risk. To minimize the overall risk, obviously we need to minimize the conditional risk for each input $_ { \textbf { \em x } }$ . The Bayesian decision rule states that the global minimum of $R ( h )$ is achieved when the classifier make predictions that minimize each conditional risk given $_ { \textbf { \em x } }$ and this gives the Bayes optimal classifier: + +$$ +h ^ { * } ( { \pmb x } ) = \arg \operatorname* { m i n } _ { { \pmb y } \in { \pmb y } } r ( { \pmb y } | { \pmb x } ) +$$ + +Let us consider two loss functions defined in Eq. 5. First is the sequence-level loss $L _ { s e q } ( { \pmb y } , { \pmb y } ^ { \prime } ) =$ $1 - \mathbb { I } ( { \pmb y } = { \pmb y } ^ { \prime } )$ , then in this case the Bayes classifier is: + +$$ +h _ { s e q } ^ { * } ( { \pmb x } ) = \arg \operatorname* { m a x } _ { { \pmb y } \in \mathcal { V } } P ( { \pmb y } | { \pmb x } ) +$$ + +, which is the most probable output label sequence given the input sequence $_ { \textbf { \em x } }$ + +Second let us consider the token-level loss $\begin{array} { r } { L _ { t o k } ( \pmb { y } , \pmb { y } ^ { \prime } ) = \sum _ { t = 1 } ^ { T } 1 - \mathbb { I } ( y _ { t } = y _ { t } ^ { \prime } ) } \end{array}$ , i.e the sum of zero-one loss at each time step. We have: + +$$ +\begin{array} { r l } { h _ { t o k } ^ { * } ( \pmb { x } ) } & { = \underset { y \in \pmb { \mathscr { Y } } } { \mathrm { a r g ~ m i n ~ } } \mathbb { E } _ { P ( \pmb { y ^ { \prime } } | \pmb { x } ) } [ L _ { 2 } ( \pmb { y } , \pmb { y ^ { \prime } } ) ] } \\ & { = \underset { y \in \pmb { \mathscr { Y } } } { \mathrm { a r g ~ m a x ~ } } \mathbb { E } _ { P ( \pmb { y ^ { \prime } } | \pmb { x } ) } [ \sum _ { t = 1 } ^ { T } \mathbb { I } ( y _ { t } = y _ { t } ^ { \prime } ) ] } \\ & { = \underset { y \in \pmb { \mathscr { Y } } } { \mathrm { a r g ~ m a x } } \sum _ { t = 1 } ^ { T } \mathbb { E } _ { P ( \pmb { y ^ { \prime } } | \pmb { x } ) } [ \mathbb { I } ( y _ { t } = y _ { t } ^ { \prime } ) ] } \\ & { = \underset { y \in \pmb { \mathscr { Y } } } { \mathrm { a r g ~ m a x } } \sum _ { t = 1 } ^ { T } \mathbb { E } _ { P ( y _ { t } ^ { \prime } | \pmb { x } ) } [ \mathbb { I } ( y _ { t } = y _ { t } ^ { \prime } ) ] } \\ & { = \underset { y \in \pmb { \mathscr { Y } } } { \mathrm { a r g ~ m a x } } \underset { t = 1 } { \overset { T } { \prod } } P ( y _ { t } | \pmb { x } ) } \end{array} +$$ + +This suggests that the Bayes classifier finds the most probable label at each time step given the input sequence. + +# D.2 EXPERIMENTAL SETUPS AND ANALYSIS + +To study how training data affects the performance of a weaker classifier, we construct a Hidden Markov Model (HMM) by sampling the parameters of the transition and emission probabilities uniformly within $( 0 , a ]$ and $( 0 , b ]$ respectively. A higher value of $a$ and $b$ indicates an HMM model with higher uncertainty. We refer this HMM as the “true HMM” as our real data generator. Next we consider a weaker classifier that uses a low-dimension bidirectional-LSTM (Bi-LSTM) to encode the input sequence and individual softmax functions at each time step to predict labels independently, which is referred as the “Bi-LSTM” classifier. Obviously, the Bi-LSTM classifier is not able to model the dependencies between output labels embedded in the HMM, and it is equivalent to a simplified non-autoregressive generation model. + +We generate the real training data $D _ { r e a l } = \{ ( { \pmb x } _ { 1 } , { \pmb y } _ { 1 } ) , \cdot \cdot \cdot , ( { \pmb x } _ { N } , { \pmb y } _ { N } ) \}$ of size $N$ by sampling from the joint probability of the true HMM. Similarly we sample $N _ { t e s t }$ data points as the test data and $N _ { v a l i d }$ data points as the validation data. We evaluate the classifier’s token-level accuracy tacc and sequand n the test data respectively, where . These two metrics correspond $\begin{array} { r } { t a c c = \frac { \sum _ { i = 1 } ^ { N _ { t e s t } } \sum _ { t = 1 } ^ { T } \mathbb { I } ( h ( \pmb { x } _ { i } ) ^ { t } = \pmb { y } _ { i } ^ { t } ) } { T \times N _ { t e s t } } } \end{array}$ $\begin{array} { r } { s a c c \ = \ \frac { \sum _ { i = 1 } ^ { N _ { t e s t } } { \mathbb { I } \left( { h ( { \bf { x } } _ { i } ) = y _ { i } } \right) } } { N _ { t e s t } } } \end{array}$ $L _ { t o k }$ sequence-level loss $L _ { s e q }$ on each data point of the test data. + +First, we use $h _ { s e q } ^ { * } ( { \pmb x } )$ to generate the distillation labels $\boldsymbol { y } ^ { \prime }$ from the true HMM, which corresponds to applying the Viterbi decoding to each $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ in $D _ { r e a l }$ . The training data set $D _ { s e q }$ is created with $( { \pmb x } _ { i }$ , $\pmb { y } _ { i } ^ { \prime } )$ . Next, we use $h _ { t o k } ^ { * } ( x )$ to generate the distillation labels $\hat { y }$ and create the training data $D _ { t o k }$ of $( \dot { \pmb x } _ { i } , \hat { \pmb y } _ { i } )$ . To generate $\hat { y }$ , we apply the forward-backward algorithm to each $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ in $D _ { r e a l }$ and obtain $P ( y _ { i } ^ { t } | \mathbf { x } _ { i } )$ . We take arg max over the label space $\mathcal { L }$ : $\hat { y } _ { i } ^ { t } = \underset { y _ { i } ^ { t } \in \mathcal { L } } { \operatorname { a r g m a x } } P ( y _ { i } ^ { t } | \mathbf { x } _ { i } )$ . + +We use these three training data $( D _ { r e a l } , D _ { t o k } , D _ { s e q } )$ to train the Bi-LSTM classifier respectively. We repeat the experiment for 50 times by constructing 50 HMM models with different random seeds as the data generator. We find that when evaluating with the token-level accuracy tacc, models trained with $D _ { t o k }$ yields the best performance (Bi-LSTM trained with $D _ { t o k }$ win $9 7 . 6 \%$ runs); when evaluating with the sequence-level accuracy sacc, models trained with $D _ { s e q }$ yields the best performance (Bi-LSTM trained with $D _ { s e q }$ win $9 8 . 5 \%$ runs). This is because the Bi-LSTM classifier has difficulty modeling the true data distribution defined by an HMM. On the other hand, it is easier for the Bi-LSTM classifier to model the distributions of $D _ { s e q }$ and $D _ { t o k }$ . Data sets $D _ { s e q }$ and $D _ { t o k }$ define deterministic conditional distributions over the input data, which are much simpler than the real data distribution. By definition, $D _ { t o k }$ is created by the optimal Bayes classifier $\bar { h } _ { t o k } ^ { * } ( { \pmb x } )$ , this means that the Bi-LSTM classifier trained with $D _ { t o k }$ can better capture the distribution of $P ( y _ { t } | \mathbf { x } ) = \operatorname* { m a x } _ { u _ { t } } P ( u _ { t } | \mathbf { x } )$ , which can generalize better to the test data when evaluated with the token-level accuracy. Similarly, Bi-LSTM trained with $D _ { s e q }$ performs better on the test data with the sequence-level metric. + +This corroborates our observation in machine translation task that NAT has difficulty in modeling the real conditional distribution of true sentence pairs. However, when using the distilled data translated from a pretrained autoregressive model with beam-search decoding, it performs better on the test set when evaluated with the BLEU score metric. \ No newline at end of file diff --git a/md/train/BygZK2VYvB/BygZK2VYvB.md b/md/train/BygZK2VYvB/BygZK2VYvB.md new file mode 100644 index 0000000000000000000000000000000000000000..c5476c2faed55cfcaf88ac870b7a2c35ea8c727c --- /dev/null +++ b/md/train/BygZK2VYvB/BygZK2VYvB.md @@ -0,0 +1,316 @@ +# Utilizing Edge Features in Graph Neural Networks via Variational Information Maximization + +Anonymous authors Paper under double-blind review + +# Abstract + +Graph Neural Networks (GNNs) broadly follow the scheme that the representation vector of each node is updated recursively using the message from neighbor nodes, where the message of a neighbor is usually pre-processed with a parameterized transform matrix. To make better use of edge features, we propose the Edge Information maximized Graph Neural Network (EIGNN) that maximizes the Mutual Information (MI) between edge features and message passing channels. The MI is reformulated as a differentiable objective via a variational approach. We theoretically show that the newly introduced objective enables the model to preserve edge information, and empirically corroborate the enhanced performance of MI-maximized models across a broad range of learning tasks including regression on molecular graphs and relation prediction in knowledge graphs. + +# 1 Introduction + +Many real-world datasets naturally come in the form of graphs, such as citation networks (Kipf & Welling, 2017), social networks Hamilton et al. (2017), knowledge graphs (Schlichtkrull et al., 2018), molecular graphs (Scarselli et al., 2009; Duvenaud et al., 2015) etc., all of which consist of a number of nodes and edges equipped with their inherent features. Recently, impressive performance has been achieved in graph learning tasks with various forms of Graph Neural Networks (GNNs) (Zhou et al., 2018). Compared to prior works, such as node2vec (Grover & Leskovec, 2016), GNNs learn the state of a node by recursively aggregating messages from its neighbors: combining the graph structure with node features. Intuitively, edge features should play an important role in graph learning tasks. For example, chemical bonds in a molecule have a high impact on chemical properties of molecules, and edge features in knowledge graphs encode important relations between concepts, data, and entities. Our proposed method focuses on improving the usage of edge features in GNNs. + +The expressive power of GNNs largely depends on how the message is passed between nodes. A widely adopted scheme is multiplying neighbor node states with a parameterized transform matrix before aggregation (Gilmer et al., 2017; Xu et al., 2019). Despite tremendous success of GNNs, existing models do not exhaustively exploit the full potentials of edge features on graphs. For example, many GNNs such as GCN (Kipf & Welling, 2017), ChebyNet (Defferrard et al., 2016) and GAT (Veličković et al., 2018) do not even consider categorized edge types. To utilize edge features in multi-relational graphs, RGCN (Schlichtkrull et al., 2018) proposes to learn a different transform matrix for each edge type, respectively. However, it does not generalize to edge features in continuous space. MPNN (Gilmer et al., 2017) introduces an edge network that takes edge feature vectors as input and outputs transform matrices, which are used to transform states of neighbor nodes. In principle, the MPNN framework can handle complex edge features. Yet, the lack of maximization of MI between edge and message channels implies that the MPNN may give an edge-independent transform matrix. + +In this work, we aim to more efficiently exploit the full potentials of edge features from the perspective of training. We propose the Edge Information maximized Graph Neural Network (EIGNN) that maximizes the Mutual Information (MI) between edge features and the message passing channel which is parameterized as the transform matrix in the widely-accepted message passing framework (transformation and aggregation) (Gilmer et al., 2017; Xu et al., 2019). Considering the challenge of computing the MI, we adopt a variational approach to reformulate it as an differentiable objective, which can be easily applied as a regularization term. We theoretically show that EIGNN can reduce information loss of edge features. Apart from demonstrating the impressive performance of EIGNN on extensive benchmarks of molecular graphs and knowledge graphs, we also analyze and attribute the enhanced effectiveness of EIGNN to the exploitation of edge features instead of the regularization effects. Notably, attribution analysis on molecular graphs show that EIGNN can capture domain knowledge without human interference. + +Preliminaries Let $G = ( \nu , \mathcal { E } )$ be a graph with node feature vectors $x _ { v } \in \mathbb { R } ^ { d }$ for node $v \in \nu$ and edge feature vectors $e _ { v w } \in \mathcal { E }$ for the edge connecting node $v$ and $w$ . In GNNs, the state of each node is updated recursively using neighbor nodes. Let $\mathcal { N } _ { v }$ be the set of neighbor nodes of $v$ and $h _ { v } ^ { ( l ) } \in \mathbb { R } ^ { d _ { l } }$ be the hidden state of $v$ at $\it l$ -th layer, where $d _ { l }$ is the dimension of the hidden layer. For simplicity of notation, we use a single $d$ to denote the dimension such that $h _ { v } ^ { ( l ) } \in \mathbb { R } ^ { d }$ . We also have $h _ { v } ^ { ( 0 ) } = x _ { v }$ at the input layer. + +# 2 Related works + +# 2.1 Relational Modeling in Graph Neural Networks + +Single-relational modeling. Many variants such as GCN (Kipf & Welling, 2017), GAT (Veličković et al., 2018), ChebyNet (Defferrard et al., 2016), GraphSAGE (Hamilton et al., 2017) focus on learning node states. These models can assign weight to neighbors, but they can not handle various edge features. A typical neighborhood aggregation scheme is + +$$ +h _ { v } ^ { ( l + 1 ) } = \sigma \left( \sum _ { w \in \mathcal { N } _ { v } } \alpha _ { v w } W _ { 1 } ^ { ( l ) } h _ { w } ^ { ( l ) } + W _ { 0 } ^ { ( l ) } h _ { v } ^ { ( l ) } \right) , +$$ + +where $\sigma$ denotes an activation function, $\alpha _ { v w }$ can be a normalization constant or a learned attention coefficient (Veličković et al., 2018). States of all neighbors are multiplied by the same trainable transform matrix $W _ { 1 } ^ { ( l ) }$ . Sometimes the self-connection is also treated in the same way, s.t., W (l)0 = W (l)1 . + +Multi-relational modeling. A simple strategy to handle multi-relational graphs is assigning each edge type with a separate transform matrix as presented in RGCN (Schlichtkrull et al., 2018) and adopted by GGNN (Li et al., 2016) and LNet (Liao et al., 2019). RGCN updates node states according to the following scheme + +$$ +\begin{array} { r } { h _ { v } ^ { ( l + 1 ) } = \sigma \left( \sum _ { r \in \mathcal { R } } \sum _ { w \in \mathcal { N } _ { v } ^ { r } } \alpha _ { v w , r } W _ { r } ^ { ( l ) } h _ { w } ^ { ( l ) } + W _ { 0 } ^ { ( l ) } h _ { v } ^ { ( l ) } \right) , } \end{array} +$$ + +where $\mathcal { N } _ { v } ^ { r }$ is the collection of neighboring nodes of $\boldsymbol { v }$ with relation $r \in \mathcal { R }$ and $\alpha _ { v w , r }$ is a normalization constant similar as $\alpha _ { v w }$ in Eq. (1). Such a scheme faces challenge in handling edge features of continuous space. GGNN and LNet do not focus on the improvement of edge expressibility. GGNN introduces Gated Recurrent Unit (GRU) (Cho et al., 2014) and LNet focus on handling multi-scale connections. + +Complex-relational modeling. The relation in a graph can be quite complex, expressed as a general feature vector $e$ . MPNN (Gilmer et al., 2017) introduces an edge network which takes edge feature vectors as input and outputs transform matrices. A single edge network is shared in a MPNN model. The forward propagation is formalized as + +$$ +m _ { v } ^ { ( l + 1 ) } = \sigma \left( \sum _ { w \in \mathcal { N } _ { v } } f ( e _ { v w } ) h _ { w } ^ { ( l ) } + W _ { 0 } ^ { ( l ) } h _ { v } ^ { ( l ) } \right) , \quad h _ { v } ^ { ( l + 1 ) } = \mathrm { G R U } ( h _ { v } ^ { ( l ) } , m _ { v } ^ { ( l + 1 ) } ) , +$$ + +where $f : e W$ denotes the edge network. Recently, some research works treat a multirelational problem as the complex-relational one by introducing a continuous edge embedding vector for each edge type, so as to handle increasing number of relations (Nathani et al., 2019). Although the MPNN architecture allows the usage of arbitrary edge features, this advantage is not utilized in practice. MPNN can actually learn an edge-independent transform matrix. A GNN model that efficiently utilizes edge features is yet to emerge. + +# 2.2 Readout functions + +After several forward propagations, GNNs yield final states of all nodes, which are suitable for node/edge classification or regression. For graph classification or regression tasks, we can apply a readout function (Ying et al., 2018; Vinyals et al., 2015) such that + +$$ +y = R ( \{ h _ { v } ^ { L } | v \in G \} ) , +$$ + +where $h _ { v } ^ { L }$ is the state of $v$ at the last layer, $R$ is the readout function that outputs a graph-level representation $y$ , e.g., summing up the final node states, applying hierarchical pooling (Ying et al., 2018) or using the set2set model (Vinyals et al., 2015). + +# 3 Our method + +# 3.1 The Usage of Mutual Information + +In probability theory and information theory, MI is a measure of mutual dependence between two random variables. Our method proposes to preserve edge information in GNNs, which is important in many real-world graph structures such as molecules - apart from node (atom) features, attributes of edges (bonds) are equally important for predicting properties of molecules. To this end, we maximize $I ( e ; W )$ - the MI between the edge feature vector $e$ and the message passing channel, i.e., the transform matrix $W$ which is used to transform neighbor node states in the forward propagation. Our method can be easily generalized to directly maximize the MI between edge features and the message itself in methods that do not explicitly have the transform matrix, e.g., the message from node $w$ to node $v$ can be expressed as $f ( h _ { v } , e _ { v w } , h _ { w } )$ rather than $f ( e _ { v w } ) h _ { w }$ , which is shown in Section 4.3. + +An general principle of maximum MI is described for unsupervised learning task by (Linsker, 1988) and MI inspired objective functions have long been adopted in unsupervised learning (Bridle et al., 1992; Barber & Agakov, 2006; Veličković et al., 2019; Hjelm et al., 2019), semi-supervised learning (Krause et al., 2010) and generative adversarial networks (Chen et al., 2016). Specifically, DGI (Veličković et al., 2019) also applies MI to GNNs. DGI proposes to learn node-wise representations in an unsupervised manner by maximizing the MI between node representations and corresponding high-level summaries of graphs, using adversarial learning and negative sampling. The node representations may then be retrieved and used for downstream tasks, such as node classification. DGI can be used to pre-train GNNs, as demonstrated in Hu et al. (2019). Our EIGNN also proposes information maximization but targets a completely different objective and adopts a quite different approach. + +# 3.2 A Variational Approach to Maximize Mutual Information + +Computing $I ( e ; W )$ itself is intractable in practice, needless to say that training a model requires the derivative. Thus, we adopt a variational approach (Agakov, 2004) to reformulate $I ( e ; W )$ as a differentiable objective. We show that our objective is an approximated lower bound of $I ( e ; W )$ and notably, optimizing our objective does lead to maximizing $I ( e ; W )$ . Following MPNN (Gilmer et al., 2017), we use an edge network to parameterize the transform matrix $W$ and relate it to edge features. Therefore, the prior $p ( W | e )$ is + +$$ +p ( W | e ) = \delta ( W - f ( e ) ) , +$$ + +where $\delta ( \cdot )$ is the Dirac delta function. The posterior $p ( e | W )$ is intractable, so we define a variational distribution $q ( e | W )$ , which can be obtained by defining a neural network $g : W \to e$ Specifically, $q ( e | W )$ substitutes to some distribution (such as Gaussian distribution) with parameter $g ( W )$ . In this way, $f$ and $g$ are similar to the probabilistic encoder and decoder in the Variational Auto-Encoder (VAE) (Kingma $\&$ Welling, 2013). Then we can approximate $I ( e ; W )$ with a differentiable objective $L _ { I } ( f , g ; e )$ as follows. + +Theorem 1. Let e be the edge feature vector, $W$ be the transform matrix with conditional distribution $p ( W | e )$ specified by the probabilistic encoder $f$ as shown in Eq. (5) and $q ( e | W )$ be the variational distribution specified by the probabilistic decoder $g$ , then we have + +$$ +I ( e ; W ) \geq H ( e ) + \mathbb { E } _ { e \sim p ( e ) } [ \mathcal { L } _ { I } ( f , g ; e ) ] , +$$ + +where $\mathcal { L } _ { I } ( f , g ; e ) = \log q ( e | f ( e ) )$ and $H ( \cdot )$ denotes the entropy. + +Proof. Let $D _ { K L } ( \cdot \parallel \cdot )$ denote the KL-divergence, which should be nonnegative, then we have + +$$ +\begin{array} { r l } { I ( e ; W ) = H ( e ) - H ( e | W ) } & { } \\ { \ } & { = H ( e ) + \mathbb { E } _ { W \sim p ( W ) } [ \mathbb { E } _ { e \sim p ( e | W ) } [ \log p ( e | W ) ] ] } \\ { \ } & { = H ( e ) + \mathbb { E } _ { W \sim p ( W ) } [ \mathbb { E } _ { e \sim p ( e | W ) } [ \log p ( e | W ) - \log q ( e | W ) + \log q ( e | W ) ] ] } \\ { \ } & { = H ( e ) + \mathbb { E } _ { W \sim p ( W ) } [ D _ { K L } ( p ( e | W ) \| q ( e | W ) ) + \mathbb { E } _ { e \sim p ( e | W ) } [ \log q ( e | W ) ] ] } \\ { \ } & { \geq H ( e ) + \mathbb { E } _ { W \sim p ( W ) } [ \mathbb { E } _ { e \sim p ( e | W ) } [ \log q ( e | W ) ] ] } \\ { \ } & { = H ( e ) + \mathbb { E } _ { e \sim p ( e ) , W \sim p ( W | e ) } [ \log q ( e | W ) ] } \\ { \ } & { \stackrel { ( a ) } { = } H ( e ) + \mathbb { E } _ { e \sim p ( e ) } [ \log q ( e | f ( e ) ) ] } \end{array} +$$ + +where the equality ( $a$ ) follows from Eq. (5). + +According to Theorem 1, we can maximize the variational lower bound for $I ( e ; W )$ . The bound becomes tight when the variational distribution $q ( e | W )$ approaches the true posterior $p ( e | W )$ . Moreover, $H ( e )$ is a constant because the distribution of edge feature vector $e$ is fixed for given graphs, hence we can equivalently maximize $\mathcal { L } _ { I } ( f , g ; e )$ . We choose the widely accepted Gaussian distribution as the prior distribution for the probabilistic decoder $g$ , + +$$ +q ( e | W ) = \mathcal { N } ( e ; g ( W ) , \sigma ^ { 2 } I ) . +$$ + +Then we have + +$$ +\mathcal { L } _ { I } ( f , g ; e ) = \log q ( e | f ( e ) ) = \log \mathcal { N } ( e ; g ( f ( e ) ) , \sigma ^ { 2 } I ) = - \lambda \| e - g ( f ( e ) ) \| _ { 2 } ^ { 2 } +$$ + +where $\lambda > 0$ is a constant determined by $\sigma$ and the dimension of $e$ , taken as a tunable parameter. The following Theorem 2 shows that maximizing the objective in Eq. (8) does lead to the maximization of $I ( e ; W )$ , hence enables the model to preserve edge information. + +Theorem 2. Assume the optimal solution of maximizing $\mathcal { L } _ { I } ( f , g ; e )$ is $f ^ { \star }$ and $g ^ { \star }$ , then $f ^ { \star }$ also maximizes $I ( e ; W )$ . + +Proof. Note that $H ( e )$ is a constant when the graphs are given. In information theory, we have + +$$ +H ( g ( f ( e ) ) ) \leq H ( f ( e ) ) \leq H ( e ) . +$$ + +$I ( e ; W )$ is upper bounded by $H ( e )$ , + +$$ +I ( e ; W ) = I ( e ; f ( e ) ) = H ( f ( e ) ) - H ( f ( e ) | e ) = H ( f ( e ) ) \leq H ( e ) . +$$ + +Since $f ^ { \star }$ and $g ^ { \star }$ is the optimal solution of maximizing $\mathcal { L } _ { I } ( f , g ; e )$ presented in Eq. (8), it is not difficult to see that $e = g ^ { \star } ( f ^ { \star } ( e ) ) , \forall e \in \mathcal { E }$ . In this case, the inequalities in Eq. 9 become equalities, i.e., + +$$ +H ( g ^ { \star } ( f ^ { \star } ( e ) ) ) = H ( f ^ { \star } ( e ) ) = H ( e ) . +$$ + +Therefore, we have $I ( e ; W ) = H ( e )$ , i.e., the maximum is attained in this case. + +3.3 Edge Information Maximized Graph Neural Networks + +Our EIGNN is derived by implementing our MI objective in GNNs. As a concrete example, the forward propagation of our model follows the formulation in Eq. (3), where the dege network $f : e W$ is expressed as a multi-layer perceptron (MLP). According to theoretical analysis presented in Sec. 3.2 , we introduce another MLP $g : W \to e$ as the decoder. + +For graph regression or classification tasks, the model outputs a prediction $y$ for each graph $G$ , which has label $\hat { y }$ . Without MI maximization, we denote the vanilla loss as $\mathcal { L } _ { 0 } ( \hat { y } , y ; G )$ . Common choice of $\mathcal { L } _ { 0 }$ includes Mean Square Error (MSE), Mean Absolute Error (MAE) and Cross Entropy (CE). For a graph $G = ( \nu , \mathcal { E } )$ , EIGNN maximizes $\mathcal { L } _ { I } ( f , g ; e )$ and minimizes $\mathcal { L } _ { 0 } ( \hat { y } , y ; G )$ using the following loss function + +$$ +\mathcal { L } _ { E I G N N } ( G ) = \mathcal { L } _ { 0 } ( \hat { y } , y ; G ) - \lambda \mathbb { E } _ { e \in \mathcal { E } } [ \mathcal { L } _ { I } ( f , g ; e ) ] , +$$ + +where $\mathbb { E } _ { e \in \mathcal { E } } [ \cdot ]$ denotes taking the mean over all edges in $G = ( \nu , \mathcal { E } )$ and $\lambda$ is the regularization parameter. When EIGNN is trained using mini-batches, $\mathcal { L } _ { 0 } ( \hat { y } , y ; G )$ is averaged over all graphs in the batch while $\mathcal { L } _ { I } ( f , g ; e )$ is averaged over all edges of all graphs in the batch. + +Similarly, for relational prediction tasks in knowledge graphs, EIGNN directly yields nodelevel representations $h _ { v }$ for each node $v \in \mathcal V$ and edge-level representations $e$ for each relationship. The objective function of EIGNN can be derived from the translational scoring function Bordes et al. (2013), which learns embedding such that for a given valid triple $t _ { v w } = ( h _ { v } , e _ { v w } , h _ { w } )$ from the valid set $S$ , the condition $d _ { t _ { v w } } = h _ { v } + e _ { v w } - h _ { w } \approx 0$ holds. Let $\mathcal { L } _ { 0 } = \mathbb { E } _ { t _ { v w } \in S } \mathbb { E } _ { t _ { v w } ^ { \prime } \in S ^ { \prime } } \operatorname* { m a x } \{ d _ { t _ { v w } ^ { \prime } } - d _ { t _ { v w } } + \gamma , 0 \}$ , where $S ^ { \prime }$ denotes a set of invalid triples and $\gamma$ is a margin hyper-parameter, EIGNN can be trained by minimizing the following loss, + +$$ +\mathcal { L } _ { E I G N N } ( G ) = \mathcal { L } _ { 0 } - \lambda \mathbb { E } _ { e \in \mathcal { E } } [ \mathcal { L } _ { I } ( f , g ; e ) ] . +$$ + +# 4 Experiments + +In this section, we first conduct experiments on a large quantum chemistry benchmark QM9, which is challenging for most baselines. Then we evaluate EIGNN on several useful molecule benchmarks and use attribution analysis to show that EIGNN increases the impact of edges and captures domain knowledge without human interference. Finally, we adopt our method to large-scale knowledge graphs and evaluate the performance on challenging relation prediction tasks using a wide variety of real-world datasets. All experimental results demonstrate a clear and substantial improvement of EIGNN over the state-of-the-art methods. + +# 4.1 Quantum Chemistry + +QM9 (Ramakrishnan et al., 2014) is a large benchmark containing 134k molecules with 12 quantum chemistry regression properties, which have been show to be quite challenging for many GNNs (Gilmer et al., 2017). Feature engineering of nodes and edges exactly follows (Gilmer et al., 2017) such that molecules are preprocessed as graphs according to atom features and bond features. We compare our EIGNN with nine state-of-the-art baselines which can be categorized into three groups according to the ability of handling edge features: i) GCN, ChebyNet, GAT and GIN (Xu et al., 2019) which simply use binary edge features to indicate the existence of a bond without any other edge features; ii) RGCN, GGNN, LNet and simplified MPNN (sMPNN) which consider bond types (no bond, single, double, triple, or aromatic); iii) MPNN and our EIGNN which use edge feature vectors to indicate both edge types and pairwise distance between atoms. + +For a fair comparison, we repeat all experiments 3 times with different random seeds while during each run, all methods share the same random seed. We randomly choose 10k molecules for validation, 10k molecules for testing, and keep the rest for training. Each target property is normalized to zero mean and unit variance for training. Each model is trained to predict the 12 target properties simultaneously. $\lambda$ is naively set to 1 for EIGNN. We use mean square error (MSE) loss to train the models for at most 300 epochs till convergence, and the performance is measured by mean absolute error (MAE). For LNet and GGNN, implementation of the readout function follows the original paper. While for all other models, we use the same set2set (Vinyals et al., 2015) readout, which has been demonstrated to work well in (Gilmer et al., 2017). + +Table 1: Quantum property regressions for 12 targets and overall performance (top two raws) on QM9. We repeat all experiments 3 times with different random seeds and report the average performance. Full results with standard deviation are presented in Appendix A, e.g., for MPNN and EIGNN, we have Avg. nMAE $0 . 0 3 9 8 \pm 0 . 0 0 0 2$ and 0.0357 ± 0.0005. + +
MethodGCNChebyNetGATGINRGCNGGNNLNetsMPNNMPNNEIGNN
Avg.nMAE0.1350.1210.1370.1000.1020.0990.0990.0890.0400.036
Avg.MAE5.3064.3035.4703.4803.8173.6613.6533.1610.6930.633
mu0.5680.5180.5670.4780.5060.5180.4720.4720.1100.097
alpha0.8810.7930.8910.6210.6320.6080.6230.5280.3320.294
HOMO(10-3)5.4514.7755.4294.1834.4534.4833.8893.8542.4812.230
LUMO(10-3)6.4005.6746.3314.7965.1385.1534.1944.5492.8622.593
gap(10-3)8.2017.0978.1936.0966.5006.6025.8135.6343.6203.275
R253.5641.9554.5234.6540.1039.6835.2733.496.0645.646
ZPVE(10-3)2.5332.5272.2711.7441.4771.2921.4381.3450.6790.612
UO2.0421.9842.2901.4221.0590.6971.8060.7910.4160.357
U2.0421.9842.2901.4221.0590.6971.7550.7910.4160.357
H2.0421.9842.2901.4221.0590.6971.7960.7910.4160.357
G2.0421.9842.2901.4221.0590.6961.7780.7910.4160.357
Cv0.4730.4200.4790.3090.3170.3150.3120.2620.1340.121
+ +![](images/b51754269df1a1a81766b31ec23b13e16833a1c14fe21641771ca4dfac60a05d.jpg) +Figure 1: Ablation study. Training and validation error on QM9. The shadow area indicates $m e a n \pm s t d$ over 3 runs. + +In Table 1, we list regression results for all methods. We report individual MAE for each target in their original scale, averaged MAE (Avg. MAE) over 12 properties, and averaged normalized MAE (Avg. nMAE; averaged over normalized target properties since different targets have different units and ranges). Our EIGNN achieves the best performance for each metric and each target. Now we are ready to answer the following research questions. i) Are edge features important? Yes. The error has a trend of decreasing with increasing edge features. The comparison between sMPNN (using edge types) and MPNN (using edge types and distance) directly verifies the importance of edge features. It is also consistent with the expert knowledge that distances between pairwise atoms are closely related to quantum properties. For example, the smaller the distance between the two atoms, the stronger the bond is, and consequently a higher bond energy is associated with this atom pair. ii) Does the EIGNN work? Yes. EIGNN achieves the best performance on each target, outperforming the strong baseline MPNN. Moreover, the advantage of EIGNN over MPNN is consistent over 3 runs and the standard deviation on this task is quite small. Detailed results are shown in Table 4 of Appendix A. iii) How does the EIGNN work? Our MI objective is easily implemented on top of vanilla loss function. We have shown that our objective enables preserving of edge information. Fig. 1 demonstrates that regularization such as $L _ { 2 }$ weight decay can increase training error while our objective does not. Moreover, the validation performance verifies that regularization itself does not reduce the validation error. Thus, the effectiveness of EIGNN is due to exploiting edge features rather than the regularization effect. We further run an ablation study where we concatenate edge features to node representations (i.e., MPNN+concat in Fig. 1) in message passing. Concatenation is unable to identify correlations between edges and nodes (Gilmer et al., 2017) and our results show that it slightly reduces the mean validation error but increases the variance. + +# 4.2 More Molecule Benchmarks with Potential Applications + +We further evaluate EIGNN on three molecule benchmarks: Lipophilicity (Wu et al., 2018), ESOL (Delaney, 2004) and FreeSolv (Mobley & Guthrie, 2014). These datasets contain fewer molecules, and have potential usages in applications such as chemistry, drug discovery, and materials science. For example, the property lipophilicity is an important feature of drug molecules that affects both membrane permeability and solubility. The dataset Lipophilicity contains 4200 compounds. ESOL provides water solubility data for 1128 compounds. FreeSolv contains hydration free energy of 642 small molecules in water. We conduct graph regression experiments on these benchmarks. All datasets are split into training, validation and test according to a proportion of 0.8/0.1/0.1. MPNN and our EIGNN share the same architecture with 3 layers of message passing and 3 steps of set2set. We repeat each experiment 3 times with different random seeds. Results of testing root mean square error (RMSE) in Table 2 verify the effectiveness of our method. Our EIGNN outperforms MPNN on each dataset and each run. Detailed results for each run are presented in Appendix B. + +Table 2: Testing RMSE on Lipophilicity, ESOL and FreeSolv. + +
DatasetLipophilicityESOLFreeSolv
MethodMPNNEIGNNMPNNEIGNNMPNNEIGNN
mean±std0.678±0.0420.653±0.0250.805±0.0640.776±0.0711.398±0.0811.273±0.137
+ +![](images/93a30757aa01764b32a397063bc6a0e3a215232f566f99e62524e437f83f0e93.jpg) +Figure 2: Attribution analysis. The color indicates the impact of an edge/atom on the output, i.e., the regression result. EIGNN i) increases the edge attribution, ii) reduces the prediction error and iii) can learn domain knowledge without human interference. + +Attribution analysis. To understand how our EIGNN reduces the regression error, we conduct attribution analysis, i.e., attributing the prediction of a deep network to its input features, which usually builds up on the standard gradient operator (Sundararajan et al., features 2017). For an output $e$ as $\begin{array} { r } { S _ { e } = | \frac { \partial y } { \partial e } | } \end{array}$ $y$ , i.e., the prediction of a GNN, we define its sensitivity to an edge with , where $\left. \cdot \right.$ denotes the $L _ { 1 }$ norm. Similarly, the sensitivity to an atom with features $x$ is $\begin{array} { r } { S _ { x } = | \frac { \partial y } { \partial x } | } \end{array}$ . Then $S _ { e }$ and $S _ { x }$ are used as the metrics of attribution in our experiments. As an example, we show in Fig. 2 the attribution for two molecules in Lipophilicity: (a) $N c I n o n c I C ( = N O ) N c \mathcal { Q } c c c ( F ) c ( C l ) c \mathcal { Q }$ and (b) Oc1c2ncc3ccccc3c2nn1c4ccccc4 . Molecule in (a) has the potential to be used to treat, prevent and/or diagnose cancer Prinz et al. (2019). Compared with MPNN, we can observe an increasing of overall edge attribution under our EIGNN and a decreasing of prediction error in both cases. Interestingly, the attribution under EIGNN is similar to the expert knowledge of chemists: halogen atoms such as {Cl, Br, I} and their bond with the carbon atom greatly effect the lipophilicity of a molecule Wilcken et al. (2013), while atoms {O, N} also have high impact on the lipophilicity but usually in a negative way (Augustijns & Brewster, 2007). In Fig. 2 (a), the attribution of the halogen bond C-Cl and the pair {O, N} under our EIGNN is much higher than the one under MPNN, which is consistent with the expert knowledge. In Fig. 2 (b), similarly, the attribution of atoms {O, N} and the bond C-O under EIGNN is much higher. More examples are presented in Appendix C. + +# 4.3 Predicting Relations in Knowledge Graphs + +In this subsection, we adopt EIGNN to tackle the problem of relation prediction in knowledge graphs (KGs), which entails predicting whether a given triple is valid or not. For example, a triple (London, capital of, United Kingdom) should be classified as valid or London should be predicted as the capital of United Kingdom. KGs represent human knowledge as a directed graph, and have been widely used in practical applications, such as semantic search, dialogue generation, question answering etc. Recovering missing relations in KGs have been a major task for practical usages of KGs. We evaluate our methods on three benchmark datasets, WN18RR (Dettmers et al., 2018), FB15k-237 (Toutanova et al., 2015) and NELL-995 (Xiong et al., 2017). Without the reversible relation problem (Dettmers et al., 2018), WN18RR includes 11 relations scraped from WordNet for 40, 943 synsets. FB15k-237 is a subset of Freebase, and contains 14, 541 entities associated with 237 types of edge. NELL-995 is constructed from the $9 9 5 ^ { t h }$ iteration of NELL system, containing 75, 492 entities and 200 types of edge. + +Table 3: Experimental results on WN18RR, FB15K-237 and NELL-995 test sets. Hits@N values are in percentage. The best score is in bold and second best score is underlined. + +
DatasetWN18RRFB15K-237NELL-995
MRRHit@N%MRRHit@N %
MRR@1@3@10@1@3@10@1@3@10
DistMult0.44441.24750.40.28119.930.144.60.48540.152.461
ComplEx0.44940.946.9530.27819.429.7450.48239.952.860.6
ConvE0.45641.94753.10.31222.534.149.70.49140.353.161.3
TransE0.24342.744.153.20.27919.837.644.10.40134.447.250.1
ConvKB0.26558.244.555.80.28919.832.447.10.4337.04754.5
R-GCN0.123813.720.70.1641018.1300.128.212.618.8
KBGAT0.43635.848.157.80.43136.145.856.90.51442.955.367.8
EIGNN0.43835.748.858.10.45137.448.260.50.52343.856.168.3
+ +A critical issue of applying Eq. (3) to KGs is that high-dimensional embedding vectors are required to distinguish massive amount of entities and relations, leading to a rapid growth in number of parameters in EIGNN. To address this issue, we adopt the architecture of (Nathani et al., 2019) and learn graph attention based embeddings that target relation prediction on KGs as follows, + +$$ +\begin{array} { r } { m _ { v w } = f \big ( h _ { v } ^ { ( l ) } , e _ { v w } ^ { l } , h _ { w } ^ { ( l ) } \big ) , \alpha _ { v w } ^ { l } = \mathrm { s o f t m a x } \big ( a ^ { l } m _ { v w } ^ { l } \big ) , h _ { v } ^ { ( l + 1 ) } = \sigma \left( \sum _ { w \in \mathcal { N } _ { v } } \alpha _ { v w } ^ { l } m _ { v w } ^ { l } \right) . } \end{array} +$$ + +Compared with Eq. (3), where $m _ { v w } = f ( e _ { v w } ) h _ { w }$ , the above equation absorbs the transform matrix $f ( e _ { v w } )$ into $f ( h _ { v } ^ { ( l ) } , e _ { v w } , h _ { w } ^ { ( l ) } )$ and reduces the model parameters. In the following experiments, we implement $f$ using a MLP as in previous experiments, and maximizes the MI between $e _ { v w }$ and $m _ { v w }$ by introducing another MLP with $\lambda = 0 . 0 1$ . Multi-head attention is further introduced to stabilize the learning process and encapsulate more information about neighbors according to (Veličković et al., 2018). After training EIGNN, ConvKB (Nguyen et al., 2018) is adopted as a regression function for a given triple by analyzing the global embedding properties across each dimension. + +In the relation prediction task, the aim is to predict a triple $( v , e _ { v w } , w )$ with $\boldsymbol { v }$ or $w$ missing. We can generate a set of candidate triples for each missing entity $v$ by randomly replacing it with an arbitrary one. Scores can be calculated by ConvKB for all triples, and we find the rank of a correct triple by sorting all scores in ascending order. Thus, the performance of relation prediction task can be evaluated by mean reciprocal rank (MRR) and the proportion of correct entities in the top $N$ ranks (Hits@N) for $N = 1 , 3$ , and 10 (Bordes et al., 2013). We compare our EIGNN with seven state-of-the-art baselines focusing on this task: DistMult (Yang et al., 2014), ComplEx (Trouillon et al., 2016), ConvE (Dettmers et al., 2018), TransE (Bordes et al., 2013), ConvKB (Nguyen et al., 2018), RGCN (Schlichtkrull et al., 2018) and KBGAT (Nathani et al., 2019). As shown in Table 3, our EIGNN achieves the best performance for each metric on FB15K-237 and NELL-995, and achieves the best performance on WN18RR with Hit $^ \mathrm { ( a 3 }$ and 10 metrics. The results of KBGAT are reproduced following the official implementation1, and the results of other methods can be found in the previous peer-reviewed publications, i.e. (Nathani et al., 2019). + +# 5 Conclusions + +In this work, to make better use of edge features in GNNs, we proposed the edge information maximized graph neural network (EIGNN) that maximizes the mutual information between edge feature vectors and message passing channels. We reformulated the mutual information as a differentiable objective by adopting a variational approach. We have theoretically proved that our proposed objective enables EIGNN to preserve edge information and empirically evaluated EIGNN’s performance on a variety of benchmarks incorporating an array of challenging molecular datasets and knowledge graphs. These results clearly manifested a substantial improvement of EIGNN over the prior state-of-the-art methods. Apart from demonstrating the impressive performance of EIGNN, we also showed that its effectiveness is due to exploitation of edge features instead of the regularization effect. Notably, attribution analysis on molecular graphs show that EIGNN can capture domain knowledge in an end-to-end fashion. + +# References + +David Barber Felix Agakov. The im algorithm: a variational approach to information maximization. NeurIPS, 2004. + +Patrick Augustijns and Marcus E Brewster. Solvent systems and their selection in pharmaceutics and biopharmaceutics, volume 190. Springer, 2007. + +David Barber and Felix V Agakov. Kernelized infomax clustering. In NeurIPS, 2006. + +Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In NeurIPS, pp. 2787–2795, 2013. + +John S Bridle, Anthony JR Heading, and David JC MacKay. Unsupervised classifiers, mutual information and’phantom targets. In NeurIPS, 1992. + +Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: interpretable representation learning by information maximizing generative adversarial nets. In NeurIPS, 2016. + +Kyunghyun Cho, Bart Van Merriënboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014. + +Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In NeurIPS, 2016. + +John S Delaney. Esol: estimating aqueous solubility directly from molecular structure. Journal of chemical information and computer sciences, 44(3):1000–1005, 2004. + +Tim Dettmers, Pasquale Minervini, Pontus Stenetorp, and Sebastian Riedel. Convolutional 2d knowledge graph embeddings. In AAAI, 2018. + +David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In NeurIPS, 2015. + +Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In ICML, 2017. + +Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 855–864. ACM, 2016. + +Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In NeurIPS, pp. 1024–1034, 2017. + +R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. 2019. + +Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Pre-training graph neural networks. arXiv preprint arXiv:1905.12265, 2019. + +Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. + +Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017. + +Andreas Krause, Pietro Perona, and Ryan G Gomes. Discriminative clustering by regularized information maximization. In NeurIPS, 2010. + +Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. In ICLR, 2016. + +Renjie Liao, Zhizhen Zhao, Raquel Urtasun, and Richard S Zemel. Lanczosnet: Multi-scale deep graph convolutional networks. In ICLR, 2019. + +Ralph Linsker. Self-organization in a perceptual network. Computer, 21(3):105–117, 1988. + +David L Mobley and J Peter Guthrie. Freesolv: a database of experimental and calculated hydration free energies, with input files. Journal of computer-aided molecular design, 28 (7):711–720, 2014. + +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 AAAI, volume 33, pp. 4602–4609, 2019. + +Deepak Nathani, Jatin Chauhan, Charu Sharma, and Manohar Kaul. Learning attentionbased embeddings for relation prediction in knowledge graphs. The 57th Annual Meeting of the Association for Computational Linguistics (ACL), 2019. + +Dai Quoc Nguyen, Tu Dinh Nguyen, Dat Quoc Nguyen, and Dinh Phung. A novel embedding model for knowledge base completion based on convolutional neural network. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 327–333, 2018. + +Bianka Prinz, Jerry M Thomas, Ansgar Brock, Viviana Cremasco, Catherine Anne SabatosPeyton, Glenn Dranoff, Scott Chapel, Andrew Lake, Alison Paterson, Rachel W O’connor, et al. Antibody molecules to cd73 and uses thereof, January 31 2019. US Patent App. 16/014,744. + +Raghunathan Ramakrishnan, Pavlo O Dral, Matthias Rupp, and O Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific data, 1: 140022, 2014. + +Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1): 61–80, 2009. + +Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne Van Den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In European Semantic Web Conference, pp. 593–607. Springer, 2018. + +Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In ICML, pp. 3319–3328. JMLR. org, 2017. + +Kristina Toutanova, Danqi Chen, Patrick Pantel, Hoifung Poon, Pallavi Choudhury, and Michael Gamon. Representing text for joint embedding of text and knowledge bases. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1499–1509, 2015. + +Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier, and Guillaume Bouchard. Complex embeddings for simple link prediction. In ICML, pp. 2071–2080, 2016. + +Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. In ICLR, 2018. + +Petar Veličković, William Fedus, William L Hamilton, Pietro Liò, Yoshua Bengio, and R Devon Hjelm. Deep graph infomax. In ICLR, 2019. + +Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: Sequence to sequence for sets. arXiv preprint arXiv:1511.06391, 2015. + +Rainer Wilcken, Markus O Zimmermann, Andreas Lange, Andreas C Joerger, and Frank M Boeckler. Principles and applications of halogen bonding in medicinal chemistry and chemical biology. Journal of medicinal chemistry, 56(4):1363–1388, 2013. + +Zhenqin Wu, Bharath Ramsundar, Evan N Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S Pappu, Karl Leswing, and Vijay Pande. Moleculenet: a benchmark for molecular machine learning. Chemical science, 9(2):513–530, 2018. +Wenhan Xiong, Thien Hoang, and William Yang Wang. Deeppath: A reinforcement learning method for knowledge graph reasoning. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 564–573, 2017. +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In ICLR, 2019. +Bishan Yang, Wen-tau Yih, Xiaodong He, Jianfeng Gao, and Li Deng. Embedding entities and relations for learning and inference in knowledge bases. ICLR, 2014. +Zhitao Ying, Jiaxuan You, Christopher Morris, Xiang Ren, Will Hamilton, and Jure Leskovec. Hierarchical graph representation learning with differentiable pooling. In NeurIPS, pp. 4800–4810, 2018. +Jie Zhou, Ganqu Cui, Zhengyan Zhang, Cheng Yang, Zhiyuan Liu, and Maosong Sun. Graph neural networks: A review of methods and applications. arXiv preprint arXiv:1812.08434, 2018. + +# A Full Results on QM9 + +Table 4: Full results of quantum property regressions for 12 targets and overall performance (nMAE and MAE in top two raws) on QM9. We repeat all experiments 3 times with different random seeds and report the average performance and standard deviation. This is a supplement for Table 1. in the main text. + +
MethodGCNChebyNetGATGIN
Avg.nMAE0.1350±0.00460.1206±0.00840.1367±0.00500.1001±0.0007
Avg.MAE5.3063±0.19644.3032±0.48145.4698±0.20403.4799±0.0402
mu0.5679±0.00780.5180±0.01310.5670±0.01020.4783±0.0041
alpha0.8811±0.03080.7932±0.07780.8913±0.03140.6209±0.0028
HOMO(10-3)5.4510±0.07904.7750±0.20405.4290±0.16604.1830±0.0370
LUMO(10-3)6.4000±0.12305.6740±0.26706.3310±0.23904.7960±0.0520
gap(10-3)8.2010±0.21507.0970±0.36208.1930±0.29106.0960±0.0420
R253.563±1.031941.950±4.828954.519±1.599234.647±0.2167
ZPVE(10-3)2.5330±0.10702.5270±0.35602.2710±0.14501.7440±0.0100
UO2.0422±0.32811.9842±0.20352.2899±0.20001.4215±0.0857
U2.0422±0.32811.9842±0.20352.2899±0.20001.4215±0.0857
H2.0422±0.32811.9842±0.20352.2899±0.20001.4215±0.0857
G2.0423±0.32811.9842±0.20362.2899±0.20001.4215±0.0857
Cv0.4730±0.02090.4199±0.04990.4787±0.01640.3093±0.0035
MethodRGCNGGNNLNetsMPNN
Avg.nMAE0.1021±0.00160.0992±0.00130.0992±0.00610.0888±0.0014
Avg.MAE3.8175±0.06053.6608±0.07233.6527±0.34173.1610±0.0697
mu0.5056±0.00480.5179±0.00760.4717±0.00630.4718±0.0096
alpha0.6321±0.01450.6077±0.00920.6225±0.05080.5278±0.0106
HOMO(10-3)4.4530±0.12904.4830±0.06503.8889±0.16173.8540±0.0410
LUMO(10-3)5.1380±0.12105.1530±0.08904.1935±0.22054.5490±0.0810
gap(10-3)6.5000±0.13906.6020±0.14005.8132±0.64565.6340±0.0570
R240.102±0.742839.685±0.821235.275±3.053133.489±0.6562
ZPVE(10-3)1.4770±0.00901.2920±0.03401.4376±0.07691.3450±0.0260
UO1.0589±0.02310.6969±0.04131.8058±0.25330.7914±0.0446
U1.0589±0.02310.6966±0.04181.7555±0.21960.7914±0.0446
H1.0589±0.02310.6974±0.04081.7964±0.24280.7914±0.0446
G1.0589±0.02310.6961±0.04211.7780±0.24580.7914±0.0446
Cv0.3170±0.01520.3146±0.01250.3124±0.03030.2625±0.0040
MethodMPNNEIGNN
Avg.nMAE0.0398±0.00020.0357±0.0005
Avg.MAE0.6929±0.02120.6331±0.0298
mu0.1095±0.00140.0974±0.0026
alpha0.3318±0.00260.2939±0.0054
HOMO(10-3)2.4810±0.02002.2300±0.0310
LUMO(10-3)2.8620±0.03702.5930±0.0440
gap(10-3)3.6200±0.01803.2750±0.0520
R26.0637±0.25115.6464±0.3098
ZPVE(10-3)0.6790±0.01400.6120±0.0170
UO0.4164±0.02250.3574±0.0100
U0.4164±0.02250.3575±0.0100
H0.4164±0.02250.3574±0.0100
G0.4164±0.02250.3575±0.0101
Cv0.1339±0.00130.1208±0.0027
+ +We present full results of quantum property regressions on QM9 with average performance and standard deviation in Table 4. The $( 1 0 ^ { - 3 }$ ) in the parentheses indicates that the values in the corresponding raw of the table should multiply by $1 0 ^ { - 3 }$ . This is simply for clear presentation of the values. We also present a detailed descriptions on the target properties in Table 5 for your reference. + +In our results, we directly report MAE instead of Error Ratio [(MAE)/(Chemical Accuracy) (Gilmer et al., 2017)], because it is common to report MAE in terms of chemical unit. This practice has been widely adopted not only in computational chemistry but also in the machine learning community working on molecular graphs (Wu et al., 2018; Morris et al., 2019). Still, we add Table 6 which contains the Error Ratio for MPNN and our EIGNN. In this comparison, we follow (Gilmer et al., 2017) and train models separately to predict each target. Our EIGNN consistently outperforms MPNN. + +Table 5: Regression targets on QM9. + +
Target propertyDescriptionUnit
muDipole momentD
alphaIsotropic polarizabilitya
HOMOHighest occupied molecular orbital energyEh
LUMOLowest unoccupied molecular orbital energyEh
gapGap between HOMO and LUMOEh
R2Electronic spatial extent
ZPVEZero point vibrational energyEh
UOInternal energy at OKEh
UInternal energy at 298.15KEh
HEnthalpy at 298.15KEh
GFree energy at 298.15KEh
CvHeat capavity at 298.15Kcal molK
+ +Table 6: Error Ratio [(MAE)/(Chemical Accuracy) (Gilmer et al., 2017)] on QM9. Note that the energy values of $\{ \mathrm { U 0 , ~ U , ~ H , ~ G } \}$ are per molecule rather than per atom. Following (Gilmer et al., 2017), models are separately trained on each target. + +
TargetMPNNEIGNNImprovement (%)
mu0.870.808.24
alpha2.642.447.57
HOMO1.541.3910.2
LUMO1.311.282.13
gap2.201.9710.4
R21.000.7228.4
ZPVE5.314.4316.5
UO64.335.844.4
U56.623.658.3
H77.435.254.5
G46.634.426.1
Cv1.691.79-6.22
+ +B Full Results on Lipophilicity, ESOL and FreeSolv + +In this section, we present experimental results on Lipophilicity, ESOL and FreeSolv with detailed results for each run. The results in Table 7 verify that our EIGNN consistently outperforms MPNN. + +# C More Examples of Attribution + +In this section, we present more examples of attribution analysis on Lipophilicity. As a supplement for Fig. 2 in the main text, the observation here is similar. Compared with MPNN, we can observe an increasing of overall edge attribution under our EIGNN and a decreasing of prediction error in both cases. Notably, our EIGNN is able to capture the expert knowledge. (a) The molecule is $C N [ C @ \mathbb { Q } H ] ( C ) C ( = O ) N [ C @ \mathbb { Q } H ] ( C 1 C C C C T 1 ) C ( =$ $O ) N [ C @ H ] 2 C C C N ( C C c ( F ) c c 3 ) C 2$ . The attribution of $\{ \mathrm { O } , \mathrm { N } \}$ and the halogen atom $\mathrm { F }$ is higher under EIGNN. (b) The molecule is $C C ( C ) N 1 C C N [ C @ H ] ( C 1 ) C ( =$ $O ) N 2 C C N ( C C 2 ) C ( = O ) N c 3 c c c ( C l ) c ( C l ) c 3$ . Our EIGNN successfully captures the importance of two critical halogen atoms Cl and several atoms N. (c) The molecule is $C O c 1 c c ( c c 1 ) C ( = \ O ) N 2 C C C C 2 \ = \ O$ . The attribution of two atoms $\mathrm { \ o }$ at the top is + +Table 7: Testing RMSE on Lipophilicity, ESOL and FreeSolv. This is a supplement for Table 2 in the main text. + +
DatasetLipophilicityESOLFreeSolv
SeedMPNNEIGNNMPNNEIGNNMPNNEIGNN
00.7180.6760.7700.7181.3961.109
10.6960.6640.7500.7331.2991.265
20.6200.6190.8940.8761.4991.443
mean±std0.678±0.0420.653±0.0250.805±0.0640.776±0.0711.398±0.0811.273±0.137
+ +much higher under EIGNN. (d) The molecule is $C c 1 c c 2 N C ( = O ) C ( = C C ( = O ) c 2 c c 1 C ) O$ . +The attribution of atoms O is much higher under EIGNN. + +![](images/d35b4c5026ccc9e9cd8864632869ef2ae4dd487409a61f9850c2293c8640530b.jpg) +Figure 3: More examples of attribution analysis. The color indicates the impact of an edge/atom on the output, i.e., the regression result. EIGNN i) increases the edge attribution, ii) reduces the prediction error and iii) can learn domain knowledge without human interference. \ No newline at end of file diff --git a/md/train/ByxkijC5FQ/ByxkijC5FQ.md b/md/train/ByxkijC5FQ/ByxkijC5FQ.md new file mode 100644 index 0000000000000000000000000000000000000000..674f95ca137d9ce26e5f383a2d03fa93651ede5e --- /dev/null +++ b/md/train/ByxkijC5FQ/ByxkijC5FQ.md @@ -0,0 +1,379 @@ +# NEURAL PERSISTENCE: A COMPLEXITY MEASURE FOR DEEP NEURAL NETWORKS USING ALGEBRAIC TOPOLOGY + +Bastian Rieck1,2,†, Matteo Togninalli1,2,†, Christian $\mathbf { B o c k } ^ { 1 , 2 , \dagger }$ , Michael Moor1,2, Max Horn1,2, Thomas Gumbsch1,2, Karsten Borwardt1,2 + +1DEPARTMENT OF BIOSYSTEMS SCIENCE AND ENGINEERING, ETH ZURICH, SWITZERLAND +2SIB SWISS INSTITUTE OF BIOINFORMATICS, SWITZERLAND +†These authors contributed equally + +# ABSTRACT + +While many approaches to make neural networks more fathomable have been proposed, they are restricted to interrogating the network with input data. Measures for characterizing and monitoring structural properties, however, have not been developed. In this work, we propose neural persistence, a complexity measure for neural network architectures based on topological data analysis on weighted stratified graphs. To demonstrate the usefulness of our approach, we show that neural persistence reflects best practices developed in the deep learning community such as dropout and batch normalization. Moreover, we derive a neural persistencebased stopping criterion that shortens the training process while achieving comparable accuracies as early stopping based on validation loss. + +# 1 INTRODUCTION + +The practical successes of deep learning in various fields such as image processing (Simonyan & Zisserman, 2015; He et al., 2016; Hu et al., 2018), biomedicine (Ching et al., 2018; Rajpurkar et al., 2017; Rajkomar et al., 2018), and language translation (Bahdanau et al., 2015; Sutskever et al., 2014; Wu et al., 2016) still outpace our theoretical understanding. While hyperparameter adjustment strategies exist (Bengio, 2012), formal measures for assessing the generalization capabilities of deep neural networks have yet to be identified (Zhang et al., 2017). Previous approaches for improving theoretical and practical comprehension focus on interrogating networks with input data. These methods include i) feature visualization of deep convolutional neural networks (Zeiler & Fergus, 2014; Springenberg et al., 2015), ii) sensitivity and relevance analysis of features (Montavon et al., 2017), iii) a descriptive analysis of the training process based on information theory (Tishby & Zaslavsky, 2015; Shwartz-Ziv & Tishby, 2017; Saxe et al., 2018; Achille & Soatto, 2018), and iv) a statistical analysis of interactions of the learned weights (Tsang et al., 2018). Additionally, Raghu et al. (2017) develop a measure of expressivity of a neural network and use it to explore the empirical success of batch normalization, as well as for the definition of a new regularization method. They note that one key challenge remains, namely to provide meaningful insights while maintaining theoretical generality. This paper presents a method for elucidating neural networks in light of both aspects. + +We develop neural persistence, a novel measure for characterizing neural network structural complexity. In doing so, we adopt a new perspective that integrates both network weights and connectivity while not relying on interrogating networks through input data. Neural persistence builds on computational techniques from algebraic topology, specifically topological data analysis (TDA), which was already shown to be beneficial for feature extraction in deep learning (Hofer et al., 2017) and describing the complexity of GAN sample spaces (Khrulkov & Oseledets, 2018). More precisely, we rephrase deep networks with fully-connected layers into the language of algebraic topology and develop a measure for assessing the structural complexity of i) individual layers, and ii) the entire network. In this work, we present the following contributions: + +- We introduce neural persistence, a novel measure for characterizing the structural complexity of neural networks that can be efficiently computed. +- We prove its theoretical properties, such as upper and lower bounds, thereby arriving at a normalization for comparing neural networks of varying sizes. +- We demonstrate the practical utility of neural persistence in two scenarios: i) it correctly captures the benefits of dropout and batch normalization during the training process, and ii) it can be easily used as a competitive early stopping criterion that does not require validation data. + +# 2 BACKGROUND: TOPOLOGICAL DATA ANALYSIS + +Topological data analysis (TDA) recently emerged as a field that provides computational tools for analysing complex data within a rigorous mathematical framework that is based on algebraic topology. This paper uses persistent homology, a theory that was developed to understand highdimensional manifolds (Edelsbrunner et al., 2002; Edelsbrunner & Harer, 2010), and has since been successfully employed in characterizing graphs (Sizemore et al., 2017; Rieck et al., 2018), finding relevant features in unstructured data (Lum et al., 2013), and analysing image manifolds (Carlsson et al., 2008). This section gives a brief summary of the key concepts; please refer to Edelsbrunner & Harer (2010) for an extensive introduction. + +Simplicial homology The central object in algebraic topology is a simplicial complex K, i.e. a high-dimensional generalization of a graph, which is typically used to describe complex objects such as manifolds. Various notions to describe the connectivity of K exist, one of them being simplicial homology. Briefly put, simplicial homology uses matrix reduction algorithms (Munkres, 1996) to derive a set of groups, the homology groups, for a given simplicial complex K. Homology groups describe topological features—colloquially also referred to as holes—of a certain dimension $d$ , such as connected components $( d = 0$ ), tunnels $( d = 1 )$ , and voids $\ Q \ = \ 2$ ). The information from the dth homology group is summarized in a simple complexity measure, the dth Betti number $\beta _ { d }$ , which merely counts the number of $d$ -dimensional features: a circle, for example, has Betti numbers $( 1 , 1 )$ , i.e. one connected component and one tunnel, while a filled circle has Betti numbers $( 1 , 0 )$ , i.e. one connected component but no tunnel. In the context of analysing simple feedforward neural networks for two classes, Bianchini & Scarselli (2014) calculated bounds of Betti numbers of the decision region belonging to the positive class, and were thus able to show the implications of different activation functions. These ideas were extended by Guss & Salakhutdinov (2018) to obtain a measure of the topological complexity of decision boundaries. + +Persistent homology For the analysis of real-world data sets, however, Betti numbers turn out to be of limited use because their representation is too coarse and unstable. This prompted the development of persistent homology. Given a simplicial complex $\mathrm { K }$ with an additional set of weights $a _ { 0 } ~ \leq ~ a _ { 1 } ~ \leq ~ \cdot ~ \cdot ~ \leq ~ a _ { m - 1 } ~ \leq ~ a _ { m }$ , which are commonly thought to represent the idea of a scale, it is possible to put K in a filtration, i.e. a nested sequence of simplicial complexes $\emptyset = \mathrm { K } _ { 0 } \subseteq \mathrm { K } _ { 1 } \subseteq \cdots \subseteq \mathrm { K } _ { m - 1 } \subseteq \mathrm { K } _ { m } = \mathrm { K }$ . This filtration is thought to represent the ‘growth’ of K as the scale is being changed. During this growth process, topological features can be created (new vertices may be added, for example, which creates a new connected component) or destroyed (two connected components may merge into one). Persistent homology tracks these changes and represents the creation and destruction of a feature as a point $( a _ { i } , a _ { j } ) \in \mathbb { R } ^ { 2 }$ for indices $i \leq j$ with respect to the filtration. The collection of all points corresponding to $d$ -dimensional topological features is called the dth persistence diagram $\mathcal { D } _ { d }$ . It can be seen as a collection of Betti numbers at multiple scales. Given a point $( x , y ) \in \mathcal { D } _ { d }$ , the quantity $\mathrm { p e r s } ( x , y ) : = | y - x |$ is referred to as its persistence. Typically, high persistence is considered to correspond to features, while low persistence is considered to indicate noise (Edelsbrunner et al., 2002). + +# 3 A NOVEL MEASURE FOR NEURAL NETWORK COMPLEXITY + +This section details neural persistence, our novel measure for assessing the structural complexity of neural networks. By exploiting both network structure and weight information through persistent homology, our measure captures network expressiveness and goes beyond mere connectivity properties. Subsequently, we describe its calculation, provide theorems for theoretical and empirical bounds, and show the existence of neural networks complexity regimes. To summarize this section, Figure 1 illustrates how our method treats a neural network. + +![](images/80fd9380ddcb49b187a4397ea8cad05092b870aee36f908dee64e9829b8cbd50.jpg) +Figure 1: Illustrating the neural persistence calculation of a network with two layers $( l _ { 0 }$ and $l _ { 1 } .$ ). Colours indicate connected components per layer. The filtration process is depicted by colouring connected components that are created or merged when the respective weights are greater than or equal to the threshold $w _ { i } ^ { \prime }$ . As $w _ { i } ^ { \prime }$ decreases, network connectivity increases. Creation and destruction thresholds are collected in one persistence diagram per layer (right), and summarized according to Equation 1 for calculating neural persistence. + +# 3.1 NEURAL PERSISTENCE + +Given a feedforward neural network with an arrangement of neurons and their connections $E$ , let $\mathcal { W }$ refer to the set of weights. Since $\mathcal { W }$ is typically changing during training, we require a function $\varphi \colon E \mathcal { W }$ that maps a specific edge to a weight. Fixing an activation function, the connections form a stratified graph. + +Definition 1 (Stratified graph and layers). $A$ stratified graph is a multipartite graph $G = ( V , E )$ satisfying $V = V _ { 0 } \sqcup V _ { 1 } \sqcup \ldots ,$ , such that if $u \in V _ { i }$ , $v \in V _ { j }$ , and $( u , v ) \in E$ , we have $j = i + 1$ Hence, edges are only permitted between adjacent vertex sets. Given $k \in \mathbb N$ , the kth layer of $a$ stratified graph is the unique subgraph $G _ { k } : = ( V _ { k } \sqcup V _ { k + 1 } , E _ { k } : = E \cap \{ V _ { k } \times V _ { k + 1 } \} )$ . + +This enables calculating the persistent homology of $G$ and each $G _ { k }$ , using the filtration induced by sorting all weights, which is common practice in topology-based network analysis (Carstens & Horadam, 2013; Horak et al., 2009) where weights often represent closeness or node similarity. However, our context requires a novel filtration because the weights arise from an incremental fitting procedure, namely the training, which could theoretically lead to unbounded values. When analysing geometrical data with persistent homology, one typically selects a filtration based on the (Euclidean) distance between data points (Bubenik, 2015). The filtration then connects points that are increasingly distant from each other, starting from points that are direct neighbours. Our network filtration aims to mimic this behaviour in the context of fully-connected neural networks. Our framework does not explicitly take activation functions into account; however, activation functions influence the evolution of weights during training. + +Filtration Given the set of weights $\mathcal { W }$ for one training step, let $w _ { \mathrm { m a x } } : = \operatorname* { m a x } _ { w \in \mathcal { W } } | w |$ . Furthermore, let $\mathcal { W } ^ { \prime } : = \{ | w | / w _ { \operatorname* { m a x } } | w \bar { \in } \mathcal { W } \}$ be the set of transformed weights, indexed in non-ascending order, such that $G _ { k }$ $G _ { k } ^ { ( 0 ) } \subseteq G _ { k } ^ { ( 1 ) } \subseteq \cdot \cdot .$ $1 = w _ { 0 } ^ { \prime } \geq w _ { 1 } ^ { \prime } \geq \cdot \cdot \cdot \geq 0$ , where e trans $G _ { k } ^ { ( i ) } : = ( V _ { k } \sqcup V _ { k + 1 } , \{ ( u , v ) \mid ( u , v ) \in E _ { k } \land \varphi ^ { \prime } ( u , v ) \geq w _ { i } ^ { \prime } \} )$ . This permits us to define a filtration for the $k$ th layer ands the $\varphi ^ { \prime } ( u , v ) \ { \stackrel { } { \in } } \ \mathcal { W } ^ { \prime }$ +analysis of neural networks, for which large (absolute) weights indicate that certain neurons exert a larger influence over the final activation of a layer. The strength of a connection is thus preserved by the filtration, and weaker weights with $| w | \approx \dot { 0 }$ remain close to 0. Moreover, since $w ^ { \prime } \in [ 0 , 1 ]$ holds for the transformed weights, this filtration makes the network invariant to scaling, which simplifies the comparison of different networks. + +Persistence diagrams Having set up the filtration, we can calculate persistent homology for every layer $G _ { k }$ . As the filtration contains at most 1-simplices (edges), we capture zero-dimensional topological information, i.e. how connected components are created and merged during the filtration. These information are structurally equivalent to calculating a maximum spanning tree using the weights, or performing hierarchical clustering with a specific setup (Carlsson & Mémoli, 2010). While it would theoretically be possible to include higher-dimensional information about each layer $G _ { k }$ , for example in the form of cliques (Rieck et al., 2018), we focus on zero-dimensional information in this paper, because of the following advantages: i) the resulting values are easily interpretable as they essentially describe the clustering of the network at multiple weight thresholds, ii) previous research (Rieck & Leitte, 2016; Hofer et al., 2017) indicates that zero-dimensional topological information is already capturing a large amount of information, and iii) persistent homology calculations are highly efficient in this regime (see below). We thus calculate zero-dimensional persistent homology with this filtration. The resulting persistence diagrams have a special structure: since our filtration solely sorts edges, all vertices are present at the beginning of the filtration, i.e. they are already part of $G _ { k } ^ { ( 0 ) }$ for each $k$ . As a consequence, they are assigned a weight of 1, resulting in connected components. Hence, entries in the corresponding persistence diagram are of the form $( 1 , x )$ , with $x \in \mathcal { W } ^ { \prime }$ , and will be situated below the diagonal, similar to superlevel set filtrations (Bubenik, 2015; Cohen-Steiner et al., 2009). Using the $p$ -norm of a persistence diagram, as introduced by Cohen-Steiner et al. (2010), we obtain the following definition for neural persistence. + +
Algorithm1Neural persistence calculation
Require: Neural network with l layers and weights WDetermine largest absolute weight
1: Wmax ← maxw∈w lwl 2: W' ← {lwl/wmax |w ∈W}>Transform weights for filtration
3: for k ∈{0,...,l-1} do G 4: F↑ n n>Establish filtration of kth layer
5: Dk ←PERSISTENTHOMOLOGY(Fε) Calculate persistence diagram
end for 7: return{Dollp,...,|/Dt-1llp}> Calculate neural persistence for each layer
+ +Definition 2 (Neural persistence). The neural persistence of the kth layer $G _ { k }$ , denoted by $\mathrm { N P } ( G _ { k } )$ is the $p$ -norm of the persistence diagram $\mathcal { D } _ { k }$ resulting from our previously-introduced filtration, i.e. + +$$ +\mathrm { N P } ( G _ { k } ) : = \| \mathcal { D } _ { k } \| _ { p } : = \Big ( \sum _ { ( c , d ) \in \mathcal { D } _ { k } } \mathrm { p e r s } ( c , d ) ^ { p } \Big ) ^ { \frac { 1 } { p } } , +$$ + +which (for $p = 2$ ) captures the Euclidean distance of points in $\mathcal { D } _ { k }$ to the diagonal. + +The $p$ -norm is known to be a stable summary (Cohen-Steiner et al., 2010) of topological features in a persistence diagram. For neural persistence to be a meaningful measure of structural complexity, it should increase as a neural network is learning. We evaluate this and other properties in Section 4. + +Algorithm 1 provides pseudocode for the calculation process. It is highly efficient: the filtration (line 4) amounts to sorting all $n$ weights of a network, which has a computational complexity of ${ \mathcal { O } } ( n \log n )$ . Calculating persistent homology of this filtration (line 5) can be realized using an algorithm based on union–find data structures Edelsbrunner et al. (2002). This has a computational complexity of $O \left( n \cdot \alpha \left( n \right) \right)$ , where $\alpha ( \cdot )$ refers to the extremely slow-growing inverse of the Ackermann function (Cormen et al., 2009, Chapter 22). We make our implementation and experiments available under https://github.com/BorgwardtLab/Neural-Persistence. + +# 3.2 PROPERTIES OF NEURAL PERSISTENCE + +We elucidate properties about neural persistence to permit the comparison of networks with different architectures. As a first step, we derive bounds for the neural persistence of a single layer $G _ { k }$ . + +Theorem 1. Let $G _ { k }$ be a layer of a neural network according to Definition 1. Furthermore, let $\varphi _ { k } \colon E _ { k } \to \mathcal { W } ^ { \prime }$ denote the function that assigns each edge of $G _ { k }$ a transformed weight. Using the filtration from Section 3.1 to calculate persistent homology, the neural persistence $\mathrm { N P } ( G _ { k } )$ of the kth layer satisfies + +$$ +0 \leq \mathrm { N P } ( G _ { k } ) \leq \left( \operatorname* { m a x } _ { e \in E _ { k } } \varphi _ { k } ( e ) - \operatorname* { m i n } _ { e \in E _ { k } } \varphi _ { k } ( e ) \right) ( | V _ { k } \times V _ { k + 1 } | - 1 ) ^ { \frac { 1 } { p } } , +$$ + +where $| V _ { k } \times V _ { k + 1 } |$ denotes the cardinality of the vertex set, i.e. the number of neurons in the layer. + +Proof. We prove this constructively and show that the bounds can be realized. For the lower bound, let $G _ { k } ^ { - }$ be a fully-connected layer with $| V _ { k } |$ vertices and, given $\theta \in [ 0 , 1 ]$ , let $\varphi _ { k } ( e ) : = \theta$ for every edge $e$ . Since a vertex $v$ is created before its incident edges, the filtration degenerates to a lexicographical ordering of vertices and edges, and all points in $\mathcal { D } _ { k }$ will be of the form $( \theta , \theta )$ . Thus, $\mathrm { N P } ( G _ { k } ^ { - } ) = 0$ . For the upper bound, let $G _ { k } ^ { + }$ again be a fully-connected layer with $| V _ { k } | \geq 3$ vertices and let $\dot { a } , b \in [ 0 , 1 ]$ with $a \ < \ b$ . Select one edge $e ^ { \prime }$ at random and define a weight function as $\varphi ( e ^ { \prime } ) : = b$ and $\varphi ( e ) : = a$ otherwise. In the filtration, the addition of the first edge will create a pair of the form $( b , b )$ , while all other pairs will be of the form $( b , a )$ . Consequently, we have + +$$ +\begin{array} { r l } & { \mathrm { N P } ( G _ { k } ^ { + } ) = \Big ( \mathrm { p e r s } ( b , b ) ^ { p } + ( n - 1 ) \cdot \mathrm { p e r s } ( b , a ) ^ { p } \Big ) ^ { \frac { 1 } { p } } = ( b - a ) \cdot ( n - 1 ) ^ { \frac { 1 } { p } } } \\ & { \quad \quad \quad = \bigg ( \underset { e \in E _ { k } } { \operatorname* { m a x } } \varphi ( e ) - \underset { e \in E _ { k } } { \operatorname* { m i n } } \varphi ( e ) \bigg ) ( | V _ { k } | - 1 ) ^ { \frac { 1 } { p } } , } \end{array} +$$ + +so our upper bound can be realized. To show that this term cannot be exceeded by $\mathrm { N P } ( G )$ for any $G$ , suppose we perturb the weight function $\widetilde { \varphi } ( e ) : = \varphi ( e ) + \epsilon \in [ 0 , 1 ]$ . This cannot increase NP, however, because each difference $b - a$ in Equation 3 is maximized by max $\varphi ( e ) - \operatorname* { m i n } \varphi ( e )$ . + +We can use the upper bound of Theorem 1 to normalize the neural persistence of a layer, making it possible to compare layers (and neural networks) that feature different architectures, i.e. a different number of neurons. + +Definition 3 (Normalized neural persistence). For a layer $G _ { k }$ following Definition $^ { l }$ , using the upper bound of Theorem 1, the normalized neural persistence $\widetilde { \mathrm { N P } } ( G _ { k } )$ is defined as the neural persistence of $G _ { k }$ divided by its upper bound, i.e. $\widetilde { \mathrm { N P } } ( G _ { k } ) : = \mathrm { N P } ( G _ { k } ) \cdot \mathrm { N P } ( G _ { k } ^ { + } ) ^ { - 1 }$ . + +The normalized neural persistence of a layer permits us to extend the definition to an entire network. While this is more complex than using a single filtration for a neural network, this permits us to side-step the problem of different layers having different scales. + +Definition 4 (Mean normalized neural persistence). Considering a network as a stratified graph $G$ according to Definition $^ { l }$ , we sum the neural persistence values per layer to obtain the mean normalized neural persistence, i.e. $\begin{array} { r } { \overline { { \mathrm { N P } } } ( G ) : = 1 / l \cdot \sum _ { k = 0 } ^ { l - 1 } \widetilde { \mathrm { N P } } ( G _ { k } ) } \end{array}$ . + +While Theorem 1 gives a lower and upper bound in a general setting, it is possible to obtain empirical bounds when we consider the tuples that result from the computation of a persistence diagram. Recall that our filtration ensures that the persistence diagram of a layer contains tuples of the form $( 1 , w _ { i } )$ , with $w _ { i } \in [ 0 , 1 ]$ being a transformed weight. Exploiting this structure permits us to obtain bounds that could be used prior to calculating the actual neural persistence value in order to make the implementation more efficient. + +Theorem 2. Let $G _ { k }$ be a layer of a neural network as in Theorem $^ { l }$ with n vertices and m edges whose edge weights are sorted in non-descending order, i.e. $w _ { 0 } \ \leq \ w _ { 2 } \ \leq \ \cdot \cdot \ \leq \ w _ { m - 1 }$ . Then $\mathrm { N P } ( G _ { k } )$ can be empirically bounded by + +$$ +\left\| \mathbb { 1 } - \mathbf { w } _ { \mathrm { m a x } } \right\| _ { p } \leq \mathrm { N P } ( G _ { k } ) \leq \left\| \mathbb { 1 } - \mathbf { w } _ { \mathrm { m i n } } \right\| _ { p } , +$$ + +where $\mathbf { w } _ { \mathrm { m a x } } = ( w _ { m - 1 } , w _ { m - 2 } , \ldots , w _ { m - n } ) ^ { T }$ and $\mathbf { w } _ { \mathrm { m i n } } = ( w _ { 0 } , w _ { 2 } , \ldots , w _ { n - 1 } ) ^ { T }$ are the vectors containing the n largest and $n$ smallest weights, respectively. + +Proof. See Section A.2 in the appendix. + +Complexity regimes in neural persistence As an application of the two theorems, we briefly take a look at how neural persistence changes for different classes of simple neural networks. To this end, we train a perceptron on the ‘MNIST’ data set. Since our measure uses the weight matrix of a perceptron, we can compare its neural persistence with the neural persistence of random weight matrices, drawn from different distributions. Moreover, we can compare trained networks with respect to their initial parameters. Figure 2 depicts the neural persistence values as well as the lower bounds according to Theorem 2 for different settings. We can see that a network in which the optimizer diverges (due to improperly selected parameters) is similar to a random Gaussian matrix. + +![](images/45f7b7b8b6052d2ab86240987de83f63d77cd6691acfbd6ee35f569d997f5278.jpg) +Figure 2: Neural persistence values of trained perceptrons (green), diverging ones (yellow), random Gaussian matrices (red), and random uniform matrices (black). We performed 100 runs per category; dots indicate neural persistence while crosses indicate the predicted lower bound according to Theorem 2. The bounds according to Theorem 1 are shown as dashed lines. + +Trained networks, on the other hand, are clearly distinguished from all other networks. Uniform matrices have a significantly lower neural persistence than Gaussian ones. This is in line with the intuition that the latter type of networks induces functional sparsity because few neurons have large absolute weights. For clarity, we refrain from showing the empirical upper bounds because most weight distributions are highly right-tailed; the bound will not be as tight as the lower bound. These results are in line with a previous analysis (Sizemore et al., 2017) of small weighted networks, in which persistent homology is seen to outperform traditional graph-theoretical complexity measures such as the clustering coefficient (see also Section A.1 in the appendix). For deeper networks, additional experiments discuss the relation between validation accuracy and neural persistence (Section A.5), the impact of different data distributions, as well as the variability of neural persistence for architectures of varying depth (Section A.6). + +# 4 EXPERIMENTS + +This section demonstrates the utility and relevance of neural persistence for fully connected deep neural networks. We examine how commonly used regularization techniques (batch normalization and dropout) affect neural persistence of trained networks. Furthermore, we develop an early stopping criterion based on neural persistence and we compare it to the traditional criterion based on validation loss. We used different architectures with $R e L U$ activation functions across experiments. The brackets denote the number of units per hidden layer. In addition, the Adam optimizer with hyperparameters tuned via cross-validation was used unless noted otherwise. Please refer to Table A.1 in the appendix for further details about the experiments. + +# 4.1 DEEP LEARNING BEST PRACTICES IN LIGHT OF NEURAL PERSISTENCE + +We compare the mean normalized neural persistence (see Definition 4) of a two-layer (with an architecture of [650, 650]) neural network to two models where batch normalization (Ioffe & Szegedy, 2015) or dropout (Srivastava et al., 2014) are applied. Figure 3 shows that the networks designed according to best practices yield higher normalized neural persistence values on the ‘MNIST’ data set in comparison to an unmodified network. The effect of dropout on the mean normalized neural persistence is more pronounced and this trend is directly analogous to the observed accuracy on the test set. These results are consistent with expectations if we consider dropout to be similar to ensemble learning (Hara et al., 2016). As individual parts of the network are trained independently, a higher degree of per-layer redundancy is expected, resulting in a different structural complexity. Overall, these results indicate that for a fixed architecture approaches targeted at increasing the neural persistence during the training process may be of particular interest. + +![](images/e23c76a7e2454da9a60d1d9c6e252fb88ce7177476ef1472bd9afb09f369662e.jpg) +Figure 3: Comparison of mean normalized neural persistence for trained networks without modifications (green), with batch normalization (yellow), and with $50 \%$ of the neurons dropped out during training (red) for the ‘MNIST’ data set (50 runs per setting). + +# 4.2 EARLY STOPPING BASED ON NEURAL PERSISTENCE + +Neural persistence can be used as an early stopping criterion that does not require a validation data set to prevent overfitting: if the mean normalized neural persistence does not increase by more than $\Delta _ { \mathrm { m i n } }$ during a certain number of epochs $g$ , the training process is stopped. This procedure is called ‘patience’ and Algorithm 2 describes it in detail. A similar variant of this algorithm, using validation loss instead of persistence, is the state-of-the-art for early stopping in training (Bengio, 2012; Chollet et al., 2015). To evaluate the efficacy of our measure, we compare it against validation loss in an extensive set of scenarios. More precisely, for a training process with at most $G$ epochs, we define a $G \times G$ parameter grid consisting of the ‘patience’ parameter $g$ and a burn-in rate $b$ (both measured in epochs). $b$ defines the number of epochs after which an early stopping criterion starts monitoring, thereby preventing underfitting. Subsequently, we set $\Delta _ { \operatorname* { m i n } } = 0$ for all measures to remain comparable and scale-invariant, as non-zero values could implicitly favour one of them due to scaling. For each data set, we perform 100 training runs of the same architecture, monitoring validation loss and mean normalized neural persistence every quarter epoch. The early stopping behaviour of both measures is simulated for each combination of $b$ and $g$ and their performance over all runs is summarized in terms of median test accuracy and median stopping epoch; if a criterion is not triggered for one run, we report the test accuracy at the end of the training and the number of training epochs. This results in a scatterplot, where each point (corresponding to a single parameter combination) shows the difference in epochs and the absolute difference in test accuracy (measured in percent). The quadrants permit an intuitive explanation: $Q _ { 2 }$ , for example, contains all configurations for which our measure stops earlier, while achieving a higher accuracy. Since $b$ and $g$ are typically chosen to be small in an early stopping scenario, we use grey points to indicate uncommon configurations for which $b$ or $g$ is larger than half of the total number of epochs. Furthermore, to summarize the performance of our measure, we calculate the barycentre of all configurations (green square). + +Figure 4a depicts the comparison with validation loss for the ‘Fashion-MNIST’ (Xiao et al., 2017) data set; please refer to Section A.3 in the appendix for more data sets. Here, we observe that most common configurations are in $Q _ { 2 }$ or in $Q _ { 3 }$ , i.e our criterion stops earlier. The barycentre is at $( - 0 . 5 3 , - 0 . 0 8 )$ , showing that out of 625 configurations, on average we stop half an epoch earlier than validation loss, while losing virtually no accuracy $\left( 0 . 0 8 \% \right)$ . Figure 4c depicts detailed differences in accuracy and epoch for our measure when compared to validation loss; each cell in a heatmap corresponds to a single parameter configuration of $b$ and $g$ . In the heatmap of accuracy differences, blue, white, and red represent parameter combinations for which we obtain higher, equal, or lower accuracy, respectively, than with validation loss for the same parameters. Similarly, in the + +Require: Weighted neural network $\mathcal { N }$ , patience $g$ , $\Delta _ { \mathrm { m i n } }$ +1: $P 0$ , $G \gets 0$ $\triangleright$ Initialize highest observed value and patience counter +2: procedure EARLYSTOPPING $( \mathcal { N } , g , \Delta _ { \mathrm { m i n } } )$ $\triangleright$ Callback that monitors training at every epoch +3: $P ^ { \prime } \overline { { \mathrm { N P } } } ( \mathcal { N } )$ +4: if $P ^ { \prime } > P + \Delta _ { \mathrm { m i n } }$ then ▷ Update mean normalized neural persistence and reset counter +5: $P P ^ { \prime }$ , $G 0$ +6: else ▷ Update patience counter +7: $G G + 1$ +8: end if +9: if $G \geq g$ then $\triangleright$ Patience criterion has been triggered +10: return $P$ $\triangleright$ Stop training and return highest observed value +11: end if +12: end procedure + +![](images/20a597cd81084feafed12c885cc7508b41ddf9d9cebe73098fb0180e61a0b18c.jpg) +Figure 4: The visualizations depict the differences in accuracy and epoch for all comparison scenarios of mean normalized neural persistence versus validation loss, while the table summarizes the results on other data sets. Final test accuracies are shown irrespectively of early stopping to put the accuracy differences into context. + +heatmap of epoch differences, green represents parameter combinations for which we stop earlier than validation loss. For $b \leq 8$ , we stop earlier (0.62 epochs on average), while losing only $0 . 0 6 \%$ accuracy. Finally, Figure 4d shows how often each measure is triggered. Ideally, each measure should consist of a dark green triangle, as this would indicate that each configuration stops all the time. For this data set, we observe that our method stops for more parameter combinations than validation loss, but not as frequently for all of them. To ensure comparability across scenarios, we did not use the validation data as additional training data when stopping with neural persistence; we refer to Section A.7 for additional experiments in data scarcity scenarios. We observe that our method stops earlier when overfitting can occur, and it stops later when longer training is beneficial. + +# 5 DISCUSSION + +In this work, we presented neural persistence, a novel topological measure of the structural complexity of deep neural networks. We showed that this measure captures topological information that pertains to deep learning performance. Being rooted in a rich body of research, our measure is theoretically well-defined and, in contrast to previous work, generally applicable as well as computationally efficient. We showed that our measure correctly identifies networks that employ best practices such as dropout and batch normalization. Moreover, we developed an early stopping criterion that exhibits competitive performance while not relying on a separate validation data set. Thus, by saving valuable data for training, we managed to boost accuracy, which can be crucial for enabling deep learning in regimes of smaller sample sizes. Following Theorem 2, we also experimented with using the $p$ -norm of all weights of the neural network as a proxy for neural persistence. However, this did not yield an early stopping measure because it was never triggered, thereby suggesting that neural persistence captures salient information that would otherwise be hidden among all the weights of a network. We extended our framework to convolutional neural networks (see Section A.4) by deriving a closed-form approximation, and observed that an early stopping criterion based on neural persistence for convolutional layers will require additional work. Furthermore, we conjecture that assessing dissimilarities of networks by means of persistence diagrams (making use of higher-dimensional topological features), for example, will lead to further insights regarding their generalization and learning abilities. Another interesting avenue for future research would concern the analysis of the ‘function space’ learned by a neural network. On a more general level, neural persistence demonstrates the great potential of topological data analysis in machine learning. + +# REFERENCES + +Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mané, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems: Simple, end-to-end, LeNet-5-like convolutional MNIST model example, 2015. URL https://github.com/tensorflow/models/blob/master/ tutorials/image/mnist/convolutional.py. + +Alessandro Achille and Stefano Soatto. Emergence of invariance and disentanglement in deep representations. Journal of Machine Learning Research, 18:1–34, 2018. + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations (ICLR), 2015. + +Yoshua Bengio. Practical recommendations for gradient-based training of deep architectures. In Grégoire Montavon, Geneviève B. Orr, and Klaus-Robert Müller (eds.), Neural Networks: Tricks of the Trade, volume 7700 of Lecture Notes in Computer Science, pp. 437–478. Springer, Heidelberg, Germany, 2012. + +Monica Bianchini and Franco Scarselli. On the complexity of neural network classifiers: A comparison between shallow and deep architectures. IEEE Transactions on Neural Networks and Learning Systems, 25(8):1553–1565, 2014. + +Peter Bubenik. Statistical topological data analysis using persistence landscapes. Journal of Machine Learning Research, 16:77–102, 2015. + +Gunnar Carlsson and Facundo Mémoli. Characterization, stability and convergence of hierarchical clustering methods. Journal of Machine Learning Research, 11:1425–1470, 2010. + +Gunnar Carlsson, Tigran Ishkhanov, Vin de Silva, and Afra Zomorodian. On the local behavior of spaces of natural images. International Journal of Computer Vision, 76(1):1–12, 2008. + +Corrie J. Carstens and Kathy J. Horadam. Persistent homology of collaboration networks. Mathematical Problems in Engineering, 2013:815035, 2013. + +Travers Ching, Daniel S. Himmelstein, Brett K. Beaulieu-Jones, Alexandr A. Kalinin, Brian T. Do, Gregory P. Way, Enrico Ferrero, Paul-Michael Agapow, Michael Zietz, Michael M. Hoffman, Weil Xie, Gail L. Rosen, Benjamin J. Lengerich, Johnny Israeli, Jack Lanchantin, Stephen Woloszynek, Anne E. Carpenter, Avanti Shrikumar, Jinbo Xu, Evan M. Cofer, Christopher A. Lavender, Srinivas C. Turaga, Amr M. Alexandri, Zhiyong Lu, David J. Harris, Dave DeCaprio, Yanjun Qi, Anshul Kundaje, Yifan Peng, Laura K. Wiley, Marwin H.S. Segler, Simina M. Boca, S. Joshua Swamidass, Austin Huang, Anthony Gitter, and Casey S. Greene. Opportunities and obstacles for deep learning in biology and medicine. Journal of The Royal Society Interface, 15 (141):20170387, 2018. + +François Chollet et al. Keras. https://keras.io, 2015. + +David Cohen-Steiner, Herbert Edelsbrunner, and John Harer. Extending persistence using Poincaré and Lefschetz duality. Foundations of Computational Mathematics, 9(1):79–103, 2009. + +David Cohen-Steiner, Herbert Edelsbrunner, John Harer, and Yuriy Mileyko. Lipschitz functions have $\mathrm { L } _ { p }$ -stable persistence. Foundations of Computational Mathematics, 10(2):127–139, 2010. + +Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to algorithms. MIT Press, Cambridge, MA, USA, 3rd edition, 2009. + +Herbert Edelsbrunner and John Harer. Computational topology: An introduction. American Mathematical Society, Providence, RI, USA, 2010. + +Herbert Edelsbrunner, David Letscher, and Afra J. Zomorodian. Topological persistence and simplification. Discrete & Computational Geometry, 28(4):511–533, 2002. + +William H Guss and Ruslan Salakhutdinov. On characterizing the capacity of neural networks using algebraic topology. arXiv preprint arXiv:1802.04443, 2018. + +Kazuyuki Hara, Daisuke Saitoh, and Hayaru Shouno. Analysis of dropout learning regarded as ensemble learning. In Alessandro E.P. Villa, Paolo Masulli, and Antonio Javier Pons Rivero (eds.), Artificial Neural Networks and Machine Learning (ICANN), number 9887 in Lecture Notes in Computer Science, pp. 72–79, Cham, Switzerland, 2016. Springer. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016. + +Christoph Hofer, Roland Kwitt, Marc Niethammer, and Andreas Uhl. Deep learning with topological signatures. In Advances in Neural Information Processing Systems (NeurIPS), pp. 1633– 1643, 2017. + +Danijela Horak, Slobodan Maletic, and Milan Rajkovi ´ c. Persistent homology of complex networks.´ Journal of Statistical Mechanics: Theory and Experiment, 2009(03):P03034, 2009. + +Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7132–7141, 2018. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. 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. 448–456. PMLR, 2015. + +Valentin Khrulkov and Ivan Oseledets. Geometry score: A method for comparing generative adversarial networks. 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. 2621–2629. PMLR, 2018. + +Pek Y. Lum, Gurjeet Singh, Alan Lehman, Tigran Ishkanov, Mikael Vejdemo-Johansson, Muthu Alagappan, John Carlsson, and Gunnar Carlsson. Extracting insights from the shape of complex data using topology. Scientific Reports, 3:1–8, 2013. + +Grégoire Montavon, Wojciech Samek, and Klaus-Robert Müller. Methods for interpreting and understanding deep neural networks. Digital Signal Processing, 73:1–15, 2017. + +James R. Munkres. Elements of algebraic topology. CRC Press, Boca Raton, FL, USA, 1996. + +Maithra Raghu, Ben Poole, Jon Kleinberg, Surya Ganguli, and Jascha Sohl-Dickstein. On the expressive power of deep neural networks. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 2847–2854. PMLR, 2017. + +Alvin Rajkomar, Eyal Oren, Kai Chen, Andrew M. Dai, Nissan Hajaj, Michaela Hardt, Peter J Liu, Xiaobing Liu, Jake Marcus, Mimi Sun, et al. Scalable and accurate deep learning with electronic health records. npj Digital Medicine, 1(1):18, 2018. + +Pranav Rajpurkar, Jeremy Irvin, Kaylie Zhu, Brandon Yang, Hershel Mehta, Tony Duan, Daisy Ding, Aarti Bagul, Curtis Langlotz, Katie Shpanskaya, Matthew Lungren, and Andrew Y. Ng. CheXNet: Radiologist-level pneumonia detection on chest X-rays with deep learning. arXiv preprint arXiv:1711.05225, 2017. + +Bastian Rieck and Heike Leitte. Exploring and comparing clusterings of multivariate data sets using persistent homology. Computer Graphics Forum, 35(3):81–90, 2016. + +Bastian Rieck, Ulderico Fugacci, Jonas Lukasczyk, and Heike Leitte. Clique community persistence: A topological visual analysis approach for complex networks. IEEE Transactions on Visualization and Computer Graphics, 24(1):822–831, 2018. + +Andrew Michael Saxe, Yamini Bansal, Joel Dapello, Madhu Advani, Artemy Kolchinsky, Brendan Daniel Tracey, and David Daniel Cox. On the information bottleneck theory of deep learning. In International Conference on Learning Representations (ICLR), 2018. + +Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations (ICLR), 2015. + +Ann Sizemore, Chad Giusti, and Danielle S. Bassett. Classification of weighted networks through mesoscale homological features. Journal of Complex Networks, 5(2):245–273, 2017. + +Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. In Workshop Track of the International Conference on Learning Representations (ICLR), 2015. + +Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1):1929–1958, 2014. + +Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems (NeurIPS), pp. 3104–3112, 2014. + +Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. In IEEE Information Theory Workshop (ITW), pp. 1–5, 2015. + +Michael Tsang, Dehua Cheng, and Yan Liu. Detecting statistical interactions from neural network weights. In International Conference on Learning Representations (ICLR), 2018. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. + +Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-MNIST: A novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. + +Matthew D. Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In David Fleet, Tomas Pajdla, Bernt Schiele, and Tinne Tuytelaars (eds.), European Conference on Computer Vision (ECCV), volume 8689 of Lecture Notes in Computer Science, pp. 818–833, Cham, Switzerland, 2014. Springer. + +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations (ICLR), 2017. + +![](images/3e52dd21eada4c492671f91ce309b030920a0c5bd736bf94def65b29229b5621.jpg) +Figure A.1: Traditional graph measures (top), such as the clustering coefficient, fail to detect differences in the complexity of neural networks. Our novel neural persistence measure (bottom), by contrast, shows that trained networks with $\eta = 0 . 5$ (green), which have an accuracy of $\approx 0 . 9 1$ , obey a different distribution than networks trained with $\bar { \eta = 1 \times 1 0 ^ { - 0 . 5 } }$ (yellow), which have accuracies ranging from 0.38–0.65. + +# A APPENDIX + +# A.1 COMPARISON WITH GRAPH-THEORETICAL MEASURES + +Traditional complexity/structural measures from graph theory, such as the clustering coefficient, the average shortest path length, and global/local efficiency are already known to be insufficiently accurate to characterize different models of complex random networks Sizemore et al. (2017). Our experiments indicate that this holds true for (deep) neural networks, too. As a brief example, we trained a perceptron on the MNIST data set with batch stochastic gradient descent $\left( \eta = 0 . 5 \right)$ , achieving a test accuracy of $\approx 0 . 9 1$ . Moreover, we intentionally ‘sabotaged’ the training by setting $\eta = 1 \check { \times } 1 0 ^ { - 5 }$ such that SGD is unable to converge properly. This leads to networks with accuracies ranging from 0.38–0.65. A complexity measure should be capable of distinguishing both classes of networks. However, as Figure A.1 (top) shows, this is not the case for the clustering coefficient. Neural persistence (bottom), on the other hand, results in two regimes that can clearly be distinguished, with the trained networks having a significantly smaller variance. + +# A.2 PROOF OF THEOREM 2 + +Proof. We may consider the filtration from Section 3.1 to be a subset selection problem with constraints, where we select $n$ out of $m$ weights. The neural persistence $\mathrm { N P } ( G _ { k } )$ of a layer thus only depends on the selected weights that appear as tuples of the form $( 1 , w _ { i } )$ in $\mathcal { D } _ { k }$ . Letting $\widetilde { \mathbf { w } }$ denote the vector of selected weights arising from the persistence diagram calculation, we can rewrite neural persistence as $\mathrm { N P } ( G _ { k } ) = \| \mathbf { 1 } - \mathbf { \bar { w } } \| _ { p }$ . Furthermore, $\widetilde { \mathbf { w } }$ satisfies $\left\| \mathbf { w } _ { \mathrm { m i n } } \right\| _ { p } \leq \left\| \widetilde { \mathbf { w } } \right\| _ { p } \leq \left\| \mathbf { w } _ { \mathrm { m a x } } \right\| _ { p }$ . Since all transformed weights are non-negative in our filtration, it follows that (note the reversal of the two terms) + +$$ +\left\| \mathbb { 1 } - \mathbf { w } _ { \mathrm { m a x } } \right\| _ { p } \leq \mathrm { N P } ( G _ { k } ) \leq \left\| \mathbb { 1 } - \mathbf { w } _ { \mathrm { m i n } } \right\| _ { p } , +$$ + +and the claim follows. + +# A.3 ADDITIONAL VISUALIZATIONS AND ANALYSES FOR EARLY STOPPING + +Due to space constraints and the large number of configurations that we investigated for our early stopping experiments, this section contains additional plots that follow the same schematic: the top row shows the differences in accuracy and epoch for our measure when compared to the commonlyused validation loss. Each cell in the heatmap corresponds to a single configuration of $b$ and $g$ . In the heatmap of accuracy differences, blue represents parameter combinations for which we obtain a higher accuracy than validation loss for the same parameters; white indicates combinations for which we obtain the same accuracy, while red highlights combinations in which our accuracy decreases. Similarly, in the heatmap of epoch differences, green represents parameter combinations for which we stop earlier than validation loss for the same parameter. The scatterplots in + +Section 4.2 show an ‘unrolled’ version of this heat map, making it possible to count how many parameter combinations result in early stops while also increasing accuracy, for example. The heatmaps, by contrast, make it possible to compare the behaviour of the two measures with respect to each parameter combination. Finally, the bottom row of every plot shows how many times each measure was triggered for every parameter combination. We consider a measure to be triggered if its stopping condition is satisfied prior to the last training epoch. Due to the way the parameter grid is set up, no configuration above the diagonal can stop, because $b + g$ would be larger than the total number of training epochs. This permits us to compare the ‘slopes’ of cells for each measure. Ideally, each measure should consist of a dark green triangle, as this would indicate that parameter configuration stops all the time. + +MNIST Please refer to Figures A.2 and A.3. The colours in the difference matrix of the top row are slightly skewed because in a certain configuration, our measure loses $0 . 8 \%$ of accuracy when stopping. However, there are many other configurations in which virtually no accuracy is lost and in which we are able to stop more than four epochs earlier. The heatmaps in the bottom row again indicate that neural persistence is capable of stopping for more parameter combinations in general. We do not trigger as often for some of them, though. + +CIFAR-10 Please refer to Figure A.4. In general, we observe that this data set is more sensitive with respect to the parameters for early stopping. While there are several configurations in which neural persistence stops with an increase of almost $1 0 \%$ in accuracy, there are also scenarios in which we cannot stop training earlier, or have to train longer (up to 15 epochs out of 80 epochs in total). The second row of plots shows our measure triggers reliably for more configurations than validation loss. Overall, the scatterplot of all scenarios (Figure A.5) shows that most practical configurations are again located in $Q _ { 2 }$ and $Q _ { 3 }$ . While we may thus find certain configurations in which we reliably outperform validation loss as an early stopping criterion, we also want to point out that our measures behaves correctly for many practical configurations. Points in $Q _ { 1 }$ , where we train longer and achieve a higher accuracy, are characterized by a high patience $g$ of approximately 40 epochs and a low burn-in rate $b$ , or vice versa. This is caused by the training for CIFAR-10, which does not reliably converge for FCNs. Figure A.6 demonstrates this by showing loss curves and the mean normalized neural persistence curves of five runs over training (loss curves have been averaged over all runs; standard deviations are shown in grey; we show the first half of the training to highlight the behaviour for practical early stopping conditions). For ‘Fashion-MNIST’, we observe that NP exhibits clear change points during the training process, which can be exploited for early stopping. For ‘CIFAR- $1 0 ^ { \circ }$ , we observe a rather incremental growth for some runs (with no clearlydefined maximum), making it harder to derive a generic early stopping criterion that does not depend on fine-tuned parameters. Hence, we hypothesize that neural persistence cannot be used reliably in scenarios where the architecture is incapable of learning the data set. In the future, we plan to experiment with deliberately selected ‘bad’ and ‘good’ architectures in order to evaluate to what extent our topological measure is capable of assessing their suitability for training, but this is beyond the scope of this paper. + +IMDB Please refer to Figure A.7. For this data set, we observe that most parameter configurations result in earlier stopping (up to two epochs earlier than validation loss), with accuracy increases of up to $0 . 1 0 \%$ . This is also shown in the scatterplot A.8. Only a single configuration, viz. $g = 1$ and $b = 0$ , results in a severe loss of accuracy; we removed it from the scatterplot for reasons of clarity, as its accuracy difference of $- 2 1 \%$ would skew the display of the remaining configurations too much (this is also why the legends do not include this outlier). + +![](images/3c35bb3f6c7ef24944b74841f095b5f90fbd6f7cdbf07049bc491d04e749f8f5.jpg) +Figure A.2: Additional visualizations for the ‘MNIST’ data set. + +![](images/dade82f5a59e26da4e6229460c3bf2b51843e076b4828b36555b73ddb7be5997.jpg) +Figure A.3: Scatterplot of epoch and accuracy differences for ‘MNIST’. + +![](images/f8c1a9edcca286843f5c9ba4338c7071b5889eb1d456fa99ba675663f8fef2f5.jpg) +Figure A.4: Additional visualizations for the ‘CIFAR-10’ data set. + +![](images/3823b45065ae166356b058d5fdc184013f5abfa5595c796058a7dfc834b5d868.jpg) +Figure A.5: Scatterplot of epoch and accuracy differences for ‘CIFAR-10’. + +![](images/8e60a305363104862081f30ebbe69323e6dbe30d0397dbd9e23d401631eb06dc.jpg) +Figure A.6: A comparison of mean normalized neural persistence curves that we obtain during the training of ‘CIFAR- $1 0 ^ { \circ }$ and ‘Fashion-MNIST’. + +![](images/73518b88c21afd754d599613ebc01d9ca337ba21fb40633648ca9011f94eed11.jpg) +Figure A.7: Additional visualizations for the ‘IMDB’ data set. + +![](images/3611e7cce2c434d8d4ba7ccbf593414b6102ba67172f89a0120c280f537e1c70.jpg) +Figure A.8: Scatterplot of epoch and accuracy differences for ‘IMDB’. + +# A.4 NEURAL PERSISTENCE FOR CONVOLUTIONAL LAYERS + +In principle, the proposed filtration process could be applied to any bipartite graph. Hence, we can directly apply our framework to convolutional layers, provided we represent them properly. Specifically, for layer $l$ we represent the convolution of its ith input feature map $a _ { i } ^ { ( l - 1 ) } \in \overline { { \mathbb { R } ^ { h _ { \mathrm { i n } } \times w _ { \mathrm { i n } } } } }$ with the $j$ th filter $H _ { j } \in \mathbb { R } ^ { p \times q }$ as one bipartite graph $G _ { i , j }$ parametrized by a sparse weight matrix $W _ { i , j } ^ { ( l ) } \ \in \ \mathbb { R } ^ { ( h _ { \mathrm { o u t } } \cdot w _ { \mathrm { o u t } } ) \times ( h _ { \mathrm { i n } } \cdot w _ { \mathrm { i n } } ) }$ , which in each row contains the $p \cdot q$ unrolled values of $H _ { j }$ on the diagonal, with $h _ { \mathrm { i n } } \ : - \ : p$ zeros padded in between after each $p$ values of $\mathrm { v e c } ( H _ { j } )$ . This way, the flattened pre-activation can be described as $\begin{array} { r } { \mathrm { v e c } ( z _ { i , j } ^ { ( l ) } ) = W _ { i , j } ^ { ( l ) } \cdot \mathrm { v e c } ( a _ { i } ^ { ( l - 1 ) } ) + b _ { i , j } ^ { l } \cdot \mathbb { 1 } _ { ( h _ { \mathrm { o u t } } \cdot w _ { \mathrm { o u t } } ) \times 1 } . } \end{array}$ + +Since flattening does not change the topology of our bipartite graph, we compute the normalized neural persistence on this sparse weight matrix W (l)i,j as the unrolled analogue of the fully-connected network’s weight matrix. Averaging over all filters then gives a per-layer measure, similar to the way we derived mean normalized neural persistence in the main paper. + +When studying the unrolled adjacency matrix can be approximated in a closed form. Spe $W _ { i , j } ^ { ( l ) }$ , it becolly, for es cleand that the edge filtration processinput and output neurons we $m$ $n$ +initialize $\tau = m + n$ connected components. When using zero padding, the additional dummy input +neurons have to included in $m$ . For all $\tau$ tuples in the persistence diagram the creation event $c = 1$ . +Notably, each output neuron shares the same set of edge weights. + +Due to this, the destruction events—except for a few special cases—simplify to a list of length $\tau$ containing the largest filter values (each value is contained $n$ times) in descending order until the list is filled. This simplification of neural persistence of a convolution with one filter is shown as a closed expression in Equations 7–11, and our implementation is sketched in Algorithm 3. We thus obtain + +where we use + +$$ +\begin{array} { r l } & { \mathrm { N P } ( G _ { i , j } ) = \| \mathbb { 1 } - \widetilde { \mathbf { w } } \| _ { p } , } \\ & { } \\ & { \| \widetilde { \mathbf { w } } \| _ { p } \leq \left\| \left( 0 , \mathbf { w } _ { c } ^ { T } , \mathbf { w } _ { \bar { c } , \phi } ^ { T } , \mathrm { v e c } ( A _ { \phi } ) ^ { T } , \mathrm { v e c } ( B _ { \phi } ) ^ { T } \right) ^ { T } \right\| _ { p } , } \end{array} +$$ + +with + +$$ +\begin{array} { r l } & { \quad \phi = \tau - \dim ( \mathbf { w } _ { c } ) - 1 , } \\ & { \quad A _ { x } = \mathbf { w } _ { 1 : \left\lfloor \frac { x } { n } \right\rfloor } \otimes \mathbb { 1 } _ { n - 1 } , } \\ & { \quad B _ { y } = \mathbf { w } _ { \left\lfloor \frac { y } { n } \right\rfloor + 1 } \otimes \mathbb { 1 } _ { y \mathrm { ~ m o d ~ } n } , } \end{array} +$$ + +where $\mathbf { 1 } _ { 0 } : = 0$ . Following this notation, Equation 7 expresses neural persistence of the bipartite graph $G _ { i , j }$ , with $\widetilde { \mathbf { w } }$ denoting the vector of selected weights (i.e. the destruction events) when calculating the persistence diagram. We use w to denote the flattened and sorted weight values (in descending order) of the convolutional filter $H _ { j }$ , while ${ \bf w } _ { c }$ represents the vector of all weights that are located in a corner of $H _ { j }$ , whereas $\mathbf { w } _ { \bar { c } , \phi }$ is the vector of all weights which do not originate from the corner of the filter while still belonging to the first (and thus largest) $\textstyle { \left\lfloor { \frac { \phi } { n } } \right\rfloor }$ weights in w, which we denote by w1:⌊ ϕ ⌋. + +For the subsequent experiments (see below), we use a simple CNN that employs $3 2 + 2 0 4 8$ filters. Hence, by using the shortcut described above, we do not have to unroll 2080 weight matrices explicitly, thereby gaining both in memory efficiency and run time, as compared to the naive approach: on average, a naive exact computation based on unrolling required 8.77 s per convolutional filter and evaluation step, whereas the approximation only took about 0.000 38 s while showing very similar behaviour up to a constant offset. + +For our experiments, we used an off-the-shelf ‘LeNet-like’ CNN model architecture (two convolutional layers each with max pooling and ReLU, 1 fully-connected and softmax) as described in Abadi et al. (2015). We trained the model on ‘Fashion-MNIST’ and included this setup in the early stopping experiments (100 runs of 20 epochs). In Figure A.9, we observe that stopping based on the neural persistence of a convolutional layer typically only incurs a considerable loss of accuracy: given a final test accuracy of $9 1 . 7 3 { \pm } 0 . 1 3 $ , stopping with this naive extension of our measure reduces accuracy by up to $4 \%$ . Furthermore, in contrast to early stopping on a fully-connected architecture, we do not observe any parameter combinations that stop early and increase accuracy. In fact, there is no configuration that results in an increased accuracy. This empirically confirms our theoretical scepticism towards naively applying our edge-focused filtration scheme to CNNs. + +
Algorithm 3 Approximating Neural Persistence of Convolutions per filter
Require: filter H ∈ RpXq; number of input and output neurons as m, n 1:T←0>Initialize set of tuples for persistence diagram
2:T↑m+n,t←0,i←0 3:hmax ←maXh∈H |hlInitialize number of tuples, tuple counter, weight index Determine largest absolute weight
4:H'← {|h|/hmax|h∈H}>Transform weights for filtration
5:s ← sort(vec(H')) Sort weights in descending order
6: H' ← {h,o,h',q-1,hp-1,o,hp-1,q-1}DDetermine the set of all corner weights of flter H'
7:T←(1,0),t←t+1Add tuple for surviving component
8:1 forh'∈H'do T←(1,h),t←t+1>Each corner of H'merges components
9: 10: end for
11: while 1 do Create the remaining tuples (Approximation step)
12: n' = n-Ind(s[i] ∈H')>if current weight is a corner weight, write one less tuple
13: ift+n'≤τthen√if there are at least n' more tuples, set their merge value to s[i]
14:repeat n' times
15:
T ←(1,s[i])>approximative as s[i] does not always add n' merges due to loops
16:t←t+n',i←𝑖+1
17: else>otherwise,process the remaining tuples similarly
18:
repeat (T - t) times
19:
T←(1,s[])
20:break
21:
end if
22: end while
23:1
return |/Tllp
+ +# A.5 RELATIONSHIP BETWEEN NEURAL PERSISTENCE AND VALIDATION ACCURACY + +Motivated by Figure 2, which shows the different ‘regimes’ of neural persistence for a perceptron network, we investigate a possible correlation of (high) neural persistence with (high) predictive accuracy. For deeper networks, we find that neural persistence measures structural properties that arise from different parameters (such as training procedures or initializations), and no correlation can be observed. + +For our experiments, we constructed neural networks with a high neural persistence prior to training. More precisely, following the theorems in this paper, we initialized most weights of each layer with very low values and reserved high values for very few weights. This was achieved by sampling the weights from a beta distribution with $\alpha = 0 . 0 0 5$ and $\beta = 0 . 5$ . Using this procedure, we are able to initialize [20,20,20] networks with $\overline { { \mathrm { N P } } } \approx 0 . 9 0 \pm 0 . 0 0 3$ compared to the same networks that have $\overline { { \mathrm { N P } } } \approx 0 . 3 \bar { 8 } \pm 0 . 0 0 \bar { 4 }$ when initialized by Xavier initialization. The mean validation accuracy of these untrained networks on the ‘Fashion-MNIST’ data set is $0 . 1 0 \pm 0 . 0 1$ and $0 . 0 9 \pm 0 . 0 3$ , respectively. + +Figure A.10 depicts how both types of networks converge to similar regimes of validation accuracy, while the mean normalized neural persistence achieved at the end of the training varies. For networks initialized with high $\overline { { \mathrm { N P } } }$ (Figure A.10, left) the validation accuracy of networks with final $0 . 9 \ \leq$ $\overline { { \mathrm { N P } } } \leq 0 . 9 5$ ranges from 0.098 (not shown) to 0.863. For Xavier initialization (Figure A.10, right), the lack of correlation can also be observed. Furthermore, comparing the two plots, there are no clear advantages in initializing networks with high $\overline { { \mathrm { N P } } }$ . This observation further motivates the proposed early stopping criterion, which checks for changes in the $\overline { { \mathrm { N P } } }$ value, and considers stagnating values to be indicative of a trained network. + +![](images/0f4da7ab39911f187339e80293439ac5ed40e12e6a68dcacbe4b572236aa3a5c.jpg) +Figure A.9: Additional visualizations for the ‘Fashion-MNIST’ data set, following the preliminary examination of convolutional layers. Here, the approximated neural persistence calculation for the first convolutional layer was used. However, we also ran few runs of the same experiment using the exact method which showed the same results. Employing the second convolutional layer or both did not improve this result. + +![](images/6907ceb2f79c4dba533ed81668eb118945c98a72085796636c01e8253b8a5539.jpg) +Figure A.10: Each cluster of points represent the last two training epochs (sampled every quarter epoch) of a [20,20,20] network trained on the ‘Fashion-MNIST’ data set. We observe no correlation between validation accuracy and normalized total persistence + +![](images/6dcaf0b038fb584d1b6ff53038410f5357a2482160960ade2ab1cef55b9ba638.jpg) +Figure A.11: (left) Histogram of the final normalized neural persistence of a [50, 50, 20] network for 100 runs and 25 epochs of training. (right) Normalized neural persistence after 15 epochs of training on MNIST for different architectures with increasing depth. Deeper architectures are denoted as $[ n \times 2 0 ]$ where $n$ is the number of hidden layers. + +# A.6 NEURAL PERSISTENCE FOR DIFFERENT DATA DISTRIBUTIONS AND DEEPER FCN ARCHITECTURES + +Neural persistence captures information about different data distributions during training. The weights tuned via backpropagation are directly influenced by the input data (as well as their labels) and neural persistence tracks those changes. To demonstrate this, we trained the same architecture , i.e. [50, 50, 20], on two data sets with the same dimensions but different properties: MNIST and ‘Fashion-MNIST’. Each data set has the same image size $2 8 \times 2 8$ pixels, one channel) but lay on different manifolds. Figure A.11 (left) shows a histogram of the mean normalized neural persistence $( \overline { { \mathrm { N P } } } )$ after 25 epochs of training over 100 different runs. The distributions have a similar shape but are shifted, indicating that the two datasets lead the network to different topological regimes. + +We also investigated the effect of depth on neural persistence. We selected a fixed layer size (20 hidden units) and increased the number of hidden layers. Figure A.11 (right) depicts the boxplots of mean $\overline { { \mathrm { N P } } }$ for multiple architectures after 15 epochs of training on MNIST. Adding layers initially increases the variability of $\overline { { \mathrm { N P } } }$ by enabling the network to converge to different regimes (essentially, there are many more valid configurations in which a trained neural network might end up in). However, this effect is reduced after a certain depth: networks with deeper architectures exhibit less variability in $\overline { { \mathrm { N P } } }$ . + +# A.7 EARLY STOPPING IN DATA SCARCITY SCENARIOS + +Labelled data is expensive in most domains of interest, which results in small data sets or low quality of the labels. We investigate the following experimental set-ups: (1) Reducing the training data set size and (2) Permuting a fraction of the training labels. We train a fully connected network ([500, 500, 200] architecture) on ‘MNIST’ and ‘Fashion-MNIST’. In the experiments, we compare the following measures for stopping the training: i) Stopping at the optimal test accuracy. ii) Fixed stopping after the burn in period. iii) Neural persistence patience criterion. iv) Training loss patience criterion. v) Validation loss patience criterion. For a description of the patience criterion, see Algorithm 2. All measures, except validation loss, include the validation datasets $( 2 0 \% )$ in the training process to simulate a larger data set when no cross-validation is required. We report the accuracy on the non-reduced, non-permuted test sets. The batch size is 32 training instances. The stopping measures are evaluated every quarter epoch. + +Figure A.12 shows the results averaged over 10 runs (the error is the standard deviation). The difference between the top and the bottom panel is the data set and the patience parameters. The $x$ -axis depicts the fraction of the data set, which is warped for better accessibility. In each panel, the left-hand side subplots depict the results of the reduced data set experiment where the right-hand side subplots depict the result of the permutation experiments. The $y$ -axis of the top subplot shows the accuracy on the non-reduced, non-permuted test set. The $y$ -axis of the bottom subplot shows when the stopping criterion was triggered. + +We note the following observations, which hold for both panels: More, non-permuted data yields higher test accuracy. Also, as expected, the optimal stopping gives the highest test accuracy. The fixed early stopping results in inferior test accuracy when only a fraction of the data is available. The neural persistence based stopping is triggered late when only a fraction of the data is available which results in a slightly better test accuracy compared to training and validation loss. The training loss stopping achieves similar test accuracies compared to the persistence based stopping (for all regimes except the very small data set) with shorter training, on average. We note that, it is generally not advisable to use training loss as a measure for stopping because the stability of this criterion also depends on the batch size. When only a fraction of the data is available, the validation loss based stopping stops on average after the same number of training epochs as the training loss, which results in inferior test accuracy because the network has seen in total fewer training samples. Most strikingly, validation loss based stopping is is triggered later (sometimes never) when most training and validation labels are randomly permuted which results in overfitting and poor test accuracy. + +To conclude, the neural persistence based stopping achieves good performance without being affected by the batch size and noisy labels. The authors also note that the result is consistent for multiple architectures and most patience parameters. + +![](images/002bb226eb263258dfac45a8e4d8b8499578006850c5d35eaa68b40876a0374e.jpg) +Figure A.12: On MNIST and Fashion-MNIST $\overline { { \mathrm { N P } } }$ (in blue) stops later than validation and training loss when fewer training samples are available (left-hand side) which results in a higher test accuracy. For increasing noise in the training labels (right-hand side), the stopping of $\overline { { \mathrm { N P } } }$ remains stable, in contrast to the validation loss stopping, which leads to lower test accuracy after longer training at a high fraction of permuted labels. The patience and burn in parameters are reported in quarter epochs. + +
saaarrreirerg Thit rtrer iTrile sarelieg Jrrinti Aeeeetrect 8-01 ×[=ə'666:0= °‘60= £0000 =น8-O1 x[=96660= °g60= g g-01×[=น 28 28 IMRR
90=u8-01 ×[=ə666:0= °g 6'0= 1£0000=4
3W4pa 44pa
[001000] 40[008'000'008] [9149871] 25
18
5
[TILTINI(-UTIT0)1 CIATIIIT
srprsg#sanr# JateterW4pa [0700005] [01000000]
rrndeeied
+ + += 0.0003 + 10 = 0.0003 + 10 + = 0.0003 + 10 3 40 + +![](images/5fb0d945b6f506294d1bcaa94a8c1c0527dbc594219e443c9b4cb24193f89d70.jpg) +Figure A.13: Comparison of test set accuracy for trained networks without modifications (green), with batch normalization (yellow), and with $50 \%$ of the neurons dropped out during training (red) for the MNIST data set. + +# A.8 TESTING ACCURACY OF DIFFERENTLY REGULARIZED MODELS + +We showed in the main text that neural persistence is capable of distinguishing between networks trained with/without batch normalization and/or dropout. Figure A.13 additionally shows test set accuracies. \ No newline at end of file diff --git a/md/train/E4PK0rg2eP/E4PK0rg2eP.md b/md/train/E4PK0rg2eP/E4PK0rg2eP.md new file mode 100644 index 0000000000000000000000000000000000000000..6c2858be4cbdd9f1fd0ea45ddf7b00f0121f7b1e --- /dev/null +++ b/md/train/E4PK0rg2eP/E4PK0rg2eP.md @@ -0,0 +1,328 @@ +# PARAMETER-EFFICIENT TRANSFER LEARNING WITH DIFF PRUNING + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +While task-specific finetuning of deep networks pretrained with self-supervision has led to significant empirical advances in NLP, their large size makes the standard finetuning approach difficult to apply to multi-task, memory-constrained settings, as storing the full model parameters for each task become prohibitively expensive. We propose diff pruning as a simple approach to enable parameterefficient transfer learning within the pretrain-finetune framework. This approach views finetuning as learning a task-specific “diff” vector that is applied on top of the pretrained parameter vector, which remains fixed and is shared across different tasks. The diff vector is adaptively pruned during training with a differentiable approximation to the $L _ { 0 }$ -norm penalty to encourage sparsity. Diff pruning becomes parameter-efficient as the number of tasks increases, as it requires storing only the nonzero positions and weights of the diff vector for each task, while the cost of storing the shared pretrained model remains constant. We find that models finetuned with diff pruning can match the performance of fully finetuned baselines on the GLUE benchmark while only modifying $0 . 5 \%$ of the pretrained model’s parameters per task. + +# 1 INTRODUCTION + +Task-specific finetuning of pretrained deep networks has become the dominant paradigm in contemporary NLP, achieving state-of-the-art results across a suite of natural language understanding tasks (Devlin et al., 2019; Liu et al., 2019c; Yang et al., 2019; Lan et al., 2020). While straightforward and empirically effective, this approach is difficult to scale to multi-task, memory-constrained settings (e.g. for on-device applications), as it requires shipping and storing a full set of model parameters for each task. Inasmuch as these models are learning generalizable, task-agnostic language representations through self-supervised pretraining, finetuning the entire model for each task is an especially inefficient use of model parameters. + +A popular approach to parameter-efficiency is to learn sparse models for each task where a subset of the final model parameters are exactly zero (Gordon et al., 2020; Sajjad et al., 2020; Zhao et al., 2020; Sanh et al., 2020). Such approaches often face a steep sparsity/performance tradeoff, and a substantial portion of nonzero parameters (e.g. $10 \% { - } 3 0 \% )$ ) are still typically required to match the performance of the dense counterparts. An alternative is to use multi-task learning or feature-based transfer for more parameter-efficient transfer learning with pretrained models (Liu et al., 2019b; Clark et al., 2019; Stickland & Murray, 2019; Reimers & Gurevych, 2019; Feng et al., 2020). These methods learn only a small number of additional parameters (e.g. a linear layer) on top of a shared model. However, multi-task learning generally requires access to all tasks during training to prevent catastrophic forgetting (French, 1999), while feature-based transfer learning (e.g. based on taskagnostic sentence representations) is typically outperformed by full finetuning (Howard & Ruder, 2018). + +Adapters (Rebuffi et al., 2018) have recently emerged as a promising approach to parameterefficient transfer learning within the pretrain-finetune paradigm (Houlsby et al., 2019; Pfeiffer et al., 2020a;b;c). Adapter layers are smaller, task-specific modules that are inserted between layers of a pretrained model, which remains fixed and is shared across tasks. These approaches do not require access to all tasks during training making them attractive in settings where one hopes to obtain and share performant models as new tasks arrive in stream. Houlsby et al. (2019) find that adapter layers trained on BERT can match the performance of fully finetuned BERT on the GLUE benchmark (Wang et al., 2019a) while only requiring $3 . 6 \%$ additional parameters (on average) per task. + +In this work, we consider a similar setting as adapters but propose a new diff pruning approach with the goal of even more parameter-efficient transfer learning. Diff pruning views finetuning as learning a task-specific difference vector that is applied on top of the pretrained parameter vector, which remains fixed and is shared across different tasks. In order to learn this vector, we reparameterize the task-specific model parameters as $\theta _ { \mathrm { t a s k } } = \theta _ { \mathrm { p r e t r a i n e d } } + \delta _ { \mathrm { t a s k } }$ , where the pretrained parameter vector $\theta _ { \mathrm { p r e t r a i n e d } }$ is fixed and the task-specific diff vector $\delta _ { \mathrm { t a s k } }$ is finetuned. The diff vector is regularized with a differentiable approximation to the $L _ { 0 }$ -norm penalty (Louizos et al., 2018) to encourage sparsity. This approach can become parameter-efficient as the number of tasks increases as it only requires storing the nonzero positions and weights of the diff vector for each task. The cost of storing the shared pretrained model remains constant and is amortized across multiple tasks. On the GLUE benchmark (Wang et al., 2019a), diff pruning can match the performance of the fully finetuned BERT baselines while finetuning only $0 . 5 \%$ of the pretrained parameters per task, making it a potential alternative to adapters for parameter-efficient transfer learning. + +# 2 BACKGROUND: TRANSFER LEARNING FOR NLP + +The field of NLP has recently seen remarkable progress through transfer learning with a pretrainand-finetune paradigm, which initializes a subset of the model parameters for all tasks from a pretrained model and then finetunes on a task specific objective. Pretraining objectives include context prediction (Mikolov et al., 2013), autoencoding (Dai & Le, 2015), machine translation (McCann et al., 2017), and more recently, variants of language modeling (Peters et al., 2018; Radford et al., 2018; Devlin et al., 2019) objectives. + +Here we consider applying transfer learning to multiple tasks. We consider a setting with a potentially unknown set of tasks, where each $\tau \in \mathcal { T }$ has an associated training set $\{ x _ { \tau } ^ { ( n ) } , y _ { \tau } ^ { ( n ) } \} _ { n = 1 } ^ { N }$ 1 For . all tasks, the goal is to produce (possibly tied) model parameters to minimize the empirical risk, + +$$ +\operatorname* { m i n } _ { \pmb { \theta } _ { \tau } } \ \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathcal { L } \left( f ( x _ { \tau } ^ { ( n ) } ; \pmb { \theta } _ { \tau } ) , y _ { \tau } ^ { ( n ) } \right) + \lambda R ( \pmb { \theta } _ { \tau } ) +$$ + +where $f ( \cdot ; \pmb \theta )$ is a parameterized function over the input (e.g. a neural network), $\mathcal L ( \cdot , \cdot )$ is a loss function (e.g. cross-entropy), and $R ( \cdot )$ is an optional regularizer with hyperparameter $\lambda$ . + +This multi-task setting can use the pretrain-then-finetune approach by simply learning independent parameters for each task; however the large size of pretrained models makes this approach exceedingly parameter inefficient. For example, widely-adopted models such as BERTBASE and BERTLARGE have 110M and 340M parameters respectively, while their contemporaries such as T5 (Raffel et al., 2020), Megatron-LM (Shoeybi et al., 2019), and Turing-NLG (Rajbhandari et al., 2019) have parameter counts in the billions. Storing the fully finetuned models becomes difficult even for a moderate number of tasks.2 A classic approach to tackling this parameterinefficiency (Caruana, 1997) is to train a single shared model (along with a task-specific output layer) against multiple tasks through joint training. However, the usual formulation of multi-task learning requires the set of tasks $\tau$ to be known in advance in order to prevent catastrophic forgetting (French, 1999),3 making it unsuitable for applications in which the set of tasks is unknown (e.g. when tasks arrive in stream). + +# 3 DIFF PRUNING + +Diff pruning formulates task-specific finetuning as learning a diff vector $\delta _ { \tau }$ that is added to the pretrained model parameters $\theta _ { \mathrm { p r e t r a i n e d } }$ . We first reparameterize the task-specific model parameters, + +$$ +\begin{array} { r } { \pmb { \theta } _ { \tau } = \pmb { \theta } _ { \mathrm { p r e t r a i n e d } } + \delta _ { \tau } , } \end{array} +$$ + +which results in the following empirical risk minimization problem, + +$$ +\operatorname* { m i n } _ { \delta _ { \tau } } \ \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathcal { L } \left( f ( x _ { \tau } ^ { ( n ) } ; \theta _ { \mathrm { p r e t r a i n e d } } + \delta _ { \tau } ) , y _ { \tau } ^ { ( n ) } \right) + \lambda R ( \theta _ { \mathrm { p r e t r a i n e d } } + \delta _ { \tau } ) . +$$ + +This trivial reparameterization is equivalent to the original formulation. Its benefit comes in the multi-task setting where the cost of storing the pretrained parameters $\theta _ { \mathrm { p r e t r a i n e d } }$ is amortized across tasks, and the only marginal cost for new tasks is the diff vector. If we can regularize $\delta _ { \tau }$ to be sparse such that $\lVert \delta _ { \tau } \rVert _ { 0 } \ll \lVert \bar { \pmb { \theta } } _ { \mathrm { p r e t r a i n e d } } \rVert _ { 0 }$ , then this approach can become more parameter-efficient as the number of tasks increases. We can specify this goal with an $L _ { 0 }$ -norm penalty on the diff vector, + +$$ +R ( \theta _ { \mathrm { p r e t r a i n e d } } + \delta _ { \tau } ) = \| \pmb { \delta } _ { \tau } \| _ { 0 } = \sum _ { i = 1 } ^ { d } \mathbb { 1 } \{ \pmb { \delta } _ { \tau , i } \neq 0 \} . +$$ + +# 3.1 DIFFERENTIABLE APPROXIMATION TO THE $L _ { 0 }$ -NORM + +This regularizer is difficult to directly optimize as it is non-differentiable. In order to approximate this $L _ { 0 }$ objective, we follow the standard approach for gradient-based learning with $L _ { 0 }$ sparsity using a relaxed mask vector (Louizos et al., 2018). This approach involves relaxing a binary vector into continuous space, and then multiplying it with a dense weight vector to determine how much of the weight vector is applied during training. After training, the mask is deterministic and a large portion of the diff vector is true zero. + +To apply this method we first decompose $\delta _ { \tau }$ into a binary mask vector multiplied with a dense vector, + +$$ +\begin{array} { r } { \delta _ { \tau } = \mathbf { z } _ { \tau } \odot \mathbf { w } _ { \tau } , \qquad \mathbf { z } _ { \tau } \in \{ 0 , 1 \} ^ { d } , \mathbf { w } _ { \tau } \in \mathbb { R } ^ { d } } \end{array} +$$ + +We can now instead optimize an expectation with respect to ${ \bf z } _ { \tau }$ , whose distribution $p ( \mathbf { z } _ { \tau } ; \pmb { \alpha } _ { \tau } )$ is initially Bernoulli with parameters $\pmb { \alpha } _ { \tau }$ , + +$$ +\operatorname* { m i n } _ { \alpha _ { \tau } , \mathbf { w } _ { \tau } } \mathbb { E } _ { \mathbf { z } _ { \tau } \sim p ( \mathbf { z } _ { \tau } ; \alpha _ { \tau } ) } \left[ \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathcal { L } \left( f ( x _ { \tau } ^ { ( n ) } ; \boldsymbol { \theta } _ { \mathrm { p r e t r a i n e d } } + \mathbf { z } _ { \tau } \odot \mathbf { w } _ { \tau } , ) , y _ { \tau } ^ { ( n ) } \right) + \lambda \lVert \delta _ { \tau } \rVert _ { 0 } \right] . +$$ + +This objective is still difficult in practice due to ${ \bf z } _ { \tau }$ ’s being discrete (which requires the score function gradient estimator), but the expectation provides some guidance for empirically effective relaxations. We follow prior work (Louizos et al., 2018; Wang et al., 2019b) and relax ${ \bf z } _ { \tau }$ into continuous space $[ 0 , 1 ] ^ { d }$ with a stretched Hard-Concrete distribution (Jang et al., 2017; Maddison et al., 2017), which allows for the use of pathwise gradient estimators. Specifically, ${ \bf z } _ { \tau }$ is now defined to be a deterministic and (sub)differentiable function of a sample $\mathbf { u }$ from a uniform distribution, + +$$ +\begin{array} { r } { \mathbf { u } \sim U ( \mathbf { 0 } , \mathbf { 1 } ) , \qquad \mathbf { s } _ { \tau } = \sigma \left( \log \mathbf { u } - \log ( 1 - \mathbf { u } ) + \alpha _ { \tau } \right) , } \\ { \bar { \mathbf { s } } _ { \tau } = \mathbf { s } _ { \tau } \times ( r - l ) + l , \qquad \mathbf { z } _ { \tau } = \operatorname* { m i n } ( \mathbf { 1 } , \operatorname* { m a x } ( \mathbf { 0 } , \bar { \mathbf { s } } _ { \tau } ) ) . } \end{array} +$$ + +Here $l < 0$ and $r > 1$ are two constants used to stretch ${ \bf s } _ { \tau }$ into the interval $( l , r ) ^ { d }$ before it is clamped to $[ 0 , 1 ] ^ { d }$ with the $\operatorname* { m i n } ( \mathbf { 1 } , \operatorname* { m a x } ( \mathbf { 0 } , \cdot ) )$ operation. In this case we have a differentiable closed-form expression for the expected $L _ { 0 }$ -norm, + +$$ +\mathbb { E } \left[ \left. \pmb { \delta } _ { \tau } \right. _ { 0 } \right] = \sum _ { i = 1 } ^ { d } \mathbb { E } \left[ \mathbb { 1 } \left\{ \mathbf { z } _ { \tau , i } > 0 \right\} \right] = \sum _ { i = 1 } ^ { d } \sigma \left( \alpha _ { \tau , i } - \log \frac { - l } { r } \right) . +$$ + +Thus the final optimization problem is given by, + +$\operatorname* { m i n } _ { \tau _ { \tau } , \mathbf { w } _ { \tau } } \mathbb { E } _ { \mathbf { u } \sim U [ \mathbf { 0 } , 1 ] } \left[ \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathcal { L } \left( f ( x _ { \tau } ^ { ( n ) } ; \boldsymbol { \theta } _ { \mathrm { p r e r a i n e d } } + \mathbf { z } _ { \tau } \odot \mathbf { w } _ { \tau } , ) , y _ { \tau } ^ { ( n ) } \right) \right] + \lambda \sum _ { i = 1 } ^ { d } \sigma \left( \alpha _ { \tau , i } - \log \frac { - l } { r } \right) ,$ and we can now utilize pathwise gradient estimators to optimize the first term with respect to $\pmb { \alpha } _ { \tau }$ since the expectation no longer depends on it.4 After training we obtain the final diff vector $\delta _ { \tau }$ by sampling $\mathbf { u }$ once to obtain ${ \bf z } _ { \tau }$ (which is not necessarily a binary vector but has a significant number of dimensions equal to exactly zero due to the clamping function), then setting $\pmb { \delta } _ { \tau } = \mathbf { z } _ { \tau } \odot \mathbf { w } _ { \tau }$ . 5 + +3.2 $L _ { 0 }$ -BALL PROJECTION WITH MAGNITUDE PRUNING FOR SPARSITY CONTROL + +Differentiable $L _ { 0 }$ regularization provides a strong way to achieve high sparsity rate. However, it would be ideal to have more fine-grained control into the exact sparsity rate in the diff vector, especially considering applications which require specific parameter budgets. As $\lambda$ is just the Lagrangian multiplier for the constraint $\mathbb { E } \left[ \lVert \pmb { \delta } _ { \tau } \rVert _ { 0 } \right] < \eta$ for some $\eta$ , this could be achieved in principle by searching over different values of $\lambda$ . However we found it more efficient and empirically effective to achieve an exact sparsity rate by simply projecting onto the $L _ { 0 }$ -ball after training. + +Specifically we use magnitude pruning on the diff vector $\delta _ { \tau }$ and target a sparsity rate $t \%$ by only keeping the top $t \% \times \bar { d }$ values in $\delta _ { \tau }$ .6 Note that unlike standard magnitude pruning, this is based on the magnitude of the diff vector values and not the model parameters. As is usual in magnitude pruning, we found it important to further finetune $\delta _ { \tau }$ with the nonzero masks fixed to maintain good performance (Han et al., 2016). Since this type of parameter-efficiency through projection onto the $L _ { 0 }$ -ball can be applied without adaptive diff pruning,7 such an approach will serve as one of our baselines in the empirical study. + +# 3.3 STRUCTURED DIFF PRUNING + +Diff pruning, as presented above, is architecture-agnostic and does not exploit the underlying model structure—each dimension of ${ \bf z } _ { \tau }$ is independent from one another. While this makes the approach potentially more flexible, we might expect to achieve better sparsity/performance tradeoff through a structured formulation which encourages active parameters to group together and other areas to be fully sparse. Motivated by this intuition, we first partition the parameter indices into $G$ groups $\{ g ( 1 ) , \ldots , g ( G ) \}$ where $g ( j )$ is a subset of parameter indices governed by group $g ( j )$ .8 We then introduce a scalar $\mathbf { z } _ { \tau } ^ { j }$ (with the associated parameter $\alpha _ { \tau } ^ { j }$ ) for each group $g ( j )$ , and decompose the task-specific parameter for index $i \in g ( j )$ as $\begin{array} { r } { \delta _ { \tau , i } ^ { j } = \mathbf { z } _ { \tau , i } \times \mathbf { z } _ { \tau } ^ { j } \times \mathbf { w } _ { \tau , i } . } \end{array}$ The expected $L _ { 0 }$ -norm is then given by, + +$$ +\Sigma \left[ \left. \delta _ { \tau } \right. _ { 0 } \right] = \sum _ { j = 1 } ^ { G } \sum _ { i \in g ( j ) } \mathbb { E } \left[ \mathbb { I } \left\{ \mathbf { z } _ { \tau , i } \cdot \mathbf { z } _ { \tau } ^ { g } > 0 \right\} \right] = \sum _ { j = 1 } ^ { G } \sum _ { i \in g ( j ) } \sigma \left( \alpha _ { \tau , i } - \log { \frac { - l } { r } } \right) \times \sigma \left( \alpha _ { \tau } ^ { j } - \log { \frac { - l } { r } } \right) , +$$ + +and we can train with gradient-based optimization as before. + +# 4 EXPERIMENTS + +# 4.1 MODEL AND DATASETS + +For evaluation we use the GLUE benchmark (Wang et al., 2019b), a popular finetuning dataset. Following adapters (Houlsby et al., 2019), we test our approach on the following subset of the GLUE tasks: Multi-Genre Natural Language Inference (MNLI), where the goal is two predict whether the relationship between two sentences is entailment, contradiction, or neutral (we test on both $\mathrm { M N L L } \mathrm { I } _ { m }$ and $\mathrm { M N L I } _ { m m }$ which respectively tests on matched/mismatched domains); Quora Question Pairs (QQP), a classification task to predict whether two question are semantically equivalent; Question Natural Language Inference (QNLI), which must predict whether a sentence is a correct answer to the question; Stanford Sentiment Treebank (SST-2), a sentence classification task to predict the sentiment of movie reviews; Corpus of Linguistic Acceptability (CoLA), where the goal is predict whether a sentence is linguistically acceptable or not; Semantic Textual Similarity Benchmark (STS$\mathbf { B }$ ), which must predict a similarity rating between two sentences; Microsoft Research Paraphrase Corpus (MRPC), where the goal is to predict whether two sentences are semantically equivalent; Recognizing Textual Entailment (RTE), which must predict whether a second sentence is entailed by the first. For evaluation, the benchmark uses Matthew’s correlation for CoLA, Spearman for STS-B, $\mathrm { F _ { 1 } }$ score for MRPC/QQC, and accuracy for MNLI/QNLI/SST-2/RTE. + +
Total paramsNew params per taskQNLI*SST-2 MNLImMNLImmCoLA MRPC STS-B RTEQQPAvg
Full finetuning9.00×100%91.194.986.785.960.589.387.670.172.180.9
Adapters (8-256)1.32×3.6%90.794.084.985.159.589.586.971.571.880.4
Adapters (64)1.19×2.1%91.494.285.384.656.989.687.368.671.879.8
Full finetuning9.00×100%93.494.186.786.059.688.986.671.271.780.6
Last layer1.34×3.8%79.891.671.472.940.280.167.358.663.368.2
Non-adap. diff pruning1.05×0.5%89.793.684.984.851.281.578.261.568.675.5
Diff pruning1.05×0.5%92.993.885.785.660.587.083.568.170.679.4
Diff pruning (struct.)1.05×0.5%93.394.186.486.061.189.786.070.671.180.6
+ +Table 1: GLUE benchmark test server results with BERTLARGE models. (Top) Results with adapter bottleneck layers (brackets indicate the size of bottlenecks), taken from from Houlsby et al. (2019). (Bottom) Results from this work. ${ } ^ { * } \mathrm { Q N L I }$ results are not directly comparable across the two works as the GLUE benchmark has updated the test set since then. To make our results comparable the average column is calculated without QNLI. + +For all experiments, we use the BERTLARGE model from Devlin et al. (2019), which has 24 layers, 1024 hidden size, 16 attention heads, and 340M parameters. We use the Huggingface Transformer library (Wolf et al., 2019) to conduct our experiments. + +# 4.2 BASELINES + +We compare both structured and non-structured variants of diff pruning against the following baselines: Full finetuning, which fully finetunes $\mathrm { B E R T _ { L } }$ ARGE as usual; Last layer finetuning, which only finetunes the penultimate layer (along with the final output layer)9; Adapters from Houlsby et al. (2019), which train task-specific bottleneck layers between between each layer of a pretrained model, where parameter-efficiency can be controlled by varying the size of the bottleneck layers; and Non-adaptive diff pruning, which performs diff pruning just based on magnitude pruning (i.e., we obtain $\pmb { \theta } _ { \tau }$ through usual finetuning, set $\delta _ { \tau } = \pmb { \theta } _ { \tau } - \pmb { \theta } _ { \mathrm { p r e t r a i n e d } }$ , and then apply magnitude pruning followed by additional finetuning on $\delta _ { \tau }$ ). For diff pruning we set our target sparsity rate to $0 . 5 \%$ and investigate the effect of different target sparsity rates in section 5.1. + +# 4.3 IMPLEMENTATION DETAILS AND HYPERPARAMETERS + +Diff pruning introduces additional hyperparameters $l , r$ (for stretching the Hard-Concrete distribution) and $\lambda$ (for weighting the approximate $L _ { 0 }$ -norm penalty). We found $l = - 1 . 5 , r = 1 . 5 , \lambda =$ $1 . 2 5 \times 1 0 ^ { - 7 }$ to work well across all tasks. We also initialize the weight vector ${ \bf w } _ { \tau }$ to 0, and $\pmb { \alpha } _ { \tau }$ to a positive vector (we use 5) to encourage ${ \bf z } _ { \tau }$ to be close to 1 at the start of training. While we mainly experiment with BERTLARGE to compare against prior work with adapters (Houlsby et al., 2019), in preliminary experiments we found these hyperparameters to work for finetuning RoBERTa (Liu et al., $2 0 1 9 \mathrm { c }$ ) and XLNet (Yang et al., 2019) models as well. + +For all tasks we use a learning rate of $1 \times 1 0 ^ { - 5 }$ and perform a hyperparameter search over batch size $\in \{ 4 , 6 , 8 , 1 0 \}$ and the number of epochs $\in \{ 2 , 3 , 4 , 5 \}$ .10 However we found the default settings used for regular finetuning as suggested in the original BERT paper to work well for most tasks. Finetuning with the fixed mask after projecting onto the $L _ { 0 }$ -ball with magnitude pruning is done with a learning rate of $5 \times 1 0 ^ { - 5 }$ for 3 or 5 epochs (3 epochs for QNLI, SST-2, MNLI-m, MNLI-mm, CoLA, QQP, 5 epochs for MRPC, STS-B, RTE). Grouping for the structured version of diff pruning is based on the matrix/bias vectors (i.e. parameters that belong to the same matrix or bias vector are assumed to be in the same group), which results in 393 groups.1 + +# 5 RESULTS AND ANALYSIS + +Our main results on the GLUE benchmark are shown in Table 1. Structured diff pruning can match the performance of a fully finetuned BERTLARGE model while only requiring $0 . 5 \%$ additional parameters per task. Diff pruning without structured sparsity also performs well, though slightly worse than the structured approach. Non-adaptive diff pruning, which magnitude prunes the diff vector without learning the binary mask $\mathbf { z } _ { \tau }$ , performs significantly worse, indicating the importance of learning the masking vector. Compared to adapters, diff pruning obtains similar performance while requiring fewer parameters per task, making it a potential alternative for parameter-efficient transfer learning.12 We now perform a series of analysis experiments on the validation set. + +
Non-structuredPruned Diff GroupsStructured
#%#%
MRPC246.15213.2
STS-B256.44812.2
RTE287.15012.7
Avg25.76.550.012.7
+ +![](images/595b6e69a0b27f0e5a01c20b6b20af16c35c98e03db9d2bd1a18a59ee3317e0f.jpg) +Figure 1: (Left) Average performance on the GLUE validation set across different target sparsity rates for the different methods. (Right) Number of groups where all of the parameters in the group are fully zero for structured vs. non-structured diff pruning at $0 . 5 \%$ target sparsity. We group based on each matrix/bias vector, resulting in 393 groups in total. + +
Diff vector target sparsityQNLISST-2MNLImMNLImmCoLAMRPCSTS-BRTEQQPAvg
0.10%92.793.385.685.958.087.486.368.685.282.5
0.25%93.294.286.286.563.390.988.471.586.184.5
0.50%93.494.286.486.963.591.389.571.586.684.8
1.00%93.394.286.487.066.391.489.971.186.685.1
100%93.594.186.587.162.891.989.871.887.685.0
+ +Table 2: Structured diff pruning results on the validation set with different target sparsity rates. Average performance includes all 9 tasks. + +# 5.1 VARYING THE TARGET SPARSITY + +In Figure 1 (left), we plot results on the GLUE validation set averaged across all tasks at target sparsity rates of $0 . 1 \%$ , $0 . 2 5 \%$ , $0 . 5 \%$ , $1 . 0 \%$ for the different baselines. Structured diff pruning consistently outperforms non-structured and and non-adaptive variants across different sparsity rates. The advantage of adaptive methods becomes more pronounced at extreme sparsity rates. In Table 2, we report the breakdown of accuracy of structured diff pruning across different tasks and sparsity rates, where we observe that different tasks have different sensitivity to target sparsity rates. This suggests that we can obtain even greater parameter-efficiency through targeting task-specific sparsity rates in the diff vector. + +# 5.2 STRUCTURED VS. NON-STRUCTURED DIFF PRUNING + +Structured diff pruning introduces an additional mask per group, which encourages pruning of entire groups. This is less restrictive than traditional group sparsity techniques that have been used with $L _ { 0 }$ -norm relaxations which force all parameters in a group to share the same mask (Louizos et al., 2018; Wang et al., 2019b). However we still expect entire groups to be pruned out more often in the structured case, which might bias the learning process towards either eliminating completely or clustering together nonzero diffs. In Figure 1 (right), we indeed find that structured diff pruning leads to finetuned models that are much more likely to leave entire groups unchanged from their pretrained values (zero diffs). + +# 5.3 TASK-SPECIFIC SPARSITY + +Different layers of pretrained models have argued to encode different information (Liu et al., 2019a; Tenney et al., 2019). Given that each task will likely recruit different kinds of language phenomena embedded in the hidden layers, we hypothesize that diff pruning will modify different parts of the pretrained model through task-specific finetuning. Figure 2 shows the percentage of nonzero diff parameters attributable to the different layers for each task. We find that different tasks indeed modify different parts of the network, although there are some qualitative similarities between some tasks, for example between QNLI & QQP (both must encode questions), and MRPC & STS-B (both must predict similarity between sentences). The embedding layer is very sparsely modified for all tasks. While some of the variations in the sparsity distributions is due to simple randomness, we do observe some level of consistency over multiple runs of the same task, as shown in Figure 3 of the appendix. + +![](images/a2618320f9f0e0193cd71e3737c981cd5b834522d27110d75f63705a8284b8ae.jpg) + +Figure 2: Percentage of modified parameters attributable to each layer for different tasks at $0 . 5 \%$ target sparsity. The layers are ordered from earlier to later (i.e. the embedding layer is shown at the top). The $\mathbf { X }$ -axis for each plot goes from $0 \%$ to $20 \%$ . + +
QNLISST-2MNLImMNLImmCoLAMRPCSTS-BRTEQQPAvg
Sparsity1.5%0.6%0.8%0.8%1.6%2.4%3.3%0.7%0.6%1.4%
Performance93.894.086.286.863.191.989.771.886.584.9
With 0.5% sparsity93.494.286.486.963.591.389.571.586.684.8
+ +Table 3: (Top) Sparsity and performance before magnitude pruning on the validation set with structured diff pruning. (Bottom) Performance with $0 . 5 \%$ target sparsity. + +The ability to modify different parts of the pretrained model for each task could explain the improved parameter-efficiency of our approach compared to Houlsby et al. (2019)’s adapter layers, which can only read/write to the pretrained model at certain points of the computational graph.13 This potentially suggests that adapter layers with more fine-grained access into model internals (e.g. adapters for key/value/query transformations) might result in even greater parameter-efficiency. While left as future work, we also note that diff pruning can be applied in conjunction with adapters, which might further improve results. + +# 5.4 EFFECT OF $\mathrm { L } _ { 0 }$ -BALL PROJECTION VIA MAGNITUDE PRUNING + +Applying magnitude pruning to project onto the $\mathrm { L } _ { 0 }$ -ball was crucial in achieving exact sparsity targets. As shown in Table 3, we observed little loss in performance through magnitude pruning. We re-iterate that it was crucial to finetune with the fixed mask in order to maintain good performance.14 + +# 5.5 SQUAD EXTRACTIVE QUESTION ANSWERING + +To demonstrate the effectiveness of our approach beyond classification, we additionally experiment on the extractive question answering task SQuAD, which asks model to select the answer span to a question given a Wikipedia paragraph. To make direct comparisons with Houlsby et al. (2019), we run all experiments on SQuAD v1.1. For diff pruning, we use the same general hyper-parameters as our full finetuning baseline.15 Results are shown in Table 4. Diff pruning is able achieve comparable or better performance with only $1 \%$ additional parameters. Notably, we see that our method can improve the F1 score of full finetuning baseline by a significant margin (e.g. $9 0 . 8 \% \Rightarrow 9 3 . 2 \% )$ ) + +
SparsityF1
Full finetuning Adapters100% 2%90.7% 90.4%
Full finetuning100%90.8%
Diff pruning1%92.1%
Diff pruning (struct.)1%93.2%
+ +Table 4: SQuAD validation results with BERTLARGE model. + +while modifying many fewer parameters (e.g., $1 0 0 \% \Rightarrow 1 \%$ ), which potentially implies that diff pruning can have a useful regularization effect. + +# 6 DISCUSSION + +# 6.1 MEMORY REQUIREMENTS + +For training, our approach requires more memory than usual finetuning due to additionally optimizing $\pmb { \alpha } _ { \tau }$ and ${ \bf w } _ { \tau }$ . This did not present a significant challenge for pretrained models that we experimented with in this study, since majority of GPU memory was utilized by the minibatch’s activation layers. However, this could present an issue as model sizes get larger and larger. While training efficiency was not a primary concern of this work, diff pruning takes approxiamtely $1 . 5 \times$ to $2 \times$ more time per batch, which results in slower training. + +After training, storing the task-specific diff vector requires storing a compressed version with both the nonzero positions and weights, which incurs additional storage requirements. + +# 6.2 INFORMATION-EFFICIENT TRANSFER LEARNING + +Efficiently representing pretrained models adapted to new tasks is becoming an increasingly important problem in contemporary NLP. This paper focuses on a rather narrow definition of efficiency— parameter-efficiency. An interesting direction might be to target generalizations of parameterefficiency, for example, information-efficiency, which aims to minimize the number of bits required to represent the task-specific model when given the pretrained model for free. This view can suggest other avenues for achieving information-efficient transfer learning: for example, “what is the minimum number of (potentially synthetic) datapoints that we can finetune BERT on to obtain a good task-specific model?”,16 or “what is the shortest prefix string that we can condition GPT3 on for it to become a good task-specific model”? + +# 7 RELATED WORK + +Multi-task learning Multi-task learning (Caruana, 1997), broadly construed, aims to learn models and representations that can be utilized across a diverse range of tasks, and offers a natural approach to training parameter-efficient deep models. Several works have shown that a single BERT model can obtain good performance across multiple tasks when jointly trained (Liu et al., 2019b; Clark et al., 2019; Stickland & Murray, 2019). Adapter layers, which are task-specific layers that read and write to layers of a shared model (Rebuffi et al., 2018), offer an alternative approach to multi-task learning that does not require access to all tasks during training, and have also been applied to obtain parameter-efficient BERT models (Houlsby et al., 2019; Pfeiffer et al., 2020a;b;c). A related line of work targets extreme parameter-efficiency through task-agnostic sentence representations that can be used without finetuning for downstream tasks (Le & Mikolov, 2014; Kiros et al., 2015; Wieting et al., 2016; Hill et al., 2016; Arora et al., 2017; Conneau et al., 2017; Cer et al., 2018; Zhang et al., 2018; Subramanian et al., 2018; Zhang et al., 2020). Reimers & Gurevych (2019), building on the earlier work of Conneau et al. (2017), show that BERT finetuned on natural language inference obtains sentence representations that perform well across multiple sentence-level tasks. These feature-based transfer learning methods are however generally outperformed by fully finetuned models (Howard & Ruder, 2018). + +Model compression There has been much recent work on compressing pretrained trained with self-supervision (see Ganesh et al. (2020) for a recent survey). A particularly promising line of work focuses on obtaining smaller pretrained models (for subsequent finetuning) through weight pruning (Gordon et al., 2020; Sajjad et al., 2020; Chen et al., 2020) and/or knowledge distillation (Sanh et al., 2019; Sun et al., 2019; Turc et al., 2019; Jiao et al., 2019; Sun et al., 2020). It would be interesting to see whether our approach can be applied on top of these smaller pretrained models to for even greater parameter-efficiency. + +Learning to prune Our work is closely related to the line of work on learning to prune pretrained models with differentiable relaxations of binary masks (Wang et al., 2019b; Zhao et al., 2020; Sanh et al., 2020; Radiya-Dixit & Wang, 2020). While these works also enable parameter-efficient transfer learning, they generally apply the masks directly on the pretrained parameters instead of on the difference vector as in the present work. + +Regularization towards pretrained models Finally, diff pruning is also related to works which regularize the learning process towards pretrained models for continual learning (Kirkpatrick et al., 2017; Schwarz et al., 2018), domain adaptation (Wiese et al., 2017; Miceli Barone et al., 2017), and stable finetuning (Lee et al., 2020). These works typically do not utilize sparse regularizers and target a different goal than parameter-efficiency. + +# 8 CONCLUSION + +We propose diff pruning as a simple approach for parameter-efficient transfer learning with pretrained models. Experiments on standard NLP benchmarks and models show that diff pruning can match the performance of fully finetuned baselines while requiring only a few additional parameters per task. We also propose a structured variant of diff pruning which provides further improvements. Future work will consider (i) applying this approach to other architectures (e.g. ConvNets for vision applications), (ii) injecting parameter-efficiency objectives directly into the pretraining process (to pretrain models that are better suited towards sparse transfer learning), and (iii) combining diff pruning with other techniques (e.g. adapters) to achieve even greater parameter-efficiency. + +# REFERENCES + +Sanjeev Arora, Yingyu Liang, and Tengyu Ma. A Simple but Tough-to-Beat Baseline for Sentence Embeddings . In Proceedings of ICLR, 2017. + +Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language Models are Few-Shot Learners. 2020. + +Rich Caruana. Multitask Learning. Machine Learning, 1997. + +Daniel Cer, Yinfei Yang, Sheng-yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St. John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, Brian Strope, and Ray Kurzweil. Universal sentence encoder for English. In Proceedings of EMNLP: System Demonstrations, 2018. + +Tianlong Chen, Jonathan Frankle, Shiyu Chang, Sijia Liu, Yang Zhang, Zhangyang Wang, and Michael Carbin. The Lottery Ticket Hypothesis for Pre-trained BERT Networks. arXiv:2007.12223, 2020. + +Kevin Clark, Minh-Thang Luong, Urvashi Khandelwal, Christopher D. Manning, and Quoc V. Le. BAM! Born-Again Multi-Task Networks for Natural Language Understanding. In Proceedings of ACL, 2019. + +Alexis Conneau, Douwe Kiela, Holger Schwenk, Loic Barrault, and Antoine Bordes. Supervised Learning of Universal Sentence Representations from Natural Language Inference Data. In Proceedings of EMNLP, 2017. + +Andrew Dai and Quoc V. Le. Semi-Supervised Sequence Learning. In Proceedings of NIPS, 2015. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of NAACL, 2019. + +Fangxiaoyu Feng, Yinfei Yang, Daniel Cer, Naveen Arivazhagan, and Wei Wang. Languageagnostic BERT Sentence Embedding. arXiv:2007.01852, 2020. + +Robert French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3, 1999. + +Prakhar Ganesh, Yao Chen, Xin Lou, Mohammad Ali Khan, Yin Yang, Deming Chen, Marianne Winslett, Hassan Sajjad, and Preslav Nakov. Compressing Large-Scale Transformer-Based Models: A Case Study on BERT. arXiv:2002.11985, 2020. + +Mitchell A. Gordon, Kevin Duh, and Nicholas Andrews. Compressing BERT: Studying the Effects of Weight Pruning on Transfer Learning. In Proceedings of Rep4NLP 2020 Workshop at ACL 2020, 2020. + +Song Han, Huizi Mao, and William J. Dally. Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding. In Proceedings of ICLR, 2016. + +Felix Hill, Kyunghyun Cho, and Anna Korhonen. Learning distributed representations of sentences from unlabelled data. In Proceedings of ACL, 2016. + +Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin de Laroussilhe, Andrea Gesmundo, and Mona Attariyanand Sylvain Gelly. Parameter-efficient transfer learning for nlp. In Proceedings of ICML, 2019. + +Jeremy Howard and Sebastian Ruder. Universal Language Model Fine-tuning for Text Classification. In Proceedings of ACL, 2018. + +Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with Gumbel-Softmax. In Proceedings of ICLR, 2017. + +Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. TinyBERT: Distilling BERT for Natural Language Understanding. arXiv:1909.10351, 2019. + +James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 14:3521–3526, 2017. + +Ryan Kiros, Yukun Zhu, Ruslan Salakhutdinov, Richard S. Zemel, Antonio Torralba, Raquel Urta sun, and Sanja Fidler. Skip-Thought Vectors. In Proceedings of NeurIPS, 2015. + +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. In Proceedings of ICLR, 2020. + +Quoc V. Le and Tomas Mikolov. Distributed Representations of Sentences and Documents. In Proceedings of ICML, 2014. + +Cheolhyoung Lee, Kyunghyun Cho, and Wanmo Kang. Mixout: Effective Regularization to Finetune Large-scale Pretrained Language Models. In Proceedings of ICLR, 2020. + +Sang-Woo Lee, Jin-Hwa Kim, Jaehyun Jun, Jung-Woo Ha, and Byoung-Tak Zhang. Overcoming catastrophic forgetting by incremental moment matching. In Advances in Neural Information Processing Systems. 2017. + +Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, and Noah A. Smith. Linguistic Knowledge and Transferability of Contextual Representations. In Proceedings of ACL, 2019a. + +Xiaodong Liu, Pengcheng He, Weizhu Chen, and Jianfeng Gao. Multi-Task Deep Neural Networks for Natural Language Understanding. In Proceedings of ACL, 2019b. + +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv:1907.11692, 2019c. +David Lopez-Paz and Marc’Aurelio Ranzato. Gradient Episodic Memory for Continual Learning. In Proceedings of NeurIPS, 2017. +Christos Louizos, Max Welling, Diederik P, and Kingma. Learning Sparse Neural Networks through $L _ { 0 }$ Regularization. In Proceedings of ICLR, 2018. +Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. In Proceedings of ICLR, 2017. +Bryan McCann, James Bradbury, Caiming Xiong, and Richard Socher. Learned in translation: Contextualized word vectors. In Proceedings of NeurIPS. 2017. +Antonio Valerio Miceli Barone, Barry Haddow, Ulrich Germann, and Rico Sennrich. Regularization techniques for fine-tuning in neural machine translation. In Proceedings of EMNLP, 2017. +Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient Estimation of Word Representations in Vector Space. arXiv:1301.3781, 2013. +German I. Parisi, Ronald Kemker, Jose L. Part, Christopher Kanan, and Stefan Wermter. Continual Lifelong Learning with Neural Networks: A Review. arXiv:1802.07569, 2018. +Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep Contextualized Word Representations. In Proceedings of NAACL, 2018. +Jonas Pfeiffer, Aishwarya Kamath, Andreas Ruckle, and Kyunghyun Cho amd Iryna Gurevych. AdapterFusion: Non-Destructive Task Composition for Transfer Learning. arXiv:2005.00247, 2020a. +Jonas Pfeiffer, Andreas Ruckle, Clifton Poth, Aishwarya Kamath, Ivan Vulic, Sebastian Ruder, and Iryna Gurevych Kyunghyun Cho. AdapterHub: A Framework for Adapting Transformers. arXiv:2007.07779, 2020b. +Jonas Pfeiffer, Ivan Vulic, Iryna Gurevych, and Sebastian Ruder. MAD-X: An Adapter-based Framework for Multi-task Cross-lingual Transfer. arXiv:2005.00052, 2020c. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. 2019. +Evani Radiya-Dixit and Xin Wang. How fine can fine-tuning be? Learning efficient language models. In Proceedings of AISTATS, 2020. +Colin Raffel, Noam Shazeer, Katherine Lee Adam Roberts, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the Limits of Transfer Learning with a Unified Text-toText Transformer. Journal of Machine Learning Research, 21, 2020. +Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. ZeRO: Memory Optimizations Toward Training Trillion Parameter Models. arXiv:1910.02054, 2019. +S. Rebuffi, A. Vedaldi, and H. Bilen. Efficient Parametrization of Multi-domain Deep Neural Networks. In Proceedings of CVPR, 2018. +Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence Embeddings using Siamese BERTNetworks. In Proceedings of EMNLP, 2019. +Hassan Sajjad, Fahim Dalvi, Nadir Durrani, and Preslav Nakov. Poor Man’s BERT: Smaller and Faster Transformer Models. arXiv:2004.03844, 2020. + +Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. In Proceedings of 5th Workshop on Energy Efficient Machine Learning and Cognitive Computing, 2019. + +Victor Sanh, Thomas Wolf, and Alexander M. Rush. Movement Pruning: Adaptive Sparsity by Fine-Tuning. arXiv:2005.07683, 2020. + +Timo Schick and Hinrich Schutze. It’s Not Just Size That Matters: Small Language Models Are Also Few-Shot Learners. arXiv:2009.07118, 2020. + +Jonathan Schwarz, Jelena Luketina, Wojciech M. Czarnecki, Agnieszka Grabska-Barwinska, Yee Whye Teh, Razvan Pascanu, and Raia Hadsell. Progress & Compress: A scalable framework for continual learning. In Proceedings of ICML, 2018. + +Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual Learning with Deep Generative Replay. In Proceedings of NeurIPS. 2017. + +Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism. arXiv:1909.08053, 2019. + +Asa Cooper Stickland and Iain Murray. BERT and PALs: Projected attention layers for efficient adaptation in multi-task learning. In Proceedings of ICML, 2019. + +Sandeep Subramanian, Adam Trischler, Yoshua Bengio, and Christopher J. Pal. Learning General Purpose Distributed Sentence Representations via Large Scale Multi-task Learning. In Proceedings of ICLR, 2018. + +Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient Knowledge Distillation for BERT Model Compression. In Proceedings of EMNLP, 2019. + +Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. MobileBERT: a compact task-agnostic BERT for resource-limited devices. In Proceedings of ACL, July 2020. + +Ian Tenney, Dipanjan Das, and Ellie Pavlick. BERT Rediscovers the Classical NLP Pipeline. In Proceedings of ACL, 2019. + +Iulia Turc, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Well-Read Students Learn Better: On the Importance of Pre-training Compact Models. arXiv:1908.08962, 2019. + +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of ICLR, 2019a. + +Tongzhou Wang, Jun-Yan Zhu, Antonio Torralba, and Alexei A. Efros. Dataset Distillation. arXiv:1811.10959, 2018. + +Ziheng Wang, Jeremy Wohlwend, and Tao Lei. Structured Pruning of Large Language Models. arXiv:1910.04732, 2019b. + +Georg Wiese, Dirk Weissenborn, and Mariana Neves. Neural domain adaptation for biomedical question answering. In Proceedings of CoNLL, August 2017. + +John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. Towards Universal Paraphrastic Sentence Embeddings. In Proceedings of ICLR, 2016. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick ´ von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Huggingface’s transformers: Stateof-the-art natural language processing. ArXiv, abs/1910.03771, 2019. + +John M. Wu, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. Similarity Analysis of Contextual Word Representation Models. In Proceedings of ACL, 2020. + +![](images/8c95c374d96e969461975571abc9c78de78634e6f294904982d24204df94d38e.jpg) +Figure 3: Percentage of modified parameters attributable to each layer for 5 different runs of SST-2 at $0 . 5 \%$ target sparsity. The layers are ordered from earlier to later (i.e. the embedding layer is shown at the top). The $\mathbf { X }$ -axis for each plot goes from $0 \%$ to $20 \%$ . + +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. XLNet: Generalized Autoregressive Pretraining for Language Understanding. In Proceedings of NeurIPS, 2019. + +Minghua Zhang, Yunfang Wu, Weikang Li, and Wei Li. Learning universal sentence representations with mean-max attention autoencoder. In Proceedings of EMNLP, 2018. + +Yan Zhang, Ruidan He, Zuozhu Liu, Kwan Hui Lim, and Lidong Bing. An Unsupervised Sentence Embedding Method byMutual Information Maximization. In Proceedings of EMNLP, 2020. + +Mengjie Zhao, Tao Lin, Martin Jaggi, and Hinrich Schutze. Masking as an Efficient Alternative to Finetuning for Pretrained Language Models. arXiv:2004.12406, 2020. + +# A APPENDIX + +# A.1 CONSISTENCY OF NONZERO PARAMETERS + +Figure 3 shows the percentage of modified parameters attributable to each layer across 5 runs of SST2. We find that there is nonotrivial variation in sparsity across runs, but also a degree of consistency. For example, the first layer is modified considerably more than other layers across all runs. \ No newline at end of file diff --git a/md/train/EsA9Nr9JHvy/EsA9Nr9JHvy.md b/md/train/EsA9Nr9JHvy/EsA9Nr9JHvy.md new file mode 100644 index 0000000000000000000000000000000000000000..5d219132a08e4d58e5c895bdee4356f49b55ecb8 --- /dev/null +++ b/md/train/EsA9Nr9JHvy/EsA9Nr9JHvy.md @@ -0,0 +1,1736 @@ +# THE HEAVY-TAIL PHENOMENON IN SGD + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +In recent years, various notions of capacity and complexity have been proposed for characterizing the generalization properties of stochastic gradient descent (SGD) in deep learning. Some of the popular notions that correlate well with the performance on unseen data are (i) the ‘flatness’ of the local minimum found by SGD, which is related to the eigenvalues of the Hessian, (ii) the ratio of the stepsize $\eta$ to the batch size $b$ , which essentially controls the magnitude of the stochastic gradient noise, and (iii) the ‘tail-index’, which measures the heaviness of the tails of the network weights at convergence. In this paper, we argue that these three seemingly unrelated perspectives for generalization are deeply linked to each other. We claim that depending on the structure of the Hessian of the loss at the minimum, and the choices of the algorithm parameters $\eta$ and $b$ , the SGD iterates will converge to a heavy-tailed stationary distribution. We rigorously prove this claim in the setting of quadratic optimization: we show that even in a simple linear regression problem with independent and identically distributed Gaussian data, the iterates can be heavy-tailed with infinite variance. We further characterize the behavior of the tails with respect to algorithm parameters, the dimension, and the curvature. We then translate our results into insights about the behavior of SGD in deep learning. We finally support our theory with experiments conducted on both synthetic data and fully connected neural networks. + +# 1 INTRODUCTION + +The learning problem in neural networks can be expressed as an instance of the well-known population risk minimization problem in statistics, given as follows: + +$$ +\begin{array} { r } { \operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } F ( x ) : = \mathbb { E } _ { z \sim \mathcal { D } } [ f ( x , z ) ] , } \end{array} +$$ + +where $z \in \mathbb { R } ^ { p }$ denotes a random data point, $\mathcal { D }$ is a probability distribution on $\mathbb { R } ^ { p }$ that denotes the law of the data points, $\boldsymbol { x } \in \mathbb { R } ^ { d }$ denotes the parameters of the neural network to be optimized, and $f : \mathbb { R } ^ { d } \times \mathbb { R } ^ { p } \mapsto \mathbf { \bar { \mathbb { R } } _ { + } }$ denotes a measurable cost function, which is often non-convex in $x$ . While this problem cannot be attacked directly since $\mathcal { D }$ is typically unknown, if we have access to a training dataset $S = \{ z _ { 1 } , \ldots , z _ { n } \}$ with $n$ independent and identically distributed (i.i.d.) observations, i.e., $z _ { i } \ \sim _ { \mathrm { i . i . d } }$ . $\mathcal { D }$ for $i = 1 , \ldots , n$ , we can use the empirical risk minimization strategy, which aims at solving the following optimization problem (Shalev-Shwartz & Ben-David, 2014): + +$$ +\begin{array} { r } { \operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } f ( x ) : = f ( x , S ) : = ( 1 / n ) \sum _ { i = 1 } ^ { n } f ^ { ( i ) } ( x ) , } \end{array} +$$ + +where $f ^ { ( i ) }$ denotes the cost induced by the data point $z _ { i }$ . The stochastic gradient descent (SGD) algorithm has been one of the most popular algorithms for addressing this problem: + +$$ +\begin{array} { r } { x _ { k } = x _ { k - 1 } - \eta \nabla \tilde { f } _ { k } ( x _ { k - 1 } ) , \quad \mathrm { ~ w h e r e ~ } \quad \nabla \tilde { f } _ { k } ( x ) : = ( 1 / b ) \sum _ { i \in \Omega _ { k } } \nabla f ^ { ( i ) } ( x ) . } \end{array} +$$ + +Here, $k$ denotes the iterations, $\eta > 0$ is the stepsize (also called the learning-rate), $\nabla \tilde { f }$ is the stochastic gradient, $b$ is the batch-size, and $\Omega _ { k } \subset \{ 1 , \ldots , n \}$ is a random subset with $| \Omega _ { k } | = b$ for all $k$ . + +Even though the practical success of SGD has been proven in many domains, the theory for its generalization properties is still in an early phase. Among others, one peculiar property of SGD that has not been theoretically well-grounded is that, depending on the choice of $\eta$ and $b$ , the algorithm can exhibit significantly different behaviors in terms of the performance on unseen test data. + +A common perspective over this phenomenon is based on the ‘flat minima’ argument that dates back to Hochreiter & Schmidhuber (1997), and associates the performance with the ‘sharpness’ or ‘flatness’ of the minimizers found by SGD, where these notions are often characterized by the magnitude of the eigenvalues of the Hessian, larger values corresponding to sharper local minima (Keskar et al., 2016). Recently, Jastrz˛ebski et al. (2017) focused on this phenomenon as well and empirically illustrated that the performance of SGD on unseen test data is mainly determined by the stepsize $\eta$ and the batch-size $b$ , i.e., larger $\eta / b$ yields better generalization. Revisiting the flat-minima argument, they concluded that the ratio $\eta / b$ determines the flatness of the minima found by SGD; hence the difference in generalization. In the same context, ¸Sim¸sekli et al. (2019b) focused on the statistical properties of the gradient noise $( \nabla \tilde { f } _ { k } ( x ) - \nabla f ( x ) )$ and illustrated that under an isotropic model, the gradient noise exhibits a heavy-tailed behavior, which was also confirmed in follow-up studies (Zhang et al., 2019). Based on this observation and a metastability argument (Pavlyukevich, 2007), they showed that SGD will ‘prefer’ wider basins under the heavy-tailed noise assumption, without an explicit mention of the cause of the heavy-tailed behavior. + +In another recent study, Martin & Mahoney (2019) introduced a new approach for investigating the generalization properties of deep neural networks by invoking results from heavy-tailed random matrix theory. They empirically showed that the eigenvalues of the weight matrices in different layers exhibit a heavy-tailed behavior, which is an indication that the weight matrices themselves exhibit heavy tails as well (Ben Arous & Guionnet, 2008). Accordingly, they fitted a power law distribution to the empirical spectral density of individual layers and illustrated that heavier-tailed weight matrices indicate better generalization. Very recently, ¸Sim¸sekli et al. (2020) formalized this argument in a mathematically rigorous framework and showed that such a heavy-tailed behavior diminishes the ‘effective dimension’ of the problem, which in turn results in improved generalization. While these studies form an important initial step towards establishing the connection between heavy tails and generalization, the originating cause of the observed heavy-tailed behavior is yet to be understood. + +In this paper, we argue that these three seemingly unrelated perspectives for generalization are deeply linked to each other. We claim that, depending on the choice of the algorithm parameters $\eta$ and $b$ , the dimension $d$ , and the curvature of $f$ (to be precised in Section 3), SGD exhibits a ‘heavy-tail phenomenon’, meaning that the law of the iterates converges to a heavy-tailed distribution. We rigorously prove that, this phenomenon is not specific to deep learning and in fact it can be observed even in surprisingly simple settings: we show that when $f$ is chosen as a simple quadratic function and the data points are i.i.d. from an isotropic Gaussian distribution, the iterates can still converge to a heavy-tailed distribution with arbitrarily heavy tails, hence with infinite variance. We summarize our contributions as follows: + +1. When $f$ is a quadratic, we prove that: (i) the tails become monotonically heavier for increasing curvature, increasing $\eta$ , or decreasing $b$ , hence relating the heavy-tails to the ratio $\eta / b$ and the curvature, (ii) the law of the iterates converges exponentially fast towards the stationary distribution in the Wasserstein metric, (iii) there exists a higher-order moment (e.g., variance) of the iterates that diverges at most polynomially-fast, depending on the heaviness of the tails at stationarity. 2. We support our theory with experiments conducted on both synthetic data and neural networks. Our experimental results confirm our theory on synthetic setups and also illustrate that the heavy-tail phenomenon is also observed in fully connected multi-layer neural networks. + +To the best of our knowledge, these results are the first of their kind to rigorously characterize the empirically observed heavy-tailed behavior of SGD with respect to $\eta , b , d$ , and the curvature, with explicit convergence rates. + +# 2 TECHNICAL BACKGROUND + +Heavy-tailed distributions with a power-law decay. In probability theory, a real-valued random variable $X$ is said to be heavy-tailed if the right tail or the left tail of the distribution decays slower than any exponential distribution. We say $X$ has heavy (right) tail if $\begin{array} { r } { \operatorname* { l i m } _ { x \infty } \operatorname { l P } ( X \geq x ) e ^ { c x } = \infty } \end{array}$ for any $c > 0$ . 2 Similarly, an $\mathbb { R } ^ { d }$ -valued random vector $X$ has heavy tail if $u ^ { T } X$ has heavy right tail for some vector $u \in \mathbb { S } ^ { d - 1 }$ , where $\mathbb { S } ^ { d - 1 } : = \{ u \in \mathbb { R } ^ { d } : \| u \| = 1 \}$ is the unit sphere in $\mathbb { R } ^ { d }$ . + +Heavy tail distributions include $\alpha$ -stable distributions, Pareto distribution, log-normal distribution and the Weilbull distribution. One important class of the heavy-tailed distributions is the distributions with power-law decay, which is the focus of our paper. That is, $\mathbb { P } ( X \geq x ) \sim c _ { 0 } x ^ { - \alpha }$ as $x \to \infty$ for some $c _ { 0 } > 0$ and $\alpha > 0$ , where $\alpha > 0$ is known as the tail-index, which determines the tail thickness of the distribution. Similarly, we say that the random vector $X$ has power-law decay with tail-index $\alpha$ if for some $u \in \mathbb { S } ^ { d - 1 }$ , we have $\mathbb { P } \bar { ( } u ^ { T } X \geq x ) \sim c _ { 0 } x ^ { - \alpha }$ , for some $c _ { 0 } , \alpha > 0$ . + +Stable distributions. The class of $\alpha$ -stable distributions are an important subclass of heavy-tailed distributions with a power-law decay, which appears as the limiting distribution of the generalized CLT for a sum of i.i.d. random variables with infinite variance (Lévy, 1937). A random variable $X$ follows a symmetric $\alpha$ -stable distribution denoted as $X \sim { \cal S } \alpha { \cal S } ( \sigma )$ if its characteristic function takes the form: $\mathbb { E } \left[ e ^ { i t X } \right] = \exp \left( - \sigma ^ { \alpha } | t | ^ { \alpha } \right)$ , $t \in \mathbb { R }$ , where $\sigma > 0$ is the scale parameter that measures the spread of $X$ around 0, and $\alpha \in ( 0 , 2 ]$ is known as the tail-index, and $s \alpha s$ becomes heavier-tailed as $\alpha$ gets smaller. The probability density function of a symmetric $\alpha$ -stable distribution, $\alpha \in ( 0 , 2 ]$ , does not yield closed-form expression in general except for a few special cases. When $\alpha = 1$ and $\alpha = 2$ , $s \alpha s$ reduces to the Cauchy and the Gaussian distributions, respectively. When $0 < \alpha < 2$ , $\alpha$ -stable distributions have their moments being finite only up to the order $\alpha$ in the sense that $\mathbb { E } [ | X | ^ { p } ] < \infty$ if and only if $p < \alpha$ , which implies infinite variance. + +Wasserstein metric. For any $p \geq 1$ , define $\mathcal { P } _ { p } ( \mathbb { R } ^ { d } )$ as the space consisting of all the Borel probability measures $\nu$ on $\mathbb { R } ^ { d }$ with the finite $p$ -th moment (based on the Euclidean norm). For any two Borel probability measures $\nu _ { 1 } , \nu _ { 2 } \in \mathcal { P } _ { p } ( \mathbb { R } ^ { d } )$ , we define the standard $p$ -Wasserstein metric (Villani, 2009): $\mathcal { W } _ { p } ( \nu _ { 1 } , \nu _ { 2 } ) : = ( \operatorname* { i n f } \mathbb { E } \left[ \| Z _ { 1 } - Z _ { 2 } \| ^ { p } \right] ) ^ { 1 / p }$ , where the infimum is taken over all joint distributions of the random variables $Z _ { 1 } , Z _ { 2 }$ with marginal distributions $\nu _ { 1 } , \nu _ { 2 }$ respectively. + +# 3 SETUP AND MAIN THEORETICAL RESULTS + +Before stating our theoretical results in detail, let us informally motivate our main method of analysis. Suppose that the initial SGD iterate $x _ { 0 }$ is in the domain of attraction3 of a local minimum $x _ { \star }$ of $f$ and the function $f$ is smooth and well-approximated by a quadratic function in this basin. Under this assumption, by considering a first-order Taylor approximation of $\nabla f ^ { ( i ) } ( x )$ around $x _ { \star }$ , we have $\nabla f ^ { ( i ) } ( x ) \approx \nabla f ^ { ( i ) } ( x _ { \star } ) + \nabla ^ { 2 } f ^ { ( i ) } ( x _ { \star } ) ( x - x _ { \star } )$ . By using this approximation, we can approximate the SGD recursion (1.3) as follows: + +$$ +\begin{array} { r l r } { { x _ { k } \approx x _ { k - 1 } - ( \eta / b ) \sum _ { i \in \Omega _ { k } } \nabla ^ { 2 } f ^ { ( i ) } ( x _ { \star } ) x _ { k - 1 } + ( \eta / b ) \sum _ { i \in \Omega _ { k } } \Bigl ( \nabla ^ { 2 } f ^ { ( i ) } ( x _ { \star } ) x _ { \star } - \nabla f ^ { ( i ) } ( x _ { \star } ) \Bigr ) } } \\ & { } & { \quad = : ( I - ( \eta / b ) H _ { k } ) x _ { k - 1 } + q _ { k } , } \end{array} +$$ + +where $I$ denotes the identity matrix of appropriate size. Here, our main observation is that the SGD recursion can be approximated by a linear stochastic recursion, which gives us access to the tools from implicit renewal theory for investigating its statistical properties (Kesten, 1973; Goldie, 1991). In a renewal theoretic context, the object of interest would be the matrix $\begin{array} { r } { ( I - \frac { \eta } { b } H _ { k } ) } \end{array}$ , whose statistical properties determine the behavior of $x _ { k }$ : depending on the moments of this matrix, $x _ { k }$ can have heavy or light tails, or might even diverge. + +In this study, we focus on the tail behavior of the SGD dynamics by analyzing it through the lens of implicit renewal theory. As, the recursion (3.1) is obtained by a quadratic approximation of the component functions $f ^ { ( i ) }$ , which arises naturally in linear regression, we will consider a simplified setting and rigorously study this dynamics in the case of linear regression. + +We would like to underline that, in our analysis, the Taylor approximation (3.1) is not crucial. Indeed, we can easily extend our theory to more general non-linear recursions by imposing strict statistical assumptions on the loss function (which can be chosen non-convex) and the data distribution (Mirek, 2011). Unfortunately, such assumptions would either be trivially false for deep learning problems, e.g., (Mirek, 2011) or cannot be verified in practice, e.g., (Hodgkinson & Mahoney, 2020). In order to be able to provide explicit results with clear assumptions, we limit our scope to quadratic optimization, which turns out to be already fairly technical. We leave the analysis of the general case as a natural next step of our work. + +We now consider the case when $f$ is a quadratic, which arises in linear regression: + +$$ +\operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } F ( x ) : = ( 1 / 2 ) \mathbb { E } _ { ( a , y ) \sim \mathcal { D } } \left[ \left( a ^ { T } x - y \right) ^ { 2 } \right] , +$$ + +where the data $( a , y )$ comes from an unknown distribution $\mathcal { D }$ with support $\mathbb { R } ^ { d } \times \mathbb { R }$ . Assume we have access to i.i.d. samples $( a _ { i } , y _ { i } )$ from the distribution $\mathcal { D }$ where $\nabla f ^ { ( i ) } ( x ) = a _ { i } \big ( a _ { i } ^ { T } x - y _ { i } \big )$ is an unbiased estimator of the true gradient $\nabla F ( x )$ . The curvature, i.e. the value of second partial derivatives, of this objective around a minimum is determined by the Hessian matrix $\mathbb { E } ( a a ^ { T } )$ which depends on the distribution of $a$ . In this setting, SGD with batch size $b$ leads to the iterations + +$$ +x _ { k } = M _ { k } x _ { k - 1 } + q _ { k } \mathrm { w i t h } \ M _ { k } : = I - ( \eta / b ) H _ { k } , \ H _ { k } : = \sum _ { i \in \Omega _ { k } } a _ { i } a _ { i } ^ { T } , \ q _ { k } : = ( \eta / b ) \sum _ { i \in \Omega _ { k } } a _ { i } y _ { i } , +$$ + +where $\Omega _ { k } : = \{ b ( k - 1 ) + 1 , b ( k - 1 ) + 2 , \ldots , b k \}$ with $| \Omega _ { k } | = b$ . Here, for simplicity, we assume that we are in the one-pass regime (also called the streaming setting (Frostig et al., 2015; Jain et al., 2017)) where each sample is used only once without being recycled. Our purpose in this paper is to show that heavy tails can arise in SGD even in simple settings such as when the input data $a _ { i }$ is Gaussian, without the necessity to have a heavy-tailed input data4. Consequently, we make the following assumptions on the data throughout the paper: + +(A1) $a _ { i } \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I _ { d } )$ are i.i.d. +(A2) $y _ { i }$ are i.i.d. with a continuous density whose support is $\mathbb { R }$ with all the moments finite. + +Assumption (A2) would be satisfied in many cases, for instance when $y _ { i }$ is normally distributed on $\mathbb { R }$ . Note that by Assumption (A1), the matrices $\begin{array} { r } { M _ { k } = I - \frac { \eta } { b } H _ { k } } \end{array}$ are i.i.d. and the Hessian matrix of the objective (3.2) satisfies $\mathbb { E } ( a a ^ { T } ) = \sigma ^ { 2 } I _ { d }$ where the value of $\sigma ^ { 2 }$ determines the curvature around a minimum; smaller (larger) $\sigma ^ { 2 }$ implies the objective will grow slower (faster) around the minimum and the minimum will be flatter (sharper) (see e.g. Dinh et al. (2017)). We introduce + +$$ +\begin{array} { r } { h ( s ) : = \operatorname* { l i m } _ { k \to \infty } \left( { \mathbb E } \| M _ { k } M _ { k - 1 } \dots M _ { 1 } \| ^ { s } \right) ^ { 1 / k } , } \end{array} +$$ + +which arises in stochastic matrix recursions (see e.g. Buraczewski et al. (2014)) where $\| \cdot \|$ denotes the matrix 2-norm (i.e. largest singular value of a matrix). Since $\mathbb { E } \| M _ { k } \| ^ { s } < \infty$ for all $k$ and $s > 0$ we have $h ( s ) < \infty$ . Let us also define + +$$ +\begin{array} { r } { \Pi _ { k } : = M _ { k } M _ { k - 1 } \dots M _ { 1 } \quad \mathrm { a n d } \quad \rho : = \operatorname* { l i m } _ { k \to \infty } ( 2 k ) ^ { - 1 } \log \left( \mathrm { l a r g e s t ~ e i g e n v a l u e ~ o f ~ } \Pi _ { k } ^ { T } \Pi _ { k } \right) . } \end{array} +$$ + +The latter quantity is called the top Lyapunov exponent of the stochastic recursion (3.3). Furthermore, if $\rho$ exists and is negative, it can be shown that a stationary distribution of the recursion (3.3) exists. In the Appendix (see Lemma 14), we show that under our assumptions, + +$$ +\rho = \mathbb { E } \log \left. \left( I - ( \eta / b ) H \right) e _ { 1 } \right. , \quad h ( s ) = \mathbb { E } \left[ \left. \left( I - ( \eta / b ) H \right) e _ { 1 } \right. ^ { s } \right] \mathrm { f o r } \rho < 0 , +$$ + +re $H$ is a matrix with the same distribution as $H _ { k }$ , and $e _ { 1 }$ is the first basis vector. + +In the following, we show that the limit density has a polynomial tail with a tail-index given precisely by $\alpha$ , the unique critical value such that $h ( \alpha ) = 1$ . The result builds on adapting the techniques developed in stochastic matrix recursions (Alsmeyer & Mentemeier, 2012; Buraczewski et al., 2016) to our setting. Our result shows that even in the simplest setting when the input data is Gaussian without any heavy tail, SGD iterates can lead to a heavy-tailed stationary distribution with an infinite variance. To our knowledge, this is the first time such a phenomenon is proven in the linear regression setting. + +Theorem 1. Consider the SGD iterations (3.3). If $\rho < 0$ , then SGD iterations admit a unique stationary distribution $x _ { \infty }$ which satisfy + +$$ +\begin{array} { r } { \operatorname* { l i m } _ { t \infty } t ^ { \alpha } \mathbb { P } ( u ^ { T } x _ { \infty } > t ) = e _ { \alpha } ( u ) , \quad u \in \mathbb { S } ^ { d - 1 } , } \end{array} +$$ + +for some positive and continuous function $e _ { \alpha }$ on the unit sphere $\mathbb { S } ^ { d - 1 }$ , where $\alpha$ is the unique positive value such that $h ( \alpha ) = 1$ . + +As Martin & Mahoney (2019); ¸Sim¸sekli et al. (2020) provide both numerical and theoretical evidence showing that the tail-index of the density of the network weights is closely related to the generalization performance, where smaller tail-index indicates better generalization, a natural question of practical importance is how the tail-index depends on the parameters of the problem including the batch size, dimension and the stepsize. We prove that larger batch sizes lead to a lighter tail (i.e. larger $\alpha$ ), which links the heavy tails to the observation that smaller $b$ yields improved generalization in a variety of settings in deep learning (Keskar et al., 2016; Panigrahi et al., 2019; Martin & Mahoney, 2019). We also prove that smaller stepsizes lead to larger $\alpha$ , hence lighter tails, which agrees with the fact that the existing literature for linear regression often choose $\eta$ small enough to guarantee that variance of the iterates stay bounded (Dieuleveut et al., 2017b; Jain et al., 2017). + +Theorem 2. The tail-index $\alpha$ is strictly increasing in batch size b and strictly decreasing in stepsize $\eta$ and variance $\sigma ^ { 2 }$ provided that $\alpha \geq 1$ . Moreover, the tail-index $\alpha$ is strictly decreasing in dimension $d$ + +Next result characterizes the tail-index $\alpha$ depending on the choice of the batch size $b$ , the variance $\sigma ^ { 2 }$ , which determines the curvature around the minimum and the stepsize; in particular we show that if the stepsize exceeds an explicit threshold, the stationary distribution will become heavy tailed with an infinite variance. + +Proposition 3. Let ηcrit = 2bσ2(d+b+1) . The following holds: (i) There exists $\eta _ { m a x } > \eta _ { c r i t }$ such that for any $\eta _ { c r i t } < \eta < \eta _ { m a x }$ , Theorem 1 holds with tail index $0 < \alpha < 2 $ . (ii) If $\eta = \eta _ { c r i t }$ , Theorem $^ { l }$ holds with tail index $\alpha = 2$ . (iii) If $\eta \in ( 0 , \eta _ { c r i t } )$ , then Theorem 1 holds with tail index $\alpha > 2$ . + +Relation to first exit times. Proposition 3 implies that, for fixed $\eta$ and $b$ , the tail-index $\alpha$ will be decreasing with increasing $\sigma$ . Combined with the first-exit-time analyses of ¸Sim¸sekli et al. (2019b); Nguyen et al. (2019), which state that the escape probability from a basin becomes higher for smaller $\alpha$ , our result implies that the probability of SGD escaping from a basin gets larger with increasing curvature; hence providing an alternative view for the argument that SGD prefers flat minima. + +Three regimes for stepsize. Theorems 1-2 and Proposition 3 identify three regimes: (I) convergence to a limit with a finite variance if $\rho < 0$ and $\alpha > 2$ ; (II) convergence to a heavy-tailed limit with infinite variance if $\rho < 0$ and $\alpha < 2$ ; (III) $\rho > 0$ when convergence cannot be guaranteed. For Gaussian input, if the stepsize is small enough, smaller than $\eta _ { c r i t }$ , by Proposition 3, $\rho < 0$ and $\alpha > 2$ , therefore regime (I) applies. As we increase the stepsize, there is a critical stepsize level $\eta _ { c r i t }$ for which $\eta > \eta _ { c r i t }$ leads to $\alpha < 2$ as long as $\eta < \eta _ { m a x }$ where $\eta _ { m a x }$ is the maximum allowed stepsize for ensuring convergence (corresponds to $\rho = 0$ ). A similar behavior with three (learning rate) stepsize regimes was reported in Lewkowycz et al. (2020) and derived analytically for one hidden layer linear networks with a large width. The large stepsize choices that avoids divergence, so called the catapult phase for the stepsize, yielded the best generalization performance empirically, driving the iterates to a flatter minima in practice. We suspect that the catapult phase in Lewkowycz et al. (2020) corresponds to regime (II) in our case, where the iterates are heavy-tailed, which might cause convergence to flatter minima as the first-exit-time discussions suggest ( ¸Sim¸sekli et al., 2019a). + +Moment Bounds and Convergence Speed. Theorem 1 is of asymptotic nature which characterizes the stationary distribution $x _ { \infty }$ of SGD iterations with a tail-index $\alpha$ . Next, we provide non-asymptotic moment bounds for $x _ { k }$ at each $k$ -th iterate, and also for the limit $x _ { \infty }$ . + +Theorem 4. (i) If the tail-index $\alpha \leq 1$ , then for any $p \in ( 0 , \alpha )$ , we have $h ( p ) < 1$ and + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { p } \leq ( h ( p ) ) ^ { k } \mathbb { E } \Vert x _ { 0 } \Vert ^ { p } + \frac { 1 - ( h ( p ) ) ^ { k } } { 1 - h ( p ) } \mathbb { E } \Vert q _ { 1 } \Vert ^ { p } . +$$ + +(ii) If the tail-index $\alpha > 1$ , then for any $p \in ( 1 , \alpha )$ , we have $h ( p ) < 1$ and for any $\epsilon > 0$ such that $( 1 + \epsilon ) h ( p ) < 1$ , we have + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { p } \leq ( ( 1 + \epsilon ) h ( p ) ) ^ { k } \mathbb { E } \Vert x _ { 0 } \Vert ^ { p } + \frac { 1 - ( ( 1 + \epsilon ) h ( p ) ) ^ { k } } { 1 - ( 1 + \epsilon ) h ( p ) } \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { ( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 ) ^ { p } } \mathbb { E } \Vert q _ { 1 } \Vert ^ { p } . +$$ + +Theorem 4 shows that when $p < \alpha$ the upper bound on the $p$ -th moment of the iterates converges exponentially to the $p$ -the moment of $q _ { 1 }$ when $\alpha \leq 1$ and a neighborhood of the $p$ -moment of $q _ { 1 }$ when $\alpha > 1$ , where $q _ { 1 }$ is defined in (3.3). By letting $k \infty$ and applying Fatou’s lemma, we can also characterize the moments of the stationary distribution. + +Corollary 5. (i) If the tail-index $\alpha \leq 1$ , then for any $\begin{array} { r } { p \in ( 0 , \alpha ) , \operatorname { \mathbb { E } } \| x _ { \infty } \| ^ { p } \leq \frac { 1 } { 1 - h ( p ) } \operatorname { \mathbb { E } } \| q _ { 1 } \| ^ { p } } \end{array}$ , where $h ( p ) < 1$ . (ii) If the tail-index $\alpha > 1$ , then for any $p \in ( 1 , \alpha )$ , we have $h ( p ) < 1$ and for any $\epsilon > 0$ such that (1 + )h(p) < 1, we have Ekx∞kp ≤ 11−(1+)h(p) ( $\begin{array} { r } { \mathbb { E } \| x _ { \infty } \| ^ { p } \leq \frac { 1 } { 1 - ( 1 + \epsilon ) h ( p ) } \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { ( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 ) ^ { p } } \mathbb { E } \| q _ { 1 } \| ^ { p } . } \end{array}$ + +Next, we will study the speed of convergence of the $k$ -th iterate $x _ { k }$ to its stationary distribution $x _ { \infty }$ in the Wasserstein metric $\mathcal { W } _ { p }$ for any $1 \leq p < \alpha$ . + +Theorem 6. Assume $\alpha > 1$ . Let $\nu _ { k }$ , $\nu _ { \infty }$ denote the probability laws of $x _ { k }$ and $x _ { \infty }$ respectively. Then $\begin{array} { r } { \mathcal { W } _ { p } ( \nu _ { k } , \nu _ { \infty } ) \leq ( h ( p ) ) ^ { k / p } \mathcal { W } _ { p } ( \nu _ { 0 } , \nu _ { \infty } ) } \end{array}$ , for any $1 \ \leq \ p \ < \ \alpha$ , where the convergence rate $( h ( p ) ) ^ { 1 / p } \in ( 0 , 1 )$ . + +Theorem 6 shows that in case $\alpha < 2$ the convergence to a heavy tailed distribution occurs relatively fast, i.e. with a linear convergence in the $p$ -Wasserstein metric. We can also characterize the constant $h ( p )$ in Theorem 6 which controls the convergence rate as follows: + +$\begin{array} { r } { \eta < \eta _ { c r i t } = \frac { 2 b } { \sigma ^ { 2 } ( d + b + 1 ) } } \end{array}$ $\alpha > 2$ + +$$ +\begin{array} { r } { \mathcal { W } _ { 2 } ( \nu _ { k } , \nu _ { \infty } ) \leq \left( 1 - 2 \eta \sigma ^ { 2 } \left( 1 - \eta / \eta _ { c r i t } \right) \right) ^ { k / 2 } \mathcal { W } _ { 2 } ( \nu _ { 0 } , \nu _ { \infty } ) . } \end{array} +$$ + +Theorem 6 works for any $p < \alpha$ . At the critical $p = \alpha$ , Theorem 1 indicates that $\mathbb { E } \| x _ { \infty } \| ^ { \alpha } = \infty$ , and therefore has $\mathbb { E } \| x _ { k } \| ^ { \alpha } \infty$ as $k \to \infty$ , 5 which serves as an evidence that the tail gets heavier as the number of iterates $k$ increases. By adapting the proof of Theorem 4, we have the following result stating that the moments of the iterates of order $\alpha$ go to infinity but this speed can only be polynomially fast. + +Proposition 8. Given the tail-index $\alpha$ , we have $\mathbb { E } \| x _ { \infty } \| ^ { \alpha } = \infty .$ . Moreover, $\mathbb { E } \| x _ { k } \| ^ { \alpha } = O ( k )$ if $\alpha \leq 1$ and $\mathbb { E } \Vert x _ { k } \Vert ^ { \alpha } = O ( k ^ { \alpha } ) i f \alpha > 1 $ . + +It may be possible to leverage recent results on the concentration of products of i.i.d. random matrices (Huang et al., 2020; Henriksen & Ward, 2020) to study the tail of $x _ { k }$ for finite $k$ , which can be a future research direction. + +Extension to non-Gaussian data. Our main purpose in Theorem 1 is to show that heavy tails can arise even in the simplest setting when the input is Gaussian. However, Proposition 1 extends naturally if the input $a _ { i }$ is not necessarily Gaussian. For example, if we assume that the distribution of $a _ { i }$ has support of $\mathbb { R } ^ { d }$ and has a finite second moment, it can be checked that our proof technique for Theorem 1 will be still applicable and Theorem 1 will hold with $h ( s )$ defined by (3.4). The only difference is that when input is not Gaussian, the explicit formula (3.6) for $h ( s )$ will not hold as an equality but it will become an inequality, i.e. + +$$ +\begin{array} { r } { h ( s ) \leq \tilde { h } ( s ) : = \mathbb { E } \left[ \Vert \left( I - ( \eta / b ) H \right) e _ { 1 } \Vert ^ { s } \right] , } \end{array} +$$ + +where $h ( s )$ is defined by (3.4). This inequality is just a consequence of sub-multiplicativity of matrix products appearing in (3.4). If $\ddot { \alpha }$ is such that $\ddot { h } ( \alpha ) = 1$ , then by (3.11), $\ddot { \alpha }$ is a lower bound on the tail index $\alpha$ that satisfies $h ( \alpha ) = 1$ where $h$ is defined as in (3.4). In other words, when the input is not Gaussian, we have $\ddot { \alpha } \leq \alpha$ and therefore $\ddot { \alpha }$ serves as a lower bound on the tail index. Furthermore, Theorem 2 will also apply in the sense that $\ddot { \alpha }$ . $\ddot { \alpha }$ will be strictly increasing in batch size $b$ and strictly increasing in stepsize $\eta$ and variance $\sigma ^ { 2 }$ provided that $\ddot { \alpha } \geq 1$ . + +Extension to non-quadratic optimization. We note that extending our results beyond quadratic optimization is possible, if the gradients have asymptotic linear growth. For example, consider the cost $F ( x ) = \mathbb { E } [ \ell ( a ^ { T } x - y ) ]$ with loss function $\ell$ . The choice of $\ell ( z ) = \| z \| ^ { 2 } / 2$ is the standard linear regression setting where the gradient of $F ^ { \dagger }$ is an affine function of $x$ and in this case $\| \nabla F ( x ) - \Sigma x \|$ is bounded if we choose $\Sigma = \mathbb { E } [ a a ^ { T } ]$ . Theorem 1 will hold as long as there exists a matrix $\Sigma$ such that $\| \nabla F ( x ) - \Sigma x \|$ stays bounded even if the function $\ell$ is not a quadratic function, the proof is straightforward and would be based on verifying that the conditions of (Mirek, 2011, Theorem 1.4) hold in the setting of Theorem 1. This type of optimization problems arises for instance in robust regression where the objective is $F ( x ) = \mathbb { E } [ ( a ^ { T } x - b ) ^ { 2 } ] + \lambda g ( x )$ with a penalty function $g ( x )$ whose gradient is bounded and a tunable parameter $\lambda$ . The boundedness of the gradient of $g ( x )$ results in at-most linear growth of $g ( x )$ and allows robustness to outliers where the parameter $\lambda$ can be used to adjust the robustness level desired. Examples for the choice of $g ( x )$ include the smoothly clipped absolute deviation (SCAD) penalty (Loh & Wainwright (2015)), Huber loss (Huber, 1992) or the exponential squared loss when $g ( \bar { x ) } = 1 - \exp ( - \| x \| ^ { 2 } / c )$ where $c$ is a tuning parameter. + +Generalized Central Limit Theorem for Ergodic Averages. When $\alpha > 2$ , by Corollary 5, second moment of the iterates cumulative sum of the $x _ { k }$ r ase central limit theorem (CLT) says that if theis scaled properly, the resulting distribution is $\begin{array} { r } { S _ { K } = \sum _ { k = 1 } ^ { K } x _ { k } } \end{array}$ $\alpha < 2$ derive the following generalized CLT (GCLT) which says that if the iterates are properly scaled, the limit will be an $\alpha$ -stable distribution. This is stated in a more precise manner as follows. + +Corollary 9. Assume $\rho < 0$ so that Theorem 1 holds. Then, we have the following: + +(i) If $\alpha \in ( 0 , 1 ) \cup ( 1 , 2 )$ , then there is a sequence $d _ { K } = d _ { K } ( \alpha )$ and a function $C _ { \alpha } : \mathbb { S } ^ { d - 1 } \mapsto \mathbb { C }$ such that as $K \infty$ the random variables $K ^ { - \frac { 1 } { \alpha } } \left( S _ { K } - d _ { K } \right)$ converge in law to the $\alpha$ -stable random variable with characteristic function $\Upsilon _ { \alpha } ( t v ) = \exp ( t ^ { \alpha } C _ { \alpha } ( v ) )$ , for $t > 0$ and $v \in \mathbb { S } ^ { d - 1 }$ . + +(ii) If $\alpha = 1$ , then there are functions $\xi , \tau : ( 0 , \infty ) \mapsto \mathbb { R }$ and $C _ { 1 } : \mathbb { S } ^ { d - 1 } \mapsto \mathbb { C }$ such that as $K \infty$ the random variables $K ^ { - 1 } S _ { K } - K \xi \left( K ^ { - 1 } \right)$ converge in law to the random variable with characteristic function $\Upsilon _ { 1 } ( t v ) = \exp \left( t C _ { 1 } ( v ) + i t \langle v , \tau ( t ) \rangle \right)$ , for $t > 0$ and $v \in \mathbb { S } ^ { d - 1 }$ . + +(iii) If $\alpha = 2$ , then there is a sequence $d _ { K } = d _ { K } ( 2 )$ and $a$ function $C _ { 2 } : \mathbb { S } ^ { d - 1 } \mapsto \mathbb { R }$ such that as $K \infty$ the random variables $( K \log K ) ^ { - \frac { 1 } { 2 } }$ $( S _ { K } - d _ { K } )$ converge in law to the random variable with characteristic function $\Upsilon _ { 2 } ( t v ) = \exp \left( t ^ { 2 } C _ { 2 } ( v ) \right)$ , for $t > 0$ and $v \in \mathbb { S } ^ { d - 1 }$ . + +$( i \nu ) I f \alpha \in ( 0 , 1 )$ , then $d _ { K } = 0$ , and if $\alpha \in ( 1 , 2 ]$ , then $d _ { K } = K { \bar { x } }$ , where $\begin{array} { r } { \bar { x } = \int _ { \mathbb { R } ^ { d } } x \nu _ { \infty } ( d x ) } \end{array}$ . + +In addition to its evident theoretical interest, Corollary 9 has also an important practical implication: estimating the tail-index of a generic heavy-tailed distribution is a challenging problem (see e.g. Clauset et al. (2009); Goldstein et al. (2004); Bauke (2007)); however, for the specific case of $\alpha$ -stable distributions, accurate and computationally efficient estimators, which do not require the knowledge of the functions $C _ { \alpha } , \tau , \xi$ , have been proposed (Mohammadi et al., 2015). Thanks to Corollary 9, we will be able to use such estimators in our numerical experiments, as we will detail in the next section. + +We finally note that the gradient noise in SGD is actually both multiplicative and additive (Dieuleveut et al., 2017b;a); a fact that is often discarded for simplifying the mathematical analysis. In the linear regression setting, we have shown that the multiplicative noise $M _ { k }$ is the main source of heavy-tails, where a deterministic $M _ { k }$ would not lead to heavy tails.6 In the light of our theory, in Appendix A, we discuss in detail the recently proposed stochastic differential equation (SDE) representations of SGD in continuous-time and argue that, compared to classical SDEs driven by a Brownian motion (e.g., (Jastrz˛ebski et al., 2017; Cheng et al., 2019), SDEs driven by heavy-tailed $\alpha$ -stable Lévy processes (e.g., ( ¸Sim¸sekli et al., 2019b)) are more adequate when $\alpha < 2$ . + +# 4 EXPERIMENTS + +In this section, we present our experimental results on both synthetic and real data, in order to illustrate that our theory also holds in finite-sum problems (besides the streaming setting). Our main goal will be to illustrate the tail behavior of SGD by varying the algorithm parameters: depending on the choice of the stepsize $\eta$ and the batch-size $b$ , the iterates do converge to a heavy-tailed distribution (Theorem 1) and the behavior of the tail-index obeys Theorem 2. + +Synthetic experiments. In our first setting, we consider a simple synthetical setup, where we assume that the data points follow a Gaussian distribution. We will illustrate that the SGD iterates can become heavy-tailed even in this simplistic setting where the problem is a simple linear regression with all the variables being Gaussian. More precisely, we will consider the following model: + +$$ +x _ { 0 } \sim { \mathcal N } ( 0 , \sigma _ { x } ^ { 2 } I ) , \quad a _ { i } \sim { \mathcal N } ( 0 , \sigma ^ { 2 } I ) , \quad y _ { i } | a _ { i } , x _ { 0 } \sim { \mathcal N } \left( a _ { i } ^ { \top } x _ { 0 } , \sigma _ { y } ^ { 2 } \right) , +$$ + +where $x _ { 0 } , a _ { i } \in \mathbb { R } ^ { d }$ , $y _ { i } \in \mathbb { R }$ for $i = 1 , \ldots , n$ , and $\sigma , \sigma _ { x } , \sigma _ { y } > 0$ . + +In our experiments, we will need to estimate the tail-index $\alpha$ of the stationary distribution $\nu _ { \infty }$ . Even though several tail-index estimators have been proposed for generic heavy-tailed distributions in the literature (Paulauskas & Vaiciulis, 2011), we observed that, even for small ˇ $d$ , these estimators can yield inaccurate estimations and require tuning hyper-parameters, which is non-trivial. We circumvent this issue thanks to the GCLT in Corollary 9: since the average of the iterates is guaranteed to converge to a multivariate $\alpha$ -stable random variable, we can use the tail-index estimators that are specifically designed for stable distributions. By following Tzagkarakis et al. (2018); $\mathrm { S i }$ im¸sekli et al. (2019b), we use the estimator proposed by Mohammadi et al. (2015), which is fortunately agnostic to the scaling function $C _ { \alpha }$ . The details of this estimator are given in Appendix B. + +To be able to benefit from the CLT, we are required to compute the average of the ‘centered’ iterates: 1K−K P k=K−K0+1(xk − x¯), where $K _ { 0 }$ is a ‘burn-in’ period aiming to discard the initial phase of SGD, and the mean of $\nu _ { \infty }$ is given by $\begin{array} { r } { \bar { x } \ = \ \int _ { \mathbb { R } ^ { d } } x \nu _ { \infty } ( d x ) \ = \ ( A ^ { \top } \bar { A } ) ^ { - 1 } A ^ { \top } \bar { y } } \end{array}$ as long as $\alpha \ > \ 1 ^ { 7 }$ , where the $i$ -th row of $\textbf { \textit { A } } \in \mathbb { R } ^ { n \times d }$ contains $a _ { i } ^ { \top }$ and $y = [ y _ { 1 } , \ldots , y _ { n } ] \in \mathbb { R } ^ { n }$ . We then repeat this procedure 1600 times for different initial points and obtain 1600 different random vectors, whose distributions are supposedly close to an $\alpha$ -stable distribution. Finally, we run the tail-index estimator of Mohammadi et al. (2015) on these random vectors to estimate $\alpha$ . + +![](images/92be254b7e652df099a1f51160138880410dddce56ddcb8370fa927739aefddb.jpg) +Figure 1: Behavior of $\alpha$ with (a) varying stepsize $\eta$ and batch-size $b$ , (b) $d$ and $\sigma$ , (c) under RMSProp. + +In our first experiment, we investigate the tail-index $\alpha$ of the stationary measure $\nu _ { \infty }$ for varying stepsize $\eta$ and batch-size $b$ . We set $d = 1 0 0$ first fix the variances $\sigma = 1$ , $\sigma _ { x } = \sigma _ { y } = 3$ , and generate $\{ a _ { i } , y _ { i } \} _ { i = 1 } ^ { n }$ by simulating the statistical model. Then, by fixing this dataset, we run the SGD recursion (3.3) for a large number of iterations and vary $\eta$ from 0.02 to 0.2 and $b$ from 1 to 20. We also set $K = 1 0 0 0$ and $K _ { 0 } = 5 0 0$ . Figure 1(a) illustrates the results. We can observe that, increasing $\eta$ and decreasing $b$ both result in decreasing $\alpha$ , where the tail-index can be prohibitively small (i.e., $\alpha < 1$ , hence even the mean of $\nu _ { \infty }$ is not defined) for large $\eta$ . Besides, we can also observe that the tail-index is in strong correlation with the ratio $\eta / b$ . + +In our second experiment, we investigate the effect of $d$ and $\sigma$ on $\alpha$ . In Figure 1(b) (left), we set $d = 1 0 0$ , $\eta = 0 . 1$ and $b = 5$ and vary $\sigma$ from 0.8 to 2. For each value of $\sigma$ , we simulate a new dataset from by using the generative model and run SGD with $K , K _ { 0 }$ . We again repeat each experiment 1600 times. We follow a similar route for Figure 1(b) (right): we fix $\sigma = 1 . 7 5$ and repeat the previous procedure for each value of $d$ ranging from 5 to 50. The results confirm our theory: $\alpha$ decreases for increasing $\sigma$ and $d$ , and we can observe that for a fixed $b$ and $\eta$ the change in $d$ can abruptly alter $\alpha$ . In our final synthetic data experiment, we investigate how the tails behave under adaptive optimization algorithms. We replicate the setting of our first experiment, with the only difference that we replace SGD with RMSProp (Hinton et al., 2012). As shown in Figure 1(c), the ‘clipping’ effect of RMSProp as reported in Zhang et al. (2019) prevents the iterates become heavy-tailed and the vast majority of the estimated tail-indices is around 2, indicating a Gaussian behavior. On the other hand, we repeated the same experiment with the variance-reduced optimization algorithm SVRG (Johnson & Zhang, 2013), and observed that for almost all choices of $\eta$ and $b$ the algorithm converges near the minimizer (with an error in the order of $1 0 ^ { - 6 }$ ), hence the stationary distribution $\nu _ { \infty }$ seems to be a degenerate distribution, which does not admit a heavy-tailed behavior. Regarding the observed link between heavy-tails and generalization (Martin & Mahoney, 2019; ¸Sim¸sekli et al., 2020), this behavior of RMSProp and SVRG might be related to their ineffective generalization performance as reported in Keskar & Socher (2017); Defazio & Bottou (2019). + +Experiments on fully connected neural networks. In the second set of experiments, we investigate the applicability of our theory beyond the quadratic optimization problems. Here, we follow the setup of ¸Sim¸sekli et al. (2019a) and consider a fully connected neural network with the cross entropy loss and ReLU activation functions on the MNIST and CIFAR10 datasets. We train the models by using SGD for 10K iterations and we range $\eta$ from $1 0 ^ { - 4 }$ to $1 0 ^ { - 1 }$ and $b$ from 1 to 10. Since it would be computationally infeasible to repeat each run thousands of times as we did in the synthetic data experiments, in this setting we follow a different approach based on (i) ( ¸Sim¸sekli et al., 2019a) that suggests that the tail behavior can differ in different layers of a neural network, and (ii) (De Bortoli et al., 2020) that shows that in the infinite width limit, the different components of a given layer of a two-layer fully connected network (FCN) becomes independent. Accordingly, we first compute the average of the last 1K SGD iterates, whose distribution should be close an $\alpha$ -stable distribution by the GCLT. We then treat each layer as a collection of i.i.d. $\alpha$ -stable random variables and measure the tail-index of each individual layer separately by using the the estimator from Mohammadi et al. (2015). Figure 2 shows the results for a three-layer network (with 128 hidden units at each layer) , whereas we obtained very similar results with a two-layer network as well. We observe that, while the dependence of $\alpha$ on $\eta / b$ differs from layer to layer, in each layer the measured $\alpha$ correlate very-well with the ratio $\eta / b$ in both datasets. + +![](images/a2d68eb1c52ea867ab8ed03b778489370dc8dc7fe4e147aac7a6595039de9fe8.jpg) +Figure 2: Results on FCNs. Different markers represent different initializations with the same $\eta , b$ + +Experiments on VGG networks. In our last set of experiments, we evaluate our theory on VGG networks (Simonyan & Zisserman, 2015) with 11 layers (10 convolutional layers with max-pooling and ReLU units, followed by a final linear layer), which contains 10M parameters. We follow the same procedure as we used for the fully connected networks, where we vary $\eta$ from $1 0 ^ { - 4 }$ to $1 . 7 \times 1 0 ^ { - 3 }$ and $b$ from 1 to 10. + +The results are shown in Figure 3. Similar to the previous experiments, we observe that $\alpha$ depends on the layer. For the intermediate layers (Layers 2-8), the tail index correlates well with the ratio $\eta / b$ , whereas the first and last two convolutional layers (Layers 9 and 10) exhibit a Gaussian behavior $\alpha \approx 2$ ). + +![](images/da90b9790b81084e8462dcb3da9d1350eba463f4da485ece075e67c483ef9a95.jpg) +Figure 3: Results on VGG networks. The values of $\alpha$ that exceeded 2 is truncated to 2 for visualization purposes. + +On the other hand, the tail-index of the last layer (which is linear) does not correlate with either $\eta$ or $b$ These observations provide further support for our theory and show that the heavy-tail phenomenon also occurs in neural networks, whereas $\alpha$ is potentially related to $\eta$ and $b$ in a more complicated way. + +# 5 CONCLUSION AND FUTURE DIRECTIONS + +We studied the tail behavior of the SGD in a quadratic optimization problem and showed that depending on the curvature, $\eta .$ , and $b$ , the iterates can converge to a heavy-tailed random variable. We further supported our theory with experiments conducted on fully connected neural networks and illustrated that our results would also apply to more general settings and hence provide new insights about the behavior of SGD in deep learning. This study also brings up a number of future directions. (i) Our proof techniques are for the streaming setting, where each sample is used only once. However, in practice SGD is typically implemented on the finite-sum problem (1.2) with multiple passes over the data. Extending our results to this scenario and investigating the effects of finite-sample size on the tail index and generalization would be an interesting future research direction. (ii) We suspect that the tail index of the SGD iterates may have an impact on the time required to escape a saddle point and this can be investigated further as another future research direction. + +# REFERENCES + +Alnur Ali, Edgar Dobriban, and Ryan J Tibshirani. The implicit regularization of stochastic gradient flow for least squares. arXiv preprint arXiv:2003.07802, 2020. + +Gerold Alsmeyer and Sebastian Mentemeier. Tail behaviour of stationary solutions of random difference equations: the case of regular matrices. Journal of Difference Equations and Applications, 18 (8):1305–1332, 2012. + +Heiko Bauke. Parameter estimation for power-law distributions by maximum likelihood methods. The European Physical Journal B, 58(2):167–173, 2007. + +Gérard Ben Arous and Alice Guionnet. The spectrum of heavy tailed random matrices. Communications in Mathematical Physics, 278(3):715–751, 2008. + +Jean Bertoin. Lévy Processes. Cambridge University Press, 1996. + +Dariusz Buraczewski, Ewa Damek, and Mariusz Mirek. Asymptotics of stationary solutions of multivariate stochastic recursions with heavy tailed inputs and related limit theorems. Stochastic Processes and Their Applications, 122(1):42–67, 2012. + +Dariusz Buraczewski, Ewa Damek, Yves Guivarc’h, and Sebastian Mentemeier. On multidimensional Mandelbrot cascades. Journal of Difference Equations and Applications, 20(11):1523–1567, 2014. + +Dariusz Buraczewski, Ewa Damek, and Tomasz Przebinda. On the rate of convergence in the Kesten renewal theorem. Electronic Journal of Probaiblity, 20(22):1–35, 2015. + +Dariusz Buraczewski, Ewa Damek, and Thomas Mikosch. Stochastic Models with Power-Law Tails. Springer, 2016. + +Pratik Chaudhari and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. In International Conference on Learning Representations, 2018. + +Xiang Cheng, Dong Yin, Peter L Bartlett, and Michael I Jordan. Stochastic gradient and langevin processes. arXiv preprint arXiv:1907.03215, 2019. + +Aaron Clauset, Cosma Rohilla Shalizi, and Mark EJ Newman. Power-law distributions in empirical data. SIAM Review, 51(4):661–703, 2009. + +Valentin De Bortoli, Alain Durmus, Xavier Fontaine, and Umut Simsekli. Quantitative propagation of chaos for sgd in wide neural networks. arXiv preprint arXiv:2007.06352, 2020. + +Aaron Defazio and Leon Bottou. On the ineffectiveness of variance reduced optimization for deep learning. In Advances in Neural Information Processing Systems, pp. 1755–1765, 2019. + +Aymeric Dieuleveut, Alain Durmus, and Francis Bach. Bridging the gap between constant step size stochastic gradient descent and Markov chains. arXiv preprint arXiv:1707.06386, 2017a. + +Aymeric Dieuleveut, Nicolas Flammarion, and Francis Bach. Harder, better, faster, stronger convergence rates for least-squares regression. The Journal of Machine Learning Research, 18(1): 3520–3570, 2017b. + +Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1019–1028. JMLR. org, 2017. + +Holger Fink and Claudia Klüppelberg. Fractional Lévy-driven Ornstein–Uhlenbeck processes and stochastic differential equations. Bernoulli, 17(1):484–506, 2011. + +Roy Frostig, Rong Ge, Sham M Kakade, and Aaron Sidford. Competing with the empirical risk minimizer in a single pass. In Conference on Learning Theory, pp. 728–763, 2015. + +Charles M Goldie. Implicit renewal theory and tails of solutions of random equations. Annals of Applied Probability, 1(1):126–166, 1991. + +Michel L Goldstein, Steven A Morris, and Gary G Yen. Problems with fitting to the power-law distribution. The European Physical Journal B-Condensed Matter and Complex Systems, 41(2): 255–258, 2004. + +Amelia Henriksen and Rachel Ward. Concentration inequalities for random matrix products. Linear Algebra and its Applications, 594:81–94, 2020. + +Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Overview of mini-batch gradient descent. Neural Networks for Machine Learning, Lecture 6a, 2012. URL http://www.cs.toronto. edu/\~hinton/coursera/lecture6/lec6.pdf. + +Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997. + +Liam Hodgkinson and Michael W Mahoney. Multiplicative noise and heavy tails in stochastic optimization. arXiv preprint arXiv:2006.06293, 2020. + +Wenqing Hu, Chris Junchi Li, Lei Li, and Jian-Guo Liu. On the diffusion approximation of nonconvex stochastic gradient descent. Annals of Mathematical Science and Applications, 4(1):3–32, 2019. + +De Huang, Jonathan Niles-Weed, Joel A. Tropp, and Rachel Ward. Matrix concentration for products. arXiv preprint arXiv:2003.05437, 2020. + +Peter J Huber. Robust estimation of a location parameter. In Breakthroughs in statistics, pp. 492–518. Springer, 1992. + +Prateek Jain, Sham M Kakade, Rahul Kidambi, Praneeth Netrapalli, and Aaron Sidford. Accelerating stochastic gradient descent. In Proc. STAT, volume 1050, pp. 26, 2017. + +Stanisław Jastrz˛ebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos Storkey. Three factors influencing minima in SGD. arXiv preprint arXiv:1711.04623, 2017. + +Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In Advances in Neural Information Processing Systems, pp. 315–323, 2013. + +Nitish Shirish Keskar and Richard Socher. Improving generalization performance by switching from Adam to SGD. arXiv preprint arXiv:1712.07628, 2017. + +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. + +Harry Kesten. Random difference equations and renewal theory for products of random matrices. Acta Mathematica, 131:207–248, 1973. + +Paul Lévy. Théorie de l’addition des variables aléatoires. Gauthiers-Villars, Paris, 1937. + +Aitor Lewkowycz, Yasaman Bahri, Ethan Dyer, Jascha Sohl-Dickstein, and Guy Gur-Ari. The large learning rate phase of deep learning: the catapult mechanism. arXiv preprint arXiv:2003.02218, 2020. + +Qianxiao Li, Cheng Tai, and Weinan E. Stochastic modified equations and adaptive stochastic gradient algorithms. In Proceedings of the 34th International Conference on Machine Learning, pp. 2101–2110, 06–11 Aug 2017. + +Po-Ling Loh and Martin J Wainwright. Regularized m-estimators with nonconvexity: Statistical and algorithmic theory for local optima. The Journal of Machine Learning Research, 16(1):559–616, 2015. + +Stephan Mandt, Matthew D. Hoffman, and David M. Blei. A variational analysis of stochastic gradient algorithms. In International Conference on Machine Learning, pp. 354–363, 2016. + +Charles H Martin and Michael W Mahoney. Traditional and heavy-tailed self regularization in neural network models. arXiv preprint arXiv:1901.08276, 2019. + +Mariusz Mirek. Heavy tail phenomenon and convergence to stable laws for iterated Lipschitz maps. Probability Theory and Related Fields, 151(3-4):705–734, 2011. + +Mohammad Mohammadi, Adel Mohammadpour, and Hiroaki Ogata. On estimating the tail index and the spectral measure of multivariate $\alpha$ -stable distributions. Metrika, 78(5):549–561, 2015. + +Charles M Newman. The distribution of Lyapunov exponents: Exact results for random matrices. Communications in Mathematical Physics, 103(1):121–126, 1986. + +Thanh Huy Nguyen, Umut Simsekli, Mert Gurbuzbalaban, and Gaël Richard. First exit time analysis of stochastic gradient descent under heavy-tailed gradient noise. In Advances in Neural Information Processing Systems, pp. 273–283, 2019. + +Bernt Øksendal. Stochastic Differential Equations: An Introduction with Applications. Springer Science & Business Media, 2013. + +Abhishek Panigrahi, Raghav Somani, Navin Goyal, and Praneeth Netrapalli. Non-Gaussianity of stochastic gradient noise. arXiv preprint arXiv:1910.09626, 2019. + +Vygantas Paulauskas and Marijus Vaiciulis. Once more on comparison of tail index estimators. ˇ arXiv preprint arXiv:1104.1242, 2011. + +Ilya Pavlyukevich. Cooling down Lévy flights. Journal of Physics A: Mathematical and Theoretical, 40(41):12299–12313, 2007. + +Shai Shalev-Shwartz and Shai Ben-David. Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press, 2014. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015. + +Umut ¸Sim¸sekli, Mert Gürbüzbalaban, Thanh Huy Nguyen, Gaël Richard, and Levent Sagun. On the heavy-tailed theory of stochastic gradient descent for deep neural networks. arXiv preprint arXiv:1912.00018, 2019a. + +Umut ¸Sim¸sekli, Levent Sagun, and Mert Gürbüzbalaban. A tail-index analysis of stochastic gradient noise in deep neural networks. In International Conference on Machine Learning, pp. 5827–5837, 2019b. + +Umut ¸Sim¸sekli, Ozan Sener, George Deligiannidis, and Murat A Erdogdu. Hausdorff dimension, stochastic differential equations, and generalization in neural networks. arXiv preprint arXiv:2006.09313, 2020. + +George Tzagkarakis, John P Nolan, and Panagiotis Tsakalides. Compressive sensing of temporally correlated sources using isotropic multivariate stable laws. In 2018 26th European Signal Processing Conference (EUSIPCO), pp. 1710–1714. IEEE, 2018. + +Cédric Villani. Optimal Transport: Old and New. Springer, Berlin, 2009. + +Jingzhao Zhang, Sai Praneeth Karimireddy, Andreas Veit, Seungyeon Kim, Sashank J Reddi, Sanjiv Kumar, and Suvrit Sra. Why ADAM beats SGD for attention models. arXiv preprint arXiv:1912.03194, 2019. + +Zhanxing Zhu, Jingfeng Wu, Bing Yu, Lei Wu, and Jinwen Ma. The anisotropic noise in stochastic gradient descent: Its behavior of escaping from minima and regularization effects. arXiv preprint arXiv:1803.00195, 2018. + +# A A NOTE ON STOCHASTIC DIFFERENTIAL EQUATION REPRESENTATIONS FOR SGD + +In recent years, a popular approach for analyzing the behavior of SGD has been viewing it as a discretization of a continuous-time stochastic process that can be represented via a stochastic differential equation (SDE) (Mandt et al., 2016; Jastrz˛ebski et al., 2017; Li et al., 2017; Hu et al., 2019; Zhu et al., 2018; Chaudhari & Soatto, 2018; ¸Sim¸sekli et al., 2019b). While these SDEs have been useful for understanding different properties of SGD, their differences and functionalities have not been clearly understood. In this section, in the light of our theoretical results, we will discuss in which situation their choice would be more appropriate. We will restrict ourselves to the case where $f ( x )$ is a quadratic function; however, the discussion can be extended to more general $f$ . + +The SDE approximations are often motivated by first rewriting the SGD recursion as follows: + +$$ +x _ { k + 1 } = x _ { k } - \eta \nabla \tilde { f } _ { k + 1 } \left( x _ { k } \right) = x _ { k } - \eta \nabla f \left( x _ { k } \right) + \eta U _ { k + 1 } ( x _ { k } ) , +$$ + +where $U _ { k } ( x ) : = \nabla \tilde { f } _ { k } ( x ) - \nabla f ( x )$ is called the ‘stochastic gradient noise’. Then, based on certain statistical assumptions on $U _ { k }$ , we can view (A.1) as a discretization of an SDE. For instance, if we assume that the gradient noise follows a Gaussian distribution, whose covariance does not depend on the iterate $x _ { k }$ , i.e., $\eta U _ { k } \approx \sqrt { \eta } Z _ { k }$ where $Z _ { k } \sim \mathcal N ( 0 , \sigma _ { z } \eta I )$ for some constant $\sigma _ { z } > 0$ , we can see (A.1) as the Euler-Maruyama discretization of the following SDE with stepsize $\eta$ (Mandt et al., 2016): + +$$ +\mathrm { d } x _ { t } = - \nabla f ( x _ { t } ) \mathrm { d } t + \sqrt { \eta \sigma _ { z } } \mathrm { d } \mathrm { B } _ { t } , +$$ + +where $\mathrm { B } _ { t }$ denotes the $d$ -dimensional standard Brownian motion. This process is called the OrnsteinUhlenbeck (OU) process (see e.g. Øksendal (2013)), whose invariant measure is a Gaussian distribution. We argue that this process can be a good proxy to (3.3) only when $\alpha \geq 2$ , since otherwise the SGD iterates will exhibit heavy-tails, whose behavior cannot be captured by a Gaussian distribution. As we illustrated in Section 4, to obtain large $\alpha$ , the step-size $\eta$ needs to be small and/or the batch-size $b$ needs to be large. However, it is clear that this approximation will fall short when the system exhibits heavy tails, i.e., $\alpha < 2$ . Therefore, for the large $\eta / b$ regime, which appears to be more interesting since it often yields improved test performance (Jastrz˛ebski et al., 2017), this approximation would be inaccurate for understanding the behavior of SGD. This problem mainly stems from the fact that the additive isotropic noise assumption results in a deterministic $M _ { k }$ matrix for all $k$ . Since there is no multiplicative noise term, this representation cannot capture a potential heavy-tailed behavior. + +A natural extension of the state-independent Gaussian noise assumption is to incorporate the covariance structure of $U _ { k }$ . In our linear regression problem, we can easily see that the covariance matrix of the gradient noise has the following form: + +$$ +\Sigma _ { U } ( x ) = \mathrm { C o v } ( U _ { k } | x ) = \frac { \sigma ^ { 2 } } { b } \mathrm { d i a g } ( x \circ x ) , +$$ + +where $\circ$ denotes element-wise multiplication and $\sigma ^ { 2 }$ is the variance of the data points. Therefore, we can extend the previous assumption by assuming $Z _ { k } | x \sim \mathcal { N } ( 0 , \eta \Sigma _ { U } ( x ) )$ . It has been observed that this approximation yields a more accurate representation (Cheng et al., 2019; Ali et al., 2020; Jastrz˛ebski et al., 2017). Using this assumption in (A.1), the SGD recursion coincides with the Euler-Maruyama discretization of the following SDE: + +$$ +\begin{array} { r l } & { d x _ { t } = - \nabla f ( x _ { t } ) d t + \sqrt { \eta \Sigma _ { U } ( x _ { t } ) } d \mathrm { B } _ { t } } \\ & { \qquad \stackrel { \mathrm { d } } { = } - \left( A ^ { \top } A x _ { t } - A ^ { \top } y \right) d t + \sqrt { \frac { \sigma ^ { 2 } \eta } { b } } \mathrm { d i a g } ( x _ { t } ) d \mathrm { B } _ { t } , } \end{array} +$$ + +where $\circeq$ denotes equality in distribution. The stochasticity in such SDEs is called often called multiplicative. Let us illustrate this property by discretizing this process and by using the definition of the gradient and the covariance matrix, we observe that (noting that $N _ { k } \sim \mathcal { N } ( 0 , I )$ ) + +$$ +\begin{array} { r l } & { x _ { k + 1 } = x _ { k } - \eta \left( A ^ { \top } A x _ { k } - A ^ { \top } y \right) + \sqrt { \frac { \sigma ^ { 2 } \eta ^ { 2 } } { b } } \mathrm { d i a g } ( x _ { k } ) N _ { k + 1 } } \\ & { \qquad = \left( I - \eta A ^ { \top } A + \sqrt { \sigma ^ { 2 } \eta ^ { 2 } / b } \mathrm { d i a g } ( N _ { k + 1 } ) \right) x _ { k } - \eta A ^ { \top } y , } \end{array} +$$ + +where we can clearly see the multiplicative effect of the noise, as indicated by its name. On the other hand, we can observe that, thanks to the multiplicative structure, this process would be able to capture the potential heavy-tailed structure of SGD. However, there are two caveats. The first one is that, in the case of linear regression, the process is called a geometric (or modified) Ornstein-Uhlenbeck process which is an extension of geometric Brownian motion. One can show that the distribution of the process at any time $t$ will have lognormal tails. Hence it will be accurate only when the tail-index $\alpha$ is close to the one of the lognormal distribution. The second caveat is that, for a more general cost function $f$ , the covariance matrix is more complicated and hence the invariant measure of the process cannot be found analytically, hence analyzing these processes for a general $f$ can be as challenging as directly analyzing the behavior of SGD. + +The third way of modeling the gradient noise is based on assuming that it is heavy-tailed. In particular, we can assume that $\eta U _ { k } \approx \eta ^ { 1 / \alpha } L _ { k }$ where $[ L _ { k } ] _ { i } \sim { \mathcal { S } } \alpha { \mathcal { S } } ( \sigma _ { L } \eta ^ { ( \alpha - 1 ) / \alpha } )$ for all $i = 1 , \ldots , d$ Under this assumption the SGD recursion coincides with the Euler discretization of the following Lévy-driven SDE ( ¸Sim¸sekli et al., 2019b): + +$$ +d x _ { t } = - \nabla f ( x _ { t } ) d t + \sigma _ { L } \eta ^ { ( \alpha - 1 ) / \alpha } d \mathrm { L } _ { t } ^ { \alpha } , +$$ + +where $\mathrm { L } _ { t } ^ { \alpha }$ denotes the $\alpha$ -stable Lévy process with independent components (see Section A.1 for technical background on Lévy processes and in particular $\alpha$ -stable Lévy processes). In the case of linear regression, this processes is called a fractional OU process (Fink & Klüppelberg, 2011), whose invariant measure is also an $\alpha$ -stable distribution with the same tail-index $\alpha$ . Hence, even though it is based on an isotropic, state-independent noise assumption, in the case of large $\eta / b$ regime, this approach can mimic the heavy-tailed behavior of the system with the exact tail-index $\alpha$ . On the other hand, Buraczewski et al. (2016) (Theorem 1.7 and 1.16) showed that if $U _ { k }$ is assumed to heavy tailed with index $\alpha$ (not necessarily $S \alpha S$ ) then the process $x _ { k }$ will inherit the same tails and the ergodic averages will still converge to an $s \alpha s$ random variable, hence generalizing the conclusions of the $s \alpha s$ assumption to the case where $U _ { k }$ follows an arbitrary heavy-tailed distribution. + +# A.1 TECHNICAL BACKGROUND: LÉVY PROCESSES + +Lévy motions (processes) are stochastic processes with independent and stationary increments, which include Brownian motions as a special case, and in general may have heavy-tailed distributions (see e.g. Bertoin (1996) for a survey). Symmetric $\alpha$ -stable Lévy motion is a Lévy motion whose time increments are symmetric $\alpha$ -stable distributed. We define $\mathrm { L } _ { t } ^ { \alpha }$ , a $d$ -dimensional symmetric $\alpha$ -stable Lévy motion as follows. Each component of $\mathrm { L } _ { t } ^ { \alpha }$ is an independent scalar $\alpha$ -stable Lévy process defined as follows: + +(i) $\mathrm { L } _ { 0 } ^ { \alpha } = 0$ almost surely; +(ii) For any $t _ { 0 } < t _ { 1 } < \cdots < t _ { N }$ , the increments $\mathrm { L } _ { t _ { n } } ^ { \alpha } - \mathrm { L } _ { t _ { n - 1 } } ^ { \alpha }$ are independent, $n = 1 , 2 , \ldots , N$ ; +(iii) The difference $\mathrm { L } _ { t } ^ { \alpha } - \mathrm { L } _ { s } ^ { \alpha }$ and $\mathrm { L } _ { t - s } ^ { \alpha }$ have the same distribution: $\displaystyle S \alpha S ( ( t - s ) ^ { 1 / \alpha } )$ for $s < t$ ; +(iv) $\mathrm { L } _ { t } ^ { \alpha }$ has stochastically continuous sample paths, i.e. for any $\delta > 0$ and $s \geq 0$ , $\mathbb { P } ( | \mathrm { L } _ { t } ^ { \alpha } - \mathrm { L } _ { s } ^ { \alpha } | >$ $\delta ) 0$ as $t \to s$ . + +When $\alpha = 2$ , we obtain a scaled Brownian motion as a special case, i.e. $\mathrm { L } _ { t } ^ { \alpha } = \sqrt { 2 } \mathrm { B } _ { t }$ , so that the difference $\mathrm { L } _ { t } ^ { \alpha } - \mathrm { L } _ { s } ^ { \alpha }$ follows a Gaussian distribution $\mathcal { N } ( 0 , \bar { 2 } ( t - s ) )$ . + +# B TAIL-INDEX ESTIMATION + +In this study, we follow Tzagkarakis et al. (2018); ¸Sim¸sekli et al. (2019b), and make use of the recent estimator proposed by Mohammadi et al. (2015). + +Theorem 10 (Mohammadi et al. (2015) Corollary 2.4). Let $\{ X _ { i } \} _ { i = 1 } ^ { K }$ be a collection of strictly stable random variables in $\mathbb { R } ^ { d }$ with tail-index $\alpha \in ( 0 , 2 ]$ and $K = K _ { 1 } { \times } K _ { 2 }$ . Define $\begin{array} { r } { Y _ { i } = \sum _ { j = 1 } ^ { K _ { 1 } } X _ { j + ( i - 1 ) K _ { 1 } } } \end{array}$ for $i \in [ [ 1 , K _ { 2 } ] ]$ . Then, the estimator + +$$ +\widehat { \frac { 1 } { \alpha } } \triangleq { \frac { 1 } { \log K _ { 1 } } } { \Big ( } { \frac { 1 } { K _ { 2 } } } \sum _ { i = 1 } ^ { K _ { 2 } } \log \| Y _ { i } \| - { \frac { 1 } { K } } \sum _ { i = 1 } ^ { K } \log \| X _ { i } \| { \Big ) } , +$$ + +converges to $1 / \alpha$ almost surely, as $K _ { 2 } \infty$ + +As this estimator requires a hyperparameter $K _ { 1 }$ , at each tail-index estimation, we used several values for $K _ { 1 }$ and we used the median of the estimators obtained with different values of $K _ { 1 }$ . We provide the codes in the supplement, where the implementation details can be found. For the neural network experiments, we used the same setup as provided in the repository of ¸Sim¸sekli et al. (2019b). + +# C PROOFS OF MAIN RESULTS + +C.1 PROOF OF THEOREM 1 + +Proof of Theorem 1. The proof follows from (Buraczewski et al., 2016, Thm 4.4.15) which goes back to (Alsmeyer & Mentemeier, 2012, Theorem 1.1) and Kesten (Kesten, 1973, Theorem 6). See also (Goldie, 1991; Buraczewski et al., 2015). We recall that we have the stochastic recursion: + +$$ +x _ { k } = M _ { k } x _ { k - 1 } + q _ { k } , +$$ + +where the sequence $( M _ { k } , q _ { k } )$ are i.i.d. distributed as $( M , q )$ and for each $k$ , $( M _ { k } , q _ { k } )$ is independent of $x _ { k - 1 }$ . To apply (Buraczewski et al., 2016, Thm 4.4.15), it suffices to have the following conditions being satisfied: + +1. $M$ is invertible with probability 1. +2. The matrix $M$ has a continuous Lebesgue density that is positive in a neighborhood of the identity matrix. +3. $\rho < 0$ and $h ( \alpha ) = 1$ . +4. $\mathbb { P } ( M x + q = x ) < 1$ for every $x$ . +$5 . \mathbb { E } \left[ \| M \| ^ { \alpha } ( \log ^ { + } \| M \| + \log ^ { + } \| M ^ { - 1 } \| ) \right] < \infty .$ +6. $0 < \mathbb { E } \| q \| ^ { \alpha } < \infty$ . + +All the conditions are satisfied under our assumptions. In particular, Condition 1 and Condition 5 are proved in Lemma 18, and Condition 2 and Condition 4 follow from the fact that $M$ and $q$ have continuous distributions. If $\rho < 0$ , then by Lemma 15, we have $h ( 0 ) = 1$ , $h ^ { \prime } ( 0 ) = \rho < 0$ and $h ( s )$ is convex in $s$ , and moreover by Lemma 16, we have li $\mathrm { n i n f } _ { s \to \infty } h ( s ) > 1$ . Therefore, there exists some $\alpha \in ( 0 , \infty )$ such that $h ( \alpha ) = 1$ , which gives Condition 3. Finally, Condition 6 is satisfied by the definition of $q$ and by the Assumptions (A1)–(A2). □ + +# C.2 PROOF OF THEOREM 2 + +Proof of Theorem 2. We will split the proof of Theorem 2 into two parts: + +(I) We will show that the tail-index $\alpha$ is strictly decreasing in stepsize $\eta$ and variance $\sigma ^ { 2 }$ provided that $\alpha \geq 1$ . + +(II) We will show that the tail-index $\alpha$ is strictly increasing in batch size $b$ provided that $\alpha \geq 1$ . + +(III) We will show that the tail-index $\alpha$ is strictly decreasing in dimension $d$ . + +First, let us prove (I). Let $a : = \eta \sigma ^ { 2 } > 0$ be given. Consider the tail-index $\alpha$ as a function of $a$ , i.e. + +$$ +\alpha ( a ) : = \operatorname* { m i n } \{ s : h ( a , s ) = 1 \} , +$$ + +where $h ( a , s ) = h ( s )$ with emphasis on dependence on $a$ + +By assumption, $\alpha ( a ) \geq 1$ . The function $h ( a , s )$ is convex function of $a$ (see Lemma 19 for $s \geq 1$ and a strictly convex function of $s$ for $s \geq 0$ ). Furthermore, it satisfies $h ( a , 0 ) = 1$ for every $a \geq 0$ and $h ( 0 , s ) = 1$ for every $s \geq 0$ . We consider the curve + +$$ +\mathcal { C } : = \left. ( a , s ) \in ( 0 , \infty ) \times \left[ 1 , \infty \right] : h ( a , s ) = 1 \right. . +$$ + +This is the set of the choice of $a$ , which leads to a tail-index $s$ where $s \geq 1$ . Since $h$ is smooth in both $a$ and $s$ , we can represent $s$ as a smooth function of $a$ , i.e. on the curve + +$$ +h ( a , s ( a ) ) = 0 , +$$ + +where $s ( a )$ is a smooth function of $a$ . We will show that $s ^ { \prime } ( a ) < 0$ ; i.e. if we increase $a$ ; the tail-index $s ( a )$ will drop. Pick any $( a _ { * } , s _ { * } ) \in \mathcal { C }$ , it will satisfy $h ( a _ { * } , s _ { * } ) = 1$ . We have the following facts: + +$( i )$ The function $h ( a , s ) = 1$ for either $a = 0$ or $s = 0$ . This is illustrated in Figure 4 with a blue marker. +(ii) $h ( a _ { * } , s ) < 1$ for $s < s _ { * }$ . This follows from the convexity of $h ( a _ { * } , s )$ function and the fact that $h ( a _ { * } , 0 ) = 1$ , $h ( a _ { * } , s _ { * } ) = 1$ . From here, we see that the function $h ( a _ { * } , s )$ is increasing at $s = s _ { \ast }$ and we have its derivative + +$$ +\frac { \partial h } { \partial s } ( a _ { * } , s _ { * } ) > 0 . +$$ + +$( i i i )$ The function $h ( a , s _ { * } )$ is convex as a function of $a$ by Lemma 19, it satisfies $h ( 0 , s _ { * } ) =$ $h ( a _ { * } , s _ { * } ) = 1$ . Therefore, by convexity $h ( a , s _ { * } ) < 1$ for $\mathfrak { i } \in ( 0 , s _ { * } )$ ; otherwise the function $h ( a , s _ { * } )$ would be a constant function. We have therefore necessarily. + +$$ +\frac { \partial h } { \partial a } ( a _ { \ast } , s _ { \ast } ) > 0 . +$$ + +nction . The $h ( a , s _ { * } )$ o $\begin{array} { r } { h ( a , s _ { \ast } ) \geq h ( a _ { \ast } , s _ { \ast } ) + \frac { \partial h } { \partial a } ( a _ { \ast } , s _ { \ast } ) ( a - } \end{array}$ $\dot { a _ { * } ) } > h ( \dot { a _ { * } } , s _ { * } ) = 1$ $h ( a , s _ { * } ) > 1$ $a > a _ { * }$ $h ( a , s ) > 1$ for $a > a *$ and $s > s _ { * }$ (otherwise if $h ( a , s ) \leq 1$ , we get a contradiction because $h ( 0 , s ) = 1$ , $h ( a _ { * } , s ) > 1$ and $h ( a , s ) \leq 1$ is impossible due to convexity). This is illustrated in Figure 4 where we mark this region as a rectangular box where $h > 1$ . + +$( i v )$ By similar arguments we can show that the function $h ( a , s ) < 1$ if $( s , a ) \in ( 0 , a _ { * } ) \times [ 1 , s _ { * } )$ Indeed, if $h ( a , s ) \geq 1$ for some $( s , a ) \in [ 1 , s _ { * } ) \times ( 0 , a _ { * } )$ , this contradicts the fact that $h ( 0 , s ) = 1$ and $h ( a _ { * } , s ) < 1$ proven in part $( i i )$ . This is illustrated in Figure 4 where inside the rectangular box on the left-hand side, we have $h < 1$ . + +$$ +\begin{array} { l } { { s } } \\ { { s _ { * } \displaystyle \vert \displaystyle \frac { \vert h > 1 } { h < 1 } \sum _ { i = 1 } ^ { n } } } \\ { { 1 \displaystyle \left[ \displaystyle \frac { \vert } { \vert \cdot \vert \cdot \vert } \right] { - 1 } \sum _ { a } } } \end{array} +$$ + +Figure 4: The curve $h ( a , s ) = 1$ in the $( a , s )$ plane + +Geometrically, we see from Figure 4 that the curve $s ( a )$ as a function of $a$ , is sandwiched between two rectangular boxes and has necessarily $s ^ { \prime } ( a ) < 0$ . This can also be directly obtained rigorously from the implicit function theorem; if we differentiate the implicit equation $h ( a , s ( a ) ) = 0$ with respect to $a$ , we obtain + +$$ +\frac { \partial h } { \partial a } ( a _ { * } , s _ { * } ) + \frac { \partial h } { \partial s } ( a _ { * } , s _ { * } ) s ^ { \prime } ( a _ { * } ) = 0 . +$$ + +From parts $( i i ) - ( i i i )$ , we have $\textstyle { \frac { \partial h } { \partial a } } ( a _ { * } , s _ { * } )$ and $\begin{array} { r } { \frac { \partial h } { \partial s } ( a _ { * } , s _ { * } ) > 0 } \end{array}$ . Therefore, we have + +$$ +\begin{array} { r } { s ^ { \prime } ( a _ { * } ) = - \frac { \frac { \partial h } { \partial a } \left( a _ { * } , s _ { * } \right) } { \frac { \partial h } { \partial s } \left( a _ { * } , s _ { * } \right) } < 0 , } \end{array} +$$ + +which completes the proof for $s _ { * } \geq 1$ + +Next, let us prove (II). With slight abuse of notation, we define the function $h ( b , s ) = h ( s )$ to emphasize the dependence on $b$ . We have + +$$ +h ( b , s ) = \mathbb { E } \left\| \left( I - \frac { \eta } { b } \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } \right) e _ { 1 } \right\| ^ { s } . +$$ + +where we used Lemma 14. When $s \geq 1$ , the function $x \mapsto \| x \| ^ { s }$ is convex, and by Jensen’s inequality, we get for any $b \geq 2$ and $b \in \mathbb { N }$ , + +$$ +\begin{array} { r l } { { h ( b , s ) = \mathbb { E } \| \frac { 1 } { b } \sum _ { i = 1 } ^ { b } ( I - \frac { \eta } { b - 1 } \sum _ { j \neq i } a _ { j } a _ { j } ^ { T } ) e _ { 1 } \| ^ { s } } } \\ & { \leq \mathbb { E } [ \frac { 1 } { b } \sum _ { i = 1 } ^ { b } \| ( I - \frac { \eta } { b - 1 } \sum _ { j \neq i } a _ { j } a _ { j } ^ { T } ) e _ { 1 } \| ^ { s } ] } \\ & { = \frac { 1 } { b } \sum _ { i = 1 } ^ { b } \mathbb { E } [ \| ( I - \frac { \eta } { b - 1 } \sum _ { j \neq i } a _ { j } a _ { j } ^ { T } ) e _ { 1 } \| ^ { s } ] = h ( b - 1 , s ) , } \end{array} +$$ + +where we used the fact that $a _ { i }$ are i.i.d. Indeed, from the condition for equality to hold in Jensen’s inequality, and the fact that $a _ { i }$ are i.i.d. random, the inequality above is a strict inequality. Hence when $d \in \mathbb { N }$ for any $s \geq 1$ , $h ( b , s )$ is strictly decreasing in $b$ . By following the same argument as in the proof of (I), we conclude that the tail-index $\alpha$ is strictly increasing in batch size $b$ . + +Finally, let us prove (III). Let us show the tail-index $\alpha$ is strictly decreasing in dimension $d$ . Since $a _ { i }$ are i.i.d. and $\bar { a _ { i } } \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I _ { d } )$ , by Lemma 25, + +$$ +h ( s ) = \mathbb { E } \left[ \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { s / 2 } \right] , +$$ + +where $X , Y$ are independent chi-square random variables with degree of freedom $b$ and $d - 1$ respectively. Notice that $h ( s )$ is strictly increasing in $d$ since the only dependence of $h ( s )$ on $d$ is via $Y$ , which is a chi-square distribution with degree of freedom $( d \mathrm { - } 1 )$ . By writing $Y = Z _ { 1 } ^ { 2 } + \cdot \cdot \cdot + Z _ { d - 1 } ^ { 2 }$ , where $Z _ { i } \sim N ( 0 , 1 )$ i.i.d., it follows that $h ( s )$ is strictly increasing in $d$ . Hence, by similar argument as in (I), we conclude that $\alpha$ is strictly decreasing in dimension $d$ . □ + +Remark 11. When $d = 1$ and $a _ { i }$ are i.i.d. $N ( 0 , \sigma ^ { 2 } )$ , we can provide an alternative proof that the tail-index $\alpha$ is strictly increasing in batch size $b$ . It suffices to show that for any $s \geq 1$ , $h ( s )$ is strictly decreasing in the batch size $b _ { \cdot }$ . By Lemma 25 when $d = 1$ , + +$$ +h ( b , s ) = \mathbb { E } \left[ \left( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { s / 2 } \right] , +$$ + +where $h ( b , s )$ is as in $( C . 3 )$ and $X , Y$ are independent chi-square random variables with degree of freedom $b$ and $d - 1$ respectively. When $d = 1$ , we have $Y \equiv 0$ , and + +$$ +h ( b , s ) = \operatorname { \mathbb { E } } \left[ \left( 1 - { \frac { 2 \eta \sigma ^ { 2 } } { b } } X + { \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } } X ^ { 2 } \right) ^ { s / 2 } \right] = \operatorname { \mathbb { E } } \left[ \left| 1 - { \frac { \eta \sigma ^ { 2 } } { b } } X \right| ^ { s } \right] . +$$ + +Since $X$ is a chi-square random variable with degree of freedom $b$ , we have + +$$ +h ( b , s ) = \mathbb { E } \left[ \left| 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } Z _ { i } \right| ^ { s } \right] , +$$ + +where $Z _ { i }$ are i.i.d. $N ( 0 , 1 )$ random variables. When $s \geq 1 ,$ , the function $x \mapsto | x | ^ { s }$ is convex, and by Jensen’s inequality, we get for any $b \geq 2$ and $b \in \mathbb { N }$ + +$$ +\begin{array} { r l r } { { h ( b , s ) = \mathbb { E } [ | \frac { 1 } { b } \sum _ { i = 1 } ^ { b } ( 1 - \frac { \eta \sigma ^ { 2 } } { b - 1 } \sum _ { j \neq i } Z _ { j } ) | ^ { s } ] } } \\ & { } & { \leq \mathbb { E } [ \frac { 1 } { b } \sum _ { i = 1 } ^ { b } | 1 - \frac { \eta \sigma ^ { 2 } } { b - 1 } \sum _ { j \neq i } Z _ { j } | ^ { s } ] } \\ & { } & { = \frac { 1 } { b } \sum _ { i = 1 } ^ { b } \mathbb { E } [ | 1 - \frac { \eta \sigma ^ { 2 } } { b - 1 } \sum _ { j \neq i } Z _ { j } | ^ { s } ] = h ( b - 1 , s ) , } \end{array} +$$ + +where we used the fact that $Z _ { i }$ are i.i.d. Indeed, from the condition for equality to hold in Jensen’s inequality, and the fact that $Z _ { i }$ are i.i.d. $N ( 0 , 1 )$ distributed, the inequality above is a strict inequality. Hence when $d = 1$ for any $s \geq 1$ , $h ( b , s )$ is strictly decreasing in $b$ . + +# C.3 PROOF OF PROPOSITION 3 + +Proof of Proposition 3. We next prove (i). When $\begin{array} { r } { \eta = \eta _ { c r i t } = \frac { 2 b } { \sigma ^ { 2 } ( d + b + 1 ) } } \end{array}$ , that is $\eta \sigma ^ { 2 } ( d + b + 1 ) = 2 b$ it follows from the proof of Proposition 23 that + +$$ +\rho \leq { \frac { 1 } { 2 } } \log \mathbb { E } \left[ 1 - { \frac { 2 \eta \sigma ^ { 2 } } { b } } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + { \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } \right] = 0 . +$$ + +Note that since 1 − 2ησ2 $\begin{array} { r } { 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } } \end{array}$ is random, the inequality above is a strict inequality from Jensen’s inequality. Thus, when $\eta ~ = ~ \eta _ { c r i t }$ , i.e. $\eta \sigma ^ { 2 } ( d \dot { + } b \dot { + } 1 ) = 2 b , \rho < 0$ . By continuity, there exists some $\delta > 0$ such that for any $2 b \ <$ $\eta \sigma ^ { 2 } ( d + b + 1 ) < 2 b + \delta$ , i.e. $\eta _ { c r i t } < \eta < \eta _ { m a x }$ , where $\begin{array} { r } { \eta _ { m a x } : = \eta _ { c r i t } + \frac { \delta } { \sigma ^ { 2 } ( d + b + 1 ) } } \end{array}$ , we have $\rho < 0$ . Moreover, when $\eta \sigma ^ { 2 } ( d + b + 1 ) > 2 b$ , i.e. $\eta > \eta _ { c r i t }$ , we have + +$$ +\begin{array} { l } { { \displaystyle h ( 2 ) = \mathbb E \left[ \left( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } \right) \right] } } \\ { { \displaystyle \qquad = 1 - 2 \eta \sigma ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } ( d + b + 1 ) \geq 1 , } } \end{array} +$$ + +which implies that there exists some $0 < \alpha < 2$ such that $h ( \alpha ) = 1$ . + +Finally, let us prove (ii) and (iii). When $\eta \sigma ^ { 2 } ( d + b + 1 ) \leq 2 b .$ , i.e. $\eta \leq \eta _ { c r i t }$ , we have $h ( 2 ) \leq 1$ which implies that $\alpha > 2$ . In particular, when $\eta \sigma ^ { 2 } ( d + b + 1 ) = 2 b$ , i.e. $\eta = \eta _ { c r i t }$ , the tail-index $\alpha = 2$ . □ + +# C.4 PROOF OF THEOREM 4 AND COROLLARY 5 + +Proof of Theorem 4. We recall that + +$$ +x _ { k } = M _ { k } x _ { k - 1 } + q _ { k } , +$$ + +which implies that + +$$ +\| x _ { k } \| \leq \| M _ { k } x _ { k - 1 } \| + \| q _ { k } \| . +$$ + +(i) If the tail-index $\alpha \leq 1$ , then for any $0 < p < \alpha$ , we have $h ( p ) = \mathbb { E } \| M _ { k } e _ { 1 } \| ^ { p } < 1$ and moreover by Lemma 20, + +$$ +\begin{array} { r } { \| x _ { k } \| ^ { p } \leq \| M _ { k } x _ { k - 1 } \| ^ { p } + \| q _ { k } \| ^ { p } . } \end{array} +$$ + +Due to spherical symmetry of the isotropic Gaussian distribution, the distribution of $\frac { \| M _ { k } x \| } { \| x \| }$ does not depend on the choice of $x \in \mathbb { R } ^ { d } \backslash \{ 0 \}$ . Therefore, kMkxk−1kkx k and kxk−1k are independent, and + +kMkxk−1kkx k has the same distribution as kMke1k, where e1 is the first basis vector. It follows that + +$$ +\begin{array} { r } { \mathbb { E } \| x _ { k } \| ^ { p } \leq \mathbb { E } \| M _ { k } e _ { 1 } \| ^ { p } \mathbb { E } \| x _ { k - 1 } \| ^ { p } + \mathbb { E } \| q _ { k } \| ^ { p } , } \end{array} +$$ + +so that + +$$ +\begin{array} { r } { \mathbb { E } \| x _ { k } \| ^ { p } \leq h ( p ) \mathbb { E } \| x _ { k - 1 } \| ^ { p } + \mathbb { E } \| q _ { 1 } \| ^ { p } , } \end{array} +$$ + +where $h ( p ) \in ( 0 , 1 )$ . By iterating over $k$ , we get + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { p } \leq ( h ( p ) ) ^ { k } \mathbb { E } \Vert x _ { 0 } \Vert ^ { p } + \frac { 1 - ( h ( p ) ) ^ { k } } { 1 - h ( p ) } \mathbb { E } \Vert q _ { 1 } \Vert ^ { p } . +$$ + +(ii) If the tail-index $\alpha > 1$ , then for any $1 < p < \alpha$ , by Lemma 20, for any $\epsilon > 0$ , we have + +$$ +\| x _ { k } \| ^ { p } \leq ( 1 + \epsilon ) \| M _ { k } x _ { k - 1 } \| ^ { p } + \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { \left( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 \right) ^ { p } } \| q _ { k } \| ^ { p } , +$$ + +which (similar as in (i)) implies that + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { p } \leq ( 1 + \epsilon ) \mathbb { E } \Vert M _ { k } e _ { 1 } \Vert ^ { p } \mathbb { E } \Vert x _ { k - 1 } \Vert ^ { p } + \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { \left( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 \right) ^ { p } } \mathbb { E } \Vert q _ { k } \Vert ^ { p } , +$$ + +so that + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { p } \leq ( 1 + \epsilon ) h ( p ) \mathbb { E } \Vert x _ { k - 1 } \Vert ^ { p } + \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { \Big ( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 \Big ) ^ { p } } \mathbb { E } \Vert q _ { 1 } \Vert ^ { p } . +$$ + +We choose $\epsilon > 0$ so that $( 1 + \epsilon ) h ( p ) < 1 \qquad $ . By iterating over $k$ , we get + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { p } \leq ( ( 1 + \epsilon ) h ( p ) ) ^ { k } \mathbb { E } \Vert x _ { 0 } \Vert ^ { p } + \frac { 1 - ( ( 1 + \epsilon ) h ( p ) ) ^ { k } } { 1 - ( 1 + \epsilon ) h ( p ) } \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { \Big ( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 \Big ) ^ { p } } \mathbb { E } \Vert q _ { 1 } \Vert ^ { p } . +$$ + +The proof is complete. + +Remark 12. In general, there is no closed-form expression for $\mathbb { E } \| q _ { 1 } \| ^ { p }$ in Theorem 4. We provide an upper bound as follows. When $p > 1$ , by Jensen’s inequality, we can compute that + +$$ +\mathbb { E } \Vert q _ { 1 } \Vert ^ { p } = \eta ^ { p } \mathbb { E } \left. \frac { 1 } { b } \sum _ { i = 1 } ^ { b } a _ { i } y _ { i } \right. ^ { p } \leq \frac { \eta ^ { p } } { b } \sum _ { i = 1 } ^ { b } \mathbb { E } \left. a _ { i } y _ { i } \right. ^ { p } = \eta ^ { p } \mathbb { E } \left[ \left| y _ { 1 } \right| ^ { p } \left. a _ { 1 } \right. ^ { p } \right] , +$$ + +and when $p \leq 1$ , by Lemma 20, we can compute that + +$$ +\mathbb { E } \Vert q _ { 1 } \Vert ^ { p } = \frac { \eta ^ { p } } { b ^ { p } } \mathbb { E } \sum _ { i = 1 } ^ { b } a _ { i } y _ { i } ^ { p } \leq \frac { \eta ^ { p } } { b ^ { p } } \mathbb { E } [ ( \sum _ { i = 1 } ^ { b } \Vert a _ { i } y _ { i } \Vert ) ^ { p } ] \leq \frac { \eta ^ { p } } { b ^ { p } } \sum _ { i = 1 } ^ { b } \mathbb { E } a _ { i } y _ { i } ^ { p } = \eta ^ { p } \mathbb { E } [ | y _ { 1 } | ^ { p } \Vert a _ { 1 } ^ { p } ] . +$$ + +Proof of Corollary 5. It follows from Theorem 4 by letting $k \to \infty$ and applying Fatou’s lemma. + +C.5 PROOF OF THEOREM 6, COROLLARY 7, PROPOSITION 8 AND COROLLARY 9 + +Proof of Theorem $6$ . For any $\nu _ { 0 } , \tilde { \nu } _ { 0 } \in \mathcal { P } _ { p } ( \mathbb { R } ^ { d } )$ , there exists a couple $x _ { 0 } \sim \nu _ { 0 }$ and $\tilde { x } _ { 0 } \sim \tilde { \nu } _ { 0 }$ independent of $( M _ { k } , q _ { k } ) _ { k \in \mathbb { N } }$ and $\mathcal { W } _ { p } ^ { p } ( \nu _ { 0 } , \tilde { \nu } _ { 0 } ) = \mathbb { E } \| x _ { 0 } - \tilde { x } _ { 0 } \| ^ { p }$ . We define $x _ { k }$ and $\tilde { x } _ { k }$ starting from $x _ { 0 }$ and $\tilde { x } _ { 0 }$ respectively, via the iterates + +$$ +\begin{array} { r } { x _ { k } = M _ { k } x _ { k - 1 } + q _ { k } , } \\ { \tilde { x } _ { k } = M _ { k } \tilde { x } _ { k - 1 } + q _ { k } , } \end{array} +$$ + +and let $\nu _ { k }$ and $\tilde { \nu } _ { k }$ denote the probability laws of $x _ { k }$ and $\tilde { x } _ { k }$ respectively. For any $p \ < \ \alpha$ , since $\mathbb { E } \| M _ { k } \| ^ { \alpha } = 1$ and $\mathbb { E } \| q _ { k } \| ^ { \alpha } < \infty$ , we have $\nu _ { k } , \tilde { \nu } _ { k } \in \mathcal { P } _ { p } ( \mathbb { R } ^ { d } )$ for any $k$ . Moreover, we have + +$$ +x _ { k } - \tilde { x } _ { k } = M _ { k } ( x _ { k - 1 } - \tilde { x } _ { k - 1 } ) , +$$ + +Due to spherical symmetry of the isotropic Gaussian distribution, the distribution of $\frac { \| M _ { k } x \| } { \| x \| }$ does not depend on the choice of $x \in \mathbb { R } ^ { d } \backslash \{ 0 \}$ . Therefore, $\frac { \| M _ { k } ( x _ { k - 1 } - \widetilde { x } _ { k - 1 } ) \| } { \| x _ { k - 1 } - \widetilde { x } _ { k - 1 } \| }$ and $\| x _ { k - 1 } - \tilde { x } _ { k - 1 } \|$ are independent, and $\frac { \| M _ { k } ( x _ { k - 1 } - \widetilde { x } _ { k - 1 } ) \| } { \| x _ { k - 1 } - \widetilde { x } _ { k - 1 } \| }$ has the same distribution as $\| M _ { k } e _ { 1 } \|$ , where $e _ { 1 }$ is the first basis vector. It follows from (C.23) that + +$$ +\begin{array} { r l } & { \mathbb { E } \| x _ { k } - \tilde { x } _ { k } \| ^ { p } \leq \mathbb { E } \left[ \| M _ { k } ( x _ { k - 1 } - \tilde { x } _ { k - 1 } ) \| ^ { p } \right] } \\ & { \quad \quad = \mathbb { E } \left[ \| M _ { k } e _ { 1 } \| ^ { p } \right] \mathbb { E } \left[ \| x _ { k - 1 } - \tilde { x } _ { k - 1 } \| ^ { p } \right] } \\ & { \quad \quad = h ( p ) \mathbb { E } \left[ \| x _ { k - 1 } - \tilde { x } _ { k - 1 } \| ^ { p } \right] , } \end{array} +$$ + +which by iterating implies that + +$$ +\mathcal { W } _ { p } ^ { p } ( \nu _ { k } , \tilde { \nu } _ { k } ) \leq \mathbb { E } \| x _ { k } - \tilde { x } _ { k } \| ^ { p } \leq ( h ( p ) ) ^ { k } \mathbb { E } \| x _ { 0 } - \tilde { x } _ { 0 } \| ^ { p } = ( h ( p ) ) ^ { k } \mathcal { W } _ { p } ^ { p } ( \nu _ { 0 } , \tilde { \nu } _ { 0 } ) . +$$ + +By letting $\tilde { \nu } _ { 0 } = \nu _ { \infty }$ , the probability law of the stationary distribution $x _ { \infty }$ , we conclude that + +$$ +\begin{array} { r } { \mathcal { W } _ { p } ( \nu _ { k } , \nu _ { \infty } ) \leq \left( ( h ( p ) ) ^ { 1 / q } \right) ^ { k } \mathcal { W } _ { p } ( \nu _ { 0 } , \nu _ { \infty } ) . } \end{array} +$$ + +Finally, notice that $1 \leq p < \alpha$ , and therefore $h ( p ) < 1$ . The proof is complete. + +Proof of Corollary 7. When $\begin{array} { r } { \eta \sigma ^ { 2 } < \frac { 2 b } { d + b + 1 } } \end{array}$ , by Proposition 3, the tail-index $\alpha > 2$ , by taking $p = 2$ , and using $\begin{array} { r } { h ( 2 ) = 1 - 2 \eta \sigma ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } ( d + b + 1 ) < 1 } \end{array}$ (see Proposition 3), it follows from Theorem 6 that + +$$ +\mathcal { W } _ { 2 } ( \nu _ { k } , \nu _ { \infty } ) \leq \left( 1 - 2 \eta \sigma ^ { 2 } \left( 1 - \frac { \eta \sigma ^ { 2 } } { 2 b } ( d + b + 1 ) \right) \right) ^ { k / 2 } \mathcal { W } _ { 2 } ( \nu _ { 0 } , \nu _ { \infty } ) . +$$ + +Remark 13. Consider the case $a _ { i }$ are i.i.d. $\mathcal { N } ( 0 , \sigma ^ { 2 } I _ { d } )$ . In Theorem 4, Corollary 5 and Theorem $6$ , the key quantity is $h ( p ) \in ( 0 , 1 )$ , where $p < \alpha$ . We recall that + +$$ +h ( p ) = \mathbb { E } \left[ \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { p / 2 } \right] , +$$ + +where $a = \eta \sigma ^ { 2 } , X , Y$ are independent chi-square random variables with degree of freedom $b$ and $d - 1$ respectively. The first-order approximation of $h ( p )$ is given by + +$$ +h ( p ) \sim 1 + \frac { p } { 2 } \mathbb { E } \left[ - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right] = 1 + \frac { p } { 2 } \left[ - 2 a + \frac { a ^ { 2 } } { b } ( b + 2 ) + \frac { a ^ { 2 } } { b } ( d - 1 ) \right] < 1 , +$$ + +provided that $\begin{array} { r } { a = \eta \sigma ^ { 2 } < \frac { 2 b } { d + b + 1 } } \end{array}$ which occurs if and only if $\alpha > 2$ . In other words, when $\begin{array} { r } { \eta \sigma ^ { 2 } < \frac { 2 b } { d + b + 1 } } \end{array}$ < 2bd+b+1 , α > 2 and + +$$ +h ( p ) \sim 1 - p \eta \sigma ^ { 2 } \left( 1 - \frac { \eta \sigma ^ { 2 } ( b + d + 1 ) } { 2 b } \right) < 1 . +$$ + +On the other hand, when $\begin{array} { r } { \eta \sigma ^ { 2 } \ge \frac { 2 b } { d + b + 1 } } \end{array}$ , $p < \alpha \leq 2$ , and the second-order approximation of $h ( p )$ is given by + +$$ +\begin{array} { l } { { \displaystyle h ( p ) \sim 1 + \frac { p } { 2 } \mathbb { E } \left[ - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right] + \frac { \frac { p } { 2 } \left( \frac { p } { 2 } - 1 \right) } { 2 } \mathbb { E } \left[ \left( - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] } } \\ { { \displaystyle \qquad = 1 + q a \left( \frac { a ( b + d + 1 ) } { 2 b } - 1 \right) - \frac { 2 - p } { 8 } \mathbb { E } \left[ \left( - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] , } } \end{array} +$$ + +and we computed before in (E.55) that for small $a = \eta \sigma ^ { 2 }$ and large $d$ , + +$$ +\mathbb { E } \left[ \left( - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] \sim \frac { 4 a ^ { 2 } } { b } ( b + 2 ) + \frac { a ^ { 4 } } { b ^ { 3 } } ( b + 2 ) d ^ { 2 } - \frac { 4 a ^ { 3 } } { b ^ { 2 } } ( b + 2 ) d , +$$ + +and therefore with $a = \eta \sigma ^ { 2 }$ , + +$$ +\begin{array} { r l } & { \displaystyle h ( p ) \sim 1 - p a \left( \frac { - a ( b + d + 1 ) } { 2 b } + 1 + \frac { ( 2 - p ) a ( b + 2 ) } { 2 q b } \left( 1 + \frac { a ^ { 2 } } { 4 b ^ { 2 } } d ^ { 2 } - \frac a b d \right) \right) < 1 , } \\ & { \displaystyle { \nu i d e d t h a t 1 \leq \frac { a ( b + d + 1 ) } { 2 b } < 1 + \frac { ( 2 - p ) a ( b + 2 ) } { 2 q b } \left( 1 + \frac { a ^ { 2 } } { 4 b ^ { 2 } } d ^ { 2 } - \frac a b d \right) } . } \end{array} +$$ + +Proof of Proposition 8. First, we notice that it follows from Theorem 1 that $\mathbb { E } \| x _ { \infty } \| ^ { \alpha } = \infty$ . To see this, notice that $\begin{array} { r } { \operatorname* { l i m } _ { t \infty } t { } ^ { \alpha } \mathbb { P } ( e _ { 1 } ^ { T } x _ { \infty } > t ) = e _ { \alpha } ( e _ { 1 } ) } \end{array}$ , where $e _ { 1 }$ is the first basis vector in $\mathbb { R } ^ { d }$ , and $\mathbb { P } ( \| x _ { \infty } \| \ge t ) \ge \mathbb { P } ( e _ { 1 } ^ { T } x _ { \infty } \ge t )$ , and thus + +$$ +\mathbb { E } \| x _ { \infty } \| ^ { \alpha } = \int _ { 0 } ^ { \infty } t \mathbb { P } ( \| x _ { \infty } \| ^ { \alpha } \geq t ) d t = \int _ { 0 } ^ { \infty } t \mathbb { P } ( \| x _ { \infty } \| \geq t ^ { 1 / \alpha } ) d t = \infty . +$$ + +By following the proof of Theorem 4 by letting $q = \alpha$ in the proof, one can show the following. + +(i) If the tail-index $\alpha \leq 1$ , then we have + +$$ +\begin{array} { r } { \mathbb { E } \| x _ { \infty } \| ^ { \alpha } \leq \mathbb { E } \| x _ { 0 } \| ^ { \alpha } + k \mathbb { E } \| q _ { 1 } \| ^ { \alpha } , } \end{array} +$$ + +which grows linearly in $k$ . + +(ii) If the tail-index $\alpha > 1$ , then for any $\epsilon > 0$ , we have + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { \alpha } \leq ( 1 + \epsilon ) ^ { k } \mathbb { E } \Vert x _ { 0 } \Vert ^ { \alpha } + \frac { ( 1 + \epsilon ) ^ { k } - 1 } { \epsilon } \frac { ( 1 + \epsilon ) ^ { \frac { \alpha } { \alpha - 1 } } - ( 1 + \epsilon ) } { \left( ( 1 + \epsilon ) ^ { \frac { 1 } { \alpha - 1 } } - 1 \right) ^ { \alpha } } \mathbb { E } \Vert q _ { 1 } \Vert ^ { \alpha } = O ( k ) , +$$ + +which grows exponentially in $k$ for any fixed $\epsilon > 0$ . By letting $\epsilon \to 0$ , we have + +$$ +\mathbb { E } \Vert x _ { k } \Vert ^ { \alpha } = ( 1 + \epsilon ) ^ { k } \mathbb { E } \Vert x _ { 0 } \Vert ^ { \alpha } + ( 1 + O ( \epsilon ) ) ( ( 1 + \epsilon ) ^ { k } - 1 ) \frac { ( \alpha - 1 ) ^ { \alpha - 1 } } { \epsilon ^ { \alpha } } \mathbb { E } \Vert q _ { 1 } \Vert ^ { \alpha } . +$$ + +Therefore, it holds for any sufficiently small $\epsilon > 0$ that, + +$$ +\mathbb { E } \| x _ { k } \| ^ { \alpha } \leq \frac { ( 1 + \epsilon ) ^ { k } } { \epsilon ^ { \alpha } } \left( \mathbb { E } \| x _ { 0 } \| ^ { \alpha } + ( \alpha - 1 ) ^ { \alpha - 1 } \mathbb { E } \| q _ { 1 } \| ^ { \alpha } \right) . +$$ + +We can optimize (1+)kα o ver the choice of $\epsilon > 0$ , and by choosing $\begin{array} { r } { \epsilon = \frac { \alpha } { k - \alpha } } \end{array}$ αk−α , which goes to zero as k goes to ∞, we have ( $\begin{array} { r } { \frac { ( 1 + \epsilon ) ^ { k } } { \epsilon ^ { \alpha } } = ( 1 + \frac { \alpha } { k - \alpha } ) ^ { k } ( \frac { k - \alpha } { \alpha } ) ^ { \alpha } = O ( k ^ { \alpha } ) } \end{array}$ , and hence + +$$ +\mathbb { E } \| x _ { k } \| ^ { \alpha } = O ( k ^ { \alpha } ) , +$$ + +which grows polynomially in $k$ . The proof is complete. + +Proof of Corollary 9. The result is obtained by a direct application of (Mirek, 2011, Theorem 1.15) to the recursions (3.3) where it can be checked in a straightforward manner that the conditions for this theorem hold. □ + +# D SUPPORTING LEMMAS + +In this section, we present a few supporting lemmas that are used in the proofs of the main results of the paper as well as the additional results in the Appendix. + +First, we recall that the iterates are given by $x _ { k } = M _ { k } x _ { k - 1 } + q _ { k }$ , where $( M _ { k } , q _ { k } )$ are i.i.d. and $M _ { k }$ is distributed as $I - \textstyle { \frac { \eta } { b } } H$ , where $\begin{array} { r } { H = \sum _ { i = 1 } ^ { b } { a _ { i } a _ { i } ^ { T } } } \end{array}$ and $q _ { k }$ is distributed as $\begin{array} { r } { \frac { \eta } { b } \sum _ { i = 1 } ^ { b } a _ { i } y _ { i } } \end{array}$ , where $a _ { i }$ and $y _ { i }$ are i.i.d. satisfying the Assumptions (A1)–(A2). + +We can compute $\rho$ and $h ( s )$ as follows where $\rho$ and $h ( s )$ are defined by (3.5) and (3.4). + +Lemma 14. $\rho$ can be characterized as: + +$$ +\rho = \mathbb { E } \log \left. \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right. , +$$ + +and $h ( s )$ can be characterized as: + +$$ +h ( s ) = \mathbb { E } \left[ \left. \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right. ^ { s } \right] , +$$ + +provided that $\rho < 0$ . + +Proof. It is known that the Lyapunov exponent defined in (3.5) admits the alternative representation + +$$ +\rho : = \operatorname* { l i m } _ { k \to \infty } \frac { 1 } { k } \log \| \widetilde { x } _ { k } \| , +$$ + +where $\tilde { x } _ { k } : = \Pi _ { k } \tilde { x } _ { 0 }$ with $\Pi _ { k } : = { \cal M } _ { k } { \cal M } _ { k - 1 } \ldots { \cal M } _ { 1 }$ and $\tilde { x } _ { 0 } : = x _ { 0 }$ (see (Newman, 1986, eqn. (2))). We will compute the limit on the right-hand side of (D.3). First, we observe that due to spherical symmetry of the isotropic Gaussian distribution, the distribution of kMkxk does not depend on the choice of $x \in \mathbb { R } ^ { d } \backslash \{ 0 \}$ and is i.i.d. over $k$ with the expectation $\begin{array} { r } { \mathbb { E } ( \| \ddot { M } e _ { 1 } \| ) = \mathbb { E } ( \| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \| ) } \end{array}$ where we chose $x = e _ { 1 }$ . Therefore, + +$$ +\frac { 1 } { k } \log \left. \tilde { x } _ { k } \right. - \frac { 1 } { k } \log \left. \tilde { x } _ { 0 } \right. = \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \log \frac { \left. \tilde { x } _ { i } \right. } { \left. \tilde { x } _ { i - 1 } \right. } = \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \log \frac { \left. M _ { i } \tilde { x } _ { i - 1 } \right. } { \left. \tilde { x } _ { i - 1 } \right. } +$$ + +is an average of i.i.d. random variables and by the law of large numbers we obtain + +$$ +\rho = \operatorname* { l i m } _ { k \to \infty } \frac { 1 } { k } \log \left\| \tilde { x } _ { k } \right\| = \mathbb { E } \left\| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right\| . +$$ + +From (D.3), we conclude that this proves (D.1). It remains to prove (D.2). We consider the function + +$$ +\tilde { h } ( s ) = \operatorname* { l i m } _ { k \to \infty } \left( \mathbb { E } \frac { \| \tilde { x } _ { k } \| ^ { s } } { \| \tilde { x } _ { 0 } \| ^ { s } } \right) ^ { 1 / k } , +$$ + +where the initial point $\tilde { x } _ { 0 } = x _ { 0 }$ is deterministic. In the rest of the proof, we will show that for $\rho < 0$ , $h ( s ) = { \tilde { h } } ( s )$ where $h ( s )$ is given by (3.4) and $\tilde { h } ( s )$ is equal to the right-hand side of (D.2); our proof is inspired by the approach of Newman (1986). We will first compute $\tilde { h } ( s )$ and show that it is equal to the right-hand side of (D.2). Note that we can write + +$$ +{ \frac { \| x _ { k } \| ^ { s } } { \| x _ { 0 } \| ^ { s } } } = \prod _ { i = 1 } ^ { k } { \frac { \| M _ { i } x _ { i - 1 } \| ^ { s } } { \| x _ { i - 1 } \| ^ { s } } } . +$$ + +This is a product of i.i.d. random variables with the same distribution as that of $\| M e _ { 1 } \| ^ { s }$ due to the spherical symmetry of the input $a _ { i }$ . Therefore, we can write + +$$ +\begin{array} { l } { \displaystyle \tilde { h } ( s ) = \operatorname* { l i m } _ { k \to \infty } \left( \mathbb { E } \frac { \| x _ { k } \| ^ { s } } { \| x _ { 0 } \| ^ { s } } \right) ^ { 1 / k } = \operatorname* { l i m } _ { k \to \infty } \left( \mathbb { E } \prod _ { i = 1 } ^ { k } \| M _ { i } e _ { 1 } \| ^ { s } \right) ^ { 1 / k } } \\ { \displaystyle = \mathbb { E } \left[ \| M e _ { 1 } \| ^ { s } \right] = \mathbb { E } \left[ \left\| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right\| ^ { s } \right] , } \end{array} +$$ + +where we used the fact that $M _ { i } e _ { 1 }$ are i.i.d. over $i$ . It remains to show that $h ( s ) = { \tilde { h } } ( s )$ for $\rho < 0$ . Note that $\frac { \| \tilde { x } _ { k } \| ^ { s } } { \| \tilde { x } _ { 0 } \| ^ { s } } \leq \| \Pi _ { k } \| ^ { s }$ , and therefore from the definition of $h ( s )$ and $\tilde { h } ( s )$ , we have immediately + +$$ +h ( s ) \geq { \tilde { h } } ( s ) +$$ + +for any $s > 0$ . We will show that $h ( s ) \leq { \tilde { h } } ( s )$ when $\rho < 0$ . We assume $\rho < 0$ . Then, Theorem 1 is applicable and there exists a stationary distribution $x _ { \infty }$ with a tail index $\alpha$ such that $h ( \alpha ) = 1$ . We will show that $\tilde { h } ( \alpha ) = 1$ . First, the tail density admits the characterization (3.7), and therefore $x _ { \infty } \in L _ { s }$ for $s < \alpha$ , i.e. the $s$ -th moment of $x _ { \infty }$ is finite. Similarly due to (3.7), $x _ { \infty } \notin L _ { s }$ for $s > \alpha$ . Since $h ( \alpha ) = 1$ , it follows from (D.5) that we have $\tilde { h } ( \alpha ) \leq 1$ . However if $\tilde { h } ( \alpha ) < 1$ , then by the continuity of the $\tilde { h }$ function there exists $\varepsilon$ such that $h ( s ) < 1$ for every $s \in ( \alpha - \varepsilon , \alpha + \varepsilon ) \subset ( 0 , 1 )$ . From the definition of $\tilde { h } ( s )$ then this would imply that $\mathbb { E } ( \| x _ { k } \| ^ { s } ) 0$ for every $s \in ( \alpha - \varepsilon , \alpha + \varepsilon )$ . On the other hand, by following a similar argument to the proof technique of Corollary 5, it can be shown that the $s$ -th moment of $x _ { \infty }$ has to be bounded,8 which would be a contradiction with the fact that $x _ { \infty } \notin L _ { s }$ for $s > \alpha$ . Therefore, $\tilde { h } ( \alpha ) \geq 1$ . Since $h ( \alpha ) = 1$ , (D.5) leads to + +$$ +h ( \alpha ) = \tilde { h } ( \alpha ) = 1 . +$$ + +We observe that the function $h$ is homogeneous in the sense that if the iterations matrices $M _ { i }$ are replaced by $c M _ { i }$ where $c > 0$ is a real scalar, $h ( s )$ will be replaced by $h _ { c } ( s ) : = c ^ { s } h ( s )$ . In other words, the function + +$$ +\begin{array} { r } { h _ { c } ( s ) : = \operatorname* { l i m } _ { k \to \infty } \left( { \mathbb { E } } \| ( c M _ { k } ) ( c M _ { k - 1 } ) \dots ( c M _ { 1 } ) \| ^ { s } \right) ^ { 1 / k } } \end{array} +$$ + +clearly satisfies $h _ { c } ( s ) = c ^ { s } h ( s )$ by definition. A similar homogeneity property holds for $\tilde { h } ( s )$ : If the iterations matrices $M _ { i }$ are replaced by $c M _ { i }$ , then $\tilde { h } ( s )$ will be replaced by ${ \tilde { h } } _ { c } ( s ) : = c ^ { s } { \tilde { h } } ( s )$ . We will show that this homogeneity property combined with the fact that $h ( \alpha ) = \tilde { h } ( \alpha ) = 1$ will force $h ( s ) = { \tilde { h } } ( s )$ for any $s > 0$ . For this purpose, given $s > 0$ , we choose $c = 1 / \sqrt [ s ] { h ( s ) }$ . Then, by considering input matrix $c M _ { i }$ instead of $M _ { i }$ and by following a similar argument which led to the identity (D.6), we can show that $h _ { c } ( s ) = c ^ { s } h ( s ) = 1$ . Therefore, $\tilde { h } _ { c } ( s ) = \overline { { \tilde { h } } } _ { c } ( s ) = 1$ . This implies directly ${ \tilde { h } } ( s ) = h ( s )$ . + +Next, we show the following property for the function $h$ . + +Lemma 15. We have $h ( 0 ) = 1$ , $h ^ { \prime } ( 0 ) = \rho$ and $h ( s )$ is strictly convex in s. + +Proof. By the expression of $h ( s )$ from Lemma 14, it is easy to check that $h ( 0 ) = 1$ . Moreover, we can compute that + +$$ +h ^ { \prime } ( s ) = \mathbb { E } [ \log ( ( I - \frac { \eta } { b } H ) e _ { 1 } ) ( I - \frac { \eta } { b } H ) e _ { 1 } ^ { s } ] , +$$ + +and thus + +$$ +h ^ { \prime } ( 0 ) = \rho . +$$ + +Moreover, we can compute that + +$$ +h ^ { \prime \prime } ( s ) = \operatorname { \mathbb { E } } \left[ \left( \log \left( \left\| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right\| \right) \right) ^ { 2 } \left\| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right\| ^ { s } \right] > 0 , +$$ + +which implies that $h ( s )$ is strictly convex in $s$ + +In the next result, we show that $\operatorname* { l i m } \operatorname* { i n f } _ { s \to \infty } h ( s ) > 1$ . This property, together with Lemma 15 implies that if $\rho < 0$ , then there exists some $\alpha \in ( 0 , \infty )$ such that $h ( \alpha ) = 1$ . Indeed, in the proof of Lemma 16, we will show that li $_ { 1 } \operatorname* { i n f } _ { s \to \infty } h ( s ) = \infty$ . + +Lemma 16. We have $\operatorname* { l i m } \operatorname* { i n f } _ { s \to \infty } h ( s ) > 1 .$ . + +Proof. We recall from Lemma 14 that + +$$ +h ( s ) = \mathbb { E } \left\| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right\| ^ { s } , +$$ + +where distrib $e _ { 1 }$ is td as s vector in . We can co $\mathbb { R } ^ { d }$ and ute th $\begin{array} { r } { H = \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } } \end{array}$ , and $a _ { i } = ( a _ { i 1 } , \dots , a _ { i d } ) $ are i.i.d. $\mathcal { N } ( 0 , \sigma ^ { 2 } I _ { d } )$ + +$$ +\begin{array} { r l } { \mathbb { E } [ ( | \bar { \xi } - \frac { \eta _ { \alpha } } { \theta } | ) ^ { 2 } ] } & { = \mathbb { E } ( | ( \frac { - \frac { \eta _ { \alpha } } { \theta } } { \theta } ) ^ { 2 } | \leq ( \frac { 1 } { \theta } ) ^ { 2 } ) } \\ & { = \mathbb { E } [ ( \frac { 1 } { \theta } ) ^ { 2 } ( \frac { - \eta _ { \alpha } } { \theta } ) ^ { 2 } ] ( - \frac { \eta _ { \alpha } } { \theta } \frac { 1 } { \theta } \frac { \sin \theta } { \sin \theta } ) ^ { 2 } ( ( - \frac { \eta _ { \alpha } } { \theta } \frac { 1 } { \theta } \frac { \sin \theta } { \sin \theta } ) ^ { 2 } ) ^ { \alpha _ { 2 } ^ { 3 } } ] } \\ & { = \mathbb { E } [ ( \frac { 1 } { \theta } ) ^ { 2 } \frac { \sin \theta } { \theta } \frac { \sin \theta } { \sin \theta } ) ^ { 2 } ( \frac { \theta } { \theta } \frac { \sin \theta } { \theta } ) ^ { 2 } \frac { \sin ^ { 2 } \theta } { \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } ] ^ { 2 } \Bigg ] } \\ & { = \mathbb { E } [ ( \frac { 1 } { \theta } ) ^ { 2 } \frac { \sin \theta } { \theta } \frac { \sin \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } ) ^ { 2 } \Bigg ] } \\ & = \mathbb { E } [ ( \frac { 1 } { \theta } ) ^ { 2 } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } \frac { \sin ^ { 2 } \theta } { \sin \theta } - \frac { 1 } { 2 \sin ^ { 2 } \theta } \frac { \sin \theta } \end{array} +$$ + +as $s \to \infty$ . + +In the next result, we show that the inverse of $M$ exists with probability 1, and provide an upper bound result, which will be used to prove Lemma 18. + +Lemma 17. $M ^ { - 1 }$ exists with probability 1. Moreover, we have + +$$ +\mathbb { E } \left[ \left( \log ^ { + } \left. M ^ { - 1 } \right. \right) ^ { 2 } \right] \leq 8 . +$$ + +Proof. Note that $M$ is a continuous random matrix, by the assumption on the distribution of $a _ { i }$ Therefore, + +$$ +\mathbb { P } ( M ^ { - 1 } { \mathrm { ~ d o e s ~ n o t ~ e x i s t } } ) = \mathbb { P } ( { \mathrm { d e t } } M = 0 ) = 0 . +$$ + +Note that the singular values of $M ^ { - 1 }$ are of the form $| 1 - \textstyle { \frac { \eta } { b } } \sigma _ { H } | ^ { - 1 }$ where $\sigma _ { H }$ is a singular value of $H$ and we have + +$$ +( \log ^ { + } \| M ^ { - 1 } \| ) ^ { 2 } = \left\{ \begin{array} { l l } { { 0 } } & { { \mathrm { i f } \quad \frac { \eta } { b } H \sim 2 I , } } \\ { { ( \| ( I - \frac { \eta } { b } H ) ^ { - 1 } \| ) ^ { 2 } } } & { { \mathrm { i f } \quad 0 \preceq \frac { \eta } { b } H \preceq 2 I . } } \end{array} \right. +$$ + +We consider two cases $0 \leq { \frac { \eta } { b } } H \preceq I$ and $I \preceq \frac { \eta } { b } H \preceq 2 I$ . We compute the conditional expectations for each case: + +$$ +\begin{array} { r l } & { \mathbb { E } \left[ \left( \log ^ { + } \left. M ^ { - 1 } \right. \right) ^ { 2 } \ \middle | \ 0 \preceq \frac { \eta } { b } H \preceq I \right] = \mathbb { E } \left[ \left( \log \left. \left( I - \frac { \eta } { b } H \right) ^ { - 1 } \right. \right) ^ { 2 } \ \middle | \ 0 \preceq \frac { \eta } { b } H \prec I \right] } \\ & { \qquad \leq \mathbb { E } \left[ \left( 2 \frac { \eta } { b } \| H \| \right) ^ { 2 } \ \middle | \ 0 \preceq \frac { \eta } { b } H \preceq I \right] } \\ & { \qquad \leq 4 , } \end{array} +$$ + +where in the first inequality we used the fact that + +$$ +\log ( I - X ) ^ { - 1 } \preceq 2 X +$$ + +for a symmetric positive semi-definite matrix $X$ satisfying $0 \preceq X \prec I$ (the proof of this fact is analogous to the proof of the scalar inequality $\begin{array} { r } { \log ( \frac { \tilde { 1 } } { 1 - x } ) \leq 2 x } \end{array}$ for $0 \leq x < 1 \gamma$ . By a similar computation, + +$$ +\begin{array}{c} \begin{array}{c} \begin{array} { r l } & { u \bigg [ ( \log ^ { * } \left\| ( \frac { \eta } { b } \theta ^ { - 1 } \right\| ) ^ { 2 } \left| { L } \right\| \le \frac { \eta } { b } d \le 2 d \bigg ] } \\ & { = \mathbb { P } \left[ \log \left\| \left( I - \frac { \eta } { b } \theta \right) ^ { - 1 } \right\| \mid \ r \ge \frac { \eta } { b } H \sim 2 I \right] } \\ & { = \mathbb { P } \left[ \log ^ { 2 } \left\| \left( \frac { \eta } { b } b \right) ^ { - 1 } \left[ I - \left( \frac { \eta } { b } H \right) ^ { - 1 } \right] ^ { - 1 } \right\| \ | \ r \le \frac { \eta } { b } H \sim 2 i \right]} \end{array} \\ & { \le \mathbb { E } \left[ \log ^ { 2 } \left( \left\| \left( \frac { \eta } { b } H \right) ^ { - 1 } \right\| \cdot \left\| \left[ { L } - \left( \frac { \eta } { b } H \right) ^ { - 1 } \right] ^ { - 1 } \right\| \ \right) \mid \ L \le \frac { \eta } { b } H \sim 2 i \right]} \end{array} \\ & { \le \mathbb { P } \left[ \log ^ { 2 } \left( \left\| \left[ I - \left( \frac { \eta } { b } H \right) ^ { - 1 } \right] ^ { - 1 } \right\| \right) \mid r \le \frac { \eta } { b } H \sim 2 I \right] } \\ & { = \mathbb { P } \left[ \log ^ { 2 } \left( \left\| \left[ I - \left( \frac { \eta } { b } H \right) ^ { - 1 } \right] ^ { - 1 } \right\| \right) \mid \frac { 1 } { 2 } I \sim \left( \frac { \eta } { b } H \right) ^ { - 1 } \prec I \right] , } \end{array} +$$ + +where in the last inequality we used the fact that $\begin{array} { r } { ( \frac { \eta } { b } H ) ^ { - 1 } \preceq I } \end{array}$ for $I \preceq \frac { \eta } { b } H \prec 2 I$ . If we apply the inequality (D.17) to the last inequality for the choice of $\begin{array} { r } { X = ( \frac { \eta } { b } H ) ^ { - 1 } } \end{array}$ , we obtain + +$$ +\begin{array} { r l r } & { } & { \mathbb { E } \left[ \log ^ { 2 } \left\| \left[ I - \left( \frac { \eta } { b } H \right) ^ { - 1 } \right] ^ { - 1 } \right\| \ \Big | \ \frac { 1 } { 2 } I \preceq \left( \frac { \eta } { b } H \right) ^ { - 1 } \prec I \right] } \\ & { } & { \leq \mathbb { E } \left[ \left\| 2 \left( \frac { \eta } { b } H \right) ^ { - 1 } \right\| ^ { 2 } \ \Big | \ \frac { 1 } { 2 } I \preceq \left( \frac { \eta } { b } H \right) ^ { - 1 } \prec I \right] \leq 4 . } \end{array} +$$ + +Combining (D.16) and (D.18), it follows from (D.13) that $\mathbb { E } \log ^ { + } \| M ^ { - 1 } \| \leq 8 .$ + +In the next result, we show that a certain expected value that involves the moments and logarithm of $\lVert M \rVert$ , and logarithm of $\lVert M ^ { - 1 } \rVert$ is finite, which is used in the proof of Theorem 1. + +Lemma 18. + +$$ +\begin{array} { r } { \mathbb { E } \left[ \| M \| ^ { \alpha } \left( \log ^ { + } \| M \| + \log ^ { + } \| M ^ { - 1 } \| \right) \right] < \infty . } \end{array} +$$ + +Proof. Note that $\begin{array} { r } { M = I - \frac { \eta } { b } H } \end{array}$ , where $\begin{array} { r } { H = \sum _ { i } ^ { b } a _ { i } a _ { i } ^ { T } } \end{array}$ in distribution. Therefore for any $s > 0$ + +$$ +\mathbb { E } [ \| M \| ^ { s } ] = \mathbb { E } \left[ \left\| I - \frac { \eta } { b } \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } \right\| ^ { s } \right] \leq \mathbb { E } \left[ \left( 1 + \frac { \eta } { b } \sum _ { i = 1 } ^ { b } \| a _ { i } \| ^ { 2 } \right) ^ { s } \right] < \infty , +$$ + +since all the moments of $a _ { i }$ are finite by the Assumption (A1). This implies that + +$$ +\mathbb { E } \left[ \| M \| ^ { \alpha } \left( \log ^ { + } \| M \| \right) \right] < \infty . +$$ + +By Cauchy-Schwarz inequality, + +$$ +\begin{array} { r } { \mathbb { E } \left[ \left\| M \right\| ^ { \alpha } \left( \log ^ { + } \left\| M ^ { - 1 } \right\| \right) \right] \leq \left( \mathbb { E } \left[ \left\| M \right\| ^ { 2 \alpha } \right] \mathbb { E } \left[ \left( \log ^ { + } \left\| M ^ { - 1 } \right\| \right) ^ { 2 } \right] \right) ^ { 1 / 2 } < \infty , } \end{array} +$$ + +where we used Lemma 17. + +In the next result, we show a convexity result, which is used in the proof of Theorem 2 to show that the tail-index $\alpha$ is strictly decreasing in stepsize $\eta$ and variance $\sigma ^ { 2 }$ . + +Lemma 19. For any given positive semi-definite symmetric matrix $H$ fixed, the function $F _ { H }$ : $[ 0 , \infty ) \to \mathbb { R }$ defined as + +$$ +F _ { H } ( a ) : = \| ( I - a H ) e _ { 1 } \| ^ { s } +$$ + +is convex for $s \geq 1$ . It follows that for given $b$ and $d$ with $\begin{array} { r } { \tilde { H } : = \frac { 1 } { b } \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } } \end{array}$ , the function + +$$ +h ( \boldsymbol { a } , \boldsymbol { s } ) : = \mathbb { E } \left[ F _ { \tilde { H } } ( \boldsymbol { a } ) \right] = \mathbb { E } \left\| \left( \boldsymbol { I } - \boldsymbol { a } \tilde { H } \right) \boldsymbol { e } _ { 1 } \right\| ^ { s } +$$ + +is a convex function of a for a fixed $s \geq 1$ . + +Proof. We consider the case $s \geq 1$ and consider the function + +$$ +G _ { H } ( a ) : = \| ( I - a H ) e _ { 1 } \| , +$$ + +and show that it is convex for $H \succeq 0$ and it is strongly convex for $H \succ 0$ over the interval $[ 0 , \infty )$ . Let $a _ { 1 } , a _ { 2 } \in [ 0 , \infty )$ be different points, i.e. $a _ { 1 } \neq a _ { 2 }$ . It follows from the subadditivity of the norm that + +$$ +\begin{array} { l } { { G _ { H } \left( { \displaystyle { \frac { a _ { 1 } + a _ { 2 } } { 2 } } } \right) = \left\| \left( I - { \displaystyle { \frac { a _ { 1 } + a _ { 2 } } { 2 } } H } \right) e _ { 1 } \right\| } } \\ { { \displaystyle ~ \leq \left\| \left( { \displaystyle { \frac { I } { 2 } } } - { \displaystyle { \frac { a _ { 1 } } { 2 } } H } \right) e _ { 1 } \right\| + \left\| \left( { \displaystyle { \frac { I } { 2 } } } - { \displaystyle { \frac { a _ { 2 } } { 2 } } H } \right) e _ { 1 } \right\| } } \\ { { \displaystyle ~ = { \displaystyle { \frac { 1 } { 2 } } } G _ { H } ( a _ { 1 } ) + { \displaystyle { \frac { 1 } { 2 } } } G _ { H } ( a _ { 2 } ) } , } \end{array} +$$ + +which implies that $G _ { H } ( a )$ is a convex function. On the other hand, the function $g ( x ) = x ^ { s }$ is convex for $s \geq 1$ on the positive real axis, therefore the composition $g ( G _ { H } ( a ) )$ is also convex for any $H$ fixed. Since the expectation of random convex functions is also convex, we conclude that $h ( s )$ is also convex. □ + +The next result is used in the proof of Theorem 4 to bound the moments of the iterates. + +Lemma 20. (i) Given $0 < p \leq 1$ , for any $x , y \geq 0$ + +$$ +( x + y ) ^ { p } \leq x ^ { p } + y ^ { p } . +$$ + +(ii) Given $p > 1$ , for any $x , y \geq 0 ,$ , and any $\epsilon > 0$ , + +$$ +( x + y ) ^ { p } \leq ( 1 + \epsilon ) x ^ { p } + \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { \left( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 \right) ^ { p } } y ^ { p } . +$$ + +Proof. (i) If $y = 0$ , then $( x + y ) ^ { p } \leq x ^ { p } + y ^ { p }$ trivially holds. If $y > 0$ , it is equivalent to show that + +$$ +\left( { \frac { x } { y } } + 1 \right) ^ { p } \leq \left( { \frac { x } { y } } \right) ^ { p } + 1 , +$$ + +which is equivalent to show that + +$$ +( x + 1 ) ^ { p } \leq x ^ { p } + 1 , \qquad { \mathrm { f o r ~ a n y ~ } } x \geq 0 . +$$ + +Let $F ( x ) : = ( x + 1 ) ^ { p } - x ^ { p } - 1$ and $F ( 0 ) = 0$ and $F ^ { \prime } ( x ) = p ( x + 1 ) ^ { p - 1 } - p x ^ { p - 1 } \leq 0$ since $p \leq 1$ , which shows that $F ( x ) \leq 0$ for every $x \geq 0$ . + +(ii) If $y = 0$ , then the inequality trivially holds. If $y > 0$ , by doing the transform $x \mapsto x / y$ and $y \mapsto 1$ it is equivalent to show that for any $x \geq 0$ , + +$$ +( 1 + x ) ^ { p } \leq ( 1 + \epsilon ) x ^ { p } + \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { \left( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 \right) ^ { p } } . +$$ + +To show this, we define + +$$ +F ( x ) : = ( 1 + x ) ^ { p } - ( 1 + \epsilon ) x ^ { p } , \qquad x \geq 0 . +$$ + +Then $F ^ { \prime } ( x ) = p ( 1 + x ) ^ { p - 1 } - p ( 1 + \epsilon ) x ^ { p - 1 }$ so that $F ^ { \prime } ( x ) \geq 0$ if $x \leq ( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 ) ^ { - 1 }$ , and $F ^ { \prime } ( x ) \leq 0$ if $x \geq ( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 ) ^ { - 1 }$ . Thus, + +$$ +\operatorname* { m a x } _ { x \ge 0 } F ( x ) = F \left( \frac { 1 } { ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 } \right) = \frac { ( 1 + \epsilon ) ^ { \frac { p } { p - 1 } } - ( 1 + \epsilon ) } { \left( ( 1 + \epsilon ) ^ { \frac { 1 } { p - 1 } } - 1 \right) ^ { p } } . +$$ + +The proof is complete. + +# E ADDITIONAL TECHNICAL RESULTS + +We recall that the iterates are given by $x _ { k } = M _ { k } x _ { k - 1 } + q _ { k }$ , where $( M _ { k } , q _ { k } )$ are i.i.d. copies of $( M , q )$ where $\begin{array} { r } { M = I - \frac { \eta } { b } H } \end{array}$ with $\begin{array} { r } { H = \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } } \end{array}$ in distribution and $\begin{array} { r } { q = \frac { \eta } { b } \sum _ { i = 1 } ^ { b } a _ { i } y _ { i } } \end{array}$ , where $a _ { i }$ and $y _ { i }$ are i.i.d. satisfying the Assumptions (A1)–(A2). + +We first obtain more explicit expressions for $\rho$ and $h ( s )$ under the Assumption (A1). + +Proposition 21. We have + +$$ +\rho = \frac { 1 } { 2 } \mathbb { E } \log \left[ 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } \right] , +$$ + +and for any $s \geq 0$ , + +$$ +h ( s ) = \mathbb { E } \left[ \left( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } \right) ^ { s / 2 } \right] , +$$ + +where $z _ { i } : = ( z _ { i 1 } , z _ { i 2 } , \ldots , z _ { i d } ) \sim \mathcal { N } ( 0 , I _ { d } ) ,$ , $1 \leq i \leq b$ are i.i.d. + +Proof. By the expression of $\rho$ from Lemma 14, we can compute that + +$$ +\begin{array} { r l } & { \rho = \mathbb { E } \log \left\| \left( I - \frac { \eta } { b } H \right) c _ { 1 } \right\| } \\ & { \quad = \frac { 1 } { 2 } \mathbb { E } \log \left\| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right\| ^ { 2 } } \\ & { \quad = \frac { 1 } { 2 } \mathbb { E } \log \left[ \epsilon _ { 1 } ^ { T } \left( I - \frac { \eta } { b } \displaystyle \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } \right) \left( I - \frac { \eta } { b } \displaystyle \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } \right) \epsilon _ { 1 } \right] } \\ & { \quad = \frac { 1 } { 2 } \mathbb { E } \log \left[ 1 - \frac { 2 \eta } { b } \displaystyle \epsilon _ { 1 } ^ { T } \displaystyle \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } \epsilon _ { 1 } + \frac { \eta ^ { 2 } } { b ^ { 2 } } \epsilon _ { 1 } ^ { T } \displaystyle \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } \displaystyle \sum _ { i = 1 } ^ { b } a _ { i } a _ { i } ^ { T } \epsilon _ { 1 } \right] } \\ & { \quad = \frac { 1 } { 2 } \mathbb { E } \log \left[ 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \displaystyle \sum _ { i = 1 } ^ { b } z _ { i } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \displaystyle \sum _ { i = 1 } ^ { b } \displaystyle \sum _ { i = 1 } ^ { b } ( z _ { i } | z _ { i 1 } + \cdots + z _ { i } a _ { i } z _ { j } ) z _ { i 1 } z _ { j 1 } \right] , } \end{array} +$$ + +where $z _ { i } = ( z _ { i 1 } , z _ { i 2 } , \ldots , z _ { i d } ) \sim \mathcal { N } ( 0 , I _ { d } ) , 1 \leq$ $1 \leq i \leq b$ are i.i.d. Similarly, by the expression of $h ( s )$ from Lemma 14, we have + +$$ +\begin{array} { l } { { \displaystyle h ( s ) = \mathbb E \left\| \left( I - \frac { \eta } { b } H \right) e _ { 1 } \right\| ^ { s } } } \\ { { \displaystyle \quad = \mathbb E \left[ \left( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } \right) ^ { s / 2 } \right] . } } \end{array} +$$ + +Remark 22. It follows from Proposition 21 that $\rho ,$ , $h ( s )$ and hence the tail-index α depends on η and $\sigma ^ { 2 }$ only via its product $\overline { { \eta } } \sigma ^ { 2 }$ . + +We have seen in Theorem 1 that the iterates converge to a heavy-tailed distribution with tail-index $\alpha \in ( 0 , \infty )$ provided that $\rho < 0$ . When the data $a _ { i }$ are i.i.d. in general, it is not easy to check whether $\rho < 0$ holds. For the Gaussian data (Assumption (A1)), it is possible to characterise the region of the parameters $\eta , b , d , \sigma ^ { 2 }$ in which $\rho < 0$ . We first state the following result, which provides a sufficient (but not necessary) condition for $\rho < 0$ . + +Proposition 23. $\rho < 0$ provided that + +$$ +\eta \sigma ^ { 2 } ( d + b + 1 ) < 2 b . +$$ + +Proof. We recall from Proposition 21 that + +$$ +\rho = \frac { 1 } { 2 } \mathbb { E } \log \left[ 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } \right] , +$$ + +where $z _ { i } = ( z _ { i 1 } , \ldots , z _ { i d } ) \sim \mathcal { N } ( 0 , I _ { d } ) , 1$ $1 \leq i \leq b$ . Note that the function $x \mapsto \log x$ is concave, and by Jensen’s inequality, we have + +$$ +\rho \leq { \frac { 1 } { 2 } } \log \mathbb { E } \left[ 1 - { \frac { 2 \eta \sigma ^ { 2 } } { b } } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } + { \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } \right] . +$$ + +We can compute that + +$$ +\mathbb { E } \left[ \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right] = b \mathbb { E } [ z _ { 1 1 } ^ { 2 } ] = b , +$$ + +and + +$$ +\begin{array} { r l } { { \mathbb { E } [ \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } ] } } \\ & { = \mathbb { E } [ \sum _ { i = 1 } ^ { b } ( z _ { i 1 } ^ { 2 } + \cdot \cdot \cdot + z _ { i d } ^ { 2 } ) z _ { i 1 } ^ { 2 } ] + \mathbb { E } [ \sum _ { 1 \leq i \neq j \leq b } ( z _ { i 1 } z _ { j 1 } + \cdot \cdot \cdot + z _ { i d } z _ { j d } ) z _ { i 1 } z _ { j 1 } ] } \\ & { = b \mathbb { E } [ ( z _ { 1 1 } ^ { 2 } + \cdot \cdot \cdot + z _ { 1 d } ^ { 2 } ) z _ { 1 1 } ^ { 2 } ] + b ( b - 1 ) \mathbb { E } [ ( z _ { 1 1 } z _ { 2 1 } + \cdot \cdot \cdot + z _ { 1 d } z _ { 2 d } ) z _ { 1 1 } z _ { 2 1 } ] } \\ & { = b \mathbb { E } [ z _ { 1 1 } ^ { 4 } ] + b ( d - 1 ) ( \mathbb { E } [ z _ { 1 1 } ^ { 2 } ] ) ^ { 2 } + b ( b - 1 ) \mathbb { E } [ z _ { 1 1 } ^ { 2 } z _ { 2 1 } ^ { 2 } ] } \\ & { = 3 b + b ( d - 1 ) + b ( b - 1 ) = b ( d + b + 1 ) , } \end{array} +$$ + +where we used the property that $z _ { i } = ( z _ { i j } , 1 \leq j \leq d )$ are i.i.d. and $z _ { i j }$ are i.i.d. $N ( 0 , 1 )$ and + +$$ +\mathbb { E } [ z _ { 1 1 } ^ { 2 } ] = 1 , \qquad \mathbb { E } [ z _ { 1 1 } ^ { 4 } ] = 3 . +$$ + +Hence, we conclude that $\rho < 0$ provided that + +$$ +1 - 2 \eta \sigma ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } ( d + b + 1 ) < 1 , +$$ + +which is equivalent to + +$$ +\eta \sigma ^ { 2 } ( d + b + 1 ) < 2 b . +$$ + +The proof is complete. + +Remark 24. It is worth pointing out that $\rho < 0$ does not hold for arbitrary model parameters. In particular, we can compute that + +$$ +\begin{array} { r l } & { \rho = \displaystyle \frac { 1 } { 2 } \mathrm { E l o g } \left[ \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { 1 } ^ { 2 } \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } z _ { 1 } z _ { 1 } \lambda \sum _ { k = 2 } ^ { d } z _ { i k } z _ { 2 k } \right] } \\ & { = \displaystyle \frac { 1 } { 2 } \mathrm { E l o g } \left[ \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { 1 } ^ { 2 } \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { k = 2 } ^ { d } \left( \sum _ { i = 1 } ^ { b } z _ { 1 } z _ { 2 k } \right) ^ { 2 } \right] } \\ & { \geq \displaystyle \frac { 1 } { 2 } \mathrm { E l o g } \left[ \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { k = 2 } ^ { d } \left( \sum _ { i = 1 } ^ { b } z _ { 1 } z _ { 2 k } \right) ^ { 2 } \right] } \\ & { = \log \left( \frac { \eta \sigma ^ { 2 } } { b } \right) + \frac { 1 } { 2 } \mathrm { E l o g } \left[ \displaystyle \sum _ { k = 2 } ^ { d } \left( \sum _ { i = 1 } ^ { b } z _ { 1 } z _ { i k } \right) ^ { 2 } \right] . } \end{array} +$$ + +Note that conditional on $z _ { i 1 }$ , $1 \leq i \leq b$ , + +$$ +\sum _ { i = 1 } ^ { b } z _ { i 1 } z _ { i k } \sim \mathcal { N } \left( 0 , \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right) , +$$ + +are i.i.d. for $k = 2 , \ldots , d$ . Therefore, + +$$ +{ \frac { 1 } { 2 } } \mathbb { E } \log \left[ \sum _ { k = 2 } ^ { d } \left( \sum _ { i = 1 } ^ { b } z _ { i 1 } z _ { i k } \right) ^ { 2 } \right] = { \frac { 1 } { 2 } } \mathbb { E } \log \left[ X Y \right] = { \frac { 1 } { 2 } } \mathbb { E } \log X + { \frac { 1 } { 2 } } \log \mathbb { E } \log Y , +$$ + +where $X$ is a chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . Therefore, we can compute that + +$$ +\begin{array} { r l } & { \displaystyle \frac 1 2 \mathbb { E } \log X = \frac 1 2 \int _ { 0 } ^ { \infty } \log ( x ) \frac { x ^ { \frac { b } { 2 } - 1 } e ^ { - \frac x 2 } } { 2 ^ { \frac b 2 } \Gamma ( \frac b 2 ) } d x } \\ & { \qquad \ge \frac 1 { 2 ^ { \frac b 2 + 1 } \Gamma ( \frac b 2 ) } \int _ { 0 } ^ { 1 } \log ( x ) x ^ { \frac { b } { 2 } - 1 } e ^ { - \frac x 2 } d x } \\ & { \qquad \ge \frac 1 { 2 ^ { \frac b 2 + 1 } \Gamma ( \frac b 2 ) } \int _ { 0 } ^ { 1 } \log ( x ) x ^ { \frac { b } { 2 } - 1 } d x = \frac { - 1 } { 2 ^ { \frac b 2 - 1 } b ^ { 2 } \Gamma ( \frac b 2 ) } . } \end{array} +$$ + +Similarly, we can show that $\frac 1 2 \mathbb { E } \log { Y } \geq \frac { - 1 } { 2 ^ { \frac { d - 1 } { 2 } - 1 } ( d - 1 ) ^ { 2 } \Gamma ( \frac { d - 1 } { 2 } ) }$ . Hence, we conclude that $\rho \geq 0$ provided that + +$$ +\eta \sigma ^ { 2 } \geq b \exp \left\{ { \frac { 1 } { 2 ^ { { \frac { b } { 2 } } - 1 } b ^ { 2 } \Gamma ( { \frac { b } { 2 } } ) } } + { \frac { 1 } { 2 ^ { { \frac { d - 1 } { 2 } } - 1 } ( d - 1 ) ^ { 2 } \Gamma ( { \frac { d - 1 } { 2 } } ) } } \right\} . +$$ + +Next, we provide alternative formulas for $h ( s )$ and $\rho$ for the Gaussian data (Assumption (A1)) which is used for some technical proofs. + +Lemma 25. For any $s > 0$ + +$$ +h ( s ) = \mathbb { E } \left[ \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { s / 2 } \right] , +$$ + +and + +$$ +\rho = \frac { 1 } { 2 } \mathbb { E } \left[ \log \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) \right] , +$$ + +where $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . + +Proof. We can compute that + +$$ +\begin{array} { l } { \displaystyle h ( s ) = \mathbb { E } [ ( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } \frac { \lambda } { b } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 3 } } \sum _ { \nu = 1 } ^ { b } \sum _ { i = 1 } ^ { b } ( z _ { \nu \lambda } z _ { \nu \lambda } + \cdots + z _ { i } z _ { i } z _ { i } ) z _ { \lambda } z _ { 1 } ) ^ { s ^ { s / 2 } } ] } \\ { = \mathbb { E } [ ( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 3 } } \sum _ { \nu = 1 } ^ { b } \sum _ { i = 1 } ^ { b } z _ { 1 } ^ { 3 } + z _ { \nu \lambda } z _ { 1 } ) \sum _ { i = 1 } ^ { d } z _ { i } z _ { \nu \lambda } ) ) ^ { s ^ { s / 2 } } \Bigg ] } \\ { = \mathbb { E } [ ( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { 1 } ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 3 } } ( \sum _ { i = 1 } ^ { b } z _ { 1 } ^ { 2 } ) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { k = 2 } ^ { d } ( \sum _ { i = 1 } ^ { b } z _ { i } z _ { k } ) ^ { 2 } ) ^ { s ^ { s / 2 } } ] } \\ { = \mathbb { E } [ ( ( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i } ^ { 2 } ) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } \sum _ { i = 1 } ^ { d } \sum _ { \nu = 2 } ^ { b } ( \sum _ { i = 1 } ^ { b } z _ { 1 } z _ { k } ) ^ { 2 } ) ^ { s / 2 } ] . } \end{array} +$$ + +Note that conditional on $z _ { i 1 }$ , $1 \leq i \leq b$ , + +$$ +\sum _ { i = 1 } ^ { b } z _ { i 1 } z _ { i k } \sim \mathcal { N } \left( 0 , \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right) , +$$ + +are i.i.d. for $k = 2 , \ldots , d$ . Therefore, we have + +$$ +\begin{array} { l } { { \displaystyle h ( s ) = \mathbb { E } \left[ \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { k = 2 } ^ { d } \left( \sum _ { i = 1 } ^ { b } z _ { i 1 } z _ { i k } \right) ^ { 2 } \right) ^ { s / 2 } \right] } } \\ { { \displaystyle ~ = \mathbb { E } \left[ \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \sum _ { k = 2 } ^ { d } x _ { k } ^ { 2 } \right) ^ { s / 2 } \right] , } } \end{array} +$$ + +where $x _ { k }$ are i.i.d. $N ( 0 , 1 )$ independent of $z _ { i 1 }$ , $i = 1 , \ldots , b$ . Hence, we have + +$$ +\begin{array} { l } { { \displaystyle h ( s ) = \mathbb { E } \left[ \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \sum _ { k = 2 } ^ { d } x _ { k } ^ { 2 } \right) ^ { s / 2 } \right] } } \\ { { \displaystyle ~ = \mathbb { E } \left[ \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { s / 2 } \right] , } } \end{array} +$$ + +where $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . + +Similarly, we can compute that + +$$ +\begin{array} { l } { \displaystyle \rho = \frac { 1 } { 2 } \mathbb { E } \left[ \log \left[ \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { i = 1 } ^ { b } \sum _ { j = 1 } ^ { a } z _ { i 1 } z _ { j 1 } \sum _ { k = 2 } ^ { d } z _ { i k } z _ { j k } \right] \right] } \\ { \displaystyle = \frac { 1 } { 2 } \mathbb { E } \left[ \log \left[ \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } \sum _ { i = 1 } ^ { b } z _ { i 1 } ^ { 2 } \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \sum _ { k = 2 } ^ { d } \left( \sum _ { i = 1 } ^ { b } z _ { i 1 } z _ { i k } \right) ^ { 2 } \right] \right] } \\ { \displaystyle = \frac { 1 } { 2 } \mathbb { E } \left[ \log \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) \right] , } \end{array} +$$ + +where $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . The proof is complete. □ + +In Theorem 1, we showed the existence of the tail-index $\alpha$ . For the Gaussian data (Assumption (A1)), we can provide some explicit bound on the tail-index $\alpha$ provided some explicit technical conditions hold. Next, we provide a technical condition under which the tail-index $\alpha \in ( 0 , 4 ]$ . (See also Proposition 3 for a technical condition under which the tail-index $\alpha \in ( 0 , 2 ] .$ ) + +Proposition 26. There exists some $0 < \alpha \leq 4$ such that $h ( \alpha ) = 1$ provided that + +$$ +\begin{array} { r l } & { 2 b > \eta \sigma ^ { 2 } ( d + b + 1 ) } \\ & { \quad \geq 2 b - 2 \eta \sigma ^ { 2 } ( b + 2 ) + \displaystyle \frac { 2 \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) ( b + d + 3 ) } \\ & { \quad \quad \quad - \displaystyle \frac { 1 } { 2 } \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) - \displaystyle \frac { 1 } { 2 } \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( d ^ { 2 } - 1 ) - \displaystyle \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) . } \end{array} +$$ + +Proof. It follows from Lemma 25 that + +$$ +h ( 4 ) = \mathbb { E } \left[ \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] , +$$ + +where $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . We can further compute that + +$$ +h ( 4 ) = \mathbb { E } \left[ \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 4 } \right] + \mathbb { E } \left[ \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 4 } } X ^ { 2 } Y ^ { 2 } \right] + 2 \mathbb { E } \left[ \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right] . +$$ + +First, we can compute that + +$$ +\mathbb { E } \left[ \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 4 } \right] = 1 - \frac { 4 \eta \sigma ^ { 2 } } { b } \mathbb { E } [ X ] + \frac { 6 \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } \mathbb { E } [ X ^ { 2 } ] - \frac { 4 \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 3 } } \mathbb { E } [ X ^ { 3 } ] + \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 4 } } \mathbb { E } [ X ^ { 4 } ] . +$$ + +We recall the formula for the $m$ -th moment of a chi-square distribution with degree of freedom $k$ given by $\begin{array} { r } { 2 ^ { m } \Gamma ( m + \frac { k } { 2 } ) / \Gamma ( \frac { k } { 2 } ) } \end{array}$ , which is $2 ^ { m } \textstyle \frac { k } { 2 } \left( \frac { k } { 2 } + 1 \right) \cdot \cdot \cdot \left( \frac { k } { 2 } + ( m - 1 ) \right)$ when $m$ is a positive integer. Since $X$ is chi-square distributed with degree of freedom $b$ , we have + +$$ +\begin{array} { l } { \displaystyle \mathbb { E } [ X ] = 2 \cdot \frac { b } { 2 } = b , } \\ { \displaystyle \mathbb { E } [ X ^ { 2 } ] = 2 ^ { 2 } \cdot \frac { b } { 2 } \left( \frac { b } { 2 } + 1 \right) = b ( b + 2 ) , } \\ { \displaystyle \mathbb { E } [ X ^ { 3 } ] = 2 ^ { 3 } \cdot \frac { b } { 2 } \left( \frac { b } { 2 } + 1 \right) \left( \frac { b } { 2 } + 2 \right) = b ( b + 2 ) ( b + 4 ) , } \\ { \displaystyle \mathbb { E } [ X ^ { 4 } ] = 2 ^ { 4 } \cdot \frac { b } { 2 } \left( \frac { b } { 2 } + 1 \right) \left( \frac { b } { 2 } + 2 \right) \left( \frac { b } { 2 } + 3 \right) = b ( b + 2 ) ( b + 4 ) ( b + 6 ) , } \end{array} +$$ + +which implies that + +$$ +\Big \Sigma \Bigg [ \Bigg ( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \Bigg ) ^ { 4 } \Bigg ] = 1 - 4 \eta \sigma ^ { 2 } + \frac { 6 \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) - \frac { 4 \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) + \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) . +$$ + +Second, we can compute that + +$$ +\mathbb { E } \left[ \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 4 } } X ^ { 2 } Y ^ { 2 } \right] = \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 4 } } \mathbb { E } \left[ X ^ { 2 } \right] \mathbb { E } [ Y ^ { 2 } ] = \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 4 } } b ( b + 2 ) ( d - 1 ) ( d + 1 ) = \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) . +$$ + +where we used the fact that $Y$ is independent of $X$ and $Y$ is chi-square distributed with degree of freedom $d - 1$ so that $\mathbb { E } [ Y ^ { 2 } ] = ( d - \bar { 1 } ) ( d + 1 )$ . + +Third, we can compute that + +$$ +{ \begin{array} { r l } & { 2 \mathbb { E } \left[ \left( 1 - { \frac { \eta \sigma ^ { 2 } } { b } } X \right) ^ { 2 } { \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } } X Y \right] } \\ & { = 2 \mathbb { E } \left[ { \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } } X Y \right] + 2 \mathbb { E } \left[ { \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 4 } } } X ^ { 3 } Y \right] - 4 \mathbb { E } \left[ { \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 3 } } } X ^ { 2 } Y \right] } \\ & { = 2 { \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } } ( d - 1 ) + 2 { \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } } ( b + 2 ) ( b + 4 ) ( d - 1 ) - 4 { \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } } ( b + 2 ) ( d - 1 ) . } \end{array} } +$$ + +Putting everything together, we have + +$$ +\begin{array} { l } { { \displaystyle h ( 4 ) = 1 - 4 \eta \sigma ^ { 2 } + \frac { 6 \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) - \frac { 4 \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) + \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) } } \\ { { \displaystyle \qquad + \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } } \\ { { \displaystyle \qquad + 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } ( d - 1 ) + 2 \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) - 4 \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( d - 1 ) , } } \end{array} +$$ + +and $h ( 4 ) \geq 1$ if and only if + +$$ +\begin{array} { l } { { \displaystyle 1 - 4 \eta \sigma ^ { 2 } + \frac { 6 \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) - \frac { 4 \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) + \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) } } \\ { { \displaystyle \qquad + \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } } \\ { { \displaystyle \qquad + 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } ( d - 1 ) + 2 \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 3 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) - 4 \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( d - 1 ) \ge 1 , } } \end{array} +$$ + +which is equivalent to + +$$ +\begin{array} { r l } & { \displaystyle - 2 b + \eta \sigma ^ { 2 } ( 3 b + 6 ) + \eta \sigma ^ { 2 } ( d - 1 ) } \\ & { \quad \quad - \displaystyle \frac { 2 \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) ( b + 4 ) + \frac { 1 } { 2 } \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) + \frac { 1 } { 2 } \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } \\ & { \quad \quad \quad + \displaystyle \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) - 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) ( d - 1 ) \ge 0 , } \end{array} +$$ + +which is equivalent to + +$$ +\begin{array} { l } { { \displaystyle - 2 b + \eta \sigma ^ { 2 } ( d + b + 1 ) \ge - 2 \eta \sigma ^ { 2 } ( b + 2 ) } } \\ { { \displaystyle ~ + ~ \frac { 2 \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) ( b + 4 ) - \frac { 1 } { 2 } \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) - \frac { 1 } { 2 } \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } } \\ { { \displaystyle ~ - \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 2 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) + 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b } ( b + 2 ) ( d - 1 ) . } } \end{array} +$$ + +Finally, recall that $\rho < 0$ if $2 b > \eta \sigma ^ { 2 } ( d + b + 1 )$ and $h ( 4 ) \geq 1$ implies there exists some $0 < \alpha \leq 4$ such that $h ( \alpha ) = 1$ . The proof is complete. □ + +Let us define $\mathcal { D } _ { s , b }$ as the set consisting of $( \eta , \sigma )$ such that + +$$ +\mathcal { D } _ { s , b } : = \left\{ ( \eta , \sigma ) : \eta \sigma ^ { 2 } ( d + b + 1 ) < 2 b \mathrm { a n d } h ( s ) \geq 1 \right\} . +$$ + +We have shown in Proposition 23 that $\rho < 0$ provided that $\eta \sigma ^ { 2 } ( d + b + 1 ) < 2 b$ . Therefore, if $( \eta , \sigma ) \in \mathcal { D } _ { s , b }$ , then the tail-index $\alpha \in ( 0 , s ]$ . In Proposition 26, we characterised the set $\mathcal { D } _ { 4 , b }$ . In the next proposition, we show that $\mathcal { D } _ { 4 , b }$ is non-trivial, i.e., $\mathcal { D } _ { 4 , b }$ is not an empty set. + +Proposition 27. $\mathcal { D } _ { 4 , b }$ is not an empty set. In particular, it includes the pairs $( \eta , \sigma )$ such that + +$$ +\frac { a _ { c } } { d + b + 1 } \leq \frac { \eta \sigma ^ { 2 } } { b } < \frac { 2 } { d + b + 1 } , +$$ + +for some $a _ { c } \in ( 0 , 2 )$ such that $F ( a _ { c } ) = 0$ and $F ( a ) \leq 0$ for any $a _ { c } \leq a \leq 2$ , where + +$$ +\begin{array} { c } { { F ( a ) : = 2 - a - \displaystyle \frac { 2 a } { d + b + 1 } ( b + 2 ) + \displaystyle \frac { 2 a ^ { 2 } } { ( d + b + 1 ) ^ { 2 } } ( b + 2 ) ( b + d + 3 ) } } \\ { { - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } } \\ { { - \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) . } } \end{array} +$$ + +Proof. We aim to show that there exist some $\eta , \sigma$ such that + +$$ +\begin{array} { r l } & { 2 > \displaystyle \frac { \eta \sigma ^ { 2 } } { b } ( d + b + 1 ) } \\ & { \quad \ge 2 - \displaystyle \frac { 2 \eta \sigma ^ { 2 } } { b } ( b + 2 ) + \displaystyle \frac { 2 \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } ( b + 2 ) ( b + d + 3 ) } \\ & { \qquad \quad - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) - \displaystyle \frac { \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 3 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) . } \end{array} +$$ + +$\begin{array} { r } { \frac { \eta \sigma ^ { 2 } } { b } ( d + b + 1 ) = a } \end{array}$ . Then, it suffices to show that there exists some $a < 2$ such that + +$$ +\begin{array} { c } { { a \geq 2 - \displaystyle \frac { 2 a } { d + b + 1 } ( b + 2 ) + \displaystyle \frac { 2 a ^ { 2 } } { ( d + b + 1 ) ^ { 2 } } ( b + 2 ) ( b + d + 3 ) } } \\ { { - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } } \\ { { - \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) . } } \end{array} +$$ + +Let us define + +$$ +\begin{array} { c } { { F ( a ) : = 2 - a - \displaystyle \frac { 2 a } { d + b + 1 } ( b + 2 ) + \displaystyle \frac { 2 a ^ { 2 } } { ( d + b + 1 ) ^ { 2 } } ( b + 2 ) ( b + d + 3 ) } } \\ { { - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) - \displaystyle \frac { 1 } { 2 } \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } } \\ { { - \displaystyle \frac { a ^ { 3 } } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) . } } \end{array} +$$ + +Then, we can check that $F ( 0 ) = 2 > 0$ and + +$$ +\begin{array} { c } { { F ( 2 ) = \displaystyle - \frac { 4 } { d + b + 1 } ( b + 2 ) + \frac { 8 } { ( d + b + 1 ) ^ { 2 } } ( b + 2 ) ( b + d + 3 ) } } \\ { { \displaystyle ~ - \frac { 4 } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( b + 6 ) - \frac { 4 } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( d ^ { 2 } - 1 ) } } \\ { { \displaystyle ~ - \frac { 8 } { ( d + b + 1 ) ^ { 3 } } ( b + 2 ) ( b + 4 ) ( d - 1 ) , } } \end{array} +$$ + +so that + +$$ +\begin{array} { c } { { \frac { ( d + b + 1 ) ^ { 3 } } { 4 ( b + 2 ) } F ( 2 ) = - ( d + b + 1 ) ^ { 2 } + 2 ( d + b + 1 ) ( b + d + 3 ) } } \\ { { - ( b + 4 ) ( b + 6 ) - ( d ^ { 2 } - 1 ) - 2 ( b + 4 ) ( d - 1 ) } } \\ { { = d ^ { 2 } + b ^ { 2 } + 1 + 2 d + 2 b + 2 b d + 4 d + 4 b + 4 } } \\ { { - b ^ { 2 } - 1 0 b - 2 4 - d ^ { 2 } + 1 - 2 b d - 8 d + 2 b + 8 } } \\ { { = - 2 d - 2 b - 1 0 < 0 . } } \end{array} +$$ + +Thus, $F ( 2 ) < 0$ . Hence, we conclude that there exists some $0 < a _ { c } < 2$ such that $F ( a _ { c } ) = 0$ and $F ( a ) \leq 0$ for any $a _ { c } \leq a \leq 2$ . Then, for any + +$$ +a _ { c } \leq \frac { \eta \sigma ^ { 2 } } { b } ( d + b + 1 ) < 2 , +$$ + +we have $( \eta , \sigma ) \in \mathcal { D } _ { 4 , b }$ . The proof is complete. + +Recall that $\mathcal { D } _ { 2 m , b }$ consists of $( \eta , \sigma )$ such that + +$$ +\begin{array} { r } { \mathcal { D } _ { 2 m , b } = \left. \left( \eta , \sigma \right) : \eta \sigma ^ { 2 } ( d + b + 1 ) < 2 b \mathrm { a n d } h ( 2 m ) \geq 1 \right. . } \end{array} +$$ + +Since $\mathcal { D } _ { 4 , b } \neq \emptyset$ and $\mathcal { D } _ { 4 , b } \subseteq \mathcal { D } _ { 2 m , b }$ for any $m \geq 2$ . Indeed, we can characterises the set $\mathcal { D } _ { 2 m , b }$ in the following proposition. + +Proposition 28. Given any $m \in \mathbb { N }$ , there exists some $0 < \alpha \leq 2 m$ such that $h ( \alpha ) = 1$ provided that $\eta \sigma ^ { 2 } \bar { ( } d + b + 1 ) < 2 b$ and + +$$ +\begin{array} { r l r } & { } & { \displaystyle \sum _ { k = 0 } ^ { m } \sum _ { j = 0 } ^ { 2 k } { \binom { m } { k } } { \binom { 2 k } { j } } \frac { \eta ^ { 2 ( m - k ) + j } \sigma ^ { 4 ( m - k ) + 2 j } } { b ^ { 2 ( m - k ) + j } } ( - 1 ) ^ { j } 2 ^ { j + 2 ( m - k ) } } \\ & { } & { \cdot \frac { \Gamma ( j + m - k + \frac { b } { 2 } ) } { \Gamma \left( \frac { b } { 2 } \right) } \frac { \Gamma ( m - k + \frac { d - 1 } { 2 } ) } { \Gamma ( \frac { d - 1 } { 2 } ) } \ge 1 . } \end{array} +$$ + +Proof. By applying Lemma 25, we can compute that + +$$ +\begin{array} { r l } & { \mathrm { s i } \left( 2 \pi \right) = \mathbf { E } \left[ \left( \left( 1 - \frac { \sigma ^ { 2 } } { \nu } \right) ^ { 2 } + \frac { \sigma ^ { 2 } \nu ^ { 2 } } { \nu ^ { 2 } } + X _ { f } ^ { \nu ( 2 ) } + X _ { f } ^ { \nu ( 2 ) } \right) ^ { - 1 } \right] } \\ & { \qquad - \sum _ { i = 1 } ^ { N } \binom { N } { i } \frac { \sigma ^ { 2 } ( n - 1 ) ^ { n } + \sigma ^ { 2 } ( n - 1 ) } { \nu ^ { 2 } } \left[ \left( 1 - \frac { \sigma ^ { 2 } } { \nu } \right) ^ { 2 n } X _ { f } ^ { ( 2 ) } - X _ { f } ^ { ( 2 ) } \right] } \\ & { \qquad - \sum _ { i = 1 } ^ { N } \binom { N } { i } \frac { \sigma ^ { 2 } ( n - 1 ) ^ { n } + \sigma ^ { 2 } ( n - 1 ) } { \nu ^ { 2 } } \sum _ { i = 1 } ^ { N } \binom { N } { i } \frac { \sigma ^ { 2 } ( n - 1 ) } { \nu } \sum _ { j = 1 } ^ { N } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } \chi _ { j } ^ { ( 2 ) } } \\ & { \qquad - \sum _ { i = 1 } ^ { N } \binom { N } { i } \frac { \sigma ^ { 2 } ( n - 1 ) ^ { n } + \sigma ^ { 2 } ( n - 1 ) } { \nu ^ { 2 } } \sum _ { i = 1 } ^ { N } \binom { N } { i } \frac { \sigma ^ { 2 } ( n - 1 ) } { \nu } \sum _ { j = 1 } ^ { N } \frac { \sigma ^ { 2 } ( n - 1 ) } { \nu ^ { 2 } } \sum _ { i = 1 } ^ { N } \frac { \sigma ^ { 2 } ( n - 1 ) } { \nu ^ { 2 } } \sum _ { i = 1 } ^ { N } \frac { \sigma ^ { 2 } ( n - 1 ) } { \nu ^ { 2 } } } \\ & \qquad - \sum _ { i = 1 } ^ { N } \binom { N } { i } ^ { 2 ( n - 1 ) } \frac { \sigma ^ { 2 } ( n - 1 ) } \ \end{array} +$$ + +where we used the formula for the moments of chi-square distribution, that is, the $m$ -th moment of a chi-square distribution with degree of freedom $k$ is given by $\begin{array} { r } { 2 ^ { m } \Gamma ( m + \frac { k } { 2 } ) / \Gamma ( \frac { k } { 2 } ) } \end{array}$ . □ + +Previously, we have provided some upper bounds on the tail-index $\alpha$ under some technical conditions on the model parameters. Next, let us provide an upper bound for the tail-index $\alpha$ without relying on any additional technical conditions. + +Proposition 29. The tail-index $\alpha$ is upper bounded by: + +$$ +\alpha \leq \operatorname* { m a x } \left\{ 2 , \frac { \mathbb { P } \left( - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \leq 0 \right) } { \mathbb { E } \left[ \left( - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { + } \right] } \right\} , +$$ + +where $X , Y$ are independent and $X$ is a chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . + +Proof. We recall that + +$$ +1 = h ( \alpha ) = \mathbb { E } \left[ \left( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { \frac { \alpha } { 2 } } \right] , +$$ + +where $X , Y$ are independent and $X$ is a chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . Note that for any $x \geq 0$ and $\alpha \geq 2$ , $( 1 + x ) ^ { \frac { \alpha } { 2 } } \geq 1 + \frac { \alpha } { 2 } x$ . Therefore, + +$$ +\begin{array} { r l } & { 1 \geq { \mathbb { E } } \left[ \left( 1 - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { \frac { a } { 2 } } 1 _ { - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \geq 0 } \right] } \\ & { \quad \geq { \mathbb { E } } \left[ \left( 1 + \frac { \alpha } { 2 } \left( - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) \right) 1 _ { - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \geq 0 } \right] } \\ & { \quad = { \mathbb { P } } \left( - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \geq 0 \right) } \\ & { \qquad + \frac { \alpha } { 2 } { \mathbb { E } } \left[ \left( - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { + } \right] , } \end{array} +$$ + +which yields the desired result. The proof is complete. + +Remark 30. (i) Note that it follows from Lemma 25 that we have + +$$ +\rho = \frac { 1 } { 2 } \mathbb { E } \left[ \log \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) \right] , +$$ + +where $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . Therefore, we have + +$$ +\rho = \frac { 1 } { 2 } \int _ { 0 } ^ { \infty } \int _ { 0 } ^ { \infty } \log \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } x \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } x y \right) \frac { x ^ { \frac { b } { 2 } - 1 } e ^ { - \frac { x } { 2 } } } { 2 ^ { \frac { b } { 2 } } \Gamma \left( \frac { b } { 2 } \right) } \frac { y ^ { \frac { d - 1 } { 2 } } - 1 e ^ { - \frac { y } { 2 } } } { 2 ^ { \frac { d - 1 } { 2 } } \Gamma \left( \frac { d - 1 } { 2 } \right) } d x d y . +$$ + +In particular, when $d = 1$ , we have $Y \equiv 0$ and + +$$ +\rho = \int _ { 0 } ^ { \infty } \log \left| 1 - \frac { \eta \sigma ^ { 2 } } { b } x \right| \frac { x ^ { \frac { b } { 2 } - 1 } e ^ { - \frac { x } { 2 } } } { 2 ^ { \frac { b } { 2 } } \Gamma ( \frac { b } { 2 } ) } d x . +$$ + +(ii) Note that it follows from Lemma 25 that we have + +$$ +h ( s ) = \mathbb { E } \left[ \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { s / 2 } \right] , +$$ + +where $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . Therefore, we have + +$$ +h ( s ) = \int _ { 0 } ^ { \infty } \int _ { 0 } ^ { \infty } \left( \left( 1 - \frac { \eta \sigma ^ { 2 } } { b } x \right) ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } x y \right) ^ { \frac { s } { 2 } } \frac { x ^ { \frac { b } { 2 } - 1 } e ^ { - \frac { x } { 2 } } } { 2 ^ { \frac { b } { 2 } } \Gamma \left( \frac { b } { 2 } \right) } \frac { y ^ { \frac { d - 1 } { 2 } - 1 } e ^ { - \frac { y } { 2 } } } { 2 ^ { \frac { d - 1 } { 2 } } \Gamma \left( \frac { d - 1 } { 2 } \right) } d x d y . +$$ + +In particular, when $d = 1$ , we have $Y \equiv 0$ and + +$$ +h ( s ) = \int _ { 0 } ^ { \infty } \left| 1 - \frac { \eta \sigma ^ { 2 } } { b } x \right| ^ { s } \frac { x ^ { \frac { b } { 2 } - 1 } e ^ { - \frac { x } { 2 } } } { 2 ^ { \frac { b } { 2 } } \Gamma ( \frac { b } { 2 } ) } d x . +$$ + +So far, we have studied various properties of the tail-index $\alpha$ , including the monotonicity on stepsize, noise variance, batch size and the dimension, as well as some quantitative bounds. In general, there is no simple closed-form formula for the tail-index $\alpha$ . Next, we will obtain some approximations for the tail-index $\alpha$ in various asymptotic regimes. First, we provide a rigorous first-order approximation for the tail-index $\alpha$ when it is less than and close to 2. + +$a : = \eta \sigma ^ { 2 }$ $\textstyle { a _ { c } : = { \frac { 2 b } { d + b + 1 } } }$ + +$$ +\alpha \sim 2 - \frac { 4 } { F _ { c } } ( a - a _ { c } ) , +$$ + +for any $a \downarrow a _ { c }$ , where + +$$ +F _ { c } : = \mathbb { E } \left[ \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \log \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] > 0 , +$$ + +where $X , Y$ are independent and $X$ is a chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . + +Proof of Proposition $3 l$ . Let us define $a = \eta \sigma ^ { 2 }$ . In Proposition 3, we showed that there exists some $\delta > 0$ such that for any $2 b \leq a ( d + b + 1 ) < 2 b + \delta$ , $\rho < 0$ and there exists some $0 < \alpha \leq 2$ , such that $h ( \alpha ) = 1$ . In particular, when $\begin{array} { r } { a = a _ { c } : = \frac { 2 b } { d + b + 1 } } \end{array}$ 2bd+b+1 , the tail-index α = 2. Consider the tail-index $\alpha = \alpha ( a )$ as a function of $a$ . Then, we have + +$$ +1 = h ( \alpha ) = \mathbb { E } \left[ \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { \frac { \alpha } { 2 } } \right] , +$$ + +where $X , Y$ are independent and $X$ is a chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . By differentiating (E.27) w.r.t. $a$ , we get + +$$ +\begin{array} { c } { 0 = \mathbb { E } \Bigg [ \frac { 1 } { 2 } \frac { \partial \alpha } { \partial a } \log \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) e ^ { \frac { \alpha } { 2 } \log \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) } } \\ { { + \frac { \alpha } { 2 } \frac { - \frac { 2 } { b } X + \frac { 2 a } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a } { b ^ { 2 } } X Y } { 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y } \cdot e ^ { \frac { \alpha } { 2 } \log \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) } \Bigg ] , } } \end{array} +$$ + +which implies that + +$$ +\frac { \partial \alpha } { \partial a } \bigg \vert _ { a = a _ { c } } = \frac { - 2 \mathbb { E } \left[ - \frac { 2 } { b } X + \frac { 2 a _ { c } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { c } } { b ^ { 2 } } X Y \right] } { \mathbb { E } \left[ \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \log \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] } , +$$ + +where we used the fact that by Jensen’s inequality and t $\alpha = 2$ whe that $a = a _ { c }$ ion is $x \mapsto x \log x$ is convex, and we have $\begin{array} { r } { 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y } \end{array}$ + +$$ +\begin{array} { r l } & { \mathbb { E } \left[ \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \log \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] } \\ & { > \mathbb { E } \left[ \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] \log \mathbb { E } \left[ \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] = 0 . } \end{array} +$$ + +Moreover, we can compute that + +$$ +- 2 \mathbb { E } \left[ - \frac 2 b X + \frac { 2 a _ { c } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { c } } { b ^ { 2 } } X Y \right] = - 2 \left[ - 2 + \frac { 2 a _ { c } } { b } ( b + 2 ) + \frac { 2 a _ { c } } { b } ( d - 1 ) \right] = - 4 . +$$ + +Hence, we conclude that + +$$ +\alpha \sim 2 - \frac { 4 } { F _ { c } } ( a - a _ { c } ) , +$$ + +for any $a \downarrow a _ { c }$ , where + +$$ +F _ { c } : = \mathbb { E } \left[ \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \log \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] > 0 . +$$ + +Next, we derive an approximation for the tail-index $\alpha$ when it is close to zero. + +Proposition 32. Let $a : = \eta \sigma ^ { 2 }$ and $\rho = \rho ( a )$ emphasizing the dependence on a. Define $a _ { * } : =$ $\operatorname* { i n f } \bar { \{ a > 0 : \rho ( a ) = 0 \} }$ . Then, we have + +$$ +\alpha \sim c _ { * } ( a _ { * } - a ) , +$$ + +as $a \uparrow a _ { * }$ , where + +$$ +\begin{array} { r } { \mathrm { ~ \cdot ~ } : = 4 { \mathbb { E } } \left[ \frac { - \frac { 2 } { b } X + \frac { 2 a _ { * } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { * } } { b ^ { 2 } } X Y } { 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y } \right] \cdot \left( { \mathbb { E } } \left[ \left( \log \left( 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right) \right) ^ { 2 } \right] \right) ^ { - 1 } , } \end{array} +$$ + +where $X , Y$ are defined in Proposition $3 l$ . + +Proof of Proposition 32. The tail-index $\alpha$ is uniquely determined by + +$$ +1 = h ( \alpha ) = \mathbb { E } \left[ \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { \alpha / 2 } \right] , +$$ + +where $a = \eta \sigma ^ { 2 }$ and $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . It is clear that $\alpha$ depends on $\eta$ and $\sigma$ only via $a : = \eta \sigma ^ { 2 }$ . In Proposition 3, we showed that there exists some $\delta > 0$ such that for any $2 b \leq a ( d + b + 1 ) < 2 b + \delta _ { }$ , $\rho < 0$ and there exists some $0 < \alpha \leq 2$ , such that $h ( \alpha ) = 1$ . Let $\rho = \rho ( a )$ with emphasis on the dependence of $\rho$ on $a = \eta \sigma ^ { 2 }$ . In Proposition 23, we showed that $\rho < 0$ provided that $\dot { a } ( d + b + 1 ) < \dot { 2 } b$ . On the other hand, we showed in Remark 24 criti $\rho \geq 0$ for any ue $a _ { * } > 0$ $\begin{array} { r } { a \geq b \exp \left\{ \frac { 1 } { 2 ^ { \frac { b } { 2 } - 1 } b ^ { 2 } \Gamma \left( \frac { b } { 2 } \right) } + \frac { 1 } { 2 ^ { \frac { d - 1 } { 2 } - 1 } ( d - 1 ) ^ { 2 } \Gamma \left( \frac { d - 1 } { 2 } \right) } \right\} } \end{array}$ such that $\rho ( a ) < 0$ ( b2 ) 2 d−2 for every $a < a _ { * }$ )2Γ( and $\rho ( a _ { * } ) = 0$ Therefore, there exists some . It is clear that as $a a _ { * }$ , $\alpha 0$ . We are interested in studying the tail-index $\alpha$ when $\alpha$ is close to zero. By differentiating (E.33) w.r.t. $a$ , we get + +$$ +\begin{array} { r l } & { 0 = \mathbb { E } \Bigg [ \Bigg ( \frac { 1 } { 2 } \frac { \partial \alpha } { \partial a } \log \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) } \\ & { \qquad + \frac { \alpha } { 2 } \frac { - \frac { 2 } { b } X + \frac { 2 a } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a } { b ^ { 2 } } X Y } { 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y } \Bigg ) e ^ { \frac { \alpha } { 2 } \log \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) } \Bigg ] , } \end{array} +$$ + +and by differentiating w.r.t. $a$ again, we get + +$$ +\begin{array} { c } { { \displaystyle 0 = \mathbb { E } [ ( \frac { 1 } { 2 } \frac { \partial \alpha } { \partial \alpha } \log ( 1 - \frac { 2 \alpha } { b } X + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X Y ) } } \\ { { \qquad + \frac { \alpha } { 2 } \frac { - \frac { 2 } { b } X + \frac { 2 \alpha } { b ^ { 2 } } X ^ { 2 } + \frac { 2 \alpha } { b ^ { 2 } } X Y } { 1 - \frac { 2 } { b } X + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X Y } ) ^ { 2 } e ^ { \frac { \alpha } { 2 } \log ( 1 - \frac { 2 \alpha } { b } X + \frac { 2 } { b ^ { 2 } } X ^ { 2 } + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X Y ) ^ { - 1 } } } } \\ { { \qquad + \mathbb { E } [ \frac { 1 } { 2 } \frac { \partial ^ { 2 } \alpha } { \partial \alpha ^ { 2 } } \log ( 1 - \frac { 2 \alpha } { b } X + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X Y ) \epsilon ^ { \frac { \alpha } { 2 } \log ( 1 - \frac { 2 \alpha } { b } X + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X Y ) } ] ^ { - 1 } } } \\ { \qquad + \mathbb { E } [ \frac { \partial \alpha } { \partial a } \frac { - \frac { 2 } { b } X + \frac { 2 \alpha } { b ^ { 2 } } X ^ { 2 } + \frac { 2 \alpha } { b ^ { 2 } } X Y } { 1 - \frac { 2 \alpha } { b } X + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 \alpha } { b ^ { 2 } } X Y } \cdot e ^ { \frac { \alpha } { 2 } \log ( 1 - \frac { 2 \alpha } { b } X + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { \alpha ^ { 2 } } { b ^ { 2 } } X ) ] } } \\ \qquad + \mathbb { E } [ \frac { \alpha } { 2 } \frac { \partial } { \partial a } \end{array} +$$ + +At $a = a _ { * } , \alpha = 0$ and $\begin{array} { r } { \rho = \frac { 1 } { 2 } \mathbb { E } \left[ \log \left( 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] = 0 } \end{array}$ , which implies that + +$$ +\begin{array} { c } { { 0 = \displaystyle \frac { 1 } { 4 } ( \alpha ^ { \prime } ( a _ { * } ) ) ^ { 2 } \mathbb { E } \left[ \left( \log \left( 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right) \right) ^ { 2 } \right] } } \\ { { + \alpha ^ { \prime } ( a _ { * } ) \mathbb { E } \left[ \frac { - \frac { 2 } { b } X + \frac { 2 a _ { * } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { * } } { b ^ { 2 } } X Y } { 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y } \right] , } } \end{array} +$$ + +which implies that + +$$ +\alpha ^ { \prime } ( a _ { * } ) = \frac { - 4 \mathbb { E } \left[ \frac { - \frac { 2 } { b } X + \frac { 2 a _ { * } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { * } } { b ^ { 2 } } X Y } { 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y } \right] } { \mathbb { E } \left[ \left( \log \left( 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right) \right) ^ { 2 } \right] } , +$$ + +and therefore + +$$ +\alpha \sim \frac { 4 \mathbb { E } \left[ \frac { - \frac { 2 } { b } X + \frac { 2 a _ { * } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { * } } { b ^ { 2 } } X Y } { 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y } \right] } { \mathbb { E } \left[ \left( \log \left( 1 - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right) \right) ^ { 2 } \right] } ( a _ { * } - a ) +$$ + +as $a \uparrow a _ { * }$ + +When the dimension $d$ is large, we can use Proposition 31 and Proposition 32 to obtain a more explicit approximation for the tail-index $\alpha$ when it is between 0 and 2. + +Theorem 33. When the dimension $d$ is large, the tail-index satisfies: + +$$ +\alpha \sim 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) , +$$ + +for any $\begin{array} { r } { \frac { 2 b } { d + b + 1 } \leq \eta \sigma ^ { 2 } < \frac { 2 b } { d + b + 1 } + \frac { 8 b ( b + 2 ) } { d ^ { 3 } } } \end{array}$ . + +Noas hat in Theoremincreases from apto $\begin{array} { r } { 2 \mathrm { ~ - ~ } \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) } \end{array}$ decreasation of from 2 to 0. Moreover, $\eta \sigma ^ { 2 }$ $\frac { 2 b } { d + b + 1 }$ $\textstyle { \frac { 2 b } { d + b + 1 } } + { \frac { 8 b ( b + 2 ) } { d ^ { 3 } } }$ $^ { a _ { * } }$ the approximation 2 − d34b(b+2) $\begin{array} { r } { 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) } \end{array}$ is strictly decreasing in $d , \eta$ , and $\sigma ^ { 2 }$ and strictly increasing in $b$ . This is consistent with the monotonicity results we have shown before. + +Proof of Theorem 33. When $\eta \sigma ^ { 2 }$ increases from $\begin{array} { r } { a _ { c } = \frac { 2 b } { d + b + 1 } } \end{array}$ to $a _ { * }$ , where $a _ { * } = \operatorname* { i n f } \{ a > 0 : \rho ( a ) =$ $0 \}$ , the tail-index decreases from 2 to 0. When $d \uparrow \infty$ , $a _ { * } \to 0$ and ${ a _ { c } } \to 0$ , and hence it suffices to show that + +$$ +\alpha \sim 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) , +$$ + +as $d \uparrow \infty$ and $\begin{array} { r } { \eta \sigma ^ { 2 } \downarrow \frac { 2 b } { d + b + 1 } } \end{array}$ ↓ 2bd+b+1 , and a∗ ∼ d $\begin{array} { r } { a _ { * } \sim \frac { 2 b } { d + b + 1 } + \frac { 8 b ( b + 2 ) } { d ^ { 3 } } } \end{array}$ , and when $d \uparrow \infty$ and $\begin{array} { r } { \eta \sigma ^ { 2 } \uparrow \frac { 2 b } { d + b + 1 } + \frac { 8 b ( b + 2 ) } { d ^ { 3 } } } \end{array}$ , + +$$ +\alpha \sim 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) . +$$ + +We will prove (E.37) in Corollary 34 which is a corollary of Proposition 31 when $d \uparrow \infty$ and we will prove (E.38) in Corollary 35 which is a corollary of Proposition 32 when $d \uparrow \infty$ . □ + +When the dimension $d$ is large, we have the following result as a corollary of Proposition 31. + +Corollary 34. The tail-index satisfies: + +$$ +\alpha \sim 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) , +$$ + +as $d \uparrow \infty$ and $\begin{array} { r } { \eta \sigma ^ { 2 } \downarrow \frac { 2 b } { d + b + 1 } } \end{array}$ . + +Proof of Corollary using $\textstyle \log ( 1 + x ) \sim x - { \frac { x ^ { 2 } } { 2 } }$ $3 4$ . As $d \uparrow \infty , a _ { c } \downarrow 0$ so that $\begin{array} { r } { ( 1 + x ) \log ( 1 + x ) \sim ( 1 + x ) x - \frac { x ^ { 2 } } { 2 } } \end{array}$ , we have $\begin{array} { r } { \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y 0 } \end{array}$ , we have in probability, and + +$$ +\begin{array} { r l } & { F _ { c } \sim \mathbb { E } \left[ \left( 1 - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \left( - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] } \\ & { \qquad - \frac { 1 } { 2 } \mathbb { E } \left[ \left( - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] } \\ & { \qquad = \frac { 1 } { 2 } \mathbb { E } \left[ \left( - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] . } \end{array} +$$ + +Next, we can compute that + +$$ +\begin{array} { r l } & { \mathbb { E } \Bigg [ \Bigg ( \frac { \mathcal { Q } _ { \Delta } } { \theta } _ { 1 } \boldsymbol { X } _ { 1 } ^ { \alpha } \Bigg . \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg . \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg . \Bigg . } \\ & { = \Bigg . \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg [ \mathcal { Q } _ { \Delta } ^ { 2 } + \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg . \Bigg . \Bigg ] ^ { 2 } } \\ & { = \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg [ \mathcal { Q } _ { \Delta } ^ { 2 } + \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg . \Bigg ] ^ { 2 } - \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg [ \mathcal { Q } _ { \Delta } ^ { 2 } + \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg . \Bigg ] ^ { 2 } - \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg [ \mathcal { Q } _ { \Delta } ^ { 2 } + \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg . \Bigg ] ^ { 2 } - \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg [ \mathcal { Q } _ { \Delta } ^ { 2 } \Bigg . \Bigg ] ^ { 2 } } \\ & { = \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Bigg ( \Delta \boldsymbol { Q } _ { \Delta } ^ { 2 } + \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Delta \boldsymbol { Q } _ { \Delta } ^ { 2 } - 2 \Delta \boldsymbol { Q } _ { \Delta } ^ { 2 } + \Delta ( \Delta \boldsymbol { Q } _ { \Delta } ^ { 2 } + \frac { \mathcal { Q } _ { \Delta } ^ { 2 } } { \theta ^ { 2 } } \Delta \boldsymbol { Q } _ { \Delta } ^ { 2 } - \Delta \boldsymbol { Q } _ { \Delta } ^ { 2 } ) \Bigg . \Bigg . \frac { \Delta } { \theta ^ { 2 } } \Bigg . } \\ & \Bigg . \quad \quad \quad \quad \quad \quad \quad \quad \quad \ \end{array} +$$ + +as $d \uparrow \infty$ , where we used the formulas for the moments of chi-square random variables, and $\begin{array} { r } { a _ { c } \sim \frac { 2 b } { d } } \end{array}$ for $d \uparrow \infty$ . Therefore, it follows from Proposition 31 that we have + +$$ +\alpha \sim 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) , +$$ + +as $d \uparrow \infty$ and $\textstyle \eta \sigma ^ { 2 } \downarrow \frac { 2 b } { d + b + 1 }$ . The proof is complete. + +When the dimension $d$ is large, we have the following result as a corollary of Proposition 32. + +Corollary 35. When $d \uparrow \infty$ and $\begin{array} { r } { \eta \sigma ^ { 2 } \uparrow a _ { * } \sim \frac { 2 b } { d + b + 1 } + \frac { 8 b ( b + 2 ) } { d ^ { 3 } } } \end{array}$ 8b(b+2)3 , the tail-index satisfies + +$$ +\alpha \sim 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) . +$$ + +Proof of Corollary 35. Note that by the definition of $^ { a _ { * } }$ , + +$$ +0 = \rho ( a _ { \ast } ) = \frac 1 2 \mathbb { E } \left[ \log \left( 1 - \frac { 2 a _ { \ast } } b X + \frac { a _ { \ast } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { \ast } ^ { 2 } } { b ^ { 2 } } X Y \right) \right] . +$$ + +When the dimension $d$ is large, i.e. $d \uparrow \infty$ , we have $Y \uparrow \infty$ in probability, and thus $a _ { * } \to 0$ . This implies that $\begin{array} { r } { - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { \bar { 2 } } \to 0 } \end{array}$ in probability, and hence we must have ${ \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } } X Y 0$ as well. It follows that + +$$ +0 \sim \frac 1 2 \mathbb { E } \left[ - \frac { 2 a _ { * } } b X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right] , +$$ + +which implies that as $d \uparrow \infty$ , + +$$ +a _ { * } \sim a _ { c } : = \frac { 2 b } { d + b + 1 } , +$$ + +where we used $\begin{array} { r } { \mathbb { E } \left[ - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right] = 0 } \end{array}$ . Note that when $a = a _ { c }$ , $\alpha = 2$ , which is not close to zero, and to get a finer approximation, using $\textstyle \log ( 1 + x ) \sim x - { \frac { x ^ { 2 } } { 2 } }$ , we get + +$$ +\begin{array} { c } { { 0 \sim \displaystyle \frac { 1 } { 2 } \mathbb { E } \left[ - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right] - \frac { 1 } { 4 } \mathbb { E } \left[ \left( - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] } } \\ { { \sim \displaystyle \frac { 1 } { 2 } \mathbb { E } \left[ - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right] - \frac { 1 } { 4 } \mathbb { E } \left[ \left( - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] } } \\ { { \sim \displaystyle \frac { 1 } { 2 } \mathbb { E } \left[ - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right] - \frac { 8 b ( b + 2 ) } { d ^ { 3 } } , } } \end{array} +$$ + +where we used from the proof of Corollary 34 that + +$$ +\mathbb { E } \left[ \left( - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] \sim \frac { 3 2 b ( b + 2 ) } { d ^ { 3 } } , +$$ + +as $d \uparrow \infty$ . Let us write $a _ { * } = a _ { c } + \epsilon$ , then as $\epsilon 0$ , we have + +$$ +0 \sim \frac { 1 } { 2 } \mathbb { E } \left[ - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right] + \frac { 1 } { 2 } \mathbb { E } \left[ - \frac { 2 } { b } X + \frac { 2 a _ { c } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { c } } { b ^ { 2 } } X Y \right] \epsilon - \frac { 8 b ( b + 2 ) } { d ^ { 3 } } , +$$ + +and we can compute that + +$$ +\mathbb { E } \left[ - \frac { 2 } { b } X + \frac { 2 a _ { c } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { c } } { b ^ { 2 } } X Y \right] = \left[ \frac { - 2 } { b } b + \frac { 2 a _ { c } } { b ^ { 2 } } b ( b + 2 ) + \frac { 2 a _ { c } } { b ^ { 2 } } b ( d - 1 ) \right] = 2 , +$$ + +which implies that + +$$ +\epsilon \sim \frac { 8 b ( b + 2 ) } { d ^ { 3 } } . +$$ + +Hence, we have + +$$ +\begin{array} { r l } & { \alpha \sim \frac { 4 \mathbb { E } \left[ - \frac { 2 } { b } X + \frac { 2 a _ { * } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { * } } { b ^ { 2 } } X Y \right] } { \mathbb { E } \left[ \left( - \frac { 2 a _ { * } } { b } X + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { * } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] } \left( a _ { * } - \eta \sigma ^ { 2 } \right) } \\ & { \sim \frac { 4 \mathbb { E } \left[ - \frac { 2 } { b } X + \frac { 2 a _ { c } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { c } } { b ^ { 2 } } X Y \right] } { \mathbb { E } \left[ \left( - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] } \left( a _ { c } + \epsilon - \eta \sigma ^ { 2 } \right) . } \end{array} +$$ + +We recall that + +$$ +4 \mathbb { E } \left[ - \frac { 2 } { b } X + \frac { 2 a _ { c } } { b ^ { 2 } } X ^ { 2 } + \frac { 2 a _ { c } } { b ^ { 2 } } X Y \right] = 8 , +$$ + +and from the proof of Corollary 34, we have + +$$ +\mathbb { E } \left[ \left( - \frac { 2 a _ { c } } { b } X + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a _ { c } ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] \sim \frac { 3 2 b ( b + 2 ) } { d ^ { 3 } } , +$$ + +as $d \uparrow \infty$ , where we used the formulas for the moments of chi-square random variables, and $\begin{array} { r } { a _ { c } \sim \frac { 2 b } { d } } \end{array}$ for $d \uparrow \infty$ . Hence, we conclude that + +$$ +\alpha \sim { \frac { 8 d ^ { 3 } } { 3 2 b ( b + 2 ) } } \left( { \frac { 2 b } { d + b + 1 } } + { \frac { 8 b ( b + 2 ) } { d ^ { 3 } } } - \eta \sigma ^ { 2 } \right) , +$$ + +when $d \uparrow \infty$ is large and $\begin{array} { r } { \eta \sigma ^ { 2 } \uparrow \frac { 2 b } { d + b + 1 } + \frac { 8 b ( b + 2 ) } { d ^ { 3 } } } \end{array}$ 8b(b+2)d3 . The proof is complete by noticing that + +$$ +\frac { 8 d ^ { 3 } } { 3 2 b ( b + 2 ) } \left( \frac { 2 b } { d + b + 1 } + \frac { 8 b ( b + 2 ) } { d ^ { 3 } } - \eta \sigma ^ { 2 } \right) = 2 - \frac { d ^ { 3 } } { 4 b ( b + 2 ) } \left( \eta \sigma ^ { 2 } - \frac { 2 b } { d + b + 1 } \right) . +$$ + +Remark 36. We have already obtained an approximation of $\alpha$ when α lies between 0 and 2 and the dimension $d$ is large (see Theorem 33). Fix the dimension $d$ and batch size $b$ , when $a = \eta \sigma ^ { 2 } \to 0$ , the tail-index $\alpha \to \infty$ . Let us derive an approximation for the tail-index $\alpha$ in this asymptotic regime. We recall that the tail-index $\alpha$ is uniquely determined by + +$$ +1 = h ( \alpha ) = \mathbb { E } \left[ \left( 1 - \frac { 2 a } { b } X + \frac { a ^ { 2 } } { b ^ { 2 } } X ^ { 2 } + \frac { a ^ { 2 } } { b ^ { 2 } } X Y \right) ^ { \alpha / 2 } \right] , +$$ + +where $a = \eta \sigma ^ { 2 }$ and $X , Y$ are independent and $X$ is chi-square random variable with degree of freedom $b$ and $Y$ is a chi-square random variable with degree of freedom $( d - 1 )$ . We apply the approximation (1 + x)α/2 ∼ 1 + α2 x + α2 ( α2 −1)2 x to get: + +$$ +\begin{array} { r l } & { 1 \sim 1 + \displaystyle \frac { \alpha } { 2 } \mathbb { E } \left[ \left( - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) \right] } \\ & { \qquad + \frac { \frac { \alpha } { 2 } ( \frac { \alpha } { 2 } - 1 ) } { 2 } \mathbb { E } \left[ \left( - \frac { 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] . } \end{array} +$$ + +Assume that $\eta \sigma ^ { 2 }$ is small and ignore the higher-order terms, we get + +$$ +\begin{array} { r l } & { \frac { \alpha } { 2 } \sim 1 + \frac { 2 \mathbb { E } \left[ \frac { 2 \eta \sigma ^ { 2 } } { b } X \right] - 2 \mathbb { E } \left[ \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right] } { \mathbb { E } \left[ \left( \frac { 2 \eta \sigma ^ { 2 } } { b } X \right) ^ { 2 } \right] } } \\ & { \quad = 1 + \frac { \frac { 4 \eta \sigma ^ { 2 } } { b } b - 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } ( b ^ { 2 } + 2 b ) - 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } b ( d - 1 ) } { \frac { 4 \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } ( b ^ { 2 } + 2 b ) } = \frac { b } { \eta \sigma ^ { 2 } ( b + 2 ) } + \frac { 1 } { 2 } - \frac { d - 1 } { 2 ( b + 2 ) } . } \end{array} +$$ + +Hence, we conclude that as $\eta \sigma ^ { 2 } \to 0$ , the tail-index satisfies + +$$ +\alpha \sim \frac { 2 b } { \eta \sigma ^ { 2 } ( b + 2 ) } + 1 - \frac { d - 1 } { b + 2 } . +$$ + +Note that the approximation $\begin{array} { r } { \frac { 2 b } { \eta \sigma ^ { 2 } ( b + 2 ) } + 1 - \frac { d - 1 } { b + 2 } } \end{array}$ is strictly increasing in $b$ , and strictly decreasing in $\eta , \sigma ^ { 2 }$ and $d$ , which is consistent with what we have shown before. If $\begin{array} { r } { \eta \sigma ^ { 2 } = \frac { 2 b } { d + b + 1 } } \end{array}$ , we know from Proposition 3 that the tail-index $\alpha = 2$ . Indeed, by plugging $\begin{array} { r } { \eta \sigma ^ { 2 } = \frac { 2 b } { d + b + 1 } } \end{array}$ into the right hand side of (E.52), we get + +$$ +\frac { 2 b } { \eta \sigma ^ { 2 } ( b + 2 ) } + 1 - \frac { d - 1 } { b + 2 } = \frac { 2 b ( d + b + 1 ) } { 2 b ( b + 2 ) } + 1 - \frac { d - 1 } { b + 2 } = 2 , +$$ + +which is consistent with Proposition 3. + +Remark 37. The approximation in $( E . 5 2 )$ is good if $\eta \sigma ^ { 2 }$ is small, and every other model parameter is fixed. When $\eta \sigma ^ { 2 }$ is small, and dimension $d$ is large, a finer approximation is given by + +$$ +\frac { \alpha } { 2 } \sim 1 + \frac { 2 \mathbb { E } \left[ \frac { 2 \eta \sigma ^ { 2 } } { b } X \right] - 2 \mathbb { E } \left[ \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X Y \right] } { \mathbb { E } \left[ \left( \frac { - 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta \sigma ^ { 4 } } { b ^ { 2 } } X Y \right) ^ { 2 } \right] } , +$$ + +and we can compute that + +$$ +\begin{array} { r l r } { { \mathbb { E } [ ( \frac { - 2 \eta \sigma ^ { 2 } } { b } X + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } X ^ { 2 } + \frac { \eta \sigma ^ { 4 } } { b ^ { 2 } } X Y ) ^ { 2 } ] } } \\ & { = \frac { 4 a ^ { 2 } } { b ^ { 2 } } b ( b + 2 ) + \frac { a ^ { 4 } } { b ^ { 4 } } b ( b + 2 ) ( b + 4 ) ( b + 6 ) + \frac { a ^ { 4 } } { b ^ { 4 } } b ( b + 2 ) ( d ^ { 2 } - 1 ) } \\ & { } & { \quad - \frac { 4 a ^ { 3 } } { b ^ { 3 } } b ( b + 2 ) ( b + 4 ) + \frac { 2 a ^ { 4 } } { b ^ { 4 } } b ( b + 2 ) ( b + 4 ) ( d - 1 ) - \frac { 4 a ^ { 3 } } { b ^ { 3 } } b ( b + 2 ) ( d - 1 ) } \\ & { } & { \quad \sim \frac { 4 a ^ { 2 } } { b ^ { 2 } } b ( b + 2 ) + \frac { a ^ { 4 } } { b ^ { 4 } } b ( b + 2 ) d ^ { 2 } - \frac { 4 a ^ { 3 } } { b ^ { 3 } } b ( b + 2 ) d , } \end{array} +$$ + +where $a = \eta \sigma ^ { 2 }$ . Hence, we obtain the approximation: + +$$ +\frac { \alpha } { 2 } \sim 1 + \frac { \frac { 4 \eta \sigma ^ { 2 } } { b } b - 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } ( b ^ { 2 } + 2 b ) - 2 \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } b ( d - 1 ) } { \frac { 4 \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } b ( b + 2 ) + \frac { \eta ^ { 4 } \sigma ^ { 8 } } { b ^ { 4 } } b ( b + 2 ) d ^ { 2 } - \frac { 4 \eta ^ { 3 } \sigma ^ { 6 } } { b ^ { 3 } } b ( b + 2 ) d } , +$$ + +which yields that the tail-index $\alpha$ can be approximated as: + +$$ +\alpha \sim 2 + \frac { 2 b } { \eta \sigma ^ { 2 } ( b + 2 ) ( 1 + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { 4 b ^ { 2 } } d ^ { 2 } - \frac { \eta \sigma ^ { 2 } } { b } d ) } - \frac { 4 ( d + b + 1 ) } { ( b + 2 ) ( 4 + \frac { \eta ^ { 2 } \sigma ^ { 4 } } { b ^ { 2 } } d ^ { 2 } - \frac { 4 \eta \sigma ^ { 2 } } { b } d ) } . +$$ \ No newline at end of file diff --git a/md/train/GY6-6sTvGaf/GY6-6sTvGaf.md b/md/train/GY6-6sTvGaf/GY6-6sTvGaf.md new file mode 100644 index 0000000000000000000000000000000000000000..ca15e71f038b9261e967b122c0c69745638c8845 --- /dev/null +++ b/md/train/GY6-6sTvGaf/GY6-6sTvGaf.md @@ -0,0 +1,437 @@ +# IMAGE AUGMENTATION IS ALL YOU NEED: REGULARIZING DEEP REINFORCEMENT LEARNING FROM PIXELS + +Denis Yarats∗ New York University & Facebook AI Research denisyarats@cs.nyu.edu + +Ilya Kostrikov∗ New York University kostrikov@cs.nyu.edu + +Rob Fergus New York University fergus@cs.nyu.edu + +# ABSTRACT + +Existing model-free reinforcement learning (RL) approaches are effective when trained on states but struggle to learn directly from image observations. We propose an augmentation technique that can be applied to standard model-free RL algorithms, enabling robust learning directly from pixels without the need for auxiliary losses or pre-training. The approach leverages input perturbations commonly used in computer vision tasks to transform input examples, as well as regularizing the value function and policy. Our approach reaches a new stateof-the-art performance on DeepMind control suite and Atari $1 0 0 \mathrm { k }$ benchmark, surpassing previous model-free (Haarnoja et al., 2018; van Hasselt et al., 2019a), model-based (Hafner et al., 2019; Lee et al., 2019; Hafner et al., 2018; Kaiser et al., 2019) and contrastive learning (Srinivas et al., 2020) approaches. It also closes the gap between state-based and image-based RL training. Our method, which we dub DrQ: Data-regularized Q, can be combined with any model-free RL algorithm. To the best of our knowledge, our approach is the first effective data augmentation method for RL on these benchmarks. + +# 1 INTRODUCTION + +Sample-efficient deep reinforcement learning (RL) algorithms capable of directly training from image pixels would open up many real-world applications in control and robotics. However, simultaneously training a convolutional encoder alongside a policy network is challenging when given limited environment interaction, strong correlation between samples and a typically sparse reward signal. Limited supervision is a common problem across AI and two approaches are commonly taken: (i) training with an additional auxiliary losses, such as those based on self-supervised learning (SSL) and (ii) training with data augmentation. + +A wide range of auxiliary loss functions have been proposed to augment supervised objectives, e.g. weight regularization, noise injection (Hinton et al., 2012), or various forms of auto-encoder (Kingma et al., 2014). In RL, reconstruction losses (Jaderberg et al., 2017; Yarats et al., 2019) or SSL objectives (Dwibedi et al., 2018; Srinivas et al., 2020) are used. However, these objectives are unrelated to the task at hand, thus have no guarantee of inducing an appropriate representation for the policy network. SSL losses are highly effective in the large data regime, e.g. in domains such as vision (Chen et al., 2020; He et al., 2019) and NLP (Collobert et al., 2011; Devlin et al., 2018) where large (unlabeled) datasets are readily available. However, in sample-efficient RL, training data is more limited due to restricted interaction between the agent and the environment, limiting their effectiveness. + +Data augmentation methods are widely used in vision and speech domains, where output-invariant perturbations can easily be applied to the labeled input examples. Surprisingly, data augmentation has received little attention in the RL community. In this paper we propose augmentation approaches appropriate for sample-efficient RL and comprehensively evaluate them. The key idea of our approach is to use standard image transformations to perturb input observations, as well as regularizing the $Q$ -function learned by the critic so that different transformations of the same input image have similar $Q$ -function values. No further modifications to standard actor-critic algorithms are required. Our study is, to the best of our knowledge, the first careful examination of image augmentation in sample-efficient RL. + +The main contributions of the paper are as follows: (i) the first to demonstrate that data augmentation greatly improves performance when training model-free RL algorithms from images; (ii) introducing a natural way to exploit MDP structure through two mechanisms for regularizing the value function, in a manner that is generally applicable to model-free RL and (iii) setting a new state-of-the-art performance on the standard DeepMind control suite (Tassa et al., 2018), closing the gap between learning from states, and Atari 100k (Kaiser et al., 2019) benchmarks. + +# 2 RELATED WORK + +Data Augmentation in Computer Vision Data augmentation via image transformations has been used to improve generalization since the inception of convolutional networks (Becker & Hinton, 1992; Simard et al., 2003; LeCun et al., 1989; Ciresan et al., 2011; Ciregan et al., 2012). Following AlexNet (Krizhevsky et al., 2012), they have become a standard part of training pipelines. For object classification tasks, the transformations are selected to avoid changing the semantic category, i.e. translations, scales, color shifts, etc. While a similar set of transformations are potentially applicable to control tasks, the RL context does require modifications to be made to the underlying algorithm. + +Data augmentation methods have also been used in the context of self-supervised learning. Dosovitskiy et al. (2016) use per-exemplar perturbations in a unsupervised classification framework. More recently, several approaches (Chen et al., 2020; He et al., 2019; Misra & van der Maaten, 2019) have used invariance to imposed image transformations in contrastive learning schemes, producing state-of-the-art results on downstream recognition tasks. By contrast, our scheme addresses control tasks, utilizing different types of invariance. + +Data Augmentation in RL In contrast to computer vision, data augmentation is rarely used in RL. Certain approaches implicitly adopt it, for example Levine et al. (2018); Kalashnikov et al. (2018) use image augmentation as part of the AlexNet training pipeline without analysing the benefits occurring from it, thus being overlooked in subsequent work. HER (Andrychowicz et al., 2017) exploits information about the observation space by goal and reward relabeling, which can be viewed as a way to perform data augmentation. Other work uses data augmentation to improve generalization in domain transfer (Cobbe et al., 2018). However, the classical image transformations used in vision have not previously been shown to definitively help on standard RL benchmarks. Concurrent with our work, RAD (Laskin et al., 2020) performs an exploration of different data augmentation approaches, but is limited to transformations of the image alone, without the additional augmentation of the Q-function used in our approach. Moreover, RAD can be regarded as a special case of our algorithm. Multiple follow ups to our initial preprint appeared on ArXiv (Raileanu et al., 2020; Okada & Taniguchi, 2020), using similar techniques on other tasks, thus supporting the effectiveness and generality of data augmentation in RL. + +Continuous Control from Pixels There are a variety of methods addressing the sample-efficiency of RL algorithms that directly learn from pixels. The most prominent approaches for this can be classified into two groups, model-based and model-free methods. The model-based methods attempt to learn the system dynamics in order to acquire a compact latent representation of high-dimensional observations to later perform policy search (Hafner et al., 2018; Lee et al., 2019; Hafner et al., 2019). In contrast, the model-free methods either learn the latent representation indirectly by optimizing the RL objective (Barth-Maron et al., 2018; Abdolmaleki et al., 2018) or by employing auxiliary losses that provide additional supervision (Yarats et al., 2019; Srinivas et al., 2020; Sermanet et al., 2018; Dwibedi et al., 2018). Our approach is complementary to these methods and can be combined with them to improve performance. + +# 3 BACKGROUND + +Reinforcement Learning from Images We formulate image-based control as an infinite-horizon partially observable Markov decision process (POMDP) (Bellman, 1957; Kaelbling et al., 1998). An POMDP can be described as the tuple $( \mathcal { O } , \mathcal { A } , p , r , \gamma )$ , where $\mathcal { O }$ is the high-dimensional observation space (image pixels), $\mathcal { A }$ is the action space, the transition dynamics $p = P r ( o _ { t } ^ { \prime } | o _ { \leq t } , a _ { t } )$ capture the probability distribution over the next observation $o _ { t } ^ { \prime }$ given the history of previous observations $O { \le } t$ and current action $a _ { t }$ , $r : \mathcal { O } \times \mathcal { A } \to \mathbb { R }$ is the reward function that maps the current observation and action to a reward $r _ { t } = r ( o _ { \leq t } , a _ { t } )$ , and $\gamma \in [ 0 , 1 )$ is a discount factor. Per common practice (Mnih et al., 2013), throughout the paper the POMDP is converted into an MDP (Bellman, 1957) by stacking several consecutive image observations into a state $s _ { t } = \{ o _ { t } , o _ { t - 1 } , o _ { t - 2 } , . . . \}$ . For simplicity we redefine the transition dynamics $p = P r \big ( s _ { t } ^ { \prime } | s _ { t } , a _ { t } \big )$ and the reward function $r _ { t } \dot { = } r ( s _ { t } , a _ { t } )$ . We then aim to find a policy $\pi ( a _ { t } | s _ { t } )$ t that maximizes the cumulative discounted return $\begin{array} { r } { \mathbb { E } _ { \pi } [ \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r _ { t } | a _ { t } \sim } \end{array}$ $\pi ( \cdot | s _ { t } ) , s _ { t } ^ { \prime } \sim p ( \cdot | s _ { t } , a _ { t } ) , \dot { s } _ { 1 } \sim p ( \cdot ) ]$ . + +Soft Actor-Critic The Soft Actor-Critic (SAC) (Haarnoja et al., 2018) learns a state-action value function $Q _ { \theta }$ , a stochastic policy $\pi _ { \theta }$ and a temperature $\alpha$ to find an optimal policy for an MDP $( S , \mathcal { A } , p , r , \gamma )$ by optimizing a $\gamma$ -discounted maximum-entropy objective (Ziebart et al., 2008). $\theta$ is used generically to denote the parameters updated through training in each part of the model. + +Deep Q-learning DQN (Mnih et al., 2013) also learns a convolutional neural net to approximate Q-function over states and actions. The main difference is that DQN operates on discrete actions spaces, thus the policy can be directly inferred from Q-values. In practice, the standard version of DQN is frequently combined with a set of refinements that improve performance and training stability, commonly known as Rainbow (van Hasselt et al., 2015). For simplicity, the rest of the paper describes a generic actor-critic algorithm rather than DQN or SAC in particular. Further background on DQN and SAC can be found in Appendix A. + +# 4 SAMPLE EFFICIENT REINFORCEMENT LEARNING FROM PIXELS + +# 4.1 OPTIMALITY INVARIANT IMAGE TRANSFORMATIONS FOR Q FUNCTION + +We first introduce a general framework for regularizing the value function through transformations of the input state. For a given task, we define an optimality invariant state transformation $f : S \times \mathcal { T } S$ as a mapping that preserves the $Q$ -values + +$$ +Q ( s , a ) = Q ( f ( s , \nu ) , a ) { \mathrm { ~ f o r ~ a l l ~ } } s \in S , a \in { \mathcal { A } } { \mathrm { ~ a n d ~ } } \nu \in \mathcal { T } . +$$ + +where $\nu$ are the parameters of $f ( \cdot )$ , drawn from the set of all possible parameters $\tau$ . One example of such transformations are the random image translations successfully applied in the previous section. + +For every state, the transformations allow the generation of several surrogate states with the same $Q$ -values, thus providing a mechanism to reduce the variance of $Q$ -function estimation. In particular, for an arbitrary distribution of states $\mu ( \cdot )$ and policy $\pi$ , instead of using a single sample $s ^ { * } \sim \mu ( \cdot )$ , $a ^ { * } \sim \pi ( \cdot | s ^ { * } )$ estimation of the following expectation + +$$ +\begin{array} { r } { { \mathbb E } _ { s \sim \mu ( \cdot ) } \left[ Q ( s , a ) \right] \approx Q ( s ^ { * } , a ^ { * } ) } \end{array} +$$ + +we generate $K$ samples via random transformations and obtain an estimate with lower variance + +$$ +\mathbb { E } _ { \mathbf { \Phi } _ { a \sim \pi ( \cdot | s ) } } \left[ Q ( s , a ) \right] \approx \frac { 1 } { K } \sum _ { k = 1 } ^ { K } Q ( f ( s ^ { * } , \nu _ { k } ) , a _ { k } ) \mathrm { ~ w h e r e ~ } \nu _ { k } \in \mathcal { T } \mathrm { ~ a n d ~ } a _ { k } \sim \pi ( \cdot | f ( s ^ { * } , \nu _ { k } ) ) . +$$ + +This suggests two distinct ways to regularize $Q$ -function. First, we use the data augmentation to compute the target values for every transition tuple $( s _ { i } , a _ { i } , r _ { i } , s _ { i } ^ { \prime } )$ as + +$$ +y _ { i } = r _ { i } + \gamma \frac { 1 } { K } \sum _ { k = 1 } ^ { K } Q _ { \theta } \big ( f \big ( s _ { i } ^ { \prime } , \nu _ { i , k } ^ { \prime } \big ) , a _ { i , k } ^ { \prime } \big ) \mathrm { ~ w h e r e ~ } a _ { i , k } ^ { \prime } \sim \pi ( \cdot | f \big ( s _ { i } ^ { \prime } , \nu _ { i , k } ^ { \prime } \big ) ) +$$ + +where $\nu _ { i , k } ^ { \prime } \in \mathcal { T }$ corresponds to a transformation parameter of $s _ { i } ^ { \prime }$ . Then the Q-function is updated using these targets through an SGD update using learning rate $\lambda _ { \theta }$ + +$$ +\theta \theta - \lambda _ { \theta } \nabla _ { \theta } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( Q _ { \theta } ( f ( s _ { i } , \nu _ { i } ) , a _ { i } ) - y _ { i } ) ^ { 2 } . +$$ + +In tandem, we note that the same target from Equation (1) can be used for different augmentations of $s _ { i }$ , resulting in the second regularization approach + +$$ +\theta \gets \theta - \lambda _ { \theta } \nabla _ { \theta } \frac { 1 } { N M } \sum _ { i = 1 , m = 1 } ^ { N , M } ( Q _ { \theta } ( f ( s _ { i } , \nu _ { i , m } ) , a _ { i } ) - y _ { i } ) ^ { 2 } . +$$ + +When both regularization methods are used, $\nu _ { i , m }$ and $\nu _ { i , k } ^ { \prime }$ are drawn independently. + +# 4.2 PRACTICAL INSTANTIATION OF OPTIMALITY INVARIANT IMAGE TRANSFORMATION + +A range of successful image augmentation techniques have been developed in computer vision (Ciregan et al., 2012; Ciresan et al., 2011; Simard et al., 2003; Krizhevsky et al., 2012; Chen et al., 2020). These apply transformations to the input image for which the task labels are invariant, e.g. for object recognition tasks, image flips and rotations do not alter the semantic label. However, tasks in RL differ significantly from those in vision and in many cases the reward would not be preserved by these transformations. We examine image transformations from Chen et al. (2020) (random shifts, random cutouts, horizontal/vertical flips, rotations and intensity shifts) in Appendix E and conclude that random shifts strike a good balance between simplicity and performance, we therefore limit our choice of transformation function $f ( \cdot )$ to random shifts. + +We apply shifts to the images sampled from the replay buffer. For example, images from the DeepMind control suite used in our experiments are $8 4 \times 8 4$ . We pad each side by 4 pixels (by repeating boundary pixels) and then select a random $8 4 \times 8 4$ crop, yielding the original image shifted by $\pm 4$ pixels. This procedure is repeated every time an image is sampled from the replay buffer. + +# 4.3 OUR APPROACH: DATA-REGULARIZED Q (DRQ) + +Our approach, $\mathbf { D r Q }$ , is the union of the three separate regularization mechanisms introduced above: + +1. transformations of the input image (Section 4.2). +2. averaging the $Q$ target over K image transformations (Equation (1)). +3. averaging the $Q$ function itself over M image transformations (Equation (3)). + +Algorithm 1 details how they are incorporated into a generic pixel-based off-policy actor-critic algorithm. Note that if $[ \mathsf { K } { = } 1 , \mathsf { M } { = } 1 ]$ then $\mathbf { D r Q }$ reverts to image transformations alone, this makes applying $\mathbf { D r Q }$ to any model-free RL algorithm straightforward. + +For the experiments in this paper, we pair DrQ with SAC (Haarnoja et al., 2018) and DQN (Mnih et al., 2013), popular model-free algorithms for control in continuous and discrete action spaces respectively. We select image shifts as the class of image transformations $f$ , with $\nu \pm 4$ , as explained in Section 4.2. + +# 5 EXPERIMENTS + +# 5.1 ABLATION EXPERIMENT + +Figure 1 shows the effect of image shift augmentation applied to three tasks from the DeepMind control suite (Tassa et al., 2018). Figure 1a shows unmodified SAC (Haarnoja et al., 2018) parameterized with different image encoders, taken from: NatureDQN (Mnih et al., 2013), Dreamer (Hafner et al., 2019), Impala (Espeholt et al., 2018), SAC-AE (Yarats et al., 2019), and D4PG (Barth-Maron et al., 2018). The encoders vary significantly in their architecture and capacity, with parameter + +Algorithm 1 DrQ: Data-regularized Q applied to a generic off-policy actor critic algorithm. +Black: unmodified off-policy actor-critic. Orange: image transformation. +Green: target $Q$ augmentation. +Blue: $Q$ augmentation. + +Hyperparameters: Total number of environment steps $T$ , mini-batch size $N$ , learning rate $\lambda _ { \theta }$ target network update rate $\tau$ , image transformation $f$ , number of target $Q$ augmentations $K$ number of $Q$ augmentations $M$ . + +for each timestep $t = 1 . . T$ do + +$$ +\mathcal { D } \gets \mathcal { D } \cup ( s _ { t } , a _ { t } , r ( s _ { t } , a _ { t } ) , s _ { t } ^ { \prime } ) +$$ + +# end for + +$\{ \nu _ { i , m } | \nu _ { i , m } \sim \mathcal { U } ( \mathcal { T } ) , i = 1 . . N , m = 1 . . M \}$ $\begin{array} { r } { J _ { Q } ( \theta ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( Q _ { \theta } ( s _ { i } , a _ { i } ) - y _ { i } ) ^ { 2 } } \end{array}$ or $\begin{array} { r } { J _ { Q } ( \theta ) = \frac { 1 } { N M } \sum _ { i , m = 1 } ^ { N , M } ( Q _ { \theta } ( f ( s _ { i } , \nu _ { i , m } ) , a _ { i } ) - y _ { i } ) ^ { 2 } } \end{array}$ . Uniformly sample Q augmentations θ ← θ − λθ∇θJQ(θ) $\triangleright$ Update the critic $\theta ^ { \prime } ( 1 - \tau ) \theta ^ { \prime } + \tau \theta$ $\triangleright$ Update the critic target + +end procedure + +counts ranging from $2 2 0 \mathrm { k }$ to 2.4M. None of these train satisfactorily, with performance decreasing for the larger capacity models. Figure 1b shows SAC with the application of our random shifts transformation of the input images (i.e. just Section 4.2, not Q augmentation also). The results for all encoder architectures improve dramatically, suggesting that our method is general and can assist many different encoder architectures. To the best of our knowledge, this is the first successful demonstration of applying image augmentation on the standard benchmarks for continuous control. Furthermore, Figure 2 shows the full $\mathbf { D r Q }$ , with both image shifts and Q augmentation (Section 4.1), as well as ablated versions. Q augmentation provides additional consistent gain over image shift augmentation alone (full results are in Appendix F). + +# 5.2 DEEPMIND CONTROL SUITE EXPERIMENTS + +In this section we evaluate our algorithm $\mathbf { ( D r Q ) }$ on the two commonly used benchmarks based on the DeepMind control suite (Tassa et al., 2018), namely the PlaNet (Hafner et al., 2018) and Dreamer (Hafner et al., 2019) setups. Throughout these experiments all hyper-parameters of the algorithm are kept fixed: the actor and critic neural networks are trained using the Adam optimizer (Kingma & Ba, 2014) with default parameters and a mini-batch size of 512 1. For SAC, the soft target update rate $\tau$ is 0.01, initial temperature is 0.1, and target network and the actor updates are made every 2 critic updates (as in Yarats et al. (2019)). We use the image encoder architecture from SAC-AE (Yarats et al., 2019) and follow their training procedure. The full set of parameters can be found in Appendix B. Following Henderson et al. (2018), the models are trained using 10 different seeds; for every seed the mean episode returns are computed every 10000 environment steps, averaging over 10 episodes. All figures plot the mean performance over the 10 seeds, together with $\pm$ 1 standard deviation shading. We compare our $\mathbf { D r Q }$ approach to leading model-free and model-based approaches: PlaNet (Hafner et al., 2018), SAC-AE (Yarats et al., 2019), SLAC (Lee et al., 2019), CURL (Srinivas et al., 2020) and Dreamer (Hafner et al., 2019). The comparisons use the results provided by the authors of the corresponding papers. + +![](images/35c073a5e4788f323043f33a4dbb6e01475ff02ce5ddc7ce8afc73164d000317.jpg) + +![](images/48e9ad967dfa82b0a828a8a5eb98565bedce8de1f087eeb5eaf9086f5486c456.jpg) +Figure 1: The performance of SAC trained from pixels on the DeepMind control suite using image encoder networks of different capacity (network architectures taken from recent RL algorithms, with parameter count indicated). (a): unmodified SAC. Task performance can be seen to get worse as the capacity of the encoder increases. For Walker Walk (right), all architectures provide mediocre performance, demonstrating the inability of SAC to train directly from pixels on harder problems. (b): SAC combined with image augmentation in the form of random shifts. The task performance is now similar for all architectures, regardless of their capacity, which suggests the generality of our method. There is also a clear performance improvement relative to (a), particularly for the more challenging Walker Walk task. +Figure 2: Different combinations of our three regularization techniques on tasks from (Tassa et al., 2018) using SAC. Black: standard SAC. Blue: DrQ $[ \mathsf { K } { = } 1 , \mathsf { M } { = } 1 ]$ , SAC augmented with random shifts. Red: DrQ $[ \mathsf { K } { = } 2 , \mathsf { M } { = } 1 ]$ , random shifts $^ +$ Target Q augmentations. Purple: DrQ $[ \mathsf { K } { = } 2 , \mathsf { M } { = } 2 ]$ , random shifts $^ +$ Target $\mathbf { Q } + \mathbf { Q }$ augmentations. All three regularization methods correspond to Algorithm 1 with different K,M showing clear gains when both Target Q and Q augmentations are used. + +PlaNet Benchmark (Hafner et al., 2018) consists of six challenging control tasks from (Tassa et al., 2018) with different traits. The benchmark specifies a different action-repeat hyper-parameter for each of the six tasks2. Following common practice (Hafner et al., 2018; Lee et al., 2019; Yarats et al., + +![](images/310af58b4e79339c5369ae180225441f2653d233cfa703f98b317a7c8daf3ca1.jpg) +Figure 3: The PlaNet benchmark. Our algorithm $\mathbf { D r Q }$ $[ \mathsf { K } = 2 , \mathsf { M } = 2 ]$ ) outperforms the other methods and demonstrates the state-of-the-art performance. Furthermore, on several tasks $\mathbf { D r Q }$ is able to match the upper-bound performance of SAC trained directly on internal state, rather than images. Finally, our algorithm not only shows improved sample-efficiency relative to other approaches, but is also faster in terms of wall clock time. + +2019; Mnih et al., 2013), we report the performance using true environment steps, thus are invariant to the action-repeat hyper-parameter. Aside from action-repeat, all other hyper-parameters of our algorithm are fixed across the six tasks, using the values previously detailed. + +Figure 3 compares DrQ $\mathrm { K } { = } 2 , \mathrm { M } { = } 2$ ] to PlaNet (Hafner et al., 2018), SAC-AE (Yarats et al., 2019), CURL (Srinivas et al., 2020), SLAC (Lee et al., 2019), and an upper bound performance provided by SAC (Haarnoja et al., 2018) that directly learns from internal states. We use the version of SLAC that performs one gradient update per an environment step to ensure a fair comparison to other approaches. $\mathbf { D r Q }$ achieves state-of-the-art performance on this benchmark on all the tasks, despite being much simpler than other methods. Furthermore, since $\mathbf { D r Q }$ does not learn a model (Hafner et al., 2018; Lee et al., 2019) or any auxiliary tasks (Srinivas et al., 2020), the wall clock time also compares favorably to the other methods. + +In Table 1 we also compare performance given at a fixed number of environment interactions (e.g. $1 0 0 \mathbf k$ and 500k). Furthermore, in Appendix G we demonstrate that $\mathbf { D r Q }$ is robust to significant changes in hyper-parameter settings. + +Dreamer Benchmark is a more extensive testbed that was introduced in Dreamer (Hafner et al., 2019), featuring a diverse set of tasks from the DeepMind control suite. Tasks involving sparse reward were excluded (e.g. Acrobot and Quadruped) since they require modification of SAC to incorporate multi-step returns (Barth-Maron et al., 2018), which is beyond the scope of this work. We evaluate on the remaining 15 tasks, fixing the action-repeat hyper-parameter to 2 as in Hafner et al. (2019). + +We compare DrQ $[ { \cal K } = 2 , { \cal M } = 2 ]$ ] to Dreamer (Hafner et al., 2019) and the upper-bound performance of SAC (Haarnoja et al., 2018) from states3. Again, we keep all the hyper-parameters of our algorithm fixed across all the tasks. In Figure 4, DrQ demonstrates the state-of-the-art results by collectively outperforming Dreamer (Hafner et al., 2019), although Dreamer is superior on 3 of the 15 tasks (Walker Run, Cartpole Swingup Sparse and Pendulum Swingup). On many tasks $\mathbf { D r Q }$ approaches the upper-bound performance of SAC (Haarnoja et al., 2018) trained directly on states. + +Table 1: The PlaNet benchmark at $1 0 0 \mathrm { k }$ and $5 0 0 \mathrm { k }$ environment steps. Our method $\mathbf { ( D r Q }$ $[ \mathsf { K } { = } 2 , \mathsf { M } { = } 2 ]$ ) outperforms other approaches in both the data-efficient (100k) and asymptotic performance (500k) regimes. Random shifts only version (e.g. $\mathbf { D r Q }$ $[ \mathsf { K } = 1 , \mathsf { M } = 1 ]$ ) has a competitive performance but is consistently inferior to DrQ $[ { \cal K } = 2 , { \cal M } = 2 ]$ , particularly for $1 0 0 \mathrm { k }$ steps. We emphasize, that both versions of DrQ use exactly the same number of interactions with both the environment and replay buffer. Note that $\mathbf { D r Q }$ $[ \mathsf { K } { = } 1 , \mathsf { M } { = } 1 ]$ ] is almost identical to RAD (Laskin et al., 2020), modulo some hyper-parameter differences. + +
500k step scoresDrQ[K=2,M=2]DrQ[K=1,M=1]CURLPlaNetSAC-AESLACSAC State
Finger Spin938±103913±151874±151718±40914±107771±203927±43
Cartpole Swingup868±10845±39861±30787±46730±152-870±7
Reacher Easy942±71857±120904±94588±471601±135975±5
Cheetah Run660±96460±59500±91568±21544±50629±74772±60
Walker Walk921±45897±47906±56478±164858±82865±97964±8
Ball In Cup Catch963±9961±12958±13939±43810±121959±4979±6
100k step scores
Finger Spin901±104744±144779±108560±77747±130680±130672±76
Cartpole Swingup759±92537±119592±170563±73276±38-812±45
Reacher Easy601±213451±210517±11382±174225±164=919±123
Cheetah Run344±67250±58307±48252±173240±38391±47228±95
Walker Walk612±164501±68344±132221±43395±58428±74604±317
Ball In Cup Catch913±53667±146772±241710±217338±196607±173957±26
+ +![](images/f933076d7387bc93e88ccad71021979f8f57380c16dde4d934d1d22a5258b5d4.jpg) +Figure 4: The Dreamer benchmark. Our method (DrQ $[ { \bf K } { = } 2 , { \bf M } { = } 2 ]$ ) again demonstrates superior performance over Dreamer on 12 out 15 selected tasks. In many cases it also reaches the upper-bound performance of SAC that learns directly from states. + +# 5.3 ATARI 100K EXPERIMENTS + +We evaluate $\mathbf { D r Q }$ $[ \mathsf { K } { = } 1 , \mathsf { M } { = } 1 ]$ on the Atari 100k benchmark (Kaiser et al., 2019) – a sampleconstrained evaluation for discrete control algorithms. The underlying RL approach to which $\mathbf { D r Q }$ is applied is a DQN, combined with double Q-learning (van Hasselt et al., 2015), n-step returns (Mnih et al., 2016), and dueling critic architecture (Wang et al., 2015). As per common practice (Kaiser et al., 2019; van Hasselt et al., 2019a), we evaluate our agent for $1 2 5 \mathrm { k }$ environment steps at the end of training and average its performance over 5 random seeds. Figure 5 shows the median humannormalized episode returns performance (as in Mnih et al. (2013)) of the underlying model, which we refer to as Efficient DQN, in pink. When DrQ is added there is a significant increase in performance (cyan), surpassing OTRainbow (Kielak, 2020) and Data Efficient Rainbow (van Hasselt et al., 2019a). DrQ is also superior to CURL (Srinivas et al., 2020) that uses an auxiliary loss built on top of a hybrid between OTRainbow and Efficient rainbow. DrQ combined with Efficient DQN thus achieves state-of-the-art performance, despite being significantly simpler than the other approaches. The experimental setup and full results are detailed in Appendix C and Appendix D respectively. + +![](images/fbcc51e4af935e2be2c7e57346f73897201298d3eb9034b6668acad9863e7880.jpg) +Figure 5: The Atari $1 0 0 \mathrm { k }$ benchmark. Compared to a set of leading baselines, our method $\mathbf { ( D r Q }$ $[ \mathsf { K } = 1 , \mathsf { M } = 1 ]$ , combined with Efficient DQN) achieves the state-of-the-art performance, despite being considerably simpler. Note the large improvement that results from adding DrQ to Efficient DQN (pink vs cyan). By contrast, the gains from CURL, that utilizes tricks from both Data Efficient Rainbow and OTRainbow, are more modest over the underlying RL methods. + +# 6 CONCLUSION + +We have introduced a regularization technique, based on image shifts and Q-function augmentation, that significantly improves the performance of model-free RL algorithms trained directly from images. In contrast to the concurrent work of Laskin et al. (2020), which is a special case of $\mathbf { D r Q }$ , our method exploits the MDP structure of the problem, demonstrating gains over image augmentations alone. Our method is easy to implement and adds a negligible computational burden. We compared our method to state-of-the-art approaches on the DeepMind control suite, outperforming them on the majority of tasks and closing the gap with state-based training. On the Atari $1 0 0 \mathrm { k }$ benchmark DrQ outperforms other SOTA methods in the median metric. To the best of our knowledge, this is the first convincing demonstration of the utility of data augmentation on these standard benchmarks. Furthermore, we demonstrate the method to be robust to the choice of hyper-parameters. + +# 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. + +Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, OpenAI Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In Advances in neural information processing systems, pp. 5048–5058, 2017. + +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. arXiv e-prints, 2016. + +Gabriel Barth-Maron, Matthew W. Hoffman, David Budden, Will Dabney, Dan Horgan, Dhruva TB, Alistair Muldal, Nicolas Heess, and Timothy Lillicrap. Distributional policy gradients. In International Conference on Learning Representations, 2018. + +S. Becker and G. E. Hinton. Self-organizing neural network that discovers surfaces in random-dot stereograms. Nature, 1992. + +Richard Bellman. A markovian decision process. Indiana Univ. Math. J., 1957. + +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020. + +Dan Ciregan, Ueli Meier, and Jurgen Schmidhuber. Multi-column deep neural networks for image classification. In 2012 IEEE conference on computer vision and pattern recognition, pp. 3642–3649, 2012. + +Dan C Ciresan, Ueli Meier, Jonathan Masci, Luca M Gambardella, and Jurgen Schmidhuber. Highperformance neural networks for visual object classification. arXiv preprint arXiv:1102.0183, 2011. + +Karl Cobbe, Oleg Klimov, Chris Hesse, Taehoon Kim, and John Schulman. Quantifying generalization in reinforcement learning. arXiv preprint arXiv:1812.02341, 2018. + +Ronan Collobert, Jason Weston, Leon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel Kuksa. Natural language processing (almost) from scratch. Journal of machine learning research, 2011. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. + +Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017. + +Alexey Dosovitskiy, Philipp Fischer, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with exemplar convolutional neural networks. TPAMI, 2016. + +Debidatta Dwibedi, Jonathan Tompson, Corey Lynch, and Pierre Sermanet. Learning actionable representations from visual observations. CoRR, 2018. + +Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018. + +Scott Fujimoto, Herke van Hoof, and David Meger. Addressing function approximation error in actor-critic methods. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018, 2018. + +Tuomas Haarnoja, Aurick Zhou, Kristian Hartikainen, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, et al. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018. + +Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. arXiv preprint arXiv:1811.04551, 2018. + +Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. arXiv preprint arXiv:1912.01603, 2019. + +Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. arXiv preprint arXiv:1911.05722, 2019. + +Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. Thirty-Second AAAI Conference On Artificial Intelligence (AAAI), 2018. + +Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012. + +Max Jaderberg, Volodymyr Mnih, Wojciech Czarnecki, Tom Schaul, Joel Z. Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. International Conference on Learning Representations, 2017. + +Leslie Pack Kaelbling, Michael L Littman, and Anthony R Cassandra. Planning and acting in partially observable stochastic domains. Artificial intelligence, 1998. + +Lukasz Kaiser, Mohammad Babaeizadeh, Piotr Milos, Blazej Osinski, Roy H. Campbell, Konrad Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, Ryan Sepassi, George Tucker, and Henryk Michalewski. Model-based reinforcement learning for atari. arXiv preprint arXiv:1903.00374, 2019. + +Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. Qt-opt: Scalable deep reinforcement learning for vision-based robotic manipulation. arXiv preprint arXiv:1806.10293, 2018. + +Kacper Piotr Kielak. Do recent advancements in model-based deep reinforcement learning really improve data efficiency? openreview, 2020. URL https://openreview.net/forum? id $=$ Bke9u1HFwB. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in neural information processing systems, pp. 3581–3589, 2014. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, 2012. + +Michael Laskin, Kimin Lee, Adam Stooke, Lerrel Pinto, Pieter Abbeel, and Aravind Srinivas. Reinforcement learning with augmented data, 2020. + +Yann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1989. + +A. X. Lee, A. Nagabandi, P. Abbeel, and S. Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. arXiv e-prints, 2019. + +Sergey Levine, Peter Pastor, Alex Krizhevsky, Julian Ibarz, and Deirdre Quillen. Learning handeye coordination for robotic grasping with deep learning and large-scale data collection. The International Journal of Robotics Research, 37(4-5):421–436, 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. CoRR, 2015. + +Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. arXiv:1912.01991, 2019. + +Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv e-prints, 2013. + +Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy P. Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. CoRR, 2016. + +Masashi Okada and Tadahiro Taniguchi. Dreaming: Model-based reinforcement learning by latent imagination without reconstruction. arXiv preprint arXiv:2007.14535, 2020. + +Roberta Raileanu, Max Goldstein, Denis Yarats, Ilya Kostrikov, and Rob Fergus. Automatic data augmentation for generalization in deep reinforcement learning. 2020. + +Edgar Riba, Dmytro Mishkin, Daniel Ponsa, Ethan Rublee, and Gary Bradski. Kornia: an open source differentiable computer vision library for pytorch. In The IEEE Winter Conference on Applications of Computer Vision, pp. 3674–3683, 2020. + +Andrew M. Saxe, James L. McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. arXiv e-prints, 2013. + +Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, Sergey Levine, and Google Brain. Time-contrastive networks: Self-supervised learning from video. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1134–1141. IEEE, 2018. + +Patrice Y Simard, David Steinkraus, John C Platt, et al. Best practices for convolutional neural networks applied to visual document analysis. In Icdar, 2003. + +Aravind Srinivas, Michael Laskin, and Pieter Abbeel. Curl: Contrastive unsupervised representations for reinforcement learning. arXiv preprint arXiv:2004.04136, 2020. + +Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018. + +Hado van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. arXiv e-prints, 2015. + +Hado van Hasselt, Matteo Hessel, and John Aslanides. When to use parametric models in reinforce ment learning? arXiv preprint arXiv:1906.05243, 2019a. + +Hado P van Hasselt, Matteo Hessel, and John Aslanides. When to use parametric models in reinforcement learning? In Advances in Neural Information Processing Systems, 2019b. + +Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Van Hasselt, Marc Lanctot, and Nando De Freitas. Dueling network architectures for deep reinforcement learning. arXiv preprint arXiv:1511.06581, 2015. + +Denis Yarats and Ilya Kostrikov. Soft actor-critic (sac) implementation in pytorch. https:// github.com/denisyarats/pytorch_sac, 2020. + +Denis Yarats, Amy Zhang, Ilya Kostrikov, Brandon Amos, Joelle Pineau, and Rob Fergus. Improving sample efficiency in model-free reinforcement learning from images. arXiv preprint arXiv:1910.01741, 2019. + +Brian D. Ziebart, Andrew Maas, J. Andrew Bagnell, and Anind K. Dey. Maximum entropy inverse reinforcement learning. In Proceedings of the 23rd National Conference on Artificial Intelligence - Volume 3, 2008. + +# APPENDIX + +# A EXTENDED BACKGROUND + +Reinforcement Learning from Images We formulate image-based control as an infinite-horizon partially observable Markov decision process (POMDP) (Bellman, 1957; Kaelbling et al., 1998). An POMDP can be described as the tuple $( \mathcal { O } , \mathcal { A } , p , r , \gamma )$ , where $\mathcal { O }$ is the high-dimensional observation space (image pixels), $\mathcal { A }$ is the action space, the transition dynamics $p = P r ( o _ { t } ^ { \prime } | o _ { \leq t } , a _ { t } )$ capture the probability distribution over the next observation $o _ { t } ^ { \prime }$ given the history of previous observations $O { \le } t$ and current action $a _ { t }$ , $r : \mathcal { O } \times \mathcal { A } \to \mathbb { R }$ is the reward function that maps the current observation and action to a reward $r _ { t } = r ( o _ { \leq t } , a _ { t } )$ , and $\gamma \in [ 0 , 1 )$ is a discount factor. Per common practice (Mnih et al., 2013), throughout the paper the POMDP is converted into an MDP (Bellman, 1957) by stacking several consecutive image observations into a state $s _ { t } = \{ o _ { t } , o _ { t - 1 } , o _ { t - 2 } , . . . \}$ . For simplicity we redefine the transition dynamics $p = P r \big ( s _ { t } ^ { \prime } | s _ { t } , a _ { t } \big )$ and the reward function $r _ { t } \dot { = } r ( s _ { t } , a _ { t } )$ . We then aim to find a policy $\pi ( a _ { t } | s _ { t } )$ t that maximizes the cumulative discounted return $\begin{array} { r } { \mathbb { E } _ { \pi } [ \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r _ { t } | a _ { t } \sim } \end{array}$ $\pi ( \cdot | s _ { t } ) , s _ { t } ^ { \prime } \sim \bar { p } ( \cdot | s _ { t } , a _ { t } ) , \dot { s } _ { 1 } \sim p ( \cdot ) \mathrm { ~ . ~ }$ . + +Soft Actor-Critic The Soft Actor-Critic (SAC) (Haarnoja et al., 2018) learns a state-action value function $Q _ { \theta }$ , a stochastic policy $\pi _ { \theta }$ and a temperature $\alpha$ to find an optimal policy for an MDP $( S , \mathcal { A } , p , r , \gamma )$ by optimizing a $\gamma$ -discounted maximum-entropy objective (Ziebart et al., 2008). $\theta$ is used generically to denote the parameters updated through training in each part of the model. The actor policy $\pi _ { \boldsymbol { \theta } } \big ( a _ { t } | \boldsymbol { s } _ { t } \big )$ is a parametric tanh-Gaussian that given $s _ { t }$ samples $a _ { t } = \operatorname { t a n h } ( \mu _ { \theta } ( s _ { t } ) + \sigma _ { \theta } ( s _ { t } ) \epsilon )$ , where $\epsilon \sim \mathcal { N } ( 0 , 1 )$ and $\mu _ { \theta }$ and $\sigma _ { \theta }$ are parametric mean and standard deviation. + +The policy evaluation step learns the critic $Q _ { \theta } ( s _ { t } , a _ { t } )$ network by optimizing a single-step of the soft Bellman residual + +$$ +\begin{array} { r l } & { J _ { Q } ( \mathcal { D } ) = \mathbb { E } _ { ( s _ { t } , a _ { t } , s _ { t } ^ { \prime } ) \sim \mathcal { D } } [ ( Q _ { \theta } ( s _ { t } , a _ { t } ) - y _ { t } ) ^ { 2 } ] } \\ & { \qquad a _ { t } ^ { \prime } \sim \pi ( \cdot | s _ { t } ^ { \prime } ) } \\ & { y _ { t } = r ( s _ { t } , a _ { t } ) + \gamma [ Q _ { \theta ^ { \prime } } ( s _ { t } ^ { \prime } , a _ { t } ^ { \prime } ) - \alpha \log \pi _ { \theta } ( a _ { t } ^ { \prime } | s _ { t } ^ { \prime } ) ] , } \end{array} +$$ + +where $\mathcal { D }$ is a replay buffer of transitions, $\theta ^ { \prime }$ is an exponential moving average of the weights as done in (Lillicrap et al., 2015). SAC uses clipped double-Q learning (van Hasselt et al., 2015; Fujimoto et al., 2018), which we omit from our notation for simplicity but employ in practice. + +The policy improvement step then fits the actor policy $\pi _ { \boldsymbol { \theta } } ( a _ { t } | \boldsymbol { s } _ { t } )$ network by optimizing the objective + +$$ +J _ { \pi } ( \mathcal { D } ) = \mathbb { E } _ { s _ { t } \sim \mathcal { D } } [ D _ { \mathrm { K L } } ( \pi _ { \theta } ( \cdot | s _ { t } ) | | \exp \{ \frac { 1 } { \alpha } Q _ { \theta } ( s _ { t } , \cdot ) \} ) ] . +$$ + +Finally, the temperature $\alpha$ is learned with the loss + +$$ +J _ { \alpha } ( \mathcal { D } ) = \mathbb { E } _ { \underset { a _ { t } \sim \pi _ { \theta } ( \cdot | s _ { t } ) } { s _ { t } \sim \mathcal { D } } } [ - \alpha \log \pi _ { \theta } ( a _ { t } | s _ { t } ) - \alpha \bar { \mathcal { H } } ] , +$$ + +where $\bar { \mathcal { H } } \in \mathbb { R }$ is the target entropy hyper-parameter that the policy tries to match, which in practice is usually set to $\bar { \mathcal { H } } = - | \bar { \mathcal { A } } |$ . + +Deep Q-learning DQN (Mnih et al., 2013) also learns a convolutional neural net to approximate Q-function over states and actions. The main difference is that DQN operates on discrete actions spaces, thus the policy can be directly inferred from Q-values. The parameters of DQN are updated by optimizing the squared residual error + +$$ +\begin{array} { r l } & { J _ { Q } ( \mathcal { D } ) = \mathbb { E } _ { ( s _ { t } , a _ { t } , s _ { t } ^ { \prime } ) \sim \mathcal { D } } [ ( Q _ { \theta } ( s _ { t } , a _ { t } ) - y _ { t } ) ^ { 2 } ] } \\ & { \qquad y _ { t } = r ( s _ { t } , a _ { t } ) + \gamma \underset { a ^ { \prime } } { \operatorname* { m a x } } Q _ { \theta ^ { \prime } } ( s _ { t } ^ { \prime } , a ^ { \prime } ) . } \end{array} +$$ + +In practice, the standard version of DQN is frequently combined with a set of tricks that improve performance and training stability, wildly known as Rainbow (van Hasselt et al., 2015). + +# B THE DEEPMIND CONTROL SUITE EXPERIMENTS SETUP + +Our PyTorch SAC (Haarnoja et al., 2018) implementation is based off of Yarats & Kostrikov (2020). + +# B.1 ACTOR AND CRITIC NETWORKS + +We employ clipped double Q-learning (van Hasselt et al., 2015; Fujimoto et al., 2018) for the critic, where each $Q$ -function is parametrized as a 3-layer MLP with ReLU activations after each layer except of the last. The actor is also a 3-layer MLP with ReLUs that outputs mean and covariance for the diagonal Gaussian that represents the policy. The hidden dimension is set to 1024 for both the critic and actor. + +# B.2 ENCODER NETWORK + +We employ an encoder architecture from Yarats et al. (2019). This encoder consists of four convolutional layers with $3 \times 3$ kernels and 32 channels. The ReLU activation is applied after each conv layer. We use stride to 1 everywhere, except of the first conv layer, which has stride 2. The output of the convnet is feed into a single fully-connected layer normalized by LayerNorm (Ba et al., 2016). Finally, we apply tanh nonlinearity to the 50 dimensional output of the fully-connected layer. We initialize the weight matrix of fully-connected and convolutional layers with the orthogonal initialization (Saxe et al., 2013) and set the bias to be zero. + +The actor and critic networks both have separate encoders, although we share the weights of the conv layers between them. Furthermore, only the critic optimizer is allowed to update these weights (e.g. we stop the gradients from the actor before they propagate to the shared conv layers). + +# B.3 TRAINING AND EVALUATION SETUP + +Our agent first collects 1000 seed observations using a random policy. The further training observations are collected by sampling actions from the current policy. We perform one training update every time we receive a new observation. In cases where we use action repeat, the number of training observations is only a fraction of the environment steps (e.g. a 1000 steps episode at action repeat 4 will only results into 250 training observations). We evaluate our agent every 10000 true environment steps by computing the average episode return over 10 evaluation episodes. During evaluation we take the mean policy action instead of sampling. + +# B.4 PLANET AND DREAMER BENCHMARKS + +We consider two evaluation setups that were introduced in PlaNet (Hafner et al., 2018) and Dreamer (Hafner et al., 2019), both using tasks from the DeepMind control suite (Tassa et al., 2018). The PlaNet benchmark consists of six tasks of various traits. Importantly, the benchmark proposed to use a different action repeat hyper-parameter for each task, which we summarize in Table 2. + +The Dreamer benchmark considers an extended set of tasks, which makes it more difficult that the PlaNet setup. Additionally, this benchmark requires to use the same set hyper-parameters for each task, including action repeat (set to 2), which further increases the difficulty. + +Table 2: The action repeat hyper-parameter used for each task in the PlaNet benchmark. + +
Task nameAction repeat
Cartpole Swingup8
Reacher Easy4
Cheetah Run4
Finger Spin2
Ball In Cup Catch4
Walker Walk2
+ +# B.5 PIXELS PREPROCESSING + +We construct an observational input as an 3-stack of consecutive frames (Mnih et al., 2013), where each frame is a RGB rendering of size $8 4 \times 8 4$ from the 0th camera. We then divide each pixel by 255 to scale it down to [0, 1] range. + +# B.6 OTHER HYPER PARAMETERS + +Due to computational constraints for all the continuous control ablation experiments in the main paper and appendix we use a minibatch size of 128, while for the main results we use minibatch of size 512. In Table 3 we provide a comprehensive overview of all the other hyper-parameters. + +Table 3: An overview of used hyper-parameters in the DeepMind control suite experiments. + +
Parameter Replay buffer capacitySetting 100000
Seed steps Ablations minibatch size Main results minibatch size Discount y Optimizer1000 128 512 0.99
Learning rate Critic target update frequency Critic Q-function soft-update rate T Actor update frequency Actor log stddev boundsAdam 10-3 2 0.01 2 [-10,2]
+ +# C THE ATARI 100K EXPERIMENTS SETUP + +For ease of reproducibility in Table 4 we report the hyper-parameter settings used in the Atari $1 0 0 \mathrm { k }$ experiments. We largely reuse the hyper-parameters from OTRainbow (Kielak, 2020), but adapt them for DQN (Mnih et al., 2013). Per common practise, we average performance of our agent over 5 random seeds. The evaluation is done for $1 2 5 \mathrm { k }$ environment steps at the end of training for 100k environment steps. + +Table 4: A complete overview of hyper parameters used in the Atari $1 0 0 \mathrm { k }$ experiments. + +
Parameter Data augmentationSetting Random shifts and Intensity
Grey-scaling Observation down-sampling Frames stacked Action repetitions Reward clipping Terminal on loss of life Max frames per episode Update Dueling Target network: update period Discount factor Minibatch size Optimizer Optimizer: learning rate Optimizer: β1 Optimizer: β2 Optimizer: ∈ Max gradient norm Training steps Evaluation steps Min replay size for sampling Memory size Replay period every Multi-step return length Q network:channels Q network: filter size Q network: stride Q network: hidden unitsTrue 84×84 4 4 [-1,1] True 108k Double Q True 1 0.99 32 Adam 0.0001 0.9 0.999 0.00015 10 100k 125k 1600 Unbounded 1 step 10 32,64,64 8×8,4×4,3×3 4,2,1
+ +# D FULL ATARI 100K RESULTS + +Besides reporting in Figure 5 median human-normalized episode returns over the 26 Atari games used in (Kaiser et al., 2019), we also provide the mean episode return for each individual game in Table 5. + +Table 5: Mean episode returns on each of 26 Atari games from the setup in Kaiser et al. (2019). The results are recorded at the end of training and averaged across 5 random seeds (the CURL’s results are averaged over 3 seeds as reported in Srinivas et al. (2020)). On each game we mark as bold the highest score. Our method demonstrates better overall performance (as reported in Figure 5). + +
GameRainbowSimPLeOTRainbowEff. RainbowOT/Eff.Rainbow +CURLEff. DQNEff. DQN +DrQ (Ours)
Alien318.7616.9824.7739.91148.2558.1702.5
Amidar32.588.082.8188.6232.363.7100.2
Assault231.0527.2351.9431.2543.7589.5490.3
Asterix243.61128.3628.5470.8524.3341.9577.9
BankHeist15.634.2182.151.0193.774.0205.3
BattleZone2360.05184.44060.610124.611208.04760.86240.0
Boxing-24.89.12.50.24.8-1.85.1
Breakout1.216.49.81.918.27.314.3
ChopperCommand120.01246.91033.3861.81198.0624.4870.1
CrazyClimber2254.562583.621327.816185.327805.65430.620072.2
DemonAttack163.6208.1711.8508.0834.0403.51086.0
Freeway0.020.325.027.927.93.720.0
Frostbite60.2254.7231.6866.8924.0202.9889.9
Gopher431.2771.0778.0349.5801.4320.8678.0
Hero487.02656.66458.86857.06235.12200.14083.7
Jamesbond47.4125.3112.3301.6400.1133.2330.3
Kangaroo0.0323.1605.4779.3345.3448.61282.6
Krull1468.04539.93277.92851.53833.62999.04163.0
KungFuMaster0.017257.25722.214346.114280.02020.97649.0
MsPacman67.01480.0941.91204.11492.8872.01015.9
Pong-20.612.81.3-19.32.1-19.4-17.1
PrivateEye0.058.3100.097.8105.2351.3-50.4
Qbert123.51288.8509.31152.91225.6627.5769.1
RoadRunner1588.55640.62696.79600.06786.71491.98296.3
Seaquest131.7683.3286.9354.1408.0240.1299.4
UpNDown504.63350.32847.62877.42735.22901.73134.8
Median human-normalised episode returns0.0200.1350.2080.1470.2400.0940.270
+ +# E IMAGE AUGMENTATIONS ABLATION + +Following (Chen et al., 2020), we evaluate popular image augmentation techniques, namely random shifts, cutouts, vertical and horizontal flips, random rotations and imagewise intensity jittering. Below, we provide a comprehensive overview of each augmentation. Furthermore, we examine effectiveness of these techniques in Figure 6. + +Random Shift We bring our attention to random shifts that are commonly used to regularize neural networks trained on small images (Becker & Hinton, 1992; Simard et al., 2003; LeCun et al., 1989; Ciresan et al., 2011; Ciregan et al., 2012). In our implementation of this method images of size $8 4 \times 8 4$ are padded each side by 4 pixels (by repeating boundary pixels) and then randomly cropped back to the original $8 4 \times 8 4$ size. + +Cutout Cutouts introduced in DeVries & Taylor (2017) represent a generalization of Dropout (Hinton et al., 2012). Instead of masking individual pixels cutouts mask square regions. Since image pixels can be highly correlated, this technique is proven to improve training of neural networks. + +Horizontal/Vertical Flip This technique simply flips an image either horizontally or vertically with probability 0.1. + +Rotate Here, an image is rotated by $r$ degrees, where $r$ is uniformly sampled from $[ - 5 , - 5 ]$ + +Intensity Each $N \times C \times 8 4 \times 8 4$ image tensor is multiplied by a single scalar $s$ , which is computed as $s = \mu + \sigma \cdot \mathrm { c l i p } ( r , - 2 , 2 )$ , where $r \sim \mathcal { N } ( 0 , 1 )$ . For our experiments we use $\mu = 1 . 0$ and $\sigma = 0 . 1$ + +![](images/9053fd74cd643c1d6e7fbbb037032e8c32f7d54efc0baae648f60b58ea8a2788.jpg) +Figure 6: Various image augmentations have different effect on the agent’s performance. Overall, we conclude that using image augmentations helps to fight overfitting. Moreover, we notice that random shifts proven to be the most effective technique for tasks from the DeepMind control suite. + +Implementation Finally, we provide Python-like implementation for the aforementioned augmentations powered by Kornia (Riba et al., 2020). + +import torch import torch.nn as nn import kornia.augmentation as aug + +random_shift $=$ nn.Sequential(nn.ReplicationPad2d(4),aug.RandomCrop((84, 84))) + +cutout $=$ aug.RandomErasing( $\mathrm { . p } { = } 0 \cdot 5$ ) + +h_flip $=$ aug.RandomHorizontalFlip $\mathrm { \cdot p = 0 ~ . ~ }$ 1) + +v_flip $=$ aug.RandomVerticalFlip( $\mathrm { . p = 0 . 1 }$ ) + +rotate $=$ aug.RandomRotation(degree $\mathtt { S } = 5 \mathtt { . } 0$ ) + +intensity $=$ Intensity(scale ${ \tt a } = 0$ .1) + +class Intensity(nn.Module): def __init__(self, scale): super().__init__() self.scale $\qquad = \quad \ S \subset$ ale + +def forward(self, x): $\qquad \pm \quad =$ torch.randn((x.size(0), 1, 1, 1), device $= \times$ .device) noise $= \ 1 . 0 \mathrm { ~ \Omega ~ } +$ (self.scale $\star$ r.clamp(-2.0, 2.0)) return x $\star$ noise + +# F K AND M HYPER-PARAMETERS ABLATION + +We further ablate the K,M hyper-parameters from Algorithm 1 to understand their effect on performance. In Figure 7 we observe that increase values of K,M improves the agent’s performance. We choose to use the $[ { \cal K } = 2 , { \cal M } = 2 ]$ parametrization as it strikes a good balance between performance and computational demands. + +![](images/a14dbf1be0cbfbaf553d5b0ddd7d8b09fbdc7d1c0922d93a33002addc3f166f9.jpg) +Figure 7: Increasing values of K,M hyper-parameters generally correlates positively with the agent’s performance, especially on the harder tasks, such as Cheetah Run. + +# G ROBUSTNESS INVESTIGATION + +To demonstrate the robustness of our approach (Henderson et al., 2018), we perform a comprehensive study on the effect different hyper-parameter choices have on performance. A review of prior work (Hafner et al., 2018; 2019; Lee et al., 2019; Srinivas et al., 2020) shows consistent values for discount $\gamma = 0 . 9 9$ and target update rate $\tau = 0 . 0 1$ parameters, but variability on network architectures, mini-batch sizes, learning rates. Since our method is based on SAC (Haarnoja et al., 2018), we also check whether the initial value of the temperature is important, as it plays a crucial role in the initial phase of exploration. We omit search over network architectures since Figure 1b shows our method to be robust to the exact choice. We thus focus on three hyper-parameters: mini-batch size, learning rate, and initial temperature. + +Due to computational demands, experiments are restricted to a subset of tasks from Tassa et al. (2018): Walker Walk, Cartpole Swingup, and Finger Spin. These were selected to be diverse, requiring different behaviors including locomotion and goal reaching. A grid search is performed over minibatch sizes $\{ 1 2 8 , 2 5 6 , 5 1 2 \}$ , learning rates $\{ 0 . 0 0 0 1 , 0 . 0 0 0 5 , 0 . 0 0 1 , 0 . 0 0 5 \}$ , and initial temperatures $\{ 0 . 0 0 5 , 0 . 0 1 , 0 . 0 5 , 0 . 1 \}$ . We follow the experimental setup from Appendix B, except that only 3 seeds are used due to the computation limitations, but since variance is low the results are representative. + +![](images/dc3d860e8a9345e3a2ff263f3cccf54250a78df72cda9340f303663e3249d1ed.jpg) +Figure 8: A robustness study of our algorithm $\mathbf { ( D r Q ) }$ to changes in mini-batch size, learning rate, and initial temperature hyper-parameters on three different tasks from (Tassa et al., 2018). Each row corresponds to a different mini-batch size. The low variance of the curves and heat-maps shows DrQ to be generally robust to exact hyper-parameter settings. + +Figure 8 shows performance curves for each configuration as well as a heat map over the mean performance of the final evaluation episodes, similar to Mnih et al. (2016). Our method demonstrates good stability and is largely invariant to the studied hyper-parameters. We emphasize that for simplicity the experiments in Section 5 use the default learning rate of Adam (Kingma & Ba, 2014) (0.001), even though it is not always optimal. + +# H IMPROVED DATA-EFFICIENT REINFORCEMENT LEARNING FROM PIXELS + +Our method allows to generate many various transformations from a training observation due to the data augmentation strategy. Thus, we further investigate whether performing more training updates per an environment step can lead to even better sample-efficiency. Following van Hasselt et al. (2019b) we compare a single update with a mini-batch of 512 transitions with 4 updates with 4 different mini-batches of size 128 samples each. Performing more updates per an environment step leads to even worse over-fitting on some tasks without data augmentation (see Figure 9a), while our method $\mathbf { D r Q }$ , that takes advantage of data augmentation, demonstrates improved sample-efficiency (see Figure 9b). + +![](images/07b1da1b0826219bbe015466bb032d01d332406ce9f130673091e5bb63629967.jpg) +Figure 9: In the data-efficient regime, where we measure performance at $1 0 0 \mathrm { k }$ environment steps, $\mathbf { D r Q }$ is able to enhance its efficiency by performing more training iterations per an environment step. This is because $\mathbf { D r Q }$ allows to generate various transformations for a training observation. \ No newline at end of file diff --git a/md/train/H1K6Tb-AZ/H1K6Tb-AZ.md b/md/train/H1K6Tb-AZ/H1K6Tb-AZ.md new file mode 100644 index 0000000000000000000000000000000000000000..76e6be531d4da9551be9bbfe9afdbdaeacd30070 --- /dev/null +++ b/md/train/H1K6Tb-AZ/H1K6Tb-AZ.md @@ -0,0 +1,199 @@ +# TESLA: TASK-WISE EARLY STOPPING AND LOSS AGGREGATION FOR DYNAMIC NEURAL NETWORK INFERENCE + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +For inference operations in deep neural networks on end devices, it is desirable to deploy a single pre-trained neural network model, which can dynamically scale across a computation range without comprising accuracy. To achieve this goal, Incomplete Dot Product (IDP) has been proposed to use only a subset of terms in dot products during forward propagation. However, there are some limitations, including noticeable performance degradation in operating regions with low computational costs, and essential performance limitations since IDP uses hand-crafted profile coefficients. In this paper, we extend IDP by proposing new training algorithms involving a single profile, which may be trainable or pre-determined, to significantly improve the overall performance, especially in operating regions with low computational costs. Specifically, we propose the Task-wise Early Stopping and Loss Aggregation (TESLA) algorithm, which is showed in our 3-layer multilayer perceptron on MNIST that outperforms the original IDP by $3 2 \%$ when only $1 0 \%$ of dot products terms are used and achieves $9 4 . 7 \%$ accuracy on average. By introducing trainable profile coefficients, TESLA further improves the accuracy to $9 5 . 5 \%$ without specifying coefficients in advance. Besides, TESLA is applied to the VGG-16 model, which achieves $8 0 \%$ accuracy using only $2 0 \%$ of dot product terms on CIFAR-10 and also keeps $6 0 \%$ accuracy using only $3 0 \%$ of dot product terms on CIFAR-100, but the original IDP performs like a random guess in these two datasets at such low computation costs. Finally, we visualize the learned representations at different dot product percentages by class activation map and show that, by applying TESLA, the learned representations can adapt over a wide range of operation regions. + +# 1 INTRODUCTION + +Inference operations in deep neural networks on end devices, such as mobile phones, embedded sensors, IoT devices, etc., have recently received increasing attention including McMahan et al. (2016), Howard et al. (2017), and Teerapittayanon et al. (2017). In such applications, it is desirable to deploy a single pre-trained CNN model on end devices, while allowing multiple operating regions to meet different power consumption, latency, and accuracy requirements. To achieve this goal, McDanel et al. (2017a) proposed the incomplete dot product (IDP) operation, where only a subset of terms is used in dot products of forward propagation. From now on, $x \%$ dot product (DP), where 0 $\leq x \leq 1 0 0$ , means the $x \%$ of terms used in dot products. As illustrated in Figure 1, $5 0 \%$ DP means half of filters are used during forward propagation, and thus only half of the output channels are retained. To reduce the deviation induced by IDP, filters are prioritized from most important to the least important by pre-determined monotonically non-increasing profile coefficients (say, $\gamma _ { 1 } , . . . , \gamma _ { N } )$ during training. Therefore, IDP can be applied at inference time with dynamically-adjusted degrees of completeness (specified by the percentage of terms being used) to trade off accuracy slightly for lowered power consumption and reduced latency. Specifically, VGG-16 model with $5 0 \%$ DP achieves $7 0 \%$ in accuracy on the CIFAR-10 dataset compared to the standard network achieves only $3 5 \%$ accuracy when using the reduced channel set. + +While the original IDP design seems promising, there are two limitations. First, since the training process aims at optimizing the loss function computed using all weights of the model ( $1 0 0 \%$ DP), there will be a mismatch between training and testing. It is no surprise that inference performance significantly decreases in low DP percentages and thus narrow the dynamic computation range. To mitigate this problem, the original IDP design utilizes the multiple-profile training strategy, where different profiles can be specified to focus on different dot product ranges. In such a multipleprofile training process, however, certain subset of weights will be freezed in each training stage corresponding to the profile being focused, and hence the overall performance may not be fully optimized. Besides, each profile needs to maintain a separate first and last layer for adjusting to its own dot product range, resulting in additional memory overhead. The second limitation relates to the pre-determined nature of profile coefficients. While there are multiple ways to set the profile based on different dynamic range requirements, the original IDP design did not focus on finding a single ”best” profile that leads to the best performance. Instead, they use multiple hand-crafted profile coefficients, which make the system design less general among different applications, and hence may limit the overall performance of the system. + +![](images/b0dd91008c4e8fc441f3be52ecf73951a42e6e8f3ccdd53eb25a978714cc5aae.jpg) +Figure 1: Comparison between complete dot product (CDP) and incomplete dot product (IDP) where $X \%$ DP implies only $X \%$ of filters are used to compute the corresponding output channel. Since only $X \%$ filters are unused, the resulting output is an approximation of the output under CDP. + +To reduce the mismatch between training and testing performances, we propose the Task-wise Early Stopping and Loss Aggregation (TESLA) algorithm, in which multiple loss functions are computed in different DP percentages. By gradually aggregating these loss functions in decreasing order of DP percentages as the objective function to be optimized, TESLA significantly improves testing performances in low DP percentages without compromising accuracy in medium to high DP percentages. The loss functions can also be aggregated in random order of DP percentages to make a variant of TESLA, called Randomized TESLA (R-TESLA), which enables better performances under prespecified operating regions of end devices. Moreover, we relax the constraint of pre-determined profile coefficients and propose the alternate training procedure (ATP) to alternately train the profile coefficients along with weights of the model. By introducing trainable profile coefficients, customization among different applications can be achieved in a more generalized way, and the overall performance can also be further improved. This paper has made two major contributions: (1) We propose the Task-wise Early Stopping and Loss Aggregation (TESLA) algorithm and Randomized TESLA that can achieve dynamic scaling over a computation range in neural network inference without compromising accuracy. (2) We also propose the Alternate Training Procedure (ATP) that can learn the profile coefficients and the model weights simultaneously without the need of manual configuration of the profile coefficients. + +# 2 INCOMPLETE NEURAL NETWORKS + +Incomplete dot product (IDP) is a novel mechanism proposed by McDanel et al. (2017a) that can be applied to a hidden layer of MLPs or deep CNN models to dynamically lower the inference costs by computing only a subset of terms in dot products during forward propagation. By introducing a set of non-increasing coefficients $\gamma _ { i }$ , referred to as a profile, to the channels during training, the channels will be ordered implicitly in non-increasing order from the most important to the least important. By simply dropping out less important channels at inference time, it suffices to train and deploy a single network, while still supporting different levels of computation scaling without compromising accuracy significantly. In this section, we briefly introduce the main concepts of IDP. + +# 2.1 INCOMPLETE DOT PRODUCT OPERATION + +Mathematically, for an IDP fully-connected layer with input dimension $N$ and output dimension $M$ , the $j$ -th output component $y _ { j }$ is computed as + +$$ +y _ { j } = \sum _ { i = 1 } ^ { N } \gamma _ { i } w _ { j i } x _ { i } , +$$ + +for $j \in \{ 1 , 2 , . . . , M \}$ , where $x _ { i }$ is the $i$ -th input component, $w _ { j i }$ is the weight corresponding to the $j$ -th output component and the $i$ -th input component, and $\gamma _ { i }$ is the $i$ -th profile coefficient. + +Similar expression can be derived for the IDP operation applied to a convolutional layer of CNN, as illustrated in Figure 1. For an IDP convolutional layer with number of input channels $N$ and number of output channels $M$ , the $j$ -th output channel ${ \bf y } _ { j }$ is computed as + +$$ +\mathbf { y } _ { j } = \gamma _ { j } \sum _ { i = 1 } ^ { N } \mathbf { f } _ { j i } * \mathbf { x } _ { i } , +$$ + +for $j \in \{ 1 , 2 , . . . , M \}$ , where $\mathbf { f } _ { j i } * \mathbf { x } _ { i }$ denotes the convolution operation of the $i$ -th input channel $\mathbf { x } _ { i }$ and the $i$ -th channel of the $j$ -th filter $\mathbf { f } _ { j i }$ , and $\gamma _ { j }$ is the profile coefficient for the $j$ -th filter. Note that, instead of applying profile coefficients depthwise on each filter before convolution as is the case in the original IDP design, we multiply each $\gamma _ { j }$ to each output channel after a complete convolution to produce ${ \bf y } _ { j }$ . These two approaches, however, are equivalent with negligible difference induced by the first hidden layer. Since the output channels ${ \bf y } _ { j }$ ’s become input channels $\mathbf { x } _ { i }$ ’s to the next layer, applying $\gamma _ { j }$ ’s to ${ \bf y } _ { j }$ ’s is equivalent to applying them into the convolution operation in the next layer. + +To compute IDP with a target dot product percentage, a truncated version of Eq. 1 or Eq. 2 replaces the original computation to keep only a subset of the beginning terms. As for the case with all terms are kept, we refer to such operations as complete dot product (CDP) or $1 0 0 \%$ DP, interchangeably. Note that in the training process in the original IDP design, only CDP is used. + +# 2.2 MULTIPLE-PROFILE INCOMPLETE NEURAL NETWORKS + +In the work of McDanel et al. (2017a), several profile coefficients are proposed and applied in a pre-determined manner. When only a single profile is applied to the model, the trade-off between computation range and performance in high DP percentage regions is also demonstrated. Generally, the faster the profile coefficients decrease, the larger computation range can be achieved, at the expense of a performance degradation in high DP percentage regions. To cover a larger computation range while maintaining the performance in high DP percentage regions, McDanel et al. (2017a) further introduced the multiple-profile incomplete neural networks (MP-IDP), where different profiles can be specified to focus on different DP ranges. During training, all the specified profiles are applied in increasing order of their operating DP ranges. When a profile is applied, only weights corresponding to its operating DP range will be updated, leaving weights corresponding to lower DP percentages freezed since they have been trained in previous stages, and weights corresponding to higher IDP percentages set to zeros since they will be trained in later stages. In such a stage-by-stage training process, the overall performance may not be fully optimized. + +# 3 TASK-WISE EARLY STOPPING AND LOSS AGGREGATION + +As discussed in Section 2, in the original IDP design, CDP is used during training but IDP is applied at inference time. This mismatch leads to a noticeable degradation in inference performance, especially in low DP percentages. To mitigate this problem, we propose the Task-wise Early Stopping and Loss Aggregation (TESLA) algorithm. In this paper, a task is defined as the learning process that uses only a subset of weights determined by a DP percentage to learn the optimal representations. For example, a task of $5 0 \%$ DP implies that the first half of network weights are used for dot product computations and thus only these $5 0 \%$ of weights will be updated while conducting backpropagation. With TESLA, we can optimize a network by tasks with different DP percentages to support various levels of computation scaling and meanwhile reduce the mismatch between training and inference. The design of TESLA is described as follows. + +# 3.1 TASK-WISE EARLY STOPPING + +Since tasks with different DP percentages may have different learning difficulties and convergence rates, we apply an early stopping mechanism to automatically adjust the learning processes of tasks. Specifically, we keep all hyper-parameters unchanged except the numbers of epoches, which are controlled by the early stopping mechanism that halts the training process as long as the task performance has not been improved for a certain number of iterations. For example, considering two tasks, one using $7 0 \%$ DP (task 1) and the other using $4 0 \%$ DP (task 2), we first optimize task 1 and then switch to optimize task 2 until the optimization process of task 1 reaches the early stopping criterion. With this task-wise early stopping, we are able to optimize all the tasks sequentially, and each task initializes its model using the weights that have been optimized for all previous tasks. However, the weights used in task 2 is exactly a subset of weights used in task 1 such that the optimization process of task 2 may contaminate the well-trained weights for task 1. To reduce this unexpected disturbance while learning multiple tasks, some kinds of loss aggregation are needed to learn a new task without sacrificing the performance of all the past tasks too much. + +# Algorithm 1 Task-wise Early Stopping and Loss Aggregation, TESLA + +1: Input: a task set in decreasing order, $T = L _ { i }$ ; aggregation coefficient $\alpha$ +2: Initialization: $L _ { 1 } ^ { o b j } L _ { 1 }$ and $i \gets 1$ +3: while $i \leq s i z e ( T )$ do +4: 5: $L _ { i + 1 } ^ { o b j } \alpha \times L _ { i + 1 } + ( 1 - \alpha ) \times L _ { i } ^ { o b j }$ $L _ { i } ^ { o b j }$ pping criteria +6: i ← i + 1 +7: end while + +# Algorithm 2 Randomized TESLA, R-TESLA + +1: Input: a task set in any order, $T = L _ { i }$ ; allowable epoch, max epoch; aggregation coefficient $\alpha$ +2: Initialization: $L _ { 1 } ^ { o b j } L _ { 1 }$ , $i \gets 0$ , and $n \gets 0$ +3: while $n \leq$ max epoch do +4: optimize $L _ { i } ^ { o b j }$ until meeting early stopping criteria, which takes n epochs +5: 6: $L _ { i + 1 } ^ { o b j } \gets \alpha \times L _ { k } + ( 1 - \alpha ) \times L _ { i } ^ { o b j }$ $L _ { k }$ +7: i ← i + 1 +8: $n n + n$ epcohs +9: end while + +# 3.2 TASK-WISE LOSS AGGREGATION + +Task-wise loss aggregation is therefore proposed to jointly learn the shared representation for all tasks. By considering one new task at a time, we add the loss of the new task into the current objective function and optimize the aggregated objective function such that tasks are optimized incrementally and jointly. The aggregated objective function can be expressed as + +$$ +L _ { 1 } ^ { o b j } = L _ { 1 } ~ \mathrm { a n d } ~ L _ { i + 1 } ^ { o b j } = \alpha \times L _ { i + 1 } + ( 1 - \alpha ) \times L _ { i } ^ { o b j } ~ , ~ \forall i = 1 , \cdots , N - 1 +$$ + +where $\alpha$ is the aggregation coefficient shared by all subsequent tasks and greater $\alpha$ implies that we care more about the optimization of the new task. As a consequence, the objective function in the whole learning process is an affine combination of the losses of currently considered tasks. By + +![](images/0fd499cedc4c9afbb9bd09c480424ad51915337c4d0feb7009e3f509d3814295.jpg) +Figure 2: Network structures in study + +Table 1: Hyper-parameters in Experiments + +
ExperimentMLP on MNISTVGG-16 onCIFAR-10VGG-16 on CIFAR-100
Tasks at DP %100,70,40,10100,50,20100,70,50,30
Learning rate0.0010.0040.004
OptimizerAdamSGD momentum=0.9SGD momentum =0.9
Batch size283264
Aggregation coefficient0.50.50.5
TESLA stopping criterianot improve in4 epochsnot improve in 4 epochsnot improve in 4 epochs
R-TESLAstopping criteria# epochs over 50#epochs over35#epochs over35
Initial weightsrandompre-trained on ImageNetpre-trained on ImageNet
+ +task-wise loss aggregation, these losses are aggregated incrementally and can be jointly optimized to learn a shared representation to be relevant to all tasks. + +# 3.3 TESLA AND RANDOMIZED TESLA + +Task-wise Early Stopping and Loss Aggregation, TESLA. We integrate task-wise early stopping and task-wise loss aggregation as TESLA to learn dynamic representations in neural networks. The entire training process optimizes all tasks in an arbitrary order. It is obvious that we have several options to order tasks in (i) increasing, (ii) decreasing, or (iii) random DP percentages. Recall that we add a non-increasing coefficients to prioritize terms in computing dot product, and thus the beginning terms, e.g. at $1 0 \%$ DP, are more important than the terms at last $1 0 \%$ terms. Therefore, discarding the terms from the end is less harmful to the optimized parameters, so TESLA is designed to optimize tasks in decreasing order of DP percentages. The TESLA algorithm is shown in Algorithm 1. + +Randomized Task-wise Early Stopping and Loss Aggregation, R-TESLA. Here Randomized means that tasks are optimized in random order. The benefits of R-TESLA is two fold. First, RTESLA provides an opportunity to turn attention back to optimize a task which had been halted before, and allows to finetune the weights, which may have been contaminated by other tasks. Second, unlike TESLA that optimizes each task only once, R-TESLA allows each task to be optimized for multiple times, which can be specified by a customized task distribution derived from the behavioral statistics of users or the specification of hardware design. The detailed procedures of R-TESLA are in Algorithm 2. + +# 3.4 TRAINABLE PROFILE COEFFICIENTS + +In this section we propose to learn profile coefficients along with weights of the model alternately. We initialize all coefficients as one and as long as any update of profile coefficients, we manually clip the coefficients to keep the non-increasing property. The alternate training procedure (ATP) relaxes the constraint of fixed coefficients and we demonstrate the feasibility of ATP in the experiment of the MLP model on MNIST dataset in Section 4. + +# 4 EXPERIMENTS + +In this section, we demonstrate the effectiveness of using TESLA and R-TESLA to learn dynamic representations in MLP and CNN models, with the widely-used datasets MNIST, CIFAR-10, and CIFAR-100. Figure 2 shows the network architectures in study. Note that while working on CIFAR100, the last fully connected layer of Figure 2(b) is replaced by a single 100-class classifier. Here we compare TESLA and R-TESLA with the original IDP design proposed by McDanel et al. (2017a) over a range of dynamic scaling during inference. All hyper-parameters and experiment settings are summarized in Table 1. + +# 4.1 MULTILAYER PERCEPTRONS + +First, we consider a 3-layer MLP model, in which the IDP operation is applied to the first hidden layer, as shown in Figure 2(a), and evaluate on the MNIST dataset. In this experiment, we define four tasks that optimize the model at $1 0 \%$ , $4 0 \%$ , $7 0 \%$ , and $1 0 0 \%$ DP, respectively. It is noteworthy that defining too many tasks in our experiment would not benefit much, since there must be a large amount of shared parameters among tasks which makes the model vulnerable to overfitting. + +![](images/1b204a0ffa4be7521a49124c4af28e44f0315059e93f44280d7eddbd5e8711ea.jpg) +Figure 3: Performance comparisons by a MLP model over the MNIST dataset + +TESLA versus original IDP. We compare TESLA and the original IDP design under various profiles. Figure 3(a) shows that at $2 0 \%$ DP, the original IDP achieves $8 0 \%$ , $6 3 \%$ and $5 5 \%$ accuracy for the harmonic, all-one, and linear profiles respectively but TESLA keeps at least $8 8 \%$ accuracy for all profiles at $2 0 \%$ DP and reaches average accuracy of $9 4 . 7 \%$ using the linear profile. Most importantly, compared to the original IDP, TESLA performs only about $1 \%$ worse in accuracy at $1 0 0 \%$ DP but gains a significant improvement from $5 0 \%$ to $9 0 \%$ in accuracy at $1 0 \%$ DP, which is an acceptable trade-off under practical applications. + +R-TESLA versus TESLA and original IDP. Figure 3(b) shows that R-TESLA outperforms the original IDP by a large margin and R-TESLA has comparable performance with TESLA in most cases. R-TESLA with the harmonic profile leads to the best average accuracy of $9 5 . 2 \%$ in this experiment. By observing the optimization progress, we find that TESLA achieves its best result after completing the last task thanks to its ordinal optimization. On the other hand, we cannot ensure that R-TESLA can make the ultimate model retains the best dynamic representations due to its random nature. + +Learn profile coefficients by ATP. Here we demonstrate the feasibility of learning profile coefficients along with weights. From Figure 3(c), with the help of trainable profile coefficients, both TESLA and R-TESLA further boost by $1 \%$ in average, and we also observe that the learned profile coefficients are similar to harmonic ones as shown in Figure 3(d). This may support why performance of harmonic coefficients is the best in the original IDP. By allowing coefficients to be trainable, it is no longer to require hand-crafted profile coefficients and determine the best profile coefficients by extensive experiments. + +# 4.2 CONVOLUTIONAL NEURAL NETWORKS + +We choose the known VGG-16 model pre-trained on ImageNet to evaluate over CIFAR-10 and CIFAR-100 dataset so that the last few dense layers are replaced by a 10-class classifier and a 100- class classifier respectively. Here we use the linear profile coefficients to compare: (i) the original IDP design, (ii) multiple-profile IDP design (MP-IDP) as proposed in McDanel et al. (2017a), (iii) TESLA, and (iv) R-TESLA. The experimental results are summarized below. + +VGG-16 on CIFAR-10. According to Figure 4(a), the performance of original IDP by all-one coefficients drops much faster than that by linear coefficients. Appling all-one coefficients is equivalent to using the original VGG-16 network; however, linear profile coefficients implicitly encourages networks to learn channel importance in order, and also brings about that pruning away later channels at different DP percentages does not hurt the performance that much. With the use of multiple profiles, MP-IDP does enlarge the computational range with an increase in accuracy to $7 5 \%$ at $5 0 \%$ DP. Furthermore, the proposed algorithms, TESLA and R-TESLA, boost the accuracy to reach $8 5 \%$ at $5 0 \%$ DP, and an even higher accuracy at $1 0 0 \%$ DP. + +Following the previous experiment, here we augment another new task of $2 0 \%$ DP and observe whether TESLA can leverage up the performance at low DP percentages by adding a task of a low DP percentage. Figure 4(b) shows that TESLA and R-TESLA greatly widens the computational ranges by making accuracy reaching $7 5 \%$ at $2 0 \%$ DP. We contribute this effect to applying TESLA and R-TESLA in decreasing order of dot product percentages so that the representation learned at $1 0 0 \%$ DP drives the training of representation at $5 0 \%$ DP, which also makes the representation much easier to be learned at $2 0 \%$ DP. Compared to TESLA and R-TESLA, MP-IDP trains models in increasing order of DP percentages and thus MP-IDP doesn’t see much improvement at lower IDP percentages although adding another task at $2 0 \%$ DP. + +![](images/fc8029bb88c608867e56b19ad9e18e324046ff3b51891264bc821bcb56eb9d01.jpg) +Figure 4: Performance comparisons by the VGG-16 model over the CIFAR-10 and CIFAR-100 dataset + +![](images/db98606cfff4d19e86ef988bb3e742d28530e3d0cbd05b2161071314c462df87.jpg) +Figure 5: CAMs at different DP percentages. Red colored text means wrong prediction and green colored text means correct prediction. + +![](images/d7f7b88869bdbd7652219e42dd81d852c03cd882246096e26ed8bc3e9aa459f6.jpg) +Figure 6: CAMs of a testing image that is correctly classified at all specified DP percentages. + +VGG-16 on CIFAR-100. To sufficiently illustrate the effectiveness of the proposed approaches, we evaluate over a larger dataset, CIFAR-100. Figure 4(c) shows the performance of TESLA and R-TESLA still keeps around $6 0 \%$ accuracy from $3 0 \%$ to $5 0 \%$ DP, which outperforms either original IDP or MP-IDP by a significant margin, which is consistent with the result of CIFAR-10. Specifically, both TESLA and R-TESLA sacrifice about $4 \%$ accuracy at $1 0 0 \%$ DP but gain a great improvements of $6 0 \%$ accuracy in low DP percentages. + +CAM visualization. We visualize what the model sees at different DP percentages by deploying the Class Activation Mapping (CAM) technique introduced by Zhou et al. (2016a). A resulting CAM indicates how much each location contribute to the final class prediction. In this stage, we replace the max-pooling layers with average-pooling layers and train the VGG-16 network with linear coefficients optimized at $2 0 \%$ , $5 0 \%$ , $1 0 0 \%$ DP. From CAMs at different DP percentages, we found that the network is easier to make wrong prediction at $1 0 \%$ and $3 0 \%$ DP but still makes correct prediction at $2 0 \%$ DP as shown in Figure 5 since the representations at $2 0 \%$ DP are optimized. This finding implies that we can specify any DP percentages to be optimized for satisfying custom requirements. Compared to Figure 6, we also notice that the CAMs at $1 0 \%$ DP are almost the same no matter the correctness of predictions, which indicates too limited capacity to capture meaningful patterns, and thus the network at $1 0 \%$ DP behaves like a random guess. + +# 5 RELATED WORK + +Our work is rooted from IDP proposed by McDanel et al. (2017a), which, in addition to MLPs and regular CNNs, can also be used in conjunction with other variants of convolutional layers, such as separable convolution layer Howard et al. (2017) and binary convolutional layer McDanel et al. (2017b). As discussed throughout this paper, our work extends the original IDP design by proposing new training algorithms involving a single profile, which may be trainable or pre-determined, to significantly improve the overall performance, especially in low DP percentages. + +Network pruning is a widely-studied area that also aims at compressing the CNN models. Early works of network pruning construct a threshold for dropping weights by information obtained from Hessian matrix or inverse Hessian matrix in LeCun et al. (1990); Hassibi & Stork (1993), which adds memory and computation costs. In most of the recent works, magnitude-based pruning and recovering are incorporated to compensate the potential loss incurred by inadequate pruning. For example, Guo et al. (2016) introduces the splicing operation to enable connection recovery, and Han et al. (2016) directly makes the network dense again. Li et al. (2016) also prune filters in CNNs based on magnitude, but the number of filters pruned away in each layer is decided by layer-wise sensitivity. Besides magnitude-based pruning, a Taylor expansion-based criterion is introduced in Molchanov et al. (2016) to approximate the change in the cost function induced by pruning. In addition to network pruning, some works focus on low-rank decomposition for network compression. For example, Denton et al. (2014) and Jaderberg et al. (2014) approximate the weight matrix into low-rank components by minimizing the reconstruction error. Yu et al. (2017) further decomposes the weight matrix into its low-rank and sparse component. Other works focus on grouping similar weights, such as quantization by Han et al. (2015), Gong et al. (2014), and Zhou et al. (2017) and weight sharing by Ullrich et al. (2017), aiming at reducing the level of redundancy and the required storage. Yet another approach introduces group sparsity regularizer to constrain the structure of the model in Wen et al. (2016), Zhou et al. (2016b), and Alvarez & Salzmann (2016). + +While all the above techniques are promising in reducing the size of the networks, none of them supports dynamic adjustment during inference as IDP does. Furthermore, most of the above techniques involve retraining the model iteratively, resulting in computational overhead. In our proposed work, the goal of efficient inference with dynamic adjustment can be readily fulfilled by training a single model at once, and the effectiveness is expected to be further improved by incorporating with other techniques listed above. + +# 6 CONCLUSION + +In this paper, we extend the idea of incomplete dot product (IDP) by proposing the Task-wise Early Stopping and Loss Aggregation (TESLA) algorithm to significantly improve the performance of neural networks with dynamically computation regions at inference time without significantly compromising accuracy. A task is defined as the learning process that uses only a subset of weights specified by a DP percentage to learn the optimal representations of the network. By introducing non-increasing profile coefficients to prioritize weights or filters during training, TESLA can be used to optimize multiple tasks in decreasing order of DP percentages by aggregating the their loss functions. Additionally, we propose Randomized TESLA (R-TESLA) which optimizes tasks in random order, and show that both TESLA and R-TESLA outperform original IDP and multiple-profile IDP significantly. The visualization of the class activation maps (CAMs) provide a strong evidence that the representations learned by TESLA allow dynamically scaling across a computation range to meet various power consumption, latency and accuracy requirements on end devices. + +# REFERENCES + +Jose M Alvarez and Mathieu Salzmann. Learning the number of neurons in deep networks. In Advances in Neural Information Processing Systems, pp. 2270–2278, 2016. + +Emily L Denton, Wojciech Zaremba, Joan Bruna, Yann LeCun, and Rob Fergus. Exploiting linear structure within convolutional networks for efficient evaluation. In Advances in Neural Information Processing Systems, pp. 1269–1277, 2014. + +Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. Compressing deep convolutional networks using vector quantization. arXiv preprint arXiv:1412.6115, 2014. + +Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. In Advances In Neural Information Processing Systems, pp. 1379–1387, 2016. + +Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015. + +Song Han, Jeff Pool, Sharan Narang, Huizi Mao, Enhao Gong, Shijian Tang, Erich Elsen, Peter Vajda, Manohar Paluri, John Tran, et al. Dsd: Dense-sparse-dense training for deep neural networks. 2016. + +Babak Hassibi and David G. Stork. Second order derivatives for network pruning: Optimal brain surgeon. In Advances in Neural Information Processing Systems 5, pp. 164–171. 1993. + +Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017. + +Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up convolutional neural networks with low rank expansions. arXiv preprint arXiv:1405.3866, 2014. + +Yann LeCun, John S. Denker, and Sara A. Solla. Optimal brain damage. In Advances in Neural Information Processing Systems 2, pp. 598–605. 1990. + +Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016. + +Bradley McDanel, Surat Teerapittayanon, and HT Kung. Incomplete dot products for dynamic computation scaling in neural network inference. 2017a. + +Bradley McDanel, Surat Teerapittayanon, and H.T. Kung. Embedded binarized neural networks. In Proceedings of the 2017 International Conference on Embedded Wireless Systems and Networks, 2017b. + +H Brendan McMahan, Eider Moore, Daniel Ramage, and Blaise Aguera y Arcas. Federated learning of deep networks using model averaging. 2016. + +Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. 2016. + +Surat Teerapittayanon, Bradley McDanel, and HT Kung. Distributed deep neural networks over the cloud, the edge and end devices. In Distributed Computing Systems (ICDCS), 2017 IEEE 37th International Conference on, pp. 328–339. IEEE, 2017. + +Karen Ullrich, Edward Meeds, and Max Welling. Soft weight-sharing for neural network compression. arXiv preprint arXiv:1702.04008, 2017. + +Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2074–2082, 2016. + +Xiyu Yu, Tongliang Liu, Xinchao Wang, and Dacheng Tao. On compressing deep models by low rank and sparse decomposition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7370–7379, 2017. + +Aojun Zhou, Anbang Yao, Yiwen Guo, Lin Xu, and Yurong Chen. Incremental network quantization: Towards lossless cnns with low-precision weights. arXiv preprint arXiv:1702.03044, 2017. + +Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2921–2929, 2016a. + +Hao Zhou, Jose M Alvarez, and Fatih Porikli. Less is more: Towards compact cnns. In European Conference on Computer Vision, pp. 662–677. Springer, 2016b. \ No newline at end of file diff --git a/md/train/H1edIiA9KQ/H1edIiA9KQ.md b/md/train/H1edIiA9KQ/H1edIiA9KQ.md new file mode 100644 index 0000000000000000000000000000000000000000..624a3b71d47dbfaac5256aefd64168cf7b7e418f --- /dev/null +++ b/md/train/H1edIiA9KQ/H1edIiA9KQ.md @@ -0,0 +1,288 @@ +# GENERATING MULTIPLE OBJECTS AT SPATIALLY DISTINCT LOCATIONS + +Tobias Hinz, Stefan Heinrich, Stefan Wermter Knowledge Technology, Department of Informatics, Universitat Hamburg ¨ Vogt-Koelln-Str. 30, 22527 Hamburg, Germany https://www.inf.uni-hamburg.de/en/inst/ab/wtm/ {hinz,heinrich,wermter}@informatik.uni-hamburg.de + +# ABSTRACT + +Recent improvements to Generative Adversarial Networks (GANs) have made it possible to generate realistic images in high resolution based on natural language descriptions such as image captions. However, fine-grained control of the image layout, i.e. where in the image specific objects should be located, is still difficult to achieve. We introduce a new approach which allows us to control the location of arbitrarily many objects within an image by adding an object pathway to both the generator and the discriminator. Our approach does not need a detailed semantic layout but only bounding boxes and the respective labels of the desired objects are needed. The object pathway focuses solely on the individual objects and is iteratively applied at the locations specified by the bounding boxes. The global pathway focuses on the image background and the general image layout. We perform experiments on the Multi-MNIST, CLEVR, and the more complex MSCOCO data set. Our experiments show that through the use of the object pathway we can control object locations within images and can model complex scenes with multiple objects at various locations. We further show that the object pathway focuses on the individual objects and learns features relevant for these, while the global pathway focuses on global image characteristics and the image background. + +# 1 INTRODUCTION + +Understanding how to learn powerful representations from complex distributions is the intriguing goal behind adversarial training on image data. While recent advances have enabled us to generate high-resolution images with Generative Adversarial Networks (GANs), currently most GAN models still focus on modeling images that either contain only one centralized object (e.g. faces (CelebA), objects (ImageNet), birds (CUB-200), flowers (Oxford-102), etc.) or on images from one specific domain (e.g. LSUN bedrooms, LSUN churches, etc.). This means that, overall, the variance between images used for training GANs tends to be low (Raj et al., 2017). However, many real-life images contain multiple distinct objects at different locations within the image and with different relations to each other. This is for example visible in the MS-COCO data set (Lin et al., 2014), which consists of images of different objects at different locations within one image. In order to model images with these complex relationships, we need models that can model images containing multiple objects at distinct locations. To achieve this, we need control over what kind of objects are generated (e.g. persons, animals, objects, etc.), the location, and the size of these objects. This is a much more challenging task than generating a single object in the center of an image. + +Current work (Karacan et al., 2016; Johnson et al., 2018; Hong et al., 2018b; Wang et al., 2018) often approaches this challenge by using a semantic layout as additional conditional input. While this can be successful in controlling the image layout and object placement, it also places a high burden on the generating process since a complete scene layout must be obtained first. We propose a model that does not require a full semantic layout, but instead only requires the desired object locations and identities (see Figure 1). One part of our model, called the global pathway, is responsible for generating the general layout of the complete image, while a second path, the object pathway, is used to explicitly generate the features of different objects based on the relevant object label and location. + +The generator gets as input a natural language description of the scene (if existent), the locations and labels of the various objects within the scene, and a random noise vector. The global pathway uses this to create a scene layout encoding which describes high-level features and generates a global feature representation from this. The object pathway generates a feature representation of a given object at a location described by the respective bounding box and is applied iteratively over the scene at the locations specified by the individual bounding boxes. We then concatenate the feature representations of the global and the object pathway and use this to generate the final image. + +The discriminator, which also consists of a global and object pathway, gets as input the image, the bounding boxes and their respective object labels, and the textual description. The global pathway is then applied to the whole image and obtains a feature representation of the global image features. In parallel, the object pathway focuses only on the areas described by the bounding boxes and the respective object labels and obtains feature representations of these specific locations. Again, the outputs of both the global and the object pathway are merged and the discriminator is trained to distinguish between real and generated images. + +In contrast to previous work we do not generate a scene layout of the whole scene but only focus on relevant objects which are placed at the specified locations, while the global consistency of the image is the responsibility of the other part of our model. To summarize our model and contributions: 1) We propose a GAN model that enables us to control the layout of a scene without the use of a scene layout. 2) Through the use of an object pathway which is responsible for learning features of different object categories, we gain control over the identity and location of arbitrarily many objects within a scene. 3) The discriminator judges not only if the image is realistic and aligned to the natural language description, but also whether the specified objects are at the given locations and of the correct object category. 4) We show that the object pathway does indeed learn relevant features for the different objects, while the global pathway focuses on general image features and the background. + +# 2 RELATED WORK + +Having more control over the general image layout can lead to a higher quality of images (Reed et al., 2016a; Hong et al., 2018b) and is also an important requirement for semantic image manipulation (Hong et al., 2018a; Wang et al., 2018). Approaches that try to exert some control over the image layout utilize Generative Adversarial Nets (Goodfellow et al., 2014), Refinement Networks (e.g. Chen & Koltun (2017); Xu et al. (2018a)), recurrent attention-based models (e.g. Mansimov et al. (2016)), autoregressive models (e.g. Reed et al. (2016c)), and even memory networks supplying the image generation process with previously extracted image features (Zhang et al., 2018b). + +One way to exert control over the image layout is by using natural language descriptions of the image, e.g. image captions, as shown by Reed et al. (2016b), Zhang et al. (2018a), Sharma et al. (2018), and $\mathrm { X u }$ et al. (2018b). However, these approaches are trained only with images and their respective captions and it is not possible to specifically control the layout or placement of specific objects within the image. Several approaches suggested using a semantic layout of the image, generated from the image caption, to gain more fine-grained control over the final image. Karacan et al. (2016), Johnson et al. (2018), and Wang et al. (2018) use a scene layout to generate images in which given objects are drawn within their specified segments based on the generated scene layout. Hong et al. (2018b) use the image caption to generate bounding boxes of specific objects within the image and predict the object’s shape within each bounding box. This is further extended by Hong et al. (2018a) by making it possible to manipulate images on a semantic level. While these approaches offer a more detailed control over the image layout they heavily rely on a semantic scene layout for the image generating process, often implying complex preprocessing steps in which the scene layout is constructed. + +The two approaches most closely related to ours are by Reed et al. (2016a) and Raj et al. (2017). Raj et al. (2017) introduce a model that consists of individual “blocks” which are responsible for different object characteristics (e.g. color, shape, etc.). However, their approach was only tested on the synthetic SHAPES data set (Andreas et al., 2016), which has only comparatively low variability and no image captions. Reed et al. (2016b) condition both the generator and the discriminator on either a bounding box containing the object or keypoints describing the object’s shape. However, the used images are still of relatively low variability (e.g. birds (Wah et al., 2011)) and only contain one object, usually located in the center of the image. In contrast, we model images with several different objects at various locations and apply our object pathway multiple times at each image, both in the generator and in the discriminator. Additionally, we use the image caption and bounding box label to obtain individual labels for each bounding box, while Reed et al. (2016b) only use the image caption as conditional information. + +![](images/ce8759ca371daed0c65e336f9f8905733d7dc145cc9833ecfa6c8f9aadbf5e1d.jpg) +Figure 1: Both the generator and the discriminator of our model consist of a global and an object pathway. The global pathway focuses on global image characteristics, such as the background, while the object pathway is responsible for modeling individual objects at their specified location. + +# 3 APPROACH + +For our approach1, the central goal is to generate objects at arbitrary locations within a scene while keeping the scene overall consistent. For this we make use of a generative adversarial network (GAN) (Goodfellow et al., 2014). A GAN consists of two networks, a generator and a discriminator, where the generator tries to reproduce the true data distribution and the discriminator tries to distinguish between generated data points and data points sampled from the true distribution. We use the conditional GAN framework, in which both the generator and the discriminator get additional information, such as labels, as input. The generator $G$ (see Figure 1) gets as input a randomly sampled noise vector $z$ the location and size of the individual bounding boxes $b b o x _ { i }$ , a label for each of the bounding boxes encoded as a one-hot vector $l _ { \mathrm { o n e h o t } _ { i } }$ , and, if existent, an image caption embedding $\varphi$ obtained with a pretrained char-CNN-RNN network from Reed et al. (2016b). As a pre-processing step (A), the generator constructs labels $l a b e l _ { i }$ for the individual bounding boxes from the image caption $\varphi$ and the provided labels $l _ { \mathrm { o n e h o t } _ { i } }$ of each bounding box. For this, we concatenate the image caption embedding $\varphi$ and the one-hot vector of a given bounding box $l _ { \mathrm { o n e h o t } _ { i } }$ and create a new label embedding $l a b e l _ { i }$ by applying a matrix-multiplication followed by a non-linearity (i.e. a fully connected layer). The resulting label $l a b e l _ { i }$ contains the previous label as well as additional information from the image caption, such as color or shape, and is potentially more meaningful. In case of missing image captions, we use the one-hot embedding $l _ { \mathrm { o n e h o t } _ { i } }$ only. + +The generator consists of two different streams which get combined later in the process. First, the global pathway (B) is responsible for creating a general layout of the global scene. It processes the previously generated local labels $l a b e l _ { i }$ for each of the bounding boxes and replicates them spatially at the location of each bounding box. In areas where the bounding boxes overlap the label embeddings $l a b e l _ { i }$ are summed up, while the areas with no bounding boxes remain filled with zeros. Convolutional layers are applied to this layout to obtain a high-level layout encoding which is concatenated with the noise vector $z$ and the image caption embedding $\varphi$ and the result is used to generate a general image layout $f _ { \mathrm { g l o b a l } }$ . + +Second, the object pathway (C) is responsible for generating features of the objects $f _ { \mathrm { l o c a l } _ { i } }$ within the given bounding boxes. This pathway creates a feature map of a predefined resolution using convolutional layers which receive the previously generated label $l a b e l _ { i }$ as input. This feature map is further transformed with a Spatial Transformer Network (STN) (Jaderberg et al., 2015) to fit into the bounding box at the given location on an empty canvas. The same convolutional layers are applied to each of the provided labels, i.e. we have one object pathway that is applied several times across different labels $l a b e l _ { i }$ and whose output feeds onto the corresponding coordinates on the empty canvas. Again, features within overlapping bounding box areas are summed up, while areas outside of any bounding box remain zero. + +As a final step, the outputs of the global and object pathways $f _ { \mathrm { g l o b a l } }$ and $f _ { \mathrm { l o c a l } _ { i } }$ are concatenated along the channel axis and are used to generate the image in the final resolution, using common GAN procedures. The specific changes of the generator compared to standard architectures are the object pathway that generates additional features at specific locations based on provided labels, as well as the layout encoding which is used as additional input to the global pathway. These two extensions can be added to the generator in any existing architecture with limited extra effort. + +The discriminator receives as input an image (either original or generated), the location and size of the bounding boxes $b b o x _ { i }$ , the labels for the bounding boxes as one-hot vectors $l _ { \mathrm { o n e h o t } _ { i } }$ , and, if existent, the image caption embedding $\varphi$ . Similarly to the generator, the discriminator also possesses both a global (D) and an object (E) pathway respectively. The global pathway takes the image and applies multiple convolutional layers to obtain a representation $f _ { \mathrm { g l o b a l } }$ of the whole image. The object pathway first uses a STN to extract the objects from within the given bounding boxes and then concatenates these extracted features with the spatially replicated bounding box label $l _ { \mathrm { o n e h o t } _ { i } }$ Next, convolutional layers are applied and the resulting features $f _ { \mathrm { l o c a l } _ { i } }$ are again added onto an empty canvas within the coordinates specified by the bounding box. Note, similarly to the generator we only use one object pathway that is applied to multiple image locations, where the outputs are then added onto the empty canvas, summing up overlapping parts and keeping areas outside of the bounding boxes set to zero. Finally, the outputs of both the object and global pathways $f _ { \mathrm { l o c a l } _ { i } }$ and $f _ { \mathrm { g l o b a l } }$ are concatenated along the channel axis and we again apply convolutional layers to obtain a merged feature representation. At this point, the features are concatenated either with the spatially replicated image caption embedding $\varphi$ (if existent) or the sum of all one-hot vectors $l _ { \mathrm { o n e h o t } _ { i } }$ along the channel axis, one more convolutional layer is applied, and the output is classified as either generated or real. + +For the general training, we can utilize the same procedure that is used in the GAN architecture that is modified with our proposed approach. In our work we mostly use the StackGAN (Zhang et al., 2018a) and AttnGAN (Xu et al., 2018b) frameworks which use a modified objective function taking into consideration the additional conditional information and provided image captions. As such, our discriminator $D$ and our generator $G$ optimize the following objective function: + +$$ +\operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } V ( D , G ) = \mathbb { E } _ { ( x , c ) \sim p _ { \mathrm { d a t a } } } [ l o g D ( x , c ) ] + \mathbb { E } _ { ( z ) \sim p _ { z } , ( c ) \sim p _ { \mathrm { d a t a } } } [ l o g ( 1 - D ( G ( z , c ) , c ) ) ] , +$$ + +where $x$ is an image, $c$ is the conditional information for this image (e.g. $l a b e l _ { i }$ , bounding boxes $b b o x _ { i }$ , or an image caption $\varphi$ ), $z$ is a randomly sampled noise vector used as input for $G$ , and $p _ { \mathrm { d a t a } }$ is the true data distribution. Zhang et al. (2018a) and others use an additional technique called conditioning augmentation for the image captions which helps improve the training process and the quality of the generated images. In the experiments in which we use image captions (MS-COCO) we also make use of this technique2. + +# 4 EVALUATION AND ANALYSIS + +For the evaluation, we aim to study the quality of the generated images with a particular focus on the generalization capabilities and the contribution of specific parts of our model, in both controllable and large-scale cases. Thus, in the following sections, we evaluate our approach on three different data sets: the Multi-MNIST data set, the CLEVR data set, and the MS-COCO data set. + +# 4.1 MULTI-MNIST + +In our first experiment, we used the Multi-MNIST data set (Eslami et al., 2016) for testing the basic functionality of our proposed model. Using the implementation provided by Eslami et al. (2016), we created 50,000 images of resolution $6 4 \times 6 4$ px that contain exactly three normal-sized MNIST digits in non-overlapping locations on a black background. + +![](images/ec47e731cba80f3790f2949ad4317f709a121efc24cc9f0613b77a9467378569.jpg) +Figure 2: Multi-MNIST images generated by the model. Training included only images with three individual normal-sized digits. Highlighted bounding boxes and yellow ground truth for visualization. + +As a first step, we tested whether our model can learn to generate digits at the specified locations and whether we can control the digit identity, the generated digit’s size, and the number of generated digits per image. According to the results, we can control the location of individual digits, their identity, and their size, even though all training images contain exactly three digits in normal size. Figure 2 shows that we can control how many digits are generated within an image (rows A–B, for two to five digits) and various sizes of the bounding box (row C). As a second step, we created an additional Multi-MNIST data set in which all training images contain only digits 0–4 in the top half and only digits 5–9 in the bottom half of the image. For testing digits in the opposite half, we can see that the model is indeed capable of generalizing the position (row D, left), i.e. it can generate digits 0–4 in the bottom half of the image and digits 5–9 in the top half of the image. Nevertheless, we also observed that this does not always work perfectly, as the network sometimes alters digits towards the ones it has seen during training at the respective locations, e.g. producing a “4” more similar to a “9” if in bottom half of the image, or generating a “7” more similar to a “1” if in top half of the image. + +As a next step, we created a Multi-MNIST data set with images that only contain digits in the top half of the image, while the bottom half is always empty. We can see (Figure 2, row D, right) that the resulting model is not able to generate digits in the bottom half of the image (see Figure 6 in the Appendix for more details on this). Controlling for the location still works, i.e. bounding boxes are filled with “something”, but the digit identity is not clearly recognizable. Thus, the model is able to control both the object identity and the object location within an image and can generalize to novel object locations to some extent. + +To test the impact of our model extensions, i.e. the object pathway in both the generator and the discriminator as well as the layout encoding, we performed ablation studies on the previously created Multi-MNIST data set with three digits at random locations. We first disabled the use of the layout encoding in the generator and left the rest of the model unchanged. In the results (Figure 2, row E, left), we can see that, overall, both the digit identity and the digit locations are still correct, but minor imperfections can be observed within various images. This is most likely due to the fact that the global pathway of the generator has no information about the digit identity and location until its features get merged with the object pathway. As a next test, we disabled the object pathway of the discriminator and left the rest of the model unmodified. Again, we see (row E, right) that we can still control the digit location, although, again, minor imperfections are visible. More strikingly, we have a noticeably higher error rate in the digit identity, i.e. the wrong digit is generated at a given location, most likely due to the fact that there is not object pathway in the discriminator controlling the object identity at the various locations. In comparison, the imperfections are different when only the object pathway of the generator is disabled (row F, left). The layout encoding and the feedback of the discriminator seem to be enough to still produce the digits in the correct image location, but the digit identity is often incorrect or not recognizable at all. Finally, we tested disabling the object pathway in both the discriminator and the generator (see row F, right). This leads to a loss of control of both image location as well as identity and sometimes even results in images with more or fewer than three digits per image. This shows that only the layout encoding, without any of the object pathways, is not enough to control the digit identity and location. Overall, these results indicate that we do indeed need both the layout encoding, for a better integration of the global and object pathways, and the object pathways in both the discriminator and the generator, for optimal results. + +![](images/c2daae0680f0912055c2bcfeb2359fd3ba0e7d44e66139c5af645529bc094781.jpg) +Figure 3: Images from the CLEVR data set. The left image of each pair shows the rendered image according to specific attributes. The right image of each pair is the image generated by our model. + +# 4.2 CLEVR + +In our second experiment we used more complex images containing multiple objects of different colors and shapes. The goal of this experiment was to evaluate the generalization ability of our object pathway across different object characteristics. For this, we performed tests similar to (Raj et al., 2017), albeit on the more complex CLEVR data set (Johnson et al., 2017). In the CLEVR data set objects are characterized by multiple properties, in our case the shape, the color, and the size. Based on the implementation provided by Johnson et al. (2017), we rendered 25,000 images with a resolution of $6 4 \times 6 4$ pixels containing $2 - 4$ objects per image. The label for a given bounding box of an object is the object shape and color (both encoded as one-hot encoding and then concatenated), while the object size is specified through the height and width of the bounding box. + +Similar to the first experiment, we tested our model for controlling the object characteristics, size, and location. In the first row of Figure 3 we present the results of the trained model, where the left image of each pair shows the originally rendered one, while the right image was generated by our model. We can confirm that the model can control both the location and the objects’ shape and color characteristics. The model can also generate images containing an arbitrary number of objects (forth and fifths pair), even though a maximum of four objects per image was seen during training. + +The CLEVR data set offers a split specifically intended to test the generalization capability of a model, in which cylinders can be either red, green, purple, or cyan and cubes can be either gray, blue, brown, or yellow during training, while spheres can have any of these colors. During testing, the colors between cylinders and cubes are reversed. Based on these restrictions, we created a second data set of 25,000 training images for testing our model. Results of the test are shown in the second row of Figure 3 (again, left image of each pair shows the originally rendered one, while the right image was generated by our model). We can see that the color transfer to novel shape-color combinations takes place, but, similarly to the Multi-MNIST results, we can see some artifacts, where e.g. some cubes look a bit more like cylinders and vice versa. Overall, the CLEVR experiment confirms the indication that our model can control object characteristics (provided through labels) and object locations (provided through bounding boxes) and can generalize to novel object locations, novel amounts of objects per image, and novel object characteristic combinations within reasonable boundaries. + +
ModelResolutionIS个FID↓
GAN-INT-CLS Reed et al. (2016b) StackGAN-V2 Zhang et al. (2018a) StackGAN Zhang et al. (2018a) PPGN Nguyen et al. (2017) ChatPainter (StackGAN) Sharma et al. (2018) Semantic Layout Hong et al. (2018b) HDGan Zhang et al. (2018c)64× 64 256 ×256 256× 256 227× 227 256× 256 128×128 256× 2567.88 ±0.07 8.30± 0.10 8.45 ± 0.031 9.58 ± 0.21 9.74 ± 0.02 11.46 ± 0.09²60.62 81.59 74.05
AttnGAN Xu et al. (2018b) StackGAN + Object Pathways (Ours)5 AttnGAN + Object Pathways (Ours)256× 256 256×256 256 ×25611.86 ± 0.18 23.61±0.214 12.12 ± 0.31 24.76 ± 0.4371.27 ± 0.123 33.10 ± 0.113 55.30 ± 1.78 33.35 ± 1.15
+ +1 Recently updated to $1 0 . 6 2 \pm 0 . 1 9$ in its source code. 2 When using the ground truth bounding boxes at test time (as we do) the IS increases to $1 1 . 9 4 \pm 0 . 0 9$ . 3 FID score was calculated with samples generated with the pretrained model provided by the authors. 4 The authors report a “best” value of $2 5 . 8 9 \pm 0 . 4 7$ , but when calculating the IS with the pretrained model provided by the authors we only obtain an IS of 23.61. Other researchers on the authors’ Github website report a similar value for the pretrained model. 5 We use the updated source code (IS of 10.62) as our baseline model. + +Table 1: Comparison of the Inception Score (IS) and Frechet Inception Distance (FID) on the MS- ´ COCO data set for different models. Note: the IS and FID values of our models are not necessarily directly comparable to the other models, since our model gets at test time, in addition to the image caption, up to three bounding boxes and their respective object labels as input. + +# 4.3 MS-COCO + +For our final experiment, we used the MS-COCO data set (Lin et al., 2014) to evaluate our model on natural images of complex scenes. In order to keep our evaluation comparable to previous work, we used the 2014 train/test split consisting of roughly 80,000 training and 40,000 test images and rescaled the images to a resolution of $2 5 6 \times 2 5 6 \ : \mathrm { p x }$ . At train-time, we used the bounding boxes and object labels of the three largest objects within an image, i.e. we used zero to three bounding boxes per image. Similarly to work by Johnson et al. (2018) we only considered objects that cover at least $2 \%$ of the image for the bounding boxes. To evaluate our results quantitatively, we computed both the Inception Score (IS, larger is better), which tries to evaluate how recognizable and diverse objects within images are (Salimans et al., 2016), as well as the Frechet Inception Distance (FID, smaller is ´ better), which compares the statistics of generated images with real images (Heusel et al., 2017). As a qualitative evaluation, we generated images that contain more than one object, and checked, whether the bounding boxes can control the object placement. We tested our approach with two commonly used architectures for text-to-image synthesis, namely the StackGAN (Zhang et al., 2017) and the AttnGAN (Xu et al., 2018b), and compared the images generated by these and our models. + +In the StackGAN, the training process is divided into two steps: first, it learns a generator for images with a resolution of $6 4 \times 6 4$ px based on the image captions, and second, it trains a second generator, which uses the smaller images $( 6 4 \times 6 4 \ : \mathrm { p x } )$ from the first generator and the image caption as input to generate images with a resolution of $2 5 6 \times 2 5 6$ px. Here, we added the object pathways and the layout encoding at the beginning of both the first generator and the second generator and used the object pathway in both discriminators. The other parts of StackGAN architecture and all hyperparameters remain the same as in the original training procedure for the MS-COCO data set. We trained the model three times from scratch and randomly sampled 3 times 30,000 image captions from the test set for each model. We then calculated the IS and FID values on each of the nine samples of 30,000 generated images and report the averaged values. As presented in Table 1, our StackGAN with added object pathways outperforms the original StackGAN both on the IS and the FID, increasing the IS from 10.62 to 12.12 and decreasing the FID from 74.05 to 55.30. Note, however, that this might also be due to the additional information our model is provided with as it receives up to three bounding boxes and respective bounding box labels per image in addition to the image caption. + +We also extended the AttnGAN by Xu et al. (2018b), the current state-of-the-art model on the MS-COCO data set (based on the Inception Score), with our object pathway to evaluate its impact on a different model. As opposed to the StackGAN, the AttnGAN consists of only one model which is trained end-to-end on the image captions by making use of multiple, intermediate, discriminators. Three discriminators judge the output of the generator at an image resolution of $6 4 \times 6 4$ , $1 2 8 \times 1 2 8$ , and $2 5 6 \times 2 5 6 \ : \mathrm { p x }$ . Through this, the image generation process is guided at multiple levels, which helps during the training process. Additionally, the AttnGAN implements an attention technique through which the networks focus on specific areas of the image for specific words in the image caption and adds an additional loss that checks if the image depicts the content as described by the image caption. There, in the same way as for the StackGAN, we added our object pathway at the beginning of the generator as well as to the discriminator that judges the generator outputs at a resolution of $6 4 \times 6 4 \mathrm { p x }$ . All other discriminators, the higher layers of the generator, and all other hyperparameters and training details stay unchanged. Table 1 shows that adding the object pathway to the AttnGAN increases the IS of our baseline model (the pretrained model provided by the authors) from 23.61 to 24.76, while the FID is roughly the same as for the baseline model. + +![](images/4e9c1e00bcda158b81163305c8ec34aff750f4ecbdfeb81a247e235f20303449.jpg) +Figure 4: Examples of images generated from the given caption from the MS-COCO data set. A) shows the original images and the respective image captions, $B$ ) shows images generated by our StackGAN $\mathrm { + O P }$ (with the corresponding bounding boxes for visualization), and $C _ { \cdot }$ ) shows images generated by the original StackGAN (Zhang et al., 2017)3 + +To evaluate whether the StackGAN model equipped with an object pathway $\mathrm { \ S t a c k G A N + O P }$ ) actually generates objects at the given positions we generated images that contain multiple objects and inspected them visually. Figure 4 shows some example images, more results can be seen in the Appendix in Figures 7 and 9. We can observe that the $\mathrm { S t a c k G A N + O P }$ indeed generates images in which the objects are at appropriate locations. In order to more closely inspect our global and object pathways, we can also disable them during the image generation process. Figure 5 shows additional examples, in which we generate the same image with either the global or the object pathway disabled during the generation process. Row C of Figure 5 shows images in which the object pathway was disabled and, indeed, we observe that the images contain mostly background information and objects at the location of the bounding boxes are either not present or of much less detail than when the object pathway is enabled. Conversely, row D of Figure 5 shows images which were generated when the global pathway was disabled. As expected, areas outside of the bounding boxes are empty, but we also observe that the bounding boxes indeed contain images that resemble the appropriate objects. These results indicate, as in the previous experiments, that the global pathway does indeed model holistic image features, while the object pathway focuses on specific, individual objects. + +When we add the object pathway to the AttnGAN $\mathrm { \Delta A t t n G A N + O P ) }$ we can observe similar results4. Again, we are able to control the location and identity of objects through the object pathway, however, we observe that the AttnGAN+OP, as well as the AttnGAN in general, tends to place objects corresponding to specific features at many locations throughout the image. For example, if the caption contains the word “traffic light” the AttnGAN tends to place objects similar to traffic lights throughout the whole image. Since our model only focuses on generating objects at given locations, while not enforcing that these objects only occur at these locations, this behavior leads to the result that the AttnGAN+OP generates desired objects at the desired locations, but might also place the same object at other locations within the image. Note, however, that we only added the object pathway to the lowest generator and discriminator and that we might gain even more control over the object location by introducing object pathways to the higher generators and discriminators, too. + +![](images/b164c6b003e8813aa5a1bdbe9b13a92b1bef465c6eb4cbede4b38aadb57db22b.jpg) +Figure 5: Examples of images generated from the given caption from the MS-COCO data set. A) shows the original images and the respective image captions, $B$ ) shows images generated by our $\mathrm { S t a c k G A N + O P }$ (with the corresponding bounding boxes for visualization) with the object pathway enabled, $C _ { \epsilon }$ ) shows images generated by the our StackGAN $\mathrm { + O P }$ when the object pathway is disabled, and $D$ ) shows images generated by the our StackGAN $\mathrm { + O P }$ when the global pathway is disabled. + +In order to further evaluate the quality of the generations, we ran an object detection test on the generated images using a pretrained YOLOv3 network (Redmon & Farhadi, 2018). Here, the goal is to measure how often an object detection framework, which was trained on MS-COSO as well, can detect a specified object at a specified location5. The results confirm the previously made observations: For both the StackGAN and the AttnGAN the object pathway seems to improve the image quality, since YOLOv3 detects a given object more often correctly when the images are generated with an object pathway as opposed to images generated with the baseline models. The StackGAN generates objects at the given bounding box, resulting in an Intersection over Union (IoU) of greater than 0.3 for all tested labels and greater than 0.5 for $8 6 . 7 \%$ of the tested labels. In contrast, the AttnGAN tends to place salient object features throughout the image, which leads to an even higher detection rate by the YOLOv3 network, but a smaller average IoU (only $5 3 . 3 \%$ of the labels achieve an IoU greater than 0.3). Overall, our experiments on the MS-COCO data set indicate that it is possible to add our object pathway to pre-existing GAN models without having to change the overall model architecture or training process. Adding the object pathway provides us with more control over the image generation process and can, in some cases, increase the quality of the generated images as measured via the IS or FID. + +# 4.4 DISCUSSION + +Our experiments indicate that we do indeed get additional control over the image generation process through the introduction of object pathways in GANs. This enables us to control the identity and location of multiple objects within a given image based on bounding boxes and thereby facilitates the generation of more complex scenes. We further find that the division of work on a global and object pathway seems to improve the image quality both subjectively and based on quantitative metrics such as the Inception Score and the Frechet Inception Distance. ´ + +The results further indicate that the focus on global image statistics by the global pathway and the more fine-grained attention to detail of specific objects by the object pathway works well. This is visualized for example in rows C and D of Figure 5. The global pathway (row C) generates features for the general image layout and background but does not provide sufficient details for individual objects. The object pathway (row D), on the other hand, focuses entirely on the individual objects and generates features specifically for a given object at a given location. While this is the desired behavior of our model it can also lead to sub-optimal images if there are not bounding boxes for objects that should be present within the image. This can often be the case if the foreground object is too small (in our case less than $2 \%$ of the total image) and is therefore not specifically labeled. In this case, the objects are sometimes not modeled in the image at all, despite being prominent in the respective image caption, since the object pathway does not generate any features. We can observe this, for example, in images described as “many sheep are standing on the grass”, where the individual sheep are too small to warrant a bounding box. In this case, our model will often only generate an image depicting grass and other background details, while not containing any sheep at all. + +Another weakness is that bounding boxes that overlap too much (empirically an overlap of more than roughly $30 \%$ ) also often lead to sub-optimal objects at that location. Especially in the overlapping section of bounding boxes we often observe local inconsistencies or failures. This might be the result of our merging of the different features within the object pathway since they are simply added to each other at overlapping areas. A more sophisticated merging procedure could potentially alleviate this problem.Another approach would be to additionally enhance the bounding box layout by predicting the specific object shape within each bounding box, as done for example by Hong et al. (2018b). + +Finally, currently our model does not generate the bounding boxes and labels automatically. Instead, they have to be provided at test time which somewhat limits the usability for unsupervised image generation. However, even when using ground truth bounding boxes, our models still outperform other current approaches that are tested with ground truth bounding boxes (e.g. Hong et al. (2018b)) based on the IS and FID. This is even without the additional need of learning to specify the shape within each bounding box as done by Hong et al. (2018b). In the future, this limitation can be avoided by extracting the relevant bounding boxes and labels directly from the image caption, as it is done for example by Hong et al. (2018b), Xu et al. (2018a), and Tan et al. (2018). + +# 5 CONCLUSION + +With the goal of understanding how to gain more control over the image generation process in GANs, we introduced the concept of an additional object pathway. Such a mechanism for differentiating between a scene representation and object representations allows us to control the identity, location, and size of arbitrarily many objects within an image, as long as the objects do not overlap too strongly. In parallel, a global pathway, similar to a standard GAN, focuses on the general scene layout and generates holistic image features. The object pathway, on the other hand, gets as input an object label and uses this to generate features specifically for this object which are then placed at the location given by a bounding box The object pathway is applied iteratively for each object at each given location and as such, we obtain a representation of individual objects at individual locations and of the general image layout (background, etc.) as a whole. The features generated by the object and global pathway are then concatenated and are used to generate the final image output. Our tests on synthetic and real-world data sets suggest that the object pathway is an extension that can be added to common GAN architectures without much change to the original architecture and can, along with more fine-grained control over the image layout, also lead to better image quality. + +# ACKNOWLEDGMENTS + +The authors gratefully acknowledge partial support from the German Research Foundation DFG under project CML (TRR 169) and the European Union under project SECURE (No 642667). We also thank the NVIDIA Corporation for their support through the GPU Grant Program. + +# REFERENCES + +Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 39–48, 2016. + +Qifeng Chen and Vladlen Koltun. Photographic image synthesis with cascaded refinement networks. In IEEE International Conference on Computer Vision, pp. 1520–1529, 2017. + +S. M. Ali Eslami, Nicolas Heess, Theophane Weber, Yuval Tassa, David Szepesvari, koray kavukcuoglu, and Geoffrey E Hinton. Attend, infer, repeat: Fast scene understanding with generative models. In Advances in Neural Information Processing Systems, pp. 3225–3233, 2016. + +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. + +Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems, pp. 6626–6637, 2017. + +Seunghoon Hong, Xinchen Yan, Thomas Huang, and Honglak Lee. Learning hierarchical semantic image manipulation through structured representations. In Advances in Neural Information Processing Systems, pp. 2712–2722, 2018a. + +Seunghoon Hong, Dingdong Yang, Jongwook Choi, and Honglak Lee. Inferring semantic layout for hierarchical text-to-image synthesis. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7986–7994, 2018b. + +Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. In Advances in Neural Information Processing Systems, pp. 2017–2025, 2015. + +Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1988–1997, 2017. + +Justin Johnson, Agrim Gupta, and Li Fei-Fei. Image generation from scene graphs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1219–1228, 2018. + +Levent Karacan, Zeynep Akata, Aykut Erdem, and Erkut Erdem. Learning to generate images of outdoor scenes from attributes and semantic layouts. arXiv preprint arXiv:1612.00215, 2016. + +Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European Conference on Computer Vision, pp. 740–755, 2014. + +Elman Mansimov, Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Generating images from captions with attention. In International Conference on Learning Representations, 2016. + +Anh Nguyen, Yoshua Bengio, and Alexey Dosovitskiy. Plug & play generative networks: Conditional iterative generation of images in latent space. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4467–4477, 2017. + +Amit Raj, Cusuh Ham, Huda Alamri, Vincent Cartillier, Stefan Lee, and James Hays. Compositional generation of images. In Advances in Neural Information Processing Systems ViGIL, 2017. + +Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018. + +Scott Reed, Zeynep Akata, Santosh Mohan, Samuel Tenka, Bernt Schiele, and Honglak Lee. Learning what and where to draw. In Advances in Neural Information Processing Systems, pp. 217–225, 2016a. + +Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In International Conference on Machine Learning, pp. 1060–1069, 2016b. + +Scott Reed, Aaron van den Oord, Nal Kalchbrenner, Victor Bapst, Matt Botvinick, and Nando ¨ de Freitas. Generating interpretable images with controllable structure. 2016c. + +Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pp. 2234–2242, 2016. + +Shikhar Sharma, Dendi Suhubdy, Vincent Michalski, Samira Ebrahimi Kahou, and Yoshua Bengio. Chatpainter: Improving text to image generation using dialogue. In International Conference on Learning Representations Workshop, 2018. + +Fuwen Tan, Song Feng, and Vicente Ordonez. Text2scene: Generating abstract scenes from textual descriptions. arXiv preprint arXiv:1809.01110, 2018. + +Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The caltech-ucsd birds-200-2011 dataset. 2011. + +Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8798–8807, 2018. + +Kun Xu, Haoyu Liang, Jun Zhu, Hang Su, and Bo Zhang. Deep structured generative models. In ICML Workshop on Theoretical Foundations and Applications of Deep Generative Models, 2018a. + +Tao Xu, Pengchuan Zhang, Qiuyuan Huang, Han Zhang, Zhe Gan, Xiaolei Huang, and Xiaodong He. Attngan: Fine-grained text to image generation with attentional generative adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018b. + +Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaolei Huang, Xiaogang Wang, and Dimitris Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. In IEEE International Conference on Computer Vision, pp. 5907–5915, 2017. + +Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris Metaxas. Stackgan $^ { + + }$ : Realistic image synthesis with stacked generative adversarial networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 1–16, 2018a. + +Shengyu Zhang, Hao Dong, Wei Hu, Yike Guo, Chao Wu, Di Xie, and Fei Wu. Text-to-image synthesis via visual-memory creative adversarial network. In Pacific Rim Conference on Multimedia, pp. 417–427, 2018b. + +Zizhao Zhang, Yuanpu Xie, and Lin Yang. Photographic text-to-image synthesis with a hierarchicallynested adversarial network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6199–6208, 2018c. + +# A IMPLEMENTATION DETAILS + +Here we provide some more details about the exact implementation of our experiments. + +# A.1 MULTI-MNIST AND CLEVR + +To train our GAN approach on the Multi-MNIST (CLEVR) data set we use the Stage-I Generator and Discriminator from the StackGAN MS-COCO architecture6. In our following description an upsample block describes the following sequence: nearest neighbor upsampling with factor 2, a convolutional layer with $X$ filters (filter size $3 \times 3$ , stride 1, padding 1), batch normalization, and a ReLU activation. The bounding box labels are one-hot vectors of size [1, 10] encoding the digit identity (CLEVR: [1, 13] encoding object shape and color). Please refer to Table 2 for detailed information on the individual layers described in the following. For all leaky ReLU activations alpha was set to 0.2. + +In the object pathway of the generator we first create a zero tensor $\mathbb { O } _ { G }$ which will contain the feature representations of the individual objects. We then spatially replicate each bounding box label into a $4 \times 4$ layout of shape $( 1 0 , 4 , 4 )$ (CLEVR: $( 1 3 , 4 , 4 ) ,$ ) and apply two upsampling blocks. The resulting tensor is then added to the tensor $\mathbb { O } _ { G }$ at the location of the bounding box using a spatial transformer network. + +In the global pathway of the generator we first obtain the layout encoding. For this we create a tensor of shape (10, 16, 16) (CLEVR: (13, 16, 16)) that contains the one-hot labels at the location of the bounding boxes and is zero everywhere else. We then apply three convolutional layers, each followed by batch normalization and a leaky ReLU activation. We reshape the output to shape $( 1 , 6 4 )$ and concatenate it with the noise tensor of shape $( 1 , 1 0 0 )$ (sampled from a random normal distribution) to form a tensor of shape $( 1 , 1 6 4 )$ . This tensor is then fed into a dense layer, followed by batch normalization and a ReLU activation and the output is reshaped to $( - 1 , 4 , 4 )$ . We then apply two upsampling blocks to obtain a tensor of shape $( - 1 , 1 6 , 1 6 )$ . + +At this point, the outputs of the object and the global pathway are concatenated along the channel axis to form a tensor of shape $( - 1 , 1 6 , 1 6 )$ . We then apply another two upsampling blocks resulting in a tensor of shape $( - 1 , 6 4 , 6 \dot { 4 } )$ followed by a convolutional layer and a TanH activation to obtain the final image of shape $( - 1 , 6 4 , 6 4 )$ . + +In the object pathway of the discriminator we first create a zero tensor $\mathbb { O } _ { D }$ which will contain the feature representations of the individual objects. We then use a spatial transfomer network to extract the image features at the locations of the bounding boxes and reshape them to a tensor of shape $( 1 , 1 6 , 1 6 )$ (CLEVR: $( 3 , 1 6 , 1 6 ) _ { \cdot }$ ). The one-hot label of each bounding box are spatially replicated to a shape of (10, 16, 16) (CLEVR: (13, 16, 16)) and concatenated with the previously extracted features to form a tensor of shape (11, 16, 16) (CLEVR: (16, 16, 16)). We then apply a convolutional layer, batch normalization and a leaky ReLU activation to the concatenation of features and label and, again, use a spatial transformer network to resize the output to the shape of the respective bounding box before adding it to the tensor $\mathbb { O } _ { D }$ . + +In the global pathway of the discriminator, we apply two convolutional layers, each followed by batch normalization and a leaky ReLU activation and concatenate the resulting tensor with the output of the object pathway. After this, we again apply two convolutional layers, each followed by batch normalization and a leaky ReLU activation. We concatenate the resulting tensor with the conditioning information about the image content, in this case, the sum of all one-hot vectors. To this tensor we apply another convolutional layer, batch normalization, a leaky ReLU activation, and another convolutional layer, to obtain the final output of the discriminator of shape (1). + +Similarly to the procedure of StackGAN and other conditional GANs we train the discriminator to classify real images with correct labels (the sum of one-hot vectors supplied in the last step of the process) as real, while generated images with correct labels and real images with (randomly sampled) incorrect labels should be classified as fake. + +# A.2 MS-COCO + +StackGAN-Stage-I For training the Stage-I generator and discriminator (images of size $6 4 \times 6 4$ pixels) we follow the same procedure and architecture outlined in the previous section about the training on the Multi-MNIST and CLEVR data sets. The only difference is that we now have image captions as an additional description of the image. As such, to obtain the bounding box labels we concatenate the image caption embedding7 and the one-hot encoded bounding box label and apply a dense layer with 128 units, batch normalization, and a ReLU activation to it, to obtain a label of shape $( 1 , 1 2 8 )$ for each bounding box. In the final step of the discriminator when we concatenate the feature representation with the conditioning vector, we use the image encoding as conditioning vector and do not use any bounding box labels at this step. The rest of the training proceeds as described in the previous section, except that the bounding box labels now have a shape of $( 1 , 1 2 8 )$ . All other details can be found in Table 2. + +StackGAN-Stage-II In the second part of the training, we train a second generator and discriminator to generate images with a resolution of $2 5 6 \times 2 5 6$ pixels. The generator gets as input images with a resolution of $6 4 \times 6 4$ pixels (generated by the trained Stage-I generator) and the image caption and uses them to generate images with a $2 5 6 \times 2 5 6$ pixels resolution. A new discriminator is trained to distinguish between real and generated images. + +On the Stage-II generator we perform the following modifications we use the same procedure as in the Stage-I generator to obtain the bounding box labels. To obtain an image encoding from the generated $6 4 \times 6 4$ image we use three convolutional layers, each followed by batch normalization and a ReLU activation to obtain a feature representation of shape $[ - 1 , 1 6 , 1 6 ]$ . Additionally, we replicate each bounding box label (obtained with the dense layer) spatially at the locations of the bounding boxes on an empty canvas of shape [128, 16, 16] and then concatenate it along the channel axis with the image encoding and the spatially replicated image caption embedding. As in the standard StackGAN we then apply more convolutional layers with residual connections to obtain the final image embedding of shape $[ - 1 , 1 6 , 1 6 ]$ , which provides the input for both the object and the global pathway. + +The generator’s object pathway gets as input the image encoding described in the previous step. First, we create a zero tensor $\mathbb { O } _ { G }$ which will contain the feature representations of the individual objects. We then use a spatial transformer network to extract the features from within the bounding box and reshapes those features to $[ - 1 , 1 6 , 1 6 ]$ . After this, we apply two upsample blocks and then use a spatial transformer network to add the features to $\mathbb { O } _ { G }$ within the bounding box region. This is done for each of the bounding boxes within the image. + +The generator’s global pathway gets as input the image encoding and uses the same convolutional layers and upsampling procedures as the original StackGAN Stage-II generator. The outputs of the object and global pathway are merged at the resolution of $[ - 1 , 6 4 , 6 4 ]$ by concatenating the two outputs along the channel axis. After this, we continue using the standard StackGAN architecture to generate images of shape [3, 256, 256]. + +The Stage-II discriminator’s object pathway first creates a zero tensor $\mathbb { O } _ { D }$ which will contain the feature representations of the individual objects. It gets as input the image (resolution of $2 5 6 \times 2 5 6$ pixels) and we use a spatial transformer network to extract the features from the bounding box and reshape those features to a shape of [3, 32, 32]. We spatially replicate the bounding box label (one-hot encoding) to a shape of $[ - 1 , \bar { 3 2 } , 3 2 ]$ and concatenate it with the extracted features along the channel axis. This is then given to the object pathway which consists of two convolutional layers with batch normalization and a LeakyReLU activation. The output of the object pathway is again transformed to the width and height of the bounding box with a spatial transformer network and then added to $\mathbb { O } _ { D }$ This procedure is performed with each of the bounding boxes within the image (maximum of three during training). + +The Stage-II discriminator’s global pathway consists of the standard StackGAN layers, i.e. it gets as input the image $( 2 5 6 \times 2 5 6$ pixels) and applies convolutional layers with stride 2 to it. The outputs of the object and global pathways are merged at the resolution of $[ - 1 , 3 2 , 3 2 ]$ by concatenating the two outputs along the channel axis We then apply more convolutional with stride 2 to decrease the resolution. After this, we continue in the same way as the original StackGAN. + +AttnGAN On the AttnGAN8 we only modify the training at the lower layers of the generator and the first discriminator (working on images of $6 4 \times 6 4$ pixels resolution). For this, we perform the same modifications as described in the StackGAN-Stage-I generator and discriminator. In the generator we obtain the bounding box labels in the same way as in the StackGAN, by concatenating the image caption embedding with the respective one-hot vector and applying a dense layer with 100 units, batch normalization, and a ReLU activation to obtain a bounding box label. In contrast to the previous architectures, we follow the AttnGAN implementation in use the gated linear unit function (GLU) as standard activation for our convolutional layers in the generator. + +In the generator’s object pathway we first create a zero tensor $\mathbb { O } _ { G }$ of shape (192, 16, 16) which will contain the feature representations of the individual objects. We then spatially replicate each bounding box label into a $4 \times 4$ layout of shape $( 1 0 0 , 4 , 4 )$ and apply two upsampling blocks with 768 and 384 filters (filter size $\mathrm { = 3 }$ , stride ${ \mathrm { : = } } 1$ , padding ${ = } 1$ ). The resulting tensor is then added to the tensor $\mathbb { O } _ { G }$ at the location of the bounding box using a spatial transformer network. + +In the global pathway of the generator we first obtain the layout encoding in the same way as in the StackGAN-I generator, except that the three convolutional layers of the layout encoding now have 50, 25, and 12 filters respectively (filter size $\scriptstyle = 3$ , stride ${ \it \Omega } = 2 { \it \Omega }$ , padding ${ \tt = } 1$ ). We concatenate it with the noise tensor of shape $( 1 , 1 0 0 )$ (sampled from a random normal distribution) and the image caption embedding to form a tensor of shape (1, 248). This tensor is then fed into a dense layer with 24,576 units, followed by batch normalization and a ReLU activation and the output is reshaped to (768, 4, 4). We then apply two upsampling blocks with 768 and 384 filters to obtain a tensor of shape (192, 16, 16). + +At this point the outputs of the object and the global pathways are concatenated along the channel axis to form a tensor of shape (384, 16, 16). We then apply another two upsampling blocks with 192 and 96 filters, resulting in a tensor of shape (48, 64, 64). This feature representation is then used by the following layers of the AttnGAN generator in the same way as detailed in the original paper and implementation. + +In the object pathway of the discriminator we first create a zero tensor $\mathbb { O } _ { D }$ which will contain the feature representations of the individual objects. We then use a spatial transfomer network to extract the image features at the locations of the bounding boxes and reshape them to a tensor of shape (3, 16, 16). The one-hot label of each bounding box is spatially replicated to a shape of $( - 1 , 1 6 , 1 6 )$ and concatenated with the previously extracted features. We then apply a convolutional layer with 192 filters (filter size ${ = } 4$ , stride ${ \boldsymbol { \mathbf { \mathit { \varepsilon } } } } = 1$ , padding ${ \mathrm { = } } 1$ ), batch normalization and a leaky ReLU activation to the concatenation of features and label and, again, use a spatial transformer network to resize the output to the shape of the respective bounding box before adding it to the tensor $\mathbb { O } _ { D }$ . + +In the global pathway of the discriminator we apply two convolutional layers with 96 and 192 filters (filter size ${ = } 4$ , stride ${ \it \Omega } = 2 { \it \Omega }$ , padding ${ = } 1$ ), each followed by batch normalization and a leaky ReLU activation and concatenate the resulting tensor with the output of the object pathway. After this, we again apply two convolutional layers with 384 and 768 filters (filter size ${ = } 4$ , stride ${ \boldsymbol { \mathbf { \mathit { \sigma } } } } = 2 { \boldsymbol { \mathbf { \mathit { \varepsilon } } } }$ , padding ${ \tt = } 1$ ), each followed by batch normalization and a leaky ReLU activation. We concatenate the resulting tensor with the spatially replicated image caption embedding. To this tensor we apply another convolutional layer with 768 filters (filter size $\scriptstyle = 3$ , stride ${ = } 1$ , padding ${ \boldsymbol { \mathbf { \rho } } } = 1$ ), batch normalization, a leaky ReLU activation, and another convolutional layer with one filter (filter size ${ = } 4$ , stride ${ = } 4$ , padding ${ = } 0$ ), to obtain the final output of the discriminator of shape (1). The rest of the training and all other hyperparameters and architectural values are left the same as in the original implementation. + +
ublisnedasaconierencepaperatiCLR2019Multi-MNISTCLEVRMS-COCO-IMS-COCO-II
Adam (beta1 = 0.5, betaz = 0.999)
Optimizer0.00020.00020.00020.0002
Learning Rate Schedule: halve every
x epochs10202020
Training Epochs2040120110
Batch Size12812812840
Weight InitializationN(0,0.02)N(0,0.02)N(0,0.02)N(0,0.02)
Z-Dim/ Img-Caption-Dim100/10100/13100/128100/128
Generator
Image Encoder
Conv (fs=3, s=1, p=1) Conv (fs=4, s=2, p=1)192
Conv (fs=4, s=2, p=1)384
Concat with image768
caption and bbox labels(1024,16,16)
Conv (fs=3, str=1, pad=1)768
4 × Res. (fs=3,s=1,p=1)768
Object Pathway
Og Shape(256,16,16)(192,16,16)(384,16,16)(192,64,64)
Upsample (fs=3, s=1, p=1)512384768384
Upsample (fs=3,s=1, p=1)256192384192
Output Shape Global Pathway(256,16,16)(192,16,16)(384,16,16)(192,64,64)
Layout Encoding
Conv (fs=3,s=2, p=1)646464
Conv (fs=3, s=2, p=1)323232
Conv (fs=3, s=2, p=1)161616
Dense Layer Units16,38412,28824,576
Upsample (fs=3, s=1, p=1)512384768384
Upsample (fs=3,s=1, p=1)256192384192
Output Shape(256,16,16)192,16,16)(384,16,16)(192,64,64)
Concat outputs of object(512,16,16)(384,16,16)(768,16,16)(384,64,64)
and global pathways12896192
Upsample (fs=3, s=1, p=1) Upsample (fs=3, s=1, p=1)64489696 48
Conv (fs=3,s=1, p=1)1333
Generator Output(1,64,64)(3,64,64)(3,64,64)(3,256,256)
Discriminator
Object Pathway
OD Shape(128,16,16)(96,16,16)(192,16,16)(192,32,32)
Conv (fs=4, s=1, p=1)12896192192
Conv (fs=4, s=1, p=1)192
Output Shape(128,16,16)(96,16,16)(192,16,16)(192,32,32)
Global Pathway
Conv (fs=4, s=2, p=1)64489696
Conv (fs=4, s=2, p=1)12896192192
Conv (fs=4, s=2, p=1)384
Output Shape(128,16,16)(96,16,16)(192,16,16)(384,32,32)
Concat outputs of object(256,16,16)(192,16,16)(384,16,16)(576,32,32)
and global pathways256
Conv (fs=4, s=2, p=1) Conv (fs=4, s=2, p=1)512192384 768768
Conv (fs=4, s=2, p=1)3841,536 3,072
Conv (fs=3, s=1,p=1)1,536
Conv (fs=3, s=1,p=1)768
Concat with(522,4,4)(397,4,4)(896,4,4)(896,4,4)
conditioning vector Conv (fs=3, s=1, p=1)512384768768
+ +Table 2: Overview of the individual layers used in our networks to generate images of resolution $6 4 \times 6 4 / 2 5 6 \times 2 5 6$ pixels. Values in brackets $( C , H , W )$ represent the tensor’s shape. Numbers in the columns after convolutional, residual, or dense layers describe the number of filters / units in that layer. $\scriptstyle ( \mathbf { f s } = x , \mathbf { s } = y , \mathbf { p } = z )$ describes filter size, stride, and padding for that convolutional / residual layer. + +# B ADDITIONAL EXAMPLES OF MULTI-MNIST RESULTS: TRAINING AND TEST SET OVER COMPLEMENTARY REGIONS + +![](images/28e93a0c75c554c0c656bb190f886f6ffde0dde485bfd94e67c834b6190c8f87.jpg) +Figure 6: Systematic test of digits over vertically different regions. Training set included three normal-sized digits only in the top half of the image. Highlighted bounding boxes and yellow ground truth for visualization. We can see that the model fails to generate recognizable digits once their location is too far in the bottom half of the image, as this location was never observed during training. + +# C ADDITIONAL EXAMPLES OF MS-COCO RESULTS: STACKGAN + +Figure 7 shows results of text-to-image synthesis on the MS-COCO data set with the StackGAN architecture. Rows A show the original image and image caption, rows B show the images generated by our StackGAN $^ +$ Object Pathway and the given bounding boxes for visualization, and rows C show images generated by the original StackGAN (pretrained model obtained from https: //github.com/hanzhanggit/StackGAN-Pytorch). The last block of examples (last row) show typical failure cases of our model, where there is no bounding box for the foreground object present. As a result our model only generates the background, without the appropriate foreground object, even though the foreground object is very clearly described in the image caption. Figure 9 provides similar results but for random bounding box positions. The first six examples show images generated by our StackGAN where we changed the location and size of the respective bounding boxes. The last three examples show failure cases in which we changed the location of the bounding boxes to “unusual” locations. For the image with the child on the bike, we put the bounding box of the bike somewhere in the top half of the image and the bounding box for the child somewhere in the bottom part. Similarly, for the man sitting on a bench, we put the bench in the top and the man in the bottom half of the image. Finally, for the image depicting a pizza on a plate, we put the plate location in the top half of the image and the pizza in the bottom half. + +# D ADDITIONAL EXAMPLES OF MS-COCO RESULTS: ATTNGAN + +Figure 8 shows results of text-to-image synthesis on the MS-COCO data set with the AttnGAN architecture. Rows A show the original image and image caption, rows B show the images generated by our AttnGAN $^ +$ Object Pathway and the given bounding boxes for visualization, and rows C show images generated by the original AttnGAN (pretrained model obtained from https: //github.com/taoxugit/AttnGAN). The last block of examples (last row) show typical failure cases, in which the model does generate the appropriate object within the bounding box, but also places the same object at multiple other locations within the image. Similarly as for StackGAN, Figure 10 shows images generated by our AttnGAN where we randomly change the location of the various bounding boxes. Again, the last three examples show failure cases where we put the locations of the bounding boxes at “uncommon” positions. In the image depicting the sandwiches we put the location of the plate in the top half of the image, in the image with the dogs we put the dogs’ location in the top half, and in the image with the motorbike we put the human in the left half and the motorbike in the right half of the image. + +![](images/664453153211417de0248a52af7600231adcfd38c67addcf35aba7f895de2d88.jpg) +Figure 7: Additional StackGAN examples – refer to page 17 for information about the figure. + +![](images/29498a6b144e65acaf98e0663098a38c20429db5742e13e5287e4a9ebb84a25d.jpg) +Figure 8: Additional AttnGAN examples – refer to page 17 for more information about the figure. + +![](images/fb6fc463bd22fca65ef30c87b255a971690f371444a47abf0d2590d953172b8b.jpg) +Figure 9: StackGAN examples with random locations – refer to page 17 for more information. + +![](images/899d938a8a58ac7f554099420a1e7368902ad8dc4626971c650096a11e1d695a.jpg) +Figure 10: AttnGAN examples with random locations – refer to page 17 for more information. + +
LabelOccurrencesWords in captions
PersonDining table13773person,people,human,man,men,woman,women,childtable, deskcar,auto, vehicle,cab
3130
Car1694
Cat1658cat
Dog1543dog
Bus1198bus
Train1188train
Bed984bed
Pizza906pizza
Horse874horse
Giraffe828giraffe
Toilet797toilet
Bear777bear
Bench732bench
+ +Table 3: Words that were used to identify given labels in the image caption for the YOLOv3 object detection test. + +
LabelOccurrencesWords in captions
Umbrella727umbrella
Elephant708elephant
Chair632chair, stool
Zebra627zebra
Boat627boat
Bird610bird
Aeroplane602plane
Bicycle600bicycle
Surfboard595surfboard
Kite593kite
Truck561truck
Stop sign522stop
TV Monitor471tv,monitor, screen
Sofa467sofa, couch
Sandwich387sandwich
Sheep368sheep
+ +# E OBJECT DETECTION ON MS-COCO IMAGES + +To further inspect the quality of the location and recognizability of the generated objects within an image, we ran a test on object detection using a YOLOv3 network Redmon & Farhadi (2018) that was also pretrained on the MS-COCO data set9. We use the Pytorch implementation from https://github.com/ayooshkathuria/pytorch-yolo-v3 to get the bounding box and label predictions for our images. We follow the standard guidelines and keep all hyperparameters for the YOLOv3 network as in the implementation. We picked the 30 most common training labels (based on how many captions contain these labels) and evaluate the models on these labels, see Table 3. + +In the following, we evaluate how often the pretrained YOLOv3 network recognizes a specific object within a generated image that should contain this object based on the image caption. For example, we expect an image generated from the caption “a young woman taking a picture with her phone” to contain a person somewhere in the image and we check whether the YOLOv3 network actually recognizes a person in the generated image. Since the baseline StackGAN and AttnGAN only receive the image caption as input (no bounding boxes and no bounding box labels) we decided to only use captions that clearly imply the presence of the given label (see Table 3). We chose this strategy in order to allow for a fair comparison of the resulting presence or absence of a given object. Specifically, for a given label we choose all image captions from the test set that contain one of the associated words for this label (associated words were chosen manually, see Table 3) and then generated three images for each caption with each model. Finally, we counted the number of images in which the given object was detected by the YOLOv3 network. Table 4 shows the ratio of images for each label and each model in which the given object was detected at any location within the image. + +Additionally, for our models that also receive the bounding boxes as input, we calculated the Intersection over Union (IoU) between the ground truth bounding box (the bounding box supplied to the model) and the bounding box predicted by the YOLOv3 network for the recognized object. Table 4 presents the average IoU (for the models that have an object pathway) for each object in the images in which YOLOv3 detected the given object. For each image in which YOLOv3 detected the given object, we calculated the IoU between the predicted bounding box and the ground truth bounding box for the given object. In the cases in which either an image contains multiple instances of the given object (i.e. multiple different bounding boxes for this object were given to the generator) or YOLOv3 detects the given object multiple times we used the maximum IoU between all predicted and ground truth bounding boxes for our statistics. + +![](images/5fe525623a2030a61e5e3b26302412c1690b0c3b7bb3a2082c72c5ce8e1cf86d.jpg) +Figure 11: Distribution of recall and IoU values in the YOLOv3 object detection test. + +Figure 11 visualizes how the IoU and recall values are distributed for the different models, and Table 4 summarizes the results with the 30 tested labels. We can observe that the StackGAN with object pathway outperforms the original StackGAN when comparing the recall of the YOLOv3 network, i.e. in how many images with a given label the YOLOv3 network actually detected the given object. The recall of the original StackGAN is higher than $1 0 \%$ for $2 6 . 7 \%$ of the labels, while our StackGAN with object pathway results in a recall greater than $1 0 \%$ for $6 0 \%$ of the labels. The IoU is greater than 0.3 for every label, while $8 6 . 7 \%$ of the labels result an IoU of greater than 0.5 (original images: $1 0 0 \%$ ) and $3 0 \%$ have an IoU of greater than 0.7 (original images: $9 6 . 7 \%$ ). This indicates that we can indeed control the location and identity of various objects within the generated images. + +Compared to the StackGAN, the AttnGAN achieves a much greater recall, with $8 0 \%$ and $8 3 . 3 \%$ of the labels having a recall of greater than $1 0 \%$ for the original AttnGAN and the AttnGAN with object pathway respectively. The difference in recall values between the original AttnGAN and the AttnGAN with object pathway is also smaller, with our AttnGAN having a higher (lower) recall than the original AttnGAN (we only count cases where the difference is at least $5 \%$ ) in $2 6 . 7 \%$ $( 1 3 . 3 \% )$ of the labels. The average IoU, on the other hand, is a lot smaller for the AttnGAN than for the StackGAN. We only achieve an IoU greater than 0.3 (0.5, 0.7) for $5 3 . 3 \%$ $( 3 . 3 \% , 0 \% )$ of the labels. As mentioned in the discussion (subsection 4.4), we attribute this to the observation that the AttnGAN tends to place seemingly recognizable features of salient objects at arbitrary locations throughout the image. This might attribute to the overall higher recall but may negatively affect the IoU. + +Overall, these results further confirm our previous experiments and highlight that the addition of the object pathway to the different models does not only enable the direct control of object location and identity but can also help to increase the image quality. The increase in image quality is supported by a higher Inception Score, lower Frechet Inception Distance (for StackGAN) and a higher performance ´ of the YOLOv3 network in detecting objects within generated images. + +Table 4: Results of YOLOv3 detections on generated and original images. Recall provides the fraction of images in which YOLOv3 detected the given object. IoU (Intersection over Union) measures the maximum IoU per image in which the given object was detected. + +
LabelOrig. Img.Recall IoUStackGANRecallStackGAN+ OPRecall IoUAttnGANAttnGAN + OPRecall IoU
Recall
Person.943.824.355.451± .019.624± .012.598.610 ± .008.276 ± .006
Dining table.355.774.007.022 ± .004.734± .011.069.045± .022.490 ± .018
Car.433.792.012.047± .007.622 ± .020.006.063± .010.144 ± .043
Cat.715.821.021.104± .100.622 ± .008.423.430± .066.350 ± .012
Dog.703.819.068.150± .007.601 ± .004.450.488± .048.311 ± .007
Bus.747.877.161.393 ± .031.794± .009.352.416± .032.374± .006
Train.900.835.133.310 ± .033.700± .007.393.438 ± .110.355 ± .036
Bed.775.789.032.141 ± .018.701± .001.539.552± .030.505 ± .002
Pizza.912.842.119.485 ± .101.786 ± .004.444.660 ± .054.395 ± .016
Horse.933.842.129.330 ± .048.585± .039.532.619± .027.300 ± .006
Giraffe.972.857.173.467 ± .035.606 ± .030.472.650± .084.365 ± .030
Toilet.898.826.005.122 ± .021.690 ± .010.201.220± .021.224± .011
Bear.381.859.015.120 ± .018.720 ± .036.319.303±.028.357 ± .010
Bench.828.798.001.030 ± .008.627± .034.094.094± .031.308 ± .018
Umbrella.912.762.001.023± .009.578 ± .030.060.063± .017.154± .053
Elephant.940.867.060.414± .069.688 ± .033.350.500± .141.353 ± .006
Chair.757.755.014.039 ± .004.488 ± .039.070.093 ± .005.225 ± .001
Zebra.972.875.732.781± .023.686 ± .017.870.766± .063.315 ± .022
Boat.795.709.077.010± .011.594± .021.168.202 ± .027.206 ± .020
Bird.837.781.059.097± .027.500 ± .066.322.357 ± .042.250 ± .020
Aeroplane.912.812.125.223 ± .043.667± .026.499.415 ± .010.320 ± .035
Bicycle.825.760.007.053 ± .020.558 ± .052.170.191± .013.233 ± .024
Surfboard.873.780.030.067 ± .019.459 ± .056.104.110± .025.143 ± .016
Kite.772.633.029.057± .028.426 ± .086.260.162 ± .068.120 ± .018
Truck.887.832.082.243 ± .062.717 ± .022.378.367± .027.393 ± .019
Stop Sign.527.874.001.261± .057.780 ± .011.070.124± .048.101± .014
TV Monitor.818.833.037.264± .005.765 ± .016.529.435 ± .314.243± .066
Sofa.878.794.012.087 ± .024.628 ± .044.170.191 ± .057.329 ± .028
Sandwich.792.796.045.139 ± .049.628 ± .014.340.370± .054.318 ± .031
Sheep.943.727.004.091± .006.460 ± .011.250.304± .037.116 ± .022
\ No newline at end of file diff --git a/md/train/H1ltQ3R9KQ/H1ltQ3R9KQ.md b/md/train/H1ltQ3R9KQ/H1ltQ3R9KQ.md new file mode 100644 index 0000000000000000000000000000000000000000..70033c21e91dcd4ddc81208e5372c74227790a88 --- /dev/null +++ b/md/train/H1ltQ3R9KQ/H1ltQ3R9KQ.md @@ -0,0 +1,300 @@ +# CAUSAL REASONING FROM META REINFORCEMENT LEARNING + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Discovering and exploiting the causal structure in the environment is a crucial challenge for intelligent agents. Here we explore whether modern deep reinforcement learning can be used to train agents to perform causal reasoning. We adopt a meta-learning approach, where the agent learns a policy for conducting experiments via causal interventions, in order to support a subsequent task which rewards making accurate causal inferences. We also found the agent could make sophisticated counterfactual predictions, as well as learn to draw causal inferences from purely observational data. Though powerful formalisms for causal reasoning have been developed, applying them in real-world domains can be difficult because fitting to large amounts of high dimensional data often requires making idealized assumptions. Our results suggest that causal reasoning in complex settings may benefit from powerful learning-based approaches. More generally, this work may offer new strategies for structured exploration in reinforcement learning, by providing agents with the ability to perform—and interpret—experiments. + +# 1 INTRODUCTION + +Many machine learning algorithms are rooted in discovering patterns of correlation in data. While this has been sufficient to excel in several areas (Krizhevsky et al., 2012; Cho et al., 2014), sometimes the problems we are interested in are fundamentally causal. Answering questions such as “Does smoking cause cancer?” or “Was this person denied a job due to racial discrimination?” or “Did this marketing campaign cause sales to go up?” all require an ability to reason about causes and effects and cannot be achieved by purely associative inference. Even for problems that are not obviously causal, like image classification, it has been suggested that some failure modes emerge from lack of causal understanding. Causal reasoning may be an essential component of natural intelligence and is present in human babies, rats and even birds (Leslie, 1982; Gopnik et al., 2001; 2004; Blaisdell et al., 2006; Lagnado et al., 2013). There is a rich literature on formal approaches for defining and performing causal reasoning (Pearl, 2000; Spirtes et al., 2000; Dawid, 2007; Pearl et al., 2016). + +Here we investigate whether procedures for learning and using causal structure can be produced by meta-learning. The approach of meta-learning is to learn the learning (or inference) procedure itself, directly from data. We adopt the specific method of Duan et al. (2016) and Wang et al. (2016), training a recurrent neural network (RNN) through model-free reinforcement learning. We train on a large family of tasks, each underpinned by a different causal structure. + +The use of meta-learning avoids the need to manually implement explicit causal reasoning methods in an algorithm, offers advantages of scalability by amortizing computations, and allows automatic incorporation of complex prior knowledge (Andrychowicz et al., 2016; Wang et al., 2016; Finn et al., 2017). Additionally, by learning end-to-end, the algorithm has the potential to find the internal representations of causal structure best suited for the types of causal inference required. + +# 2 PROBLEM SPECIFICATION AND APPROACH + +This work probed how an agent could learn to perform causal reasoning in three distinct settings – observational, interventional, and counterfactual – corresponding to different types of data available to the agent during the first phase of an episode. + +In the observational setting (Experiment 1), the agent could only obtain passive observations from the environment. This type of data allows an agent to infer associations (associative reasoning) and, when the structure of the underlying causal model permits it, to estimate the effect that changing a variable in the environment has on another variable, namely to estimate causal effects (cause-effect reasoning). + +In the interventional setting (Experiment 2), the agent could directly set the values of some variables in the environment. This type of data in principle allows an agent to estimate causal effects for any underlying causal model. + +In the counterfactual setting (Experiment 3), the agent first had an opportunity to learn about the causal graph through interventions. At the last step of the episode, it was asked a counterfactual question of the form “What would have happened if a different intervention had been made in the previous time-step?”. + +Next we will formalize these three settings and patterns of reasoning possible in each, using the graphical model framework (Pearl, 2000; Spirtes et al., 2000; Dawid, 2007)1, and introduce the meta-learning methods that we will use to train agents that are capable of such reasoning. + +# 2.1 CAUSALITY + +Causal relationships among random variables can be expressed using causal directed acyclic graphs (DAGs) (see Appendix). A causal DAG is a graphical model that captures both independence and causal relations. Each node $X _ { i }$ corresponds to a random variable, and the joint distribution $p ( X _ { 1 } , \ldots , X _ { N } )$ is given by the product of conditional distributions of each node $X _ { i }$ given its parent nodes $\operatorname { p a } ( X _ { i } )$ , i.e. $\begin{array} { r } { p ( X _ { 1 : N } \equiv X _ { 1 } , . . . , X _ { N } ) = \prod _ { i = 1 } ^ { N } p ( X _ { i } | \mathsf { p a } ( X _ { i } ) ) . } \end{array}$ . + +Edges carry causal semantics: if there exists a directed path from $X _ { i }$ to $X _ { j }$ , then $X _ { i }$ is a potential cause of $X _ { j }$ . Directed paths are also called causal paths. The causal effect of $X _ { i }$ on $X _ { j }$ is the conditional distribution of $X _ { j }$ given $X _ { i }$ restricted to only causal paths. + +![](images/f7edff51309caba959c03a89222e364720a09693b84ae7fa4c194a9ddbb97247.jpg) + +An example causal DAG $\mathcal { G }$ is given in the figure on the left, where $E$ represents hours of exercise in a week, $H$ cardiac health, and $A$ age. The causal effect of $E$ on $H$ is the conditional distribution restricted to the path $E \to H$ i.e. excluding the path $E \left. A \right. H$ . The variable $A$ is called a confounder, as it confounds the causal effect with non-causal statistical influence. + +Simply observing cardiac health conditioning on exercise level from $p ( H | E )$ (associative reasoning) cannot answer if change in exercise levels cause changes in cardiac health (cause-effect reasoning), since there is always the possibility that correlation between the two is because of the common confounder of age. + +Cause-effect Reasoning. The causal effect can be seen as the conditional distribution $p _ { E = e } ( H | E =$ $e ) ^ { 2 }$ on the graph $\mathscr { G } _ { E = e }$ above (right), resulting from intervening on $E$ by replacing $p ( E | A )$ with a delta distribution $\delta _ { E = e }$ (thereby removing the link from $A$ to $E$ ) and leaving the remaining conditional distributions $p ( H | E , A )$ and $p ( A )$ unaltered. The rules of do-calculus (Pearl, 2000; Pearl et al., 2016) tell us how to compute $\scriptstyle p \to E = e \left( H | E = e \right)$ using observations from $\mathcal { G }$ . In this case $\begin{array} { r } { p _ { E = e } ( H | E = e ) = } \end{array}$ $\textstyle \sum _ { A } p ( H | E { = } e , A ) { \bar { p } } ( A ) ^ { 3 }$ . Therefore, do-calculus enables us to reason in the intervened graph $\mathscr { G } _ { E = e }$ even if our observations are from $\mathcal { G }$ . This is the scenario captured by our observational setting outlined above. + +Such inferences are always possible if the confounders are observed, but in the presence of unobserved confounders, for many DAG structures the only way to compute causal effects is by collecting observations directly from $\mathcal { G } _ { E }$ , i.e. by actively intervening on the world to fix the value of the variable $E = e$ and observing the remaining variables. In our interventional setting, outlined above, the agent has access to such interventions. + +Counterfactual Reasoning. Cause-effect reasoning can be used to correctly answer predictive questions of the type “Does exercising improve cardiac health?” by accounting for causal structure and confounding. However, it cannot answer retrospective questions about what would have happened. For example, given an individual $i$ who has died of a heart attack, this method would not be able to answer questions of the type “What would the cardiac health of this individual have been had they done more exercise?”. This type of question requires estimating unobserved sources of noise and then reasoning about the effects of this noise under a graph conditioned on a different intervention. + +# 2.2 META-LEARNING + +Meta-learning refers to a broad range of approaches in which aspects of the learning algorithm itself are learned from the data. Many individual components of deep learning algorithms have been successfully meta-learned, including the optimizer (Andrychowicz et al., 2016), initial parameter settings (Finn et al., 2017), a metric space (Vinyals et al., 2016), and use of external memory (Santoro et al., 2016). + +Following the approach of (Duan et al., 2016; Wang et al., 2016), we parameterize the entire learning algorithm as a recurrent neural network (RNN), and we train the weights of the RNN with model-free reinforcement learning (RL). The RNN is trained on a broad distribution of problems which each require learning. When trained in this way, the RNN is able to implement a learning algorithm capable of efficiently solving novel learning problems in or near the training distribution. + +Learning the weights of the RNN by model-free RL can be thought of as the “outer loop” of learning. The outer loop shapes the weights of the RNN into an “inner loop” learning algorithm. This inner loop algorithm plays out in the activation dynamics of the RNN and can continue learning even when the weights of the network are frozen. The inner loop algorithm can also have very different properties from the outer loop algorithm used to train it. For example, in previous work this approach was used to negotiate the exploration-exploitation tradeoff in multi-armed bandits (Duan et al., 2016) and learn algorithms which dynamically adjust their own learning rates (Wang et al., 2016; 2018). In the present work we explore the possibility of obtaining a causally-aware inner-loop learning algorithm. See the Appendix for a more formal approach to meta-learning. + +# 3 TASK SETUP AND AGENT ARCHITECTURE + +In the experiments, in each episode the agent interacted with a different causal DAG $\mathcal { G }$ . $\mathcal { G }$ was drawn randomly from the space of possible DAGs under the constraints given in the next paragraph. Each episode consisted of $T$ steps, and was divided into two phases: information and quiz. The information phase, corresponding to the first $T - 1$ steps, allowed the agent to collect information by interacting with or passively observing samples from $\mathcal { G }$ . The agent could potentially use this information to infer the connectivity and weights of $\mathcal { G }$ . The quiz phase, corresponding to the final step $T$ , required the agent to exploit the causal knowledge it collected in the information phase, to select the node with the highest value under a random external intervention. + +Causal graphs, observations, and actions. We generated all graphs on $N { = } 5$ nodes, with edges only in the upper triangular of the adjacency matrix (this guarantees that all the graphs obtained are DAGs), with edge weights, $w _ { j i } \in \{ - 1 , 0 , 1 \}$ (uniformly sampled), and removed 300 for held-out testing. The remaining 58749 (or $3 ^ { N ( N - 1 ) / 2 } - 3 0 0 )$ were used as the training set. Each node’s value, $X _ { i } \in \mathbb { R }$ , was Gaussiandistributed. The values of parentless nodes were drawn from $\mathcal { N } ( \mu = 0 . 0 , \sigma = 0 . 1 )$ . The conditional probability of a node with parents was $\begin{array} { r } { p ( X _ { i } | \mathsf { p a } ( X _ { i } ) ) = \mathcal { N } ( \mu = \sum _ { j } w _ { j i } X _ { j } , \sigma = 0 . 1 ) } \end{array}$ , where $\operatorname { p a } ( X _ { i } )$ represents the parents of node $X _ { i }$ in $\mathcal { G }$ . The values of the 4 observable nodes (the root node, was always hidden), were concatenated to create $v _ { t }$ and provided to the agent in its observation vector, $O _ { t } = [ v _ { t } , m _ { t } ]$ where $m _ { t }$ is a one-hot vector indicating external intervention during the quiz phase (explained below).4 + +In both phases, on each step, $t$ , the agent’s action, $a _ { t }$ , was a discrete choice from the range $\left\{ 1 . . . 2 ( N { - } 1 ) \right\}$ . Action choices in $\{ 1 . . . N - 1 \}$ corresponded to information actions, and choices in $\{ N \ldots 2 ( N - 1 ) \}$ corresponded to quiz actions. + +Information phase. In the information phase, an information action, $a _ { t }$ , caused an intervention on the $a _ { t }$ -th node, setting its value to $X _ { a _ { t } } = 5$ . We choose an intervention value outside the likely range of sampled observations, to facilitate learning of the causal graph. The observation from the intervened graph, $\mathscr { G } _ { X _ { a _ { t } } = 5 }$ , was sampled similarly to $\mathcal { G }$ , except the incoming edges to $X _ { a _ { t } }$ were severed, and its intervened value was used for conditioning its children’s values. The node values in $\mathscr { G } _ { X _ { a _ { t } } = 5 }$ were distributed as $p _ { X _ { i } = 5 } ( X _ { 1 : N \backslash i } | X _ { i } = 5 )$ . If a quiz action was chosen during the information phase, it was ignored, the $\mathcal { G }$ values were sampled as if no intervention had been made, and the agent was given a penalty of $r _ { t } = - 5$ in order to encourage it to take quiz actions at only during quiz phase. After the action was selected, an observation was provided to the agent. The default length of this phase was fixed to $T = N = 5$ since in the noise-free limit, a minimum of $T - 1 = 4$ interventions are required in general to resolve the causal structure, and score perfectly on the test phase. + +Quiz phase. In the quiz phase, one non-hidden node was selected at random to be intervened on externally, $X _ { j }$ , and its value was set to $- 5$ . We chose an intervention value of $- 5$ never previously observed by the agent in that episode, thus disallowing the agent from memorizing the results of interventions in the information phase to perform well on the quiz phase. The agent was informed of this by the observed $m _ { T - 1 }$ (a one-hot vector which indicated which node would be intervened on), from the final pre-quiz phase time-step, $T - 1$ . Note, $m _ { t }$ was set to a zero-vector for steps $t < T - 1$ . A quiz action, $a _ { T }$ , chosen by the agent indicated the node whose value would be given to the agent as a reward. In other words, the agent would receive reward, $r _ { T } = X _ { a _ { T } - ( N - 1 ) }$ . Again, if a quiz action was chosen during the information phase, the node values were not sampled and the agent was simply given a penalty of $r _ { T } = - 5$ . + +Active vs passive agents. Our agents had to perform two distinct tasks during the information phase: a) actively choose which nodes to set values on, and b) infer the causal DAG from its observations. We refer to this setup as the “active” condition. To control for (a), we created the “passive” condition, where the agent’s information phase actions are not learned. To provide a benchmark for how well the active agent can perform task (a), we fixed the passive agent’s intervention policy to be an exhaustive sweep through all observable nodes. This is close to optimal for this domain – in fact it is the optimal policy for noise-free conditional node values. We also compared the active agent’s performance to a baseline agent whose policy is to intervene randomly on the observable nodes in the information phase, in the Appendix. + +Two kinds of learning The “inner loop” of learning (see Section 2.2) occurs within each episode where the agent is learning from the evidence it gathers during the information phase in order to perform well in the quiz phase. The same agent then enters a new episode, where it has to repeat the task on a different DAG. Test performance is reported on DAGs that the agent has never previously seen, after all the weights of the RNN have been fixed. Hence, the only transfer from training to test (or the “outer loop” of learning) is the ability to discover causal dependencies based on observations in the information phase, and to perform causal inference in the quiz phase. + +# Agent Architecture and Training + +We used a long short-term memory (LSTM) network (Hochreiter & Schmidhuber, 1997) (with 96 hidden units) that, at each time-step $t$ , receives a concatenated vector containing $\left[ o _ { t } , a _ { t - 1 } , r _ { t - 1 } \right]$ as input, where $o _ { t }$ is the observation5, $a _ { t - 1 }$ is the previous action (as a one-hot vector) and $r _ { t - 1 }$ the reward (as a single real-value)6. The outputs, calculated as linear projections of the LSTM’s hidden state, are a set of policy logits (with dimensionality equal to the number of available actions), plus a scalar baseline. The policy logits are transformed by a softmax function, and then sampled to give a selected action. + +Learning was by asynchronous advantage actor-critic (Mnih et al., 2016). In this framework, the loss function consists of three terms – the policy gradient, the baseline cost and an entropy cost. The baseline cost was weighted by 0.05 relative to the policy gradient cost. The weighting of the entropy cost was annealed over the course of training from 0.05 to 0. Optimization was done by RMSProp with $\epsilon = 1 0 ^ { - 5 }$ , momentum $= 0 . 9$ and decay $= 0 . 9 5$ . Learning rate was annealed from $3 \times 1 0 ^ { - 6 }$ to 0. For all experiments, after training, the agent was tested with the learning rate set to zero, on a held-out test set. + +# 4 EXPERIMENTS + +Our three experiments (observational, interventional, and counterfactual) differed in the properties of the $v _ { t }$ that was observed by the agent during the information phase, and thereby limited the extent of causal reasoning possible within each data setting. Our measure of performance is the reward earned in the quiz phase for held-out DAGs. Choosing a random node node in the quiz phase results in a reward of $- 5 / 4 = - 1 . 2 5$ , since one node (the externally intervened node) always has value $- 5$ and the others have on average 0 value. By learning to simply avoid the externally intervened node, the agent can earn on average 0 reward. Consistently picking the node with the highest value in the quiz phase requires the agent to perform causal reasoning. For each agent, we take the average reward earned across 1200 episodes (300 held-out test DAGs, with 4 possible external interventions). We train 12 copies of each agent and report the average reward earned by these, with error bars showing $9 5 \%$ confidence intervals. + +# 4.1 EXPERIMENT 1: OBSERVATIONAL SETTING + +In Experiment 1, the agent could neither intervene to set the value of variables in the environment, nor observe any external interventions. In other words, it only received observations from $\mathcal { G }$ , not $\mathscr { G } _ { X _ { j } }$ (where $X _ { j }$ is a node that has been intervened on). This limits the extent of causal inference possible. In this experiment, we tested six agents, four of which were learned: “Observational”, “Long Observational”, “Active Conditional”, “Passive Conditional”, “Observational MAP Baseline”(not learned) and the “Optimal Associative Baseline” (not learned). We also ran two other standard RL baselines—see the Appendix for details. + +Observational Agents: In the information phase, the actions of the agent were ignored7, and the observational agent always received the values of the observable nodes as sampled from the joint distribution associated with $\mathcal { G }$ . In addition to the default $T = 5$ episode length, we also trained this agent with $4 \times$ longer episode length (Long Observational Agent), to measure performance increase with more observational data. + +Conditional Agents: The information phase actions corresponded to observing a world in which the selected node $X _ { j }$ is equal to $X _ { j } = 5$ , and the remaining nodes are sampled from the conditional distribution $p ( X _ { 1 : N \backslash j } | X _ { j } = \mathsf { \bar { 5 } } )$ , where $X _ { 1 : N \backslash j }$ indicates the set of all nodes except $X _ { j }$ . This differs from intervening on the variable $X _ { j }$ by setting it to the value $X _ { j } = 5$ , since here we take a conditional sample from $\mathcal { G }$ rather than from $\mathscr { G } _ { X _ { j } = 5 }$ (i.e. from $p _ { X _ { j } = 5 } ( X _ { 1 : N \backslash j } | X _ { j } = 5 ) \rangle$ ), and inference about the corresponding node’s parents is possible. Therefore, this agent still has access to only observational data, as with the observational agents. However, on average it receives more diagnostic information about the relation between the random variables in $\mathcal { G }$ , since it can observe samples where a node takes a value far outside the likely range of sampled observations. We run active and passive versions of this agent as described in Section 3 + +Optimal Associative Baseline: This baseline receives the true joint distribution $p ( X _ { 1 : N } )$ implied by the DAG in that episode, therefore it has full knowledge of the correlation structure of the environment8. It can therefore do exact associative reasoning of the form $p ( X _ { j } | X _ { i } = x )$ , but cannot do any cause-effect reasoning of the form $p _ { X _ { i } = x } ( X _ { j } | X _ { i } = x ) \bar $ . In the quiz phase, this baseline chooses the node that has the maximum value according to the true $p ( X _ { j } | X _ { i } = x )$ in that episode, where $X _ { i }$ is the node externally intervened upon, and $x = - 5$ . + +Observational MAP Baseline: This baseline follows the traditional method of separating causal induction and causal inference. We first carry out exact maximum a posteriori (MAP) inference over the space of DAGs in each episode (i.e. causal induction) by selecting the DAG $( \mathcal { G } ^ { \mathrm { M A P } } )$ of the 59049 unique possibilities that maximizes the likelihood of the data observed, $v _ { 1 : T }$ , by the Observational Agent in that episode. This is equivalent to maximizing the posterior probability since the prior over graphs is uniform. + +# RESULTS + +We focus on three key questions in this experiment: (i) Can our agents learn to do associative reasoning with observational data?, (ii) Can they learn to do cause-effect reasoning from observational data?, and (iii) In addition to making causal inferences, can our agent also choose good actions in the information phase to generate the data it observes? + +![](images/749c52221b7aa659f857213bed214509bd030aeccb9f6e21dca673ef2ac5b823.jpg) +Figure 2: Experiment 1. Agents do associative and cause-effect reasoning from observational data. a) Average reward earned by the agents tested in this experiment. See main text for details. b) Performance split by the presence or absence of at least one parent (Parent and Orphan respectively) on the externally intervened node. c) Quiz phase for a test DAG. Green (red) edges indicate a weight of $+ 1$ $( - 1 )$ . Black represents the intervened node, green (red) nodes indicate a positive (negative) value at that node, white indicates a zero value. The blue circles indicate the agent’s choice. Left panel: $\mathcal { G }$ and the nodes taking the mean values prescribed by $p ( X _ { 1 : N \backslash j } | X _ { j } = - 5 )$ , including backward inference to the intervened node’s parent. The Optimal Associative Baseline’s choice is consistent with maximizing these (incorrect) node values. Right panel: $\mathscr { G } _ { X _ { j } = - 5 }$ and the nodes taking the mean values prescribed by $p _ { X _ { j } = - 5 } ( X _ { 1 : N \backslash j } | X _ { j } = - 5 )$ . We see that the Passive-Conditional Agent’s choice is consistent with maximizing these (correct) node values. + +For (i), we see that the Observational Agents achieve reward above the random baseline (see the Appendix), and that more observations (Long Observational Agent) lead to better performance (Fig. 2a), indicating that the agent is indeed learning the statistical dependencies between the nodes. We see that the performance of the Passive-Conditional Agent is better than either of the Observational Agents, since the data it observes is very informative about the statistical dependencies in the environment. Finally, we see that the PassiveConditional Agent’s performance is comparable (in fact surpasses as discussed below) the performance of the Optimal Associative Baseline, indicating that it is able to do perfect associative inference. + +![](images/69ae734c251061f5e5dae75f25ad12c00a96ccee89fecc8e16875f68d57b2a77.jpg) +Figure 1: Active and Passive Conditional Agents + +For (ii), we see the crucial result that the Passive-Conditional Agent’s performance is significantly above the Optimal Associative Baseline, i.e. it performs better than what is possible using only correlations. We compare their performances, split by whether or the node that was intervened on in the quiz phase of the episode has a parent (Fig. 2b). If the intervened node $X _ { j }$ has no parents, then $\mathscr { G } { = } \mathscr { G } _ { X _ { j } }$ , and there is no advantage to being able to do cause-effect reasoning. We see indeed that the Passive-Conditional agent performs better than the Optimal Associative Baseline only when the intervened node has parents (denoted by hatched bars in Fig. 2b), indicating that this agent is able to carry out some cause-effect reasoning, despite access to only observational data – i.e. it learns some form of do-calculus. We show the quiz phase for an example test DAG in Fig. 2c, seeing that the Optimal Associative Baseline chooses according to the node values predicted by $\mathcal { G }$ whereas the Passive-Conditional Agent chooses according the node values predicted by $\mathscr { G } _ { X _ { j } }$ . + +For (iii), we see (Fig. 2) that the Active-Conditional Agent’s performance is only marginally below the performance of the Passive-Conditional Agent, indicating that when the agent is allowed to choose its actions, it makes reasonable choices that allow good performance. + +# 4.2 EXPERIMENT 2: INTERVENTIONAL SETTING + +In Experiment 2, the agent receives interventional data in the information phase – it can choose to intervene on any observable node, $X _ { j }$ , and observe a sample from the resulting graph $\mathscr { G } _ { X _ { j } }$ . As discussed in Section 2.1, access to intervention data permits cause-effect reasoning even in the presence of unobserved confounders, a feat which is in general impossible with access only to observational data. In this experiment, we test four new agents, two of which were learned: “Active Interventional”, “Passive Interventional”, “Interventional MAP Baseline”(not learned), and “Optimal Cause-Effect Baseline” (not learned). + +Interventional Agents: The information phase actions correspond to performing an intervention on the selected node $X _ { j }$ and sampling from $\mathscr { G } _ { X _ { j } }$ (see Section 3 for details). We run active and passive versions of this agent as described in Section 3. + +Interventional MAP Baseline: This baseline infers a DAG by maximizing the likelihood of the data observed by the Passive Interventional Agent in that episode. In the quiz phase, we predict the values of each node according to ${ \mathcal { G } } _ { X _ { j } } ^ { \mathrm { M A P } }$ where $X _ { j }$ is the node externally intervened upon (i.e. causal inference), and choose the node with the highest value. + +![](images/9a32279239e503f54b6b8c6d57fdabae8547106bb59b266884e801dbebc1216b.jpg) +Figure 4: Experiment 2. Agents do cause-effect reasoning from interventional data. a) Average reward earned by the agents tested in this experiment. See main text for details. b) Performance split by the presence or absence of unobserved confounders (abbreviated as Conf. and Unconf. respectively) on the externally intervened node. c) Quiz phase for a test DAG. See Fig. 2 for a legend. Here, the left panel shows the full $\mathcal { G }$ and the nodes taking the mean values prescribed by $p ( X _ { 1 : N \backslash j } | \bar { X } _ { j } = - 5 )$ . We see that the Passive-Cond Agent’s choice is consistent with choosing based on these (incorrect) node values. The right panel shows $\mathscr { G } _ { X _ { j } = - 5 }$ and the nodes taking the mean values prescribed by $p _ { X _ { j } = - 5 } ( X _ { 1 : N \backslash j } | X _ { j } = - \mathrm { \bar { 5 } } )$ We see that the Passive-Int. Agent’s choice is consistent with maximizing on these (correct) node value. + +Optimal Cause-Effect Baseline: This baseline receives the true DAG, $\mathcal { G }$ . In the quiz phase, it chooses the node that has the maximum value according to $\mathscr { G } _ { X _ { j } }$ , where $X _ { j }$ is the node externally intervened upon. + +# RESULTS + +![](images/6b92a598cec55c4ca90267608194fd078c978d7e0d53f3d8083a35b1be04eb10.jpg) +Figure 3: Active and Passive Interventional Agents + +We focus on three key questions in this experiment: (i) Can our agents learn to do cause-effect reasoning from interventional data?, (ii) How does the cause-effect reasoning in our agents which have access to interventional data differ from the cause-effect reasoning measured in Experiment 1 (in agents that have access only to observational data)? (iii) In addition to making causal inferences, can our agent also choose good actions in the information phase to generate the data it observes? + +For (i) we see in Fig. 4a that the Passive-Interventional Agent’s performance is comparable to the Optimal Cause-Effect Baseline, indicating that it is able to do close to perfect cause-effect reasoning in this domain. + +For (ii) we see in Fig. 4a the crucial result that the Passive-Interventional Agent’s performance is significantly better than the Passive-Conditional Agent. We compare the performances of these two agents, split by whether the node that was intervened on in the quiz phase of the episode had unobserved confounders with other variables in the graph (Fig. 4b). In confounded cases, as described in Section 2.1, cause-effect reasoning is impossible with only observational data. We see that the performance of the Passive-Interventional Agent does not vary significantly with confoundedness, whereas the performance of the Passive-Conditional Agent is significantly lower in the confounded cases. This indicates that the improvement in the performance of the agent that has access to interventional data (as compared to the agents that had access to only observational data) is largely driven by its ability to also do cause-effect reasoning in the presence of confounders. This is highlighted by Fig. 4c, which shows the quiz phase for an example DAG, where the Passive-Conditional agent is unable to resolve the confounder, but the Passive-Interventional agent can. + +For (iii), we see in Fig. 3 that the Active-Interventional Agent’s performance is only marginally below the performance of the near optimal Passive-Interventional Agent, indicating that when the agent is allowed to choose its actions, it makes reasonable choices that allow good performance. + +# 4.3 EXPERIMENT 3: COUNTERFACTUAL SETTING + +In Experiment 3, the agent was again allowed to make interventions as in Experiment 2, but in this case the quiz phase task entailed answering a counterfactual question. We explain here what a counterfactual question in this domain looks like. Consider the conditional distribution $\scriptstyle { p ( \bar { X } _ { i } | \mathsf { p a } ( X _ { i } ) ) = N ( \sum _ { j } w _ { j i } X _ { j } , 0 . 1 ) }$ as described in Section 3 as $\begin{array} { r } { X _ { i } = \sum _ { j } w _ { j i } X _ { j } + \epsilon } \end{array}$ where $\epsilon$ is distributed as $\mathcal { N } ( 0 . 0 , 0 . 1 )$ , and represents the specific randomness introduced when taking one sample from the DAG. After observing the nodes $X _ { 1 : N }$ in the DAG in one sample, we can infer this specific randomness $\epsilon _ { i }$ for each node $X _ { i }$ (i.e. abduction as described in the Appendix) and answer counterfactual questions like “What would the values of the nodes be, had $X _ { j }$ in that particular sample taken on a different value than what we observed?”, for any of the nodes $X _ { j }$ . We test 2 new learned agents: “Active Counterfactual” and “Passive Counterfactual”. + +![](images/e971a44dda37b1eab99b010fc18fc5982ff913faa55ed88e63f6e3c8d79ae111.jpg) +Figure 5: Experiment 3. Agents do counterfactual reasoning. a) Average reward earned by the agents tested in this experiment. See main text for details. b) Performance split by if the maximum node value in the quiz phase is degenerate (Deg.) or distinct (Dist.). c) Quiz phase for an example test-DAG. See Fig. 2 for a legend. Here, the left panel shows $\mathscr { G } _ { X _ { j } = - 5 }$ and the nodes taking the mean values prescribed by $p _ { X _ { j } = - 5 } ( X _ { 1 : N \backslash j } | X _ { j } = - \bar { 5 } )$ . We see that the Passive-Int. Agent’s choice is consistent with maximizing on these node values, where it makes a random choice between two nodes with the same value. The right panel panel shows $\mathscr { G } _ { X _ { j } = - 5 }$ and the nodes taking the exact values prescribed by the means of $p _ { X _ { j } = - 5 } ( X _ { 1 : N \backslash j } | X _ { j } = - 5 )$ , combined with the specific randomness inferred from the previous time step. As a result of accounting for the randomness, the two previously degenerate maximum values are now distinct. We see that the Passive-CF. agent’s choice is consistent with maximizing on these node values. + +Counterfactual Agents: This agent is exactly analogous to the Interventional agent, with the addition that the exogenous noise in the last information phase step $t = T - 1$ (where say $X _ { p } = + 5$ ), is stored and the same noise is used in the quiz phase step $t = T$ (where say $X _ { f } = - 5$ ). While the question our agents have had to answer correctly so far in order to maximize their reward in the quiz phase was “Which of the nodes $X _ { 1 : N \backslash j }$ will have the highest value when $X _ { f }$ is set to $- 5 ? ^ { \prime }$ , in this setting, we ask “Which of the nodes $X _ { 1 : N \backslash j }$ would have had the highest value in the last step of the information phase, if instead of having $X _ { p } = + 5$ , we had $X _ { f } = - 5 ? ^ { \prime }$ . We run active and passive versions of this agent as described in Section 3. + +Optimal Counterfactual Baseline: This baseline receives the true DAG and does exact abduction based on the exogenous noise observed in the penultimate step of the information phase, and combines this correctly with the appropriate interventional inference on the true DAG in the quiz phase. + +# RESULTS + +We focus on two key questions in this experiment: (i) Can our agents learn to do counterfactual reasoning?, (ii) In addition to making causal inferences, can our agent also choose good actions in the information phase to generate the data it observes? + +For (i), we see that the Passive-Counterfactual Agent achieves higher reward than the Passive-Interventional Agent and the Optimal Cause-Effect Baseline. To evaluate whether this difference results from the agent’s use of abduction (see the Appendix for details), we split the test set into two groups, depending on whether or not the decision for which node will have the highest value in the quiz phase is affected by exogenous noise, i.e. whether or not the node with the maximum value in the quiz phase changes if the noise is resampled. This is most prevalent in cases where the maximum expected reward is degenerate, i.e. where several nodes give the same maximum reward (denoted by hatched bars in Figure 5b). Here, agents with no access to the noise have no basis for choosing one over the other, but different noise samples can give rise to significant differences in the actual values that these degenerate nodes have. We see indeed that there is no difference in the rewards received by the Passive-Counterfactual and Passive-Interventional Agents in the cases where the maximum values are distinct, however the Passive-Counterfactual Agent significantly outperforms the Passive-Interventional Agent in cases where there are degenerate maximum values. + +![](images/0102ff655040ab3e14e80ab25504d2a3a6eb52f8de6340142a4fc072189108a0.jpg) +Figure 6: Active and Passive Counterfactual Agents + +For (ii), we see in Fig. 6 that the Active-Counterfactual Agent’s performance is only marginally below the performance of the Passive-Counterfactual agent, indicating that when the agent is allowed to choose its actions, it makes reasonable choices that allow good performance. + +# 5 SUMMARY OF RESULTS + +We introduced and tested a framework for learning causal reasoning in various data settings—observational, interventional, and counterfactual—using deep meta-RL. Crucially, our approach did not require explicit encoding of formal principles of causal inference. Rather, by optimizing an agent to perform a task that depended on causal structure, the agent learned implicit strategies to use the available data for causal reasoning, including drawing inferences from passive observation, actively intervening, and making counterfactual predictions. Below, we summarize the keys results from each of the three experiments. + +In Section 4.1 and Fig. 2, we show that the agent learns to perform do-calculus. In Fig. 2(a) we see that, compared to the highest possible reward achievable without causal knowledge, the trained agent received more reward. This observation is corroborated by Fig. 2(b) which shows that performance increased selectively in cases where do-calculus made a prediction distinguishable from the predictions based on correlations. These are situations where the externally intervened node had a parent – meaning that the intervention resulted in a different graph. + +In Section 4.2 and Fig. 4, we show that the agent learns to resolve unobserved confounders using interventions (a feat impossible with only observational data). In Fig. 4(a) we see that the agent with access to interventional data performs better than an agent with access to only observational data. Fig. 4(b) shows that the performance increase is greater in cases where the intervened node shared an unobserved parent (a confounder) with other variables in the graph. In this section we also compare the agent’s performance to a MAP estimate of the causal structure and find that the agent’s performance matches it, indicating that the agent is indeed doing close to optimal causal inference. + +In Section 4.3 and Fig. 5, we show that the agent learns to use counterfactuals. In Fig. 5(a) we see that the agent with additional access to the specific randomness in the test phase performs better than an agent with access to only interventional data. In Fig. 5(b), we find that the increased performance is observed only in cases where the maximum mean value in the graph is degenerate, and optimal choice is affected by the exogenous noise – i.e. where multiple nodes have the same value on average and the specific randomness can be used to distinguish their actual values in that specific case. + +# 6 DISCUSSION AND FUTURE WORK + +This work is the first demonstration that causal reasoning can arise out of model-free reinforcement learning. This opens up the possibility of leveraging powerful learning-based methods for causal inference in complex settings. Traditional formal approaches usually decouple the two problems of causal induction (i.e. inferring the structure of the underlying model) and causal inference (i.e. estimating causal effects and answering counterfactual questions), and despite advances in both (Ortega & Stocker, 2015; Bramley et al., 2017; Parida et al., 2018; Sen et al., 2017; Forney et al., 2017; Lattimore et al., 2016), inducing models often requires assumptions that are difficult to fit to complex real-world conditions. By learning these end-to-end, our method can potentially find representations of causal structure best tuned to the specific causal inferences required. Another key advantage of our meta-RL approach is that it allows the agent to learn to interact with the environment in order to acquire necessary observations in the service of its task—i.e. to perform active learning. In our experimental domain, our agents’ active intervention policy was close to optimal, which demonstrates the promise of agents that can learn to experiment on their environment and perform rich causal reasoning on the observations. + +Future work should explore agents that perform experiments to support structured exploration in RL, and optimal experiment design in complex domains where large numbers of blind interventions are prohibitive. To this end, follow-up work should focus on scaling up our approach to larger environments, with more complex causal structure and a more diverse range of tasks. Though the results here are a first step in this direction which use relatively standard deep RL components, our approach will likely benefit from more advanced architectures (e.g. Espeholt et al., 2018; Hessel et al., 2018; Hester et al., 2017) that allow longer more complex episodes, as well as models which are more explicitly compositional (e.g. Battaglia et al., 2018; Andreas et al., 2016) or have richer semantics (e.g. Ganin et al., 2018), that more explicitly leverage symmetries like equivalance classes in the environment. + +# REFERENCES + +Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 39–48, 2016. + +M. Andrychowicz, M. Denil, S. Gomez, M. W. Hoffman, D. Pfau, T. Schaul, B. Shillingford, and N. De Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems, pp. 3981–3989, 2016. + +D. Barber. Bayesian Reasoning and Machine Learning. Cambridge University Press, 2012. + +Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018. + +C. M. Bishop. Pattern Recognition and Machine Learning. Springer, 2006. + +A. P. Blaisdell, K. Sawa, K. J. Leising, and M. R. Waldmann. Causal reasoning in rats. Science, 311(5763): 1020–1022, 2006. + +N. R. Bramley, P. Dayan, T. L. Griffiths, and D. A. Lagnado. Formalizing neuraths ship: Approximate algorithms for online causal learning. Psychological review, 124(3):301, 2017. + +K. Cho, B. Van Merrienboer, C. Gulcehre, D. Bahdanau, F. Bougares, H. Schwenk, and Y. Bengio. Learning ¨ phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014. + +P. Dawid. Fundamentals of statistical causality. Technical report, University Colledge London, 2007. + +Y. Duan, J. Schulman, X. Chen, P. L. Bartlett, I. Sutskever, and P. Abbeel. Rl2: Fast reinforcement learning via slow reinforcement learning. arXiv preprint arXiv:1611.02779, 2016. URL http: //arxiv.org/abs/1611.02779. + +Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018. + +C. Finn, P. Abbeel, and S. Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017. + +Andrew Forney, Judea Pearl, and Elias Bareinboim. Counterfactual data-fusion for online reinforcement learners. In International Conference on Machine Learning, pp. 1156–1164, 2017. + +Yaroslav Ganin, Tejas Kulkarni, Igor Babuschkin, SM Eslami, and Oriol Vinyals. Synthesizing programs for images using reinforced adversarial learning. arXiv preprint arXiv:1804.01118, 2018. + +A. Gopnik, D. M. Sobel, L. E. Schulz, and C. Glymour. Causal learning mechanisms in very young children: two-, three-, and four-year-olds infer causal relations from patterns of variation and covariation. Developmental psychology, 37(5):620, 2001. + +A. Gopnik, C. Glymour, D. M. Sobel, L. E. Schulz, T. Kushnir, and D. Danks. A theory of causal learning in children: causal maps and bayes nets. Psychological review, 111(1):3, 2004. + +Matteo Hessel, Hubert Soyer, Lasse Espeholt, Wojciech Czarnecki, Simon Schmitt, and Hado van Hasselt. Multi-task deep reinforcement learning with popart. arXiv preprint arXiv:1809.04474, 2018. + +Todd Hester, Matej Vecerik, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Gabriel Dulac-Arnold, et al. Deep q-learning from demonstrations. arXiv preprint arXiv:1704.03732, 2017. + +S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997. + +D. Koller and N. Friedman. Probabilistic Graphical Models: Principles and Techniques. MIT Press, 2009. + +A. Krizhevsky, I. Sutskever, and g. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012. + +David A Lagnado, Tobias Gerstenberg, and Ro’i Zultan. Causal responsibility and counterfactuals. Cognitive science, 37(6):1036–1073, 2013. +Finnian Lattimore, Tor Lattimore, and Mark D Reid. Causal bandits: Learning good interventions via causal inference. In Advances in Neural Information Processing Systems, pp. 1181–1189, 2016. +A. M. Leslie. The perception of causality in infants. Perception, 11(2):173–186, 1982. +V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. P. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. CoRR, abs/1602.01783, 2016. URL http: //arxiv.org/abs/1602.01783. +K. P. Murphy. Machine Learning: a Probabilistic Perspective. MIT Press, 2012. +P. A. Ortega and D. D. Lee A. A. Stocker. Causal reasoning in a prediction task with hidden causes. 37th Annual Cognitive Science Society Meeting CogSci, 2015. +P. K. Parida, T. Marwala, and S. Chakraverty. A multivariate additive noise model for complete causal discovery. Neural Networks, 103:44–54, 2018. +J. Pearl. Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference. Morgan Kaufmann, 1988. +J. Pearl. Causality: Models, Reasoning, and Inference. Cambridge University Press, 2000. +J. Pearl, M. Glymour, and N. P. Jewell. Causal Inference in Statistics: A Primer. Wiley, 2016. +A. Santoro, S. Bartunov, M. Botvinick, D. Wierstra, and T. Lillicrap. Meta-learning with memoryaugmented neural networks. In International conference on machine learning, pp. 1842–1850, 2016. +Rajat Sen, Karthikeyan Shanmugam, Alexandros G Dimakis, and Sanjay Shakkottai. Identifying best interventions through online importance sampling. arXiv preprint arXiv:1701.02789, 2017. +P. Spirtes, C. N. Glymour, R. Scheines, D. Heckerman, C. Meek, G. Cooper, and T. Richardson. Causation, prediction, and search. MIT press, 2000. +O. Vinyals, C. Blundell, T. Lillicrap, D. Wierstra, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016. +J. X. Wang, Z. Kurth-Nelson, D. Tirumala, H. Soyer, J. Z. Leibo, R. Munos, C. Blundell, D. Kumaran, and M. Botvinick. Learning to reinforcement learn. CoRR, abs/1611.05763, 2016. URL http: //arxiv.org/abs/1611.05763. +J. X. Wang, Z. Kurth-Nelson, D. Kumaran, D. Tirumala, H. Soyer, J. Z. Leibo, D. Hassabis, and M. Botvinick. Prefrontal cortex as a meta-reinforcement learning system. Nature Neuroscience, 21, 2018. + +![](images/950a7be8955d94a6a74726f71f16e895a8d30fbb962aecd7c8593cedbd513a9b.jpg) +A ADDITIONAL BASELINES +Figure 7: Reward distribution + +We can also compare the performance of these agents to two standard model-free RL baselines. The Q-total agent learns a Q-value for each action across all steps for all the episodes. The Q-episode agent learns a Q-value for each action conditioned on the input at each time step $\left[ o _ { t } , a _ { t - 1 } , r _ { t - 1 } \right]$ , but with no LSTM memory to store previous actions and observations. Since the relationship between action and reward is random between episodes, Q-total was equivalent to selecting actions randomly, resulting in a considerably negative reward. The Q-episode agent essentially makes sure to not choose the arm that is indicated by $m _ { t }$ to be the external intervention (which is assured to be equal to $- 5 )$ , and essentially chooses randomly otherwise, giving an average reward of 0. + +# B FORMAL DESCRIPTION OF META-LEARNING + +Consider a distribution $\mathcal { D }$ over Markov Decision Processes (MDPs). We train an agent with memory (in our case an RNN-based agent) on this distribution. In each episode, we sample a task $m \sim \mathcal { D }$ . At each step $t$ within an episode, the agent sees an observation $o _ { t }$ , executes an action $a _ { t }$ , and receives a reward $r _ { t }$ . Both $a _ { t - 1 }$ and $r _ { t - 1 }$ are given as additional inputs to the network. Thus, via the recurrence of the network, each action is a function of the entire trajectory $\mathcal { H } _ { t } = \left\{ o _ { 0 } , a _ { 0 } , r _ { 0 } , . . . , o _ { t - 1 } , a _ { t - 1 } , r _ { t - 1 } , o _ { t } \right\}$ of the episode. Because this function is parameterized by the neural network, its complexity is limited only by the size of the network. + +# C ABDUCTION-ACTION-PREDICTION METHOD FOR COUNTERFACTUAL REASONING + +Pearl et al. (2016)’s “abduction-action-prediction” method prescribes one method for answering counterfactual queries, by estimating the specific unobserved makeup of individual $i$ and by transferring it to the counterfactual world. Assume, for example, the following model for $\mathcal { G }$ of Section 2.1: $E = w _ { A E } A + \eta$ , $H = w _ { A H } A + w _ { E H } E + \epsilon$ , where the weights $w _ { i j }$ represent the known causal effects in $\mathcal { G }$ and $\epsilon$ and $\eta$ are terms of (e.g.) Gaussian noise that represent the unobserved randomness in the makeup of each individual9. Suppose that for individual $i$ we observe: $A = a ^ { i }$ , $E = e ^ { i }$ , $H = h ^ { i }$ . We can answer the counterfactual question of “What if individual $i$ had done more exercise, i.e. $E { = } e ^ { \prime }$ , instead?” by: a) Abduction: estimate the individual’s specific makeup with $\epsilon ^ { i } = h ^ { i } - w _ { A H } a ^ { i } - w _ { E H } e ^ { i }$ , b) Action: set $E$ to more exercise $e ^ { \prime }$ , c) Prediction: predict a new value for cardiac health as $h ^ { \prime } { = } w _ { A H } a ^ { i } { + } w _ { E H } e ^ { \prime } { + } { \epsilon } ^ { i }$ . + +# D EXPERIMENT 4: NON-LINEAR CAUSAL GRAPHS + +![](images/4635b97ada0f7061f268d413085612f83173204d56deebcf8f2c4e789abdb1fe.jpg) +Figure 8: Experiment 4 results + +The purview of the previous experiments was to show a proof of concept on a simple tractable system, demonstrating that causal induction and inference can be learned and implemented via a meta-learned agent. In this experiment, we generalize some of the results to nonlinear, non-Gaussian causal graphs which are more typical of real-world causal graphs and to demonstrate that our results hold without loss of generality on such systems. + +Here we investigate causal DAGs with a quadratic dependence on the parents by changing the conditional distribution to $\begin{array} { r } { \overline { { p } } ( X _ { i } | \mathfrak { p a } ( X _ { i } ) ) = \mathcal { N } ( \frac { 1 } { N _ { i } } \overset { \cdot } { \sum _ { j } } w _ { j i } ( X _ { j } \overset { \cdot } { + } X _ { j } ^ { 2 } ) , \sigma ) } \end{array}$ . Here, although each node is normally distributed given its parents, the joint distribution is not multivariate Gaussian due to the non-linearity in how the means are determined. We find that the Long-Observational achieves more reward than the Observational agent indicating that the agent is in fact learning the statistical dependencies between the nodes, within an episode. We also find that although the Active-Interventional agent is not far behind the performance of the MAP baseline, and achieves reward well above the Long-Observational10 The fact that the MAP baseline gets so close to the Optimal Cause-Effect baseline indicates that the Active agent is choosing close to optimal actions. + +![](images/515d9cd2e9a7f0c794fecfd02afc3496625d8ffc4f9aefbbf5d09e6157700d51.jpg) +E EXPERIMENT 5: LARGER CAUSAL GRAPHS WITH GENERALIZATION TO NEW EQUIVALENCE CLASSES +Figure 9: (a) Comparing agent performances with different data. (b) Comparing information phase intervention policies. + +In the experiments reported in the main paper, the test set was a random subset of all graphs, and training examples were generated randomly subject to the constraint that they not be in the test set. However, this raised the possibility that any test graph might have an equivalent graph in the training set, which could result in a type of overfitting. We therefore ran a new set of experiments where + +the entire equivalence class of each test graph was held out from the training set11. Performance on the test set therefore indicates generalization of the inference procedures learned to previously unseen equivalence classes of causal DAGs. For these experiments, we used graphs with $N { = } 6$ nodes, because 5-node graphs have too few equivalence classes to partition in this way. All other details were the same as in the main paper. + +We see in Fig. 9a that the agents learn to generalize well to these held out examples, and we find the same pattern of behavior noted in the main text where the rewards earned are ordered such that Observational agent $<$ Passive-Conditional agent $<$ Passive-Interventional agent $<$ Passive-Counterfactual agent. We see additionally in Fig. 9b that the Active-Interventional agent performs at par with the Passive-Interventional agent (which is allowed to see the results of interventions on all nodes) and significantly better than an additional baseline we use here of the Random-Interventional agent whose information phase policy is to intervene on nodes at random, indicating that the intervention policy learned by the Active agent is good. + +# F GRAPHICAL MODELS AND BELIEF NETWORKS + +Graphical models (Pearl, 1988; Bishop, 2006; Koller & Friedman, 2009; Barber, 2012; Murphy, 2012) are a marriage between graph and probability theory that allows to graphically represent and assess statistical dependence. In the following sections, we give some basic definitions and describe a method $d \cdot$ -separation) for graphically assessing statistical independence in belief networks. + +# BASIC DEFINITIONS + +![](images/eb3d75dbb75e3bdfc96c2fcd4c13809197bbde2bcc0595748c0205078e4dbf78.jpg) +Figure 10: (a): Directed acyclic graph. The node $X _ { 3 }$ is a collider on the path $X _ { 1 } \right. X _ { 3 } \left. X _ { 2 }$ and a non-collider on the path $X _ { 2 } X _ { 3 } X _ { 4 }$ . (b): Cyclic graph obtained from (a) by adding a link from $X _ { 4 }$ to $X _ { 1 }$ . + +A graph is a collection of nodes and links connecting pairs of nodes. The links may be directed or undirected, giving rise to directed or undirected graphs respectively. + +A path from node $X _ { i }$ to node $X _ { j }$ is a sequence of linked nodes starting at $X _ { i }$ and ending at $X _ { j }$ . A directed path is a path whose links are directed and pointing from preceding towards following nodes in the sequence. + +A directed acyclic graph (DAG) is a directed graph with no directed paths starting and ending at the same node. For example, the directed graph in Fig. 10(a) is acyclic. The addition of a link from $X _ { 4 }$ to $X _ { 1 }$ gives rise to a cyclic graph (Fig. 10(b)). + +A node $X _ { i }$ with a directed link to $X _ { j }$ is called parent of $X _ { j }$ . In this case, $X _ { j }$ is called child of $X _ { i }$ . + +A node is a collider on a specified path if it has (at least) two parents on that path. Notice that a node can be a collider on a path and a non-collider on another path. For example, in Fig. 10(a) $X _ { 3 }$ is a collider on the path $X _ { 1 } \right. X _ { 3 } \left. X _ { 2 }$ and a non-collider on the path $X _ { 2 } X _ { 3 } X _ { 4 }$ . + +A node $X _ { i }$ is an ancestor of a node $X _ { j }$ if there exists a directed path from $X _ { i }$ to $X _ { j }$ . In this case, $X _ { j }$ is a descendant of $X _ { i }$ . + +A graphical model is a graph in which nodes represent random variables and links express statistical relationships between the variables. + +A belief network is a directed acyclic graphical model in which each node $X _ { i }$ is associated with the conditional distribution $p ( X _ { i } | \mathfrak { p a } ( X _ { i } ) )$ , where $\mathsf { p a } ( X _ { i } )$ indicates the parents of $X _ { i }$ . The joint distribution of all nodes in the graph, $p ( X _ { 1 : N } )$ , is given by the product of all conditional distributions, i.e. + +$$ +p ( X _ { 1 : N } ) { = } \prod _ { i = 1 } ^ { N } p ( X _ { i } | \mathsf { p a } ( X _ { i } ) ) . +$$ + +# ASSESSING STATISTICAL INDEPENDENCE IN BELIEF NETWORKS + +Given the sets of random variables $x , y$ and $\mathcal { Z }$ , $\mathcal { X }$ and $\mathcal { V }$ are statistically independent given $\mathcal { Z } \left( \mathcal { X } \perp \perp \mathcal { Y } | \mathcal { Z } \right)$ if all paths from any element of $\mathcal { X }$ to any element of $\mathcal { V }$ are closed (or blocked). A path is closed if at least one of the following conditions is satisfied: + +(Ia) There is a non-collider on the path which belongs to the conditioning set $\mathcal { Z }$ . (Ib) There is a collider on the path such that neither the collider nor any of its descendants belong to the conditioning set $\mathcal { Z }$ . \ No newline at end of file diff --git a/md/train/HJC2SzZCW/HJC2SzZCW.md b/md/train/HJC2SzZCW/HJC2SzZCW.md new file mode 100644 index 0000000000000000000000000000000000000000..e91a128664e5dd2e7aac03d50b763bef3c8df197 --- /dev/null +++ b/md/train/HJC2SzZCW/HJC2SzZCW.md @@ -0,0 +1,533 @@ +# SENSITIVITY AND GENERALIZATION IN NEURAL NETWORKS: AN EMPIRICAL STUDY + +Roman Novak, Yasaman Bahri∗, Daniel A. Abolafia, Jeffrey Pennington, Jascha Sohl-Dickstein + +Google Brain + +{romann, yasamanb, danabo, jpennin, jaschasd}@google.com + +# ABSTRACT + +In practice it is often found that large over-parameterized neural networks generalize better than their smaller counterparts, an observation that appears to conflict with classical notions of function complexity, which typically favor smaller models. In this work, we investigate this tension between complexity and generalization through an extensive empirical exploration of two natural metrics of complexity related to sensitivity to input perturbations. Our experiments survey thousands of models with various fully-connected architectures, optimizers, and other hyper-parameters, as well as four different image classification datasets. + +We find that trained neural networks are more robust to input perturbations in the vicinity of the training data manifold, as measured by the norm of the input-output Jacobian of the network, and that it correlates well with generalization. We further establish that factors associated with poor generalization – such as full-batch training or using random labels – correspond to lower robustness, while factors associated with good generalization – such as data augmentation and ReLU non-linearities – give rise to more robust functions. Finally, we demonstrate how the input-output Jacobian norm can be predictive of generalization at the level of individual test points. + +# 1 INTRODUCTION + +The empirical success of deep learning has thus far eluded interpretation through existing lenses of computational complexity (Blum & Rivest, 1988), numerical optimization (Choromanska et al., 2015; Goodfellow & Vinyals, 2014; Dauphin et al., 2014) and classical statistical learning theory (Zhang et al., 2016): neural networks are highly non-convex models with extreme capacity that train fast and generalize well. In fact, not only do large networks demonstrate good test performance, but larger networks often generalize better, counter to what would be expected from classical measures, such as VC dimension. This phenomenon has been observed in targeted experiments (Neyshabur et al., 2015), historical trends of Deep Learning competitions (Canziani et al., 2016), and in the course of this work (Figure 1). + +This observation is at odds with Occam’s razor, the principle of parsimony, as applied to the intuitive notion of function complexity (see A.2 for extended discussion). One resolution of the apparent contradiction is to examine complexity of functions in conjunction with the input domain. $f ( x ) =$ $x ^ { 3 } \sin ( x )$ may seem decisively more complex than $g ( x ) \ = \ x$ . But restrained to a narrow input domain of $[ - 0 . 0 1 , 0 . 0 1 ]$ they appear differently: $g$ remains a linear function of the input, while $f ( x ) = \mathcal { O } \left( x ^ { 4 } \right)$ resembles a constant 0. In this work we find that such intuition applies to neural networks, that behave very differently close to the data manifold than away from it (§4.1). + +We therefore analyze the complexity of models through their capacity to distinguish different inputs in the neighborhood of datapoints, or, in other words, their sensitivity. We study two simple metrics presented in $\ S$ and find that one of them, the norm of the input-output Jacobian, correlates with generalization in a very wide variety of scenarios. + +![](images/70e4dcb8c0388fbbde3942926af0c8f10e7242245a9f4630754e1feb8e6f2486.jpg) +Figure 1: 2160 networks trained to $100 \%$ training accuracy on CIFAR10 (see $\ S$ for experimental details). Left: while increasing capacity of the model allows for overfitting (top), very few models do, and a model with the maximum parameter count yields the best generalization (bottom right). Right: train loss does not correlate well with generalization, and the best model (minimum along the $y$ -axis) has training loss many orders of magnitude higher than models that generalize worse (left). This observation rules out underfitting as the reason for poor generalization in low-capacity models. See (Neyshabur et al., 2015) for similar findings in the case of achievable 0 training loss. + +This work considers sensitivity only in the context of image classification tasks. We interpret the observed correlation with generalization as an expression of a universal prior on (natural) image classification functions that favor robustness (see $\ S \mathrm { A } . 2$ for details). While we expect a similar prior to exist in many other perceptual settings, care should be taken when extrapolating our findings to tasks where such a prior may not be justified (e.g. weather forecasting). + +# 1.1 PAPER OUTLINE + +We first define sensitivity metrics for fully-connected neural networks in §3. We then relate them to generalization through a sequence of experiments of increasing level of nuance: + +• In §4.1 we begin by comparing the sensitivity of trained neural networks on and off the training data manifold, i.e. in the regions of best and typical (over the whole input space) generalization. +• In §4.2 we compare sensitivity of identical trained networks that differ in a single hyperparameter which is important for generalization. Further, $\ S$ associates sensitivity and generalization in an unrestricted manner, i.e. comparing networks of a wide variety of hyper-parameters such as width, depth, non-linearity, weight initialization, optimizer, learning rate and batch size. +• Finally, $\ S$ explores how predictive sensitivity (as measured by the Jacobian norm) is for individual test points. + +# 1.2 SUMMARY OF CONTRIBUTIONS + +The novelty of this work can be summarized as follows: + +• Study of the behavior of trained neural networks on and off the data manifold through sensitivity metrics (§4.1). • Evaluation of sensitivity metrics on trained neural networks in a very large-scale experimental setting and finding that they correlate with generalization (§4.2, §4.3, §4.4). + +§2 puts our work in context of related research studying complexity, generalization, or sensitivity metrics similar to ours. + +# 2 RELATED WORK + +# 2.1 COMPLEXITY METRICS + +We analyze complexity of fully-connected neural networks for the purpose of model comparison through the following sensitivity measures (see §3 for details): + +• estimating the number of linear regions a network splits the input space into; +• measuring the norm of the input-output Jacobian within such regions. + +A few prior works have examined measures related to the ones we consider. In particular, Pascanu et al. (2013); Montufar et al. ´ (2014); Raghu et al. (2016) have investigated the expressive power of fully-connected neural networks built out of piecewise-linear activation functions. Such functions are themselves piecewise-linear over their input domain, so that the number of linear regions into which input space is divided is one measure of how nonlinear the function is. A function with many linear regions has the capacity to build complex, flexible decision boundaries. It was argued in (Pascanu et al., 2013; Montufar et al. ´ , 2014) that an upper bound to the number of linear regions scales exponentially with depth but polynomially in width, and a specific construction was examined. Raghu et al. (2016) derived a tight analytic bound and considered the number of linear regions for generic networks with random weights, as would be appropriate, for instance, at initialization. However, the evolution of this measure after training has not been investigated before. We examine a related measure, the number of hidden unit transitions along one-dimensional trajectories in input space, for trained networks. Further motivation for this measure is discussed in §3. + +Another perspective on function complexity can be gained by studying their robustness to perturbations to the input. Indeed, Rasmussen & Ghahramani (2000) demonstrate on a toy problem how complexity as measured by the number of parameters may be of limited utility for model selection, while measuring the output variation allows the invocation of Occam’s razor. In this work we apply related ideas to a large-scale practical context of neural networks with up to a billion free parameters ( 4.2, 4.3) and discuss potential ways in which sensitivity permits the application of Occam’s razor to neural networks (§A.2). + +Sokolic et al. (2017) provide theoretical support for the relevance of robustness, as measured by the input-output Jacobian, to generalization. They derive bounds for the generalization gap in terms of the Jacobian norm within the framework of algorithmic robustness (Xu & Mannor, 2012). Our results provide empirical support for their conclusions through an extensive number of experiments. Several other recent papers have also focused on deriving tight generalization bounds for neural networks (Bartlett et al., 2017; Dziugaite & Roy, 2017; Neyshabur et al., 2018). We do not propose theoretical bounds in this paper but establish a correlation between our metrics and generalization in a substantially larger experimental setting than undertaken in prior works. + +# 2.2 REGULARIZATION + +In the context of regularization, increasing robustness to perturbations is a widely-used strategy: data augmentation, noise injection (Jiang et al., 2009), weight decay (Krogh & Hertz, 1992), and max-pooling all indirectly reduce sensitivity of the model to perturbations, while Rifai et al. (2011); Sokolic et al. (2017) explicitly penalize the Frobenius norm of the Jacobian in the training objective. + +In this work we relate several of the above mentioned regularizing techniques to sensitivity, demonstrating through extensive experiments that improved generalization is consistently coupled with better robustness as measured by a single metric, the input-output Jacobian norm (§4.2). While some of these findings confirm common-sense expectations (random labels increase sensitivity, Figure 4, top row), others challenge our intuition of what makes a neural network robust (ReLU-networks, with unbounded activations, tend to be more robust than saturating HardSigmoid-networks, Figure 4, third row). + +# 2.3 INDUCTIVE BIAS OF SGD + +One of our findings demonstrates an inductive bias towards robustness in stochastic mini-batch optimization compared to full-batch training (Figure 4, bottom row). Interpreting this regularizing effect in terms of some measure of sensitivity, such as curvature, is not new (Hochreiter & Schmidhuber, 1997; Keskar et al., 2016), yet we provide a novel perspective by relating it to reduced sensitivity to inputs instead of parameters. + +The inductive bias of SGD (“implicit regularization”) has been previously studied in (Neyshabur et al., 2015), where it was shown through rigorous experiments how increasing the width of a singlehidden-layer network improves generalization, and an analogy with matrix factorization was drawn to motivate constraining the norm of the weights instead of their count. Neyshabur et al. (2017) further explored several weight-norm based measures of complexity that do not scale with the size of the model. One of our measures, the Frobenius norm of the Jacobian is of similar nature (since the Jacobian matrix size is determined by the task and not by a particular network architecture). However, this particular metric was not considered, and, to the best of our knowledge, we are the first to evaluate it in a large-scale setting (e.g. our networks are up to 65 layers deep and up to $2 ^ { 1 6 }$ units wide). + +# 2.4 ADVERSARIAL EXAMPLES + +Sensitivity to inputs has attracted a lot of interest in the context of adversarial examples (Szegedy et al., 2013). Several attacks locate points of poor generalization in the directions of high sensitivity of the network (Goodfellow et al., 2014; Papernot et al., 2016; Moosavi-Dezfooli et al., 2016), while certain defences regularize the model by penalizing sensitivity (Gu & Rigazio, 2014) or employing decaying (hence more robust) non-linearities (Kurakin et al., 2016). However, work on adversarial examples relates highly specific perturbations to a similarly specific kind of generalization (i.e. performance on a very small, adversarial subset of the data manifold), while this paper analyzes average-case sensitivity (§3) and typical generalization. + +# 3 SENSITIVITY METRICS + +We propose two simple measures of sensitivity for a fully-connected neural network (without biases) $\mathbf { f } : \bar { \mathbb { R } } ^ { d } \overset { \cdot } { } \mathbb { R } ^ { n }$ with respect to its input $\mathbf { x } \in \mathbb { R } ^ { d }$ (the output being unnormalized logits of the $n$ classes). Assume f employs a piecewise-linear activation function, like ReLU. Then f itself, as a composition of linear and piecewise-linear functions, is a piecewise-linear map, splitting the input space $\mathbf { \mathbb { R } } ^ { d }$ into disjoint regions, implementing a single affine mapping on each. Then we can measure two aspects of sensitivity by answering + +1. How does the output of the network change as the input is perturbed within the linear region? + +2. How likely is the linear region to change in response to change in the input? + +We quantify these qualities as follows: + +1. For a local sensitivity measure we adopt the Frobenius norm of the class probabilities Jacobian $\mathbf { J } ( \mathbf { x } ) = \partial \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) / \partial \mathbf { x } ^ { \mathbf { T } }$ (with $\bar { J _ { i j } } ( \mathbf { x } ) = \partial \left[ \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) \right] _ { i } / \partial x _ { j } )$ , where $\mathbf { f } _ { \sigma } = \sigma \circ \mathbf { f }$ with $\pmb { \sigma }$ being the softmax function1. Given points of interest $\mathbf { x } _ { \mathrm { t e s t } }$ , we estimate the sensitivity of the function in those regions with the average Jacobian norm: + +$$ +\mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left[ \left. \mathbf { J } \left( \mathbf { x } _ { \mathrm { t e s t } } \right) \right. _ { F } \right] , +$$ + +that we will further refer to as simply “Jacobian norm”. Note that this does not require the labels for $\mathbf { x } _ { \mathrm { t e s t } }$ . + +Interpretation. The Frobenius norm $\begin{array} { r } { \| \mathbf { J } ( \mathbf { x } ) \| _ { F } = \sqrt { \sum _ { i j } J _ { i j } ( \mathbf { x } ) ^ { 2 } } } \end{array}$ estimates the averagecase sensitivity of $\mathbf { f } _ { \sigma }$ around $\mathbf { x }$ . Indeed, consider an infinitesimal Gaussian perturbation + +$\Delta \mathbf { x } \sim \mathcal { N } \left( \mathbf { 0 } , \epsilon \mathbf { I } \right)$ : the expected magnitude of the output change is then + +$$ +\begin{array} { l } { \displaystyle \mathbb { E } _ { \Delta \mathbf { x } } \left[ \big \| \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) - \mathbf { f } _ { \sigma } \left( \mathbf { x } + \Delta \mathbf { x } \right) \big \| _ { 2 } ^ { 2 } \right] \approx \mathbb { E } _ { \Delta \mathbf { x } } \left[ \big \| \mathbf { J } ( \mathbf { x } ) \Delta \mathbf { x } \big \| _ { 2 } ^ { 2 } \right] = \mathbb { E } _ { \Delta \mathbf { x } } \bigg [ \displaystyle \sum _ { i } \left( \displaystyle \sum _ { j } J _ { i j } x _ { j } \right) ^ { 2 } \bigg ] } \\ { = \displaystyle \sum _ { i j j ^ { \prime } } J _ { i j ^ { \prime } } \mathbb { E } _ { \Delta \mathbf { x } } \left[ x _ { j } x _ { j ^ { \prime } } \right] = \displaystyle \sum _ { i j } J _ { i j } ^ { 2 } \mathbb { E } _ { \Delta \mathbf { x } } \left[ x _ { j } ^ { 2 } \right] } \\ { = \epsilon \left\| \mathbf { J } \left( \mathbf { x } \right) \right\| _ { F } ^ { 2 } . } \end{array} +$$ + +2. To detect a change in linear region (further called a “transition”), we need to be able to identify it. We do this analogously to Raghu et al. (2016). For a network with piecewiselinear activations, we can, given an input $\mathbf { x }$ , assign a code to each neuron in the network f, that identifies the linear region of the pre-activation of that neuron. E.g. each ReLU unit will have 0 or 1 assigned to it if the pre-activation value is less or greater than 0 respectively. Similarly, a ReLU6 unit (see definition in A.4) will have a code of 0, 1, or 2 assigned, since it has 3 linear regions2. Then, a concatenation of codes of all neurons in the network (denoted by $\mathbf { c } ( \mathbf { x } ) \dot { }$ ) uniquely identifies the linear region of the input $\mathbf { x }$ (see A.1.1 for discussion of edge cases). + +Given this encoding scheme, we can detect a transition by detecting a change in the code. We then sample $k$ equidistant points $\mathbf { z } _ { 0 } , \ldots , \mathbf { z } _ { k - 1 }$ on a closed one-dimensional trajectory $\tau ( \mathbf { x } )$ (generated from a data point $\mathbf { x }$ and lying close to the data manifold; see below for details) and count transitions $t ( \mathbf { x } )$ along it to quantify the number of linear regions: + +$$ +t ( \mathbf { x } ) : = \sum _ { i = 0 } ^ { k - 1 } \left\| \mathbf { c } \left( \mathbf { z } _ { i } \right) - \mathbf { c } \left( \mathbf { z } _ { ( i + 1 ) } \% \right) \right\| _ { 1 } \approx \oint _ { \mathbf { z } \in \mathcal { T } ( \mathbf { x } ) } \left\| \frac { \partial \mathbf { c } ( \mathbf { z } ) } { \partial \left( d \mathbf { z } \right) } \right\| _ { 1 } d \mathbf { z } , +$$ + +where the norm of the directional derivative $\| \partial \mathbf { c ( z ) } / \partial \left( d \mathbf { z } \right) \| _ { 1 }$ amounts to a Dirac delta function at each transition (see A.1.2 for further details). + +By sampling multiple such trajectories around different points, we estimate the sensitivity metric: + +$$ +\mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left[ t \left( \mathbf { x } _ { \mathrm { t e s t } } \right) \right] , +$$ + +that we will further refer to as simply “transitions” or “number of transitions.” + +To assure the sampling trajectory $\tau ( \mathbf { x } _ { \mathrm { t e s t } } )$ is close to the data manifold (since this is the region of interest), we construct it through horizontal translations of the image $\mathbf { x } _ { \mathrm { t e s t } }$ in pixel space (Figure App.7, right). We similarly augment our training data with horizontal and vertical translations in the corresponding experiments (Figure 4, second row). + +As earlier, this metric does not require knowing the label of $\mathbf { x } _ { \mathrm { t e s t } }$ + +Interpretation. We can draw a qualitative parallel between the number of transitions and curvature of the function. One measure of curvature of a function $\mathbf { f }$ is the total norm of the directional derivative of its first derivative $\mathbf { f ^ { \prime } }$ along a path: + +$$ +C \left( \mathbf { f } , \mathcal { T } \left( \mathbf { x } \right) \right) : = \oint _ { \mathbf { z } \in \mathcal { T } \left( \mathbf { x } \right) } \left. \frac { \partial \mathbf { f } ^ { \prime } \left( \mathbf { z } \right) } { \partial \left( d \mathbf { z } \right) } \right. _ { F } d \mathbf { z } . +$$ + +A piecewise-linear function $\mathbf { f }$ has a constant first derivative $\mathbf { f ^ { \prime } }$ everywhere except for the transition boundaries. Therefore, for a sufficiently large $k$ , curvature can be expressed as + +$$ +C \left( \mathbf { f } , \mathcal { T } \left( { \mathbf { x } } \right) \right) = \frac { 1 } { 2 } \sum _ { i = 0 } ^ { k - 1 } \left\| \mathbf { f } ^ { \prime } \left( \mathbf { z } _ { i } \right) - \mathbf { f } ^ { \prime } \left( \mathbf { z } _ { \left( i + 1 \right) \mathcal { V } _ { 0 } k } \right) \right\| _ { F } , +$$ + +where $\mathbf { z } _ { 0 } , \ldots , \mathbf { z } _ { k - 1 }$ are equidistant samples on $\tau ( \mathbf { x } )$ . This sum is similar to $t ( \mathbf { x } )$ as defined in Equation 1, but quantifies the amount of change in between two linear regions in a nonbinary way. However, estimating it on a densely sampled trajectory is a computationallyintensive task, which is one reason we instead count transitions. + +As such, on a qualitative level, the two metrics (Jacobian norm and number of transitions) track the first and second order terms of the Taylor expansion of the function. + +Above we have defined two sensitivity metrics to describe the learned function around the data, on average. In $\ S 4 . 1$ we analyze these measures on and off the data manifold by simply measuring them along circular trajectories in input space that intersect the data manifold at certain points, but generally lie away from it (Figure 2, left). + +# 4 EXPERIMENTAL RESULTS + +In the following subsections $( \ S 4 . 2 , \ S 4 . 3 )$ each study analyzes performance of a large number (usually thousands) of fully-connected neural networks having different hyper-parameters and optimization procedures. Except where specified, we include only models which achieve $1 0 0 \%$ training accuracy. This allows us to study generalization disentangled from properties like expressivity and trainability, which are outside the scope of this work. + +In order to efficiently evaluate the compute-intensive metrics (§3) in a very wide range of hyperparameters settings (see e.g. §A.5.5) we only consider fully-connected networks. Extending the investigation to more complex architectures is left for future work. + +# 4.1 SENSITIVITY ON AND OFF THE TRAINING DATA MANIFOLD + +We analyze the behavior of a trained neural network near and away from training data. We do this by comparing sensitivity of the function along 3 types of trajectories: + +1. A random ellipse. This trajectory is extremely unlikely to pass anywhere near the real data, and indicates how the function behaves in random locations of the input space that it never encountered during training. +2. An ellipse passing through three training points of different class (Figure 2, left). This trajectory does pass through the three data points, but in between it traverses images that are linear combinations of different-class images, and are expected to lie outside of the natural image space. Sensitivity of the function along this trajectory allows comparison of its behavior on and off the data manifold, as it approaches and moves away from the three anchor points. +3. An ellipse through three training points of the same class. This trajectory is similar to the previous one, but, given the dataset used in the experiment (MNIST), is expected to traverse overall closer to the data manifold, since linear combinations of the same digit are more likely to resemble a realistic image. Comparing transition density along this trajectory to the one through points of different classes allows further assessment of how sensitivity changes in response to approaching the data manifold. + +We find that, according to both the Jacobian norm and transitions metrics, functions exhibit much more robust behavior around the training data (Figure 2, center and right). We further visualize this effect in 2D in Figure 3, where we plot the transition boundaries of the last (pre-logit) layer of a neural network before and after training. After training we observe that training points lie in regions of low transition density. + +The observed contrast between the neural network behavior near and away from data further strengthens the empirical connection we draw between sensitivity and generalization in 4.2, $\ S$ and $\ S 4 . 4$ ; it also confirms that, as mentioned in $\ S$ , if a certain quality of a function is to be used for model comparison, input domain should always be accounted for. + +# 4.2 SENSITIVITY AND GENERALIZATION FACTORS + +In §4.1 we established that neural networks implement more robust functions in the vicinity of the training data manifold than away from it. + +We now consider the more practical context of model selection. Given two perfectly trained neural networks, does the model with better generalization implement a less sensitive function? + +![](images/666edda8ac9d9eaf5f6fdc66680a7967be41df151d5abab635405f764d8a91b0.jpg) +Figure 2: A $100 \%$ -accurate (on training data) MNIST network implements a function that is much more stable near training data than away from it. Left: depiction of a hypothetical circular trajectory in input space passing through three digits of different classes, highlighting the training point locations $( \pi / 3 , \pi , 5 \pi / 3 )$ . Center: Jacobian norm as the input traverses an elliptical trajectory. Sensitivity drops significantly in the vicinity of training data while remaining uniform along random ellipses. Right: transition density behaves analogously. According to both metrics, as the input moves between points of different classes, the function becomes less stable than when it moves between points of the same class. This is consistent with the intuition that linear combinations of different digits lie further from the data manifold than those of same-class digits (which need not hold for more complex datasets). See §A.5.2 for experimental details. + +![](images/26dc8232e5455fc3cbb5efbca372d66b95f65de0585c5ca9cc90eb6957706b9c.jpg) +Figure 3: Transition boundaries of the last (pre-logits) layer over a 2-dimensional slice through the input space defined by 3 training points (indicated by inset squares). Left: boundaries before training. Right: after training, transition boundaries become highly non-isotropic, with training points lying in regions of lower transition density. See §A.5.3 for experimental details. + +We study approaches in the machine learning community that are commonly believed to influence generalization (Figure 4, top to bottom): + +random labels; +• data augmentation; +• ReLUs; +• full-batch training. + +We find that in each case, the change in generalization is coupled with the respective change in sensitivity (i.e. lower sensitivity corresponds to smaller generalization gap) as measured by the Jacobian norm (and almost always for the transitions metric). + +![](images/0bc5498be3d19fbcc6011eabf8d2030c7f31633b9b2f22923c2c452f4aa39526.jpg) +Figure 4: Improvement in generalization (left column) due to using correct labels, data augmentation, ReLUs, mini-batch optimization (top to bottom) is consistently coupled with reduced sensitivity as measured by the Jacobian norm (center column). Transitions (right column) correlate with generalization in all considered scenarios except for comparing optimizers (bottom right). Each point on the plot corresponds to two neural networks that share all hyper-parameters and the same optimization procedure, but differ in a certain property as indicated by axes titles. The coordinates along each axis reflect the values of the quantity in the title of the plot in the respective setting (i.e. with true or random labels). All networks have reached $1 0 0 \%$ training accuracy on CIFAR10 in both settings (except for the data-augmentation study, second row; see $\ S$ for details). See §A.5.5 for experimental details (§A.5.4 for the data-augmentation study) and §4.2.1 for plot interpretation. + +# 4.2.1 HOW TO READ PLOTS + +In Figure 4, for many possible hyper-parameter configurations, we train two models that share all parameters and optimization procedure, but differ in a single binary setting (i.e. trained on true or random labels; with or without data augmentation; etc). Out of all such network pairs, we select only those where each network reached $100 \%$ training accuracy on the whole training set (apart from the data augmentation study). The two generalization or sensitivity values are then used as the $x$ and $y$ coordinates of a point corresponding to this pair of networks (with the plot axes labels denoting the respective value of the binary parameter considered). The position of the point with respect to the diagonal $y = x$ visually demonstrates which configuration has smaller generalization gap / lower sensitivity. + +# 4.3 SENSITIVITY AND GENERALIZATION GAP + +We now perform a large-scale experiment to establish direct relationships between sensitivity and generalization in a realistic setting. In contrast to $\ S 4 . 1$ , where we selected locations in the input space, and $\ S 4 . 2$ , where we varied a single binary parameter impacting generalization, we now sweep simultaneously over many different architectural and optimization choices (§A.5.5). + +Our main result is presented in Figure 5, indicating a strong relationship between the Jacobian norm and generalization. In contrast, Figure App.8 demonstrates that the number of transitions is not alone sufficient to compare networks of different sizes, as the number of neurons in the networks has a strong influence on transition count. + +![](images/26166cb15d9564aa43e341cc1c2adec5770289cc4323ba4a4686e1bf2299d8f6.jpg) +Figure 5: Jacobian norm correlates with generalization gap on all considered datasets. Each point corresponds to a network trained to $100 \%$ training accuracy (or at least $9 9 . 9 \%$ in the case of CIFAR100). See §A.5.4 and §A.5.5 for experimental details of bottom and top plots respectively. + +# 4.4 SENSITIVITY AND PER-POINT GENERALIZATION + +In §4.3 we established a correlation between sensitivity (as measured by the Jacobian norm) and generalization averaged over a large test set $1 0 ^ { 4 }$ points). We now investigate whether the Jacobian norm can be predictive of generalization at individual points. + +As demonstrated in Figure 6 (top), Jacobian norm at a point is predictive of the cross-entropy loss, but the relationship is not a linear one, and not even bijective (see $\ S$ for analytic expressions explaining it). In particular, certain misclassified points (right sides of the plots) have a Jacobian norm many orders of magnitude smaller than that of the correctly classified points (left sides). However, we do remark a consistent tendency for points having the highest values of the Jacobian norm to be mostly misclassified. A similar yet noisier trend is observed in networks trained using $\ell _ { 2 }$ -loss as depicted in Figure 6 (bottom). These observations make the Jacobian norm a promising quantity to consider in the contexts of active learning and confidence estimation in future research. + +![](images/c9925fc3388e008626ec6a041d41f0857febf74c821ea40576c4b1e1fc8a20b5.jpg) +Figure 6: Jacobian norm plotted against individual test point loss. Each plot shows 5 random networks that fit the respective training set with $1 0 0 \%$ accuracy, with each network having a unique color. Top: Jacobian norm plotted against cross-entropy loss. These plots experimentally confirm the relationship established in $\ S$ and Figure App.11. Bottom: Jacobian norm plotted against $\ell _ { 2 }$ -loss, for networks trained on $\ell _ { 2 }$ -loss, exhibits a similar behavior. See $\ S$ for experimental details and Figure App.9 for similar observations on other datasets. + +# 5 CONCLUSION + +We have investigated sensitivity of trained neural networks through the input-output Jacobian norm and linear regions counting in the context of image classification tasks. We have presented extensive experimental evidence indicating that the local geometry of the trained function as captured by the input-output Jacobian can be predictive of generalization in many different contexts, and that it varies drastically depending on how close to the training data manifold the function is evaluated. We further established a connection between the cross-entropy loss and the Jacobian norm, indicating that it can remain informative of generalization even at the level of individual test points. Interesting directions for future work include extending our investigation to more complex architectures and other machine learning tasks. + +# 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. + +Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky. Spectrally-normalized margin bounds for neural networks. In Advances in Neural Information Processing Systems, pp. 6241–6250, 2017. + +Avrim Blum and Ronald L. Rivest. Training a 3-node neural network is np-complete. In Machine Learning: From Theory to Applications, 1988. + +Alfredo Canziani, Adam Paszke, and Eugenio Culurciello. An analysis of deep neural network models for practical applications. CoRR, abs/1605.07678, 2016. + +Anna Choromanska, Mikael Henaff, Michael Mathieu, Gerard Ben Arous, and Yann LeCun. The ´ loss surfaces of multilayer networks. In Artificial Intelligence and Statistics, pp. 192–204, 2015. + +Yann Dauphin, Razvan Pascanu, aglar Gulehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Ben- ¨ gio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In NIPS, 2014. + +Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017. + +Daniel Golovin, Benjamin Solnik, Subhodeep Moitra, Greg Kochanski, John Karro, and D Sculley. Google vizier: A service for black-box optimization. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1487–1495. ACM, 2017. + +Ian J. Goodfellow and Oriol Vinyals. Qualitatively characterizing neural network optimization problems. CoRR, abs/1412.6544, 2014. + +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. + +Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014. + +Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, pp. 3059–3068, 2016. + +Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Neural networks for machine learninglecture 6a-overview of mini-batch gradient descent, 2012. + +Sepp Hochreiter and Jurgen Schmidhuber. Flat minima. ¨ Neural Computation, 9(1):1–42, 1997. + +William H Jefferys and James O Berger. Ockham’s razor and bayesian analysis. American Scientist, 80(1):64–72, 1992. + +Yulei Jiang, Richard M Zur, Lorenzo L Pesce, and Karen Drukker. A study of the effect of noise injection on the training of artificial neural networks. In Neural Networks, 2009. IJCNN 2009. International Joint Conference on, pp. 1428–1432. IEEE, 2009. + +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. + +Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +Alex Krizhevsky. Convolutional deep belief networks on cifar-10. 2010. + +Anders Krogh and John A Hertz. A simple weight decay can improve generalization. In Advances in neural information processing systems, pp. 950–957, 1992. + +Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016. + +Jaehoon Lee, Yasaman Bahri, Roman Novak, Sam Schoenholz, Jeffrey Pennington, and Jascha Sohldickstein. Deep neural networks as gaussian processes. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\equiv$ B1EA-M-0Z. + +David JC MacKay. Bayesian interpolation. 1991. + +David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992. + +G. Montufar, R. Pascanu, K. Cho, and Y. Bengio. On the Number of Linear Regions of Deep Neural ´ Networks. Neural Information Processing Systems, February 2014. + +Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. arXiv preprint arXiv:1610.08401, 2016. + +Iain Murray and Zoubin Ghahramani. A note on the evidence and bayesian occam’s razor, 2005. + +Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th international conference on machine learning (ICML-10), pp. 807–814, 2010. + +Radford M. Neal. Priors for infinite networks (tech. rep. no. crg-tr-94-1). University of Toronto, 1994. + +Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. Proceeding of the international Conference on Learning Representations workshop track, abs/1412.6614, 2015. + +Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nathan Srebro. Exploring generalization in deep learning. CoRR, abs/1706.08947, 2017. + +Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=Skz_WfbCZ. + +Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016. + +R. Pascanu, G. Montufar, and Y. Bengio. On the number of response regions of deep feed forward networks with piece-wise linear activations. International Conference on Learning Representations, December 2013. + +B. Poole, S. Lahiri, M. Raghu, J. Sohl-Dickstein, and S. Ganguli. Exponential expressivity in deep neural networks through transient chaos. Neural Information Processing Systems, June 2016. + +M. Raghu, B. Poole, J. Kleinberg, S. Ganguli, and J. Sohl-Dickstein. On the Expressive Power of Deep Neural Networks. International Conference on Machine Learning, June 2016. + +Carl E. Rasmussen and Zoubin Ghahramani. Occam’s razor. In NIPS, 2000. + +Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive autoencoders: Explicit invariance during feature extraction. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 833–840, 2011. + +David E Rumelhart, Geoffrey E Hinton, Ronald J Williams, et al. Learning representations by back-propagating errors. Cognitive modeling, 5(3):1, 1988. + +Jure Sokolic, Raja Giryes, Guillermo Sapiro, and Miguel RD Rodrigues. Robust large margin deep neural networks. IEEE Transactions on Signal Processing, 2017. + +Ercan Solak, Roderick Murray-Smith, William E Leithead, Douglas J Leith, and Carl E Rasmussen. Derivative observations in gaussian process models of dynamic systems. In Advances in neural information processing systems, pp. 1057–1064, 2003. + +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. + +Matus Telgarsky. Representation benefits of deep feedforward networks. CoRR, abs/1509.08101, 2015. + +Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. + +Huan Xu and Shie Mannor. Robustness and generalization. Machine learning, 86(3):391–423, 2012. + +C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. International Conference on Learning Representations, November 2016. + +# A APPENDIX + +# A.1 TRANSITION METRIC DETAILS + +# A.1.1 LINEAR REGION ENCODING + +The way of encoding a linear region $\mathbf { c } \left( \mathbf { z } \right)$ of a point $\mathbf { z }$ described in §3 (2) guarantees that different regions obtain different codes, but different codes might be assigned to the same region if all the neurons in any layer of the network are saturated (or if weights leading from the transitioning unit to active units are exactly zero, or exactly cancel). However, the probability of such an arrangement drops exponentially with width and hence is ignored in this work. + +# A.1.2 TRANSITION COUNTING + +The equality between the discrete and continuous versions of $t \left( \mathbf { x } \right)$ in Equation 1 becomes exact with a high-enough sampling density $k$ such that there are no narrow linear regions missed in between consecutive points (precisely, the encoding $\mathbf { c } \left( \mathbf { z } \right)$ has to only change at most once on the line between two consecutive points $\mathbf { z } _ { i }$ and $\mathbf { z } _ { i + 1 }$ ). + +For computational efficiency we also assume that no two neurons transitions simultaneously, which is extremely unlikely in the context of random initialization and stochastic optimization. + +![](images/1a3bf6f1955f6cf898f95de9d05feffa17ba642a01582b9d5c4d3f71d290741a.jpg) +Figure App.7: Depiction of a trajectory in input space used to count transitions as defined in §3 (2). An interpolation between 28 horizontal translations of a single digit results in a complex trajectory that constrains all points to lie close to the translation-augmented data, and allows for a tractable estimate of transition density around the data manifold. This metric is used to compare models in 4.2 and 4.3. Straight lines indicate boundaries between different linear regions (straight-line boundaries between linear regions is accurate for the case of a single-layer piecewise-linear network. The partition into linear regions is more complex for deeper networks (Raghu et al., 2016)). + +![](images/f27e7f4b1b4dd167346b5033c21867861f4178042017ef8e48e7ba3e522d108b.jpg) +Figure App.8: Number of transitions, in contrast to Figure 5, does not generally correlate with generalization gap. Left: 2160 networks with $1 0 0 \%$ train accuracy on CIFAR10. Right: 2097 networks with at least $9 9 . 9 \%$ training accuracy on CIFAR100. See §A.5.5 for experimental details. + +![](images/3c841fa462085be2747162741dc6ac9a5e7c78e3273c86d56ac75bc6efde0b3f.jpg) +Figure App.9: Jacobian norm plotted against individual test point loss on Fashion-MNIST (Xiao et al., 2017) and CIFAR100. As in Figure 6, each plot shows 5 random networks that fit the respective training set to a $1 0 0 \%$ with each network having a unique color. See §A.5.6 for experimental details. + +# A.2 DO NEURAL NETWORKS DEFY OCCAM’S RAZOR? + +Here we briefly discuss the motivation of this work in the context of Occam’s razor. + +Occam’s razor is a heuristic for model comparison based on their complexity. Given a dataset $\mathcal { D }$ , Occam’s razor gives preference to simpler models $\mathcal { H }$ . In the Bayesian interpretation of the heuristic (Jefferys & Berger, 1992) simplicity is defined as evidence $\mathbb { P } \left[ \mathcal { D } | \mathcal { H } \right]$ and is often computed using the Laplace approximation. Under further assumptions (MacKay, 1991), this evidence can be shown to be inversely proportional to the number of parameters in the model. Therefore, given a uniform prior $\mathbb { P } \left[ \mathcal { H } \right]$ on two competing hypothesis classes, the class posterior $\mathbb { P } \left[ \mathcal { H } | \mathcal { D } \right] \sim \bar { \mathbb { P } } \left[ \mathcal { D } | \mathcal { H } \right] \mathbb { P } \left[ \mathcal { H } \right]$ is higher for a model with fewer parameters. + +An alternative, qualitative justification of the heuristic is through considering the evidence as a normalized probability distribution over the whole dataset space: + +$$ +\int _ { D ^ { \prime } } \mathbb { P } \left[ \mathcal { D ^ { \prime } } | \mathcal { H } \right] d \mathcal { D ^ { \prime } } = 1 +$$ + +and remarking that models with more parameters have to spread the probability mass more evenly across all the datasets by virtue of being able to fit more of them (Figure App.10, left). This similarly suggests (under a uniform prior on competing hypothesis classes) preferring models with fewer parameters, assuming that evidence is unimodal and peaks close to the dataset of interest. + +Occam’s razor for neural networks. As seen in Figure 1, the above reasoning does not apply to neural networks: the best achieved generalization is obtained by a model that has around $1 0 ^ { \bar { 4 } }$ times as many parameters as the simplest model capable of fitting the dataset (within the evaluated search space). + +On one hand, Murray & Ghahramani (2005); Telgarsky (2015) demonstrate on concrete examples that a high number of free parameters in the model doesn’t necessarily entail high complexity. On the other hand, a large body of work on the expressivity of neural networks (Pascanu et al., 2013; Montufar et al. ´ , 2014; Raghu et al., 2016; Poole et al., 2016) shows that their ability to compute complex functions increases rapidly with size, while Zhang et al. (2016) validates that they also easily fit complex (even random) functions with stochastic optimization. Classical metrics like VC dimension or Rademacher complexity increase with size of the network as well. This indicates that weights of a neural network may actually correspond to its usable capacity, and hence “smear” the evidence $\mathbb { P } \left[ \mathcal { D } | \mathcal { H } \right]$ along a very large space of datasets $\mathcal { D } ^ { \prime }$ , making the dataset of interest $\mathcal { D }$ less likely. + +Potential issues. We conjecture the Laplace approximation of the evidence $\mathbb { P } \left[ \mathcal { D } | \mathcal { H } \right]$ and the simplified estimation of the “Occam’s factor” in terms of the accessible volume of the parameter space might not hold for neural networks in the context of stochastic optimization, and, in particular, do not account for the combinatorial growth of the accessible volume of parameter space as width increases (MacKay, 1992). Similarly, when comparing evidence as probability distributions over datasets, the difference between two neural networks may not be as drastic as in Figure App.10 (left), but more nuanced as depicted in Figure App.10 (right), with the evidence ratio being highly dependent on the particular dataset. + +We interpret our work as defining hypothesis classes based on sensitivity of the hypothesis (which yielded promising results in (Rasmussen & Ghahramani, 2000) on a toy task) and observing a strongly non-uniform prior on these classes that enables model comparison. Indeed, at least in the context of natural images classification, putting a prior on the number of parameters or Kolmogorov complexity of the hypothesis is extremely difficult. However, a statement that the true classification function is robust to small perturbations in the input is much easier to justify. As such, a prior $\mathbb { P } \left[ \mathcal { H } \right]$ in favor of robustness over sensitivity might fare better than a prior on specific network hyper-parameters. + +Above is one way to interpret the correlation between sensitivity and generalization that we observe in this work. It does not explain why large networks tend to converge to less sensitive functions. We conjecture large networks to have access to a larger space of robust solutions due to solving a highly-underdetermined system when fitting a dataset, while small models converge to more extreme weight values due to being overconstrained by the data. However, further investigation is needed to confirm this hypothesis. + +![](images/12e600f6f7004b1aeff2de1183fd3bae4d13d1b72b3ab0b7d54ee9951c86c3aa.jpg) +Figure App.10: Occam’s razor: simplified expectation vs hypothesized reality. All datasets $\mathcal { D } ^ { \prime }$ with input and target dimensions matching those of a particular dataset $\mathcal { D }$ are sorted according to the evidence $\mathbb { P } \left[ \mathcal { D } ^ { \prime } | \mathcal { H } \right]$ of a large model $\mathcal { H } _ { \mathrm { l } }$ from left to right along the horizontal axis. Left: a classic simplified depiction of Bayesian Occam’s razor. Evidence $\mathbb { P } [ \bar { \mathcal { D } } ^ { \prime } | \mathcal { H } ]$ of a small model $\mathcal { H } _ { \mathrm { s } }$ with few parameters has narrow support in the dataset space and is more peaked. If the model fits the dataset $\mathcal { D }$ well, it falls close to the peak and outperforms a larger model $\mathcal { H } _ { \mathrm { l } }$ with more parameters, having wider support. Right: suggested potential reality of neural networks. Evidence of the small model $\mathcal { H } _ { \mathrm { s } }$ peaks higher, but the large model $\mathcal { H } _ { \mathrm { l } }$ might nonetheless concentrate the majority of probability mass on simple functions and the evidence curves might intersect at a small angle. In this case, while a dataset $\mathcal { D }$ lying close to the intersection can be fit by both models, the Bayesian evidence ratio depends on its exact position with respect to the intersection. + +# A.3 BOUNDING THE JACOBIAN NORM + +Here we analyze the relationship between the Jacobian norm and the cross-entropy loss at individual test points as studied in §4.4. + +Target class Jacobian. We begin by relating the derivative of the target class probability $\mathbf { J } _ { y ( \mathbf { x } ) }$ to per-point cross-entropy loss $l ( \mathbf { x } ) = - \log \left[ \mathbf { f } _ { \sigma } ( \mathbf { x } ) \right] _ { y ( \mathbf { x } ) }$ (where $y ( \mathbf x )$ is the correct integer class). + +We will denote ${ \bf f } _ { \sigma } ( { \bf x } )$ by $\sigma$ and drop the $\mathbf { x }$ argument to de-clutter notation (i.e. write f instead of $\mathbf { f } \left( \mathbf { x } \right) .$ ). Then the Jacobian can be expressed as + +$$ +\mathbf { J } = \left[ \left( \sigma \mathbf { 1 } ^ { T } \right) \odot \left( \mathbf { I } - \pmb { \sigma } \mathbf { 1 } ^ { T } \right) ^ { T } \right] \left( \frac { \partial \mathbf { f } } { \partial \mathbf { x } ^ { T } } \right) , +$$ + +where $\odot$ is the Hadamard element-wise product. Then indexing both sides of the equation at the correct class $y$ yields + +$$ +\mathbf { J } _ { y } = \sigma _ { y } \left( \left( \mathbf { e } _ { y } - \pmb { \sigma } \right) ^ { T } \left( \frac { \partial \mathbf { f } } { \partial \mathbf { x } ^ { T } } \right) \right) , +$$ + +where $\mathbf { e } _ { y }$ is a vector of zeros everywhere except for $e _ { y } = 1$ . Taking the norm of both sides results in + +$$ +\begin{array} { c } { \displaystyle | | \mathbf { J } _ { y } | | _ { 2 } ^ { 2 } = \sigma _ { y } ^ { 2 } \sum _ { k = 1 } ^ { d } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } \left( \frac { \partial f _ { y } } { \partial x _ { k } } \right) ^ { 2 } + \sum _ { j \neq y } ^ { n } \left( \sigma _ { j } \frac { \partial f _ { j } } { \partial x _ { k } } \right) ^ { 2 } \right] } \\ { = \displaystyle \sigma _ { y } ^ { 2 } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } \sum _ { k = 1 } ^ { d } \left( \frac { \partial f _ { y } } { \partial x _ { k } } \right) ^ { 2 } + \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \sum _ { k = 1 } ^ { d } \left( \frac { \partial f _ { j } } { \partial x _ { k } } \right) ^ { 2 } \right] } \\ { = \displaystyle \sigma _ { y } ^ { 2 } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } \left\| \frac { \partial f _ { y } } { \partial \mathbf { x } ^ { T } } \right\| _ { 2 } ^ { 2 } + \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \left\| \frac { \partial f _ { j } } { \partial \mathbf { x } ^ { T } } \right\| _ { 2 } ^ { 2 } \right] } \end{array} +$$ + +We now assume that magnitudes of the individual logit derivatives vary little in between logits and over the input space3: + +$$ +\left. \frac { \partial f _ { i } } { \partial \mathbf { x } ^ { T } } \right. _ { 2 } ^ { 2 } \approx \frac { 1 } { n } \mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left. \frac { \partial \mathbf { f } } { \partial \mathbf { x } _ { \mathrm { t e s t } } ^ { T } } \right. _ { F } ^ { 2 } , +$$ + +which simplifies Equation 4 to + +$$ +\left\| \mathbf { J } _ { y } \right\| _ { 2 } ^ { 2 } \approx M \sigma _ { y } ^ { 2 } \left[ ( 1 - \sigma _ { y } ) ^ { 2 } + \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \right] , +$$ + +where $M = \mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left\| \partial \mathbf { f } / \partial \mathbf { x } _ { \mathrm { t e s t } } ^ { T } \right\| _ { F } ^ { 2 } / n$ . Since $\sigma$ lies on the $( n - 1 )$ -simplex $\Delta ^ { n - 1 }$ , under these assumptions we can bound: + +$$ +\frac { ( 1 - \sigma _ { y } ) ^ { 2 } } { n - 1 } \leqslant \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \leqslant ( 1 - \sigma _ { y } ) ^ { 2 } , +$$ + +and finally + +$$ +\frac { n } { n - 1 } M \sigma _ { y } ^ { 2 } \left( 1 - \sigma _ { y } \right) ^ { 2 } \lessapprox \left\| \mathbf { J } _ { y } \right\| _ { 2 } ^ { 2 } \lessapprox 2 M \sigma _ { y } ^ { 2 } \left( 1 - \sigma _ { y } \right) ^ { 2 } , +$$ + +or, in terms of the cross-entropy loss $l = - \log \sigma _ { y }$ + +$$ +\sqrt { \frac { n M } { n - 1 } } \mathbb { e } ^ { - l } \left( 1 - \Phi ^ { - l } \right) \lessapprox \left. \mathbf { J } _ { y } \right. _ { 2 } \lessapprox \sqrt { 2 M } \mathbb { e } ^ { - l } \left( 1 - \Phi ^ { - l } \right) . +$$ + +We validate these approximate bounds in Figure App.11 (top). + +Full Jacobian. Equation 5 establishes a close relationship between $\mathbf { J } _ { y }$ and loss $l = - \log \sigma _ { y }$ , but of course, at test time we do not know the target class $y$ . This allows us to only bound the full Jacobian norm from below: + +$$ +\sqrt { \frac { n M } { n - 1 } } \circledast ^ { - l } \left( 1 - \circledast ^ { - l } \right) \precapprox \| \mathbf { J } _ { y } \| _ { 2 } \leqslant \| \mathbf { J } \| _ { F } . +$$ + +For the upper bound, we assume the maximum-entropy case of $\sigma _ { y }$ : $\sigma _ { i } \approx ( 1 - \sigma _ { y } ) / ( n - 1 )$ , for $i \neq y$ . The Jacobian norm is + +$$ +\left\| \mathbf { J } \right\| _ { F } ^ { 2 } = \sum _ { i = 1 } ^ { n } \left\| \mathbf { J } _ { i } \right\| _ { 2 } ^ { 2 } = \left\| \mathbf { J } _ { y } \right\| _ { 2 } ^ { 2 } + \sum _ { i \neq y } ^ { n } \left\| \mathbf { J } _ { i } \right\| _ { 2 } ^ { 2 } , +$$ + +where the first summand becomes: + +$$ +\Vert \mathbf { J } _ { y } \Vert _ { 2 } ^ { 2 } \approx M \sigma _ { y } ^ { 2 } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } + \left( n - 1 \right) \left( \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } \right] = \frac { M n } { n - 1 } \sigma _ { y } ^ { 2 } \left( 1 - \sigma _ { y } \right) ^ { 2 } , +$$ + +and each of the others + +$$ +\begin{array} { l } { { \displaystyle \left\| { \bf J } _ { i } \right\| _ { 2 } ^ { 2 } \approx M \left( \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } \left[ \left( 1 - \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } + \left( \sigma _ { y } ^ { 2 } + ( n - 2 ) \left( \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } \right) \right] } } \\ { { \displaystyle \qquad = \frac { M } { ( n - 1 ) ^ { 3 } } \left( 1 - \sigma _ { y } \right) ^ { 2 } \left( n \sigma _ { y } ^ { 2 } + n - 2 \right) ^ { 2 } . } } \end{array} +$$ + +Adding $n - 1$ of such summands to $\| \mathbf { J } _ { y } \| _ { 2 } ^ { 2 }$ results in + +$$ +\| { \bf J } \| _ { F } \approx \frac { \sqrt { M } } { ( n - 1 ) } ( 1 - \sigma _ { y } ) \sqrt { n ^ { 2 } \sigma _ { y } ^ { 2 } + n - 2 } = \frac { \sqrt { M } } { ( n - 1 ) } \left( 1 - \mathrm { e } ^ { - l } \right) \sqrt { n ^ { 2 } \mathrm { e } ^ { - 2 l } + n - 2 } , +$$ + +compared against the lower bound (Equation 6) and experimental data in Figure App.11. + +![](images/e0625d13f1d1704d242feb7d156eb440d03aab6c519bb88881e108cfcac63f04.jpg) +Cross-entropy loss + +Figure App.11: Top: Jacobian norm $\left\| \mathbf { J } _ { y } \left( \mathbf { x } \right) \right\| _ { 2 } = \left\| \partial \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) _ { y } / \partial \mathbf { x } ^ { T } \right\| _ { 2 }$ of the true class $y$ output probability is tightly related to the cross-entropy loss. Each point corresponds to one of the 1000 test inputs to a $100 \%$ trained network on CIFAR10, while lines depict analytic bounds from Equation 5. Bottom: Same experiment plotting the full Jacobian norm $\| \bar { \mathbf { J } } \| _ { F }$ against cross-entropy. Solid lines correspond to the lower bound from Equation 6 and the norm approximation from Equation 7. See $\ S _ { \mathrm { A } . 5 . 7 }$ for experimental details and Figures 6 and App.9 for empirical evaluation of this relationship on multiple datasets and models. + +# A.4 NON-LINEARITIES DEFINITIONS + +Following activation functions are used in this work: + +1. ReLU (Nair & Hinton, 2010): $\mathrm { m a x } ( x , 0 )$ ; +2. ReLU6 (Krizhevsky, 2010): min $( \operatorname* { m a x } ( x , 0 ) , 6 )$ ; +3. Tanh: hyperbolic tangent, $( e ^ { x } - e ^ { - x } ) / ( e ^ { x } + e ^ { - x } )$ ; +4. HardTanh (Gulcehre et al., 2016): $\operatorname* { m i n } { ( \operatorname* { m a x } ( x , - 1 ) , 1 ) }$ ; +5. HardSigmoid (Gulcehre et al., 2016): $\operatorname* { m i n } { ( \operatorname* { m a x } ( x + 0 . 5 , 0 ) , 1 ) }$ ; + +# A.5 EXPERIMENTAL SETUP + +All experiments were implemented in Tensorflow (Abadi et al., 2016) and executed with the help of Vizier (Golovin et al., 2017). All networks were trained with cross-entropy loss. All networks were trained without biases. All computations were done with 32-bit precision. Learning rate decayed by a factor of 0.1 every 500 epochs. + +Unless specified otherwise, initial weights were drawn from a normal distribution with zero mean and variance $2 / n$ for ReLU, ReLU6 and HardSigmoid; $1 / n$ for Tanh and HardTanh, where $n$ is the number of inputs to the current layer. + +All inputs were normalized to have zero mean and unit variance, or, in other terms, lie on the $d$ - dimensional sphere of radius $\sqrt { d }$ , where $d$ is the dimensionality of the input. + +All reported values, when applicable, were evaluated on the whole training and test sets of sizes 50000 and 10000 respectively. E.g. “generalization gap” is defined as the difference between train and test accuracies evaluated on the whole train and test sets. + +When applicable, all trajectories/surfaces in input space were sampled with $2 ^ { 2 0 }$ points. + +# A.5.1 PLOTS AND ERROR BARS + +All figures except for 6 and App.11 are plotted with (pale) error bars (when applicable). The reported quantity was usually evaluated 8 times with random seeds from 1 to $8$ , unless specified otherwise. E.g. if a network is said to be $100 \%$ -accurate on the training set, it means that each of the 8 randomlyinitialized networks is $100 \%$ -accurate after training. + +The error bar is centered at the mean value of the quantity and spans the standard error of the mean in each direction. If the bar appears to not be visible, it may be smaller than the mean value marker. + +Weight initialization, training set shuffling, data augmentation, picking anchor points of data-fitted trajectories, selecting axes of a zero-centered elliptic trajectory depend on the random seed. + +# A.5.2 SENSITIVITY ALONG A TRAJECTORY + +Relevant figure 2. + +A 20-layer ReLU-network of width 200 was trained on MNIST 128 times, with plots displaying the averaged values. + +A random zero-centered ellipse was obtained by generating two axis vectors with normallydistributed entries of zero mean and unit variance (as such making points on the trajectory have an expected norm equal to that of training data) and sampling points on the ellipse with given axes. + +A random data-fitted ellipse was generated by projecting three arbitrary input points onto a plane where they fall into vertices of an equilateral triangle, and then projecting their circumcircle back into the input space. + +# A.5.3 LINEAR REGION BOUNDARIES + +Relevant figure 3. + +A 15-layer ReLU6-network of width 300 was trained on MNIST for $2 ^ { 1 8 }$ steps using SGD with momentum (Rumelhart et al., 1988); images were randomly translated with wrapping by up to 4 pixels in each direction, horizontally and vertically, as well as randomly flipped along each axis, and randomly rotated by 90 degrees clockwise and counter-clockwise. + +The sampling grid in input space was obtain by projecting three arbitrary input points into a plane as described in §A.5.2 such that the resulting triangle was centered at 0 and it’s vertices were at a distance 0.8 form the origin. Then, a sampling grid of points in the $[ - 1 ; 1 ] ^ { \times 2 }$ square was projected back into the input space. + +# A.5.4 SMALL EXPERIMENT + +Relevant figures: 4 (second row) and 5 (bottom). + +All networks were trained for $2 ^ { 1 8 }$ steps of batch size of 256 using SGD with momentum. Learning rate was set to 0.005 and momentum term coefficient to 0.9. + +Data augmentation consisted of random translation of the input by up to 4 pixels in each direction with wrapping, horizontally and vertically. The input was also flipped horizontally with probability 0.5. When applying data augmentation (second row of Figure 4), the network is unlikely to encounter the canonical training data, hence few configurations achieved $1 0 0 \%$ training accuracy. However, we verified that all networks trained with data augmentation reached a higher test accuracy than their analogues without, ensuring that the generalization gap shrinks not simply because of lower training accuracy. + +For each dataset, networks of width $\{ 1 0 0 , 2 0 0 , 5 0 0 , 1 0 0 0 , 2 0 0 0 , 3 0 0 0 \}$ , depth $\{ 2 , 3 , 5 , 1 0 , 1 5 , 2 0 \}$ and activation function ReLU, ReLU6, HardTanh, HardSigmoid were evaluated on 8 random seeds from 1 to 8. + +# A.5.5 LARGE EXPERIMENT + +Relevant figures: 1, 4 (except for the second row), 5 (top), App.8. + +335671 networks were trained for $2 ^ { 1 9 }$ steps with random hyper-parameters; if training did not complete, a checkpoint at step $2 ^ { 1 8 }$ was used instead, if available. When using L-BFGS, the maximum number of iterations was set to 2684. The space of available hyper-parameters included5: + +1. CIFAR10 and CIFAR100 datasets cropped to a $2 4 \times 2 4$ center region; +2. all 5 non-linearities from $\ S _ { \mathrm { ~ \tiny ~ \cdot ~ } }$ ; +3. SGD, Momentum, ADAM (Kingma & Ba, 2014), RMSProp (Hinton et al., 2012) and LBFGS optimizers; +4. learning rates from $\{ 0 . 0 1 , 0 . 0 0 5 , 0 . 0 0 0 5 \}$ , when applicable. Secondary coefficients were fixed at default values of Tensorflow implementations of respective optimizers; +5. batch sizes of $\{ 1 2 8 , 5 1 2 \}$ (unless using L-BFGS with the full batch of 50000); +6. standard deviations of initial weights from $\{ 0 . 5 , 1 , 4 , 8 \}$ multiplied by the default value described in $\ S _ { \mathrm { A } . 5 }$ ; +7. widths from $\{ 1 , 2 , 4 , \cdots , 2 ^ { 1 6 } \}$ ; +8. depths from $\{ 2 , 3 , 5 , \cdots , 2 ^ { 6 } + 1 \}$ ; +9. true and random training labels; +10. random seeds from 1 to 8. + +# A.5.6 PER-POINT GENERALIZATION + +Relevant figures 6, App.9. + +Networks were with either cross-entropy or $\ell _ { 2 }$ -loss trained for $2 ^ { 1 9 }$ steps on whole datasets (CIFAR100, CIFAR10, Fashion-MNIST and MNIST) and evaluated on random subsets of 1000 test images. + +Hyper-parameters were: non-linearity (all functions from §A.4), width (50, 100, 200, 500, 1000), depth (2, 5, 10, 20, 30), learning rate (0.0001, 0.001, 0.01), optimizer (SGD, Momentum, ADAM, RMSProp). Only one random seed (1) was used. For each dataset a random subset of 5 configurations among all the $1 0 0 \%$ -accurate (on training) networks was plotted (apart from the case of CIFAR100, where networks of training accuracy of at least $9 9 . 9 8 \%$ were selected). + +# A.5.7 CROSS-ENTROPY AND SENSITIVITY ANALYSIS + +Relevant figure App.11. + +Networks were trained for $2 ^ { 1 8 }$ on the whole CIFAR10 training set and evaluated networks on a random test subset of size 1000. The hyper-parameters consisted of non-linearity (all functions from $\ S \mathrm { A } . 4 )$ , width (50, 100 or 200) and depth (2, 5, 10, 20). Only one random seed (1) was considered. A single random $100 \%$ -accurate (on training data) network was drawn to compare experimental measurements with analytic bounds on the Jacobian norm. \ No newline at end of file diff --git a/md/train/HJe4Cp4KwH/HJe4Cp4KwH.md b/md/train/HJe4Cp4KwH/HJe4Cp4KwH.md new file mode 100644 index 0000000000000000000000000000000000000000..0eebed85dbb534173c512cb93783c79d2d37a3ce --- /dev/null +++ b/md/train/HJe4Cp4KwH/HJe4Cp4KwH.md @@ -0,0 +1,273 @@ +# GNN-FILM: GRAPH NEURAL NETWORKS WITH FEATURE-WISE LINEAR MODULATION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +This paper presents a new Graph Neural Network (GNN) type using feature-wise linear modulation (FiLM). Many standard GNN variants propagate information along the edges of a graph by computing “messages” based only on the representation of the source of each edge. In GNN-FiLM, the representation of the target node of an edge is additionally used to compute a transformation that can be applied to all incoming messages, allowing feature-wise modulation of the passed information. + +Results of experiments comparing different GNN architectures on three tasks from the literature are presented, based on re-implementations of baseline methods. Hyperparameters for all methods were found using extensive search, yielding somewhat surprising results: differences between baseline models are smaller than reported in the literature. Nonetheless, GNN-FiLM outperforms baseline methods on a regression task on molecular graphs and performs competitively on other tasks. + +# 1 INTRODUCTION + +Learning from graph-structured data has seen explosive growth over the last few years, as graphs are a convenient formalism to model the broad class of data that has objects (treated as vertices) with some known relationships (treated as edges). Example usages include reasoning about physical and biological systems, knowledge bases, computer programs, and relational reasoning in computer vision tasks. This graph construction is a highly complex form of feature engineering, mapping the knowledge of a domain expert into a graph structure which can be consumed and exploited by high-capacity neural network models. + +Many neural graph learning methods can be summarised as neural message passing (Gilmer et al., 2017): nodes are initialised with some representation and then exchange information by transforming their current state (in practice with a single linear layer) and sending it as a message to all neighbours in the graph. At each node, messages are aggregated in some way and then used to update the associated node representation. In this setting, the message is entirely determined by the source node (and potentially the edge type) and the target node is not taken into consideration. A (partial) exception to this is the family of Graph Attention Networks (Velickovi ˇ c et al., 2018), where ´ the agreement between source and target representation of an edge is used to determine the weight of the message in an attention architecture. However, this weight is applied to all dimensions of the message at the same time. + +A simple consequence of this observation may be to simply compute messages from the pair of source and target node state. However, the linear layer commonly used to compute messages would only allow additive interactions between the representations of source and target nodes. More complex transformation functions are often impractical, as computation in GNN implementations is dominated by the message transformation function. + +However, this need for non-trivial interaction between different information sources is a common problem in neural network design. A recent trend has been the use of hypernetworks (Ha et al., 2017), neural networks that compute the weights of other networks. In this setting, interaction between two signal sources is achieved by using one of them as the input to a hypernetwork and the other as input to the computed network. While an intellectually pleasing approach, it is often impractical because the prediction of weights of non-trivial neural networks is computationally expensive. + +Approaches to mitigate this exist (e.g., Wu et al. (2019) handle this in natural language processing), but are often domain-specific. + +A more general mitigation method is to restrict the structure of the computed network. Recently, “feature-wise linear modulations” (FiLM) were introduced in the visual question answering domain (Perez et al., 2017). Here, the hypernetwork is fed with an encoding of a question and produces an element-wise affine function that is applied to the features extracted from a picture. This can be adapted to the graph message passing domain by using the representation of the target node to compute the affine function. This compromise between expressiveness and computational feasibility has been very effective in some domains and the results presented in this article indicate that it is also a good fit for the graph domain. + +This article explores the use of hypernetworks in learning on graphs. Sect. 2 first reviews existing GNN models from the related work to identify commonalities and differences. This involves generalising a number of existing formalisms to new formulations that are able to handle graphs with different types of edges, which are often used to model different relationship between vertices. Then, two new formalisms are introduced: Relational Graph Dynamic Convolutional Networks (RGDCN), which dynamically compute the neural message passing function as a linear layer, and Graph Neural Networks with Feature-wise Linear Modulation (GNN-FiLM), which combine learned message passing functions with dynamically computed element-wise affine transformations. In Sect. 3, a range of baselines are compared in extensive experiments on three tasks from the literature, spanning classification, regression and ranking tasks on small and large graphs. Experiments were performed on re-implementations of existing model architectures in the same framework and hyperparameter setting searches were performed with the same computational budgets across all architectures. The results show that differences between baselines are smaller than the literature suggests and that the new FiLM model performs well on a number of interesting tasks. + +# 2 MODEL + +Notation. Let $\mathcal { L }$ be a finite (usually small) set of edge types. Then, a directed graph $\mathcal { G } = ( \nu , \mathcal { E } )$ has nodes $\nu$ and typed edges $\mathcal { E } \subseteq \mathcal { V } \times \mathcal { L } \times \mathcal { V }$ , where $( u , \ell , v ) \in \mathcal { E }$ denotes an edge from node $u$ to node $v$ of type $\ell$ , usually written as $u \xrightarrow { \ell _ { \setminus } } v$ . + +Graph Neural Networks. As discussed above, Graph Neural Networks operate by propagating information along the edges of a given graph. Concretely, each node $v$ is associated with an initial representation $\boldsymbol { h } _ { v } ^ { ( 0 ) }$ (for example obtained from the label of that node, or by some other model component). Then, a GNN layer updates the node representations using the node representations of its neighbours in the graph, yielding representations $\pmb { h } _ { v } ^ { ( 1 ) }$ . This process can be unrolled through time by repeatedly applying the same update function, yielding representations $h _ { v } ^ { ( 2 ) } \ldots h _ { v } ^ { ( T ) }$ . Alternatively, several GNN layers can be stacked, which is intuitively similar to unrolling through time, but increases the GNN capacity by using different parameters for each timestep. + +In Gated Graph Neural Networks (GGNN) (Li et al., 2016), the update rule uses one linear layer $W _ { \ell }$ per edge type $\ell$ to compute messages and combines the aggregated messages with the current representation of a node using a recurrent unit $r$ (e.g., GRU or LSTM cells), yielding the following definition. + +$$ +\pmb { h } _ { v } ^ { ( t + 1 ) } = r ( \pmb { h } _ { v } ^ { ( t ) } , \sum _ { u v \in \mathcal { E } } W _ { \ell } \pmb { h } _ { u } ^ { ( t ) } ; \pmb { \theta } _ { r } ) +$$ + +The learnable parameters of the model are the edge-type-dependent weights $W _ { \ell }$ and the recurrent cell parameters $\pmb { \theta } _ { r }$ . + +In Relational Graph Convolutional Networks (R-GCN) (Schlichtkrull et al., 2018), the gated unit is replaced by a simple non-linearity $\sigma$ (e.g., the hyperbolic tangent). + +$$ +\pmb { h } _ { v } ^ { ( t + 1 ) } = \sigma \left( \sum _ { u \not \in \mathcal { E } } \frac { 1 } { c _ { v , \ell } } \cdot W _ { \ell } \pmb { h } _ { u } ^ { ( t ) } \right) +$$ + +Here, $c _ { v , \ell }$ is a normalisation factor usually set to the number of edges of type $\ell$ ending in $v$ . The learnable parameters of the model are the edge-type-dependent weights $W _ { \ell }$ . It is important to note that in this setting, the edge type set $\mathcal { L }$ is assumed to contain a special edge type 0 for self-loops $v \xrightarrow { 0 } v$ , allowing state associated with a node to be kept. + +In Graph Attention Networks (GAT) (Velickovi ˇ c et al., 2018), new node representations are com- ´ puted from a weighted sum of neighbouring node representations. The model can be generalised from the original definitional to support different edge types as follows (we will call this R-GAT below).1 + +$$ +\begin{array} { r l } & { \boldsymbol { e } _ { u , \ell , v } = \mathrm { L e a k y R e L U } ( \boldsymbol { \alpha } _ { \ell } \cdot ( W _ { \ell } \boldsymbol { h } _ { u } ^ { ( t ) } \| W _ { \ell } \boldsymbol { h } _ { v } ^ { ( t ) } ) ) } \\ & { \qquad \boldsymbol { a } _ { v } = \mathrm { s o f t m a x } ( \boldsymbol { e } _ { u , \ell , v } \mid \boldsymbol { u } \xrightarrow { \ell } \boldsymbol { v } \in \mathcal { E } ) } \\ & { \quad \boldsymbol { h } _ { v } ^ { ( t + 1 ) } = \sigma \left( \displaystyle \sum _ { u \xrightarrow { \ell } v \in \mathcal { E } } ( \boldsymbol { a } _ { v } ) _ { u \xrightarrow { \ell } v } \cdot W _ { \ell } \boldsymbol { h } _ { u } ^ { ( t ) } \right) } \end{array} +$$ + +Here, $\pmb { \alpha } _ { \ell }$ is a learnable row vector used to weigh different feature dimensions in the computation of an attention (“relevance”) score of the node representations, $\mathbf { \Delta x } \Vert \mathbf { \Delta y }$ is the concatenation of vectors $_ { \textbf { \em x } }$ and $\textbf { { y } }$ , and $( \pmb { a } _ { v } ) _ { u } \mathcal { L } _ { v }$ refers to the weight computed by the softmax for that edge. The learnable parameters of the model are the edge-type-dependent weights $W _ { \ell }$ and the attention parameters $\pmb { \alpha } _ { \ell }$ . In practice, GATs usually employ several attention heads that independently implement the mechanism above in parallel, using separate learnable parameters. The results of the different attention heads are then concatenated after each propagation round to yield the value of $h _ { v } ^ { ( t + 1 ) }$ . + +More recently, $\mathrm { X u }$ et al. (2019) analysed the expressiveness of different GNN types, comparing their ability to distinguish similar graphs with the Weisfeiler-Lehman (WL) graph isomorphism test. Their results show that GCNs and the GraphSAGE model Hamilton et al. (2017) are strictly weaker than the WL test and hence they developed Graph Isomorphism Networks (GIN) (Xu et al., 2019), which are indeed as powerful as the WL test. While the GIN definition is limited to a single edge type, Corollary 6 of $\mathrm { X u }$ et al. (2019) shows that using the definition + +$$ +\pmb { h } _ { v } ^ { ( t + 1 ) } = \varphi ( ( 1 + \epsilon ) \cdot f ( \pmb { h } _ { v } ^ { ( t ) } ) + \sum _ { u v \in \mathcal { E } } f ( \pmb { h } _ { u } ^ { ( t ) } ) ) , +$$ + +there are choices for $\epsilon$ , $\varphi$ and $f$ such that the node representation update is sufficient for the overall network to be as powerful as the WL test. In the setting of different edge types, the function $f$ in the sum over neighbouring nodes needs to reflect different edge types to distinguish graphs such as $v \ \bot \rangle \ u \ \ll \ w$ and $v \ \bar { 2 } \gg \ u \ \ll \ w$ from each other. Using different functions $f _ { \ell }$ for different edge types makes it possible to unify the use of the current node representation $h _ { v } ^ { ( t ) }$ with the use of neighbouring node representations by again using a fresh edge type 0 for self-loops $v \ a \ $ . In that setting, the factor $( 1 + \epsilon )$ can be integrated into $f _ { 0 }$ . Finally, following an argument similar to $\mathrm { X u }$ et al. (2019), $\varphi$ and $f$ at subsequent layers can be “merged” into a single function which can be approximated by a multilayer perceptron (MLP), yielding the final R-GIN definition + +$$ +\pmb { h } _ { v } ^ { ( t + 1 ) } = \sigma \left( \sum _ { u \downarrow v \in \mathcal { E } } M L P ( \pmb { h } _ { u } ^ { ( t ) } ; \pmb { \theta } _ { \ell } ) \right) . +$$ + +The learnable parameters here are the edge-specific weights $\pmb { \theta } _ { \ell }$ . Note that Eq. (4) is very similar to the definition of R-GCNs (Eq. (2)), only dropping the normalisation factor $\frac { \hat { \mathbf { 1 } } } { c _ { v , \ell } }$ and replacing linear layers by an MLP. + +While many more GNN variants exist, the four formalisms above are broadly representative of general trends. It is notable that in all of these models, the information passed from one node to another is based on the learned weights and the representation of the source of an edge. In contrast, the representation of the target of an edge is only updated (in the GGNN case Eq. (1)), treated as another incoming message (in the R-GCN case Eq. (2) and the R-GIN case Eq. (4)), or used to weight the relevance of an edge (in the R-GAT case Eq. (3)). Sometimes unnamed GNN variants of the above are used (e.g., by Selsam et al. (2019); Paliwal et al. (2019)), replacing the linear layers to compute the messages for each edge by MLPs applied to the concatenation of the representations of source and target nodes. In the experiments, this will be called GNN-MLP, formally defined as follows.2 + +$$ +\pmb { h } _ { v } ^ { ( t + 1 ) } = \sigma \left( \sum _ { u \xrightarrow [ ] { \ell } v \in \mathcal { E } } \frac { 1 } { c _ { v , \ell } } \cdot M L P \left( \pmb { h } _ { u } ^ { ( t ) } \| \pmb { h } _ { v } ^ { ( t ) } \ ; \ \pmb { \theta } _ { \ell } \right) \right) +$$ + +Below, we will instantiate the $M L P$ with a single linear layer to obtain what we call GNN-MLP0, which only differs from R-GCNs (Eq. (2)) in that the message passing function is applied to the concatenation of source and target state. + +# 2.1 GRAPH HYPERNETWORKS + +Hypernetworks (i.e., neural networks computing the parameters of another neural network) (Ha et al., 2017) have been successfully applied to a number of different tasks; naturally raising the question if they are also applicable in the graph domain. + +Intuitively, a hypernetwork corresponds to a higher-order function, i.e., it can be viewed as a function computing another function. Hence, a natural idea would be to use the target of a message propagation step to compute the function computing the message; essentially allowing it to focus on features that are especially relevant for the update of the target node representation. + +Relational Graph Dynamic Convolutional Networks (RGDCN) A first attempt would be to adapt (2) to replace the learnable message transformation $W _ { \ell }$ by the result of some learnable function $f$ that operates on the target representation: + +$$ +\pmb { h } _ { v } ^ { ( t + 1 ) } = \sigma \left( \sum _ { u \downarrow v \in \mathcal { E } } f ( \pmb { h } _ { v } ^ { ( t ) } ; \pmb { \theta } _ { f , \ell } ) \pmb { h } _ { u } ^ { ( t ) } \right) +$$ + +However, for a representation size $D$ , $f$ would need to produce a matrix of size $D ^ { 2 }$ from $D$ inputs. Hence, if implemented as a simple linear layer, $f$ would have on the order of $\mathcal { O } ( D ^ { 3 } )$ parameters, quickly making it impractical in most contexts. + +This can be somewhat mitigated by splitting the node representations $h _ { v } ^ { ( t ) }$ into $C$ “chunks” $h _ { v , c } ^ { ( t ) }$ of dimension $\begin{array} { r } { K = { \frac { D } { C } } } \end{array}$ : + +$$ +\begin{array} { r l } & { W _ { \ell , t , v , c } = f ( \pmb { h } _ { v } ^ { ( t ) } ; \pmb { \theta } _ { f , \ell , c } ) } \\ & { \qquad \mathbf { h } _ { v } ^ { ( t + 1 ) } = \displaystyle \operatorname* { l i } _ { 1 \leq c \leq C } \sigma \left( \sum _ { u } \pounds _ { v \in \mathcal { E } } W _ { \ell , t , v , c } \pmb { h } _ { u , c } ^ { ( t ) } \right) } \end{array} +$$ + +The number of parameters of the model can now be reduced by tying the value of some instances of $\theta _ { f , \ell , c }$ . For example, the update function for a chunk $c$ can be computed using only the corresponding chunk of the node representation $h _ { v , c } ^ { ( t ) }$ , or the same update function can be applied to all “chunks” by setting $\pmb { \theta } _ { f , \ell , 1 } = . . . = \pmb { \theta } _ { f , \ell , C }$ . The learnable parameters of the model are only the hypernetwork parameters $\theta _ { f , \ell , c }$ . This is somewhat less desirable than the related idea of Wu et al. (2019), which operates on sequences, where sharing between neighbouring elements of the sequence has an intuitive interpretation that is not applicable in the general graph setting. + +Graph Neural Networks with Feature-wise Linear Modulation (GNN-FiLM) In (6), the message passing layer is a linear transformation conditioned on the target node representation, focusing on separate chunks of the node representation at a time. In the extreme case in which the dimension of each chunk is 1, this method coincides with the ideas of Perez et al. (2017), who propose to use layers of element-wise affine transformations to modulate feature maps in the visual question answering setting; there, a natural language question is the input used to compute the affine transformation applied to the features extracted from a picture. + +In the graph setting, we can use each node’s representation as an input that determines an elementwise affine transformation of incoming messages, allowing the model to dynamically up-weight and down-weight features based on the information present at the target node of an edge. This yields the following update rule, using a learnable function $g$ to compute the parameters of the affine transformation. + +$$ +\begin{array} { r l } & { \beta _ { \ell , v } ^ { ( t ) } , \gamma _ { \ell , v } ^ { ( t ) } = g ( \pmb { h } _ { v } ^ { ( t ) } ; \pmb { \theta } _ { g , \ell } ) } \\ & { \quad \pmb { h } _ { v } ^ { ( t + 1 ) } = \sigma \left( \displaystyle \sum _ { u \in \mathcal { E } } \gamma _ { \ell , v } ^ { ( t ) } \odot W _ { \ell } \pmb { h } _ { u } ^ { ( t ) } + \beta _ { \ell , v } ^ { ( t ) } \right) } \end{array} +$$ + +The learnable parameters of the model are both the hypernetwork parameters $\theta _ { g , \ell }$ and the weights $W _ { \ell }$ . In practice, implementing $g$ as a single linear layer works well. + +In the case of using a single linear layer, the resulting message passing function is bilinear in source and target node representation, as the message computation is centred around $( W _ { g } \pmb { h } _ { v } ^ { ( t ) } ) \odot ( W _ { \ell } \pmb { h } _ { u } ^ { ( t ) } )$ . This is the core difference to the (linear) interaction of source and target node representations in models that use $W _ { \ell } ( \pmb { h } _ { u } ^ { ( t ) } | | \pmb { h } _ { v } ^ { ( t ) } )$ . + +A simple toy example may illustrate the usefulness of such a mechanism: assuming a graph of nodes $\nu _ { A }$ and $\gamma _ { B }$ and edge types 1 and 2, a task may involve counting the number of 1-neighbours of $\nu _ { A }$ nodes and of 2-neighbours of $\gamma _ { B }$ nodes. By setting $\gamma _ { 1 , v _ { a } } = 1$ , $\gamma _ { 2 , v _ { a } } = 0$ for $v _ { a } \in \mathcal { V } _ { A }$ and $\gamma _ { 1 , v _ { b } } = 0$ , $\gamma _ { 2 , v _ { b } } = 1$ for $v _ { b } \in \mathcal { V } _ { B }$ , GNN-FiLM can solve this in a single layer. Simpler approaches can solve this by counting $A / 1 , A / 2 , B / 1$ and $B / 2$ neighbours separately in one layer and then projecting to the correct counter, but require more feature dimensions and layers for this. As this toy example illustrates, a core capability of GNN-FiLM is to learn to ignore graph edges based on the representation of target nodes. + +Note that the featurewise modulation can also be viewed of an extension of the gating mechanism of GRU or LSTM cells used in GGNNs. Concretely, the “forgetting” of memories in a GRU/LSTM is similar to down-weighting messages computed for the self-loop edges and the gating of the cell input is similar to the modulation of other incoming messages. However, GGNNs apply this gating to the sum of all incoming messages (cf. Eq. (1), wheras in GNN-FiLM the modulation additionally depends on the edge type, allowing for a more fine-grained gating mechanism. + +Finally, a small implementation bug brought focus to the fact that applying the non-linearity $\sigma$ after summing up messages from neighbouring nodes can make it harder to perform tasks such as counting the number of neighbours with a certain feature. In experiments, applying the non-linearity before aggregation as in the following update rule improved performance. + +$$ +\pmb { h } _ { v } ^ { ( t + 1 ) } = l \left( \sum _ { u \downarrow } \sigma _ { v \in \mathcal { E } } \sigma \left( \gamma _ { \ell , v } ^ { ( t ) } \odot W _ { \ell } \pmb { h } _ { u } ^ { ( t ) } + \beta _ { \ell , v } ^ { ( t ) } \right) ; \pmb { \theta } _ { l } \right) +$$ + +However, this means that the magnitude of node representations is now dependent on the degree of nodes in the handled graph. This can sometimes lead to instability during training, which can in turn be controlled by adding an additional layer $l$ after message passing, which can be a simple bounded nonlinearity (e.g. tanh), a fully connected layer, or layer normalisation (Ba et al., 2016), or any combination of these. + +# 3 EVALUATION + +# 3.1 GNN BENCHMARK TASKS + +Due to the versatile nature of the GNN modelling formalism, many fundamentally different tasks are studied in the research area and it should be noted that good results on one task often do not transfer over to other tasks. This is due to the widely varying requirements of different tasks, as the following summary of tasks from the literature should illustrate. + +• Cora/Citeseer/Pubmed (Sen et al., 2008): Each task consists of a single graph of $\sim 1 0 0 0 0$ nodes corresponding to documents and undirected (sic!) edges corresponding to references. The sparse $\sim 1 0 0 0$ node features are a bag of words representation of the corresponding documents. The goal is to assign a subset of nodes to a small number of classes. State of the art performance on these tasks is achieved with two propagation steps along graph edges. + +• PPI (Zitnik & Leskovec, 2017): A protein-protein interaction dataset consisting of 24 graphs of $\sim \ 2 5 0 0$ nodes corresponding to different human tissues. Each node has 50 features selected by domain experts and the goal is node-level classification, where each node may belong to several of the 121 classes. State of the art performance on this task requires three propagation steps. QM9 property prediction (Ramakrishnan et al., 2014): $\sim 1 3 0 0 0 0$ graphs of $\sim 8$ nodes represent molecules, where nodes are heavy atoms and undirected, typed edges are bonds between these atoms, different edge types indicating single/double/etc. bonds. The goal is to regress each graph to a number of quantum chemical properties. State of the art performance on these tasks requires at least four propagation steps. VarMisuse (Allamanis et al., 2018): $\sim 2 3 5 0 0 0$ graphs of $\sim 2 5 0 0$ nodes each represent program fragments, where nodes are tokens in the program text and different edge types represent the program’s abstract syntax tree, data flow between variables, etc. The goal is to select one of a set of candidate nodes per graph. State of the art performance requires at least six propagation steps. + +Hence, tasks differ in the complexity of edges (from undirected and untyped to directed and manytyped), the size of the considered graphs, the size of the dataset, the importance of node-level vs. graph-level representations, and the number of required propagation steps. + +This article includes results on the PPI, QM9 and VarMisuse tasks. Preliminary experiments on the citation network data showed results that were at best comparable to the baseline methods, but changes of a random seed led to substantial fluctuations (mirroring the problems with evaluation on these tasks reported by Shchur et al. (2018)). + +# 3.2 IMPLEMENTATION + +To allow for a wider comparison, the implementation of GNN-FiLM is accompanied by implementations of a range of baseline methods. These include GGNN (Li et al., 2016) (see Eq. (1)), R-GCN (Schlichtkrull et al., 2018) (see Eq. (2)), R-GAT (Velickovi ˇ c et al., 2018) (see Eq. ´ (3)), and R-GIN (Hamilton et al., 2017) (see Eq. (4))3. Additionally, GNN-MLP0 is a variant of R-GCN using a single linear layer to compute the edge message from both source and target state (i.e., Eq. (5) instantiated with an “MLP” without hidden layers), and GNN-MLP1 is the same with a single hidden layer. The baseline methods were re-implemented in TensorFlow and individually tested to reach performance equivalent to results reported in their respective source papers. All code for the implementation of these GNNs is released on https://revealed/after/double/blind/ lifted, together with implementations of all tasks and scripts necessary to reproduce the results reported in this paper. This includes the hyperparameter settings found by search, which are stored in tasks/default hypers/ and are selected by default on the respective tasks. The code is designed to facilitate testing new GNN types on existing tasks and easily adding new tasks, allowing for rapid evaluation of new architectures. + +Early on in the experiments, it became clear that the RGDCN approach (Eq. (6)) as presented is infeasible. It is extremely sensitive to the parameter initialisation and hence changes to the random seed lead to wild swings in the target metrics. Hence, no experimental results are reported for it in the following. It is nonetheless included in the article (and the implementation) to show the thought process leading to GNN-FiLM, as well as to allow other researchers to build upon this. In the following, GNN-FiLM refers to the formulation of Eq. (8), which performed better than the variant of Eq. (7) across all experiments. Somewhat surprisingly, the same trick (of moving the non-linearity before the message aggregation step) did not help the other GNN types. For all models, using each layer only for a single propagation step performed better than using fewer layers with several propagation steps. + +In all experiments, models were trained until the target metric did not improve anymore for some additional epochs (25 for PPI and QM9, 5 for VarMisuse). The reported results on the held-out test data are averaged across the results of a number of training runs, each starting from different random parameter initializations. + +# 3.3 EXPERIMENTAL RESULTS + +# 3.3.1 PROTEIN-PROTEIN INTERACTIONS (PPI) + +The models are first evaluated on the node-level classification PPI task (Zitnik & Leskovec, 2017), following the dataset split from earlier papers. Training hence used a set of 20 graphs and validation and test sets of two separate graphs each. The graphs use two edge types: the dataset-provided untyped edges as well as a fresh “self-loop” edge type to allows nodes to keep state across propagation steps. + +Hyperparameters for all models were selected based on results from earlier papers and a small grid search of a number of author-selected hyperparameter ranges (see App. A for details). This resulted in three (R-GAT), four (GGNN, GNN-FiLM, GNN-MLP1, R-GCN), or five (GNN-MLP0, R-GIN) layers (propagation steps) and a node representation size of 256 (GNN-MLP0, R-GIN) or 320 (all others). All models use dropout on the node representations before all GNN layers, with a keep ratio of 0.9. After selecting hyperparameters, all models were trained ten times with different random seeds on a NVidia V100. + +Tab. 1 shows the micro-averaged F1 score on the classification task on the test graphs, with standard deviations and training times in seconds computed over the ten runs. The results for all re-implemented models are better than the results reported by Velickovi ˇ c et al. (2018) ´ for the GAT model (without edge types). A cursory exploration of the reasons yielded three factors. First, the generalisation to different edge types (cf. Eq. (3)) and the subsequent use of a special self-loop edge type helps R-GAT (and all other models) significantly. Second, using dropout between layers significantly im + +Table 1: GNN results on PPI task. $\mathrm { G A T ^ { * } }$ result taken from Velickovi ˇ c et al. (2018). ´ + +
ModelAvg. Micro-F1Time (s)
GAT*0.973 ±0.002n/a
GGNN0.990 ±0.001432.6
R-GCN0.989 ±0.000759.0
R-GAT0.989 ±0.001782.3
R-GIN0.991 ±0.001704.8
GNN-MLP00.992±0.000556.9
GNN-MLP10.992±0.001479.2
GNN-FiLM0.992±0.000308.1
+ +proved the results. Third, the larger node representation sizes (compared to 256 used by Velickovi ˇ c´ et al. (2018)) improved the results again. However, the new GNN-FiLM improves slightly over these four baselines from the literature, while converging substantially faster than all baselines, mainly because it converges in significantly fewer training steps (approx. 240 epochs compared to 400-600 epochs for the other models). + +# 3.3.2 QUANTUM CHEMISTRY (QM9) + +All models were additionally evaluated on graph-level regression tasks on the QM9 molecule data set (Ramakrishnan et al., 2014), considering thirteen different quantum chemical properties. The ${ \sim } 1 3 0 k$ molecular graphs in the dataset were split into training, validation and test data by randomly selecting 10 000 graphs for the latter two sets. Additionally, another data split without a test set was used for the hyperparameter search (see below). The graphs use five edge types: the datasetprovided typed edges (single, double, triple and aromatic bonds between atoms) as well as a fresh “self-loop” edge type that allows nodes to keep state across propagation steps. The evaluation differs from the setting reported by Gilmer et al. (2017), as no additional molecular information is encoded as edge features, nor are the graphs augmented by master nodes or additional edges.4 + +Hyperparameters for all models were found using a staged search process. First, 500 hyperparameter configurations were sampled from an author-provided search space (see App. A for details) and run on the first three regression tasks. The top three configurations for each of these three tasks were then run on all thirteen tasks and the final configuration was chosen as the one with the lowest average mean absolute error across all properties, as evaluated on the validation data of that dataset split. This process led to eight layers / propagation steps for all models but GGNN and R-GIN, which showed best performance with six layers. Furthermore, all models used residual connections connecting every second layer and GGNN, R-GCN, GNN-FiLM and GNN-MLP0 additionally used layer normalisation (as in Eq. (8)). + +Table 2: GNN average error rates and standard deviations on QM9 target values. + +
PropertyGGNNR-GCNR-GATR-GINGNN-MLP0GNN-MLP1GNN-FiLM
mu3.85 ±0.163.21 ±0.062.68 ±0.062.64 ±0.112.36 ±0.042.44 ±0.122.38 ±0.13
alpha5.22 ±0.864.22 ±0.454.65 ±0.444.67 ±0.524.27 ±0.364.63 ±0.543.75 ±0.11
HOMO1.67 ±0.071.45 ±0.011.48 ±0.031.42 ±0.011.25 ±0.041.29 ±0.061.22 ±0.07
LUMO1.74 ±0.061.62 ±0.041.53 ±0.071.50 ±0.091.35 ±0.041.50 ±0.191.30 ±0.05
gap2.60 ±0.062.42 ±0.142.31 ±0.062.27 ±0.092.04 ±0.052.06 ±0.101.96 ±0.06
R235.94 ±35.6816.38 ±0.4952.39 ±42.5815.63 ±1.4014.86 ±1.6215.81 ±1.4215.59 ±1.38
ZPVE17.84 ±3.6117.40 ±3.5614.87 ±2.8812.93 ±1.8112.00 ±1.6614.12 ±1.1011.00 ±0.74
UO8.65 ±2.467.82 ±0.807.61 ±0.465.88 ±1.015.55 ±0.386.94 ±0.645.43 ±0.96
U9.24 ±2.268.24 ±1.256.86 ±0.5318.71 ±23.366.20 ±0.887.00 ±1.065.95 ±0.46
H9.35 ±0.969.05 ±1.217.64 ±0.925.62 ±0.815.96 ±0.457.98 ±0.885.59 ±0.57
G7.14 ±1.157.00 ±1.516.54 ±0.365.38±0.755.09 ±0.577.14 ±0.515.17 ±1.13
Cv8.86 ±9.073.93 ±0.484.11 ±0.273.53 ±0.373.38 ±0.204.60 ±0.743.46 ±0.21
Omega1.57 ±0.531.02 ±0.051.48 ±0.871.05 ±0.110.84±0.025.60 ±8.820.98 ±0.06
+ +Table 3: Accuracy on VarMisuse task. GGNN∗ result taken from appendix of Allamanis et al. (2018). + +
ModelTRAINVALIDSEENPROJTESTUNSEENPROJTEST
GGNN*n/an/a84.0 n/a74.1 n/a
GGNN87.5±1.8%82.1±0.9%85.7 ±0.5%79.3 ±1.2%
R-GCN88.7±3.1%85.7±1.6%87.2±1.5%81.4±2.3%
R-GAT90.4±3.9%84.2±1.0%86.9 ±0.7%81.2 ±0.9%
R-GIN93.4±1.8%84.2±1.0%87.1 ±0.1%81.1 ±0.9%
GNN-MLP095.3±2.4%83.4±0.3%86.5 ±0.2%80.5 ±1.4%
GNN-MLP194.7±1.2%84.4±0.4%86.9 ±0.3%81.4±0.7%
GNN-FiLM94.3±1.0%84.6±0.6%87.0 ±0.2%81.3 ±0.9%
+ +Each model was trained for each of the properties separately five times using different random seeds on compute nodes with NVidia P100 cards. The average results of the five runs are reported in Tab. 2, with their respective standard deviations.5 The results indicate that the new GNN-FiLM model outperforms the standard baselines on all tasks and the usually not considered GNN-MLP variants on the majority of tasks. + +# 3.3.3 VARIABLE USAGE IN PROGRAMS (VARMISUSE) + +Finally, the models were evaluated on the VarMisuse task of Allamanis et al. (2018). This task requires to process a graph representing an abstraction of a program fragment and then select one of a few candidate nodes (representing program variables) based on the representation of another node (representing the location to use a variable in). The experiments are performed using the released split of the dataset, which contains $\sim 1 3 0 k$ training graphs, $\sim 2 0 k$ validation graphs and two test sets: SEENPROJTEST, which contains $\sim 5 5 k$ graphs extracted from open source projects that also contributed data to the training and validation sets, and UNSEENPROJTEST, which contains $\sim 3 0 k$ graphs extracted from completely unseen projects. + +Due to the inherent cost of training models on this dataset (Balog et al. (2019) provide an in-depth performance analysis), a limited hyperparameter grid search was performed, with only $\sim 3 0$ candidate configurations for each model (see App. A for details). For each model, the configuration yielding the best results on the validation data set fold was selected. This led to six layers for GGNN and R-GIN, eight layers for R-GAT and GNN-MLP0, and ten layers for the remaining models. Graph node hidden sizes were 128 for all models but GGNN and R-GAT, which performed better with 96 dimensions. + +The results, shown in Tab. 3, are somewhat surprising, as they indicate a different ranking of model architectures as the results on PPI and QM9, with R-GCN performing best. All re-implemented baselines beat the results reported by Allamanis et al. (2018), who also reported that R-GCN and GGNN show very similar performance. This is in spite of a simpler implementation of the task than in the original paper, as it only uses the string labels of nodes for the representation and does not use the additional type information provided in the dataset. However, the re-implementation of the task uses the insights from Cvitkovic et al. (2019), who use character CNNs to encode node labels and furthermore introduce extra nodes for subtokens appearing in labels of different nodes, connecting them to their sources (e.g., nodes labelled openWullfrax and closeWullfrax are both connected to a fresh Wullfrax node). + +A deeper investigation results showed that the more complex models seem to suffer from significant overfitting to the training data, as can be seen in the results for training and validation accuracy reported in Tab. 3. A brief exploration of more aggressive regularisation methods (more dropout, weight decay) showed no improvement and a deeper understanding of the cause of these results remains for future work. + +Furthermore, the large variance in results on the validation set (especially for R-GCN) makes it likely that the hyperparameter grid search with only one training run per configuration did not yield the best configuration for each model. + +# 4 DISCUSSION & CONCLUSIONS + +After a review of existing graph neural network architectures, the idea of using hypernetworkinspired models in the graph setting was explored. This led to two models, Graph Dynamic Convolutional Networks and GNNs with feature-wise linear modulation, were presented. While GDCNs seem to be impractical to train, experiments show that GNN-FiLM is competitive with or improving on baseline models on three tasks from the literature. + +The extensive experiments also show that a number of results from the literature could benefit from more substantial hyperparameter search and are often missing comparisons to a number of obvious baselines: + +• The results in Tab. 1 indicate that GATs have no advantage over GGNNs or R-GCNs on the PPI task, which does not match the findings by Velickovi ˇ c et al. (2018). ´ • The results in Tab. 3 indicate that R-GCNs are outperforming GGNNs substantially on the VarMisuse task, contradicting the findings of Allamanis et al. (2018). • The GNN-MLP models are obvious extensions that are often alluded to, but are not part of the usually considered set of baseline models. Nonetheless, experiments across all three tasks have shown that these methods outperform better-published techniques such as GGNNs, R-GCNs and GATs, without a substantial runtime penalty. + +These results indicate that there is substantial value in independent reproducibility efforts and comparisons that include “obvious” baselines, matching the experiences from other areas of machine learning as well as earlier work by Shchur et al. (2018) on reproducing experimental results for GNNs on citation network tasks. + +# REFERENCES + +Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations (ICLR), 2018. + +Lei Jimmy Ba, Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016. + +Matej Balog, Bart van Merrienboer, Subhodeep Moitra, Yujia Li, and Daniel Tarlow. Fast training ¨ of sparse graph neural networks on dense hardware. CoRR, abs/1906.11786, 2019. + +Dan Busbridge, Dane Sherburn, Pietro Cavallo, and Nils Y. Hammerla. Relational graph attention networks. CoRR, abs/1904.05811, 2019. + +Milan Cvitkovic, Badal Singh, and Anima Anandkumar. Open vocabulary learning on source code with a graph-structured cache. In International Conference on Machine Learning (ICML), 2019. + +Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning (ICML), 2017. + +David Ha, Andrew M. Dai, and Quoc V. Le. HyperNetworks. In International Conference on Learning Representations (ICLR), 2017. + +William L Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems (NeurIPS), 2017. + +Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. In International Conference on Learning Representations (ICLR), 2016. + +Aditya Paliwal, Sarah M. Loos, Markus N. Rabe, Kshitij Bansal, and Christian Szegedy. Graph representations for higher-order logic and theorem proving. CoRR, abs/1905.10006, 2019. + +Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron C. Courville. FiLM: Visual reasoning with a general conditioning layer. In AAAI Conference on Artificial Intelligence, 2017. + +Raghunathan Ramakrishnan, Pavlo O. Dral, Matthias Rupp, and O. Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific Data, 1, 2014. + +Michael Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional network. In Extended Semantic Web Conference (ESWC), 2018. + +Daniel Selsam, Matthew Lamm, Benedikt Bunz, Percy Liang, Leonardo de Moura, and David L. ¨ Dill. Learning a SAT solver from single-bit supervision. In International Conference on Learning Representations (ICLR), 2019. + +Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29, 2008. + +Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Gunnemann. Pitfalls ¨ of graph neural network evaluation. CoRR, abs/1811.05868, 2018. + +Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph Attention Networks. In International Conference on Learning Representations (ICLR), 2018. + +Felix Wu, Angela Fan, Alexei Baevski, Yann Dauphin, and Michael Auli. Pay less attention with lightweight and dynamic convolutions. In International Conference on Learning Representations (ICLR), 2019. + +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations (ICLR), 2019. + +Marinka Zitnik and Jure Leskovec. Predicting multicellular function through multi-layer tissue networks. Bioinformatics, 33, 2017. + +# A HYPERPARAMETER SEARCH SPACES + +A.1 PPI + +For all models, a full grid search considering all combinations of the following parameters was performed: + +• hidden siz $\textsf { e } \in \{ 1 9 2 , 2 5 6 , 3 2 0 \}$ - size of per-node representations. • graph num layers $\in \{ 2 , 3 , 4 , 5 \}$ - number of propagation steps / layers. • graph layer input dropout keep prob $\in \ \{ 0 . 8 , 0 . 9 , 1 . 0 \}$ - dropout applied before propagation steps. + +# A.2 QM9 + +For all models, 500 configurations were considered, sampling hyperparameter settings uniformly from the following options: + +• hidden siz $\textsf { e } \in \{ 6 4 , 9 6 , 1 2 8 \}$ - size of per-node representations. +• graph num layers $\in \{ 4 , 6 , 8 \}$ - number of propagation steps / layers. +• graph layer input dropout keep prob $\in \ \{ 0 . 8 , 0 . 9 , 1 . 0 \}$ - dropout applied before propagation steps. +• layer norm $\in \{ T r u e , F a l s e \}$ - decided if layer norm is applied after each propagation step. +• dense layers $\in \{ 1 , 2 , 3 2 \}$ - insert a fully connected layer applied to node representations between every dense layers propagation steps. (32 effectively turns this off) res connection $\in \quad \{ 1 , 2 , 3 2 \}$ - insert a residual connection between every res connection propagation steps. (32 effectively turns this off) +• graph activation function $\in$ {relu, leaky relu, elu, gelu, tanh} - non-linearity applied after message passing. +• optimizer $\in \{ R M S P r o p , A d a m \}$ - optimizer used (with TF 1.13.1 default parameters). +• $\mathtt { l r } \in [ 0 . 0 0 0 5 , 0 . 0 0 1 ]$ - learning rate. +• $\mathsf { c e l 1 } \in \{ R N N , G R U , L S T M \}$ - gated cell used for GGNN (only part of search space for GGNN). +• num heads $\in \{ 4 , 8 , 1 6 \}$ - number of attention heads used for R-GAT (only part of search space for R-GAT). + +# A.3 VARMISUSE + +For all models, a full grid search considering all combinations of the following parameters was performed: + +• hidden si $z \in \{ 6 4 , 9 6 , 1 2 8 \}$ - size of per-node representations. +• graph num layers $\in \{ 6 , 8 , 1 0 \}$ - number of propagation steps / layers. graph layer input dropout keep prob $\in \ \{ 0 . 8 , 0 . 9 , 1 . 0 \}$ - dropout applied before propagation steps. +$\mathsf { c e l 1 } \in \mathsf { \Omega } \{ G R U , L S T M \}$ - gated cell used for GGNN (only part of search space for GGNN). +• num heads $\in \ \{ 4 , 8 \}$ - number of attention heads used for R-GAT (only part of search space for R-GAT). \ No newline at end of file diff --git a/md/train/HJeO7RNKPr/HJeO7RNKPr.md b/md/train/HJeO7RNKPr/HJeO7RNKPr.md new file mode 100644 index 0000000000000000000000000000000000000000..0fc2647dc609c5556ddbe1cd5c54268287a8ea36 --- /dev/null +++ b/md/train/HJeO7RNKPr/HJeO7RNKPr.md @@ -0,0 +1,479 @@ +# DEEPV2D: VIDEO TO DEPTH WITH DIFFERENTIABLE STRUCTURE FROM MOTION + +Zachary Teed +Princeton University +zteed@cs.princeton.edu +Jia Deng +Princeton University +jiadeng@cs.princeton.edu + +# ABSTRACT + +We propose DeepV2D, an end-to-end deep learning architecture for predicting depth from video. DeepV2D combines the representation ability of neural networks with the geometric principles governing image formation. We compose a collection of classical geometric algorithms, which are converted into trainable modules and combined into an end-to-end differentiable architecture. DeepV2D interleaves two stages: motion estimation and depth estimation. During inference, motion and depth estimation are alternated and converge to accurate depth. Code is available https://github.com/princeton-vl/DeepV2D. + +# 1 INTRODUCTION + +In video to depth, the task is to estimate depth from a video sequence. The problem has traditionally been approached using Structure from Motion (SfM), which takes a collection of images as input, and jointly optimizes over 3D structure and camera motion (Schonberger & Frahm, 2016b). The resulting camera parameter estimates can be used as input to Multi-View Stereo in order to build a more complete 3D representation such as surface meshes and depth maps (Furukawa et al., 2015; Furukawa & Ponce, 2010). + +In parallel, deep learning has been highly successful in a number of 3D reconstruction tasks. In particular, given ground truth depth, a network can learn to predict depth from a single image (Eigen et al., 2014; Eigen & Fergus, 2015; Laina et al., 2016), stereo images (Kendall et al., 2017; Mayer et al., 2016a), or collections of frames (Zhou et al., 2018; Kar et al., 2017; Tang & Tan, 2018; Yao et al., 2018). One advantage of deep networks is that they can use single-image cues such as texture gradients and shading as shown by their strong performance on depth estimation from a single image (Eigen et al., 2014; Eigen & Fergus, 2015; Laina et al., 2016). Furthermore, differentiable network modules can be composed so that entire pipelines (i.e. feature extraction, feature matching, regularization) can be learned directly from training data. On the other hand, as recent work has shown, it is often hard to train generic network layers to directly utilize multiview geometry (e.g. using interframe correspondence to recover depth), and it is often advantageous to embed knowledge of multiview geometry through specially designed layers or losses (Ummenhofer et al., 2017; Kendall & Cipolla, 2017; Zhou et al., 2017; Vijayanarasimhan et al., 2017; Zhou et al., 2018). + +In this work, we continue the direction set forth by recent works (Ummenhofer et al., 2017; Kendall et al., 2017; Tang & Tan, 2018; Zhou et al., 2018; Kar et al., 2017; Wang et al., 2018) that combine the representation ability of neural networks with the geometric principles underlying image formation. We propose DeepV2D, a composition of classical geometrical algorithms which we turn into differentiable network modules and combine into an end-to-end trainable architecture. DeepV2D interleaves two stages: camera motion estimation and depth estimation (Figure 1). The motion module takes depth as input, and outputs an incremental update to camera motion. The depth module takes camera motion as input, and performs stereo reconstruction to predict depth. At test time, DeepV2D acts as block coordinate descent, alternating between updating depth and camera motion. + +![](images/b68c2e980ef306146d4a300a5bd11351fab877600bae08cd56881af8c60e9bbf.jpg) +Figure 1: DeepV2D predicts depth from video. It is the composition of classical geometric algorithms, made differentiable, and combined into an end-to-end trainable network architecture. Video to depth is broken down into the subproblems of motion estimation and depth estimation, which are solved by the Motion Module and Depth Module respectively. + +To estimate camera motion we introduce Flow-SE3, a new motion estimation architecture, which outputs an incremental update to camera motion. Flow-SE3 takes depth as input, and estimates dense 2D correspondence between pairs of frames. We unroll a single iteration of Perspectiven-Point (PnP) (Lepetit et al., 2009; Li et al., 2012) performing Gauss-Newton updates over SE3 perturbations to minimize geometric reprojection error. The new estimate of camera motion can then be fed back into Flow-SE3, which re-estimates correspondence for a finer grain pose update. + +Our Depth Module builds upon prior work (Kendall et al., 2017; Yao et al., 2018) and formulates multiview-stereo (MVS) reconstruction as a single feed-forward network. Like classical MVS, we leverage geometry to build a cost volume over video frames, but use trainable network for both feature extraction and matching. + +Our work shares similarities with prior works (Ummenhofer et al., 2017; Kendall et al., 2017; Tang & Tan, 2018; Zhou et al., 2018; Kar et al., 2017; Wang et al., 2018) that also combine deep learning and multiview geometry, but is novel and unique in that it essentially “differentializes” a classical SfM pipeline that alternates between stereopsis, dense 2D feature matching, and $\mathrm { P n P } .$ As a comparison, DeMon (Ummenhofer et al., 2017) and DeepTAM (Zhou et al., 2018) differentialize stereopsis and feature matching, but not PnP because they use a generic network to predict camera motion. + +Another comparison is with BA-Net (Tang & Tan, 2018), whose classical analogue is performing bundle adjustment from scratch to optimize feature alignment over camera motion and the coefficients of a limited set of depth maps (depth basis). In other words, BA-Net performs one joint nonlinear optimization over all variables, whereas we decompose the joint optimization into more tractable subproblems and do block coordinate descent. Our decomposition is more expressive in terms of reconstruction since we can optimize directly over per-pixel depth and are not constrained by a depth basis, which can potentially limit the accuracy of the final depth. + +In our experiments, we demonstrate the effectiveness of DeepV2D across a variety of datasets and tasks, and outperform strong methods such as DeepTAM (Zhou et al., 2018), DeMoN (Ummenhofer et al., 2017), BANet (Tang & Tan, 2018), and MVSNet (Yao et al., 2018). As we show, alternating depth and motion estimation quickly converges to good solutions. On all datasets we outperform all existing single-view and multi-view approaches. We also show superior cross-dataset generalizability, and can outperform existing methods even when training on entirely different datasets. + +# 2 RELATED WORK + +Structure from Motion: Beginning with early systems designed for small image collections (Longuet-Higgins, 1981; Mohr et al., 1995), Structure from Motion (SfM) has improved dramatically in regards to robustness, accuracy, and scalability. Advances have come from improved features (Lowe, 2004; Han et al., 2015), optimization techniques (Snavely, 2009), and more scalable data structures and representations (Schonberger & Frahm, 2016a; Gherardi et al., 2010), culminating in a number of robust systems capable of large-scale reconstruction task (Schonberger & Frahm, 2016a; Snavely, 2011; Wu et al., 2011). Ranftl et al. (2016) showed that SfM could be extended to reconstruct scenes containing many dynamically moving objects. However, SfM is limited by the accuracy and availability of correspondence. In low texture regions, occlusions, or lighting changes SfM can produce noisy or missing reconstructions. + +Simultaneous Localization and Mapping (SLAM) jointly estimates camera motion and 3D structure from a video sequence (Engel et al., 2014; Mur-Artal et al., 2015; Mur-Artal & Tardos, 2017; New- ´ combe et al., 2011; Engel et al., 2018). LSD-SLAM (Engel et al., 2014) is unique in that it relies on a featureless approach to 3D reconstruction, directly estimating depth maps and camera pose by minimizing photometric error. Our Motion Network behaves similarly to the tracking component in LSD-SLAM, but we use a network which predicts misalignment directly instead of using intensity gradients. We end up with an easier optimization problem characteristic of indirect methods (Mur + +Artal et al., 2015), while retaining the flexibility of direct methods in modeling edges and smooth intensity changes (Engel et al., 2018). + +Geometry and Deep Learning: Geometric principles has motivated the design of many deep learning architectures. In video to depth, we need to solve two subproblems: depth estimation and motion estimation. + +Depth: End-to-end networks can be trained to predict accurate depth from a rectified pair of stereo images (Han et al., 2015; Mayer et al., 2016a; Kendall et al., 2017; Chang & Chen, 2018). Kendall et al. (2017) and Chang & Chen (2018) design network architectures specifically for stereo matching. First, they apply a 2D convolutional network to extract learned features, then build a cost volume over the learned features. They then apply 3-D convolutions to the cost volume to perform feature matching and regularization. A similar idea has been extended to estimate 3D structure from multiple views (Kar et al., 2017; Yao et al., 2018). In particular, MVSNet (Yao et al., 2018) estimates depth from multiple images. However, these works require known camera poses as input, while our method estimates depth from a video where the motion of the camera is unknown and estimated during inference. + +Motion: Several works have used deep networks to predict camera pose. Kendall et al. (2015) focus on the problem of camera localization, while other work (Zhou et al., 2017; Vijayanarasimhan et al., 2017; Wang et al., 2017) propose methods which estimate camera motion between a pairs of frames in a video. Networks for motion estimation have typically relied on generic network components whereas we formulate motion estimation as a least-squares optimization problem. Whereas prior work has focused on estimating relative motion between pairs of frames, we can jointly update the pose of a variable number of frames. + +Depth and Motion: Geometric information has served as a self-supervisory signal for many recent works (Vijayanarasimhan et al., 2017; Zhou et al., 2017; Wang et al., 2018; Yin & Shi, 2018; Yang et al., 2018; Godard et al., 2017; Mahjourian et al., 2018). In particular, Zhou et al. (2017) and Vijayanarasimhan et al. (2017) trained a single-image depth network and a pose network while supervising on photometric consistency. However, while these works use geometric principles for training, they do not use multiple frames to predict depth at inference. + +DeMoN (Ummenhofer et al., 2017) and DeepTAM (Zhou et al., 2018) where among the first works to combine motion estimation and multi-view reconstruction into a trainable pipeline. DeMoN (Ummenhofer et al., 2017) operates on two frames and estimates depth and motion in separate network branches, while DeepTAM (Zhou et al., 2018) can be used on variable number of frames. Like our work and other classical SLAM framesworks (Engel et al., 2014; Newcombe et al., 2011), DeepTAM separates depth and motion estimation, however we maintain end-to-end differentiablity between our modules. A major innovation of DeepTAM was to formulate camera motion estimation in the form of incremental updates. In each iteration, DeepTAM renders the keyframe from a synthetic viewpoint, and predicts the residual motion from the rendered viewpoint and the target frame. + +Estimating depth and camera motion can be naturally modeled as a non-linear least squares problem, which has motivated several works to include an differentiable optimization layer within network architectures (Tang & Tan, 2018; Wang et al., 2018; Clark et al., 2018; Bloesch et al., 2018). We follow this line of work, and propose the Flow-SE3 module which introduces a direct mapping from 2D correspondence to a 6-dof camera motion update. Our Flow-SE3 module is different from prior works such as DeMon (Ummenhofer et al., 2017) and DeepTAM (Zhou et al., 2018) which do not impose geometric constraints on camera motion and use generic layers. BA-Net (Tang & Tan, 2018) and LS-Net (Clark et al., 2018) include optimization layers, but instead optimize over photometric error (either pixel alignment (Clark et al., 2018) or feature alignment (Tang & Tan, 2018)). Our Flow-SE3 module still imposes geometric constraints on camera motion like BA-Net (Tang & Tan, 2018), but we show that in minimizing geometric reprojection error ( difference of pixel locations), we end up with a well-behaved optimization problem, well-suited for end-to-end training. + +An important difference between our approach and BA-Net is that BA-Net performs one joint optimization problem by formulating Bundle-Adjustment as a differentiable network layer, whereas we separate motion and depth estimation. With this separation, we avoid the need for a depth basis. Our final reconstructed depth is the product of a cost volume, which can adapt the reconstruction as camera motion updates improve, while the output of BA-Net is restricted by the initial quality of the depth basis produced by a single-image network. + +![](images/6b67b5e1b0c4a8c67334cab07168e5af6d6980ef7f3bc9d70c8d4291f05d7dd3.jpg) +Figure 2: The Depth Module performs stereo matching over multiple frames to estimate depth. First each image is fed through a network to extract a dense feature map. The 2D features are backprojected into a set of cost volumes. The cost volumes are processed by a set of 3D hourglass networks to perform feature matching. The final cost volume is processed by the differentiable arg-max operator to produce a pixelwise depth estimate. + +# 3 APPROACH + +DeepV2D predicts depth from a calibrated video sequence. We take a video as input and output dense depth. We consider two subproblems: depth estimation and motion estimation. Both subproblems are formulated as trainable neural network modules, which we refer to as the Depth Module and the Motion Module. Our depth module takes camera motion as input and outputs an updated depth prediction. Our motion module takes depth as input, and outputs a motion correction term. In the forward pass, we alternate between the depth and motion modules as we show in Figure 1. + +Notation and Camera Geometry: As a preliminary, we define some of the operations used within the depth and motion modules. We define $\pi$ to be the camera projection operator which maps a 3D point $\mathbf { X } = ( X , Y , Z , 1 ) ^ { T }$ to image coordinates $\mathbf { x } = ( u , v )$ . Likewise, $\pi ^ { \dot { - } 1 }$ is defined to be the backprojection operator, which maps a pixel $x$ and depth $z$ to a 3D point. Using the pinhole camera model with intrinsics $( f _ { x } , f _ { y } , c _ { x } , c _ { y } )$ we have + +$$ +\pi ( { \bf X } ) = ( f _ { x } \frac { X } { Z } + c _ { x } , f _ { y } \frac { Y } { Z } + c _ { y } ) , \qquad \pi ^ { - 1 } ( { \bf x } , z ) = ( z \frac { u - c _ { x } } { f _ { x } } , z \frac { v - c _ { y } } { f _ { y } } , z , 1 ) ^ { T } +$$ + +The camera pose is represented using rigid body transform $\mathbf { G } \in S E ( 3 )$ . To find the image coordinates of point $\mathbf { X }$ in camera $i$ , we chain the projection and transformation: $( u , v ) ^ { T } = \bar { \pi ( \mathbf { G } _ { i } \mathbf { X } ) }$ , where $\mathbf { G } _ { i }$ is the pose of camera $i$ . + +Now, given two cameras $\mathbf { G } _ { i }$ and $\mathbf { G } _ { j }$ . If we know the depth of a point $\mathbf { x } ^ { i } = ( u ^ { i } , v ^ { i } )$ in camera $i$ , we can find its reprojected coordinates in camera $j$ : + +$$ +\binom { u ^ { j } } { v ^ { j } } = \pi ( \mathbf { G } _ { j } \mathbf { G } _ { i } ^ { - 1 } \pi ^ { - 1 } ( \mathbf { x } , z ) ) = \pi ( \mathbf { G } _ { i j } \pi ^ { - 1 } ( \mathbf { x } , z ) ) +$$ + +using the notation $\mathbf { G } _ { i j } = \mathbf { G } _ { j } \mathbf { G } _ { i } ^ { - 1 }$ for the relative pose between cameras $i$ and $j$ . + +# 3.1 DEPTH MODULE + +The depth module takes a collection of frames, $\mathbf { I } = \{ I _ { 1 } , I _ { 2 } , . . . , I _ { N } \}$ , along with their respective pose estimates, $\mathbf { G } = \{ G _ { 1 } , G _ { 2 } , . . . , G _ { N } \}$ , and predicts a dense depth map $D ^ { * }$ for the keyframe (Figure 2). The depth module works by building a cost volume over learned features. Information is aggregated over multiple viewpoints by applying a global pooling layer which pools across viewpoints. + +The depth module can be viewed as the composition of 3 building blocks: 2D feature extractor, cost volume backprojection, and 3D stereo matching. + +2D Feature Extraction: The Depth Module begins by extracting learned features from the input images. The 2D encoder consists of 2 stacked hourglass modules (Newell et al., 2016) which maps each image to a dense feature map $I _ { i } \to F _ { i }$ . More information regarding network architectures is provided in the appendix. + +Cost Volume Backprojection: Take $I _ { 1 }$ to be the keyframe, a cost volume is constructed for each of the remaining N-1 frames. The cost volume for frame $j$ , $\mathbf { C } ^ { j }$ , is constructed by backprojecting 2D features into the coordinate system defined by the keyframe image. To build the cost volume, we enumerate over a range of depths $z _ { 1 } , z _ { 2 } , . . . , z _ { D }$ which is chosen to span the ranges observed in the dataset $0 . 2 \mathrm { m } \cdot 1 0 \mathrm { m }$ for indoor scenes). For every depth $z _ { k }$ , we use Equation 2 to find the reprojected coordinates on frame $j$ , and then use differentiable bilinear sampling of the feature map $F _ { j }$ . + +More formally, given a pixel $\mathbf { x } = ( u , v ) \in \mathbb { N } ^ { 2 }$ in frame $I _ { 1 }$ and depth $z _ { k }$ + +$$ +C _ { u v k } ^ { j } = F _ { j } ( \pi ( \mathbf { G } _ { j } \mathbf { G } _ { 1 } ^ { - 1 } \pi ^ { - 1 } ( \mathbf { x } , z _ { k } ) ) ) \in \mathbb { R } ^ { H \times W \times D \times C } +$$ + +where $F ( \cdot )$ is the differentiable bilinear sampling operator (Jaderberg et al., 2015). Since the bilinear sampling is differentiable, $\mathbf { C } ^ { j }$ is differentiable w.r.t all inputs, including the camera pose. + +Applying this operation to each frame, gives us a set of N-1 cost volumes each with dimension $\mathbf { H } { \times } \mathbf { W } { \times } \mathbf { D } { \times } \mathbf { C }$ . As a final step, we concatenate each cost volume with the keyframe image features increasing the dimension to $\mathrm { H } { \times } \mathrm { W } { \times } \mathrm { D } { \times } 2 \mathrm { C }$ . By concatenating features, we give the network the necessary information to perform feature matching between the keyframe/image pairs without decimating the feature dimension. + +3D Matching Network: The set of N-1 cost volumes are first processed by a series of 3D convolutional layers to perform stereo matching. We then perform view pooling by averaging over the N-1 volumes to aggregate information across frames. View pooling leaves us with a single volume of dimension $\mathbf { H } { \times } \mathbf { W } { \times } \mathbf { D } { \times } \mathbf { C }$ . The aggregated volume is then processed by a series of 3D hourglass modules, each outputs an intermediate depth. + +Each 3D hourglass module predicts an intermediate depth estimate. We produce an intermediate depth representation by first applying a 1x1x1 convolution to a produce $\mathrm { H } \times \mathrm { W } \times \mathrm { D }$ volume. We then apply the softmax operator over the depth dimension, so that for each pixel, we get a probability distribution over depths. We map the probability volume into a single depth estimate using the differentiable argmax function (Kendall et al., 2017) which computes the expected depth. + +# 3.2 MOTION MODULE + +The objective of the motion module is to update the camera motion estimates given depth as input. Given the input poses, $\mathbf { G } = \{ G _ { 1 } , G _ { 2 } , . . . , G _ { N } \}$ , the motion module outputs a set of local perturbations $\pmb { \xi } = \{ \xi _ { 1 } , \xi _ { 2 } , . . . , \xi _ { N } \} , \xi _ { i } \in s e ( 3 )$ used to update the poses. The updates are found by setting up a least squares optimization problem which is solved using a differentiable in-network optimization layer. + +Initialization: We use a generic network architecture to predict the initial pose estimates similiar to prior work Zhou et al. (2017). We choose one frame to be the keyframe. The poses are initialized by setting the keyframe pose to be the identity matrix, and then predicting the relative motion between the keyframe and each of the other frames in the video. + +Feature Extraction: Our motion module operates over learned features. The feature extractor maps every frame to a dense feature map, $I _ { i } \to F _ { i }$ . The weights of the feature extractor are shared across all frames. Network architecture details are provided in the appendix. + +Error Term: Take two frames, $( I _ { i } , I _ { j } )$ , with respective poses $( \mathbf { G } _ { i } , \mathbf { G } _ { j } )$ and feature maps $( F _ { i } , F _ { j } )$ . Given depth $Z _ { i }$ we can use Equation 2 we can warp $F _ { j }$ onto camera $i$ to generate the warped feature map $\tilde { F } _ { j }$ . If the relative pose $\mathbf { G } _ { i j } = \mathbf { G } _ { j } \mathbf { G } _ { i } ^ { - 1 }$ is correct, then the feature maps $F _ { i }$ and $\tilde { F } _ { j }$ should align. However, if the relative pose is noisy, then there will be misalignment between the feature images which should be corrected by the pose update. + +We concatenate $F _ { i }$ and $\tilde { F } _ { j }$ , and send the concatenated feature map through an hourglass network to predict the dense residual flow between the feature maps, which we denote $\mathbf { R }$ , and corresponding confidence map W. Using the residual flow, we define the following error term: + +$$ +\mathbf { e } _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) = \mathbf { r } _ { k } - [ \pi ( ( e ^ { \xi _ { j } } \mathbf { G } _ { j } ) ( e ^ { \xi _ { i } } \mathbf { G } _ { i } ) ^ { - 1 } \mathbf { X } _ { k } ^ { i } ) - \pi ( \mathbf { G } _ { i j } \mathbf { X } _ { k } ^ { i } ) ] , \qquad \mathbf { X } _ { k } ^ { i } = \pi ^ { - 1 } ( \mathbf { x } _ { k } , z _ { k } ) +$$ + +![](images/3c66c6e35702e8a89a2cba47238a015bf4bcafca5a75911beab7b97ba10d39f7.jpg) +Figure 3: The Motion Module updates the input pose estimates by solving a least squares optimization problem. The motion module predicts the residual flow between pairs of frames, and uses the residual terms to define the optimization objective. Pose increments $\boldsymbol { \xi }$ are found by performing a single differentiable Gauss-Newton optimization step. + +where $\mathbf { r } _ { k }$ is the residual flow at pixel $\mathbf { x } _ { k }$ predicted by the network, and $z _ { k }$ is the predicted depth. The weighting map W is mapped to $( 0 , 1 )$ using the sigmoid activation, and is used to determine how the individual error terms are weighted in the final objective. + +Optimization Objective: The previous section showed how two frames $( i , j )$ can be used to define a collection of error terms $\mathbf { e } _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } )$ for each pixel $\mathbf { x } _ { k }$ in image $I _ { i }$ . The final optimization objective is a weighted combination of error terms: + +$$ +E ( \pmb { \xi } ) = \sum _ { ( i , j ) \in \mathcal { C } } \sum _ { k } \mathbf { e } _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) ^ { T } d i a g ( \mathbf { w } _ { k } ) \mathbf { e } _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) , \qquad d i a g ( \mathbf { w } _ { k } ) = \left( \begin{array} { l l } { w _ { k } ^ { u } } & { 0 } \\ { 0 } & { w _ { k } ^ { v } } \end{array} \right) +$$ + +This leaves us with the question of which frames pairs $( i , j ) \in \mathcal { C }$ to use when defining the optimization objective. In this paper, we consider two different approaches which we refer to as Global pose optimization and Keyframe pose optimization. + +Global Pose Optimization: Our global pose optimization uses all pairs of frames ${ \mathcal { C } } = ( i , j ) , i \neq j$ to define the objective function (Equation 5) and the pose increment $\xi$ is solved for jointly over all poses. Therefore, given $N$ frames, dense pose optimization uses $\mathbf { N } { \times } \mathbf { N } { - } 1$ frame pairs. Since every pair of frames is compared, this means that the global pose optimization requires the predicted depth maps for all frames as input. Although each pair $( i , j )$ only gives us information about the relative pose $\mathbf { G } _ { i j }$ , considering all pairs allows us to converge to a globally consistent pose graph. + +Keyframe Pose Optimization: Our keyframe pose optimization selects a given frame to be the keyframe (i.e select $I _ { 1 }$ as the keyframe), and only computes the error terms between the keyframe and each of the other frames: $\mathcal { C } \overset { \cdot } { = } \left( 1 , j \right)$ for $j = 2 , . . . , N$ . + +Fixing the pose of the keyframe, we can remove $\xi _ { 1 }$ from the optimization objective. This means that each error $\mathbf { e } _ { k } ^ { i j } ( \mathbf { 0 } , \boldsymbol { \xi } _ { j } )$ term is only a function of a single pose increment $\xi _ { j }$ . Therefore, we can solve for each of the $N - 1$ pose increments independently. Additionally, since $i = 1$ for all pairs $( i , j ) \in \mathcal { C }$ , we only need the depth of the keyframe as input when using keyframe pose optimization. + +LS-Optimization Layer: Using the optimization objective in Equation 5, we solve for the pose increments $\boldsymbol { \xi }$ by applying a Gauss-Newton update. We backpropogate through the Gauss-Newton update so that the weights of the motion module (both feature extractor and flow network) can be trained on the final objective function. In the appendix, we provide additional information for how the update is derived and the expression for the Jacobian of Equation 4. + +# 3.3 FULL SYSTEM + +During inference, we alternate the depth and motion modules for a selected number of iterations. The motion module uses depth to predict camera pose. As the depth estimates converge, the camera poses become more accurate. Likewise, as camera poses converge, the depth module can estimate more accurate depth. + +![](images/8c1100db2950f560056a49cd8fdfa00352b5fdd3edae4548c7a76b405d822571.jpg) +Figure 4: Visualization of predicted depth maps on NYU, ScanNet, and SUN3D. On ScanNet and SUN3D (marked with \*) we show the results of the model trained only on NYU data. + +Initialization: We try two different strategies for initialization in our experiments: (1) self initialization initializes DeepV2D with a constant depth map and (2) single image initialization uses the output of a single-image depth network for initialization. Both methods give good performance. + +# 3.4 SUPERVISION + +Depth Supervision: We supervise on the L1 distance between the ground truth and predicted depth. We additionally apply a small L1 smoothness penalty to the predicted depth map. Given predicted depth $Z$ and ground truth depth $Z ^ { \ast }$ , the depth loss is defined as: + +$$ +\mathcal { L } _ { d e p t h } ( Z ) = \sum _ { \mathbf { x } _ { i } } \left| Z ( \mathbf { x } _ { i } ) - Z ^ { * } ( \mathbf { x _ { i } } ) \right| + w _ { s } \sum _ { \mathbf { x } _ { i } } \left| \partial _ { x } Z ( \mathbf { x } _ { i } ) \right| + \left| \partial _ { y } Z ( \mathbf { x } _ { i } ) \right| +$$ + +Motion Supervision: We supervise pose using the geometric reprojection error. Given predicted pose $\mathbf { G }$ and ground truth pose $\mathbf { G } ^ { \ast }$ , the pose loss is defined + +$$ +\mathcal { L } _ { m o t i o n } ( \mathbf { G } ) = \sum _ { \mathbf { x } _ { i } } | | \pi ( \mathbf { G } \pi ^ { - 1 } ( \mathbf { x } _ { i } , Z ( \mathbf { x } _ { i } ) ) ) - \pi ( \mathbf { G } ^ { * } \pi ^ { - 1 } ( \mathbf { x } _ { i } , Z ( \mathbf { x } _ { i } ) ) ) | | _ { \delta } +$$ + +where $| | \cdot | | _ { \delta }$ is the robust Huber loss; we set $\delta = 1$ . + +Total Loss: The total loss is taken as a weighted combination of the depth and motion loss terms: $\mathcal { L } = \mathcal { L } _ { d e p t h } + \lambda \mathcal { L } _ { m o t i o n }$ , where we set $\lambda = 1 . 0$ in our experiments. + +# 4 EXPERIMENTS + +We test DeepV2D across a wide range of benchmarks to provide a thorough comparison to other methods. While the primary focus of these experiments is to compare to other works which estimate depth from multiple frames, often single-view networks still outperform multiview depth estimation. To put our results in proper context, we include both multiview and state-of-the-art single-image comparisons. Since it is not possible to recover the absolute scale of the scene through SfM, we report all results (both ours and all other approaches) using scale matched depth (Tang & Tan, 2018). + +Our primary experiments are on NYU, ScanNet, SUN3D, and KITTI, and we report strong results across all datasets. We show visualization of our predicted depth maps in Figure 4. The figure shows that DeepV2D can recover accurate and sharp depth even when applied to unseen datasets. One aspect of particular interest is cross-dataset generalizability. Our results show that DeepV2D generalizes very well—we achieve the highest accuracy on ScanNet and SUN3D even without training on either dataset. + +# 4.1 DEPTH EXPERIMENTS + +We evaluate depth on NYU (Silberman et al., 2012), ScanNet (Dai et al., 2017), SUN3D (Xiao et al., 2013), and KITTI (Geiger et al., 2013). On all datasets, DeepV2D is given a video clip with unknown camera poses and alternates depth and pose updates and is evaluated after 8 iterations. + +NYU: NYU depth (Silberman et al., 2012) is a dataset composed of videos taken in indoor settings including offices, bedrooms, and libraries. We experiment on NYU using the standard train/test split (Eigen et al., 2014) and report results in Table 1 using scaled depth (Zhou et al., 2017; Tang & Tan, 2018). We evaluate two different initialization methods of our approach. Self-init uses a constant depth map for initialization, while fcrn-init uses the output of a FCRN (Laina et al., 2016)—a singleview network for initialization. Using a single-image depth network for initialization gives a slight improvement in performance. + +
NYUv2δ<1.25↑δ<1.25²↑δ<1.253 个Abs Rel↓Sc Inv↓RMSE↓log10↓
FCRN (Laina et al., 2016)0.8530.9650.9910.1210.1510.5920.052
DORN (Fu et al., 2018)0.8750.9660.9890.109-0.4640.047
Alhashim& Wonka (2018) COLMAP0.8950.9800.9960.103-0.3900.043
mnnian DeMoN †DfUSMC DeMoN0.619 0.4870.760 0.6970.829 0.8140.312 0.4471.512 0.4561.381 1.7930.153 0.169
MVSNet + OpenMVG0.7660.9130.9650.1810.212
0.9170.072
0.7760.9330.9790.1600.1960.7750.067
0.8050.9510.9850.1440.1790.7170.061
Ours (self-init)-Keyframe Ours (fcrn-init) - Keyframe Ours (self-init) - Global0.9400.9850.9950.0720.1050.4590.031
0.955 0.9420.9900.9960.0620.0950.4050.027
0.9860.9950.0700.1040.4540.030
Ours (fcrn-init) -Global 0.9560.9890.9960.0610.0940.4030.026
+ +Table 1: Results on the NYU dataset. Our approach outperforms existing single-view and multiview depth estimation methods. Ours (self-init) uses a constant depth map for initialization while ours(fcrn-init) uses a single-image depth network for initialization. + +We compare to state-of-the-art single-image depth networks DORN (Fu et al., 2018) and DenseDepth (Alhashim & Wonka, 2018) which are built on top of a pretrained ResNet (DORN) or DenseNet-201 (DenseDepth). The results show that we can do much better than single-view depth by using multiple views. We also include classical multiview approaches such as COLMAP (Schonberger & Frahm, 2016a) and DfUSMC (Ha et al., 2016) which estimate poses with bundle adjustment, followed by dense stereo matching. While COLMAP uses SIFT features, DfUSMC is built on local-feature tracking and is designed for small baseline videos. + +Table 1 also includes results using multi-view deep learning approaches. MVSNet (Yao et al., 2018) is trained to estimate depth from multiple viewpoints. Unlike our approach which estimates camera pose during inference, MVSNet requires ground truth poses as input. We train MVSNet on NYU and use poses estimated from OpenMVG (Moulon et al.) during inference. Finally, we also evaluate DeMoN (Ummenhofer et al., 2017) on NYU. DeMoN is not originally trained on NYU, but instead trained on a combination of 5 other datasets. We also try a version of DeMoN which we retrain on NYU using the code provided by the authors (denoted †). + +In Appendix C, we include additional results on NYU where we test different versions of our model, along with parameter counts, timing information, peak memory usage, and depth accuracy. A shallower version of DeepV2D (replacing the stacked hourglass networks with a single hourglass network) and lower resolution inference still outperform existing work on NYU. However, using a 3D network for stereo matching turns out to be very important for depth accuracy. When the 3D stereo network is replaced with a correlation layer (Dosovitskiy et al., 2015) and 2d encoder-decoder, depth accuracy is worse increasing Abs-Rel from 0.062 to 0.135. + +Figure 5 shows the impact of the number of iterations and views on the scale-invariant (sc-inv) validation set accuracy. Figure 5 (left) shows that DeepV2D requires very few iterations to converge, suggesting that block coordinate descent is effective for estimate depth from small video clips. In Figure 5 (right) we test accuracy as a function of the number of input frames used. Although DeepV2D is trained using a fixed number (4) frames as input, accuracy continues to improve a more frames are added. + +ScanNet: ScanNet is a large indoor dataset consisting of 1513 RGB-D videos in distinct scenes. We use the train/test split proposed by Tang & Tan (2018) and evaluate depth and pose accuracy in Table 2. While our primary focus is on depth, DeepV2D accurately predicts camera motion. + +We use ScanNet to test cross-dataset generalization and report results from two versions of our approach: ours (nyu) is our method trained only on nyu, ours (scannet) is our method trained on ScanNet. As expected, when we train on the ScanNet training set we do better than if we train only on NYU. But the performance of our NYU model is still good and outperforms BA-Net on all metrics. The design of our approach is motivated by generalizability. Our network only needs to learn feature matching and correspondence; this experiment indicates that by learning these low level tasks, we can generalize well to new data. + +![](images/36d9f7a5ae059ac7be779f6ce91e5242e008cb9039a92cfb4b83c830a444c06f.jpg) +Figure 5: Impact of the number of iterations (left) and frames (right) on sc-inv validation accuracy. (left) shows that DeepV2D quickly converges within a small number of iterations. In (right) we see that accuracy consistently improves as more views are added. DeepV2D can be applied to variable numbers of views for a variable number of iterations without retraining. + +Table 2: ScanNet experiments evaluating depth and pose accuracy and cross-dataset generalization. Our approach trained on NYU (ours nyu) outperforms BA-Net despite BA-Net being trained on ScanNet data; training on ScanNet (ours scannet) gives even better performance. + +
ScanNetAbs Rel↓Sq Rel↓RMSE、RMSE log √sc invrot.(deg)↓tr. (deg)↓tr.(cm)↓
DeMoN0.2310.5200.7610.2890.2843.79131.62615.50
BA-Net (orig.)0.1610.0920.3460.2140.1841.01820.5773.390
BA-Net (5-view)0.0910.0580.2230.1470.1371.00914.6262.365
DSO (Engel et al., 2018)0.92519.7282.174
DSO (fcrn-init)0.94619.2382.165
Ours (nyu) Ours (scannet)0.080 0.0570.018 0.0100.223 0.1680.109 0.0800.105 0.0770.714 0.62812.205 10.8001.514 1.373
+ +Pose accuracy from DSO Engel et al. (2018) is also included in Table 2. We test DSO using both the default initialization and single-image depth initialization using the output of FCRN (Laina et al., 2016). DSO fails to initialize or loses tracking on some of the test sequences so we only evaluate on sequences where DSO is successful. DSO fails on 335 of the 2000 test sequences while DSO (fcrn-init) fails on only 271. + +SUN3D: SUN3D (Xiao et al., 2013) is another indoor scenes dataset which we use for comparison with DeepTAM. DeepTAM only evaluates their depth module in isolation using the poses provided by dataset, while our approach is designed to estimate poses during inference. We provide results from our SUN3D experiments in Table 3. + +Table 3: Results on SUN3D dataset and comparison to DeepTAM. DeepTAM only evaluates depth in isolation and uses the poses from the dataset during inference, while our approach jointly estimates camera poses during inference. We outperform DeepTAM and DeMoN on SUN3D even when we do not use SUN3D data for training. + +
SUN3DTraining DataL1-Inv ↓L1-Rel↓Sc-Inv↓
SGM DTAM=0.1970.4120.340
DeMoN=0.2100.4230.374
DeepTAMS11+RGBD+MVS+SUN3D==0.146
OursMVS+SUNCG+SUN3D0.054 0.0560.1010.128
OursNYU NYU+ ScanNet0.0410.1060.134
0.0770.104
+ +We cannot train using the same data as DeepTAM since DeepTAM is trained using a combination of SUN3D, SUNCG, and MVS, and, at this time, neither MVS nor SUNCG are publicly available. Instead we train on alternate data and test on SUN3D. We test two different versions of our model; one where we train only on NYU, and another where we train on a combination of NYU and ScanNet data. Our NYU model performs similiar to DeepTAM; When we combine with ScanNet data, we outperform DeepTAM even though DeepTAM is trained on SUN3D and is evaluated with ground truth pose as input. + +KITTI: The KITTI dataset (Geiger et al., 2013) is captured from a moving vehicle and has been widely used to evaluate depth estimation and odometry. We follow the Eigen train/test split (Eigen et al., 2014), and report results in Table 4. We evaluate using the official ground truth depth maps. We compare to the state-of-the-art single-view methods and also multiview approaches such as BANet (Tang & Tan, 2018), and outperform previous methods on the KITTI dataset across all metrics. + +
KITTIMultiδ<1.25↑δ<1.25²↑δ<1.25³↑AbsRel↓Sq Rel↓Sq Rel†↓RMSE↓RMSE log↓
DORNN0.9450.9880.9960.0690.300=2.8570.112
DfUSMCY0.6170.7960.8740.3465.9848.8790.454
BA-NetY===0.083=0.0253.6400.134
OursY0.9770.9930.9970.0370.1740.0132.0050.074
+ +Table 4: Results on the KITTI dataset. We compare to state-of-the-art single-image depth network DORN (Fu et al., 2018) and multiview BA-Net (Tang & Tan, 2018). BA-Net reports results using a different form of the Sq-Rel metric which we denote by $\dagger$ . + +Overall, the depth experiments demonstrates that imposing geometric constraints on the model architecture leads to higher accuracy and better cross-dataset generalization. By providing a differentiable mapping from optical flow to camera motion, the motion network only needs to learn to estimate interframe correspondence. Likewise, the 3D cost volume means the the depth network only needs to learn to perform stereo matching. These tasks are easy for the network to learn, which leads to strong results on all datasets, and can generalize to new datasets. + +# 4.2 TRACKING EXPERIMENTS + +DeepV2D can be turned into a basic SLAM system. Using NYU and ScanNet for training, we test tracking performance on the TUM-RGBD tracking benchmark (Table 5) using sensor depth as input. We achieve a lower translational rmse $[ \mathrm { m } / \mathrm { s } ]$ than DeepTAM on most of the sequences. DeepTAM uses optical flow supervision to improve performance, but since our network directly maps optical flow to camera motion, we do not need supervision on optical flow. + +We use our global pose optimization in our tracking experiments. We maintain a fixed window of 8 frames during tracking. At each timestep, the pose of the first 3 frames in the window are fixed and the remaining 5 are updated using the motion module. After the update, the start of the tracking window is incremented by 1 frame. We believe our ability to jointly update the pose of multiple frames is a key reason for our strong performance on the RGB-D benchmark. + +Table 5: Tracking results in the RGB-D benchmark (translational rmse $[ \mathrm { m } / \mathrm { s } ] ,$ ). + +
360deskdesk2plantroomrpyxyzmean
DVO (Kerl et al., 2013)0.1250.0370.0200.0620.0420.0820.0510.060
DeepTAM (Zhou et al., 2018)0.0540.0270.0170.0570.0390.0650.0190.040
DeepTAM(w/o flow) (Zhou et al.,2018)0.0690.0420.0250.0630.0510.0700.0300.050
Ours0.0460.0340.0170.0520.0320.0370.0140.033
+ +# 5 CONCLUSION + +We propose DeepV2D, a deep learning architecture which is built by composing classical geometric algorithms into a fully differentiable pipeline. DeepV2D is flexible and performs well across a variety of tasks and datasets. + +Acknowledgements We would like to thank Zhaoheng Zheng for helping with baseline experiments. This work was partially funded by the Toyota Research Institute, the King Abdullah University of Science and Technology (KAUST) Office of Sponsored Research (OSR) under Award No. OSR2015-CRG4-2639, and the National Science Foundation under Grant No. 1617767. + +# REFERENCES + +Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016. + +Sameer Agarwal, Keir Mierle, et al. Ceres solver. 2012. + +Ibraheem Alhashim and Peter Wonka. High quality monocular depth estimation via transfer learning. arXiv preprint arXiv:1812.11941, 2018. + +Michael Bloesch, Jan Czarnowski, Ronald Clark, Stefan Leutenegger, and Andrew J Davison. Codeslam—learning a compact, optimisable representation for dense visual slam. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2560–2568, 2018. + +Jia-Ren Chang and Yong-Sheng Chen. Pyramid stereo matching network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5410–5418, 2018. + +Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016. + +Ronald Clark, Michael Bloesch, Jan Czarnowski, Stefan Leutenegger, and Andrew J Davison. Learning to solve nonlinear least squares for monocular stereo. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 284–299, 2018. + +Angela Dai, Angel X Chang, Manolis Savva, Maciej Halber, Thomas Funkhouser, and Matthias Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5828–5839, 2017. + +Alexey Dosovitskiy, Philipp Fischer, Eddy Ilg, Philip Hausser, Caner Hazirbas, Vladimir Golkov, Patrick Van Der Smagt, Daniel Cremers, and Thomas Brox. Flownet: Learning optical flow with convolutional networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2758–2766, 2015. + +David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2650–2658, 2015. + +David Eigen, Christian Puhrsch, and Rob Fergus. Depth map prediction from a single image using a multi-scale deep network. In Advances in neural information processing systems, pp. 2366–2374, 2014. + +Jakob Engel, Thomas Schops, and Daniel Cremers. Lsd-slam: Large-scale direct monocular slam.¨ In European Conference on Computer Vision, pp. 834–849. Springer, 2014. + +Jakob Engel, Vladlen Koltun, and Daniel Cremers. Direct sparse odometry. IEEE transactions on pattern analysis and machine intelligence, 40(3):611–625, 2018. + +Huan Fu, Mingming Gong, Chaohui Wang, Kayhan Batmanghelich, and Dacheng Tao. Deep ordinal regression network for monocular depth estimation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2002–2011, 2018. + +Yasutaka Furukawa and Jean Ponce. Accurate, dense, and robust multiview stereopsis. IEEE transactions on pattern analysis and machine intelligence, 32(8):1362–1376, 2010. + +Yasutaka Furukawa, Carlos Hernandez, et al. Multi-view stereo: A tutorial. ´ Foundations and Trends $\textsuperscript { \textregistered }$ in Computer Graphics and Vision, 9(1-2):1–148, 2015. + +Andreas Geiger, Philip Lenz, Christoph Stiller, and Raquel Urtasun. Vision meets robotics: The kitti dataset. The International Journal of Robotics Research, 32(11):1231–1237, 2013. + +Riccardo Gherardi, Michela Farenzena, and Andrea Fusiello. Improving the efficiency of hierarchical structure-and-motion. In Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on, pp. 1594–1600. IEEE, 2010. + +Clement Godard, Oisin Mac Aodha, and Gabriel J Brostow. Unsupervised monocular depth estima- ´ tion with left-right consistency. In CVPR, volume 2, pp. 7, 2017. + +Hyowon Ha, Sunghoon Im, Jaesik Park, Hae-Gon Jeon, and In So Kweon. High-quality depth from uncalibrated small motion clip. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5413–5421, 2016. + +Xufeng Han, Thomas Leung, Yangqing Jia, Rahul Sukthankar, and Alexander C Berg. Matchnet: Unifying feature and metric learning for patch-based matching. In Computer Vision and Pattern Recognition (CVPR), 2015 IEEE Conference on, pp. 3279–3286. IEEE, 2015. + +Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. In Advances in neural information processing systems, pp. 2017–2025, 2015. + +Abhishek Kar, Jitendra Malik, and Christian Hane. Learning a multi-view stereo machine. In ¨ Advances in Neural Information Processing Systems, pp. 364–375, 2017. + +Alex Kendall and Roberto Cipolla. Geometric loss functions for camera pose regression with deep learning. In Proc. CVPR, volume 3, pp. 8, 2017. + +Alex Kendall, Matthew Grimes, and Roberto Cipolla. Posenet: A convolutional network for realtime 6-dof camera relocalization. In Computer Vision (ICCV), 2015 IEEE International Conference on, pp. 2938–2946. IEEE, 2015. + +Alex Kendall, Hayk Martirosyan, Saumitro Dasgupta, Peter Henry, Ryan Kennedy, Abraham Bachrach, and Adam Bry. End-to-end learning of geometry and context for deep stereo regression. In Proceedings of the IEEE International Conference on Computer Vision, pp. 66–75, 2017. + +Christian Kerl, Jurgen Sturm, and Daniel Cremers. Dense visual slam for rgb-d cameras. In Intelligent Robots and Systems (IROS), 2013 IEEE/RSJ International Conference on, pp. 2100–2106. IEEE, 2013. + +Iro Laina, Christian Rupprecht, Vasileios Belagiannis, Federico Tombari, and Nassir Navab. Deeper depth prediction with fully convolutional residual networks. In 3D Vision (3DV), 2016 Fourth International Conference on, pp. 239–248. IEEE, 2016. + +Vincent Lepetit, Francesc Moreno-Noguer, and Pascal Fua. Epnp: An accurate o (n) solution to the pnp problem. International journal of computer vision, 81(2):155, 2009. + +Shiqi Li, Chi Xu, and Ming Xie. A robust o (n) solution to the perspective-n-point problem. IEEE transactions on pattern analysis and machine intelligence, 34(7):1444–1450, 2012. + +H Christopher Longuet-Higgins. A computer algorithm for reconstructing a scene from two projections. Nature, 293(5828):133–135, 1981. + +David G Lowe. Distinctive image features from scale-invariant keypoints. International journal of computer vision, 60(2):91–110, 2004. + +Reza Mahjourian, Martin Wicke, and Anelia Angelova. Unsupervised learning of depth and egomotion from monocular video using 3d geometric constraints. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5667–5675, 2018. + +Nikolaus Mayer, Eddy Ilg, Philip Hausser, Philipp Fischer, Daniel Cremers, Alexey Dosovitskiy, and Thomas Brox. A large dataset to train convolutional networks for disparity, optical flow, and scene flow estimation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4040–4048, 2016a. + +Nikolaus Mayer, Eddy Ilg, Philip Hausser, Philipp Fischer, Daniel Cremers, Alexey Dosovitskiy, and Thomas Brox. A large dataset to train convolutional networks for disparity, optical flow, and scene flow estimation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4040–4048, 2016b. + +Roger Mohr, Long Quan, and Franc¸oise Veillon. Relative 3d reconstruction using multiple uncalibrated images. The International Journal of Robotics Research, 14(6):619–632, 1995. + +Pierre Moulon, Pascal Monasse, Renaud Marlet, and Others. Openmvg. an open multiple view geometry library. https://github.com/openMVG/openMVG. + +Raul Mur-Artal and Juan D Tardos. Orb-slam2: An open-source slam system for monocular, stereo, ´ and rgb-d cameras. IEEE Transactions on Robotics, 33(5):1255–1262, 2017. + +Raul Mur-Artal, Jose Maria Martinez Montiel, and Juan D Tardos. Orb-slam: a versatile and accurate monocular slam system. IEEE Transactions on Robotics, 31(5):1147–1163, 2015. + +Richard A Newcombe, Steven J Lovegrove, and Andrew J Davison. Dtam: Dense tracking and mapping in real-time. In 2011 international conference on computer vision, pp. 2320–2327. IEEE, 2011. + +Alejandro Newell, Kaiyu Yang, and Jia Deng. Stacked hourglass networks for human pose estimation. In European Conference on Computer Vision, pp. 483–499. Springer, 2016. + +Rene Ranftl, Vibhav Vineet, Qifeng Chen, and Vladlen Koltun. Dense monocular depth estimation ´ in complex dynamic scenes. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4058–4066, 2016. + +Johannes L Schonberger and Jan-Michael Frahm. Structure-from-motion revisited. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4104–4113, 2016a. + +Johannes L Schonberger and Jan-Michael Frahm. Structure-from-motion revisited. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4104–4113, 2016b. + +Nathan Silberman, Derek Hoiem, Pushmeet Kohli, and Rob Fergus. Indoor segmentation and support inference from rgbd images. Computer Vision–ECCV 2012, pp. 746–760, 2012. + +Keith N Snavely. Scene reconstruction and visualization from internet photo collections. 2009. + +Noah Snavely. Scene reconstruction and visualization from internet photo collections: A survey. IPSJ Transactions on Computer Vision and Applications, 3:44–66, 2011. + +Deqing Sun, Xiaodong Yang, Ming-Yu Liu, and Jan Kautz. Pwc-net: Cnns for optical flow using pyramid, warping, and cost volume. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8934–8943, 2018. + +Chengzhou Tang and Ping Tan. Ba-net: Dense bundle adjustment network. arXiv preprint arXiv:1806.04807, 2018. + +Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26– 31, 2012. + +Benjamin Ummenhofer, Huizhong Zhou, Jonas Uhrig, Nikolaus Mayer, Eddy Ilg, Alexey Dosovitskiy, and Thomas Brox. Demon: Depth and motion network for learning monocular stereo. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5038– 5047, 2017. + +Sudheendra Vijayanarasimhan, Susanna Ricco, Cordelia Schmid, Rahul Sukthankar, and Katerina Fragkiadaki. Sfm-net: Learning of structure and motion from video. arXiv preprint arXiv:1704.07804, 2017. + +Chaoyang Wang, Jose Miguel Buenaposada, Rui Zhu, and Simon Lucey. Learning depth from ´ monocular videos using direct methods. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2022–2030, 2018. + +Sen Wang, Ronald Clark, Hongkai Wen, and Niki Trigoni. Deepvo: Towards end-to-end visual odometry with deep recurrent convolutional neural networks. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 2043–2050. IEEE, 2017. + +Changchang Wu et al. Visualsfm: A visual structure from motion system. 2011. + +Jianxiong Xiao, Andrew Owens, and Antonio Torralba. Sun3d: A database of big spaces reconstructed using sfm and object labels. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1625–1632, 2013. + +Nan Yang, Rui Wang, Jorg Stuckler, and Daniel Cremers. Deep virtual stereo odometry: Leveraging deep depth prediction for monocular direct sparse odometry. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 817–833, 2018. + +Yao Yao, Zixin Luo, Shiwei Li, Tian Fang, and Long Quan. Mvsnet: Depth inference for unstructured multi-view stereo. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 767–783, 2018. + +Zhichao Yin and Jianping Shi. Geonet: Unsupervised learning of dense depth, optical flow and camera pose. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1983–1992, 2018. + +Huizhong Zhou, Benjamin Ummenhofer, and Thomas Brox. Deeptam: Deep tracking and mapping. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 822–838, 2018. + +Tinghui Zhou, Matthew Brown, Noah Snavely, and David G Lowe. Unsupervised learning of depth and ego-motion from video. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1851–1858, 2017. + +# A APPENDIX + +# A.1 LS-OPTIMIZATION LAYER: + +In Equation 4 we defined the residual error to be: + +$$ +\mathbf { e } _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) = \mathbf { r } _ { k } - [ \pi ( ( e ^ { \xi _ { j } } \mathbf { G } _ { j } ) ( e ^ { \xi _ { i } } \mathbf { G } _ { i } ) ^ { - 1 } \mathbf { X } _ { k } ^ { i } ) - \pi ( \mathbf { G } _ { i j } \mathbf { X } _ { k } ^ { i } ) ] , \qquad \mathbf { X } _ { k } ^ { i } = \pi ^ { - 1 } ( \mathbf { x } _ { k } , z _ { k } ) +$$ + +and the objective function as the weighted sum of error terms: + +$$ +E ( \pmb { \xi } ) = \sum _ { ( i , j ) \in \mathcal { C } } \sum _ { k } \mathbf { e } _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) ^ { T } d i a g ( \mathbf { w } _ { k } ) \mathbf { e } _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) , \qquad d i a g ( \mathbf { w } _ { k } ) = \left( \begin{array} { l l } { w _ { k } ^ { u } } & { 0 } \\ { 0 } & { w _ { k } ^ { v } } \end{array} \right) +$$ + +We apply a Gauss-Newton update to Equation 9. The Gauss-Newton update is computed by solving for the minimum of the second order approximation of the objective function: + +$$ +\boldsymbol { \xi } ^ { * } = - ( \mathbf { J } ^ { T } \mathbf { W } \mathbf { J } ) ^ { - 1 } \mathbf { J } ^ { T } \mathbf { W } \mathbf { r } ( \xi _ { 1 } , . . . , \xi _ { N } ) , \qquad \mathbf { J } _ { p } = \frac { \partial r _ { p } ( \epsilon ) } { \partial \epsilon } | _ { \epsilon = 0 } +$$ + +where $\mathbf { r } ( \xi _ { 1 } , . . . , \xi _ { N } )$ is the stack of residuals and $\mathbf { J }$ is the Jacobian matrix. Each row $\mathbf { J } _ { i }$ is the Jacobian of the $\mathrm { i } ^ { t h }$ error term w.r.t to each of the parameters. Each $\xi$ is 6-dimensional, so optimizing over $N$ poses means we are updating $6 N$ variables. + +Let $r _ { p } = e _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } )$ be the $\mathrm { p } ^ { t h }$ residual, then + +$$ +\begin{array} { r l r } & { } & { \displaystyle { \frac { \partial e _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) } { \partial \xi _ { j } } } \vert _ { \xi _ { i } = 0 , \xi _ { j } = 0 } = \frac { \partial } { \partial \xi _ { j } } [ { \bf r } _ { k } - [ \pi ( ( e ^ { \xi _ { j } } { \bf G } _ { j } ) ( e ^ { \xi _ { i } } { \bf G } _ { i } ) ^ { - 1 } { \bf X } _ { k } ^ { i } ) - \pi ( { \bf G } _ { i j } { \bf X } _ { k } ^ { i } ) ] ] = } \\ & { } & { \displaystyle { \frac { \partial } { \partial \xi _ { j } } \pi ( ( e ^ { \xi _ { j } } { \bf G } _ { j } ) ( e ^ { \xi _ { i } } { \bf G } _ { i } ) ^ { - 1 } { \bf X } _ { k } ^ { i } ) } = \frac { \partial } { \partial \xi _ { j } } \pi ( e ^ { \xi _ { j } } ( { \bf G } _ { i j } { \bf X } _ { k } ^ { i } ) ) } \\ & { } & { \displaystyle { \frac { \partial e _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) } { \partial \xi _ { j } } \vert _ { \xi _ { i } = 0 , \xi _ { j } = 0 } = \frac { \partial } { \partial ( { \bf G } _ { i j } { \bf X } _ { k } ^ { i } ) } \pi ( { \bf G } _ { i j } { \bf X } _ { k } ^ { i } ) \cdot \frac { \partial } { \partial \xi _ { j } } e ^ { \xi _ { i } } ( { \bf G } _ { i j } { \bf X } _ { k } ^ { i } ) } } \end{array} +$$ + +Likewise, the Jacobian for $\xi _ { j }$ is + +$$ +\begin{array} { r l } & { \displaystyle \frac { \partial e _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) } { \partial \xi _ { j } } \vert _ { \xi _ { i } = 0 , \xi _ { j } = 0 } = \frac { \partial } { \partial \xi _ { i } } [ \mathbf { r } _ { k } - [ \pi ( ( e ^ { \xi _ { j } } \mathbf { G } _ { j } ) ( e ^ { \xi _ { i } } \mathbf { G } _ { i } ) ^ { - 1 } \mathbf { X } _ { k } ^ { i } ) - \pi ( \mathbf { G } _ { i j } \mathbf { X } _ { k } ^ { i } ) ] ] = } \\ & { \displaystyle \frac { \partial } { \partial \xi _ { i } } \pi ( ( e ^ { \xi _ { j } } \mathbf { G } _ { j } ) ( e ^ { \xi _ { i } } \mathbf { G } _ { i } ) ^ { - 1 } \mathbf { X } _ { k } ^ { i } ) = \frac { \partial } { \partial \xi _ { i } } \pi ( \mathbf { G } _ { j } \mathbf { G } _ { i } ^ { - 1 } e ^ { - \xi _ { i } } \mathbf { X } _ { k } ^ { i } ) = \frac { \partial } { \partial \xi _ { i } } \pi ( \mathbf { G } _ { i j } e ^ { - \xi _ { i } } \mathbf { X } _ { k } ^ { i } ) } \end{array} +$$ + +using the adjoint to move the increment to the left of the transformation + +$$ +\begin{array} { r } { \displaystyle = \frac { \partial } { \partial \xi _ { i } } \pi ( e ^ { w } \mathbf { G } _ { i j } \mathbf { X } _ { k } ^ { i } ) \qquad \mathrm { w h e r e ~ } w = - A d j _ { \mathbf { G } _ { i j } } \cdot \boldsymbol { \xi } } \\ { \displaystyle \frac { \partial e _ { k } ^ { i j } ( \xi _ { i } , \xi _ { j } ) } { \partial \xi _ { j } } \vert _ { \xi _ { i } = 0 , \xi _ { j } = 0 } = - \frac { \partial } { \partial \big ( \mathbf { G } _ { i j } \mathbf { X } _ { k } ^ { i } \big ) } \pi ( \mathbf { G } _ { i j } \mathbf { X } _ { k } ^ { i } ) \cdot \frac { \partial } { \partial w } e ^ { w } \big ( \mathbf { G } _ { i j } \mathbf { X } _ { k } ^ { i } \big ) \cdot A d j _ { \mathbf { G } _ { i j } } } \end{array} +$$ + +where the Jacobian of the action of a $\mathbf { S E } ( 3 )$ element on a 3D point is computed + +$$ +\frac { \partial e ^ { \xi } \mathbf { X } } { \partial \xi } | _ { \xi = 0 } = [ \begin{array} { c c c } { 1 } & { 0 } & { 0 } \\ { 0 } & { 1 } & { 0 } \\ { 0 } & { 0 } & { 1 } \end{array} ] \begin{array} { c c c } { 0 } & { - Z } & { Y } \\ { Z } & { 0 } & { X } \\ { - Y } & { X } & { 0 } \end{array} ] +$$ + +During training, we propagate through the Gauss-Newton update. The update is found by solving the linear system + +$$ +\mathbf { H } \xi = - \mathbf { b } , \qquad \mathbf { H } = \mathbf { J } ^ { T } \mathbf { W } \mathbf { J } , \ \mathbf { \ b } = \mathbf { J } ^ { T } \mathbf { W } \mathbf { r } ( \xi _ { 1 } , . . . , \xi _ { N } ) +$$ + +Since $\mathbf { H }$ is positive definite, we solve Equation 15 using Cholesky decomposition. In the backward pass, the gradients can be found by solving another linear system. + +$$ +\frac { \partial \mathcal { L } } { \partial \mathbf { H } } = - ( \mathbf { H } ^ { - 1 } \frac { \partial \mathcal { L } } { \partial \xi } ) ^ { T } \boldsymbol { \xi } , \qquad \frac { \partial \mathcal { L } } { \partial \mathbf { b } } = \mathbf { H } ^ { - 1 } \frac { \partial \mathcal { L } ^ { T } } { \partial \boldsymbol { \xi } } +$$ + +# B TRAINING DETAILS + +DeepV2D is implemented in Tensorflow (Abadi et al., 2016). All components of the network are trained from scratch without using any pretrained weights. We use gradient checkpointing (Chen et al., 2016) to reduce memory usage and increase batch size. + +When training on NYU and ScanNet, we train with 4 frame video clips. On KITTI, we use 5 frame video clips. The video clips are created by first selecting a keyframe. The other frames are randomly sampled from the set of frames within a specified time window of the keyframe. For example, on NYU, we create the training video by sampling from frames within 1 second of the keyframe. + +Training occurs in the following two stages: + +Stage I: We train the Motion Module using the $L _ { m o t i o n }$ loss with RMSProp (Tieleman & Hinton, 2012) and a learning rate of 0.0001. For the input depth, we use the ground truth depth with missing values interpolated. We train Stage I for 20k iterations on NYU, 16k iterations on KITTI, and 30k iterations on ScanNet. + +Stage II: In stage II, we jointly train the motion and depth modules end-to-end on the combined loss with RMSProp. The initial learning rate is set to .001 and decayed to .0002 after 100k training steps. During the second stage we store depth predictions to be used during the next training epoch. We train Stage II for a total of $1 2 0 \mathrm { k }$ iterations with a batch size of 2. In our ScanNet experiments, we train for an additional $6 0 \mathrm { k }$ iterations. + +Data Augmentation: We perform data augmentation by adjusting brightness, gamma, and performing random scaling of the image channels. We also randomly perturb the input camera pose to the Motion Module by sampling small perturbations. + +# C TIMING AND MEMORY USAGE + +In the below table we provide timing and peak memory usage for different versions of our method. All results are obtained using 8 frame video sequences as input with the exception of the basline single-image network FCRN Laina et al. (2016) which uses a single frame as input. + +Table 6: Timing and memory details for different versions of our approach. + +
Abs-Rel ↓ParametersPeakGPUMemoryIteration Time
FCRN (Laina et al., 2016)0.12164M0.1G0.05s
Ours (1/2 res)0.08332M0.7G0.22s
Ours (1-HG)0.07116M2.8G0.61s
Ours (corr)0.13525M1.8G0.32s
Ours0.06232M2.8G0.69s
+ +In ours(1-HG) we replace the feature extractor with a single 2D-hourglass network, and replace the stereo network with a single 3D-hourglass network. The shallower network still performs well, but causes Abs-Rel to increase from 0.065 to 0.071, showing that stacking hourglass networks is beneficial for performance. In ours (1/2 res) we test the performance of DeepV2D when images are downsampled to 1/2 resolution for training and inference. Using lower resolution images decreases memory usage and inference time but slightly decreases accuracy. + +We also test a version where we replace the 3d stereo network with a correlation layer and 2d encoder-decoder. In ours(corr), we take the correlation between features over the same depth range as we use to build the 3D cost volume, then concatenate the correlation response with features from the keyframe image, similar to DispNet (Mayer et al., 2016b). The correlation version performs worse, increasing Abs-Rel from 0.065 to 0.135. This is consistent with prior work which has demonstrated that 3D cost volumes give better performance than direct correlation (Kendall et al., 2017; Chang & Chen, 2018). + +# D ADDITIONAL TRACKING INFORMATION + +In Table 7 we report tracking results for all sequences in the Freiburg 1 dataset. + +Table 7: Per-Sequence tracking results on the RGB-D benchmark evaluated using translational RMSE $[ \mathrm { m } / \mathrm { s } ]$ . We outperform DeepTAM and DVO on 12 of the 16 sequences and achieve a lower translational RMSE averaged over all sequences. While DeepTAM requires optical flow supervision to achieve good performance, we do not require supervision on optical flow since the relation between camera motion and optical flow is embedded into our network architecture. + +
SequenceRGB-D SLAMDeepTAMOurs
3600.1190.0630.056
360(v)0.1250.0540.046
desk0.0300.0330.029
desk(v)0.0370.0270.034
desk20.0550.0460.041
desk2(v)0.0200.0170.017
floor0.0900.0810.064
plant0.0360.0270.019
plant(v)0.0620.0570.052
room0.0480.0400.047
room(v)0.0420.0390.032
rpy0.0430.0460.039
rpy(v)0.0820.0650.037
teddy0.0670.0590.043
Xyz0.0510.0190.025
xyz(v)0.0240.0170.016
Average0.0580.0430.037
+ +# E CAMERA POSE ABLATIONS + +The focus of this work on depth estimation, but we are interested in how different methods for estimating camera pose impact the final performance. In Table 8, we test different methods for estimating camera pose on NYU. In each experiment, we replace the motion module of our trained network with the given alternative, and test the final results. We also report results from MVSNet (trained on NYU) using each SfM implementation. + +COLMAP (Schonberger & Frahm, 2016a) and OpenMVG (Moulon et al.) are publicly available SfM implementations. They do not return results on all input sequences, so we only evaluate sequences were they converge without an error. PWCNet+Ceres takes the output of an optical flow network, PWCNet (Sun et al., 2018), and performs joint optimization of depth and pose using the Ceres solver (Agarwal et al., 2012). Finally, we evaluate MVSNet (Yao et al., 2018) when the pose predicted by DeepV2D is given as input. Note that not all SfM implementations converge on all sequences (success rate is reported in parenthesis) and we only evaluate the method on the frames in which it converges. + +
DepthMotionAbs-Rel ↓ 81↑S↑8↑
MVSNet DeepV2D MVSNetIdentity Identity COLMAP (274/654)0.419 0.382 0.362 0.460 0.244 0.7240.681 0.756 0.8570.859 0.901 0.925
DeepV2D MVSNetCOLMAP OpenMVG(422/654)0.199 0.741 0.181 0.7660.878 0.9130.940 0.965
DeepV2D MVSNetOpenMVG PWC+Ceres (654/654)0.173 0.774 0.279 0.6510.913 0.8450.963 0.925
DeepV2D MVSNetPWC+Ceres DeepV2D (654/654) DeepV2D (ours)0.274 0.664 0.101 0.8850.846 0.9700.925 0.990
+ +Table 8: Impact of pose estimation method on depth accuracy. Replacing our motion module with SfM degrades performance for both MVSNet and our approach. + +We also show results of our method when the motion module is replaced with other methods for estimation motion. In all cases, using SfM results in worse performance. We observe that classical SfM is not robust enough to consistently produce accurate poses, which leads to large errors on the test set. MVSNet performs better using the poses estimated by our network, but still underperforms our full system, showing the importance of differentiable alternation between pose and stereo. + +![](images/b44a3b49655e2f4fc325dbf4b130dd3281f78e41be8dac9faac857f625bda02a.jpg) +Figure 6: Visualizations of depth predictions on KITTI dataset. + +![](images/b98ffb644e035d6c18d74a2721529a8b9d49988982c81550b90de9ff7340b4c9.jpg) +Figure 7: Additional results on the NYU depth dataset Silberman et al. (2012) using 7-frame video clips. We show results compared with Laina et al. (2016) and Ummenhofer et al. (2017). + +# G NETWORK ARCHITECTURES + +![](images/f884603164e769ba0c5c6e24b87c81601c5702b8b6f6f4bc74f93937dfe2a34d.jpg) +Figure 8: Motion Module Architecture: The Encoder(left) extracts a dense 1/4 resolution feature map for each of the input images. The Residual Flow Network (right) takes in a pair of feature maps and estimates the residual flow and corresponding weights. This residual flow is estimated with an encoder-decoder network, with skip connections formed by concatenating feature maps. Numbers in parenthesis correspond to the number of output channels for each layer. + +![](images/ab2bb216c977d9d7c8d8565b68d9a4e5f34a434a39c383a2c427c398dc87cee8.jpg) +Figure 9: Depth Module Architecture: The 2D encoder (top) is applied to each image in the video sequence. The 2D Encoder consists of a series of residual convolutions and 2 Hourglass Networks. The hourglass networks process the incoming features maps as multiple scales. The hourglass network is defined recursively (i.e. HG(n) contains lower resolution hourglass HG(n-1)). We use 4 nested hourglass modules with feature dimension 64-128-192-256. The resulting feature maps from the 2D encoder are used to construct the cost volumes. The 3D matching network (bottom) takes a collection of cost volumes as input. After a 1x1x1 convolutional layer and a $3 \mathrm { x } 3 \mathrm { x } 3 $ residual convolution, we perform view pooling, which aggregates information over all the frames in the video. The aggregated volume is then processed by a series of 3D hourglass networks, each of which outputs an intermediate depth estimate. The widths of the 3D hourglass is 32-80-128-176. \ No newline at end of file diff --git a/md/train/HJxyZkBKDr/HJxyZkBKDr.md b/md/train/HJxyZkBKDr/HJxyZkBKDr.md new file mode 100644 index 0000000000000000000000000000000000000000..54a3834c81056f0bb3893b83abf9542745a5848d --- /dev/null +++ b/md/train/HJxyZkBKDr/HJxyZkBKDr.md @@ -0,0 +1,307 @@ +# NAS-BENCH-201: EXTENDING THE SCOPE OF REPRODUCIBLE NEURAL ARCHITECTURE SEARCH + +Xuanyi Dong†‡ ∗and Yi Yang† †ReLER, CAI, University of Technology Sydney, ‡Baidu Research + +# ABSTRACT + +Neural architecture search (NAS) has achieved breakthrough success in a great number of applications in the past few years. It could be time to take a step back and analyze the good and bad aspects in the field of NAS. A variety of algorithms search architectures under different search space. These searched architectures are trained using different setups, e.g., hyper-parameters, data augmentation, regularization. This raises a comparability problem when comparing the performance of various NAS algorithms. NAS-Bench-101 has shown success to alleviate this problem. In this work, we propose an extension to NAS-Bench-101: NAS-Bench201 with a different search space, results on multiple datasets, and more diagnostic information. NAS-Bench-201 has a fixed search space and provides a unified benchmark for almost any up-to-date NAS algorithms. The design of our search space is inspired from the one used in the most popular cell-based searching algorithms, where a cell is represented as a directed acyclic graph. Each edge here is associated with an operation selected from a predefined operation set. For it to be applicable for all NAS algorithms, the search space defined in NAS-Bench-201 includes all possible architectures generated by 4 nodes and 5 associated operation options, which results in 15,625 neural cell candidates in total. The training log using the same setup and the performance for each architecture candidate are provided for three datasets. This allows researchers to avoid unnecessary repetitive training for selected architecture and focus solely on the search algorithm itself. The training time saved for every architecture also largely improves the efficiency of most NAS algorithms and brings a more computational cost friendly NAS community for a broader range of researchers. We provide additional diagnostic information such as fine-grained loss and accuracy, which can give inspirations to new designs of NAS algorithms. In further support of the proposed NAS-Bench201, we have analyzed it from many aspects and benchmarked 10 recent NAS algorithms, which verify its applicability. + +# 1 INTRODUCTION + +The deep learning community is undergoing a transition from hand-designed neural architecture (He et al., 2016; Krizhevsky et al., 2012; Szegedy et al., 2015) to automatically designed neural architecture (Zoph & Le, 2017; Pham et al., 2018; Real et al., 2019; Dong & Yang, 2019b; Liu et al., 2019). In its early era, the great success of deep learning was promoted by novel neural architectures, such as ResNet (He et al., 2016), Inception (Szegedy et al., 2015), VGGNet (Simonyan & Zisserman, 2015), and Transformer (Vaswani et al., 2017). However, manually designing one architecture requires human experts to try numerous different operation and connection choices (Zoph & Le, 2017). In contrast to architectures that are manually designed, those automatically found by neural architecture search (NAS) algorithms require much less human interaction and expert effort. These NAS-generated architectures have shown promising results in many domains, such as image recognition (Zoph & Le, 2017; Pham et al., 2018; Real et al., 2019), sequence modeling (Pham et al., 2018; Dong & Yang, 2019b; Liu et al., 2019), etc. + +Recently, a variety of NAS algorithms have been increasingly proposed. While these NAS methods are methodically designed and show promising improvements, many setups in their algorithms are different. (1) Different search space is utilized, e.g., different macro skeletons of the whole architecture (Zoph et al., 2018; Tan et al., 2019) and a different operation set for the micro cell within the skeleton (Pham et al., 2018), etc. (2) After a good architecture is selected, various strategies can be employed to train this architecture and report the performance, e.g., different data augmentation (Ghiasi et al., 2018; Zhang et al., 2018), different regularization (Zoph et al., 2018), different scheduler (Loshchilov & Hutter, 2017), and different selections of hyper-parameters (Liu et al., 2018; Dong & Yang, 2019a). (3) The validation set for testing the performance of the selected architecture is not split in the same way (Liu et al., 2019; Pham et al., 2018). These discrepancies raise a comparability problem when comparing the performance of various NAS algorithms, making it difficult to conclude their contributions. + +![](images/ef948e0a6ab15e4c383b46de048586c46f5264daa6a5c300a880d48b7f656296.jpg) +Figure 1: Top: the macro skeleton of each architecture candidate. Bottom-left: examples of neural cell with 4 nodes. Each cell is a directed acyclic graph, where each edge is associated with an operation selected from a predefined operation set as shown in the Bottom-right. + +In response to this problem, NAS-Bench-101 (Ying et al., 2019) and NAS-HPO-Bench (Klein & Hutter, 2019) are proposed. However, some NAS algorithms can not be applied directly on NASBench-101, and NAS-HPO-Bench only has 144 candidate architectures, which maybe insufficient to evaluate NAS algorithms. To extend these two benchmarks and towards better reproducibility of NAS methods1, we propose NAS-Bench-201 with a fixed cell search space, inspired from the search space used in the most popular neural cell-based searching algorithms (Zoph et al., 2018; Liu et al., 2019). As shown in Figure 1, each architecture consists of a predefined skeleton with a stack of the searched cell. In this way, architecture search is transformed into the problem of searching a good cell. Each cell is represented as a densely-connected directed acyclic graph (DAG) as shown in the bottom section of Figure 1. Here the node represents the sum of the feature maps and each edge is associated with an operation transforming the feature maps from the source node to the target node. The size of the search space is related to the number of nodes defined for the DAG and the size of the operation set. In NAS-Bench-201, we choose 4 nodes and 5 representative operation candidates for the operation set, which generates a total search space of 15,625 cells/architectures. Each architecture is trained multiple times on three different datasets. The training log and performance of each architecture are provided for each run. The training accuracy/test accuracy/training loss/test loss after every training epoch for each architecture plus the number of parameters and floating point operations (FLOPs) are accessible. + +Hopefully, NAS-Bench-201 will show its value in the field of NAS research. (1) It provides a unified benchmark for most up-to-date NAS algorithms including all cell-based NAS methods. With NASBench-201, researchers can focus on designing robust searching algorithm while avoiding tedious hyper-parameter tuning of the searched architecture. Thus, NAS-Bench-201 provides a relatively fair benchmark for the comparison of different NAS algorithms. (2) It provides the full training log of each architecture. Unnecessary repetitive training procedure of each selected architecture can be avoided (Liu et al., 2018; Zoph & Le, 2017) so that researchers can target on the essence of NAS, i.e., search algorithm. Another benefit is that the validation time for NAS largely decreases when testing in NAS-Bench-201, which provides a computational power friendly environment for more participations in NAS. (3) It provides results of each architecture on multiple datasets. The model transferability can be thoroughly evaluated for most NAS algorithms. (4) In NAS-Bench-201, we provide systematic analysis of the proposed search space. We also evaluate 10 recent advanced NAS algorithms including reinforcement learning (RL)-based methods, evolutionary strategy (ES)-based methods, differentiable-based methods, etc. We hope our empirical analysis can bring some insights to the future designs of NAS algorithms. + +# 2 NAS-Bench-201 + +Our NAS-Bench-201 is algorithm-agnostic. Put simply, it is applicable to almost any up-to-date NAS algorithms. In this section, we will briefly introduce our NAS-Bench-201. The search space of NASBench-201 is inspired by cell-based NAS algorithms (Section 2.1). NAS-Bench-201 evaluates each architecture on three different datasets (Section 2.2). All implementation details of NAS-Bench-201 are introduced in Section 2.3. NAS-Bench-201 also provides some diagnostic information which can be used for potentially better designs of future NAS algorithms (discussed in Section 2.4). + +# 2.1 ARCHITECTURES IN THE SEARCH SPACE + +Macro Skeleton. Our search space follows the design of its counterpart as used in the recent neural cell-based NAS algorithms (Liu et al., 2019; Zoph et al., 2018; Pham et al., 2018). As shown in the top of Figure 1, the skeleton is initiated with one 3-by-3 convolution with 16 output channels and a batch normalization layer (Ioffe & Szegedy, 2015). The main body of the skeleton includes three stacks of cells, connected by a residual block. Each cell is stacked $N = 5$ times, with the number of output channels as 16, 32 and 64 for the first, second and third stages, respectively. The intermediate residual block is the basic residual block with a stride of 2 (He et al., 2016), which serves to downsample the spatial size and double the channels of an input feature map. The shortcut path in this residual block consists of a 2-by-2 average pooling layer with stride of 2 and a 1-by-1 convolution. The skeleton ends up with a global average pooling layer to flatten the feature map into a feature vector. Classification uses a fully connected layer with a softmax layer to transform the feature vector into the final prediction. + +Searched Cell. Each cell in the search space is represented as a densely connected DAG. The densely connected DAG is obtained by assigning a direction from the $i$ -th node to the $j$ -th node $( i < j )$ for each edge in an undirected complete graph. Each edge in this DAG is associated with an operation transforming the feature map from the source node to the target node. All possible operations are selected from a predefined operation set, as shown in Figure 1(bottom-right). In our NAS-Bench-201, the predefined operation set $\mathcal { O }$ has $L = 5$ representative operations: (1) zeroize, (2) skip connection, (3) 1-by-1 convolution, (4) 3-by-3 convolution, and (5) 3-by-3 average pooling layer. The convolution in this operation set is an abbreviation of an operation sequence of ReLU, convolution, and batch normalization. The DAG has $V = 4$ nodes, where each node represents the sum of all feature maps transformed through the associated operations of the edges pointing to this node. We choose $V = 4$ to allow the search space to contain basic residual block-like cells, which requires 4 nodes. Densely connected DAG does not restrict the searched topology of the cell to be densely connected, since we include zeroize in the operation set, which is an operation of dropping the associated edge. Besides, since we do not impose the constraint on the maximum number of edges (Ying et al., 2019), our search space is applicable to most NAS algorithms, including all cell-based NAS algorithms. + +# 2.2 DATASETS + +We train and evaluate each architecture on CIFAR-10, CIFAR-100 (Krizhevsky et al., 2009), and ImageNet-16-120 (Chrabaszcz et al., 2017). We choose these three datasets because CIFAR and ImageNet (Russakovsky et al., 2015) are the most popular image classification datasets. + +We split each dataset into training, validation and test sets to provide a consistent training and evaluation settings for previous NAS algorithms (Liu et al., 2019). Most NAS methods use the validation set to evaluate architectures after the architecture is optimized on the training set. The validation performance of the architectures serves as supervision signals to update the searching algorithm. The test set is to evaluate the performance of each searching algorithm by comparing the indicators (e.g., accuracy, model size, speed) of their selected architectures. Previous methods use different splitting strategies, which may result in various searching costs and unfair comparisons. We hope to use the proposed splits to unify the training, validation and test sets for a fairer comparison. + +CIFAR-10: It is a standard image classification dataset and consists of 60K $3 2 \times 3 2$ colour images in 10 classes. The original training set contains 50K images, with 5K images per class. The original test set contains 10K images, with 1K images per class. Due to the need of validation set, we split all 50K training images in CIFAR-10 into two groups. Each group contains 25K images with 10 classes. We regard the first group as the new training set and the second group as the validation set. + +CIFAR-100: This dataset is just like CIFAR-10. It has the same images as CIFAR-10 but categorizes each image into 100 fine-grained classes. The original training set on CIFAR-100 has 50K images, and the original test set has 10K images. We randomly split the original test set into two group of equal size — 5K images per group. One group is regarded as the validation set, and another one is regarded as the new test set. + +ImageNet-16-120: We build ImageNet-16-120 from the down-sampled variant of ImageNet (ImageNet $1 6 \times 1 6$ ). As indicated in Chrabaszcz et al. (2017), down-sampling images in ImageNet can largely reduce the computation costs for optimal hyper-parameters of some classical models while maintaining similar searching results. Chrabaszcz et al. (2017) down-sampled the original ImageNet to $1 6 \times 1 6$ pixels to form ImageNet $. 6 \times 1 6$ , from which we select all images with label $\in [ 1 , 1 2 0 ]$ to construct ImageNet-16-120. In sum, ImageNet-16-120 contains 151.7K training images, 3K validation images, and 3K test images with 120 classes. + +By default, in this paper, “the training set”, “the validation set”, “the test set” indicate the new training, validation, and test sets, respectively. + +# 2.3 ARCHITECTURE PERFORMANCE + +Training Architectures. In order to unify the performance of every architecture, we give the performance of every architecture in our search space. In our NAS-Bench-201, we follow previous literature to set up the hyper-parameters and training strategies (Zoph et al., 2018; Loshchilov & Hutter, 2017; He et al., 2016). We train each architecture with the same strategy, which is shown in Table 1. For simplification, we denote all hyperparameters for training a model as a set $\mathcal { H }$ , and we use $\mathcal { H } ^ { \dagger }$ to denote the values of hyper-parameter that we use. Specifically, we train each architecture via Nesterov momentum SGD, using the cross-entropy loss for 200 epochs in total. We set the weight decay as 0.0005 and decay the learning rate from 0.1 to 0 with a cosine annealing (Loshchilov & Hutter, 2017). We use the same $\mathcal { H } ^ { \dagger }$ on different datasets, except for the data augmentation which is slightly different due to the image resolution. On CIFAR, we use the random flip with probability of 0.5, the random crop $3 2 \times 3 2$ patch with 4 pixels padding on each border, and the normalization over RGB channels. On ImageNet-16-120, we use a similar strategy but random crop $1 6 \times 1 6$ patch with 2 pixels padding on each border. Apart from using $\mathcal { H } ^ { \dagger }$ for all datasets, we also use a different hyper-parameter set $\bar { \mathcal { H } } ^ { \dagger }$ for CIFAR-10. It is similar to $\mathcal { H } ^ { \dagger }$ but its total number of training epochs is 12. In this way, we could provide bandit-based algorithms (Falkner et al., 2018; Li et al., 2018) more options for the usage of short training budget (see more details in appendix). + +Table 1: The training hyper-parameter set $\mathcal { H } ^ { \dagger }$ . + +
optimizerNesterovmomentumweight decaybatch sizeVrandom flipnormalizationSGDinitialLRending LRLR scheduleepochinitial channelNrandom crop0.10cosine200165
√0.90.00052564p=0.5<
+ +Metrics. We train each architecture with different random seeds on different datasets. We evaluate each architecture $A$ after every training epoch. NAS-Bench-201 provides the training, validation, + +and test loss as well as accuracy. We show the supported metrics on different datasets in Table 2. Users can easily use our API to query the results of each trial of $A$ , which has negligible computational costs. In this way, researchers could significantly speed up their searching algorithm on these datasets and focus solely on the essence of NAS. + +We list the training/test loss/accuracies over + +Table 2: NAS-Bench-201 provides the following metrics with $\mathcal { H } ^ { \dagger }$ . ‘Acc.’ means accuracy. + +
DatasetTrainLoss/Acc.Eval Loss/Acc.
CIFAR-10train setvalid set
CIFAR-10train+valid settest set
CIFAR-100train setvalid set
CIFAR-100train settest set
ImageNet-16-120train setvalid set
ImageNet-16-120train settest set
+ +different split sets on four datasets in Table 2. On CIFAR-10, we train the model on the training set and evaluate it on the validation set. We also train the model on the training and validation set and evaluate it on the test set. These two paradigm follow the typical experimental setup on CIFAR-10 in previous literature (Liu et al., 2018; Zoph et al., 2018; Liu et al., 2018; Pham et al., 2018). On CIFAR-100 and ImageNet-16-120, we train the model on the training set and evaluate it on both validation and test sets. + +Table 3: We summarize some characteristics of NAS-Bench-101 and NAS-Bench-201. Our NASBench-201 can directly be applicable to almost any up-to-date NAS algorithms. In contrast, as pointed in (Ying et al., 2019), NAS algorithms based on parameter sharing or network morphisms cannot be directly evaluated on NAS-Bench-101. Besides, NAS-Bench-201 provides train/validation/test performance on three (one for NAS-Bench-101) different datasets so that the generality of NAS algorithms can be evaluated. It also provides some diagnostic information that may provide insights to design better NAS algorithms. + +
#archit -ectures#data -sets10search space constraintSupported NAS algorithmsDiagnostic information
RLES|Diff.]HPO
NAS-Bench-101510M13constrain #edges1partialpartialnonemost
NAS-Bench-20115.6K35no constraintallallallmostfine-grained info., param., etc
+ +# 2.4 DIAGNOSTIC INFORMATION + +Validation accuracy is a commonly used supervision signal for NAS. However, considering the expensive computational costs for evaluating the architecture, the signal is too sparse. In our NASBench-201, we also provide some diagnostic information which is some extra statistics obtained during training each architecture. Collecting these statistics almost involves no extra computation cost but may provide insights for better designs and training strategies of different NAS algorithms, such as platform-aware NAS (Tan et al., 2019), accuracy prediction (Baker et al., 2018), mutationbased NAS (Cai et al., 2018; Chen et al., 2016), etc. + +Architecture Computational Costs: NAS-Bench-201 provides three computation metrics for each architecture — the number of parameters, FLOPs, and latency. Algorithms that target on searching architectures with computational constraints, such as models on edge devices, can use these metrics directly in their algorithm designs without extra calculations. + +Fine-grained training and evaluation information. NAS-Bench-201 tracks the changes in loss and accuracy of every architecture after every training epochs. These fine-grained training and evaluation information shows the tendency of the architecture performance and could indicate some attributes of the model, such as the speed of convergence, the stability, the over-fitting or under-fitting levels, etc. These attributes may benefit the designs of NAS algorithms. Besides, some methods learn to predict the final accuracy of an architecture based on the results of few early training epochs (Baker et al., 2018). These algorithm can be trained faster and the performance of the accuracy prediction can be evaluated using the fine-grained evaluation information. + +Parameters of optimized architecture. Our NAS-Bench-201 releases the trained parameters for each architecture. This can provide ground truth label for hypernetwork-based NAS methods (Zhang et al., 2019; Brock et al., 2018), which learn to generate parameters of an architecture. Other methods mutate an architecture to become another one (Real et al., 2019; Cai et al., 2018). With NAS-Bench-201, researchers could directly use the off-the-shelf parameters instead of training from scratch and analyze how to transfer parameters from one architecture to another. + +# 3 DIFFERENCE WITH EXISTING NAS BENCHMARKS + +To the best of our knowledge, NAS-Bench-101 (Ying et al., 2019) is the only existing large-scale architecture dataset. Similar to NAS-Bench-201, NAS-Bench-101 also transforms the problem of architecture search into the problem of searching neural cells, represented as a DAG. Differently, NAS-Bench-101 defines operation candidates on the node, whereas we associate operations on the edge as inspired from (Liu et al., 2019; Dong & Yang, 2019b; Zoph et al., 2018). We summarize characteristics of our NAS-Bench-201 and NAS-Bench-101 in Table 3. The main highlights of our NAS-Bench-201 are as follows. (1) NAS-Bench-201 is algorithm-agnostic while NAS-Bench + +![](images/88962deb55fbfd45703cae2a047041476b98a3f9ea5092d466ba1eb7ef13ff89.jpg) +Figure 2: Training, validation, test accuracy of each architecture on CIFAR-10, CIFAR-100, and ImageNet-16-120. We also visualize the results of ResNet in the orange star marker. + +101 without any modification is only applicable to selected algorithms (Yu et al., 2020; Zela et al., 2020). The original complete search space, based on the nodes in NAS-Bench-101, is extremely huge. So, it is exceedingly difficult to efficiently traverse the training of all architectures. To trade off the computational cost and the size of the search space, they constrain the maximum number of edges in the DAG. However, it is difficult to incorporate this constraint in all NAS algorithms, such as NAS algorithms based on parameter-sharing (Liu et al., 2019; Pham et al., 2018). Therefore, many NAS algorithms cannot be directly evaluated on NAS-Bench-101. Our NAS-Bench-201 solves this problem by sacrificing the number of nodes and including all possible edges so that our search space is algorithm-agnostic. (2) We provide extra diagnostic information, such as architecture computational cost, fine-grained training and evaluation time, etc., which give inspirations to better and efficient designs of NAS algorithms utilizing these diagnostic information. + +NAS-HPO-Bench (Klein & Hutter, 2019) evaluated 62208 configurations in the joint NAS and hyper-parameter space for a simple 2-layer feed-forward network. Since NAS-HPO-Bench has only 144 architectures, it could be insufficient to evaluate different NAS algorithms. + +# 4 ANALYSIS OF NAS-Bench-201 + +An overview of architecture performance. The performance of each architecture is shown in Figure 2. We show the test accuracy of every architecture in our search space in the left column of Figure 2. The training, validation and test accuracy with respect to the number of parameters are shown in the rest three columns, respectively. Results show that a different number of parameters will affect the performance of the architectures, which indicates that the choices of operations are essential in NAS. We also observe that the performance of the architecture can vary even when the number of parameters stays the same. This observation indicates the importance of how the operations/cells are connected. We compare the architectures with a classical human-designed architecture (ResNet) in all cases, which is indicated by an orange star mark. ResNet shows competitive performance in three datasets, however, it still has room to improve, i.e., about $2 \%$ compared to the best architecture in CIFAR-100 and ImageNet-16-120, about $1 \%$ compared to the best one with the same amount of parameters in CIFAR-100 and ImageNet-16-120. + +![](images/775c3b04e237a87001c8ea71bbec6cd669f6173ca15dea4ff91446a5f23adf33.jpg) +Figure 3: The ranking of each architecture on three datasets, sorted by the ranking in CIFAR-10. + +Architecture ranking on three datasets. The ranking of every architecture in our search space is shown in Figure 3, where the architecture ranked in CIFAR-10 $\mathbf { \dot { X } } \mathbf { \cdot }$ -axis) is ranked as in y-axis in CIFAR-100 and ImageNet-16-120, indicated by green and red markers respectively. The performance of the architectures shows a generally consistent ranking over the three datasets with slightly different variance, which serves to test the generality of the searching algorithm. + +Correlations of validation and test accuracies. We visualize the correlation between the validation and test accuracy within one dataset and across datasets in Figure 4. The correlation within one dataset is high compared to cross-dataset correlation. The correlation dramatically decreases as we + +only pick the top performing architectures. When we directly transfer the best architecture in one dataset to another (a vanilla strategy), it can not $100 \%$ secure a good performance. This phenomena is a call for better transferable NAS algorithms instead of vanilla strategy. + +Dynamic ranking of architectures. We show the ranking of the performance of all architectures in different time stamps in Figure 5. The ranking based on the validation set (y axis) gradually converges to the ranking ba + +![](images/298e44fc9560f470cc253b2deef1100f0997c742c59b4514ae7c3b31300e0144.jpg) +Figure 4: We report the correlation coefficient between the accuracy on 6 sets, i.e., CIFAR-10 validation set (C10- V), CIFAR-10 test set (C10-T), CIFAR-100 validation set (C100-V), CIFAR-100 test set (C100-T), ImageNet-16-120 validation set (I120-V), ImageNet-16-120 test set (I120-T). ed on the final test accuracy (x axis). + +![](images/8b8b883e15a206f2b0604391871a50b6fe31f6240057ee9a0d08f4e4b5052c5f.jpg) +Figure 5: The ranking of all architectures based on the validation accuracy at different time stamps (y axis) sorted by the final test accuracy (x axis). + +# 5 BENCHMARK + +In this section, we evaluate 10 recent searching methods on our NAS-Bench-201, which can serve as baselines for future NAS algorithms in our dataset. Specifically, we evaluate some typical NAS algorithms: (I) Random Search algorithms, e.g., random search (RS) (Bergstra & Bengio, 2012), random search with parameter sharing (RSPS) (Li & Talwalkar, 2019). (II) ES methods, e.g., REA (Real et al., 2019). (III) RL algorithms, e.g., REINFORCE (Williams, 1992), ENAS (Pham et al., 2018). (IV) Differentiable algorithms. e.g., first order DARTS (DARTS-V1) (Liu et al., 2019), second order DARTS (DARTS-V2), GDAS (Dong & Yang, 2019b), and SETN (Dong & Yang, 2019a). (V) HPO methods, e.g., BOHB (Falkner et al., 2018). We experimented all NAS algorithms on a single GeForce GTX 1080 Ti GPU. + +Table 4: The utility of our NAS-Bench-201 for different NAS algorithms. We show whether a NAS algorithm can use our NAS-Bench-201 to accelerate the searching and evaluation procedure. + +
accelerateRSRSPSDARTS-V1DARTS-V2GDASSETNREAREINFORCEENASBOHB
searchevaluationVXXXXXV1√V√√
+ +
MethodSearch (seconds)CIFAR-10CIFAR-100ImageNet-16-120
validationtestvalidationtestvalidationtest
RSPS8007.1380.42±3.5884.07±3.6152.12±5.5552.31±5.7727.22±3.2426.28±3.09
DARTS-V111625.7739.77±0.0054.30±0.0015.03±0.0015.61±0.0016.43±0.0016.32±0.00
DARTS-V235781.8039.77±0.0054.30±0.0015.03±0.0015.61±0.0016.43±0.0016.32±0.00
GDAS31609.8089.89±0.0893.61±0.0971.34±0.0470.70±0.3041.59±1.3341.71±0.98
SETN34139.5384.04±0.2887.64±0.0058.86±0.0659.05±0.2433.06±0.0232.52±0.21
ENAS14058.8037.51±3.1953.89±0.5813.37±2.3513.96±2.3315.06±1.9514.84±2.10
RSPSt7587.1284.16±1.6987.66±1.6959.00±4.6058.33±4.3431.56±3.2831.14±3.88
DARTS-V1†10889.8739.77±0.0054.30±0.0015.03±0.0015.61±0.0016.43±0.0016.32±0.00
DARTS-V2t29901.6739.77±0.0054.30±0.0015.03±0.0015.61±0.0016.43±0.0016.32±0.00
GDASt28925.9190.00±0.2193.51±0.1371.14±0.2770.61±0.2641.70±1.2641.84±0.90
SETNt31009.8182.25±5.1786.19±4.6356.86±7.5956.87±7.7732.54±3.6331.90±4.07
ENASt13314.5139.77±0.0054.30±0.0015.03±0.0015.61±0.0016.43±0.0016.32±0.00
REA RS0.0291.19±0.3193.92±0.3071.81±1.1271.84±0.9945.15±0.8945.54±1.03
0.0190.93±0.3693.70±0.3670.93±1.0971.04±1.0744.45±1.1044.57±1.25
REINFORCE0.1291.09±0.3793.85±0.3771.61±1.1271.71±1.0945.05±1.0245.24±1.18
BOHB3.5990.82±0.5393.61±0.5270.74±1.2970.85±1.2844.26±1.3644.42±1.49
ResNetN/A90.8393.9770.4270.8644.5343.63
optimal91.6194.3773.4973.5146.7747.31
+ +Table 5: We evaluate $I O$ different searching algorithms in our NAS-Bench-201. The first block shows results of parameter sharing based NAS methods. The second block is similar to the first one, however, BN layers in the searching cells do not keep running estimates but always use batch statistics. The third block shows results of NAS methods without parameter sharing. Each algorithm uses the training and validation set of CIFAR-10 for searching. We show results of their searched architectures for (1) training on the CIFAR-10 train set and evaluating on its validation set; (2) training on the CIFAR-10 train+validation sets and evaluating on its test set; (3) training on the CIFAR-10 or ImageNet-16-120 train set and evaluating on their validation or test sets. “optimal” indicates the highest mean accuracy for each set. We report the mean and std of 500 runs for RS, REA, REINFORCE, and BOHB and of 3 runs for RSPS, DARTS, GDAS, SETN, and ENAS. + +![](images/46bf8e1d5028fd58ba84d178b04a3d22a07d1e669ace1579b1a8879b51c298f7.jpg) +Figure 6: We show results of 500 runs for RS, REA, REINFORCE, and BOHB on CIFAR-10. The architecture is searched on CIFAR-10 and we report its validation accuracy (solid line) and test accuracy (dashed line) on three datasets. Each individual run is sorted by the validation accuracy of the searched architecture. + +We show the benefits for speed using our NAS-Bench-201 for different NAS algorithms in Table 4. For each NAS algorithm, once the searching procedure finished and the final architecture is found, our NAS-Bench-201 can directly return the performance of this architecture. With NAS-Bench-201, NAS algorithms without parameter sharing can significantly reduce the searching time into seconds. Notably, it still requires several GPU hours for NAS algorithms with parameter sharing to complete the searching. + +All algorithms use the training and validation set of CIFAR-10 to search architectures. In Table 5, Figure 6, Figure 7, and Figure 8, we report the performance of the searched architectures plus the optimal architecture on three datasets. We make the following observations: (1) NAS methods without parameter sharing (REA, RS, REINFORCE, and BOHB) outperform others. This be because training a model for a few epochs with the converged LR scheduler $( { \mathcal { H } } ^ { \ddagger } )$ can provide a good relative ranking of each architecture. (2) DARTS-V1 and DARTS-V2 quickly converge to find the architecture whose edges are all skip connection. A possible reason is that the original hyper-parameters of DARTS are chosen for their search space instead of ours. (3) The strategy of BN layers can significantly effect the NAS methods with parameter sharing. Using batch statistics are better than keep running estimates of the mean and variance. (4) Using our fine-grained information, REA, REINFORCE and RS can be finished in seconds which could significantly reduce the search costs and let researchers focus solely on the search algorithm itself. + +![](images/bfcdbc0617ecf87fe75943c147160d323c1666b859f183fc6073b370e8bc4d90.jpg) +Figure 7: Results keeping keep running estimates for BN layers in each searching cell. We use parameter sharing based NAS methods to search the architecture on CIFAR-10. After each searching epoch, we derive the architecture and show its validation accuracy (VALID) and test accuracy (TEST) on CIFAR-10. The 0-th epoch indicates the architecture is derived from the randomly initialized architecture encoding. + +![](images/5085f515858c5ad523ff941b52ac8d6a01ebfa36bc15acd511fdae755f620adc.jpg) +Figure 8: Results using batch statistics without keeping keep running estimates for BN layers in each searching cell. We use parameter sharing based NAS methods to search the architecture on CIFAR-10. After each searching epoch, we derive the architecture and show its validation accuracy (VALID) and test accuracy (TEST) on CIFAR-10. The 0-th epoch indicates the architecture is derived from the randomly initialized architecture encoding. + +In Figure 7 and Figure 8, we show the performance of the architecture derived from each algorithm per searching epoch. DARTS-V1 will gradually over-fit to an architecture with all skip-connection operations. DARTS-V2 can alleviate this problem to some extent but will still over-fit after more epochs. It can further alleviate this problem by using batch statistics for BN layers. We train RSPS, GDAS, SETN, and ENAS five times longer than DARTS (250 epochs vs. 50 epochs). This is because at every iteration, RSPS, GDAS, SETN, and ENAS only optimize 1|O|=5 parameters of the shared parameters, whereas DARTS optimize all shared parameters. The searched architecture performs similar for GDAS after 50 searching epochs. RSPS and SETN show a higher variance of the searched architecture compared to GDAS. + +Clarification. We have tried our best to implement each method. However, still, some algorithms might obtain non-optimal results since their hyper-parameters might not fit our NAS-Bench-201. We empirically found that some NAS algorithms are sensitive to some hyper-parameters, whereas we try to compare them in a fair way as we can (Please see more explanation in Appendix). If researchers can provide better results with different hyper-parameters, we are happy to update results according to the new experimental results. We also welcome more NAS algorithms to test on our dataset and would include them accordingly. + +# 6 DISCUSSION + +How to avoid over-fitting on NAS-Bench-201? Our NAS-Bench-201 provides a benchmark for NAS algorithms, aiming to provide a fair and computational cost-friendly environment to the NAS community. The trained architecture and the easy-to-access performance of each architecture might provide some insidious ways for designing algorithms to over-fit the best architecture in our NASBench-201. Thus, we propose some rules which we wish the users will follow to achieve the original intention of NAS-Bench-201, a fair and efficient benchmark. + +1. No regularization for a specific operation. Since the best architecture is known in our benchmark, specific designs to fit the structural attributes of the best performed architecture are insidious ways to fit our NAS-Bench-201. For example, as mentioned in Section 5, we found that the best architecture with the same amount of parameters for CIFAR10 on NAS-Bench-201 is ResNet. Restrictions on the number of residual connections is a way to over-fit the CIFAR10 benchmark. While this can give a good result on this benchmark, the searching algorithm might not generalize to other benchmarks. + +2. Use the provided performance. The training strategy affects the performance of the architecture. We suggest the users stick to the performance provided in our benchmark even if it is feasible to use other $\mathcal { H }$ to get a better performance. This provides a fair comparison with other algorithms. + +3. Report results of multiple searching runs. Since our benchmark can help to largely decrease the computational cost for a number of algorithms. Multiple searching runs give stable results of the searching algorithm with acceptable time cost. + +Limitation regarding to hyper-parameter optimization (HPO). The performance of an architecture depends on the hyper-parameters $\mathcal { H }$ for its training and the optimal configuration of $\mathcal { H }$ may vary for different architectures. In NAS-Bench-201, we use the same configuration for all architectures, which may bring biases to the performance of some architectures. One related solution is HPO, which aims to search the optimal hyper-parameter configuration. However, searching the optimal hyper-parameter configurations and the architecture in one shot is too computationally expensive and still is an open problem. + +Potential designs using diagnostic information in NAS-Bench-201. As pointed in Section 2.4, different kinds of diagnostic information are provided. We hope that more insights about NAS could be found by analyzing these diagnostic information and further motivate potential solutions for NAS. For example, parameter sharing (Pham et al., 2018) is the crucial technique to improve the searching efficiency, but the shared parameter would sacrifice the accuracy of each architecture. Could we find a better way to share parameters of each architecture from the learned 15,625 models’ parameters? + +Generalization ability of the search space. It is important to test the generalization of observations on this dataset. An idea strategy is to do all benchmark experiments on a much larger search space. Unfortunately, it is prohibitive regarding the expensive computational cost. We bring some results from (Ying et al., 2019) and (Zela et al., 2020) to provide some preliminary evidence of generalization. In Figure 2, we show the rankings of RS, REA, and REINFORCE is ( REA $>$ REINFORCE $> \mathrm { R } S$ ). This is consistent with results in NAS-Bench-101, which contains more architecture candidates. For NAS methods with parameter sharing, we find that $\mathrm { G D A S } \geq \mathrm { D A R T S } \geq \mathrm { E N A S }$ , which is also consistent with results in NAS-Bench-1SHOT1. Therefore, observations from our NAS-Bench201 may generalize to other search spaces. + +# 7 CONCLUSION & FUTURE WORK + +In this paper, we introduce NAS-Bench-201 that extends the scope of reproducible NAS. In NASBench-201, almost any NAS algorithms can be directly evaluated. We train and evaluate 15,625 architecture on three different datasets, and we provide results regarding different metrics. We comprehensively analyze our dataset and test some recent NAS algorithms on NAS-Bench-201 to serve as baselines for future works. In future, we will (1) consider HPO and NAS together and (2) much larger search space. We welcome researchers to try their NAS algorithms on our NAS-Bench201 and would update the paper to include their results. + +Acknowledgements. We thank the ICLR area chair, ICLR reviewers, and authors of NAS-Bench101 for the constructive suggestions during the rebuttal and revision period. + +# REFERENCES + +Bowen Baker, Otkrist Gupta, Ramesh Raskar, and Nikhil Naik. Accelerating neural architecture search using performance prediction. In International Conference on Learning Representations Workshop (ICLR-W), 2018. + +James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. The Journal of Machine Learning Research (JMLR), 13(Feb):281–305, 2012. + +Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. SMASH: one-shot model architecture search through hypernetworks. In International Conference on Learning Representations (ICLR), 2018. + +Han Cai, Tianyao Chen, Weinan Zhang, Yong Yu, and Jun Wang. Efficient architecture search by network transformation. In AAAI Conference on Artificial Intelligence (AAAI), pp. 2787–2794, 2018. + +Tianqi Chen, Ian Goodfellow, and Jonathon Shlens. Net2net: Accelerating learning via knowledge transfer. In International Conference on Learning Representations (ICLR), 2016. + +Patryk Chrabaszcz, Ilya Loshchilov, and Frank Hutter. A downsampled variant of imagenet as an alternative to the cifar datasets. arXiv preprint arXiv:1707.08819, 2017. + +Xuanyi Dong and Yi Yang. One-shot neural architecture search via self-evaluated template network. In Proc. of the IEEE International Conference on Computer Vision (ICCV), pp. 3681–3690, 2019a. + +Xuanyi Dong and Yi Yang. Searching for a robust neural architecture in four gpu hours. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1761–1770, 2019b. + +Stefan Falkner, Aaron Klein, and Frank Hutter. BOHB: Robust and efficient hyperparameter optimization at scale. In The International Conference on Machine Learning (ICML), pp. 1436–1445, 2018. + +Golnaz Ghiasi, Tsung-Yi Lin, and Quoc V Le. Dropblock: A regularization method for convolutional networks. In The Conference on Neural Information Processing Systems (NeurIPS), pp. 10727–10737, 2018. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. + +Aaron Klein and Frank Hutter. Tabular benchmarks for joint architecture and hyperparameter optimization. arXiv preprint arXiv:1905.04970, 2019. + +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. ImageNet classification with deep convolutional neural networks. In The Conference on Neural Information Processing Systems (NeurIPS), pp. 1097–1105, 2012. + +Liam Li and Ameet Talwalkar. Random search and reproducibility for neural architecture search. In The Conference on Uncertainty in Artificial Intelligence (UAI), 2019. + +Lisha Li, Kevin Jamieson, Giulia DeSalvo, Afshin Rostamizadeh, and Ameet Talwalkar. Hyperband: A novel bandit-based approach to hyperparameter optimization. The Journal of Machine Learning Research (JMLR), 18(1):6765–6816, 2018. + +Chenxi Liu, Barret Zoph, Maxim Neumann, Jonathon Shlens, Wei Hua, Li-Jia Li, Li Fei-Fei, Alan Yuille, Jonathan Huang, and Kevin Murphy. Progressive neural architecture search. In Proc. of the European Conference on Computer Vision (ECCV), pp. 19–34, 2018. + +Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: Differentiable architecture search. In International Conference on Learning Representations (ICLR), 2019. + +Ilya Loshchilov and Frank Hutter. SGDR: Stochastic gradient descent with warm restarts. In International Conference on Learning Representations (ICLR), 2017. + +Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In The Conference on Neural Information Processing Systems Workshop (NeurIPS-W), 2017. + +Hieu Pham, Melody Guan, Barret Zoph, Quoc Le, and Jeff Dean. Efficient neural architecture search via parameters sharing. In The International Conference on Machine Learning (ICML), pp. 4095–4104, 2018. + +Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. In AAAI Conference on Artificial Intelligence (AAAI), pp. 4780– 4789, 2019. + +Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. ImageNet large scale visual recognition challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations (ICLR), 2015. + +Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1–9, 2015. + +Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, and Quoc V Le. Mnasnet: Platform-aware neural architecture search for mobile. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2820–2828, 2019. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In The Conference on Neural Information Processing Systems (NeurIPS), pp. 5998–6008, 2017. + +Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3-4):229–256, 1992. + +Chris Ying, Aaron Klein, Esteban Real, Eric Christiansen, Kevin Murphy, and Frank Hutter. Nasbench-101: Towards reproducible neural architecture search. In The International Conference on Machine Learning (ICML), pp. 7105–7114, 2019. + +Kaicheng Yu, Christian Sciuto, Martin Jaggi, Claudiu Musat, and Mathieu Salzmann. Evaluating the search phase of neural architecture search. In International Conference on Learning Representations (ICLR), 2020. + +Arber Zela, Julien Siems, and Frank Hutter. Nas-bench-1shot1: Benchmarking and dissecting one shot neural architecture search. In International Conference on Learning Representations (ICLR), 2020. + +Chris Zhang, Mengye Ren, and Raquel Urtasun. Graph hypernetworks for neural architecture search. In International Conference on Learning Representations (ICLR), 2019. + +Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations (ICLR), 2018. + +Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. In International Conference on Learning Representations (ICLR), 2017. + +Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8697–8710, 2018. + +
EPOCHSTOTALCIFAR-10CIFAR-100ImageNet-16-120
validationtestvalidationtestvalidationtest
612 (H)0.77670.76270.80860.80950.80520.7941
1212 (H+)0.91100.89830.93610.93680.90620.8952
12200 (H+)0.75200.73960.80710.80800.81670.8092
24200 (H+)0.77050.75940.82800.82900.82860.8217
100200 (H+)0.79380.79000.85290.85400.82620.8211
150200 (H+)0.89550.89260.92390.92460.85060.8425
175200 (H+)0.98340.97820.97430.97440.85390.8423
200200 (Ht+)0.99930.99370.96720.96710.82590.8124
+ +Table 6: We compare the correlation of different training strategies. The correlation coefficient between the validation accuracy after several training epochs on CIFAR-10 and (1) the validation accuracy of full trained models on the CIFAR-10 training set, (2) the test accuracy on CIFAR-10 trained with the training and validation sets, (3) the validation/test accuracy on CIFAR-100 trained with the CIFAR-100 training set, (4) the validation/test accuracy on ImageNet-16-120 trained with the ImageNet-16-120 training set. We use the validation accuracy after “EPOCHS“ training epochs, where the the cosine annealing converged after “TOTAL” epochs. + +# A MORE DETAILS OF NAS-Bench-201 + +Number of unique architectures. In our NAS-Bench-201, we encode each architecture by a 6- dimensional vector. The $i$ -th value in this vector indicates the operation in the $i \cdot$ -th edge in a cell. Since we have 5 possible operations, there are $5 ^ { 6 } = 1 5 6 2 5$ total unique models in this encoding. If we identify the isomorphic cell caused by the “skip-connect” operation, there are 12751 unique topology structures. If we identify the isomorphic cell caused by both “skip-connect” and “zeroize” operations, there are only 6466 unique topology structures. Note that, due to the numerical error, when given the same inputs, two architectures with the isomorphic cell might have different outputs. + +Note that, when we build our NAS-Bench-201, we train and evaluate every architecture without considering isomorphism. + +NAS-Bench-201 with bandit-based algorithms. Bandit-based algorithms, such as Hyperband (Li et al., 2018) and BOHB (Falkner et al., 2018), usually train models with a short time budget. In our NAS-Bench-201, on CIFAR-10, we provide two options if you want to obtain the performance of a model trained with a short time budget: (1) Results from $\mathcal { H } ^ { \ddag }$ , where the cosine annealing converged at the 12-th epoch. (2) Results from $\mathcal { H } ^ { \dagger }$ , where the cosine annealing converged at the 200-th epoch. As shown in Table 6, the performance of these converged networks is much more likely to correlate highly with the performance after a larger number of iterations than just taking an earlier point of a single cosine annealing trajectory. Therefore, we choose the first option for all NAS algorithms that do not use parameter sharing. + +# B IMPLEMENTATION DETAILS + +Based on the publicly available codes, we re-implement 10 NAS algorithms by ourselves to search architectures on our NAS-Bench-201. We provide the implementation details of each searching algorithm below. + +We consider the searching time of the first order DARTS as a baseline (about 12000 seconds on CIFAR-10). When evaluating RS, REINFORCE, ENAS, and BOHB, we set the total time budget as 12000 seconds for them. By default, for NAS algorithms with parameter sharing, we follow most hyper-parameters from DARTS and do not learn the scale and shift parameters for BN layers in each searching cell. We setup the searching procedure of RSPS, GDAS, SETN, ENAS five times longer than DARTS, because they optimize $\textcircled { \frac { 1 } { 5 } }$ of parameters but DARTS optimize all parameters per iteration. Most configurations can be found at https://github.com/D-X-Y/ AutoDL-Projects/tree/master/configs/nas-benchmark/algos. + +Random search (RS) (Bergstra & Bengio, 2012). We randomly select architectures until the total training time plus the time of one evaluation procedure reaches the total budget. We use the validation accuracy after 12 training epochs $( { \mathcal { H } } ^ { \ddagger } )$ , which can be obtained directly in our NAS-Bench-201 as discussed in Section 2.4. The architecture with the highest validation accuracy is selected as the final searched architecture. + +Regularized evolution for image classifier architecture search (REA) (Real et al., 2019). We set the initial population size as 10, the number of cycles as infinity. The sample size is chosen as 10 from [3, 5, 10], according to Figure 9. We finish the algorithm once the simulated training time of the traversed architecture reaches the time budgets (12000 seconds). We use the validation accuracy after 12 training epochs $( { \mathcal { H } } ^ { \ddagger } )$ as the fitness. + +![](images/3285b7ca5c40bc09586d55b9900b6fc30ebf214d06a87a399aed6e5bc83d38d6.jpg) +Figure 9: The effect of different sample sizes for REA on the CIFAR-10 validation set. + +REINFORCE (Williams, 1992). We follow (Ying et al., 2019) to use the REINFORCE algorithm as a baseline RL method. We use an architecture encoding to parameterize each candidate in our search space as (Liu et al., 2019; Dong & Yang, 2019b). We use the validation accuracy after 12 training epochs $\mathcal { H } ^ { \ddag }$ as the reward in REINFORCE. The architecture encoding is optimized via Adam. We evaluate the learning rate from [0.01, 0.02, 0.05, 0.1, 0.2, 0.5] following (Ying et al., 2019). According to Figure 10, the learning date is set as . The momentum for exponential moving average of 0.9. We finish the training once the simulated training time reaches the time budgets (12000 seconds). + +The first order and second order DARTS (DARTS-V1 and DARTS-V2) (Liu et al., 2019). We train the shared parameters via Nesterov momentum SGD, using the cross-entropy loss for 50 epochs in total. We set weight decay as 0.0005 and momentum of 0.9. We decay the learning rate from 0.025 to 0.001 via cosine learning rate scheduler and clip the gradient by 5. We train the architecture encoding via Adam with the learning rate of 0.0003 and the weight decay of 0.001. We use the batch size of 64. The random horizontal flipping, random cropping with padding, and normalization are used for data augmentation. We choose these hyper-parameters following (Liu et al., 2019). + +![](images/59d4bc392632ea80c7311e57578785579486be405277417101ea456bcbb9031d.jpg) +Figure 10: We evaluate the effect of different learning rates for REINFORCE, and report the CIFAR-10 validation accuracy of the searched architecture. + +Random search with parameter sharing (RSPS) (Li & Talwalkar, 2019). We train RSPS with the similar hyper-parameters as that of DARTS. Differently, we train the algorithm in 250 epochs in total. During each searching iteration, we randomly sample one architecture in each batch training. Each architecture uses the training mode for BN during training and the evaluation mode during evaluation (Paszke et al., 2017). After training the shared parameters, we evaluate 100 randomly selected architectures with the shared parameters. For each architecture, we randomly choose one mini-batch with 256 validation samples to estimate the validation accuracy instead of using the whole validation set to calculate the precise validation accuracy. The one with the highest estimated validation accuracy will be selected. With the size of this mini-batch increasing, the more precise validation accuracy would be obtained and the better architecture would be selected. However, the searching costs will also be increased. We use the size of 256 to trade-off the accuracy and cost. + +Gradient-based search using differentiable architecture sampler (GDAS) (Dong & Yang, 2019b). We use the most hyper-parameters as that of DARTS but train it for 250 epochs in total. The Gumbel-Softmax temperature is linearly decayed from 10 to 0.1. + +Self-Evaluated Template Network (SETN) (Dong & Yang, 2019a). We use the most hyperparameters as that of DARTS but train it for 250 epochs in total. After training the shared parameters, we select 100 architectures with the highest probabilities (encoded by the learned architecture encoding). We evaluate these 100 selected architectures with the shared parameters. The evaluation procedure for these 100 architectures are the same as RSPS. + +Table 7: The correlation between the probability or the one-shot validation accuracy (OSVA) and the ground truth accuracy on the CIFAR-10 validation set. “BN with Train” indicates that, during evaluation, the mean and variance of BN layers are calculated within each mini-batch. “BN with Eval” indicates that we accumulate mean and variance of BN layers in the training set and use these accumulated mean and variance for evaluation. We report the correlation as the average of 3 runs. + +
MethodsCIFAR-1OValidation Set
ProbabilityOSVA (BN with Train)OSVA (BN with Eval)
DARTS-V10.07790.0039-0.0071
DARTS-V20.08620.03550.0109
SETN0.06820.90490.0862
GDAS0.27140.81410.2466
+ +ENAS (Pham et al., 2018). We use a two layer LSTM as the controller with the hidden size of 32. We use the temperature of 5 and the tanh constant of 2.5 for the sampling logits Following (Pham et al., 2018), we also add the the controller’s sample entropy to the reward, weighted by 0.0001. We optimize the controller with Adam using the constant learning rate of 0.001. We optimize the network weights with SGD following the learning rate scheduler as the original paper and the batch size of 128. We did not impose any penalty to a specific operation. + +BOHB (Falkner et al., 2018). We choose to use BOHB as an HPO algorithm on our NAS-Bench201. We follow (Ying et al., 2019) to set up the hyper-parameters for BOHB. We set the number of samples for the acquisition function to 4, the random fraction to $0 \%$ , the minimum-bandwidth to 0.3, the bandwidth factor to 3. We finish the algorithm once the simulated training time reaches the time budgets (12000 seconds). + +# C DISCUSSION FOR NAS WITH PARAMETER SHARING + +Parameter sharing (Pham et al., 2018) becomes a common technique to improve the efficiency of differentiable neural architecture search methods (Liu et al., 2019; Dong & Yang, 2019b;a). The shared parameters are shared over millions of architecture candidates. It is almost impossible for the shared parameters to be optimal for all candidates. We hope to evaluate the trained shared parameters quantitatively. Specially, we use DARTS, GDAS, and SETN to optimize the shared parameters and the architecture encoding on CIFAR-10. For each architecture candidate, we can calculate its probability of being a good architecture from the architecture encoding following SETN (Dong & Yang, 2019a). In addition, we can also evaluate a candidate using the shared parameters on the validation set to obtain “the one-shot validation accuracy”. It is computationally expensive to evaluate all candidates on the whole validation set. To accelerate this procedure, we evaluate each architecture on a mini-batch with the size of 2048, and use the accuracy on this mini-batch to approximate “the one-shot validation accuracy”. Ideally, the architecture ranking sorted by the probability or the one-shot validation accuracy should be similar to the ground truth ranking. We show the correlation between the proxy metric and the ground truth validation accuracy in Table 7. There are several observations: (1) The correlation between the probability (encoded by the architecture encoding) and the ground truth accuracy is low. It suggests that the argmax-based deriving strategy (Liu et al., 2019) can not secure a good architecture. It remains open on how to derive a good architecture after optimizing the shared parameters. (2) The behavior of BN layers is important to one-shot validation accuracy. The accumulated mean and variance from the training set are harmful to one-shot accuracy. Instead, each architecture candidate should re-calculate the mean and variance of the BN layers. (3) GDAS introduced Gumbel-softmax sampling when optimizing the architecture encoding. This strategy leads to a high correlation for the learned probability than that of DARTS. (4) The uniform sampling strategy for training the shared parameters (Dong & Yang, 2019a) can increase the correlation for one-shot accuracy compared to the strategy of the joint optimizing strategy (Dong & Yang, 2019b; Liu et al., 2019). + +# D DETAILED INFORMATION OF NAS-Bench-201 + +In NAS-Bench-201 (version 1.0), every architecture is trained at least once. To be specific, 6219 architectures are trained once, 1621 architectures are trained twice, 7785 architectures are trained three times with different random seeds. Moreover, we are actively training all architectures with more seeds and will continue updating our NAS-Bench-201. + +The latency in our NAS-Bench-201 (version 1.0) is computed by running each model on a single GPU (GeForce GTX 1080 Ti) with a batch size of 256. We report the latency on CIFAR-100 and ImageNet-16-120, and the latency on CIFAR-10 should be similar to CIFAR-10. + +The usage of API. We provide convenient APIs to access our NAS-Bench-201, which can be easily installed via “pip install nas-bench-201”. Some examples are shown as follows: + +from nas_201_api import NASBench201API as API +2 api $=$ API(’NAS-Bench-201-v1_0-e61699.pth’) for i, arch_str in enumerate(api): # show every architecturre print (’{:5d}/{:5d} : {:}’.format(i, len(api), arch_str)) 5 info $=$ api.query_meta_info_by_index(1) # get metrics of the 1-th arch res_dict $=$ info.get_metrics(’cifar10’, ’train’) # a dict saving loss/acc print (’The accuracy is {:.2f}’.format(res_dict[’accuracy’])) +8 print (’The loss is {:.2f}’.format(res_dict[’loss’])) 9 cos_dict $=$ info.get_comput_costs(’cifar100’) # a dict saving costs +10 print (’The flops is {:.2f} M’.format(cos_dict[’flops’])) +11 print (’The #parameters is {:.2f} MB’.format(cos_dict[’params’])) +12 print (’The latency is {:.3f} s’.format(cos_dict[’latency’])) +13 # query the index of a specific architecture from API +14 arch_index $=$ api.query_index_by_arch(’|nor_conv_3x3\~0|+|nor_conv_3x3\~0| avg_pool_3x3\~1|+|skip_connect\~0|nor_conv_3x3\~1|skip_connect\~2|’) +15 # get results of each trial for a specific architecture +16 results $=$ api.query_by_index(arch_index, ’cifar100’) +17 print (’There are {:} trials for this architecture [{:}] on cifar100’. format(len(results), api[arch_index])) + +Please see https://github.com/D-X-Y/NAS-Bench-201 for more kinds of usages. The benchmark data file for API can be downloaded online from https://drive.google.com/ file/d/1SKW0Cu0u8-gb18zDpaAGi0f74UdXeGKs/view. \ No newline at end of file diff --git a/md/train/HWX5j6Bv_ih/HWX5j6Bv_ih.md b/md/train/HWX5j6Bv_ih/HWX5j6Bv_ih.md new file mode 100644 index 0000000000000000000000000000000000000000..af4744bfaedc60780a11eb022dff03848288c024 --- /dev/null +++ b/md/train/HWX5j6Bv_ih/HWX5j6Bv_ih.md @@ -0,0 +1,394 @@ +# CROSS-NODE FEDERATED GRAPH NEURAL NETWORK FOR SPATIO-TEMPORAL DATA MODELING + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Vast amount of data generated from networks of sensors, wearables, and the Internet of Things (IoT) devices underscores the need for advanced modeling techniques that leverage the spatio-temporal structure of decentralized data due to the need for edge computation and licensing (data access) issues. While federated learning (FL) has emerged as a framework for model training without requiring direct data sharing and exchange, effectively modeling the complex spatiotemporal dependencies to improve forecasting capabilities still remains an open problem. On the other hand, state-of-the-art spatio-temporal forecasting models assume unfettered access to the data, neglecting constraints on data sharing. To bridge this gap, we propose a federated spatio-temporal model – Cross-Node Federated Graph Neural Network (CNFGNN) – which explicitly encodes the underlying graph structure using graph neural network (GNN)-based architecture under the constraint of cross-node federated learning, which requires that data in a network of nodes is generated locally on each node and remains decentralized. CNFGNN operates by disentangling the temporal dynamics modeling on devices and spatial dynamics on the server, utilizing alternating optimization to reduce the communication cost, facilitating computations on the edge devices. Experiments on the traffic flow forecasting task show that CNFGNN achieves the best forecasting performance in both transductive and inductive learning settings with no extra computation cost on edge devices, while incurring modest communication cost. + +# 1 INTRODUCTION + +Modeling the dynamics of spatio-temporal data generated from networks of edge devices or nodes (e.g. sensors, wearable devices and the Internet of Things (IoT) devices) is critical for various applications including traffic flow prediction (Li et al., 2018; Yu et al., 2018), forecasting (Seo et al., 2019; Azencot et al., 2020), and user activity detection (Yan et al., 2018; Liu et al., 2020). While existing works on spatio-temporal dynamics modeling (Battaglia et al., 2016; Kipf et al., 2018; Battaglia et al., 2018) assume that the model is trained with centralized data gathered from all devices, the volume of data generated at these edge devices precludes the use of such centralized data processing, and calls for decentralized processing where computations on the edge can lead to significant gains in improving the latency. In addition, in case of spatio-temporal forecasting, the edge devices need to leverage the complex inter-dependencies to improve the prediction performance. Moreover, with increasing concerns about data privacy and its access restrictions due to existing licensing agreements, it is critical for spatio-temporal modeling to utilize decentralized data, yet leveraging the underlying relationships for improved performance. + +Although recent works in federated learning (FL) (Kairouz et al., 2019) provides a solution for training a model with decentralized data on multiple devices, these works either do not consider the inherent spatio-temporal dependencies (McMahan et al., 2017; Li et al., 2020b; Karimireddy et al., 2020) or only model it implicitly by imposing the graph structure in the regularization on model weights (Smith et al., 2017), the latter of which suffers from the limitation of regularization based methods due to the assumption that graphs only encode similarity of nodes (Kipf & Welling, 2017), and cannot operate in settings where only a fraction of devices are observed during training (inductive learning setting). As a result, there is a need for an architecture for spatio-temporal data modeling which enables reliable computation on the edge, while maintaining the data decentralized. + +To this end, leveraging recent works on federated learning (Kairouz et al., 2019), we introduce the cross-node federated learning requirement to ensure that data generated locally at a node remains decentralized. Specifically, our architecture – Cross-Node Federated Graph Neural Network (CNFGNN), aims to effectively model the complex spatio-temporal dependencies under the cross-node federated learning constraint. For this, CNFGNN decomposes the modeling of temporal and spatial dependencies using an encoder-decoder model on each device to extract the temporal features with local data, and a Graph Neural Network (GNN) based model on the server to capture spatial dependencies among devices. + +As compared to existing federated learning techniques that rely on regularization to incorporate spatial relationships, CNFGNN leverages an explicit graph structure using a graph neural networkbased (GNNs) architecture, which leads to performance gains. However, the federated learning (data sharing) constraint means that the GNN cannot be trained in a centralized manner, since each node can only access the data stored on itself. To address this, CNFGNN employs Split Learning (Singh et al., 2019) to train the spatial and temporal modules. Further, to alleviate the associated high communication cost incurred by Split Learning, we propose an alternating optimization-based training procedure of these modules, which incurs only half the communication overhead as compared to a comparable Split Learning architecture. Here, we also use Federated Averaging (FedAvg) (McMahan et al., 2017) to train a shared temporal feature extractor for all nodes, which leads to improved empirical performance. + +Our main contributions are as follows : + +1. We propose Cross-Node Federated Graph Neural Network (CNFGNN), a GNN-based federated learning architecture that captures complex spatio-temporal relationships among multiple nodes while ensuring that the data generated locally remains decentralized at no extra computation cost at the edge devices. +2. Our modeling and training procedure enables GNN-based architectures to be used in federated learning settings. We achieve this by disentangling the modeling of local temporal dynamics on edge devices and spatial dynamics on the central server, and leverage an alternating optimization-based procedure for updating the spatial and temporal modules using Split Learning and Federated Averaging to enable effective GNN-based federated learning. +3. We demonstrate that CNFGNN achieves the best prediction performance (both in transductive and inductive settings) at no extra computation cost on edge devices with modest communication cost, as compared to the related techniques on a traffic flow prediction task. + +# 2 RELATED WORK + +Our method derives elements from graph neural networks, federated learning and privacy-preserving graph learning, we now discuss related works in these areas in relation to our work. + +Graph Neural Networks (GNNs). GNNs have shown their superior performance on various learning tasks with graph-structured data, including graph embedding (Hamilton et al., 2017), node classification (Kipf & Welling, 2017), spatio-temporal data modeling (Yan et al., 2018; Li et al., 2018; Yu et al., 2018) and multi-agent trajectory prediction (Battaglia et al., 2016; Kipf et al., 2018; Li et al., 2020a). Recent GNN models (Hamilton et al., 2017; Ying et al., 2018; You et al., 2019; Huang et al., 2018) also have sampling strategies and are able to scale on large graphs. While GNNs enjoy the benefit from strong inductive bias (Battaglia et al., 2018; Xu et al., 2019), most works require centralized data during the training and the inference processes. + +Federated Learning (FL). Federated learning is a machine learning setting where multiple clients train a model in collaboration with decentralized training data (Kairouz et al., 2019). It requires that the raw data of each client is stored locally without any exchange or transfer. However, the decentralized training data comes at the cost of less utilization due to the heterogeneous distributions of data on clients and the lack of information exchange among clients. Various optimization algorithms have been developed for federated learning on non-IID and unbalanced data (McMahan et al., 2017; Li et al., 2020b; Karimireddy et al., 2020). Smith et al. (2017) propose a multi-task learning framework that captures relationships amongst data. While the above works mitigate the caveat of missing neighbors’ information to some extent, they are not as effective as GNN models and still suffer from the absence of feature exchange and aggregation. + +Alternating Optimization. Alternating optimization is a popular choice in non-convex optimization (Agarwal et al., 2014; Arora et al., 2014; 2015; Jain & Kar, 2017). In the context of Federated Learning, Liang et al. (2020) uses alternating optimization for learning a simple global model and reduces the number of communicated parameters, and He et al. (2020) uses alternating optimization for knowledge distillation from server models to edge models. In our work, we utilize alternating optimization to effectively train on-device modules and the server module jointly, which captures temporal and spatial relationships respectively. + +Privacy-Preserving Graph Learning. Suzumura et al. (2019) and Mei et al. (2019) use statistics of graph structures instead of node information exchange and aggregation to avoid the leakage of node information. Recent works have also incorporated graph learning models with privacypreserving techniques such as Differential Privacy (DP), Secure Multi-Party Computation (MPC) and Homomorphic Encryption (HE). Zhou et al. (2020) utilize MPC and HE when learning a GNN model for node classification with vertically split data to preserve silo-level privacy instead of nodelevel privacy. Sajadmanesh & Gatica-Perez (2020) preprocesses the input raw data with DP before feeding it into a GNN model. Composing privacy-preserving techniques for graph learning can help build federated learning systems following the privacy-in-depth principle, wherein the privacy properties degrade as gracefully as possible if one technique fails (Kairouz et al., 2019). + +# 3 CROSS-NODE FEDERATED GRAPH NEURAL NETWORK + +# 3.1 PROBLEM FORMULATION + +Given a dataset with a graph $\mathcal { G } = ( \nu , \mathcal { E } )$ , a feature tensor $\pmb { \mathsf { X } } \in \mathbb { R } ^ { | \mathcal { V } | \times \hdots }$ and a label tensor ${ \pmb { \mathsf { Y } } } \in { }$ $\mathbb { R } ^ { | \nu | \times \dots }$ , we consider learning a model under the cross-node federated learning constraint: node feature $\pmb { x } _ { i } = \pmb { \mathrm { X } } _ { i , \dots }$ , node label $\begin{array} { r } { \mathbf { { y } } _ { i } = \mathbf { { Y } } _ { i , \dots } } \end{array}$ , and model output $\hat { y } _ { i }$ are only visible to the node $i$ . + +One typical task that requires the cross-node federated learning constraint is the prediction of spatiotemporal data generated by a network of sensors. In such a scenario, $\nu$ is the set of sensors and $\mathcal { E }$ describes relations among sensors (e.g. $e _ { i j } \in \mathcal { E }$ if and only if the distance between $v _ { i }$ and $v _ { j }$ is below some threshold). The feature tensor $\pmb { x } _ { i } \in \mathbb { R } ^ { m \times D }$ represents the $i$ -th sensor’s records in the $D$ -dim space during the past $m$ time steps, and the label $\dot { \boldsymbol { y } } _ { i } \in \mathbb { R } ^ { n \times D }$ represents the $i$ -th sensor’s records in the future $n$ time steps. Since records collected on different sensors owned by different users/organizations may not be allowed to be shared due to the need for edge computation or licensing issues on data access, it is necessary to design an algorithm modeling the spatio-temporal relation without any direct exchange of node-level data. + +# 3.2 PROPOSED METHOD + +We now introduce our proposed Cross-Node Federated Graph Neural Network (CNFGNN) model. Here, we begin by disentangling the modeling of node-level temporal dynamics and server-level spatial dynamics as follows: (i) (Figure 1c) on each node, an encoder-decoder model extracts temporal features from data on the node and makes predictions; (ii) (Figure 1b) on the central server, a Graph Network (GN) (Battaglia et al., 2018) propagates extracted node temporal features and outputs node embeddings, which incorporate the relationship information amongst nodes. (i) has access to the not shareable node data and is executed on each node locally. (ii) only involves the upload and download of smashed features and gradients instead of the raw data on nodes. This decomposition enables the exchange and aggregation of node information under the cross-node federated learning constraint. + +# 3.2.1 MODELING OF NODE-LEVEL TEMPORAL DYNAMICS + +We modify the Gated Recurrent Unit (GRU) based encoder-decoder architecture in (Cho et al., 2014) for the modeling of node-level temporal dynamics on each node. Given an input sequence $\pmb { x } _ { i } \in \mathbb { R } ^ { m \times D }$ on the $i$ -th node, an encoder sequentially reads the whole sequence and outputs the + +![](images/3e1ee05691630c734f899149db2febff1d255fd4582f0392794764cdcc1a7efa.jpg) + +(a) Overview of the training procedure. + +![](images/3c494966c931cf3054784bdb0199663996cfa83e3d4629a910fe32c657d23c87.jpg) + +(b) Server-side Graph Network (GN). + +![](images/e452c68aab769bc52637ce4deba79a253af6ae7d1c8558c060fc7ee48848f040.jpg) +(c) Encoder-decoder on the $_ { i }$ -th node. +Figure 1: Cross-Node Federated Graph Neural Network. (a) In each round of training, we alternately train models on nodes and the model on the server. More specifically, we sequentially execute: (1) Federated learning of on-node models. (2) Temporal encoding update. (3) Split Learning of GN. (4) On-node graph embedding update. (b) Detailed view of the server-side GN model for modeling spatial dependencies in data. (c) Detailed view of the encoder-decoder model on the $i$ -th node. + +hidden state $h _ { c , i }$ as the summary of the input sequence according to Equation 1. + +$$ +\begin{array} { r } { \pmb { h } _ { c , i } = E n c o d e r _ { i } ( \pmb { x } _ { i } , \pmb { h } _ { c , i } ^ { ( 0 ) } ) , } \end{array} +$$ + +where ${ h } _ { c , i } ^ { ( 0 ) }$ is a zero-valued initial hidden state vector. + +To incorporate the spatial dynamics into the prediction model of each node, we concatenate $h _ { c , i }$ with the node embedding $h _ { G , c , i }$ generated from the procedure described in 3.2.2, which contains spatial information, as the initial state vector of the decoder. The decoder generates the prediction $\hat { y } _ { i }$ in an auto-regressive way starting from the last frame of the input sequence $x _ { i , m }$ with the concatenated hidden state vector. + +$$ +\hat { \pmb { y } } _ { i } = D e c o d e r _ { i } ( x _ { i , m } , [ \pmb { h } _ { c , i } ; \pmb { h } _ { G , c , i } ] ) . +$$ + +We choose the mean squared error (MSE) between the prediction and the ground truth values as the loss function, which is evaluated on each node locally. + +# 3.2.2 MODELING OF SPATIAL DYNAMICS + +To capture the complex spatial dynamics, we adopt Graph Networks (GNs) proposed in (Battaglia et al., 2018) to generate node embeddings containing the relational information of all nodes. The central server collects the hidden state from all nodes $\{ h _ { c , i } \mid i \in \mathcal { V } \}$ as the input to the GN. Each layer of GN updates the input features as follows: + +$$ +\begin{array} { r l r } & { { \mathbf e } _ { k } ^ { \prime } = \phi ^ { e } \left( { \mathbf e } _ { k } , { \mathbf v } _ { r _ { k } } , { \mathbf v } _ { s _ { k } } , { \mathbf u } \right) } & { \overline { { { \mathbf e } } } _ { i } ^ { \prime } = \rho ^ { e \to v } \left( E _ { i } ^ { \prime } \right) } \\ & { { \mathbf v } _ { i } ^ { \prime } = \phi ^ { v } \left( \overline { { { \mathbf e } } } _ { i } ^ { \prime } , { \mathbf v } _ { i } , { \mathbf u } \right) } & { \overline { { { \mathbf e } } } ^ { \prime } = \rho ^ { e \to u } \left( E ^ { \prime } \right) } \\ & { { \mathbf u } ^ { \prime } = \phi ^ { u } \left( \overline { { { \mathbf e } } } ^ { \prime } , \overline { { { \mathbf v } } } ^ { \prime } , { \mathbf u } \right) } & { \overline { { { \mathbf v } } } ^ { \prime } = \rho ^ { v \to u } \left( V ^ { \prime } \right) } \end{array} , +$$ + +# Algorithm 1 Training algorithm of CNFGNN on the server side. + +# Server executes: + +1: Initialize server-side GN weights θ GN , client model weigh ts θ¯(0)c {θ¯(0),encc , $\{ \bar { \bar { \theta } } _ { c } ^ { ( 0 ) , e n c } , \bar { \theta } _ { c } ^ { ( 0 ) , d e c } \} _ { . }$ . +2: for each node $i \in \mathcal V$ in parallel do +3: Initialize client model θ(0)c,i ${ \pmb \theta } _ { c , i } ^ { ( 0 ) } = \bar { \pmb \theta } _ { c } ^ { ( 0 ) }$ = θ¯(0)c . +4: raph encoding. on node $h _ { G , c , i } = h _ { G , c , i } ^ { ( 0 ) }$ end for +6: for global round $r _ { g } = 1 , 2 , \ldots , R _ { g }$ do +7: // (1) Federated learning of on-node models. +8: for each client $i \in \nu$ in parallel do +9: $\theta _ { c , i } \gets$ ClientUpdate $( i )$ . +11: 10: end for $\begin{array} { r } { \bar { \pmb { \theta } } _ { c } \sum _ { i \in \mathcal { V } } \frac { N _ { i } } { N } \pmb { \theta } _ { c , i } } \end{array}$ . +12: for each client $i \in \nu$ in parallel do +13: Initialize client model: $\theta _ { c , i } ^ { ( 0 ) } = \bar { \theta } _ { c }$ +14: end for +15: // (2) Temporal encoding update. +16: for each client $i \in \nu$ in parallel do +17: $h _ { c , i } \gets$ ClientEncode $( i )$ . +18: end for +19: // (3) Split Learning of GN. +20: Initialize $\pmb { \theta } _ { G N } ^ { ( r _ { g } , 0 ) } = \pmb { \theta } _ { G N } ^ { ( r _ { g } - 1 ) }$ +21: for server round $r _ { s } = 1 , 2 , \ldots , R _ { s }$ do +22: $\{ h _ { G , c , i } | i ~ \in ~ \mathcal { V } \} ~ ~ G N ( \{ h _ { c , i } | i ~ \in ~$ +23 $\mathcal { V } \rbrace ; \pmb { \theta } _ { G N } ^ { ( r _ { g } , r _ { s } - 1 ) } )$ . in prale o $i \in \nu$ +24: $\nabla _ { h _ { G , c , i } } \ell _ { i } \gets$ ClientBackward( $_ { i , h _ { G , c , i } ) }$ .backward( +25: $\nabla _ { \pmb { \theta } ^ { ( r _ { g } , r _ { s } - 1 ) } } \ell _ { i } \gets \pmb { h } _ { G , c , i }$ $\overset { \scriptscriptstyle \mathrm { G } } { \nabla } _ { h _ { G , c , i } } \ell _ { i } )$ . +26: end for +27: $\begin{array} { r l } & { \nabla _ { \pmb { \theta } _ { G N } ^ { ( r _ { g } , r _ { s } - 1 ) } } \ell \sum _ { i \in \mathcal { V } } \nabla _ { \pmb { \theta } _ { G N } ^ { ( r _ { g } , r _ { s } - 1 ) } } \ell _ { i } . } \\ & { \pmb { \theta } _ { G N } ^ { ( r _ { g } , r _ { s } ) } \pmb { \theta } _ { G N } ^ { ( r _ { g } , r _ { s } - 1 ) } } \\ & { \qquad - \eta _ { s } \nabla _ { \pmb { \theta } _ { G N } ^ { ( r _ { g } , r _ { s } - 1 ) } } \ell . } \end{array}$ +28: +29: end for +30: ${ \pmb \theta } _ { G N } ^ { ( r _ { g } ) } { \pmb \theta } _ { G N } ^ { ( r _ { g } , R _ { s } ) }$ +31: // (4) On-node graph embedding update. +32: $\begin{array} { r l } & { \{ h _ { G , c , i } | i \in \mathcal { V } \} } \\ & { \quad G N ( \{ h _ { c , i } | i \in \mathcal { V } \} ; \theta _ { G N } ^ { ( r _ { g } ) } ) . } \end{array}$ +33: for each client $i \in \mathcal V$ in parallel do +34: Set graph encoding on client as hG,c,i. +35: end for +36: end for + +# Algorithm 2 Training algorithm of CNFGNN on the client side. + +# ClientUpdate(i): + +1: for client round $r _ { c } = 1 , 2 , \ldots , R _ { c } \ : _ { }$ do +2: $\pmb { h } _ { c , i } ^ { ( r _ { c } ) } \gets E n c o d e r _ { i } ( \pmb { x } _ { i } ; \pmb { \theta } _ { c , i } ^ { ( r _ { c } - 1 ) , e n c } )$ +3: $\hat { \pmb { y } } _ { i } D e c o d e r _ { i }$ ( +$x _ { i , m } , [ { h _ { c , i } ^ { ( r _ { c } ) } } ; { h _ { G , c , i } } ] ; \theta _ { c , i } ^ { ( r _ { c } - 1 ) , d e c } ) .$ +4: 5: θ(rc)c,i ← θ(rc−1)c,i − ηc∇θ(rc−1)c,i \`i. $\ell _ { i } \gets \ell ( \hat { \pmb y } _ { i } , \pmb y )$ . + +6: end for + +7: θc,i = θ(Rc). +8: return $\theta _ { c , i }$ to server. +ClientEncode $\mathbf { \rho } ( i )$ : +1: return $\begin{array} { r c l } { { { h } } _ { { c } , i } } & { = } & { { E n c o d e r } _ { i } ( { \bf { x } } _ { i } ; { \bf { \bf { \theta } } } _ { c , i } ^ { e n c } ) } \end{array}$ to server. +ClientBackward $( i , h _ { G , c , i } )$ : +1: $\hat { \pmb { y } } _ { i } D e c o d e r _ { i } ( x _ { i , m } , [ h _ { c , i } ; h _ { G , c , i } ] ; \pmb { \theta } _ { c , i } ^ { d e c } )$ . 2: $\ell _ { i } \gets \ell ( \hat { \pmb y } _ { i } , \pmb y )$ . +3: return $\nabla _ { \boldsymbol { h } _ { G , c , i } } \ell _ { i }$ to server. + +where $\mathbf { e } _ { k } , \mathbf { v } _ { i } , \mathbf { u }$ are edge features, node features and global features respectively. $\phi ^ { e } , \phi ^ { v } , \phi ^ { u }$ are neural networks. $\rho ^ { e v } , \rho ^ { e u } , \rho ^ { v u }$ are aggregation functions such as summation. As shown in Figure 1b, we choose a 2-layer GN with residual connections for all experiments. We set $\mathbf { v } _ { i } = h _ { c , i }$ , $\mathbf { e } _ { k } = W _ { r _ { k } , s _ { k } }$ $\cdot$ is the adjacency matrix) , and assign the empty vector to u as the input of the first GN layer. The server-side GN outputs embeddings $\{ h _ { G , c , i } \mid i \in \mathcal { V } \}$ for all nodes, and sends the embedding of each node correspondingly. + +# 3.2.3 ALTERNATING TRAINING OF NODE-LEVEL AND SPATIAL MODELS + +One challenge brought about by the cross-node federated learning requirement and the server-side GN model is the high communication cost in the training stage. Since we distribute different parts of the model on different devices, Split Learning proposed by (Singh et al., 2019) is a potential solution for training, where hidden vectors and gradients are communicated among devices. However, when we simply train the model end-to-end via Split Learning, the central server needs to receive hidden states from all nodes and to send node embeddings to all nodes in the forward propagation, then it must receive gradients of node embeddings from all nodes and send back gradients of hidden states to all nodes in the backward propagation. Assume all hidden states and node embeddings have the same size $S$ , the total amount of data transmitted in each training round of the GN model is $4 | \nu | S$ . + +Table 1: Statistics of datasets PEMS-BAY and METR-LA. + +
Dataset#Nodes# Directed Edges# Train Seq# Val Seq# Test Seq
PEMS-BAY325236936465520910419
METR-LA20715152397434256850
+ +To alleviate the high communication cost in the training stage, we instead alternately train models on nodes and the GN model on the server. More specifically, in each round of training, we (1) fix the node embedding $h _ { G , c , i }$ and optimize the encoder-decoder model for $R _ { c }$ rounds, then (2) we optimize the GN model while fixing all models on nodes. Since models on nodes are fixed, $h _ { c , i }$ stays constant during the training of the GN model, and the server only needs to fetch $h _ { c , i }$ from nodes before the training of GN starts and only to communicate node embeddings and gradients. Therefore, the average amount of data transmitted in each round for $R s$ rounds of training of the GN model reduces to $\frac { 2 + \overline { { 2 } } R _ { s } } { R _ { s } } | \mathcal { V } | S$ . We provide more details of the training procedure in Algorithm 1 and Algorithm 2. + +To more effectively extract temporal features from each node, we also train the encoder-decoder models on nodes with the FedAvg algorithm proposed in (McMahan et al., 2017). This enables all nodes to share the same feature extractor and thus share a joint hidden space of temporal features, which avoids the potential overfitting of models on nodes and demonstrates faster convergence and better prediction performance empirically. + +# 4 EXPERIMENTS + +We evaluate the performance of CNFGNN and all baseline methods on the traffic forecasting task, which is an important application for spatio-temporal data modeling. We reuse the following two real-world large-scale datasets in (Li et al., 2018) and follow the same preprocessing procedures: (1) PEMS-BAY: This dataset contains the traffic speed readings from 325 sensors in the Bay Area over 6 months from Jan 1st, 2017 to May 31st, 2017. (2) METR-LA: This dataset contains the traffic speed readings from 207 loop detectors installed on the highway of Los Angeles County over 4 months from Mar 1st, 2012 to Jun 30th, 2012. + +For both datasets, we construct the adjacency matrix of sensors using the Gaussian kernel with a threshold: $W _ { i , j } = d _ { i , j }$ if $d _ { i , j } > = \kappa$ else 0, where $\begin{array} { r } { d _ { i , j } = \exp { ( - \frac { \mathrm { d i s t } ( v _ { i } , v _ { j } ) ^ { 2 } } { \sigma ^ { 2 } . } ) } , } \end{array}$ $\mathrm { d i s t } ( v _ { i } , v _ { j } )$ is the road network distance from sensor $v _ { i }$ to sensor $v _ { j }$ , $\sigma$ is the standard deviation of distances and $\kappa$ is the threshold. We set $\kappa = 0 . 1$ for both datasets. + +We aggregate traffic speed readings in both datasets into 5-minute windows and truncate the whole sequence to multiple sequences with length 24. The forecasting task is to predict the traffic speed in the following 12 steps of each sequence given the first 12 steps. We show the statistics of both datasets in Table 1. + +# 4.1 SPATIO-TEMPORAL DATA MODELING: TRAFFIC FLOW FORECASTING + +Baselines We compare CNFGNN with the following baselines. (1) GRU (centralized): a Gated Recurrent Unit (GRU) model trained with centralized sensor data. (2) $\_$ (centralized): a model directly combining GRU and GN trained with centralized data, whose architecture is similar to CNFGNN but all GRU modules on nodes always share the same weights. We see its performance as the upper bound of the performance of CNFGNN. (3) GRU (local): for each node we train a GRU model with only the local data on it. (4) GRU $^ +$ FedAvg: a GRU model trained with the Federated Averaging algorithm (McMahan et al., 2017). (5) $\mathbf { G R U + F M T L }$ : for each node we train a GRU model using the federated multi-task learning (FMTL) with cluster regularization (Smith et al., 2017) given by the adjacency matrix. For each baseline, we have 2 variants of the GRU model to show the effect of on-device model complexity: one with 63K parameters and the other with 727K parameters. For CNFGNN, the encoder-decoder model on each node has 64K parameters and the GN model has 1M parameters. + +Table 3: Comparison of the computation cost on edge devices and the communication cost. We use the amount of floating point operations (FLOPS) to measure the computational cost of models on edge devices. We also show the total size of data/parameters transmitted in the training stage (Train Comm Cost) until the model reaches its lowest validation error. + +
MethodComp Cost On Device (GFLOPS)PEMS-BAYMETR-LA
RMSETrain Comm Cost (GB)RMSETrain Comm Cost (GB)
GRU (63K)+FMTL0.1593.96157.82311.54899.201
GRU (727K) + FMTL1.8213.955359.29211.570722.137
CNFGNN (64K + 1M)0.1623.822237.65411.487222.246
+ +Discussion Table 2 shows the comparison of forecasting performance and Table 3 shows the comparison of computation cost on device and communication cost of CNFGNN and baselines. We make the following observations. Firstly, when we compare the best forecasting performance of each baseline over the 2 GRU variants, GRU trained with FedAvg performs the worst in terms of forecasting performance compared to GRU trained with centralized data and GRU trained with local data (4.432 vs 4.010/4.124 on PEMS-BAY and 12.058 vs 11.730/11.801 on METRLA), showing that the data distributions on different nodes are highly heterogeneous, and training one single model ignoring the heterogeneity is suboptimal. + +Table 2: Comparison of performance on the traffic flow forecasting task. We use the Rooted Mean Squared Error (RMSE) to evaluate the forecasting performance. + +
MethodPEMS-BAYMETR-LA
GRU (centralized, 63K)4.12411.730
GRU (centralized, 727K) GRU + GN4.12811.787
(centralized, 64K + 1M)3.81611.471
GRU (local, 63K)4.01011.801
GRU (local, 727K)4.15212.224
GRU (63K) + FedAvg4.51212.132
GRU (727K) + FedAvg4.43212.058
GRU (63K)+FMTL3.96111.548
GRU (727K) + FMTL3.95511.570
CNFGNN (64K + 1M)3.82211.487
+ +Secondly, both the $\mathrm { G R U + F M T L }$ baseline and CNFGNN consider the spatial relations among nodes and show better forecasting performance than baselines without relation information. This shows that the modeling of spatial dependencies is critical for the forecasting task. + +Lastly, CNFGNN achieves the lowest forecasting error on both datasets. The baselines that increases the complexity of on-device models (GRU $( 7 2 7 \mathrm { K } ) + \mathrm { F M T L }$ ) gains slight or even no improvement at the cost of higher computation cost on edge devices and larger communication cost. However, due to its effective modeling of spatial dependencies in data, CNFGNN not only has the largest improvement of forecasting performance, but also keeps the computation cost on devices almost unchanged and maintains modest communication cost compared to baselines increasing the model complexity on devices. + +# 4.2 INDUCTIVE LEARNING ON UNSEEN NODES + +Set-up Another advantage of CNFGNN is that it can conduct inductive learning and generalize to larger graphs with nodes unobserved during the training stage. We evaluate the performance of CNFGNN under the following inductive learning setting: for each dataset, we first sort all sensors based on longitudes, then use the subgraph on the first $\eta \%$ of sensors to train the model and evaluate the trained model on the entire graph. For each dataset we select $\eta \% = 2 5 \%$ , $5 0 \%$ , $7 5 \%$ . Over all baselines following the cross-node federated learning constraint, GRU (local) and $\mathrm { G R U + F M T L }$ requires training new models on unseen nodes and only GRU $^ +$ FedAvg is applicable to the inductive learning setting. + +Table 4: Inductive learning performance measured with rooted mean squared error (RMSE). + +
MethodPEMS-BAYMETR-LA
25%50%75%25%50%75%
GRU (63K) + FedAvg4.8634.8474.85911.99312.10412.014
CNFGNN (64K + 1M)4.5414.5984.19712.01311.81511.676
+ +![](images/43859867fa889cd71a153f132f5e85593bfc311ff2369e88c13a34e041c3045c.jpg) +Figure 2: Validation loss during the training stage of different training strategies. + +Discussion Table 4 shows the performance of inductive learning of CNFGNN and GRU $^ +$ FedAvg baseline on both datasets. We observe that under most settings, CNFGNN outperforms the $\mathrm { G R U + }$ FedAvg baseline (except on the METR-LA dataset with $2 5 \%$ nodes observed in training, where both models perform similarly), showing that CNFGNN has the stronger ability of generalization. + +4.3 ABLATION STUDY: EFFECT OF ALTERNATING TRAINING AND FEDAVG ON NODE-LEVEL AND SPATIAL MODELS + +Baselines We compare the effect of different training strategies of CNFGNN: (1) Centralized: CNFGNN trained with centralized data where all nodes share one single encoder-decoder. (2) + +Table 5: Comparison of test error (RMSE) and the communication cost during training of different training strategies of CNFGNN. + +
MethodPEMS-BAYMETR-LA
RMSETrain Comm Cost (GB)RMSETrain Comm Cost (GB)
Centralized3.81611.471
SL3.914350.36612.186307.627
SL + FedAvg4.38380.20011.631343.031
AT, w/o FedAvg4.0035221.57611.9122434.985
AT +FedAvg3.822237.65411.487222.246
+ +Split Learning (SL): CNFGNN trained with split learning (Singh et al., 2019), where models on nodes and the model on the server are jointly trained by exchanging hidden vectors and gradients. (3) Split + +Learning $^ +$ FedAvg $\mathrm { \bf S L + }$ FedAvg): A variant of SL that synchronizes the weights of encoderdecoder modules periodically with FedAvg. (4) Alternating training without Federated Averaging of models on nodes (AT, w/o FedAvg). (5) Alternating training with Federated Averaging on nodes described in Section 3.2.3 $\mathbf { \Delta A T } + \mathbf { F e d A v g }$ ). + +Discussion Figure 2 shows the validation loss during training of different training strategies on PEMS-BAY and METR-LA datasets, and Table 5 shows their prediction performance and the communication cost in training. We notice that (1) SL suffers from suboptimal prediction performance and high communication costs on both datasets; SL $^ +$ FedAvg does not have consistent results on both datasets and its performance is always inferior to AT $\cdot$ FedAvg. AT $\cdot$ FedAvg consistently outperforms other baselines on both datasets, including its variant without FedAvg. (2) AT $^ +$ FedAvg has the lowest communication cost on METR-LA and the 2nd lowest communication cost on PEMS-BAY, on which the baseline with the lowest communication cost ( $\mathrm { S L } +$ FedAvg) has a much higher prediction error (4.383 vs 3.822). Both illustrate that our proposed training strategy, $\mathrm { S L } +$ FedAvg, achieves the best prediction performance as well as low communication cost compared to other baseline strategies. + +# 4.4 ABLATION STUDY: EFFECT OF CLIENT ROUNDS AND SERVER ROUNDS + +Set-up We further investigate the effect of different compositions of the number of client rounds $( R _ { s } )$ in Algorithm 2 and the number of server rounds $( R _ { c } )$ in Algorithm 1. To this end, we vary both $R _ { c }$ and $R _ { s }$ over [1,10,20]. + +Discussion Figure 3 shows the forecasting performance (measured with RMSE) and the total communication cost in the training of CNFGNN under all compositions of $( R _ { c }$ , $R _ { s }$ ) on the METR-LA dataset. We observe that: (1) Models with lower ${ \cal R } _ { c } / { \cal R } _ { s }$ ratios $( R _ { c } / R _ { s } ~ < ~ 0 . 5 )$ tend to have lower forecasting errors while models with higher ${ \cal R } _ { c } / { \cal R } _ { s }$ ratios $( R _ { c } / R _ { s } > 2 )$ have lower communication cost in training. This is because the lower ratio of ${ \cal R } _ { c } / { \cal R } _ { s }$ encourages more frequent exchange of node information at the expense of higher communication cost, while the higher ratio of ${ \cal R } _ { c } / { \cal R } _ { s }$ acts in the opposite way. (2) Models with similar ${ \cal R } _ { c } / { \cal R } _ { s }$ ratios have similar communication costs, while those with lower + +![](images/aeed15dde9053561a6b6271b85b07c237441559b0d5bbb78fa4218bcae933a69.jpg) +Figure 3: Effect of client rounds and server rounds $( R _ { c } , R _ { s } )$ on forecasting performance and communication cost. + +$R _ { c }$ values perform better, corroborating our observation in (1) that frequent node information exchange improves the forecasting performance. + +# 5 CONCLUSION + +We propose Cross-Node Federated Graph Neural Network (CNFGNN), which bridges the gap between modeling complex spatio-temporal data and decentralized data processing by enabling the use of graph neural networks (GNNs) in the federated learning setting. We accomplish this by decoupling the learning of local temporal models and the server-side spatial model using alternating optimization of spatial and temporal modules based on split learning and federated averaging. Our experimental results on traffic flow prediction on two real-world datasets show superior performance as compared to competing techniques. Our future work includes applying existing GNN models with sampling strategies and integrating them into CNFGNN for large-scale graphs, extending CNFGNN to a fully decentralized framework, and incorporating existing privacy-preserving methods for graph learning to CNFGNN, to enhance federated learning of spatio-temporal dynamics. + +# REFERENCES + +Alekh Agarwal, Animashree Anandkumar, Prateek Jain, Praneeth Netrapalli, and Rashish Tandon. Learning sparsely used overcomplete dictionaries. In Conference on Learning Theory, pp. 123– 137, 2014. + +Sanjeev Arora, Rong Ge, and Ankur Moitra. New algorithms for learning incoherent and overcomplete dictionaries. In Conference on Learning Theory, pp. 779–806, 2014. + +Sanjeev Arora, Rong Ge, Tengyu Ma, and Ankur Moitra. Simple, efficient, and neural algorithms for sparse coding. 2015. + +Omri Azencot, N Benjamin Erichson, Vanessa Lin, and Michael W Mahoney. Forecasting sequential data using consistent koopman autoencoders. In ICML, 2020. + +Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in neural information processing systems, pp. 4502–4510, 2016. + +Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018. + +Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder–decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1724–1734, 2014. + +Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in neural information processing systems, pp. 1024–1034, 2017. + +Chaoyang He, Salman Avestimehr, and Murali Annavaram. Group knowledge transfer: Collaborative training of large cnns on the edge. arXiv preprint arXiv:2007.14513, 2020. + +Wenbing Huang, Tong Zhang, Yu Rong, and Junzhou Huang. Adaptive sampling towards fast graph representation learning. In Advances in neural information processing systems, pp. 4558–4567, 2018. + +Prateek Jain and Purushottam Kar. Non-convex optimization for machine learning. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 10(3-4):142–363, 2017. ISSN 1935-8237. doi: 10.1561/ 2200000058. URL http://dx.doi.org/10.1561/2200000058. + +Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurelien Bellet, Mehdi Bennis, Arjun Nitin ´ Bhagoji, Keith Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977, 2019. + +Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank J Reddi, Sebastian U Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for federated learning. In Proceedings of the 37th International Conference on Machine Learning, 2020. + +Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017. + +Thomas N Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard S Zemel. Neural relational inference for interacting systems. In ICML, 2018. + +Max Guangyu Li, Bo Jiang, Hao Zhu, Zhengping Che, and Yan Liu. Generative attention networks for multi-agent behavioral modeling. In AAAI, 2020a. + +Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. In Proceedings of the 3rd MLSys Conference, 2020b. + +Yaguang Li, Rose Yu, Cyrus Shahabi, and Yan Liu. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. In International Conference on Learning Representations (ICLR ’18), 2018. + +Paul Pu Liang, Terrance Liu, Liu Ziyin, Ruslan Salakhutdinov, and Louis-Philippe Morency. Think locally, act globally: Federated learning with local and global representations. arXiv preprint arXiv:2001.01523, 2020. + +Ziyu Liu, Hongwen Zhang, Zhenghao Chen, Zhiyong Wang, and Wanli Ouyang. Disentangling and unifying graph convolutions for skeleton-based action recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 143–152, 2020. + +Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial Intelligence and Statistics, pp. 1273–1282. PMLR, 2017. + +Guangxu Mei, Ziyu Guo, Shijun Liu, and Li Pan. Sgnn: A graph neural network based federated learning approach by hiding structure. In 2019 IEEE International Conference on Big Data (Big Data), pp. 2560–2568. IEEE, 2019. + +Sina Sajadmanesh and Daniel Gatica-Perez. When differential privacy meets graph neural networks. arXiv preprint arXiv:2006.05535, 2020. + +Sungyong Seo, Chuizheng Meng, and Yan Liu. Physics-aware difference graph networks for sparsely-observed dynamics. In International Conference on Learning Representations, 2019. + +Abhishek Singh, Praneeth Vepakomma, Otkrist Gupta, and Ramesh Raskar. Detailed comparison of communication efficiency of split learning and federated learning. arXiv preprint arXiv:1909.09145, 2019. + +Virginia Smith, Chao-Kai Chiang, Maziar Sanjabi, and Ameet S Talwalkar. Federated multi-task learning. In Advances in Neural Information Processing Systems, pp. 4424–4434, 2017. + +Toyotaro Suzumura, Yi Zhou, Natahalie Barcardo, Guangnan Ye, Keith Houck, Ryo Kawahara, Ali Anwar, Lucia Larise Stavarache, Daniel Klyashtorny, Heiko Ludwig, et al. Towards federated graph learning for collaborative financial crimes detection. arXiv preprint arXiv:1909.12946, 2019. + +Keyulu Xu, Jingling Li, Mozhi Zhang, Simon S Du, Ken-ichi Kawarabayashi, and Stefanie Jegelka. What can neural networks reason about? In International Conference on Learning Representations (ICLR), 2019. + +Sijie Yan, Yuanjun Xiong, and Dahua Lin. Spatial temporal graph convolutional networks for skeleton-based action recognition. In AAAI, 2018. + +Rex Ying, Ruining He, Kaifeng Chen, Pong Eksombatchai, William L Hamilton, and Jure Leskovec. Graph convolutional neural networks for web-scale recommender systems. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 974– 983, 2018. + +Jiaxuan You, Rex Ying, and Jure Leskovec. Position-aware graph neural networks. In Proceedings of the 36th International Conference on Machine Learning, 2019. + +Bing Yu, Haoteng Yin, and Zhanxing Zhu. Spatio-temporal graph convolutional networks: A deep learning framework for traffic forecasting. In Proceedings of the 27th International Joint Conference on Artificial Intelligence (IJCAI), 2018. + +Jun Zhou, Chaochao Chen, Longfei Zheng, Xiaolin Zheng, Bingzhe Wu, Ziqi Liu, and Li Wang. Privacy-preserving graph neural network for node classification. arXiv preprint arXiv:2005.11903, 2020. + +# A APPENDIX + +A.1 DETAILED EXPERIMENT SETTINGS + +Unless noted otherwise, all models are optimized using the Adam optimizer with the learning rate 1e-3. + +GRU (centralized) : Gated Recurrent Unit (GRU) model trained with centralized sensor data. The GRU model with 63K parameters is a 1-layer GRU with hidden dimension 100, and the GRU model with 727K parameters is a 2-layer GRU with hidden dimension 200. + +GRU (local) We train one GRU model for each node with the local data only. + +GRU $^ +$ FedAvg We train a single GRU model with Federated Averaging (McMahan et al., 2017). +We select 1 as the number of local epochs. + +$\mathbf { G R U } + \mathbf { F M T L }$ We train one GRU model for each node using the federated multi-task learning (FMTL) with cluster regularization (Smith et al., 2017) given by the adjacency matrix. More specifically, the cluster regularization (without the L2-norm regularization term) takes the following form: + +$$ +\mathcal { R } ( W , \mathfrak { L } ) = \lambda \mathrm { t r } ( W \Omega W ^ { T } ) . +$$ + +Given the constructed adjacency matrix $\pmb { A }$ , $\begin{array} { r } { \pmb { \Omega } = \frac { 1 } { | \mathcal { V } | } ( \pmb { D } - \pmb { A } ) = \frac { 1 } { | \mathcal { V } | } \pmb { L } } \end{array}$ , where $_ { D }$ is the degree matrix and $\pmb { L }$ is the Laplacian matrix. Equation A1 can be reformulated as: + +$$ +\begin{array} { r l } { { \mathcal { R } ( W , \pmb { \Omega } ) = \lambda \mathrm { t r } ( W \pmb { \Omega } W ^ { T } ) = \frac { \lambda } { | \mathcal { V } | } \mathrm { t r } ( W \pmb { L } W ^ { T } ) } } \\ & { = \frac { \lambda } { | \mathcal { V } | } \mathrm { t r } ( \displaystyle \sum _ { i \in \mathcal { V } } \pmb { w } _ { i } \displaystyle \sum _ { j \not = i } a _ { i j } \pmb { w } _ { i } ^ { T } - \displaystyle \sum _ { j \not = i } \pmb { w } _ { i } a _ { i j } \pmb { w } _ { j } ^ { T } ) } \\ & { = \lambda _ { 1 } ( \displaystyle \sum _ { i \in \mathcal { V } } \displaystyle \sum _ { j \not = i } \alpha _ { i , j } \langle \pmb { w } _ { i } , \pmb { w } _ { i } - \pmb { w } _ { j } \rangle ) . } \end{array} +$$ + +We implement the cluster regularization via sharing model weights between each pair of nodes connected by an edge and select $\lambda _ { 1 } = 0 . 1$ . + +CNFGNN We use a GRU-based encoder-decoder model as the model on nodes, which has 1 GRU layer and hidden dimension 64. We use a 2-layer Graph Network (GN) with residual connections as the Graph Neural Network model on the server side. We use the same network architecture for the edge/node/global update function in each GN layer: a multi-layer perceptron (MLP) with 3 hidden layers, whose sizes are [256, 256, 128] respectively. We choose $R _ { c } = 1 , R _ { s } = 2 0$ for experiments on PEMS-BAY, and $R _ { c } = 1 , R _ { s } = 1$ for METR-LA. + +# A.2 CALCULATION OF COMMUNICATION COST + +We denote $R$ as the number of communication rounds for one model to reach the lowest validation error in the training stage. + +$\mathbf { G R U + F M T L }$ Using Equation A2, in each communication round, each pair of nodes exchange their model weights, thus the total communicated data amount is calculated as: + +$$ +R \times \# \mathrm { n o n s e l f ~ d i r e c t e d ~ e d g e s } \times \mathrm { s i z e ~ o f ~ n o d e ~ m o d e l ~ w e i g h t s } . +$$ + +CNFGNN (AT $^ +$ FedAvg) In each communication round, the central server fetches and sends back model weights to each node for Federated Averaging, and transmits hidden vectors and gradients for Split Learning. The total communicated data amount is calculated as: + +$$ +\begin{array} { r l } & { R \times ( \mathrm { \# n o d e s } \times \mathrm { s i z e ~ o f ~ n o d e ~ m o d e l ~ w e i g h t s } \times 2 } \\ & { \quad + ( 1 + 2 * \mathrm { s e r v e r ~ r o u n d } + 1 ) \times \mathrm { \# n o d e s } \times \mathrm { h i d d e n ~ s t a t e ~ s i z e } ) . } \end{array} +$$ + +CNFGNN (SL) In each communication round, each node sends and fetches hidden vectors and graidents twice (one for encoder, the other for decoder) and the total communicated data amount is: + +$$ +- +$$ + +CNFGNN $\mathrm { \bf { S L + } }$ FedAvg) Compared to CNFGNN (SL), the method has extra communcation cost for FedAvg in each round, thus the total communicated data amount is: + +$$ +- +$$ + +CNFGNN (AT, w/o FedAvg) Compared to CNFGNN (AT $^ +$ FedAvg), there is no communcation cost for the FedAvg part, thus the total communcated data amount is: + +$$ +- +$$ + +Table A1: Parameters used for calculating the communication cost of $\mathrm { G R U + F M T L }$ . + +
MethodGRU (63K) + FMTL GRU (727K) + FMTL
Node Model Weights Size (GB)2.347E-42.708E-3
PEMS-BAY#Nonself Directed Edges2369
R10456
Train Comm Cost (GB)57.823359.292
METR-LA#Nonself Directed Edges1515
R279176
Train Comm ( Cost (GB)99.201722.137
+ +Table A2: Parameters used for calculating the communication cost of CNFGNN (AT $\cdot$ FedAvg). + +
Node Model Weights Size (GB)2.384E-4
PEMS-BAY#Nodes325
Hidden State Size (GB) Server Round2.173E-3 20
R2
METR-LATrain Comm Cost (GB) #Nodes237.654 207
Hidden State Size (GB)1.429E-3
Server Round R1 46
+ +# A.3 INDUCTIVE LEARNING + +We have added results using $\cdot$ and $5 \%$ data on both datasets and we show the table of inductive learning results as Table A6. We observe that: (1) With the portion of visible nodes in the training stage increasing, the prediction error of CNFGNN decreases drastically. However, the increase of the portion of visible nodes has negligible contribution to the performance of GRU $\cdot$ FedAvg after the portion surpasses $\cdot$ . Since increasing the ratio of seen nodes in training introduces more complex relationships among nodes to the training data, the difference of performance illustrates that CNFGNN has a stronger capability of capturing complex spatial relationships. (2) When the ratio of visible nodes in training is extremely low $\cdot$ , there is not enough spatial relationship information in the training data to train the GN module in CNFGNN, and the performance of CNFGNN may not be ideal. We visualize the subgraphs visible in training under different ratios in Figure A1. However, as long as the training data covers a moderate portion of the spatial information of the whole graph, CNFGNN can still leverage the learned spatial connections among nodes effectively and outperforms GRU $+$ FedAvg. We empirically show that the necessary ratio can vary for different datasets ( $2 5 \%$ for PEMS-BAY and $\cdot$ for METR-LA). + +Table A3: Parameters used for calculating the communication cost of CNFGNN (SL). + +
PEMS-BAY#Nodes Hidden State Size (GB) R325 2.173E-3 31
Train Comm Cost (GB)350.366
METR-LA#Nodes Hidden State Size (GB)207 1.429E-3
R65
Train Comm Cost (GB)307.627
+ +Table A4: Parameters used for calculating the communication cost of CNFGNN (SL $^ +$ FedAvg). +Table A5: Parameters used for calculating the communication cost of CNFGNN (AT, w/o FedAvg). + +
Node Model Weights Size (GB)2.384E-4
PEMS-BAY#Nodes Hidden State Size (GB) R Train Comm Cost (GB)325 2.173E-3 7 80.200
METR-LA#Nodes Hidden State Size (GB) R Train Comm Cost (GB)207 1.429E-3 71 343.031
+ +![](images/82218b6d5ed79cf9fb8faba82ec055c2f31115267be423b485d38a1203e54314.jpg) +Figure A1: Visualization of subgraphs visible in training under different ratios. + +Table A6: Inductive learning performance measured with rooted mean squared error (RMSE). + +
MethodPEMS-BAYMETR-LA
5%25%50%75%90%5%25%50%75%90%
GRU (63K)+ FedAvg5.0874.8634.8474.8594.86612.12811.99312.10412.01412.016
CNFGNN (64K + 1M)5.8694.5414.5984.1973.94213.93112.01311.81511.67611.629
+ +# A.4 THE HISTOGRAMS OF DATA ON DIFFERENT NODES + +We show the histograms of traffic speed on different nodes of PEMS-BAY and METR-LA in Figure A2. For each dataset, we only show the first 100 nodes ranked by their IDs for simplicity. The histograms show that the data distribution varies with nodes, thus data on different nodes are not independent and identically distributed. + +![](images/fbb9448d998bae68ee364eb978642afeeb3a587536740eb8563d4983ca31138b.jpg) +Figure A2: The histograms of data on the first 100 nodes ranked by ID. \ No newline at end of file diff --git a/md/train/HkezXnA9YX/HkezXnA9YX.md b/md/train/HkezXnA9YX/HkezXnA9YX.md new file mode 100644 index 0000000000000000000000000000000000000000..58db836796d68ffdcea9ea713ed4f85c01917b1e --- /dev/null +++ b/md/train/HkezXnA9YX/HkezXnA9YX.md @@ -0,0 +1,306 @@ +# SYSTEMATIC GENERALIZATION: WHAT IS REQUIRED AND CAN IT BE LEARNED? + +Dzmitry Bahdanau∗ Mila, Universite de Montr´ eal´ AdeptMind Scholar Element AI + +Shikhar Murty∗ Mila, Universite de Montr ´ eal ´ + +Michael Noukhovitch Mila, Universite de Montr ´ eal ´ + +Thien Huu Nguyen University of Oregon + +Harm de Vries Mila, Universite de Montr´ eal´ + +Aaron Courville +Mila, Universite de Montr´ eal´ +CIFAR Fellow + +# ABSTRACT + +Numerous models for grounded language understanding have been recently proposed, including (i) generic models that can be easily adapted to any given task and (ii) intuitively appealing modular models that require background knowledge to be instantiated. We compare both types of models in how much they lend themselves to a particular form of systematic generalization. Using a synthetic VQA test, we evaluate which models are capable of reasoning about all possible object pairs after training on only a small subset of them. Our findings show that the generalization of modular models is much more systematic and that it is highly sensitive to the module layout, i.e. to how exactly the modules are connected. We furthermore investigate if modular models that generalize well could be made more end-to-end by learning their layout and parametrization. We find that endto-end methods from prior work often learn inappropriate layouts or parametrizations that do not facilitate systematic generalization. Our results suggest that, in addition to modularity, systematic generalization in language understanding may require explicit regularizers or priors. + +# 1 INTRODUCTION + +In recent years, neural network based models have become the workhorse of natural language understanding and generation. They empower industrial machine translation (Wu et al., 2016) and text generation (Kannan et al., 2016) systems and show state-of-the-art performance on numerous benchmarks including Recognizing Textual Entailment (Gong et al., 2017), Visual Question Answering (Jiang et al., 2018), and Reading Comprehension (Wang et al., 2018). Despite these successes, a growing body of literature suggests that these approaches do not generalize outside of the specific distributions on which they are trained, something that is necessary for a language understanding system to be widely deployed in the real world. Investigations on the three aforementioned tasks have shown that neural models easily latch onto statistical regularities which are omnipresent in existing datasets (Agrawal et al., 2016; Gururangan et al., 2018; Jia & Liang, 2017) and extremely hard to avoid in large scale data collection. Having learned such dataset-specific solutions, neural networks fail to make correct predictions for examples that are even slightly out of domain, yet are trivial for humans. These findings have been corroborated by a recent investigation on a synthetic instruction-following task (Lake & Baroni, 2018), in which seq2seq models (Sutskever et al., 2014; Bahdanau et al., 2015) have shown little systematicity (Fodor & Pylyshyn, 1988) in how they generalize, that is they do not learn general rules on how to compose words and fail spectacularly when for example asked to interpret “jump twice” after training on “jump”, “run twice” and “walk twice”. + +An appealing direction to improve the generalization capabilities of neural models is to add modularity and structure to their design to make them structurally resemble the kind of rules they are supposed to learn (Andreas et al., 2016; Gaunt et al., 2016). For example, in the Neural Module Network paradigm (NMN, Andreas et al. (2016)), a neural network is assembled from several neural modules, where each module is meant to perform a particular subtask of the input processing, much like a computer program composed of functions. The NMN approach is intuitively appealing but its widespread adoption has been hindered by the large amount of domain knowledge that is required to decide (Andreas et al., 2016) or predict (Johnson et al., 2017; Hu et al., 2017) how the modules should be created (parametrization) and how they should be connected (layout) based on a natural language utterance. Besides, their performance has often been matched by more traditional neural models, such as FiLM (Perez et al., 2017), Relations Networks (Santoro et al., 2017), and MAC networks (Hudson & Manning, 2018). Lastly, generalization properties of NMNs, to the best of our knowledge, have not been rigorously studied prior to this work. + +Here, we investigate the impact of explicit modularity and structure on systematic generalization of NMNs and contrast their generalization abilities to those of generic models. For this case study, we focus on the task of visual question answering (VQA), in particular its simplest binary form, when the answer is either “yes” or “no”. Such a binary VQA task can be seen as a fundamental task of language understanding, as it requires one to evaluate the truth value of the utterance with respect to the state of the world. Among many systematic generalization requirements that are desirable for a VQA model, we choose the following basic one: a good model should be able to reason about all possible object combinations despite being trained on a very small subset of them. We believe that this is a key prerequisite to using VQA models in the real world, because they should be robust at handling unlikely combinations of objects. We implement our generalization demands in the form of a new synthetic dataset, called Spatial Queries On Object Pairs (SQOOP), in which a model has to perform spatial relational reasoning about pairs of randomly scattered letters and digits in the image (e.g. answering the question “Is there a letter A left of a letter B?”). The main challenge in SQOOP is that models are evaluated on all possible object pairs, but trained on only a subset of them. + +Our first finding is that NMNs do generalize better than other neural models when layout and parametrization are chosen appropriately. We then investigate which factors contribute to improved generalization performance and find that using a layout that matches the task (i.e. a tree layout, as opposed to a chain layout), is crucial for solving the hardest version of our dataset. Lastly, and perhaps most importantly, we experiment with existing methods for making NMNs more end-to-end by inducing the module layout (Johnson et al., 2017) or learning module parametrization through soft-attention over the question (Hu et al., 2017). Our experiments show that such end-to-end approaches often fail by not converging to tree layouts or by learning a blurred parameterization for modules, which results in poor generalization on the hardest version of our dataset. We believe that our findings challenge the intuition of researchers in the field and provide a foundation for improving systematic generalization of neural approaches to language understanding. + +# 2 THE SQOOP DATASET FOR TESTING SYSTEMATIC GENERALIZATION + +We perform all experiments of this study on the SQOOP dataset. SQOOP is a minimalistic VQA task that is designed to test the model’s ability to interpret unseen combinations of known relation and object words. Clearly, given known objects X, Y and a known relation R, a human can easily verify whether or not the objects X and $\mathrm { Y }$ are in relation R. Some instances of such queries are common in daily life (is there a cup on the table), some are extremely rare (is there a violin under the car), and some are unlikely but have similar, more likely counter-parts (is there grass on the frisbee vs is there a frisbee on the grass). Still, a person can easily answer these questions by understanding them as just the composition of the three separate concepts. Such compositional reasoning skills are clearly required for language understanding models, and SQOOP is explicitly designed to test for them. + +Concretely speaking, SQOOP requires observing a $6 4 \times 6 4$ RGB image x and answering a yes-no question $q = \mathrm { X R Y }$ about whether objects $\mathrm { X }$ and $\mathrm { Y }$ are in a spatial relation R. The questions are represented in a redundancy-free X R Y form; we did not aim to make the questions look like natural language. Each image contains 5 randomly chosen and randomly positioned objects. There are 36 objects: the latin letters A-Z and digits 0-9, and there are 4 relations: LEFT OF, RIGHT OF, ABOVE, and BELOW. This results in $3 6 \cdot 3 5 \cdot 4 = 5 0 4 0$ possible unique questions (we do not allow questions about identical objects). To make negative examples challenging, we ensure that both X and Y of a question are always present in the associated image and that there are distractor objects $\mathrm { Y } ^ { \prime } \ne \mathrm { Y }$ and $\mathrm { X } ^ { \prime } \ne \mathrm { X }$ such that $\mathrm { X R Y ^ { \prime } }$ and $\mathrm { X } ^ { \prime } \mathrm { R Y }$ are both true for the image. These extra precautions guarantee that answering a question requires the model to locate all possible X and Y then check if any pair of them are in the relation R. Two SQOOP examples are shown in Figure 2. + +![](images/f1494609efece50ff811e958184658e279cb1f6e09a33c95c3f3156fb8dbffb2.jpg) +Figure 1: Different NMN layouts: NMN-Chain-Shortcut (left), NMN-Chain (center), NMN-Tree (right). See Section 3.2 for details. +Figure 2: A positive (top) and negative (bottom) example from the SQOOP dataset. + +Our goal is to discover which models can correctly answer questions about all $3 6 \cdot 3 5$ possible object pairs in SQOOP after having been trained on only a subset. For this purpose we build training sets containing $3 6 \cdot 4 \cdot k$ unique questions by sampling $k$ different right-hand-side (RHS) objects $\mathrm { Y } _ { 1 }$ , $\mathrm { Y } _ { 2 }$ , ..., $\mathrm { Y } _ { \mathrm { k } }$ for each left-hand-side (LHS) object X. We use this procedure instead of just uniformly sampling object pairs in order to ensure that each object appears in at least one training question, thereby keeping the all versions of the dataset solvable. We will refer to $k$ as the #rhs/lhs parameter of the dataset. Our test set is composed from the remaining $3 6 \cdot 4 \cdot ( 3 5 - k )$ questions. We generate training and test sets for rhs/lhs values of 1,2,4,8 and 18, as well as a control version of the dataset, #rhs/lhs ${ } = 3 5$ , in which both the training and the test set contain all the questions (with different images). Note that lower #rhs/lhs versions are harder for generalization due to the presence of spurious dependencies between the words $\mathrm { X }$ and $\mathrm { Y }$ to which the models may adapt. In order to exclude a possible compounding factor of overfitting on the training images, all our training sets contain 1 million examples, so for a dataset with #rhs/lhs $= k$ we generate approximately $1 0 ^ { 6 } { \bar { / } } ( 3 6 \cdot$ $4 { \cdot } k$ ) different images per unique question. Appendix D contains pseudocode for SQOOP generation. + +# 3 MODELS + +A great variety of VQA models have been recently proposed in the literature, among which we can distinguish two trends. Some of the recently proposed models, such as FiLM (Perez et al., 2017) and Relation Networks (RelNet, Santoro et al. (2017)) are highly generic and do not require any taskspecific knowledge to be applied on a new dataset. On the opposite end of the spectrum are modular and structured models, typically flavours of Neural Module Networks (Andreas et al., 2016), that do require some knowledge about the task at hand to be instantiated. Here, we evaluate systematic generalization of several state-of-the-art models in both families. In all models, the image x is first fed through a CNN based network, that we refer to as the stem, to produce a feature-level 3D tensor $h _ { \mathrm { x } }$ . This is passed through a model-specific computation conditioned on the question $q$ , to produce a joint representation $h _ { q \bf { x } }$ . Lastly, this representation is fed into a fully-connected classifier network to produce logits for prediction. Therefore, the main difference between the models we consider is how the computation $h _ { q \mathbf { x } } = m o d e l ( h _ { \mathbf { x } } , q )$ is performed. + +# 3.1 GENERIC MODELS + +We consider four generic models in this paper: CNN+LSTM, FiLM, Relation Network (RelNet), and Memory-Attention-Control (MAC) network. For CNN+LSTM, FiLM, and RelNet models, the question $q$ is first encoded into a fixed-size representation $h _ { q }$ using a unidirectional LSTM network. CNN+LSTM flattens the 3D tensor $h _ { \mathrm { x } }$ to a vector and concatenates it with $h _ { q }$ to produce $h _ { q \mathrm { \tiny ~ x } }$ : + +$$ +h _ { q \mathrm { x } } = [ f l a t t e n ( h _ { \mathrm { x } } ) ; h _ { q } ] . +$$ + +RelNet (Santoro et al., 2017) uses a network $g$ which is applied to all pairs of feature columns of $h _ { \mathrm { x } }$ concatenated with the question representation $h _ { q }$ , all of which is then pooled to obtain $h _ { q \bf { x } }$ : + +$$ +h _ { q \mathrm { x } } = \sum _ { i , j } g ( h _ { \mathrm { x } } ( i ) , h _ { \mathrm { x } } ( j ) , h _ { q } ) +$$ + +where $h _ { x } ( i )$ is the $i$ -th feature column of $h _ { x }$ . FiLM networks (Perez et al., 2017) use $N$ convolutional FiLM blocks applied to $h _ { \mathrm { x } }$ . A FiLM block is a residual block (He et al., 2016) in which a feature-wise affine transformation (FiLM layer) is inserted after the $2 ^ { \mathrm { n d } }$ convolutional layer. The FiLM layer is conditioned on the question at hand via prediction of the scaling and shifting parameters $\gamma _ { n }$ and $\beta _ { n }$ : + +$$ +\begin{array} { r } { [ \gamma _ { n } ; \beta _ { n } ] = W _ { q } ^ { n } h _ { q } + b _ { q } ^ { n } } \\ { \tilde { h } _ { q \mathbf { x } } ^ { n } = B N ( W _ { 2 } ^ { n } * R e L U ( W _ { 1 } ^ { n } * h _ { q \mathbf { x } } ^ { n - 1 } + b _ { n } ) ) } \\ { h _ { q \mathbf { x } } ^ { n } = h _ { q \mathbf { x } } ^ { n - 1 } + R e L U ( \gamma _ { n } \odot \tilde { h } _ { q \mathbf { x } } ^ { n } \oplus \beta _ { n } ) } \end{array} +$$ + +where $B N$ stands for batch normalization (Ioffe & Szegedy, 2015), $^ *$ stands for convolution and $\odot$ stands for element-wise multiplications. $h _ { q \mathrm { ~ x ~ } } ^ { n }$ is the output of the $n$ -th FiLM block and $h _ { q \mathrm { x } } ^ { 0 } = h _ { \mathrm { x } }$ . The output of the last FiLM block $h _ { q \mathrm { ~ x ~ } } ^ { N }$ undergoes an extra $1 \times 1$ convolution and max-pooling to produce $h _ { q \bf { x } }$ . MAC network of Hudson & Manning (2018) produces $h _ { q \bf { x } }$ by repeatedly applying a Memory-Attention-Composition (MAC) cell that is conditioned on the question through an attention mechanism. The MAC model is too complex to be fully described here and we refer the reader to the original paper for details. + +# 3.2 NEURAL MODULE NETWORKS + +Neural Module Networks (NMN) (Andreas et al., 2016) are an elegant approach to question answering that constructs a question-specific network by composing together trainable neural modules, drawing inspiration from symbolic approaches to question answering (Malinowski & Fritz, 2014). To answer a question with an NMN, one first constructs the computation graph by making the following decisions: (a) how many modules and of which types will be used, (b) how will the modules be connected to each other, and (c) how are these modules parametrized based on the question. We refer to the aspects (a) and (b) of the computation graph as the layout and the aspect (c) as the parametrization. In the original NMN and in many follow-up works, different module types are used to perform very different computations, e.g. the Find module from Hu et al. (2017) performs trainable convolutions on the input attention map, whereas the And module from the same paper computes an element-wise maximum for two input attention maps. In this work, we follow the trend of using more homogeneous modules started by Johnson et al. (2017), who use only two types of modules: unary and binary, both performing similar computations. We restrict our study to NMNs with homogeneous modules because they require less prior knowledge to be instantiated and because they performed well in our preliminary experiments despite their relative simplicity. We go one step further than Johnson et al. (2017) and retain a single binary module type, using a zero tensor for the second input when only one input is available. Additionally, we choose to use exactly three modules, which simplifies the layout decision to just determining how the modules are connected. Our preliminary experiments have shown that, even after these simplifications, NMNs are far ahead of other models in terms of generalization. + +In the original NMN, the layout and parametrization were set in an ad-hoc manner for each question by analyzing a dependency parse. In the follow-up works (Johnson et al., 2017; Hu et al., 2017), these aspects of the computation are predicted by learnable mechanisms with the goal of reducing the amount of background knowledge required to apply the NMN approach to a new task. We experiment with the End-to-End NMN (N2NMN) (Hu et al., 2017) paradigm from this family, which predicts the layout with a seq2seq model (Sutskever et al., 2014) and computes the parametrization of the modules using a soft attention mechanism. Since all the questions in SQOOP have the same structure, we do not employ a seq2seq model but instead have a trainable layout variable and trainable attention variables for each module. + +Formally, our NMN is constructed by repeatedly applying a generic neural module $f ( \theta , \gamma , s ^ { 0 } , s ^ { 1 } )$ , which takes as inputs the shared parameters $\theta$ , the question-specific parametrization $\gamma$ and the lefthand side and right-hand side inputs $s ^ { 0 }$ and $s ^ { 1 }$ . Three such modules are connected and conditioned + +on a question $q = ( q _ { 1 } , q _ { 2 } , q _ { 3 } )$ as follows: + +$$ +\begin{array} { c } { { \displaystyle \gamma _ { k } = \sum _ { i = 1 } ^ { 3 } \alpha ^ { k , i } e ( q _ { i } ) } } \\ { { \displaystyle s _ { k } ^ { m } = \sum _ { j = - 1 } ^ { k - 1 } \tau _ { m } ^ { k , j } s _ { j } } } \\ { { \displaystyle s _ { k } = f ( \theta , \gamma _ { k } , s _ { k } ^ { 0 } , s _ { k } ^ { 1 } ) } } \\ { { \displaystyle h _ { q x } = s _ { 3 } } } \end{array} +$$ + +In the equations above, $s _ { - 1 } = 0$ is the zero tensor input, $s _ { 0 } = h _ { x }$ are the image features outputted by the stem, $e$ is the embedding table for question words. $k \in \{ 1 , 2 , 3 \}$ is the module number, $s _ { k }$ is the output of the $k$ -th module and $s _ { k } ^ { m }$ are its left $\mathbf { \bar { \rho } } _ { m } = 0 ,$ ) and right $\mathbf { \Phi } _ { m } = 1 \mathbf { \Phi } _ { \rho }$ ) inputs. We refer to $A = ( \alpha ^ { k , i } )$ and $T = ( \tau _ { m } ^ { k , j } )$ as the parametrization attention matrix and the layout tensor respectively. + +We experiment with two choices for the NMN’s generic neural module: the Find module from Hu et al. (2017) and the Residual module from Johnson et al. (2017). The equations for the Residual module are as follows: + +$$ +\begin{array} { r l r } & { } & { [ W _ { 1 } ^ { k } ; b _ { 1 } ^ { k } ; W _ { 2 } ^ { k } ; b _ { 2 } ^ { k } ; W _ { 3 } ^ { k } ; b _ { 3 } ^ { k } ] = \gamma _ { k } } \\ & { } & { \tilde { s _ { k } } = R e L U ( W _ { 3 } ^ { k } * [ s _ { k } ^ { 0 } ; s _ { k } ^ { 1 } ] + b _ { 3 } ^ { k } ) , } \\ & { } & { f _ { R e s i d u a l } ( \gamma _ { k } , s _ { k } ^ { 0 } , s _ { k } ^ { 1 } ) = R e L U ( \tilde { s _ { k } } + W _ { 1 } ^ { k } * R e L U ( W _ { 2 } ^ { k } * \tilde { s _ { k } } + b _ { 2 } ^ { k } ) ) + b _ { 1 } ^ { k } ) , } \end{array} +$$ + +and for Find module as follows: + +$$ +\begin{array} { r l r } & { } & { [ W _ { 1 } ; b _ { 1 } ; W _ { 2 } ; b _ { 2 } ] = \theta , } \\ & { } & { f _ { F i n d } ( \theta , \gamma _ { k } , s _ { k } ^ { 0 } , s _ { k } ^ { 1 } ) = R e L U ( W _ { 1 } * \gamma _ { k } \odot R e L U ( W _ { 2 } * [ s _ { k } ^ { 0 } ; s _ { k } ^ { 1 } ] + b _ { 2 } ) + b _ { 1 } ) . } \end{array} +$$ + +In the formulas above all $W$ ’s stand for convolution weights, and all $b$ ’s are biases. Equations 10 and 13 should be understood as taking vectors $\gamma _ { k }$ and $\theta$ respectively and chunking them into weights and biases. The main difference between Residual and Find is that in Residual all parameters depend on the questions words (hence $\theta$ is omitted from the signature of $f _ { R e s i d u a l } )$ , where as in Find convolutional weights are the same for all questions, and only the element-wise multipliers $\gamma _ { k }$ vary based on the question. We note that the specific Find module we use in this work is slightly different from the one used in (Hu et al., 2017) in that it outputs a feature tensor, not just an attention map. This change was required in order to connect multiple Find modules in the same way as we connect multiple residual ones. + +Based on the generic NMN model described above, we experiment with several specific architectures that differ in the way the modules are connected and parametrized (see Figure 1). In NMN-Chain the modules form a sequential chain. Modules 1, 2 and 3 are parametrized based on the first object word, second object word and the relation word respectively, which is achieved by setting the attention maps $\alpha _ { 1 }$ , $\alpha _ { 2 }$ , $\alpha _ { 3 }$ to the corresponding one-hot vectors. We also experiment with giving the image features $h _ { x }$ as the right-hand side input to all 3 modules and call the resulting model NMN-ChainShortcut. NMN-Tree is similar to NMN-Chain in that the attention vectors are similarly hardcoded, but we change the connectivity between the modules to be tree-like. Stochastic N2NMN follows the N2NMN approach by Hu et al. (2017) for inducing layout. We treat the layout $T$ as a stochastic latent variable. $T$ is allowed to take two values: $T _ { t r e e }$ as in NMN-Tree, and $T _ { c h a i n }$ as in NMN-Chain. We calculate the output probabilities by marginalizing out the layout i.e. probability of answer being “yes” is computed as $\begin{array} { r } { \bar { p } ( \mathrm { y e s } | x , q ) = \sum _ { T \in \{ T _ { t r e e } , T _ { c h a i n } \} } p ( \mathrm { y e s } | \bar { T } , x , q ) p ( \bar { T } ) } \end{array}$ . Lastly, Attention N2NMN uses the N2NMN method for learning parametrization (Hu et al., 2017). It is structured just like NMN-Tree but has $\alpha ^ { k }$ computed as $\operatorname { s o f t m a x } ( \tilde { \alpha } ^ { k } )$ , where $\tilde { \alpha } ^ { k }$ is a trainable vector. We use Attention N2NMN only with the Find module because using it with the Residual module would involve a highly non-standard interpolation between convolutional weights. + +# 4 EXPERIMENTS + +In our experiments we aimed to: (a) understand which models are capable of exhibiting systematic generalization as required by SQOOP, and (b) understand whether it is possible to induce, in an end-to-end way, the successful architectural decisions that lead to systematic generalization. + +All models share the same stem architecture which consists of 6 layers of convolution (8 for Relation Networks), batch normalization and max pooling. The input to the stem is a $6 4 \times 6 4 \times 3$ image, and the feature dimension used throughout the stem is 64. Further details can be found in Appendix A. The code for all experiments is available online1. + +# 4.1 WHICH MODELS GENERALIZE BETTER? + +We report the performance for all models on datasets of varying difficulty in Figure 3. Our first observation is that the modular and tree-structured NMN-Tree model exhibits strong systematic generalization. Both versions of this model, with Residual and Find modules, robustly solve all versions of our dataset, including the most challenging #rhs/lh $^ { = 1 }$ split. + +The results of NMN-Tree should be contrasted with those of generic models. 2 out of 4 models (Conv+LSTM and RelNet) are not able to learn to answer all SQOOP questions, no matter how easy the split was (for high #rhs/lhs Conv+LSTM overfitted and RelNet did not train). The results of other two models, MAC and FiLM, are similar. Both models are clearly able to solve the SQOOP task, as suggested by their almost perfect $< 1 \%$ error rate on the control #rhs/lhs $= 3 5$ split, yet they struggle to generalize on splits with lower #rhs/lhs. In particular, we observe $1 3 . 6 7 \pm 9 . 9 7 \%$ errors for MAC and a $3 4 . 7 3 \pm 4 . 6 1 \%$ errors for FiLM on the hardest #rhs/lhs $^ { = 1 }$ split. For the splits of intermediate difficulty we saw the error rates of both models decreasing as we increased the #rhs/lhs ratio from 2 to 18. Interestingly, even with 18 #rhs/lhs some MAC and FiLM runs result in a test error rate of $\sim 2 \%$ . Given the simplicity and minimalism of SQOOP questions, we believe that these results should be considered a failure to pass the SQOOP test for both MAC and FiLM. That said, we note a difference in how exactly FiLM and MAC fail on #rhs/lhs $^ { = 1 }$ : in several runs (3 out of 15) MAC exhibits a strong generalization performance $( \sim 0 . 5 \%$ error rate), whereas in all runs of FiLM the error rate is about $3 0 \%$ . We examine the successful MAC models and find that they converge to a successful setting of the control attention weights, where specific MAC units consistently attend to the right questions words. In particular, MAC models that generalize strongly for each question seem to have a unit focusing strongly on $X$ and a unit focusing strongly on $Y$ (see Appendix B for more details). As MAC was the strongest competitor of NMN-Tree across generic models, we perform an ablation study for this model, in which we vary the number of modules and hidden units, as well as experiment with weight decay. These modifications do not result in any significant reduction of the gap between MAC and NMN-Tree. Interestingly, we find that using the default high number of MAC units, namely 12, is helpful, possibly because it increases the likelihood that at least one unit converges to focus on X and $\mathrm { Y }$ words (see Appendix B for details). + +# 4.2 WHAT IS ESSENTIAL TO STRONG GENERALIZATION OF NMN? + +The superior generalization of NMN-Tree raises the following question: what is the key architectural difference between NMN-Tree and generic models that explains the performance gap between them? We consider two candidate explanations. First, the NMN-Tree model differs from the generic models in that it does not use a language encoder and is instead built from modules that are parametrized by question words directly. Second, NMN-Tree is structured in a particular way, with the idea that modules 1 and 2 may learn to locate objects and module 3 can learn to reason about object locations independently of their identities. To understand which of the two differences is responsible for the superior generalization, we compare the performance of the NMN-Tree, NMN-Chain and NMNChain-Shortcut models (see Figure 1). These 3 versions of NMN are similar in that none of them are using a language encoder, but they differ in how the modules are connected. The results in Figure 3 show that for both Find and Residual module architectures, using a tree layout is absolutely crucial (and sufficient) for generalization, meaning that the generalization gap between NMN-Tree and generic models can not be explained merely by the language encoding step in the latter. In particular, NMN-Chain models perform barely above random chance, doing even worse than generic models on the #rhs/lhs $^ { = 1 }$ version of the dataset and dramatically failing even on the easiest #rhs/lhs ${ } _ { = 1 8 }$ split. This is in stark contrast with NMN-Tree models that exhibits nearly perfect performance on the hardest #rhs/lh $^ { = 1 }$ split. As a sanity check we train NMN-Chain models on the vanilla #rhs/lhs ${ } = 3 5$ split. We find that NMN-Chain has little difficulty learning to answer SQOOP questions when it sees all of them at training time, even though it previously shows poor generalization when testing on unseen examples. Interestingly, NMN-Chain-Shortcut performs much better than NMN-Chain and quite similarly to generic models. We find it remarkable that such a slight change in the model layout as adding shortcut connections from image features $h _ { x }$ to the modules results in a drastic change in generalization performance. In an attempt to understand why NMN-Chain generalizes so poorly we compare the test set responses of the 5 NMN-Chain models trained on #rhs/lhs $^ { = 1 }$ split. Notably, there was very little agreement between predictions of these 5 runs (Fleiss $\kappa = 0 . 0 5$ ), suggesting that NMN-Chain performs rather randomly outside of the training set. + +![](images/3cdad88a68b9415ad79acd4f7060ea7047809e513858bf6df356b6913893c125.jpg) +Figure 3: Top: Comparing the performance of generic models on datasets of varying difficulty (lower #rhs/lhs is more difficult). Note that NMN-Tree generalizes perfectly on the hardest #rhs/lhs $^ { \dag = 1 }$ version of SQOOP, whereas MAC and FiLM fail to solve completely even the easiest #rhs/lhs ${ \it \Omega } = 1 8$ version. Bottom: Comparing NMNs with different layouts and modules. We can clearly observe the superior generalization of NMN-Tree, poor generalization of NMN-Chain and mediocre generalization of NMN-Chain-Shortcut. Means and standard deviations after at least 5 runs are reported. + +# 4.3 CAN THE RIGHT KIND OF NMN BE INDUCED? + +The strong generalization of the NMN-Tree is impressive, but a significant amount of prior knowledge about the task was required to come up with the successful layout and parametrization used in this model. We therefore investigate whether the amount of such prior knowledge can be reduced by fixing one of these structural aspects and inducing the other. + +# 4.3.1 LAYOUT INDUCTION + +In our layout induction experiments, we use the Stochastic N2NMN model which treats the layout as a stochastic latent variable with two values ( $T _ { t r e e }$ and $T _ { c h a i n }$ , see Section 3.2 for details). We experiment with N2NMNs using both Find and Residual modules and report results with different initial conditions, $p _ { 0 } ( t r e e ) \in 0 . 1 , 0 . 5 , 0 . 9$ . We believe that the initial probability $p _ { 0 } ( t r e e ) = 0 . 1$ should not be considered small, since in more challenging datasets the space of layouts would be exponentially large, and sampling the right layout in $10 \%$ of all cases should be considered a very lucky initialization. We repeat all experiments on #rhs/lhs $^ { = 1 }$ and on #rhs/lhs ${ \it \Omega } = 1 8$ splits, the former to study generalization, and the latter to control whether the failures on #rhs/lhs $^ { - 1 }$ are caused specifically by the difficulty of this split. The results (see Table 1) show that the success of layout induction (i.e. converging to a $p ( t r e e )$ close to 0.9) depends in a complex way on all the factors that we considered in our experiments. The initialization has the most influence: models initialized with $p _ { 0 } ( t r e e ) = 0 . 1$ typically do not converge to a tree (exception being experiments with Residual module on #rhs/lhs ${ } = 1 8$ , in which 3 out of 5 runs converged to a solution with a high $p ( t r e e ) )$ ). Likewise, models initialized with $p _ { 0 } ( t r e e ) = 0 . 9$ always stay in a regime with a high $p ( t r e e )$ . In the intermediate setting of $p _ { 0 } ( t r e e ) = 0 . 5$ we observe differences in behaviors for Residual and Find modules. In particular, N2NMN based on Residual modules stays spurious with $p ( t r e e ) = 0 . 5 \pm 0 . 0 8$ when #rhs/lhs $^ { \dag = 1 }$ , whereas N2NMN based on Find modules always converges to a tree. + +![](images/59c079636e0800b951a24de6c2ef0de6c4ad6cb384c912da8507a7dc1224bb65.jpg) + +![](images/e287b95b907bab018b1069114c6e8739f5d1b5bb8f48d4c6e80efdebefaddf63.jpg) + +![](images/f77da1b68c45336998c67b610a6137df0a8a3a098468e2964579bba5490e1349.jpg) +Figure 4: Learning dynamics of layout induction on 1 rhs/lhs and 18 rhs/lhs datasets using the Residual module with $p _ { 0 } ( t r e e ) =$ 0.5. All 5 runs do not learn to use the tree layout for 1 rhs/lhs, the very setting where the tree layout is necessary for generalization. +Figure 5: Attention quality $\kappa$ vs accuracy for Attention N2NMN models trained on different #rhs/lhs splits. We can observe that generalization is strongly associated with high $\kappa$ for #rhs/lhs $^ { = 1 }$ , while for splits with 2 and 18 rhs/lhs blurry attention may be sufficient. +Figure 6: An example of how attention weights of modules 1 (left), 2 (middle), and 3 (right) evolve during training of an Attention N2NMN model on the 18 rhs/lhs version of SQOOP. Modules 1 and 2 learn to focus on different objects words, X and $\mathrm { Y }$ respectively in this example, but they also assign high weight to the relation word R. Module 3 learns to focus exclusively on R. + +One counterintuitive result in Table 1 is that for the Stochastic N2NMNs with Residual modules, trained with $p _ { 0 } ( t r e e ) = 0 . 5$ and #rhs/lhs $^ { = 1 }$ , make just $1 . 6 4 { \pm } 1 . 7 9 \%$ test error despite never resolving the layout uncertainty through training $( p _ { 2 0 0 K } ( t r e e ) = 0 . 5 6 \pm 0 . 0 6 )$ . We offer an investigation of this result in Appendix C. + +# 4.3.2 PARAMETRIZATION INDUCTION + +Next, we experiment with the Attention N2NMN model (see Section 3.2) in which the parametrization is learned for each module as an attention-weighted average of word embeddings. In these experiments, we fix the layout to be tree-like and sample the pre-softmax attention weights $\tilde { \alpha }$ from a uniform distribution $U [ 0 ; 1 ]$ . As in the layout induction investigations, we experiment with several SQOOP splits, namely we try #rhs/lhs $\ r \in \{ 1 , 2 , 1 8 \}$ . The results (reported in Table 2) show that Attention N2NMN fails dramatically on #rhs/lhs=1 but quickly catches up as soon as #rhs/lhs is increased to 2. Notably, 9 out of 10 runs on #rhs/lhs $^ { = 2 }$ result in almost perfect performance, and 1 run completely fails to generalize ( $2 6 \%$ error rate), resulting in a high $8 . 1 8 \%$ variance of the mean error rate. All 10 runs on the split with 18 rhs/lhs generalize flawlessly. Furthermore, we inspect the learned attention weights and find that for typical successful runs, module 3 focuses on the relation word, whereas modules 1 and 2 focus on different object words (see Figure 6) while still focusing on the relation word. To better understand the relationship between successful layout induction and generalization, we define an attention quality metric $\begin{array} { r } { \kappa = \operatorname* { m i n } _ { w \in \{ X , Y \} } \operatorname* { m a x } _ { k \in 1 , 2 } \alpha _ { k , w } / ( 1 - \alpha _ { k , R } ) } \end{array}$ . Intuitively, $\kappa$ is large when for each word $w \in X , Y$ there is a module $i$ that focuses mostly on this word. The renormalization by $1 / ( 1 - \alpha _ { k , R } )$ is necessary to factor out the amount of attention that modules 1 and 2 assign to the relation word. For the ground-truth parametrization that we use for NMN-Tree $\kappa$ takes a value of 1, and if both modules 1 and 2 focus on X, completely ignoring Y, $\kappa$ equals 0. The scatterplot of the test error rate versus $\kappa$ (Figure 5) shows that for #rhs/lhs $^ { = 1 }$ high generalization is strongly associated with higher $\kappa$ , meaning that it is indeed necessary to have different modules strongly focusing on different object words in order to generalize in this most challenging setting. Interestingly, for #rhs/lhs $^ { = 2 }$ we see a lot of cases where N2NMN generalizes well despite attention being rather spurious $( \kappa \approx 0 . 6 $ ). + +Table 1: Tree layout induction results for Stochastic N2NMNs using Residual and Find modules on 1 rhs/lhs and 18 rhs/lhs datasets. For each setting of $p _ { 0 } ( t r e e )$ we report results after 5 runs. $p _ { 2 0 0 K } ( t r e e )$ is the probability of using a tree layout after 200K training iterations. + +
module#rhs/lhspo(tree)Test error rate (%)Test lossp200k(tree)
Residual10.131.89 ± 0.750.64±0.030.08±0.01
0.51.64 ± 1.790.27 ± 0.040.56 ±0.06
0.90.16 ± 0.110.03 ±0.010.96 ±0.00
180.13.99 ± 5.330.15 ±0.060.59±0.34
0.50.19 ±0.110.06±0.020.99 ±0.01
0.90.12 ±0.120.01 ±0.001.00 ± 0.00
Find10.147.54± 0.951.78 ± 0.470.00±0.00
0.50.78 ±0.520.05 ± 0.040.94±0.07
0.90.41 ± 0.070.02±0.001.00 ±0.00
180.15.11 ± 1.190.14±0.030.02±0.04
0.50.17 ± 0.160.01±0.011.00 ±0.00
0.90.11 ± 0.030.00±0.001.00 ± 0.00
+ +Table 2: Parameterization induction results for 1,2,18 rhs/lhs datasets for Attention N2NMN. The model does not generalize well in the difficult 1 rhs/lhs setting. Results for MAC are presented for comparison. Means and standard deviations were estimated based on at least 10 runs. + +
Model#rhs/lhsTest error rate (%)Test loss (%)
AttentionN2NMN127.19±16.021.22 ± 0.71
Attention N2NMN22.82 ±8.180.14 ± 0.41
Attention N2NMN180.16 ± 0.120.00±0.00
MAC113.67± 9.970.41 ± 0.32
MAC29.21 ± 4.310.28 ± 0.15
MAC180.53 ± 0.740.01 ±0.02
+ +In order to put Attention N2NMN results in context we compare them to those of MAC (see Table 2). Such a comparison can be of interest because both models perform attention over the question. For 1 rhs/lhs MAC seems to be better on average, but as we increase #rhs/lhs to 2 we note that Attention N2NMN succeeds in 9 out of 10 cases on the #rhs/lh $^ { \circ 2 }$ split, much more often than 1 success out of 10 observed for $\mathbf { M A C }$ . This result suggests that Attention N2NMNs retains some of the strong generalization potential of NMNs with hard-coded parametrization. + +# 5 RELATED WORK + +The notion of systematicity was originally introduced by (Fodor & Pylyshyn, 1988) as the property of human cognition whereby “the ability to entertain a given thought implies the ability to entertain thoughts with semantically related contents”. They illustrate this with an example that no English speaker can understand the phrase “John loves the girl” without being also able to understand the phrase “the girl loves John”. The question of whether or not connectionist models of cognition can account for the systematicity phenomenon has been a subject of a long debate in cognitive science (Fodor & Pylyshyn, 1988; Smolensky, 1987; Marcus, 1998; 2003; Calvo & Colunga, 2003). Recent research has shown that lack of systematicity in the generalization is still a concern for the modern seq2seq models (Lake & Baroni, 2018; Bastings et al., 2018; Loula et al., 2018). Our findings about the weak systematic generalization of generic VQA models corroborate the aforementioned seq2seq results. We also go beyond merely stating negative generalization results and showcase the high systematicity potential of adding explicit modularity and structure to modern deep learning models. + +Besides the theoretical appeal of systematicity, our study is inspired by highly related prior evidence that when trained on downstream language understanding tasks, neural networks often generalize poorly and latch on to dataset-specific regularities. Agrawal et al. (2016) report how neural models exploit biases in a VQA dataset, e.g. responding “snow” to the question “what covers the ground” regardless of the image because “snow” is the most common answer to this question. Gururangan et al. (2018) report that many successes in natural language entailment are actually due to exploiting statistical biases as opposed to solving entailment, and that state-of-the-art systems are much less performant when tested on unbiased data. Jia & Liang (2017) demonstrate that seemingly state-ofthe-art reading comprehension system can be misled by simply appending an unrelated sentence that resembles the question to the document. + +Using synthetic VQA datasets to study grounded language understanding is a recent trend started by the CLEVR dataset (Johnson et al., 2016). CLEVR images are 3D-rendered and CLEVR questions are longer and more complex than ours, but in the associated generalization split CLEVR-CoGenT the training and test distributions of images are different. In our design of SQOOP we aimed instead to minimize the difference between training and test images to make sure that we test a model’s ability to interpret unknown combinations of known words. The ShapeWorld family of datasets by Kuhnle & Copestake (2017) is another synthetic VQA platform with a number of generalization tests, but none of them tests SQOOP-style generalization of relational reasoning to unseen object pairs. Most closely related to our work is the recent study of generalization to long-tail questions about rare objects done by Bingham et al. (2017). They do not, however, consider as many models as we do and do not study the question of whether the best-performing models can be made end-to-end. + +The key paradigm that we test in our experiments is Neural Module Networks (NMN). Andreas et al. (2016) introduced NMNs as a modular, structured VQA model where a fixed number of handcrafted neural modules (such as Find, or Compare) are chosen and composed together in a layout determined by the dependency parse of the question. Andreas et al. (2016) show that the modular structure allows answering questions that are longer than the training ones, a kind of generalization that is complementary to the one we study here. Hu et al. (2017) and Johnson et al. (2017) followed up by making NMNs end-to-end, removing the non-differentiable parser. Both Hu et al. (2017) and Johnson et al. (2017) reported that several thousands of ground-truth layouts are required to pretrain the layout predictor in order for their approaches to work. In a recent work, Hu et al. (2018) attempt to soften the layout decisions, but training their models end-to-end from scratch performed substantially lower than best models on the CLEVR task. Gupta & Lewis (2018) report successful layout induction on CLEVR for a carefully engineered heterogeneous NMN that takes a scene graph as opposed to a raw image as the input. + +# 6 CONCLUSION AND DISCUSSION + +We have conducted a rigorous investigation of an important form of systematic generalization required for grounded language understanding: the ability to reason about all possible pairs of objects despite being trained on a small subset of such pairs. Our results allow one to draw two important conclusions. For one, the intuitive appeal of modularity and structure in designing neural architectures for language understanding is now supported by our results, which show how a modular model consisting of general purpose residual blocks generalizes much better than a number of baselines, including architectures such as MAC, FiLM and RelNet that were designed specifically for visual reasoning. While this may seem unsurprising, to the best of our knowledge, the literature has lacked such a clear empirical evidence in favor of modular and structured networks before this work. Importantly, we have also shown how sensitive the high performance of the modular models is to the layout of modules, and how a tree-like structure generalizes much stronger than a typical chain of layers. + +Our second key conclusion is that coming up with an end-to-end and/or soft version of modular models may be not sufficient for strong generalization. In the very setting where strong generalization is required, end-to-end methods often converge to a different, less compositional solution (e.g. a chain layout or blurred attention). This can be observed especially clearly in our NMN layout and parametrization induction experiments on the #rhs/lhs $^ { = 1 }$ version of SQOOP, but notably, strong initialization sensitivity of layout induction remains an issue even on the #rhs/lhs ${ } _ { = 1 8 }$ split. This conclusion is relevant in the view of recent work in the direction of making NMNs more end-toend (Suarez et al., 2018; Hu et al., 2018; Hudson & Manning, 2018; Gupta & Lewis, 2018). Our findings suggest that merely replacing hard-coded components with learnable counterparts can be insufficient, and that research on regularizers or priors that steer the learning towards more systematic solutions can be required. That said, our parametrization induction results on the #rhs/lhs $^ { = 2 }$ split are encouraging, as they show that compared to generic models, a weaker nudge (in the form of a richer training signal or a prior) towards systematicity may suffice for end-to-end NMNs. + +While our investigation has been performed on a synthetic dataset, we believe that it is the realworld language understanding where our findings may be most relevant. It is possible to construct a synthetic dataset that is bias-free and that can only be solved if the model has understood the entirety of the dataset’s language. It is, on the contrary, much harder to collect real-world datasets that do not permit highly dataset-specific solutions, as numerous dataset analysis papers of recent years have shown (see Section 5 for a review). We believe that approaches that can generalize strongly from imperfect and biased data will likely be required, and our experiments can be seen as a simulation of such a scenario. We hope, therefore, that our findings will inform researchers working on language understanding and provide them with a useful intuition about what facilitates strong generalization and what is likely to inhibit it. + +# ACKNOWLEDGEMENTS + +We thank Maxime Chevalier-Boisvert, Yoshua Bengio and Jacob Andreas for useful discussions. This research was enabled in part by support provided by Compute Canada (www.computecanada.ca), NSERC, Canada Research Chairs and Microsoft Research. We also thank Nvidia for donating NVIDIA DGX-1 used for this research. + +# REFERENCES + +Aishwarya Agrawal, Dhruv Batra, and Devi Parikh. Analyzing the Behavior of Visual Question Answering Models. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, January 2016. +Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural Module Networks. In Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. URL http://arxiv.org/abs/1511.02799. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural Machine Translation by Jointly Learning to Align and Translate. In Proceedings of the 2015 International Conference on Learning Representations, 2015. +Joost Bastings, Marco Baroni, Jason Weston, Kyunghyun Cho, and Douwe Kiela. Jump to better conclusions: SCAN both left and right. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 47–55, Brussels, Belgium, November 2018. Association for Computational Linguistics. URL https://www.aclweb. org/anthology/W18-5407. +Eli Bingham, Piero Molino, Paul Szerlip, Obermeyer Fritz, and Goodman Noah. Characterizing how Visual Question Answering scales with the world. In NIPS 2017 Visually-Grounded Interaction and Language Workshop, 2017. +Francisco Calvo and Eliana Colunga. The statistical brain: Reply to Marcus The algebraic mind. In Proceedings of the Annual Meeting of the Cognitive Science Society, volume 25, 2003. + +Jerry A. Fodor and Zenon W. Pylyshyn. Connectionism and cognitive architecture: A critical analysis. Cognition, 28(1):3–71, 1988. + +Alexander L. Gaunt, Marc Brockschmidt, Nate Kushman, and Daniel Tarlow. Differentiable Programs with Neural Libraries. In Proceedings of the 34th International Conference on Machine Learning, November 2016. URL http://arxiv.org/abs/1611.02109. arXiv: 1611.02109. + +Yichen Gong, Heng Luo, and Jian Zhang. Natural Language Inference over Interaction Space. In Proceedings of the 2018 International Conference on Learning Representations, 2017. URL http://arxiv.org/abs/1709.04348. arXiv: 1709.04348. + +Nitish Gupta and Mike Lewis. Neural Compositional Denotational Semantics for Question Answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 2018. URL http://aclweb.org/ anthology/D18-1239. + +Suchin Gururangan, Swabha Swayamdipta, Omer Levy, Roy Schwartz, Samuel R. Bowman, and Noah A. Smith. Annotation Artifacts in Natural Language Inference Data. In Proceedings of NAACL-HLT 2018, March 2018. URL http://arxiv.org/abs/1803.02324. arXiv: 1803.02324. + +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, 2016. + +Ronghang Hu, Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Kate Saenko. Learning to Reason: End-to-End Module Networks for Visual Question Answering. In Proceedings of 2017 IEEE International Conference on Computer Vision, April 2017. URL http://arxiv.org/ abs/1704.05526. arXiv: 1704.05526. + +Ronghang Hu, Jacob Andreas, Trevor Darrell, and Kate Saenko. Explainable Neural Computation via Stack Neural Module Networks. In Proceedings of 2018 European Conference on Computer Vision, July 2018. URL http://arxiv.org/abs/1807.08556. arXiv: 1807.08556. + +Drew A. Hudson and Christopher D. Manning. Compositional Attention Networks for Machine Reasoning. In Proceedings of the 2018 International Conference on Learning Representations, February 2018. URL https://openreview.net/forum?id=S1Euwz-Rb. + +Sergey Ioffe and Christian Szegedy. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. In Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, pp. 448–456, 2015. URL http: //jmlr.org/proceedings/papers/v37/ioffe15.html. + +Robin Jia and Percy Liang. Adversarial Examples for Evaluating Reading Comprehension Systems. Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2021–2031, 2017. doi: 10.18653/v1/D17-1215. URL https://aclanthology.coli. uni-saarland.de/papers/D17-1215/d17-1215. + +Yu Jiang, Vivek Natarajan, Xinlei Chen, Marcus Rohrbach, Dhruv Batra, and Devi Parikh. Pythia v0.1: The winning entry to the vqa challenge 2018. https://github.com/ facebookresearch/pythia, 2018. + +Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C. Lawrence Zitnick, and Ross Girshick. CLEVR: A Diagnostic Dataset for Compositional Language and Elementary Visual Reasoning. In Proceedings of 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), December 2016. URL http://arxiv.org/abs/1612.06890. arXiv: 1612.06890. + +Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Judy Hoffman, Li Fei-Fei, C. Lawrence Zitnick, and Ross Girshick. Inferring and Executing Programs for Visual Reasoning. In Proceedings of 2017 IEEE International Conference on Computer Vision, 2017. URL http: //arxiv.org/abs/1705.03633. + +Anjuli Kannan, Karol Kurach, Sujith Ravi, Tobias Kaufmann, Andrew Tomkins, Balint Miklos, Greg Corrado, Laszlo Lukacs, Marina Ganea, Peter Young, and Vivek Ramavajjala. Smart Reply: Automated Response Suggestion for Email. In Proceedings of the 22Nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’16, pp. 955–964, New York, NY, USA, 2016. ACM. ISBN 978-1-4503-4232-2. doi: 10.1145/2939672.2939801. URL http://doi.acm.org/10.1145/2939672.2939801. + +Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. In Proceedings of the 2015 International Conference on Learning Representations, 2015. URL http://arxiv. org/abs/1412.6980. arXiv: 1412.6980. + +Alexander Kuhnle and Ann Copestake. ShapeWorld - A new test methodology for multimodal language understanding. arXiv:1704.04517 [cs], April 2017. URL http://arxiv.org/ abs/1704.04517. arXiv: 1704.04517. + +Brenden M. Lake and Marco Baroni. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In Proceedings of the 36th International Conference on Machine Learning, 2018. URL http://arxiv.org/abs/1711.00350. arXiv: 1711.00350. + +Joao Loula, Marco Baroni, and Brenden M. Lake. Rearranging the Familiar: Testing Compositional Generalization in Recurrent Networks. In Proceedings of the 2018 BlackboxNLP EMNLP Workshop, July 2018. URL https://arxiv.org/abs/1807.07545. + +Mateusz Malinowski and Mario Fritz. A Multi-world Approach to Question Answering About Realworld Scenes Based on Uncertain Input. In Proceedings of the 27th International Conference on Neural Information Processing Systems, NIPS’14, pp. 1682–1690, Cambridge, MA, USA, 2014. MIT Press. URL http://dl.acm.org/citation.cfm?id=2968826.2969014. + +Gary F. Marcus. Rethinking Eliminative Connectionism. Cognitive Psychology, 37(3):243–282, December 1998. ISSN 0010-0285. doi: 10.1006/cogp.1998.0694. URL http://www. sciencedirect.com/science/article/pii/S0010028598906946. + +Gary F. Marcus. The algebraic mind: Integrating connectionism and cognitive science. MIT press, 2003. + +Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. FiLM: Visual Reasoning with a General Conditioning Layer. In In Proceedings of the 2017 AAAI Conference on Artificial Intelligence, 2017. URL http://arxiv.org/abs/1709.07871. + +Adam Santoro, David Raposo, David G. T. Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. In Advances in Neural Information Processing Systems 31, June 2017. URL http://arxiv. org/abs/1706.01427. arXiv: 1706.01427. + +Paul Smolensky. The constituent structure of connectionist mental states: A reply to Fodor and Pylyshyn. Southern Journal of Philosophy, 26(Supplement):137–161, 1987. + +Joseph Suarez, Justin Johnson, and Fei-Fei Li. DDRprog: A CLEVR Differentiable Dynamic Reasoning Programmer. arXiv:1803.11361 [cs], March 2018. URL http://arxiv.org/abs/ 1803.11361. arXiv: 1803.11361. + +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to Sequence Learning with Neural Networks. In Advances in Neural Information Processing Systems 27, pp. 3104–3112, 2014. + +Wei Wang, Ming Yan, and Chen Wu. Multi-Granularity Hierarchical Attention Fusion Networks for Reading Comprehension and Question Answering. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1705–1714, Melbourne, Australia, 2018. Association for Computational Linguistics. URL http://aclweb.org/anthology/P18-1158. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, and others. Google’s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation. arXiv preprint arXiv:1609.08144, 2016. + +# A EXPERIMENT DETAILS + +We trained all models by minimizing the cross entropy loss $\log p ( y | x , q )$ on the training set, where $y ~ \in ~ \{ \mathrm { y e s } , \mathrm { n o } \}$ is the correct answer, $x$ is the image, $q$ is the question. In all our experiments we used the Adam optimizer (Kingma & Ba, 2015) with hyperparameters $\alpha = 0 . 0 0 0 1$ , $\bar { \beta } _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 9$ , $\epsilon = 1 0 ^ { - \mathrm { { 1 0 } } }$ . We continuously monitored validation set performance of all models during training, selected the best one and reported its performance on the test set. The number of training iterations for each model was selected in preliminary investigations based on our observations of how long it takes for different models to converge. This information, as well as other training details, can be found in Table 3. + +Table 3: Training details for all models. The subsampling factor is the ratio between the original spatial dimensions of the input image and those of the representation produced by the stem. It is effectively equal to $2 ^ { k }$ , where $k$ is the number of $2 \mathrm { x 2 }$ max-pooling operations in the stem. + +
modelstem layerssubsampling factoriterationsbatch size
FiLM6420000064
MAC64100000128
Conv+LSTM64200000128
RelNet8850000064
NMN (Residual)645000064
NMN (Find)6420000064
Stochastic NMN (Residual)6420000064
Stochastic NMN (Find)6420000064
Attention NMN (Find)645000064
+ +# B ADDITIONAL RESULTS FOR MAC MODEL + +We performed an ablation study in which we varied the number of MAC units, the model dimensionality and the level of weight decay for the MAC model. The results can be found in Table 4. + +Table 4: Results of an ablation study for MAC. The default model has 12 MAC units of dimensionality 128 and uses no weight decay. For each experiment we report means and standard deviations based on 5 repetitions. + +
model#rhs/lhstrain error rate(%)test error rate (%)
default10.17± 0.2113.67 ± 9.97
1 unit10.27 ± 0.3528.67 ± 1.91
2 units10.23 ± 0.1324.28 ± 2.05
3units10.16 ±0.1526.47 ± 1.12
6units10.18 ±0.1720.84± 5.56
24 units10.04± 0.059.11 ± 7.67
dim. 6410.27 ± 0.3323.61 ± 6.27
dim. 25610.00 ±0.004.62 ± 5.07
dim. 51210.02 ±0.048.37 ± 7.45
weight decay 0.0000110.20 ±0.2319.21 ± 9.27
weight decay 0.00011.00 ± 0.5431.19 ± 0.87
weight decay 0.00140.55 ± 1.3545.11 ± 0.74
+ +We also perform qualitative investigations to understand the high variance in MAC’s performance. In particular, we focus on control attention weights $( c )$ for each run and aim to understand if runs that generalize have clear differences when compared to runs that failed. Interestingly, we observe that in successful runs each word $w \in \mathrm { X }$ , Y has a unit that is strongly focused on it. To present our observations in quantitative terms, we plot attention quality $\begin{array} { r } { \kappa = \operatorname* { m i n } _ { w \in \{ X , Y \} } \operatorname* { m a x } _ { k \in [ 1 ; 1 2 ] } } \end{array}$ $\alpha _ { k , w } / ( 1 - \alpha _ { k , R } )$ , where $\alpha$ are control scores vs accuracy in Figure 7 for each run (see Section 4.3.2 for an explanation of $\kappa$ ). We can clearly see a positive correlation between $\kappa$ and error rate, especially for low #rhs/lhs. + +![](images/b17fd2a3fccb5785bed74fbb94af302295cb1a6524c63aab5f7015046190a9ea.jpg) +Figure 7: Model test accuracy vs $\kappa$ for the MAC model on different versions of SQOOP. All experiments are run 10 times with different random seeds. We can observe a clear correlation between $\kappa$ and error rate for 1, 2 and 4 rhs/lhs. Also note that perfect generalization is always associated with $\kappa$ close to 1. + +Next, we experiment with a hard-coded variation of MAC. In this model, we use hard-coded control scores such that given a SQOOP question X R Y, the first half of all modules focuses on X while the second half focuses on Y. The relationship between MAC and hardcoded MAC is similar to that between NMN-Tree and end-to-end NMN with parameterization induction. However, this model has not performed as well as the successful runs of MAC. We hypothesize that this could be due to the interactions between the control scores and the visual attention part of the model. + +# C INVESTIGATION OF CORRECT PREDICTIONS WITH SPURIOUS LAYOUTS + +In Section 4.3.1 we observed that an NMN with the Residual module can answer test questions with a relative low error rate of $1 . 6 4 \pm 1 . 7 9 \%$ , despite being a mixture of a tree and a chain (see results in Table 1, $p _ { 0 } ( t r e e ) = 0 . 5 )$ . Our explanation for this phenomenon is as follows: when connected in a tree, modules of such spurious models generalize well, and when connected as a chain they generalize poorly. The output distribution of the whole model is thus a mixture of the mostly correct $p ( y | T \stackrel { } { = } T _ { t r e e } , x , q )$ and mostly random $p ( y | T = T _ { c h a i n } , x , q )$ . We verify our reasoning by explicitly evaluating test accuracies for $p ( y | T = T _ { t r e e } , x , q )$ and $p ( y | T = T _ { c h a i n } , x , q )$ , and find them to be around $9 9 \%$ and $6 0 \%$ respectively, confirming our hypothesis. As a result the predictions of the spurious models with $p ( t r e e ) \approx 0 . 5$ have lower confidence than those of sharp tree models, as indicated by the high log loss of $0 . 2 7 \pm 0 . 0 4$ . We visualize the progress of structure induction for the Residual module with $p _ { 0 } ( t r e e ) = 0 . 5$ in Figure 4 which shows how $p ( t r e e )$ saturates to 1.0 for #rhs/lhs ${ } = 1 8$ and remains around 0.5 when #rhs/lhs $^ { = 1 }$ . + +# D SQOOP PSEUDOCODE + +# Algorithm 1 Pseudocode for creating SQOOP + +1: $S \gets \{ \mathrm { A , B , C , \dots , Z , 0 , 1 , 2 , 3 , \dots , 9 } \}$ +2: Rel ← {LEFT-OF, RIGHT-OF, ABOVE, BELOW} . relations +3: function CREATESQOOP(k) +4: T rainQuestions ← [] +5: AllQuestions ← [] +6: for all $X$ in $S$ do +7: AllRhs ← RandomSample $( S \setminus \{ X \} , \mathbf { k } )$ $\triangleright$ sample without replacement from $S \setminus \{ X \}$ +8: $A l l Q u e s t i o n s \gets \{ X \} \times R e l \times ( S \setminus \{ X \} ) \cup A l l Q u e s t i o n$ s +9: for all $R , Y$ in $A l l R h s \times R e l$ do +10: T rainQuestions $ ( X , R , Y ) \cup T$ rainQuestions +11: end for +12: end for +13: T estQuestions ← AllQuestions \ T rainQuestions +14: function GENERATEEXAMPLE $( X , R , Y )$ +15: $a \sim \{ \mathrm { Y e s } , \mathrm { N o } \}$ +16: if $a = \mathrm { Y e s }$ then +17: $I $ place $X$ and $Y$ objects so that $R$ holds $\triangleright$ create the image +18: $I $ sample 3 objects from $S$ and add to $I$ +19: else +20: repeat +21: $X ^ { \prime } \gets$ Sample $X ^ { \prime }$ from $S \setminus \{ X \}$ +22: $Y ^ { \prime } \gets \boldsymbol { \mathsf { S } }$ ample $Y ^ { \prime }$ from $S \backslash \{ Y \}$ +23: $I $ place $X ^ { \prime }$ and $Y$ objects so that $R$ holds . create the image +24: $I $ add $X$ and $Y ^ { \prime }$ objects to $I$ so that $R$ holds +25: $I $ sample 1 more object from $S$ and add to $I$ +26: until $X$ and $Y$ are not in relation $R$ in I +27: end if +28: return $I , X , R , Y , a$ +29: end function +30: T rain $\gets$ sample $ | \underset { -- } { \underbrace { 1 0 ^ { 6 } } } | \underset { -- } { \underbrace { T r a i n Q u e s t i o n s } } |$ examples for each (X,R,Y) T rainQuestions from +GENERATEEXAMPLE $( X , R , Y )$ +31: $T e s t \gets$ sample 10 examples for each (X,R,Y) T estQuestions from GENERATEEXAM +$\mathrm { P L E } ( X , R , Y )$ +32: end function \ No newline at end of file diff --git a/md/train/HkgHk3RctX/HkgHk3RctX.md b/md/train/HkgHk3RctX/HkgHk3RctX.md new file mode 100644 index 0000000000000000000000000000000000000000..72517e50e27c3d7eeb89ceac80b39efae81f1cf2 --- /dev/null +++ b/md/train/HkgHk3RctX/HkgHk3RctX.md @@ -0,0 +1,286 @@ +# SEQ2SLATE: RE-RANKING AND SLATE OPTIMIZATION WITH RNNS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Ranking is a central task in machine learning and information retrieval. In this task, it is especially important to present the user with a slate of items that is appealing as a whole. This in turn requires taking into account interactions between items, since intuitively, placing an item on the slate affects the decision of which other items should be placed alongside it. In this work, we propose a sequence-to-sequence model for ranking called seq2slate. At each step, the model predicts the next item to place on the slate given the items already selected. The recurrent nature of the model allows complex dependencies between items to be captured directly in a flexible and scalable way. We show how to learn the model end-to-end from weak supervision in the form of easily obtained click-through data. We further demonstrate the usefulness of our approach in experiments on standard ranking benchmarks as well as in a real-world recommendation system. + +# 1 INTRODUCTION + +Ranking a set of candidate items is a central task in machine learning and information retrieval. Many existing ranking systems are based on pointwise estimators, where the model assigns a score to each item in a candidate set and the resulting slate is obtained by sorting the list according to item scores (Liu et al., 2009). Such models are usually trained from click-through data to optimize an appropriate loss function (Joachims, 2002). This simple approach is computationally attractive as it only requires a sort operation over the candidate set at test (or serving) time, and can therefore scale to large problems. On the other hand, in terms of modeling, pointwise rankers cannot easily express dependencies between ranked items. In particular, the score of an item (e.g., its probability of being clicked) often depends on the other items in the slate and their joint placement. Such interactions between items can be especially dominant in the common case where display area is limited or when strong position bias is present, so that only a few highly ranked items get the user’s attention. In this case it may be preferable, for example, to present a diverse set of items at the top positions of the slate in order to cover a wider range of user interests. + +A significant amount of work on learning-to-rank does consider interactions between ranked items when training the model. In pairwise approaches a classifier is trained to determine which item should be ranked first within a pair of items (e.g., Herbrich et al., 1999; Joachims, 2002; Burges et al., 2005). Similarly, in listwise approaches the loss depends on the full permutation of items (e.g., Cao et al., 2007; Yue et al., 2007). Although these losses consider inter-item dependencies, the ranking function itself is pointwise, so at inference time the model still assigns a score to each item which does not depend on scores of other items. + +There has been some work on trying to capture interactions between items in the ranking scores themselves (e.g., Qin et al., 2008; 2009; Zhu et al., 2014; Rosenfeld et al., 2014; Dokania et al., 2014). Such approaches can, for example, encourage a pair of items to appear next to (or far from) each other in the resulting ranking. Approaches of this type often assume that the relationship between items takes a simple form (e.g., submodular) in order to obtain tractable inference and learning algorithms. Unfortunately, this comes at the expense of the model’s expressive power. + +In this paper, we present a general, scalable approach to ranking, which naturally accounts for high-order interactions. In particular, we apply a sequence-to-sequence (seq2seq) model (Sutskever et al., 2014) to the ranking task, where the input is the list of candidate items and the output is the resulting ordering. Since the output sequence corresponds to ranked items on the slate, we call this model sequence-to-slate (seq2slate). The order in which the input is processed can significantly affect the performance of such models (Vinyals et al., 2016). For this reason, we often assume the availability of a base (or “production”) ranker with which the input sequence is ordered (e.g., a simple pointwise method that ignores the interactions we seek to model), and view the output of our model as a re-ranking of the items. + +![](images/a577f1fca04cfb32a57bc7e32e0e69b3648831ea94ec93b3956f2fb540b63a10.jpg) +Figure 1: The seq2slate pointer network architecture for ranking. + +To address the seq2seq problem, we build on the recent success of recurrent neural networks (RNNs) in a wide range of applications (e.g., Sutskever et al., 2014). This allows us to use a deep model to capture rich dependencies between ranked items, while keeping the computational cost of inference manageable. More specifically, we use pointer networks, which are seq2seq models with an attention mechanism for pointing at positions in the input (Vinyals et al., 2015b). We show how to train the network end-to-end to directly optimize several commonly used ranking measures. To this end, we adapt RNN training to use weak supervision in the form of click-through data obtained from logs, instead of relying on ground-truth rankings, which are much more expensive to obtain. Finally, we demonstrate the usefulness of the proposed approach in a number of learning-to-rank benchmarks and in a large-scale, real-world recommendeation system. + +# 2 RANKING AND SLATE OPTIMIZATION AS SEQUENCE PREDICTION + +The ranking problem is that of computing a ranking of a set of items (or ordered list or slate) given some query or context. We formalize the problem as follows. Assume a set of $n$ items, each represented by a feature vector $x _ { i } \in \mathbb { R } ^ { m }$ (which may depend on a query or context). Let $\pi \in \Pi$ denote a permutation of the items, where each $\pi _ { j } \in \{ 1 , \ldots , n \}$ denotes the index of the item in position $j$ . Our goal is to predict the output ranking $\pi$ given the input items $x$ . For instance, given a specific user query, we might want to return an ordered set of music recommendations from a set of candidates that maximizes some measure of user engagement (e.g., number of tracks played). + +In the seq2seq framework, the probability of an output permutation, or slate, given the inputs is expressed as a product of conditional probabilities according to the chain rule: + +$$ +p ( \pi | x ) = \prod _ { j = 1 } ^ { n } p ( \pi _ { j } | \pi _ { 1 } , \dots , \pi _ { j - 1 } , x ) \ , +$$ + +This expression is completely general and does not make any conditional independence assumptions. In our case, the conditional $p ( \pi _ { j } | \pi _ { < j } , x ) \in \Delta ^ { n }$ (a point in the $n$ -dimensional simplex) models the probability of any item being placed at the $j$ ’th position in the ranking given the items already placed at previous positions. Therefore, this conditional exactly captures all high-order dependencies between items in the ranked list, including those due to diversity, similarity or other interactions. + +Our setting is somewhat different than a standard seq2seq setting in that the output vocabulary is not fixed. In particular, the same index (position) is populated by different items in different instances (queries). Indeed, the vocabulary size $n$ itself may vary per instance in the common case where the number of items to rank can change. This is precisely the problem addressed by pointer networks, which we review next. + +# POINTER-NETWORK ARCHITECTURE FOR RANKING + +We employ the pointer-network architecture of Vinyals et al. (2015b) to model the conditional $p ( \pi _ { j } | \pi _ { < j } ^ { - } , \stackrel { . } { x } )$ . A pointer network uses non-parametric softmax modules, akin to the attention mechanism of Bahdanau et al. (2015), and learns to point to items in its input sequence rather than predicting an index from a fixed-sized vocabulary. + +Our seq2slate model, illustrated in Fig. 1, consists of two recurrent neural networks (RNNs): an encoder and a decoder, both of which use Long Short-term Memory (LSTM) cells (Hochreiter and Schmidhuber, 1997). At each encoding step $i \leq n$ , the encoder RNN reads the input vector $x _ { i }$ and outputs a $d$ -dimensional vector $e _ { i }$ , thus transforming the input sequence $\{ x _ { i } \} _ { i = 1 } ^ { n }$ into a sequence of latent memory states $\{ e _ { i } \} _ { i = 1 } ^ { n }$ . At each decoding step $j$ , the decoder RNN outputs a $d$ -dimensional vector $d _ { j }$ which is used as a query in our attention function. The attention function takes as input the query $d _ { j } \in \mathbb { R } ^ { d }$ and the set of latent memory states computed by the encoder $\{ e _ { i } \} _ { i = 1 } ^ { n }$ and produces a probability distribution over the next item to include in the output sequence as follows: + +$$ +\begin{array} { r l r } & { s _ { i } ^ { j } = v ^ { \top } \operatorname { t a n h } \left( W _ { e n c } \cdot e _ { i } + W _ { d e c } \cdot d _ { j } \right) } \\ & { p _ { \theta } ( \pi _ { j } = i | \pi _ { < j } , x ) \equiv p _ { i } ^ { j } = \left\{ \begin{array} { l l } { e ^ { s _ { i } ^ { j } } / \sum _ { k \notin \pi _ { < j } } e ^ { s _ { k } ^ { j } } } & { \mathrm { i f ~ } i \notin \pi _ { < j } } \\ { 0 } & { \mathrm { i f ~ } i \in \pi _ { < j } } \end{array} \right. } & { , } \end{array} +$$ + +where $W _ { e n c } , W _ { d e c } \in \mathbb { R } ^ { d \times d }$ and $v \in \mathbb { R } ^ { d }$ are learned parameters in our network, denoted collectively by parameter vector $\theta$ . The probability $p _ { i } ^ { j } = p _ { \theta } ( \pi _ { j } = i | \pi _ { < j } , x )$ , is obtained via a softmax over the remaining items and represents the degree to which the model points to input $i$ at decoding step $j$ . To output a permutation, the $p _ { i } ^ { j }$ are set to 0 for items $i$ that already appear in the slate. Once the next item $\pi _ { j }$ is selected, typically greedily or by sampling (see below), its embedding $x _ { \pi _ { j } }$ is fed as input to the next decoder step. The input of the first decoder step is a learned $d$ -dimensional vector, denoted as $g o$ in Fig. 1. Importantly, $p _ { \theta } ( \pi | x )$ is differentiable for ant fixed permutation $\pi$ which allows gradient-based learning (see Section 3). + +We note the following. (i) The model makes no explicit assumptions about the type of interactions between items. If the learned conditional in Eq. (2) is close to the true conditional in Eq. (1), then the model can capture rich interactions—including diversity, similarity or others. We demonstrate this flexibility in our experiments (Section 4). (ii) $x$ can represent either raw inputs or embeddings thereof, which can be learned together with the sequence model. (iii) The computational cost of inference, dominated by the sequential decoding procedure, is $O ( n ^ { 2 } )$ , which is standard in seq2seq models with attention. We also consider a computationally cheaper single-step decoder with linear cost $O ( n )$ , which outputs a single vector $p ^ { 1 }$ , from which we obtain $\pi$ by sorting the values (similarly to pointwise ranking). + +# 3 TRAINING WITH CLICK-THROUGH DATA + +We now turn to the task of training the seq2slate model from data. A typical approach to learning in ranking systems is to run an existing ranker “in the wild” and log click-through data, which are then used to train an improved ranking model. This type of training data is relatively inexpensive to obtain, in contrast to human-curated labels such as relevance scores, ratings, or rankings (Joachims, 2002). + +Formally, each training example consists of a sequence of items $\{ x _ { 1 } , \ldots , x _ { n } \}$ and binary labels $\left( y _ { 1 } , \ldots , y _ { n } \right)$ , with $y _ { i } \in \{ 0 , 1 \}$ , representing user feedback (e.g., click/no-click). Our approach easily extends to more informative feedback, such as the level of user engagement with the chosen item (e.g., time spent), but to simplify the presentation we focus on the binary case. Our goal is to learn the parameters $\theta$ of $p _ { \theta } ( \pi _ { j } | \pi _ { < j } , x )$ (Eq. (2)) such that permutations $\pi$ corresponding to “good” rankings are assigned high probabilities. Various performance measures $\mathcal { R } ( \pi , y )$ can be used to evaluate the quality of a permutation $\pi$ given the labels $y$ , for example, mean average precision (MAP), precision at $k$ , or normalized discounted cumulative gain at $k$ $( \mathrm { N D C G } @ \mathrm { k } )$ . Generally speaking, permutations where the positive labels rank higher are considered better. + +In the standard seq2seq setting, models are trained to maximize the likelihood of a target sequence of tokens given the input, which can be done by maximizing the likelihood of each target token given the previous target tokens using Eq. (1). During training, the model is typically fed the ground-truth tokens as inputs to the next prediction step, an approach known as teacher forcing (Williams and Zipser, 1989). Unfortunately, this approach cannot be applied in our setting since we only have access to weak supervision in the form of labels $y$ (e.g clicks), rather than ground-truth permutations. Instead, we show how the seq2slate model can be trained directly from the labels $y$ . + +# 3.1 TRAINING USING REINFORCE + +One potential approach, which has been applied successfully in related tasks (Bello et al., 2017; Zhong et al., 2017), is to use reinforcement learning $( R L )$ to directly optimize for the ranking measure $\mathcal { R } ( \pi , \overset { \mathbf { \tilde { \alpha } } } { \boldsymbol { y } } )$ . In this setup, the objective is to maximize the expected ranking metric obtained by sequences sampled from our model: $\mathbb { E } _ { \pi \sim p _ { \theta } ( . | x ) } [ \mathcal { R } ( \pi , y ) ]$ . One can use policy gradients and stochastic gradient ascent to optimize $\theta$ . The gradient is formulated using the popular REINFORCE update (Williams, 1992) and can be approximated via Monte-Carlo sampling as follows: + +$$ +\begin{array} { l } { \displaystyle \nabla _ { \theta } \mathbb { E } _ { \pi \sim p _ { \theta } ( . | x ) } \big [ \mathcal { R } ( \pi , y ) \big ] = \mathbb { E } _ { \pi \sim p _ { \theta } ( . | x ) } \Big [ \mathcal { R } ( \pi , y ) \nabla _ { \theta } \log p _ { \theta } ( \pi \mid x ) \Big ] } \\ { \displaystyle \approx \frac { 1 } { B } \sum _ { k = 1 } ^ { B } \Big ( \mathcal { R } ( \pi _ { k } , y _ { k } ) - b ( x _ { k } ) \Big ) \nabla _ { \theta } \log p _ { \theta } ( \pi _ { k } \mid x _ { k } ) , } \end{array} +$$ + +where $k$ indexes ranking instances in a batch of size $B , \pi _ { k }$ are permutations drawn from the model $p _ { \theta }$ and $b ( x )$ denotes a baseline function that estimates the expected rewards to reduce the variance of the gradients. + +# 3.2 SUPERVISED TRAINING + +RL, however, is known to be a challenging optimization problem and can suffer from sample inefficiency and difficult credit assignment. As an alternative, we propose supervised learning using the labels $y$ . In particular, rather than waiting until the end of the output sequence (as in RL), we wish to give feedback to the model at each decoder step. + +Consider the first step, and recall that the model assigns a score $s _ { i }$ to each item in the input. We define a per-step loss $\ell ( s , y )$ which essentially acts as a multi-label classification loss with labels $y$ as ground truth. Two natural, simple choices for $\ell$ are cross-entropy loss and hinge loss: + +$$ +\begin{array} { l } { { \ell _ { x e n t } ( s , y ) = - \sum _ { i } { \hat { y } } _ { i } \log { p _ { i } } } } \\ { { \ell _ { h i n g e } ( s , y ) = \operatorname* { m a x } \{ 0 , 1 - \underset { i : y _ { i } = 1 } { \operatorname* { m i n } } s _ { i } + \underset { j : y _ { j } = 0 } { \operatorname* { m a x } } s _ { j } \} , } } \end{array} +$$ + +where $\hat { y } _ { i } = y _ { i } / \sum _ { j } y _ { j }$ , and $p _ { i }$ is a softmax of $s$ , similar to Eq. (2). Intuitively, with cross-entropy loss we try to assign high probabilities to positive labels (see also Kurata et al., 2016), while hinge loss is minimized when scores of items with positive labels are higher than scores of those with negative labels. Notice that both losses are convex functions of the scores $s$ . To improve convergence, we consider a smooth version of the hinge-loss where the maximum and minimum are replaced by their smooth counterparts: smoot $\begin{array} { r } { { \mathrm { ~ \ h - m a x } } ( s ; \gamma ) = \frac { 1 } { \gamma } \log \sum _ { i } e ^ { \gamma s _ { i } } } \end{array}$ (and smooth minimum is defined similarly, using $\mathrm { m i n } _ { i } ( s _ { i } ) = - \mathrm { m a x } _ { i } ( - s _ { i } ) )$ . + +If we simply apply a per-step loss from Eq. (4) to all steps of the output sequence while reusing the labels $y$ at each step, then the loss is invariant to the actual output permutations (e.g., predicting a positive item at the beginning of the sequence has the same cost as predicting it at the end). Instead, we let the loss $\ell$ at each decoding step $j$ depend on the items already chosen, so no further loss is incurred after a label is predicted correctly. In particular, for a fixed permutation $\pi$ , define the sequence loss: + +$$ +\mathcal { L } _ { \pi } ( S , y ) = \sum _ { j = 1 } ^ { n } w _ { j } \ell _ { \pi _ { < j } } ( s ^ { j } , y ) , +$$ + +where $\boldsymbol { S } = \{ s ^ { j } \} _ { j = 1 } ^ { n }$ , and $\ell _ { \pi < j } \left( s ^ { j } , y \right)$ depends only on the indices in $s ^ { j }$ and $y$ which are not in the prefix permutation $\pi _ { < j } = ( \pi _ { 1 } , \ldots , \pi _ { j - 1 } )$ (see Eq. (4)). Including a per-step weight $w _ { j }$ can encourage better performance earlier in the sequence (e.g., $w _ { j } = 1 / \log ( j + 1 ) )$ . Furthermore, if optimizing for a particular slate size $k$ is desired, one can restrict this loss to just the first $k$ output steps. + +# DECODING POLICIES DURING TRAINING + +Since teacher-forcing is not an option, we resort to feeding the model its own previous predictions, as in Bengio et al. (2015); Ranzato et al. (2016). In this case, the permutation $\pi$ is not fixed, but rather depends on the scores $S$ . Specifically, we consider two policies for producing a permutation during training, sampling and greedy decoding, and introduce their corresponding losses. + +Greedy policy The greedy policy consists of selecting the item that maximizes $p _ { \theta } ( \cdot | \pi _ { < j } , x )$ at every time step $j$ . The resulting permutation $\pi ^ { * }$ then satisfies $\pi _ { j } ^ { * } = \mathrm { a r g m a x } _ { i } p _ { \theta } ( \pi _ { j } = i | \pi _ { < j } ^ { * } )$ and our loss becomes ${ \mathcal { L } } _ { \pi ^ { * } }$ . The greedy policy loss is not continuous everywhere since a small change in the scores $s$ may result in a jump between permutations, and therefore ${ \mathcal { L } } _ { \pi }$ . Specifically, the loss is non-differentiable when any $s ^ { j }$ has multiple maximizing arguments. Outside this measure-zero subspace, the loss is continuous (almost everywhere), and the gradient is well-defined. + +Sampling policy The sampling policy consists of drawing each $\pi _ { j }$ from $p _ { \theta } ( \cdot | \pi _ { < j } , x )$ . The corresponding loss $\begin{array} { r } { \mathbb { E } [ \mathcal { L } ] = \sum _ { \pi } p _ { \theta } ^ { \mathrm { ~ ~ } } ( \pi ) \bar { \mathcal { L } } _ { \pi } ( \theta ) } \end{array}$ is differentiable everywhere since both $p _ { \theta } ( \pi )$ and ${ \mathcal { L } } _ { \pi } ( \theta )$ are differentiable for any permutation $\pi$ (See appendix for a direct derivation of $\mathbb { E } [ \mathcal { L } ]$ as a function of $S$ ). In this case, the gradient is formulated as: + +$$ +\begin{array} { r l } & { \nabla _ { \theta } \mathbb { E } [ \mathcal { L } ( \theta ) ] = \nabla _ { \theta } \displaystyle \sum _ { \pi } p _ { \theta } ( \pi ) \mathcal { L } _ { \pi } ( \theta ) } \\ & { \quad \quad \quad \quad = \displaystyle \sum _ { \pi } \left[ ( \nabla _ { \theta } p _ { \theta } ( \pi ) ) \mathcal { L } _ { \pi } ( \theta ) + p _ { \theta } ( \pi ) ( \nabla _ { \theta } \mathcal { L } _ { \pi } ( \theta ) ) \right] } \\ & { \quad \quad \quad = \mathbb { E } _ { \pi \sim p _ { \theta } } \left[ \mathcal { L } _ { \pi } ( \theta ) \cdot \nabla _ { \theta } \log p _ { \theta } ( \pi ) + \nabla _ { \theta } \mathcal { L } _ { \pi } ( \theta ) \right] , } \end{array} +$$ + +which can be approximated by: + +$$ +\frac { 1 } { B } \sum _ { k = 1 } ^ { B } \left[ \left( \mathcal { L } _ { \pi _ { k } } ( \theta ) - b ( x _ { k } ) \right) \nabla _ { \theta } \log p _ { \theta } ( \pi _ { k } \mid x _ { k } ) + \nabla _ { \theta } \mathcal { L } _ { \pi _ { k } } ( \theta ) \right] , +$$ + +where $b ( \boldsymbol { x } _ { k } )$ is a baseline that approximates ${ \mathcal { L } } _ { \pi _ { k } } ( \theta )$ . Applying stochastic gradient descent intuitively decreases both the loss of any sample (right term) but also the probability of drawing samples with high losses (left term). Notice that our gradient calculation differs from scheduled sampling (Bengio et al., 2015) which instead computes the loss of the sampled sequences (right term) but ignores the probability of sampling high loss sequences (left term). We found it helpful to include both terms, which may apply more generally to training of sequence-to-sequence models (Bengio et al., 2015; Goyal et al., 2016). + +For both training policies, we minimize the loss via stochastic gradient descent over mini-batches in an end-to-end fashion. + +# 4 EXPERIMENTAL RESULTS + +We evaluate the performance of our seq2slate model on a collection of ranking tasks. In Section 4.1 we use learning-to-rank benchmark data to study the behavior of the model. We then apply our approach to a large-scale commercial recommendation system and report the results in Section 4.2. + +Implementation Details We set hyperparameters of our model to values inspired by the literature. All experiments use mini-batches of 128 training examples and LSTM cells with 128 hidden units. We train our models with the Adam optimizer (Kingma and Ba, 2014) and an initial learning rate of 0.0003 decayed every 1000 steps by a factor of 0.96. Network parameters are initialized uniformly at random in $[ - 0 . 1 , 0 . 1 ]$ . To improve generalization, we regularize the model by using dropout with probability of dropping $p _ { d r o p o u t } = 0 . 1$ and L2 regularization with a penalty coefficient $\lambda = 0 . 0 0 0 3$ . Unless specified otherwise, all results use supervised training with cross-entropy loss $\ell _ { x e n t }$ and the sampling policy. At inference time, we report metrics for the greedy policy. We use an exponential moving average with a decay rate of 0.99 as the baseline $b ( x )$ in Eq. (3) and Eq. (6). When training the seq2slate model with REINFORCE, we use $\mathcal { R } = \mathop { \mathrm { N D G C @ 1 0 } }$ as the reward function and do not regularize the model. We also considered a bidirectional encoder RNN (Schuster and Paliwal, 1997) but found that it did not lead to significant improvements in our experiments. + +# 4.1 LEARNING-TO-RANK BENCHMARKS + +To understand the behavior of the proposed model, we conduct experiments using two learning-torank datasets. We use two of the largest publicly available benchmarks: the Yahoo Learning to Rank Challenge data (set 1),1 and the Web30k dataset.2 All context (query) features are embedded within the item feature vectors themselves. + +
RankerYahooWeb30k
MAPNDCG@5NDCG10MAPNDCG@5NDCG@10
seq2slate0.670.690.750.510.530.59
AdaRank0.580.610.690.370.380.46
Coordinate Ascent0.490.510.590.310.330.39
LambdaMART0.580.610.690.420.460.52
ListNet0.490.510.590.430.470.53
MART0.580.600.680.390.420.48
Random Forests0.540.570.650.360.390.45
RankBoost0.500.520.600.240.250.30
RankNet0.540.570.640.430.470.53
+ +Table 1: Performance of seq2slate and other baselines on data generated with diverse-clicks. + +We adapt the procedure proposed by Joachims et al. (2017) to generate click data. The original procedure is as follows: first, a base ranker is trained from the raw data. We select this base ranker by training all models in the RankLib package,3 and selecting the one with the best performance on each data set (MART for Yahoo and LambdaMART for Web30k). We generate an item ranking using the base model, which is then used to generate training data by simulating a user “cascade” model: a user observes each item with decaying probability $1 / i ^ { \eta }$ , where $i$ is the base rank of the item and $\eta$ is a parameter of the generative model. This simulates a noisy sequential scan. An observed item is clicked if its ground-truth relevance score is above a threshold (relevant: $\{ 2 , 3 , 4 \}$ , irrelevant: $\{ 0 , 1 \} ,$ ), otherwise no click is generated. + +To introduce high-order interactions, we augment the above procedure as follows, creating a generative process dubbed diverse-clicks. When observing a relevant item, the user will only click if it is not too similar to previously clicked items (i.e, diverse enough), thus reducing the total number of clicks. Similarity is defined as being in the smallest $q$ percentile (i.e., $q = 0 . 5$ is the median) of Euclidean distances between pairs of feature vectors within the same ranking instance: $d _ { i j } = \| x _ { i } - x _ { j } \|$ . We use $\eta = 0$ (no decay, since clicks are sparse anyway due to the diversity term) and $q = 0 . 5$ . This modification to the generative model is essential for our purpose as the original data does not contain explicit inter-item dependencies. We also discuss variations of this model below. + +Using the generated training data, we train both our seq2slate model and baseline rankers from the RankLib package: AdaRank (Xu and Li, 2007), Coordinate Ascent (Metzler and Croft, 2007), LambdaMART (Wu et al., 2010), ListNet (Cao et al., 2007), MART (Friedman, 2001), Random Forests (Breiman, 2001), RankBoost (Freund et al., 2003), RankNet (Burges et al., 2005). Some of these baselines use deep neural networks (e.g., RankNet, ListNet), so they are strong state-ofthe-art models with comparable complexity to seq2slate. The results in Table 1 show that seq2slate significantly outperforms all the baselines, suggesting that it can better capture and exploit the dependencies between items in the data. + +To better understand the behavior of the model, we visualize the probabilities of the attention from Eq. (2) for one of the test instances in Fig. 2. Interestingly, the model produces slates that are close to the input ranking, but with some items demoted to lower positions, presumably due to the interactions with previous items. + +We next consider several variations of the generative model and of the seq2slate model itself. Results are reported in Table 2. The rank-gain metric per example is computed by summing the positions change of all positive labels in the re-ranking, and this is averaged over all examples (queries). + +Comparison of training variants In Table 2, we compare the different training variants outlined in Section 3, namely cross entropy with the greedy or sampling policy, a smooth hinge loss with $\gamma = 1 . 0$ , and REINFORCE. We find that supervised learning with cross entropy generally performs best, with the smooth hinge loss doing slightly worse. Our weakly supervised training methods have positive rank gain on all datasets, meaning they improve over the base ranker. Results from Table 2 (see also Table 5 in the appendix) suggest that training with REINFORCE yields comparable results on Yahoo but significantly worse results on the more challenging Web30k dataset. We find no significant difference in performance between relying on the greedy and sampling policies during training. + +Table 2: Comparison of model and data variants for seq2slate on data generated with diverse-clicks. + +
RankerYahooWeb30k
MAPNDCG@5NDCG@10rank-gainMAPNDCG@5NDCG@10rank-gain
seq2slate0.670.690.757.40.510.530.5918.3
Greedy policy0.660.690.757.20.500.520.5918.3
smooth-hinge0.660.690.757.10.490.510.5817.9
RL0.660.680.755.70.440.470.53-0.5
one-step decoder0.660.690.756.40.490.510.5816.5
shuffled data0.610.640.7110.360.360.44
base ranker (no-op)0.580.610.6900.450.480.540
+ +Table 3: Performance compared to a competitive base production ranker on real data. + +
RankerMAPNDCG@5NDCG@10rank-gain
one-step decoder+26.79%+10.69%+40.67%0.83
seq2slate+31.32%+14.47%+45.77%1.087
+ +One-step decoding We compare seq2slate to the model which uses a single decoding step, referred to as one-step decoder (see Section 2). In Table 2 we see that this model has comparable performance to the sequential decoder. This suggests that when inference time is crucial, as in many real-world systems, one might prefer the faster single-shot option. One possible explanation for the comparable performance of the one-step decoder is that the interactions in our generated data are rather simple and can be effectively learned by the encoder. By contrast, in Section 4.2 we show that on more complex real-world data, sequential decoding can perform significantly better. + +Sensitivity to input order Previous work suggests that the performance of seq2seq models are often sensitive to the order in which the input is processed (Vinyals et al., 2016; Nam et al., 2017). To test this we consider the use of seq2slate without relying on the base ranker to order the input, but instead items are fed to the model in random order. The results in Table 2 (see shuffled data) show that the performance is indeed significantly worse in this case, which is consistent with previous studies. It suggests that reranking is an easier task than ranking from scratch. + +Adaptivity to the type of interaction To demonstrate the flexibility of seq2slate, we generate data using a variant of the diverse-clicks model above. In the similar-clicks model, the user also clicks on observed irrelevant items if they are similar to previously clicked items (increasing the number of total clicks). As above, we use the pairwise distances in feature space $d _ { i j }$ to determine similarity. For this model we use $q = 0 . 5$ , and $\eta = 0 . 3$ for Web30k, $\eta = 0 . 1$ for Yahoo, to keep the proportion of positive labels similar. The results in the appendix (see Table 4) show that seq2slate has comparable performance to the baseline rankers, with slightly better performance on the harder Web30k data. This demonstrates that our model can adapt to various types of interactions in the data. + +# 4.2 REAL-WORLD DATA + +We also apply seq2slate to a ranking problem from a large-scale commercial recommendation system. We train the model using massive click-through logs (comprising roughly $O ( 1 0 ^ { 7 } )$ instances) with cross-entropy loss, the greedy policy, L2-regularization and dropout. The data has item sets of varying size, with an average $n$ of 10.24 items per example. We learn embeddings of the raw inputs as part of training. Table 3 shows the performance of seq2slate and the one-step decoder compared to the production base ranker on test data (of roughly the same size as the training data). Significant gains are observed in all performance metrics, with sequential decoding outperforming the one-step decoder. This suggests that sequential decoding may more faithfully capture complex dependencies between the items. + +Finally, we let the learned seq2slate model run in a live experiment (A/B testing). We compute the click-through rate (CTR) in each position (#clicks/#examples) for seq2slate. The production base ranker serves traffic outside the experiment, and we compute CTR per position for this traffic as well. Fig. 3 shows the difference in CTR per position, indicating that seq2slate has significantly higher CTR in the top positions. This suggests that seq2slate indeed places items that are likely to be chosen higher in the ranking. + +![](images/60ef907f9e21082dbf278a66435c7c2571d114ab9f70bbd97bccceee6a68e18b.jpg) +Figure 2: Visualization of attention probabilities on benchmark data. Intensities correspond to $p _ { i } ^ { j }$ for each item $i$ in step $j$ . + +![](images/d905e26cc9712b632f319eccc5341d66cb31cef90c14bf9748926677d56250cf.jpg) +Figure 3: Difference in CTR per position between a seq2slate model and a base production ranker in a live experiment. + +# 5 RELATED WORK + +In this section we discuss additional related work. Our work builds on the recent impressive success of seq2seq models in complex prediction tasks, including machine translation (Sutskever et al., 2014; Bahdanau et al., 2015), parsing (Vinyals et al., 2015a), combinatorial optimization (Vinyals et al., 2015b; Bello et al., 2017), multi-label classification (Wang et al., 2016; Nam et al., 2017), and others. Our work differs in that we explicitly target the ranking task, which requires a novel approach to training seq2seq models from weak feedback (click-through data). + +Most of the work on ranking mentioned above uses shallow representations. However, in recent years deep models have been used for information retrieval, focusing on embedding queries, documents and query-document pairs (Huang et al., 2013; Guo et al., 2016; Palangi et al., 2016; Wang and Klabjan, 2017; Pang et al., 2017) (see also recent survey by Mitra and Craswell (2017)). Rather than embedding individual items, in seq2slate a representation of the entire slate of items is learned and encoded in the RNN state. Moreover, learning the embeddings $( x )$ can be easily incorporated into the training of the sequence model to optimize both simultaneously end-to-end. + +Closest to ours is the recent work of Ai et al. (2018), where an RNN is used to encode a set of items for re-ranking. Their approach uses a single decoding step with attention, similar to our one-step decoder. In contrast, we use sequential decoding, which we find crucial in certain applications (see Section 4.2). Another important difference is that their training formulation assumes availability of full rankings or relevance scores, while we focus on learning from cheap click-through data. + +Finally, Santa Cruz et al. (2017) recently proposed an elegant framework for learning permutations based on the so called Sinkhorn operator. Their approach uses a continuous relaxation of permutation matrices (i.e., the set of doubly-stochastic matrices). Later, Mena et al. (2018) combined this with a Gumbel softmax distribution to enable efficient learning. However, this approach is focused on reconstruction of scrambled objects, and it is not obvious how to extend it to our ranking setting, where no ground-truth permutation is available. + +# 6 CONCLUSION + +We presented a novel seq2slate approach to ranking sets of items. We found the formalism of pointer-networks particularly suitable for this setting. We addressed the challenge of training the model from weak user feedback to improve the ranking quality. Our experiments show that the proposed approach is highly scalable and can deliver significant improvements in ranking results. + +Our work can be extended in several directions. In terms of architecture, we aim to explore the Transformer network (Vaswani et al., 2017) in place of the RNN. Several variants can potentially improve the performance of our model, including beam-search inference (Wiseman and Rush, 2016), and training with Actor-Critic (Bahdanau et al., 2017) or SeaRNN (Leblond et al., 2018) and it will be interesting to study their performance in the ranking setting. Finally, an interesting future work direction will be to study off-policy correction (Joachims et al., 2018) for seq2slate. + +# REFERENCES + +Qingyao Ai, Keping Bi, Jiafeng Guo, and W. Bruce Croft. Learning a deep listwise context model for ranking refinement. In SIGIR, pages 135–144, 2018. + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proceedings of ICLR, 2015. + +Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. In ICLR, 2017. + +Irwan Bello, Hieu Pham, Quoc V. Le, Mohammad Norouzi, and Samy Bengio. Neural combinatorial optimization with reinforcement learning. In ICLR 2017 – Workshop Track, 2017. + +Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In NIPS, 2015. + +Leo Breiman. Random forests. Machine learning, 45(1):5–32, 2001. + +Chris Burges, Tal Shaked, Erin Renshaw, Ari Lazier, Matt Deeds, Nicole Hamilton, and Greg Hullender. Learning to rank using gradient descent. In Proceedings of the 22nd international conference on Machine learning, pages 89–96, 2005. + +Zhe Cao, Tao Qin, Tie-Yan Liu, Ming-Feng Tsai, and Hang Li. Learning to rank: from pairwise approach to listwise approach. In Proceedings of the 24th international conference on Machine learning, pages 129–136. ACM, 2007. + +Puneet Kumar Dokania, Aseem Behl, CV Jawahar, and M Pawan Kumar. Learning to rank using high-order information. In European Conference on Computer Vision, pages 609–623. Springer, 2014. + +Yoav Freund, Raj Iyer, Robert E Schapire, and Yoram Singer. An efficient boosting algorithm for combining preferences. Journal of machine learning research, 4(Nov):933–969, 2003. + +Jerome H Friedman. Greedy function approximation: a gradient boosting machine. Annals of statistics, pages 1189–1232, 2001. + +Anirudh Goyal, Alex Lamb, Ying Zhang, Saizheng Zhang, Aaron C. Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, 2016. + +Jiafeng Guo, Yixing Fan, Qingyao Ai, and W. Bruce Croft. A deep relevance matching model for ad-hoc retrieval. In International Conference on Information and Knowledge Management (CIKM), pages 55–64, 2016. + +Ralf Herbrich, Thore Graepel, and Klaus Obermayer. Support vector learning for ordinal regression. In ICANN, pages 97–102, 1999. + +Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. Neural Computations, 1997. + +Po-Sen Huang, Xiaodong He, Jianfeng Gao, Li Deng, Alex Acero, and Larry Heck. Learning deep structured semantic models for web search using clickthrough data. In Proceedings of the 22nd ACM international conference on Conference on information & knowledge management, pages 2333–2338. ACM, 2013. + +T. Joachims, A. Swaminathan, and M. de Rijke. Deep learning with logged bandit feedback. In International Conference on Learning Representations (ICLR), 2018. + +Thorsten Joachims. Optimizing search engines using clickthrough data. In Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 133–142. ACM, 2002. + +Thorsten Joachims, Adith Swaminathan, and Tobias Schnabel. Unbiased learning-to-rank with biased feedback. In Proceedings of the Tenth ACM International Conference on Web Search and Data Mining, pages 781–789. ACM, 2017. + +Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2014. + +Gakuto Kurata, Bing Xiang, and Bowen Zhou. Improved neural network-based multi-label classification with better initialization leveraging label co-occurrence. In ACL, 2016. + +Remi Leblond, Jean-Baptiste Alayrac, Anton Osokin, and Simon Lacoste-Julien. ´ SEARNN: Training rnns with global-local losses. In ICLR, 2018. + +Tie-Yan Liu et al. Learning to rank for information retrieval. Foundations and Trends $\textsuperscript { \textregistered }$ in Information Retrieval, 3(3):225–331, 2009. + +Gonzalo Mena, David Belanger, Scott Linderman, and Jasper Snoek. Learning latent permutations with gumbel-sinkhorn networks. In International Conference on Learning Representations (ICLR), 2018. + +Donald Metzler and W Bruce Croft. Linear feature-based models for information retrieval. Information Retrieval, 10(3):257–274, 2007. + +Bhaskar Mitra and Nick Craswell. Neural models for information retrieval. arXiv:1705.01509, 2017. + +Jinseok Nam, Eneldo Loza Menc´ıa, Hyunwoo J Kim, and Johannes Furnkranz. Maximizing subset ¨ accuracy with recurrent neural networks in multi-label classification. In Advances in Neural Information Processing Systems 30, pages 5413–5423, 2017. + +H. Palangi, L. Deng, Y. Shen, J. Gao, X. He, J. Chen, X. Song, and R. Ward. Deep sentence embedding using long short-term memory networks: Analysis and application to information retrieval. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 24(4):694–707, 2016. + +Liang Pang, Yanyan Lan, Jiafeng Guo, Jun Xu, Jingfang Xu, and Xueqi Cheng. Deeprank: A new deep architecture for relevance ranking in information retrieval. In Proceedings of the 2017 ACM on Conference on Information and Knowledge Management, CIKM ’17, 2017. + +Tao Qin, Tie-Yan Liu, Xu-Dong Zhang, De-Sheng Wang, Wen-Ying Xiong, and Hang Li. Learning to rank relational objects and its application to web search. In Proceedings of WWW, pages 407–416. ACM, 2008. + +Tao Qin, Tie-Yan Liu, Xu-Dong Zhang, De-Sheng Wang, and Hang Li. Global ranking using continuous conditional random fields. In Advances in neural information processing systems, pages 1281–1288, 2009. + +MarcAurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. In Proceedings of ICLR, 2016. + +Nir Rosenfeld, Ofer Meshi, Danny Tarlow, and Amir Globerson. Learning structured models with the auc loss and its generalizations. In Artificial Intelligence and Statistics, pages 841–849, 2014. + +Rodrigo Santa Cruz, Basura Fernando, Anoop Cherian, and Stephen Gould. Visual permutation learning. In CVPR, 2017. + +M. Schuster and K.K. Paliwal. Bidirectional recurrent neural networks. Trans. Sig. Proc., 45(11): 2673–2681, 1997. ISSN 1053-587X. doi: 10.1109/78.650093. + +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, pages 3104–3112, 2014. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems 30. Curran Associates, Inc., 2017. + +O. Vinyals, L. Kaiser, T. Koo, S. Petrov, I. Sutskever, and G. Hinton. Grammar as a foreign language. In NIPS, 2015a. +Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In NIPS, pages 2692–2700, 2015b. +Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: Sequence to sequence for sets. In International Conference on Learning Representations (ICLR), 2016. URL http: //arxiv.org/abs/1511.06391. +Baiyang Wang and Diego Klabjan. An attention-based deep net for learning to rank. arXiv preprint arXiv:1702.06106, 2017. +Jiang Wang, Yi Yang, Junhua Mao, Zhiheng Huang, Chang Huang, and Wei Xu. CNN-RNN: A unified framework for multi-label image classification. In Computer Vision and Pattern Recognition (CVPR), 2016 IEEE Conference on, pages 2285–2294. IEEE, 2016. +Ronald Williams. Simple statistical gradient following algorithms for connectionnist reinforcement learning. In Machine Learning, 1992. +Ronald J. Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural Comput., 1(2):270–280, June 1989. ISSN 0899-7667. doi: 10.1162/neco. 1989.1.2.270. URL http://dx.doi.org/10.1162/neco.1989.1.2.270. +Sam Wiseman and Alexander M. Rush. Sequence-to-sequence learning as beam-search optimization. In ACL, 2016. +Qiang Wu, Christopher JC Burges, Krysta M Svore, and Jianfeng Gao. Adapting boosting for information retrieval measures. Information Retrieval, 13(3):254–270, 2010. +Jun Xu and Hang Li. Adarank: a boosting algorithm for information retrieval. In Proceedings of the 30th annual international ACM SIGIR conference on Research and development in information retrieval, pages 391–398. ACM, 2007. +Yisong Yue, Thomas Finley, Filip Radlinski, and Thorsten Joachims. A support vector method for optimizing average precision. In Proceedings of SIGIR, pages 271–278. ACM, 2007. +Victor Zhong, Caiming Xiong, and Richard Socher. Seq2sql: Generating structured queries from natural language using reinforcement learning. arXiv preprint arXiv:1709.00103, 2017. +Yadong Zhu, Yanyan Lan, Jiafeng Guo, Xueqi Cheng, and Shuzi Niu. Learning for search result diversification. In Proceedings of SIGIR, pages 293–302. ACM, 2014. + +A DERIVATION OF THE EXPECTED LOSS + +$$ +\begin{array} { r l } & { \mathbb { E } [ \mathcal { L } ] = \displaystyle \sum _ { \tau } p ( \boldsymbol { \pi } ) \mathcal { L } _ { \tau } } \\ & { \mathrm { ~ \ ~ \ } = \displaystyle \sum _ { \tau } p ( \boldsymbol { \pi } ) \sum _ { j } \ell _ { \tau < j } } \\ & { \mathrm { \ ~ \ ~ \ } = \displaystyle \sum _ { j } \sum _ { \tau } p ( \boldsymbol { \pi } _ { z < j } ) p ( \boldsymbol { \pi } _ { z < j } ) \ell _ { \tau < j } \ell _ { \tau < j } } \\ & { \mathrm { \ ~ \ ~ \ } = \displaystyle \sum _ { j } \sum _ { \tau } p ( \boldsymbol { \pi } _ { z < j } ) p ( \boldsymbol { \pi } _ { z \le j } ) \ell _ { \tau < j } \ell _ { \tau < j } } \\ & { \mathrm { \ ~ \ ~ \ } = \displaystyle \sum _ { j } \sum _ { \tau < j } p ( \boldsymbol { \pi } _ { z < j } ) \ell _ { \tau < j } \sum _ { \tau \ge j } p ( \boldsymbol { \pi } _ { z < j } | \boldsymbol { \pi } _ { z < j } ) } \\ & { \mathrm { \ ~ \ ~ \ } = \displaystyle \sum _ { j } \sum _ { \tau < j } \left( \sum _ { k = 1 } ^ { j - 1 } e ^ { \lambda _ { k } } / \sum _ { \tau \in S _ { k } } c \right) \ell _ { \tau < j } e ^ { \lambda _ { k } } \Big ) \ell _ { \tau < j } \langle \boldsymbol { s } ^ { j } , \boldsymbol { y } \rangle \ . } \end{array} +$$ + +Since the terms are continuous (and smooth) in $S$ for all $j$ and $\pi _ { < j }$ , so is the entire function. + +# B ADDITIONAL EXPERIMENTAL RESULTS + +
RankerYahooWeb30k
MAPNDCG@5NDCG@10MAPNDCG@5NDCG@10
seq2slate0.820.820.840.440.540.50
AdaRank0.830.810.840.410.520.48
Coordinate Ascent0.830.820.850.390.470.44
LambdaMART0.840.830.850.410.520.48
ListNet0.830.830.850.410.530.49
MART0.830.820.850.410.520.48
Random Forests0.830.820.840.400.480.45
RankBoost0.830.830.850.380.430.41
RankNet0.830.820.840.350.360.35
+ +Table 4: Performance of seq2slate and other baselines on data generated with similar-clicks. + +
RankerYahooWeb30k
MAPNDCG@5NDCG@10rank-gainMAPNDCG@5NDCG10rank-gain
seq2slate0.820.820.848.50.440.540.5016.0
Greedy policy0.820.820.848.50.440.540.5015.9
smooth-hinge0.800.800.827.70.440.540.5015.9
RL0.820.820.848.50.420.530.49-14.8
one-step decoder0.810.810.827.70.440.530.4915.5
shuffled data0.800.800.810.400.440.421
base ranker (no-op)0.780.760.7900.430.530.490
+ +Table 5: Comparison of model and data variants for seq2slate on data generated with similar-clicks. \ No newline at end of file diff --git a/md/train/HkzRQhR9YX/HkzRQhR9YX.md b/md/train/HkzRQhR9YX/HkzRQhR9YX.md new file mode 100644 index 0000000000000000000000000000000000000000..53298856f5593585ea0d9b66f42aa9d16e07f74f --- /dev/null +++ b/md/train/HkzRQhR9YX/HkzRQhR9YX.md @@ -0,0 +1,497 @@ +# TREE-STRUCTURED RECURRENT SWITCHING LINEARDYNAMICAL SYSTEMS FOR MULTI-SCALE MODELING + +Josue Nassar +Department of Electrical & Computer Engineering +Stony Brook University +Stony Brook, NY 11794 +josue.nassar@stonybrook.edu +Scott W. Linderman +Department of Statistics +Columbia University +New York, NY 10027 +scott.linderman@columbia.edu + +# Il Memming Park + +Mónica F. Bugallo +Department of Electrical & Computer Engineering +Stony Brook University +Stony Brook, NY, 11794 +monica.bugallo@stonybrook.edu Department of Neurobiology and Behavior Stony Brook University +Stony Brook, NY, 11794 +memming.park@stonybrook.edu + +# ABSTRACT + +Many real-world systems studied are governed by complex, nonlinear dynamics. By modeling these dynamics, we can gain insight into how these systems work, make predictions about how they will behave, and develop strategies for controlling them. While there are many methods for modeling nonlinear dynamical systems, existing techniques face a trade off between offering interpretable descriptions and making accurate predictions. Here, we develop a class of models that aims to achieve both simultaneously, smoothly interpolating between simple descriptions and more complex, yet also more accurate models1. Our probabilistic model achieves this multi-scale property through a hierarchy of locally linear dynamics that jointly approximate global nonlinear dynamics. We call it the tree-structured recurrent switching linear dynamical system. To fit this model, we present a fully-Bayesian sampling procedure using Pólya-Gamma data augmentation to allow for fast and conjugate Gibbs sampling. Through a variety of synthetic and real examples, we show how these models outperform existing methods in both interpretability and predictive capability. + +# 1 INTRODUCTION + +Complex systems can often be described at multiple levels of abstraction. A computer program can be characterized by the list of functions it calls, the sequence of statements it executes, or the assembly instructions it sends to the microprocessor. As we zoom in, we gain an increasingly nuanced view of the system and its dynamics. The same is true of many natural systems. For example, brain activity can be described in terms of high-level psychological states or via detailed ion channel activations; different tasks demand different levels of granularity. One of our principal aims as scientists is to identify appropriate levels of abstraction for complex natural phenomena and to discover the dynamics that govern how these systems behave at each level of resolution. + +Modern machine learning offers a powerful toolkit to aid in modeling the dynamics of complex systems. Bayesian state space models and inference algorithms enable posterior inference of the latent states of a system and the parameters that govern their dynamics (Särkkä, 2013; Barber et al., 2011; Doucet et al., 2001). In recent years, this toolkit has been expanded to incorporate increasingly flexible components like Gaussian processes (Frigola et al., 2014) and neural networks (Chung et al., 2015; Johnson et al., 2016; Gao et al., 2016; Krishnan et al., 2017) into probabilistic time series models. In neuroscience, sequential autoencoders offer highly accurate models of brain activity (Pandarinath et al., 2018). However, while these methods offer state of the art predictive models, their dynamics are specified at only the most granular resolution, leaving the practitioner to tease out higher level structure post hoc. + +Here we propose a probabilistic generative model that provides a multi-scale view of the dynamics through a hierarchical architecture. We call it the tree-structured recurrent switching linear dynamical system, or TrSLDS. The model builds on the recurrent SLDS (Linderman et al., 2017) to approximate latent nonlinear dynamics through a hierarchy of locally linear dynamics. Once fit, the TrSLDS can be queried at different levels of the hierarchy to obtain dynamical descriptions at multiple levels of resolution. As we proceed down the tree, we obtain higher fidelity, yet increasingly complex, descriptions. Thus, depth offers a simple knob for trading off interpretability and flexibility. The key contributions are two-fold2: first, we introduce a new form of tree-structured stick breaking for multinomial models that strictly generalizes the sequential stick breaking of the original rSLDS, while still permitting Pólya-gamma data augmentation (Polson et al., 2013) for efficient posterior inference; second, we develop a hierarchical prior that links dynamics parameters across levels of the tree, thereby providing descriptions that vary smoothly with depth. The paper is organized as follows. Section 2 provides background material on switching linear dynamical systems and their recurrent variants. Section 3 presents our tree-structured model and Section 4 derives an efficient fullyBayesian inference algorithm for the latent states and dynamics parameters. Finally, in Section 5 we show how our model yields multi-scale dynamics descriptions for synthetic data from two standard nonlinear dynamical systems—the Lorenz attractor and the FitzHugh-Nagumo model of nonlinear oscillation—as well as for a real dataset of neural responses to visual stimuli in a macaque monkey. + +# 2 BACKGROUND + +Let $x _ { t } \ \in \mathbb { R } ^ { d _ { x } }$ and $y _ { t } \in \mathbb { R } ^ { d _ { y } }$ denote the latent state and the observation of the system at time $t$ respectively. The system can be described using a state-space model: + +$$ +\begin{array} { r } { \begin{array} { l c r } { x _ { t } = f ( x _ { t - 1 } , w _ { t } ; \Theta ) , } & { w _ { t } \sim \mathrm { F } _ { w } } & { ( s t a t e d y n a m i c s ) } \\ { y _ { t } = g ( x _ { t } , v _ { t } ; \Psi ) , } & { v _ { t } \sim \mathrm { F } _ { v } } & { ( o b s e r \nu a t i o n ) } \end{array} } \end{array} +$$ + +where $\Theta$ denotes the dynamics parameters, $\Psi$ denotes the emission (observation) parameters, and $w _ { t }$ and $v _ { t }$ are the state and observation noises respectively. For simplicity, we restrict ourselves to systems of the form: + +$$ +\begin{array} { r } { x _ { t } = f ( x _ { t - 1 } ; \Theta ) + w _ { t } , \quad w _ { t } \sim \mathcal { N } ( 0 , Q ) , } \end{array} +$$ + +If the state space model is completely specified then recursive Bayesian inference can be applied to obtain an estimate of the latent states using the posterior $p \left( { x _ { 0 : T } | y _ { 1 : T } } \right)$ (Doucet et al., 2001). However in many applications, the parametric form of the state space model is unknown. While there exist methods that perform smoothing to obtain an estimate of $x _ { 0 : T }$ (Barber, 2006; Fox et al., 2009; Djuric & Bugallo, 2006), we are often interested in not only obtaining an estimate of the continuous latent states but also in learning the dynamics $f ( \cdot ; \Theta )$ that govern the dynamics of the system. + +In the simplest case, we can take a parametric approach to solving this joint state-parameter estimation problem. When $f ( \cdot ; \Theta )$ and $g ( \cdot ; \Psi )$ are assumed to be linear functions, the posterior distribution over latent states is available in closed-form and the parameters can be learned via expectationmaximization. On the other hand, we have nonparametric methods that use Gaussian processes and neural networks to learn highly nonlinear dynamics and observations where the joint estimation is untractable and approximations are necessarily imployed (Zhao & Park, 2016; 2018; Frigola et al., 2014; Sussillo et al., 2016). Switching linear dynamical systems (SLDS) (Ackerson & Fu, 1970; Chang & Athans, 1978; Hamilton, 1990; Ghahramani & Hinton, 1996; Murphy, 1998) balance between these two extremes, approximating the dynamics by stochastically transitioning between a small number of linear regimes. + +![](images/ce7777a334e74f3cbccb9f637258ca035d0f58ca91583b364912a9eeb2fff9e0.jpg) +Figure 1: State probability allocation through stick-breaking in standard rSLDS and the TrSLDS. + +# 2.1 SWITCHING LINEAR DYNAMICAL SYSTEMS + +SLDS approximate nonlinear dynamics by switching between a discrete set of linear regimes. An additional discrete latent state $z _ { t } \in \{ 1 , \ldots , K \}$ determines the linear dynamics at time $t$ , + +$$ +x _ { t } = x _ { t - 1 } + A _ { z _ { t } } x _ { t - 1 } + b _ { z _ { t } } + w _ { t } , \quad w _ { t } \sim \mathcal { N } ( 0 , Q _ { z _ { t } } ) +$$ + +where $A _ { k } , Q _ { k } \in \mathbb { R } ^ { d _ { x } \times d _ { x } }$ and $b _ { k } \in \mathbb { R } ^ { d _ { x } }$ for $k = 1 , \ldots , K$ . Typically, $z _ { t }$ is endowed with Markovian dynamics, $\operatorname* { P r } ( z _ { t } | z _ { t - 1 } = k ) = \pi _ { k }$ . The conditionally linear dynamics allow for fast and efficient learning of the model and can utilize the learning tools developed for linear systems (Haykin, 2001). While SLDS can estimate the continuous latent states $x _ { 0 : T }$ , the assumption of Markovian dynamics for the discrete latent states severely limits their generative capacity. + +# 2.2 RECURRENT SWITCHING LINEAR DYNAMICAL SYSTEMS + +Recurrent switching linear dynamical systems (rSLDS) (Linderman et al., 2017), also known as augmented SLDS (Barber, 2006), are an extension of SLDS where the transition density of the discrete latent state depends on the previous location in the continuous latent space + +$$ +\begin{array} { r } { z _ { t } | x _ { t - 1 } , \{ R , r \} \sim \pi _ { S B } \left( \nu _ { t } \right) , } \\ { \nu _ { t } = R x _ { t - 1 } + r , } \end{array} +$$ + +where $R \in \mathbb { R } ^ { K - 1 \times d _ { x } }$ and $r \in \mathbb { R } ^ { K - 1 }$ represents hyperplanes. $\pi _ { S B } : \mathbb { R } ^ { K - 1 } \to [ 0 , 1 ] ^ { K }$ maps from the reals to the probability simplex via stick-breaking: + +$$ +\pi _ { S B } ( \nu ) = \left( \pi _ { S B } ^ { ( 1 ) } ( \nu ) , \cdots , \pi _ { S B } ^ { ( K ) } ( \nu ) \right) , \quad \pi _ { S B } ^ { ( k ) } = \sigma ( \nu _ { k } ) \prod _ { j < k } \sigma \left( - \nu _ { j } \right) , +$$ + +for k = 1, . . . , K − 1 and π(K)SB $\begin{array} { r } { \pi _ { S B } ^ { ( K ) } = \prod _ { k = 1 } ^ { K - 1 } \sigma \left( - \nu _ { k } \right) } \end{array}$ where $\nu _ { k }$ is the $k$ th component of of $\nu$ and $\sigma ( \nu ) = ( 1 + e ^ { - \nu } ) ^ { - 1 }$ is the logistic function (Fig. 1). By including this recurrence in the transition density of $z _ { t }$ , the rSLDS partitions the latent space into $K$ sections, where each section follows its own linear dynamics. It is through this combination of locally linear dynamical systems that the rSLDS approximates eq. (3); the partitioning of the space allows for a more interpretable visualization of the underlying dynamics. + +Recurrent SLDS can be learned efficiently and in a fully Bayesian manner, and experiments empirically show that they are adept in modeling the underlying generative process in many cases. However, the stick breaking process used to partition the space poses problems for inference due to its dependence on the permutation of the discrete states $\{ 1 , \cdots , K \}$ (Linderman et al., 2017). + +# 3 TREE-STRUCUTRED RECURRENT SWITCHING LINEAR DYNAMICAL SYSTEMS + +Building upon the rSLDS, we propose the tree-structured recurrent switching linear dynamical system (TrSLDS). Rather than sequentially partitioning the latent space using stick breaking, we use a treestructured stick breaking procedure (Adams et al., 2010) to partition the space. + +Let $\tau$ denote a tree structure with a finite set of nodes $\{ \epsilon , 1 , \cdots , N \}$ . Each node $n$ has a parent node denoted by $\operatorname { p a r } ( n )$ with the exception of the root node, $\epsilon$ , which has no parent. For simplicity, we initially restrict our scope to balanced binary trees where every internal node $n$ is the parent of two children, $\operatorname { l e f t } ( n )$ and right $( n )$ . Let $\mathrm { c h i l d } ( \bar { n } ) = \{ \mathrm { l e f t } ( n ) , \mathrm { r i g h t } ( n ) \}$ denote the set of children for internal node $n$ . Let $\mathcal { Z } \subseteq \mathcal { T }$ denote the set of leaf nodes, which have no children. Let depth $( n )$ denote the depth of a node $n$ in the tree, with $\mathrm { d e p t h } ( \epsilon ) = 0$ . + +At time instant $t$ , the discrete latent state $z _ { t }$ is chosen by starting at the root node and traversing down the tree until one of the $K$ leaf nodes are reached. The traversal is done through a sequence of left/right choices by the internal nodes. Unlike in standard regression trees where the choices are deterministic (Lakshminarayanan, 2016), we model the choices as random variables. The traversal through the tree can be described as a stick breaking process. We start at the root node with a unit-length stick $\pi _ { \epsilon } = 1$ , which we divide between its two children. The left child receives a fraction $\pi _ { \mathrm { l e f t } ( \epsilon ) } = \sigma ( \nu _ { \epsilon } )$ and the right child receives the remainder $\pi _ { \mathrm { r i g h t } ( \epsilon ) } = 1 - \sigma ( \nu _ { \epsilon } )$ such that $\nu _ { \epsilon } \in \mathbb { R }$ specifies the left/right balance. This process is repeated recursively, subdividing $\pi _ { n }$ into two pieces at each internal node until we reach the leaves of the tree (Fig. 1). The stick assigned to each node is thus, + +$$ +\pi _ { n } = \left\{ \begin{array} { l l } { \sigma ( \nu _ { \mathrm { p a r } ( n ) } ) ^ { \mathrm { I } [ n = \mathrm { l e f t } ( \mathrm { p a r } ( n ) ) ] } \left( 1 - \sigma ( \nu _ { \mathrm { p a r } ( n ) } ) \right) ^ { \mathrm { I } [ n = \mathrm { r i g h t } ( \mathrm { p a r } ( n ) ) ] } \pi _ { \mathrm { p a r } ( n ) } } & { n \neq \epsilon , } \\ { 1 } & { n = \epsilon . } \end{array} \right. +$$ + +We incorporate this into the TrSLDS by allowing $\nu _ { n }$ to be a function of the continuous latent state + +$$ +\nu _ { n } ( x _ { t - 1 } , R _ { n } , r _ { n } ) = R _ { n } ^ { T } x _ { t - 1 } + r _ { n } , +$$ + +where the parameters $R _ { n }$ and $r _ { n }$ specify a linear hyperplane in the continuous latent state space. As the continuous latent state $x _ { t - 1 }$ evolves, the left/right choices become more or less probable. This in turn changes the probability distribution $\pi _ { k } ( x _ { t - 1 } , \Gamma , \mathcal { T } )$ over the $K$ leaf nodes, where $\Gamma = \{ R _ { n } , r _ { n } \} _ { n \in \mathcal { T } }$ In the TrSLDS, these leaf nodes correspond to the discrete latent states of the model, such that for each leaf node $k$ , + +$$ +p \left( z _ { t } = k \mid x _ { t - 1 } , \Gamma , \mathcal { T } \right) = \pi _ { k } ( x _ { t - 1 } , \Gamma , \mathcal { T } ) . +$$ + +In general, the tree-structured stick-breaking is not restricted to balanced binary trees. We can allow more than two children through an ordered sequential stick-breaking at each level. In this sense, tree-structured stick-breaking is a strict generalization of stick-breaking. We also note that similar to rSLDS, the model can be made more flexible by introducing a dependence on the previous discrete latent in eq. (9) but for the rest of the paper, we stick to eq. (8). + +# 3.1 A HIERARCHICAL DYNAMICS PRIOR THAT RESPECTS THE TREE STRUCTURE + +Similar to standard rSLDS, the dynamics are conditionally linear given a leaf node $z _ { t }$ . A priori, it is natural to expect that locally linear dynamics of nearby regions in the latent space are similar. Thus, in the context of tree-structured stick breaking, we impose that partitions that share a common parent should have similar dynamics. We explicitly model this by enforcing a hierarchical prior on the dynamics that respects the tree structure. + +Let $\left\{ A _ { n } , b _ { n } \right\}$ be the dynamics parameters associated with node $n$ . Although the locally linear dynamics of a discrete state are specified by the leaf nodes, we introduce dynamics at the internal nodes as well. These internal dynamics serve as a link between the leaf node dynamics via a hierarchical prior, + +$$ +\operatorname { v e c } ( [ A _ { n } , b _ { n } ] ) | \operatorname { v e c } ( [ A _ { \mathrm { p a r } ( n ) } , b _ { \mathrm { p a r } ( n ) } ] ) \sim { \mathcal { N } } ( \operatorname { v e c } ( [ A _ { \mathrm { p a r } ( n ) } , b _ { \mathrm { p a r } ( n ) } ] ) , \Sigma _ { n } ) , +$$ + +where $\mathrm { v e c } ( \cdot )$ is the vectorization operator. The prior on the root node is + +$$ +\mathrm { v e c } \left( \left[ A _ { \epsilon } , b _ { \epsilon } \right] \right) \sim { \mathcal N } \left( 0 , \Sigma _ { \epsilon } \right) . +$$ + +We impose the following constraint on the covariance matrix of the prior + +$$ +\begin{array} { r } { \Sigma _ { n } = \lambda ^ { \mathrm { d e p t h } ( n ) } \Sigma _ { \epsilon } , } \end{array} +$$ + +where $\lambda \in ( 0 , 1 )$ is a hyper parameter that dictates how "close" a parent and child are to one another. The prior over the parameters can be written as, where the affine term and the $\mathrm { v e c } ( \cdot )$ operator are dropped for compactness, + +$$ +p ( \{ A _ { n } \} _ { n \in \mathcal { T } } ) = p ( A _ { \epsilon } ) \prod _ { i \in \operatorname { c h i l d } ( \epsilon ) } p ( A _ { i } | A _ { \epsilon } ) \prod _ { j \in \operatorname { c h i l d } ( i ) } p ( A _ { j } | A _ { i } ) \ . . . \prod _ { z \in \mathcal { Z } } p ( A _ { z } | A _ { \operatorname { p a r } ( z ) } ) . +$$ + +It is through this hierarchical tree-structured prior that TrSLDS obtains a multi-scale view of the system. Parents are given the task of learning a higher level description of the dynamics over a larger region while children are tasked with learning the nuances of the dynamics. The use of hierarchical priors also allows for neighboring sections of latent space to share common underlying dynamics inherited from their parent. TrSLDS can be queried at different levels, where levels deeper in the tree provide more resolution. + +TrSLDS shares some features with regression trees (Lakshminarayanan, 2016), even though regression trees are primarily used for standard, static regression problems. The biggest differences are that our tree-structured model has stochastic choices and the internal nodes contribute to smoothing across partitions through the corresponding hierarchical prior. + +There are other hierarchical extensions of SLDS that have been proposed in the literature. In Stanculescu et al. (2014), they propose adding a layer to factorized SLDS where the top-level discrete latent variables determine the conditional distribution of $z _ { t }$ , with no dependence on $x _ { t - 1 }$ . While the tree-structured stick-breaking used in TrSLDS is also a hierarchy of discrete latent variables, the model proposed in Stanculescu et al. (2014) has no hierarchy of dynamics, preventing it from obtaining a multi-scale view of the dynamics. In Zoeter & Heskes (2003), the authors construct a tree of SLDSs where an SLDS with $K$ possible discrete states is first fit. An SLDS with $M$ discrete states is then fit to each of the $K$ clusters of points. This process continues iteratively, building a hierarchical collection of SLDSs that allow for a multi-scale, low-dimensional representation of the observed data. While similar in spirit to TrSLDS, there are key differences between the two models. First, it is through the tree-structured prior that TrSLDS obtains a multi-scale view of the dynamics, thus we only need to fit one instantiation of TrSLDS; in contrast, they fit a separate SLDS for each node in the tree, which is computationally expensive. There is also no explicit probabilistic connection between the dynamics of a parent and child in Zoeter & Heskes (2003). We also note that TrSLDS aims to learn a multiscale view of the dynamics while Zoeter & Heskes (2003) focuses on smoothing, that is, they aim to learn a multi-scale view of the latent states corresponding to data but not suitable for forecasting. + +In the next section we show an alternate view of TrSLDS which we will refer to as the residual model in which internal nodes do contribute to the dynamics. Nevertheless, this residual model will turn out to be equivalent to the TrSLDS. + +# 3.2 RESIDUAL MODEL + +Let $\{ \tilde { A } _ { n } , \tilde { b } _ { n } \}$ be the linear dynamics of node $n$ and let $\operatorname { p a t h } ( n ) = ( \epsilon , \dots , n )$ be the sequence of nodes visited to arrive at node $n$ . In contrast to TrSLDS, the dynamics for a leaf node are now determined by all the nodes in the tree: + +$$ +\begin{array} { r l } & { p ( x _ { t } | x _ { t - 1 } , \tilde { \Theta } , z _ { t } ) = \mathcal { N } ( x _ { t } | x _ { t - 1 } + \bar { A } _ { z _ { t } } x _ { t - 1 } + \bar { b } _ { z _ { t } } , \tilde { Q } _ { z _ { t } } ) , } \\ & { \bar { A } _ { z _ { t } } = \displaystyle \sum _ { j \in \mathrm { p a t h } ( z _ { t } ) } \tilde { A } _ { j } , \quad \bar { b } _ { z _ { t } } = \displaystyle \sum _ { j \in \mathrm { p a t h } ( z _ { t } ) } \tilde { b } _ { j } , } \end{array} +$$ + +We model the dynamics to be independent a priori, where once again the $\mathrm { v e c } ( \cdot )$ operator and the affine term aren’t shown for compactness, + +$$ +p ( \{ \tilde { A } _ { n } \} _ { n \in \mathcal { T } } ) = \prod _ { n \in \mathcal { T } } p ( \tilde { A } _ { n } ) , \quad p ( \tilde { A } _ { n } ) = \mathcal { N } ( 0 , \tilde { \Sigma } _ { n } ) , +$$ + +where $\tilde { \Sigma } _ { n } = \tilde { \lambda } ^ { \mathrm { d e p t h } ( n ) } \tilde { \Sigma } _ { \epsilon }$ and $\tilde { \lambda } \in ( 0 , 1 )$ . + +The residual model offers a different perspective of TrSLDS. The covariance matrix can be seen as representing how much of the dynamics a node is tasked with learning. The root node is given the broadest prior because it is present in eq. (16) for all leaf nodes; thus it is given the task of learning the global dynamics. The children then have to learn to explain the residuals of the root node. Nodes deeper in the tree become more associated with certain regions of the space, so they are tasked with learning more localized dynamics which is represented by the prior being more sharply centered on 0. The model ultimately learns a multi-scale view of the dynamics where the root node captures a coarse estimate of the system while lower nodes learn a much finer grained picture. We show that TrSLDS and residual model yield the same joint distribution (See A for the proof). + +Theorem 1. TrSLDS and the residual model are equivalent if the following conditions are true: $A _ { \epsilon } = \tilde { A } _ { \epsilon } ,$ , $\begin{array} { r } { A _ { n } = \sum _ { j \in \mathrm { p a t h } ( n ) } \tilde { A } _ { j } } \end{array}$ , $Q _ { z } = \tilde { Q } _ { z } \forall z \in \mathrm { l e a v e s } ( \mathcal { T } )$ , $\Sigma _ { \epsilon } = \tilde { \Sigma } _ { \epsilon }$ and $\lambda = \tilde { \lambda }$ + +# 4 BAYESIAN INFERENCE + +The linear dynamic matrices $\Theta$ , the hyperplanes $\Gamma = \{ R _ { n } , r _ { n } \} _ { n \in \mathcal { T } \backslash \mathcal { Z } }$ , the emission parameters $\Psi$ , the continuous latent states $x _ { 0 : T }$ and the discrete latent states $z _ { 1 : T }$ must be inferred from the data. Under the Bayesian framework, this implies computing the posterior, + +$$ +p \left( { { x } _ { 0 : T } } , { { z } _ { 0 : T } } , \Theta , \Psi , \Gamma \vert { { y } _ { 1 : T } } \right) = \frac { p \left( { { x } _ { 0 : T } } , { { z } _ { 1 : T } } , \Theta , \Psi , \Gamma , y _ { 1 : T } \right) } { p \left( { { y } _ { 1 : T } } \right) } . +$$ + +We perform fully Bayesian inference via Gibbs sampling (Brooks et al., 2011) to obtain samples from the posterior distribution described in eq. (18). To allow for fast and closed form conditional posteriors, we augment the model with Pólya-gamma auxiliary variables Polson et al. (2013). + +# 4.1 PÓLYA-GAMMA AUGMENTATION + +Consider a logistic regression from regressor $x _ { n } \in \mathbb { R } ^ { d _ { x } }$ to categorical distribution $z _ { n } \in \{ 0 , 1 \}$ ; the likelihood is + +$$ +p ( z _ { 1 : N } ) = \prod _ { n = 1 } ^ { N } \frac { \Big ( e ^ { x _ { n } ^ { T } \beta } \Big ) ^ { z _ { n } } } { 1 + e ^ { x _ { n } ^ { T } \beta } } . +$$ + +If a Gaussian prior is placed on $\beta$ then the model is non-conjugate and the posterior can’t be obtained in closed form. To circumvent this problem Polson et al. (2013) introduced a Pólya-Gamma (PG) augmentation scheme. This augmentation scheme is based on the following integral identity + +$$ +\frac { \left( e ^ { \psi } \right) ^ { a } } { \left( 1 + e ^ { \psi } \right) ^ { b } } = 2 ^ { - b } e ^ { \kappa \psi } \int _ { 0 } ^ { \infty } e ^ { - \frac { 1 } { 2 } \omega \psi ^ { 2 } } p ( \omega ) \mathrm { d } \omega +$$ + +where $\kappa = a - b / 2$ and $\omega \sim \mathrm { P G } ( b , 0 )$ . Setting $\psi = x ^ { T } \beta$ , it is evident that the integrand is a kernel for a Gaussian. Augmenting the model with PG axillary r.v.s $\{ \omega _ { n } \} _ { n = 1 } ^ { N }$ , eq. (19) can be expressed as + +$$ +p ( z _ { 1 : N } ) = \prod _ { n = 1 } ^ { N } \frac { \Big ( e ^ { x _ { n } ^ { T } \beta } \Big ) ^ { z _ { n } } } { 1 + e ^ { x _ { n } ^ { T } \beta } } \propto \prod _ { n = 1 } ^ { N } e ^ { \kappa _ { n } \psi _ { n } } \int _ { 0 } ^ { \infty } e ^ { - \frac { 1 } { 2 } \omega _ { n } \psi _ { n } ^ { 2 } } p ( \omega _ { n } ) \mathrm { d } \omega _ { n } = \prod _ { n = 1 } ^ { N } \mathbb { E } _ { \omega _ { n } } \big [ e ^ { - \frac { 1 } { 2 } ( \omega _ { n } \psi _ { n } ^ { 2 } - 2 \kappa _ { n } \psi _ { n } ) } \big ] . +$$ + +Conditioning on $\omega _ { n }$ , the posterior of $\beta$ is + +$$ +p ( \beta | \omega _ { 1 : N } , z _ { 1 : N } , x _ { 1 : N } ) \propto p ( \beta ) \prod _ { n = 1 } ^ { N } e ^ { - \frac { 1 } { 2 } \left( \omega _ { n } \psi _ { n } ^ { 2 } - 2 \kappa _ { n } \psi _ { n } \right) } +$$ + +where $\psi _ { n } = x _ { n } ^ { T } \beta$ and $\begin{array} { r } { \kappa _ { n } = z _ { n } - \frac { 1 } { 2 } } \end{array}$ . It can be shown that the conditional posterior of $\omega _ { n }$ is also PG where $\omega _ { n } | \beta , x _ { n } , z _ { n } \sim \mathrm { P G } ( 1 , \psi _ { n } )$ (Polson et al., 2013). + +# 4.2 CONDITIONAL POSTERIORS + +The structure of the model allows for closed form conditional posterior distributions that are easy to sample from. For clarity, the conditional posterior distributions for the TrSLDS are given below: + +1. The linear dynamic parameters $( A _ { k } , b _ { k } )$ and state variance $Q _ { k }$ of a leaf node $k$ are conjugate with a Matrix Normal Inverse Wishart (MNIW) prior + +$$ +p ( ( A _ { k } , b _ { k } ) , Q _ { k } | x _ { 0 : T } , z _ { 1 : T } ) \propto p ( ( A _ { k } , b _ { k } ) , Q _ { k } ) \prod _ { t = 1 } ^ { T } N ( x _ { t } | x _ { t - 1 } + A _ { z _ { t } } x _ { t - 1 } + b _ { z _ { t } } , Q _ { z _ { t } } ) ^ { \mathbb { 1 } [ z _ { t } = k ] } . +$$ + +2. The linear dynamic parameters of an internal node $n$ are conditionally Gaussian given a Gaussian prior on $\left( A _ { n } , b _ { n } \right)$ + +$$ +p ( ( A _ { n } , b _ { n } ) | \Theta _ { - n } ) \propto p ( ( A _ { n } , b _ { n } ) | ( A _ { \mathrm { p a r } ( n ) } , b _ { \mathrm { p a r } ( n ) } ) ) \prod _ { j \in \coth \mathbb { 1 } \mathbb { d } ( n ) } p ( ( A _ { j } , b _ { j } ) | ( A _ { n } , b _ { n } ) ) . +$$ + +3. If we assume the observation model is linear and with additive white Gaussian noise then the emission parameters $\Psi = \{ ( C , d ) , S \}$ are also conjugate with a MNIW prior + +$$ +p ( ( C , d ) , S | x _ { 1 : T } , y _ { 1 : T } ) \propto p ( ( C , d ) , S ) \prod _ { t = 1 } ^ { T } \mathcal { N } ( y _ { t } | C x _ { t } + d , S ) . +$$ + +We can also handle Bernoulli observations through the use of Pólya-gamma augmentation. +In the interest of space, the details are explained in Section B.1 in the Appendix. + +4. The choice parameters are logistic regressions which follow from the conditional posterior + +$$ +p \left( \Gamma \middle | x _ { 0 : T } , z _ { 1 : T } \right) \propto p \left( \Gamma \right) \prod _ { t = 1 } ^ { T } p \left( z _ { t } \middle | x _ { t - 1 } , \Gamma \right) = p \left( \Gamma \right) \prod _ { t = 1 } ^ { T } \prod _ { n \in \mathrm { p a t h } \left( z _ { t } \right) \backslash z } \frac { \left( e ^ { \nu _ { n , t } } \right) ^ { \mathrm { 1 } \left( \mathrm { l e f t } \left( n \right) \in \mathrm { p a t h } \left( z _ { t } \right) \right) } } { 1 + e ^ { \nu _ { n , t } } } , +$$ + +where $\nu _ { n , t } = R _ { n } ^ { T } x _ { t - 1 } + r _ { n }$ . The likelihood is of the same form as the left hand side of eq. (20), thus it is amenable to the PG augmentation. Let $\omega _ { n , t }$ be the auxiliary Pólya-gamma random variable introduced at time $t$ for an internal node $n$ . We can express the posterior over the hyperplane of an internal node $n$ as: + +$$ +p ( ( R _ { n } , r _ { n } ) | x _ { 0 : T } , z _ { 1 : T } , \omega _ { n , 1 : T } ) \propto p ( ( R _ { n } , r _ { n } ) ) \prod _ { t = 1 } ^ { T } \mathcal { N } ( \nu _ { n , t } | \kappa _ { n , t } / \omega _ { n , t } , 1 / \omega _ { n , t } ) ^ { 1 ( n \in \mathrm { p a t h } ( z _ { t } ) ) } , +$$ + +where $\begin{array} { r } { \kappa _ { n , t } = \frac 1 2 \mathbb { 1 } [ j = \mathrm { l e f t } ( n ) ] - \frac 1 2 \mathbb { 1 } [ j = \mathrm { r i g h t } ( n ) ] } \end{array}$ , $j \in \mathrm { c h i l d } ( n )$ . Augmenting the model with Pólya-gamma random variables allows for the posterior to be conditionally Gaussian under a Gaussian prior. + +5. Conditioned on the discrete latent states, the continuous latent states are Gaussian. However, the presence of the tree-structured recurrence potentials $\psi ( x _ { t - 1 } , z _ { t } )$ introduced by eq. (10) destroys the Gaussinity of the conditional. When the model is augmented with PG random variables $\omega _ { n , t }$ , the augmented recurrence potential, $\psi ( x _ { t - 1 } , \boldsymbol { z } _ { t } , \omega _ { n , t } )$ , becomes effectively Gaussian, allowing for the use of message passing for efficient sampling. Linderman et al. (2017) shows how to perform message-passing using the Pólya-gamma augmented recurrence potentials $\psi ( x _ { t } , z _ { t } , w _ { n , t } )$ . In the interest of space, the details are explained in Section B.2 in the Appendix. + +6. The discrete latent variables $z _ { 1 : T }$ are conditionally independent given $x _ { 1 : T }$ thus + +$$ +p \left( \boldsymbol { z } _ { t } = k | \boldsymbol { x } _ { 1 : T } , \Theta , \Gamma \right) = \frac { p \left( x _ { t } | \boldsymbol { x } _ { t - 1 } , \theta _ { k } \right) p \left( \boldsymbol { z } _ { t } = k | \boldsymbol { x } _ { t - 1 } , \Gamma \right) } { \sum _ { l \in \mathrm { l e a v e s } ( T ) } p \left( \boldsymbol { x } _ { t } | \boldsymbol { x } _ { t - 1 } , \theta _ { l } \right) p \left( \boldsymbol { z } _ { t } = l | \boldsymbol { x } _ { t - 1 } , \Gamma \right) } , k \in \mathrm { l e a v e s } ( T ) . +$$ + +7. The conditional posterior of the Pólya-Gamma random variables are also Pólya-Gamma: $\omega _ { n , t } | z _ { t } , ( R _ { n } , r _ { n } ) , x _ { t - 1 } \sim \mathrm { P G } ( 1 , \nu _ { n , t } )$ . + +Due to the complexity of the model, good initialization is critical for the Gibbs sampler to converge to a mode in a reasonable number of iterations. Details of the initialization procedure are contained in Section C in the Appendix. + +# 5 EXPERIMENTS + +We demonstrate the potential of the proposed model by testing it on a number of non-linear dynamical systems. The first, FitzHugh-Nagumo, is a common nonlinear system utilized throughout neuroscience to describe an action potential. We show that the proposed method can offer different angles of the system. We also compare our model with other approaches and show that we can achieve state of the art performance. We then move on to the Lorenz attractor, a chaotic nonlinear dynamical system, and show that the proposed model can once again break down the dynamics and offer an interesting perspective. Finally, we apply the proposed method on the data from Graf et al. (2011). + +![](images/3c036b909ffe2d53f67b812be3bcd5e964c243cfab9e4743f08217a0662ee3a8.jpg) +Figure 2: TrSLDS applied to model the FitzHugh-Nagumo nonlinear oscillator. (a) The model was trained on 100 trajectories with random starting points. (b) The model can infer the latent trajectories. (c) The true vector field of FHN is shown where color of the arrow represents log-speed. The two nullclines are plotted in yellow and green. (d-f) The vector fields display the multi-scale view learned from the model where color of the arrows dictate log-speed The background color showcases the hierarchical partitioning learned by the model where the darker the color is, the higher the probability of ending up in that discrete state. As we go deeper in the tree, the resolution increases which is evident from the vector fields. (g) A deterministic trajectory from the leaf nodes (colored by most likely leaf node) with affine transformation onto a trajectory FHN (gray). (h) Plotting $w$ and $v$ over time, we see that the second level captures some of the oscillations but ultimately converges to a fixed point. The model learned by the leaf nodes captures the limit cycle accurately. (i) Performances compared for multi-step prediction. We see that TrSLDS outperforms rSLDS. + +# 5.1 FITZHUGH-NAGUMO + +The FitzHugh-Nagumo (FHN) model is a 2-dimensional reduction of the Hodgkin-Huxley model which is completely described by the following system of differential equations (Izhikevich, 2007): + +$$ +\dot { v } = v - \frac { v ^ { 3 } } { 3 } - w + I _ { e x t } , \qquad \tau \dot { w } = v + a - b w . +$$ + +We set the parameters to $a = 0 . 7$ , $b = 0 . 8$ , $\tau = 1 2 . 5$ , and $I _ { e x t } \sim \mathcal { N } ( 0 . 7 , 0 . 0 4 )$ . We trained our model with 100 trajectories where the starting points were sampled uniformly from $[ - 3 , 3 ] ^ { 2 }$ . Each of the trajectories consisted of 430 time points, where the last 30 time points of the trajectories were used for testing. The observation model is linear and Gaussian where $C = { \binom { 2 } { 0 } } \quad { \overset { 0 } { - } } { \overset { - } { 2 } } { \overset { - } { ) } } , d = [ 0 . 5 , 0 . 5$ ] and $S = 0 . 0 1 \mathbb { I } _ { 2 }$ where $\mathbb { I } _ { n }$ is an identity matrix of dimension n. We set the number of leaf nodes to be 4 and ran Gibbs for 1,000 samples; the last 50 samples were kept and we choose the sample that produced the highest log likelihood to produce Fig. 2 where the vector fields were produced using the mode of the conditional posteriors of the dynamics. + +To quantitatively measure the predictive power of TrSLDS, we compute the $k$ -step predictive mean squared error, $\mathbf { M S E } _ { k }$ , and its normalized version, $R _ { k } ^ { 2 }$ , on a test set where $\mathrm { M S E } _ { k }$ and $\bar { R } _ { k } ^ { 2 }$ are defined as + +$$ +\mathbf { M S E } _ { k } = \frac { 1 } { T - k } \sum _ { t = 0 } ^ { T - k } \left\| y _ { t + k } - \hat { y } _ { t + k } \right\| _ { 2 } ^ { 2 } , \qquad R _ { k } ^ { 2 } = 1 - \frac { ( T - k ) \mathbf { M S E } _ { k } } { \sum _ { t = 0 } ^ { T - k } \left\| y _ { t + k } - \bar { y } \right\| _ { 2 } ^ { 2 } } , +$$ + +where $\bar { y }$ is the average of a trial and $\hat { y } _ { t + k }$ is the prediction at time $t + k$ which is obtained by (i) using the the samples produced by the sampler to obtain an estimate of $\hat { x } _ { T }$ given $y _ { 1 : T }$ , (ii) propagate $\hat { x } _ { T }$ for $k$ time steps forward to obtain $\hat { x } _ { t + k }$ and then (iii) obtain $\hat { y } _ { t + k }$ . We compare the model to LDS, SLDS and rSLDS for $k = 1 , \ldots , 3 0$ over the last 30 time steps for all 100 trajectories (Fig. 2I). + +# 5.2 LORENZ ATTRACTOR + +![](images/8ebda55e6b6b55c81c929fe7ad8029ddefad9375e1ce476a4bc4bbc2f246478d.jpg) +Figure 3: (a) The 50 trajectories used to train the model are plotted where the red "x" displays the starting point of the trajectory. (b) The inferred latent states are shown, colored by their discrete latent state. (c) We see that the second layer approximates the Lorenz attractor with 2 ellipsoids. A trajectory from the Lorenz attractor starting at the same initial point is shown for comparison. (d) Going one level lower in the tree, we see that in order to capture the nuances of the dynamics, each of the ellipsoids must be split in half. A trajectory from the Lorenz attractor is shown for comparison. (e) Plotting the dynamics, it is evident that the leaf nodes improve on it’s parent’s approximation. (f) The $R _ { k } ^ { 2 }$ demonstrates the predictive power of TrSLDS. + +Lorenz attractors are chaotic systems whose nonlinear dynamics are defined by, + +$$ +\begin{array} { r } { \dot { x _ { 1 } } = \sigma \left( x _ { 2 } - x _ { 1 } \right) , \quad \dot { x _ { 2 } } = x _ { 1 } ( \rho - x _ { 3 } ) - x _ { 2 } , \quad \dot { x _ { 3 } } = x _ { 1 } x _ { 2 } - \beta x _ { 3 } . } \end{array} +$$ + +The parameters were set to $\sigma = 1 0$ , $\rho = 2 8$ and $\beta = 8 / 3$ . The data consisted of 50 trajectories, each of length of 230 where the first 200 time points are used for training and the last 30 are used for testing. The observation model was a projection onto 10 dimensional space with Gaussian noise.We set the number of leaf nodes to be 4 and ran Gibbs for 1,000 samples; the last 50 samples were kept and we choose the sample that produced the highest log-likelihood to produce Fig. 3. + +The butterfly shape of the Lorenz attractor lends itself to being roughly approximated by two 2- dimensional ellipsoids; this is exactly what TrSLDS learns in the second level of the tree. As is evident from Fig. 5B, the two ellipsoids don’t capture the nuances of the dynamics. Thus, the model partitions each of the ellipsoids to obtain a finer description. We can see that embedding the system with a hierarchical tree-structured prior allows for the children to build off its parent’s approximations. + +# 5.3 NEURAL DATA + +To validate the model and inference procedure, we used the neural spike train data recorded from the primary visual cortex of an anesthetized macaque monkey collected by Graf et al. (2011). The dataset is composed of short trials where the monkey viewed periodic temporal pattern of motions of 72 orientations, each repeated 50 times. Dimensionality reduction of the dataset showed that for each orientation of the drifting grating stimulus, the neural response oscillates over time, but in a stimulus dependent geometry captured in 3-dimensions (Zhao & Park, 2017). We used 50 trials each from a subset of 4 stimulus orientations grouped in two (140 and 150 degrees vs. 230 and 240 degrees) where each trial contained 140 neurons. Out of the 140 neurons, we selected 63 well-tuned neurons. The spike trains were binarized with a $1 0 \mathrm { m s }$ window for Bernoulli observation model and we truncated the onset and offset neural responses, resulting in 111 time bins per trial. + +We fit TrSLDS with $K = 4$ leaf nodes and 3-dimensional continuous latent space; the sampler was run for 500 samples where the last sample was used to produce the results shown in Fig. 4. To obtain an initial estimate for $x _ { 0 : T }$ , we smoothed the spike trains using a Gaussian kernel and performed probabilistic PCA on the smoothed spike trains. + +From Fig. 4, it is evident that TrSLDS has learned a multi-scale view as expected. It is able to correctly distinguish between the two groups of orientations by assigning them to two different subtrees (green-yellow vs. red-orange). The leaf nodes of each subtree refines the periodic orbit further. From Fig. 4, we can see that TrSLDS also learns two limit cycles that are separated. + +![](images/7eb975bf6003ca2e20ee4e47c4dd18f8c8881b4ee1f18325322a7945c09ea31f.jpg) +Figure 4: Modeling primary visual cortex spike trains. (top) Example spike raster plots in response to a drifting grating of orientations 150 and 240 degrees. Our data consisted of 200 such trials. (bottom) The average inferred latent trajectories over time for orientations 140 and 150 degrees colored by the most likely discrete latent state. (right top) Same plotted in space. The model is able to separate the limit cycles for each orientation group (green-yellow vs. red-orange) and refine them further with the leaf nodes. (right bottom) Two model generated predictive trajectories showing two stable limit cycles that resemble the two periodic orbits. + +# 6 CONCLUSION + +In this paper, we propose tree-structured recurrent switching linear dynamical systems (TrSLDS) which is an extension of rSLDS (Linderman et al., 2017). The system relies on the use of treestructured stick-breaking to partition the space. The tree-structured stick-breaking paradigm naturally lends itself to imposing a hierarchical prior on the dynamics that respects the tree structure. This tree-structured prior allows for a multi-scale view of the system where one can query at different levels of the tree to see different scales of the resolution. We also developed a fully Bayesian sampler, which leverages the Pólya-Gamma augmentation, to learn the parameters of the model and infer latent states. The two synthetic experiments show that TrSLDS can recover a multi-scale view of the system, where the resolution of the system increase as we delve deeper into the tree. The analysis on the real neural data verifies that TrSLDS can find a multi-scale structure. + +# REFERENCES + +Guy A Ackerson and King-Sun Fu. On state estimation in switching environments. IEEE Transactions on Automatic Control, 15(1):10–17, 1970. + +Ryan P Adams, Zoubin Ghahramani, and Michael I Jordan. Tree-Structured Stick Breaking for Hierarchical Data. In J D Lafferty, C K I Williams, J Shawe-Taylor, R S Zemel, and A Culotta (eds.), Advances in Neural Information Processing Systems 23, pp. 19–27. Curran Associates, Inc., 2010. + +David Barber. Expectation Correction for Smoothed Inference in Switching Linear Dynamical Systems. Technical report, 2006. + +David Barber, A Taylan Cemgil, and Silvia Chiappa. Bayesian time series models. Cambridge University Press, 2011. + +Steve Brooks, Andrew Gelman, Galin Jones, and Xiao-Li Meng. Handbook of Markov Chain Monte Carlo. CRC press, 2011. + +Chaw-Bing Chang and Michael Athans. State estimation for discrete systems with switching parameters. IEEE Transactions on Aerospace and Electronic Systems, (3):418–425, 1978. + +Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015. + +Petar Djuric and Mónica Bugallo. Cost-Reference Particle Filtering for Dynamic Systems with Nonlinear and Conditionally Linear States, 9 2006. + +Arnaud Doucet, Nando Freitas, and Neil Gordon. An Introduction to Sequential Monte Carlo Methods. In Sequential Monte Carlo Methods in Practice, pp. 3–14. Springer New York, New York, NY, 2001. doi: 10.1007/978-1-4757-3437-9{\_}1. + +Elena A. Erosheva and S. McKay Curtis. Dealing with Reflection Invariance in Bayesian Factor Analysis. Psychometrika, 82(2):295–307, 6 2017. ISSN 0033-3123. doi: 10.1007/s11336-017-9564-y. + +Emily Fox, Erik B Sudderth, Michael I Jordan, and Alan S Willsky. Nonparametric Bayesian Learning of Switching Linear Dynamical Systems. In D Koller, D Schuurmans, Y Bengio, and L Bottou (eds.), Advances in Neural Information Processing Systems 21, pp. 457–464. Curran Associates, Inc., 2009. + +Roger Frigola, Yutian Chen, and Carl Edward Rasmussen. Variational Gaussian Process State-Space Models. In Z Ghahramani, M Welling, C Cortes, N D Lawrence, and K Q Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 3680–3688. Curran Associates, Inc., 2014. + +Yuanjun Gao, Evan W Archer, Liam Paninski, and John P Cunningham. Linear dynamical neural population models through nonlinear embeddings. In Advances in neural information processing systems, pp. 163–171, 2016. + +John Geweke and Guofu Zhou. Measuring the Pricing Error of the Arbitrage Pricing Theory. Review of Financial Studies, 9(2):557–587, 4 1996. ISSN 0893-9454. doi: 10.1093/rfs/9.2.557. + +Zoubin Ghahramani and Geoffrey E Hinton. Switching state-space models. Technical report, University of Toronto, 1996. + +Arnulf B. Graf, Adam Kohn, Mehrdad Jazayeri, and J. Anthony Movshon. Decoding the activity of neuronal populations in macaque primary visual cortex. Nature neuroscience, 14(2):239–245, February 2011. ISSN 1546-1726. doi: 10.1038/nn.2733. + +James D Hamilton. Analysis of time series subject to changes in regime. Journal of econometrics, 45 (1):39–70, 1990. + +Simon S Haykin. Kalman Filtering and Neural Networks. John Wiley & Sons, Inc., New York, NY, USA, 2001. ISBN 0471369985. + +Eugene M Izhikevich. Dynamical systems in neuroscience. MIT press, 2007. + +Matthew Johnson, David K Duvenaud, Alex Wiltschko, Ryan P Adams, and Sandeep R Datta. Composing graphical models with neural networks for structured representations and fast inference. In Advances in neural information processing systems, pp. 2946–2954, 2016. + +Rahul G Krishnan, Uri Shalit, and David Sontag. Structured inference networks for nonlinear state space models. 2017. + +Balaji Lakshminarayanan. Decision Trees and Forests: A Probabilistic Perspective. Technical report, UCL (University College London), 2016. + +Scott Linderman, Matthew Johnson, and Ryan P Adams. Dependent Multinomial Models Made Easy: Stick-Breaking with the Polya-gamma Augmentation. In C Cortes, N D Lawrence, D D Lee, M Sugiyama, and R Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 3456–3464. Curran Associates, Inc., 2015. + +Scott Linderman, Matthew Johnson, Andrew Miller, Ryan Adams, David Blei, and Liam Paninski. Bayesian Learning and Inference in Recurrent Switching Linear Dynamical Systems. In Aarti Singh and Jerry Zhu (eds.), Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, volume 54 of Proceedings of Machine Learning Research, pp. 914–922, Fort Lauderdale, FL, USA, 9 2017. PMLR. + +Kevin P Murphy. Switching Kalman filters. Technical report, Compaq Cambridge Research, 1998. + +Chethan Pandarinath, Daniel J O’Shea, Jasmine Collins, Rafal Jozefowicz, Sergey D Stavisky, Jonathan C Kao, Eric M Trautmann, Matthew T Kaufman, Stephen I Ryu, Leigh R Hochberg, et al. Inferring single-trial neural population dynamics using sequential auto-encoders. Nature methods, pp. 1, 2018. + +Nicholas G Polson, James G Scott, and Jesse Windle. Bayesian Inference for Logistic Models Using Pólya–Gamma Latent Variables. Journal of the American Statistical Association, 108(504):1339– 1349, 2013. doi: 10.1080/01621459.2013.829001. + +Simo Särkkä. Bayesian filtering and smoothing, volume 3. Cambridge University Press, 2013. + +Ioan Stanculescu, Christopher KI Williams, and Yvonne Freer. A hierarchical switching linear dynamical system applied to the detection of sepsis in neonatal condition monitoring. In UAI, pp. 752–761, 2014. + +David Sussillo, Rafal Józefowicz, L. F Abbott, and Chethan Pandarinath. LFADS - Latent Factor Analysis via Dynamical Systems. CoRR, abs/1608.06315, 2016. + +Yuan Zhao and Il Memming Park. Interpretable nonlinear dynamic modeling of neural trajectories. In Advances in Neural Information Processing Systems (NIPS), 2016. + +Yuan Zhao and Il Memming Park. Variational Latent Gaussian Process for Recovering SingleTrial Dynamics from Population Spike Trains. Neural Computation, 29(5), May 2017. doi: 10.1162/NECO_a_00953. + +Yuan Zhao and Il Memming Park. Variational joint filtering. arXiv, abs/1707.09049, 2018. + +Onno Zoeter and Tom Heskes. Hierarchical visualization of time-series data using switching linear dynamical systems. IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(10): 1202–1214, 2003. + +# A PROOF OF THEOREM 1 + +Proof. Let $\tau$ be a balanced binary tree with $K$ leaf nodes. To show that the models are equal, it suffices to show the equivalence of the likelihood and the prior between models. For compactness, we drop the affine term and the $\mathrm { v e c } ( \cdot )$ operator. The likelihood of TrSLDS is + +$$ +p ( x _ { 1 : T } | \boldsymbol { z } _ { 1 : T } , \Theta ) = \prod _ { t = 1 } ^ { T } \mathcal { N } ( x _ { t } | x _ { t - 1 } + A _ { z _ { t } } x _ { t - 1 } , Q _ { z _ { t } } ) , +$$ + +and the likelihood of the residual model is + +$$ +p ( x _ { 1 : T } | z _ { 1 : T } , \tilde { \Theta } ) = \prod _ { t = 1 } ^ { T } \mathcal { N } \left( x _ { t } | x _ { t - 1 } + \bar { A } _ { z _ { t } } x _ { t - 1 } , \tilde { Q } _ { z _ { t } } \right) . +$$ + +where $\bar { A } _ { z _ { t } }$ is defined in eq. (16). Substituting $\begin{array} { r } { A _ { z _ { t } } = \sum _ { j \in \mathrm { p a t h } ( z _ { t } ) } \tilde { A } _ { j } } \end{array}$ into eq. (27) equates the likelihoods. All that is left to do is to show the equality of the priors. + +We can express $\begin{array} { r } { A _ { n } = \sum _ { j \in \mathrm { p a t h } ( n ) } \tilde { A } _ { j } } \end{array}$ recursively + +$$ +A _ { n } = \tilde { A } _ { n } + A _ { \mathrm { p a r } ( n ) } . +$$ + +Plugging eq. (28) into $\ln p ( A _ { n } | A _ { \mathrm { p a r } ( n ) } )$ + +$$ +\begin{array} { l } { \displaystyle \ln p \big ( A _ { n } \big | A _ { \mathrm { p a r } ( n ) } \big ) = - \frac { 1 } { 2 } \left( A _ { n } - A _ { \mathrm { p a r } ( n ) } \right) ^ { T } \Sigma _ { n } ^ { - 1 } \left( A _ { n } - A _ { \mathrm { p a r } ( n ) } \right) + \mathrm { C } } \\ { = - \frac { 1 } { 2 } \left( \tilde { A } _ { n } + A _ { \mathrm { p a r } ( n ) } - A _ { \mathrm { p a r } ( n ) } \right) ^ { T } \Sigma _ { n } ^ { - 1 } \left( \tilde { A } _ { n } + A _ { \mathrm { p a r } ( n ) } - A _ { \mathrm { p a r } ( n ) } \right) + \mathrm { C } } \\ { = - \frac { 1 } { 2 } \tilde { A } _ { n } ^ { T } \Sigma _ { n } ^ { - 1 } \tilde { A } _ { n } + \mathrm { C } } \\ { = - \frac { 1 } { 2 } \tilde { A } _ { n } ^ { T } \left( \lambda ^ { \mathrm { d e p t h } ( n ) } \Sigma _ { \epsilon } \right) ^ { - 1 } \tilde { A } _ { n } + \mathrm { C } } \end{array} +$$ + +where $\textrm { C }$ is a constant. Because $\Sigma _ { \epsilon } = \tilde { \Sigma } _ { \epsilon }$ and $\lambda = \widetilde { \lambda }$ , eq. (32) is equivalent to the kernel of $p ( { \tilde { A } } _ { n } )$ implying that the priors are equal. Since this is true $\forall n \in \mathcal { T }$ , the joint distributions of the two models are the same. □ + +# B DETAILS ON BAYESIAN INFERENCE + +# B.1 HANDLING BERNOULLI OBSERVATIONS + +Suppose the observation of the system at time $t$ follows + +$$ +\begin{array} { c l c r } { { \displaystyle p ( \boldsymbol { y } _ { t } | \boldsymbol { x } _ { t } , \boldsymbol { \Psi } ) = \prod _ { n = 1 } ^ { N } \mathrm { B e r n } ( \boldsymbol { \sigma } ( \boldsymbol { v } _ { n , t } ) ) = \prod _ { n = 1 } ^ { N } \frac { ( e ^ { \boldsymbol { v } _ { n , t } } ) ^ { \boldsymbol { y } _ { n , t } } } { 1 + e ^ { \boldsymbol { v } _ { n , t } } } , } } \\ { { \boldsymbol { v } _ { n , t } = c _ { n } ^ { T } \boldsymbol { x } _ { t } + d _ { n } , } } \end{array} +$$ + +where $c _ { n } \in \mathbb { R } ^ { d _ { x } }$ , $d _ { n } \in \mathbb { R }$ . Equation 33 is of the same form as the left hand side of eq. (20), thus it is amenable to PG augmentation. We introduce PG axillary variables $\eta _ { n , t }$ . Conditioning on $\eta _ { 1 : N }$ eq. (33) becomes + +$$ +\begin{array} { l } { \displaystyle p ( y _ { t } | x _ { t } , \eta _ { 1 : N } ) = \prod _ { n = 1 } ^ { N } e ^ { - \frac { 1 } { 2 } ( \eta _ { n , t } v _ { n , t } - 2 \kappa _ { n , t } v _ { n , t } ) } } \\ { \displaystyle \propto \prod _ { n = 1 } ^ { N } \mathcal { N } ( c _ { n } ^ { T } x _ { t } + d _ { n } | \kappa _ { n , t } / \eta _ { n , t } , 1 / \eta _ { n , t } ) } \\ { \displaystyle = \mathcal { N } ( C x _ { t } + D | H _ { t } ^ { - 1 } \kappa _ { t } , H _ { t } ^ { - 1 } ) } \end{array} +$$ + +where $H _ { t } = \operatorname { d i a g } ( [ \eta _ { 1 , t } , \dotsc , \eta _ { N , t } ] )$ , $\kappa _ { t } = [ \kappa _ { 1 , t } , \ldots , \kappa _ { N , t } ]$ and $\begin{array} { r } { \kappa _ { n , t } = y _ { n , t } - \frac { 1 } { 2 } } \end{array}$ + +The observation is now effectively Gaussian and can be incorporated into the message passing for $x _ { 1 : T }$ . The emission parameters are also conjugate with the augmented observation potential given a Matrix Normal prior. The conditional posterior on the axillary PG variables $\eta _ { n , t }$ also follows a PG distribution i.e. $\eta _ { n , t } \big | ( c _ { n } , d _ { n } ) , x _ { t } \sim \mathrm { P G } ( 1 , \overline { { \upsilon } } _ { n , t } )$ . Note that this augmentation scheme can also work for negative binomial, binomial, and multinomial observations (Polson et al., 2013; Linderman et al., 2015). + +# B.2 MESSAGE PASSING FOR $x _ { 1 : T }$ + +Assuming that the observations, $y _ { 1 : T }$ , are linear and Gaussian, the posterior of the continuous latent states, $x _ { 0 : T }$ , conditioned on all the other variables is proportional to + +$$ +\prod _ { t = 1 } ^ { T } \psi ( x _ { t } , x _ { t - 1 } , z _ { t } ) \psi ( z _ { t } , x _ { t - 1 } ) \psi ( x _ { t } , y _ { t } ) +$$ + +where $\psi ( x _ { t } , x _ { t - 1 } , z _ { t } )$ is the potential of the conditionally linear dynamics, $\psi ( x _ { t } , y _ { t } )$ is the potential of the observation and $\psi ( x _ { t - 1 } , z _ { t } )$ is the recurrence potential. $\psi ( x _ { t - 1 } , z _ { t } )$ is a product of all the internal nodes traversed at time $t$ + +$$ +\psi ( x _ { t - 1 } , z _ { t } ) = \prod _ { n \in \mathrm { p a t h } ( z _ { t } ) \backslash \mathcal { Z } } \psi _ { n } ( x _ { t - 1 } , z _ { t } ) . +$$ + +If the potentials in eq. (38) were all linear and Gaussian, then we could efficiently sample from the posetrior of $x _ { 0 : T }$ by passing messsages forward through Kalman Filtering and then sampling backwards; the prescence of the recurrence potentials prevent this because they aren’t Gaussian. By augmenting the model with the PG r.v.’s, the recurrence potential at internal node $n$ becomes + +$$ +\psi _ { n } ( x _ { t - 1 } , z _ { t } , w _ { n , t - 1 } ) = \mathcal { N } ( R _ { n } ^ { T } x _ { t - 1 } + r _ { n } | \kappa _ { n , t - 1 } / \omega _ { n , t - 1 } , 1 / \omega _ { n , t - 1 } ) +$$ + +which is effectively Gaussian , allowing for the use of the Kalman filter for message passing. + +# C INITIALIZATION + +We initialized the Gibbs sampler using the following initialization procedure: (i) probabilistic PCA was performed on the data, $y _ { 1 : T }$ to initialize the emission parameters, $\{ C , d \}$ and the continuous latent states, $x _ { 1 : T }$ . (ii) To initialize the dynamics of the nodes , $\Theta$ , and the hyperplanes, $\Gamma$ , we propose greedily fitting the proposed model using MSE as the loss function. We first optimize over the root node + +$$ +\underset { A _ { \epsilon } , b _ { \epsilon } } { \arg \operatorname* { m i n } } \frac { 1 } { T } \sum _ { t = 0 } ^ { T } \left\| x _ { t + 1 } - x _ { t } - A _ { \epsilon } x _ { t } - b _ { \epsilon } \right\| _ { 2 } ^ { 2 } , +$$ + +and obtain $A _ { \epsilon } ^ { * } , b _ { \epsilon } ^ { * }$ (Note that $A _ { \epsilon } ^ { * } , b _ { \epsilon } ^ { * }$ can obtained in closed form by computing their corresponding OLS estimates). Fixing $A _ { \epsilon } ^ { * }$ and $b _ { \epsilon } ^ { * }$ , we then optimize over the second level in the tree + +$$ +\begin{array} { c } { \displaystyle \operatorname * { a r g m i n } _ { A _ { 1 } , b _ { 1 } , A _ { 2 } , b _ { 2 } , R _ { \epsilon } , r _ { \epsilon } } \frac { 1 } { T } \sum _ { t = 0 } ^ { T } \| x _ { t + 1 } - \sigma ( v _ { \epsilon } ) \hat { x } _ { 1 } - \sigma ( - v _ { \epsilon } ) \hat { x } _ { 2 } \| , } \\ { \hat { x } _ { i } = x _ { t } + \left( A _ { \epsilon } ^ { * } + A _ { i } \right) x _ { t } + ( b _ { \epsilon } ^ { * } + b _ { i } ) , } \\ { v _ { \epsilon } = R _ { \epsilon } ^ { T } x _ { t } + r _ { \epsilon } . } \end{array} +$$ + +This procedure would continue until we reach the leaf nodes of the tree. $\Theta ^ { * }$ and $\Gamma ^ { * }$ are then used to initialize the dynamics and the hyperplanes, respectively. In our simulations, we used stochastic gradient descent with momentum to perform the optimization. (iii) The discrete latent states, $z _ { 1 : T }$ , were initialized by performing hard classification using $\Gamma ^ { * }$ and the initial estimate of $x _ { 0 : T }$ . + +# D DEALING WITH ROTATIONAL INVARIANCE + +A well known problem with these types of model is it’s susceptibility to rotational and scaling transformation, thus we can only learn the dynamics up to an affine transformation Erosheva & Curtis (2017). During Gibbs sampling the parameters will continuously rotate and scale, which can slow down the mixing of the chains. One possible solution to the issue is if we constrained $C$ to have some special structure which would make the model identifiable; this would require sampling from manifolds which is usually inefficient. Similar to Geweke & Zhou (1996), we use the following procedure to prevent the samples from continuously rotating and scaling: + +• Once we obtain a sample from the conditional posterior of the emission parameters $\{ C , D \}$ , we normalize the columns of $C$ . +• RQ decomposition is performed on $C$ to obtain $U , O$ where $U \in \mathcal { R } ^ { d _ { y } \times d _ { x } }$ is an upper triangular matrix and $\mathcal { \dot { O } } \in \mathcal { R } ^ { d _ { x } \times d _ { x } }$ is an orthogonal matrix. +• We set $C = U$ and rotate all the parameters of the model using $O$ . + +![](images/db5128ea32c1ed553d4f2cad718af7d080559ae0e3e1cda443470d8a3e80d0ea.jpg) +E SCALABILITY AND COMPUTATIONAL COMPLEXITY OF THE INFERENCE +Figure 5: The logarithm of the joint density was computed for all the samples generated from the 3 TrSLDS and smoothed using a trailing moving average filter. The sampler seems to converge to a mode rather quickly for all the three instantiations of the TrSLDS. + +The rSLDS and the TrSLDS share the same linear time complexity for sampling the discrete and continuous states, and both models learn K-1 hyperplanes to weakly partition the space. Specifically, both models incur: an $\mathcal { O } ( T K )$ cost for sampling the discrete states, which increases to $\scriptstyle { \dot { \mathcal { O } } } ( T K ^ { 2 } )$ if we allow Markovian dependencies between discrete states; an $\mathcal { O } ( T D ^ { 3 } )$ cost ( $\mathrm { D }$ is the continuous state dimension) for sampling the continuous states, just like in a linear dynamical system; and $\Im { \mathcal { O } ( K D ^ { 3 } ) }$ cost for sampling the hyperplanes. The only additional cost of the TrSLDS stems from the hierarchical prior on state dynamics. Unlike the rSLDS, we impose a tree-structured prior on the dynamics to encourage similar dynamics between nearby nodes in the tree. Rather than sampling K dynamics parameters, we need to sample 2K-1. Since they are all related via a tree-structured Gaussian graphical model, the cost of an exact sample is $\mathcal { O } ( K \bar { D } ^ { 3 } )$ just as in the rSLDS, with the only difference being a constant factor of about 2. Thus, we obtain a multi-scale view of the underlying system with a negligible effect on the computational complexity. + +To see how the number of discrete latent states effects the convergence speed of the Gibbs sampler, we fit 3 TrSLDS, with $K = 2 , 4 , 8$ respectively, to a Lorenz Attractor described in Sec. but used 250 trajectories to train the model as opposed to 50. To assess convergence, we plotted the logarithm of the joint density as a function of Gibbs samples. The results are shown Fig. 5. + +# F SYNTHETIC NASCAR R + +We ran the TrSLDS on the synthetic NASCAR R example from (Linderman et al., 2017), where the underlying model is an rSLDS. We trained TrSLDS on 10,000 time points and ran Gibbs for 1,000 samples; the last sample was used to create Fig. 6 where the vector fields where created from the mode of the conditional posterior of the dynamics. Even though the partitions were created using sequential stick-breaking, TrSLDS was able to reconstruct the dynamics of the model. + +![](images/cfeeba6d61bd2d40ab17765d02ae14fe7b28e6fa7e68c8565508e466a951e7f3.jpg) +Figure 6: TrSLDS applied to the synthetic NASCAR R example. (left top) The true continuous latent states colored by their discrete state assignment. (left bottom) TrSLDS is able to infer the continuous and discrete latent states. (middle top) The dynamics were constructed such that the trajectories produced creates an oval track. (middle bottom) Although the partitioning is done through sequential stick-breaking, TrSLDS is still able to recover the dynamics. (right) We can see that TrSLDS can indeed recover a multi-scale view. The root nodes captures the rotation. The second level seperates the track into two rotations of different speeds. + +# G TREE SYNTHETIC NASCAR R + +To check whether the sampler is mixing adequately, we test TrSLDS on a twist on the synthetic NASCAR R example where the underlying model is a TrSLDS. We also ran rSLDS on the example to highlight the limitations of seqeuntail stick-breaking. We trained both rSLDS and TrSLDS on 20,000 time points and Gibbs was ran for 1,000 samples; the last sample was used to create Fig. 7. To compare the precditive performance between the models, the $R _ { k } ^ { 2 }$ was computed for rSLDS and TrSLDS. + +![](images/4b226de744df071e054ce184313783f598a4f41d6427f6a788d7c3e8e822312c.jpg) +Figure 7: TrSLDS and rSLDS applied to the tree version of to the synthetic NASCAR R . (left top)The true continuous latent states colored by their discrete state assignment. (left bottom) TrSLDS is able to infer the continuous and discrete latent states. (middle) TrSLDS was able to learn the underlying dynamics and partitions, indiicating that the sampler is mixing well. (right top)Due to the sequential nature of rSLDS, the model can’t adequately learn the dynamics of the model. (right bottom) We can see from the $\mathbf { k }$ -step $R ^ { 2 }$ that TrSLDS outperforms rSLDS. \ No newline at end of file diff --git a/md/train/HkzSQhCcK7/HkzSQhCcK7.md b/md/train/HkzSQhCcK7/HkzSQhCcK7.md new file mode 100644 index 0000000000000000000000000000000000000000..a6c4241cc0d144fc1c58b5c18ae5c465c468fd42 --- /dev/null +++ b/md/train/HkzSQhCcK7/HkzSQhCcK7.md @@ -0,0 +1,322 @@ +# STCN: STOCHASTIC TEMPORAL CONVOLUTIONAL NETWORKS + +Emre Aksan & Otmar Hilliges +Department of Computer Science +ETH Zurich, Switzerland +{emre.aksan, otmar.hilliges}@inf.ethz.ch + +# ABSTRACT + +Convolutional architectures have recently been shown to be competitive on many sequence modelling tasks when compared to the de-facto standard of recurrent neural networks (RNNs), while providing computational and modeling advantages due to inherent parallelism. However, currently there remains a performance gap to more expressive stochastic RNN variants, especially those with several layers of dependent random variables. In this work, we propose stochastic temporal convolutional networks (STCNs), a novel architecture that combines the computational advantages of temporal convolutional networks (TCN) with the representational power and robustness of stochastic latent spaces. In particular, we propose a hierarchy of stochastic latent variables that captures temporal dependencies at different time-scales. The architecture is modular and flexible due to decoupling of deterministic and stochastic layers. We show that the proposed architecture achieves state of the art log-likelihoods across several tasks. Finally, the model is capable of predicting high-quality synthetic samples over a long-range temporal horizon in modeling of handwritten text. + +# 1 INTRODUCTION + +Generative modeling of sequence data requires capturing long-term dependencies and learning of correlations between output variables at the same time-step. Recurrent neural networks (RNNs) and its variants have been very successful in a vast number of problem domains which rely on sequential data. Recent work in audio synthesis, language modeling and machine translation tasks (Dauphin et al., 2016; Van Den Oord et al., 2016; Dieleman et al., 2018; Gehring et al., 2017) has demonstrated that temporal convolutional networks (TCNs) can also achieve at least competitive performance without relying on recurrence, and hence reducing the computational cost for training. + +Both RNNs and TCNs model the joint probability distribution over sequences by decomposing the distribution over discrete time-steps. In other words, such models are trained to predict the next step, given all previous time-steps. RNNs are able to model long-term dependencies by propagating information through their deterministic hidden state, acting as an internal memory. In contrast, TCNs leverage large receptive fields by stacking many dilated convolutions, allowing them to model even longer time scales up to the entire sequence length. It is noteworthy that there is no explicit temporal dependency between the model outputs and hence the computations can be performed in parallel. The TCN architecture also introduces a temporal hierarchy: the upper layers have access to longer input sub-sequences and learn representations at a larger time scale. The local information from the lower layers is propagated through the hierarchy by means of residual and skip connections (Van Den Oord et al., 2016; Bai et al., 2018). + +However, while TCN architectures have been shown to perform similar or better than standard recurrent architectures on particular tasks (Van Den Oord et al., 2016; Bai et al., 2018), there currently remains a performance gap to more recent stochastic RNN variants (Bayer & Osendorfer, 2014; Chung et al., 2015; Fabius & van Amersfoort, 2014; Fraccaro et al., 2016; Goyal et al., 2017; Shabanian et al., 2017). Following a similar approach to stochastic RNNs, Lai et al. (2018) present a significant improvement in the log-likelihood when a TCN model is coupled with latent variables, albeit at the cost of limited receptive field size. + +![](images/d359808562547faeee9a83d1af529c4304cb6f63f56df5ac6e6025a77b3485c8.jpg) +Figure 1: The computational graph of generative (left) and inference (right) models of STCN. The approximate posterior $q$ is conditioned on $\mathbf { d } _ { t }$ and is updated by the prior $p$ which is conditioned on the TCN representations of the previous time-step $\mathbf { d } _ { t - 1 }$ . The random latent variables at the upper layers have access to a long history while lower layers receive inputs from more recent time steps. + +In this work we propose a new approach for augmenting TCNs with random latent variables, that decouples deterministic and stochastic structures yet leverages the increased modeling capacity efficiently. Motivated by the simplicity and computational advantages of TCNs and the robustness and performance of stochastic RNNs, we introduce stochastic temporal convolutional networks (STCN) by incorporating a hierarchy of stochastic latent variables into TCNs which enables learning of representations at many timescales. However, due to the absence of an internal state in TCNs, introducing latent random variables analogously to stochastic RNNs is not feasible. Furthermore, defining conditional random variables across time-steps would result in breaking the parallelism of TCNs and is hence undesirable. + +In STCN the latent random variables are arranged in correspondence to the temporal hierarchy of the TCN blocks, effectively distributing them over the various timescales (see figure 1). Crucially, our hierarchical latent structure is designed to be a modular add-on for any temporal convolutional network architecture. Separating the deterministic and stochastic layers allows us to build STCNs without requiring modifications to the base TCN architecture, and hence retains the scalability of TCNs with respect to the receptive field. This conditioning of the latent random variables via different timescales is especially effective in the case of TCNs. We show this experimentally by replacing the TCN layers with stacked LSTM cells, leading to reduced performance compared to STCN. + +We propose two different inference networks. In the canonical configuration, samples from each latent variable are passed down from layer to layer and only one sample from the lowest layer is used to condition the prediction of the output. In the second configuration, called STCN-dense, we take inspiration from recent CNN architectures (Huang et al., 2017) and utilize samples from all latent random variables via concatenation before computing the final prediction. + +Our contributions can thus be summarized as: 1) We present a modular and scalable approach to augment temporal convolutional network models with effective stochastic latent variables. 2) We empirically show that the STCN-dense design prevents the model from ignoring latent variables in the upper layers (Zhao et al., 2017). 3) We achieve state-of-the-art log-likelihood performance, measured by ELBO, on the IAM-OnDB, Deepwriting, TIMIT and the Blizzard datasets. 4) Finally we show that the quality of the synthetic samples matches the significant quantitative improvements. + +# 2 BACKGROUND + +Auto-regressive models such as RNNs and TCNs factorize the joint probability of a variable-length sequence $\mathbf { x } = \{ x _ { 1 } , \dots , x _ { T } \}$ as a product of conditionals as follows: + +$$ +p _ { \theta } ( { \bf x } ) = \prod _ { t = 1 } ^ { T } p _ { \theta } ( x _ { t } | x _ { 1 : t - 1 } ) \quad , +$$ + +where the joint distribution is parametrized by $\theta$ . The prediction at each time-step is conditioned on all previous observations. The observation model is frequently chosen to be a Gaussian or Gaussian mixture model (GMM) for real-valued data, and a categorical distribution for discrete-valued data. + +# 2.1 TEMPORAL CONVOLUTIONAL NETWORKS + +In TCNs the joint probabilities in Eq. (1) are parametrized by a stack of convolutional layers. Causal convolutions are the central building block of such models and are designed to be asymmetric such that the model has no access to future information. In order to produce outputs of the same size as the input, zero-padding is applied at every layer. + +In the absence of a state transition function, a large receptive field is crucial in capturing long-range dependencies. To avoid the need for vast numbers of causal convolution layers, typically dilated convolutions are used. Exponentially increasing the dilation factor results in an exponential growth of the receptive field size with depth (Yu & Koltun, 2015; Van Den Oord et al., 2016; Bai et al., 2018). In this work, without loss of generality, we use the building blocks of Wavenet (Van Den Oord et al., 2016) as gated activation units (van den Oord et al., 2016) have been reported to perform better. + +A deterministic TCN representation $d _ { t } ^ { l }$ at time-step $t$ and layer $l$ summarizes the input sequence $x _ { 1 : t }$ + +$$ +d _ { t } ^ { l } = \mathbf { C o n v } ^ { ( l ) } ( d _ { t } ^ { l - 1 } , d _ { t - j } ^ { l - 1 } ) \quad \mathrm { a n d } \quad d _ { t } ^ { 1 } = \mathbf { C o n v } ^ { ( 1 ) } ( x _ { t } , x _ { t - j } ) \quad , +$$ + +where the filter width is 2 and $j$ denotes the dilation step. In our work, the stochastic variables $z ^ { l } , l \ = \ 1 \ldots L$ are conditioned on TCN representations $d ^ { l }$ that are constructed by stacking $K$ Wavenet blocks over the previous $d ^ { l - 1 }$ (for details see Figure 4 in Appendix). + +# 2.2 NON-SEQUENTIAL LATENT VARIABLE MODELS + +VAEs (Kingma & Welling, 2013; Rezende et al., 2014) introduce a latent random variable $\mathbf { z }$ to learn the variations in the observed non-sequential data where the generation of the sample $\mathbf { X }$ is conditioned on the latent variable $\mathbf { z }$ . The joint probability distribution is defined as: + +$$ +\begin{array} { r } { p _ { \theta } ( \mathbf { x } , \mathbf { z } ) = p _ { \theta } ( \mathbf { x } | \mathbf { z } ) p _ { \theta } ( \mathbf { z } ) \quad , } \end{array} +$$ + +and parametrized by $\theta$ . Optimizing the marginal likelihood is intractable due to the non-linear mappings between $\mathbf { z }$ and $\mathbf { X }$ and the integration over $\mathbf { z }$ . Instead the VAE framework introduces an approximate posterior $q _ { \phi } ( { \bf z } | { \bf x } )$ and optimizes a lower-bound on the marginal likelihood: + +$$ +\begin{array} { r } { \log p _ { \theta } ( \mathbf { x } ) \geq - K L ( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) | | p _ { \theta } ( \mathbf { z } ) ) + \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } [ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } ) ] \quad , } \end{array} +$$ + +where $K L$ denotes the Kullback-Leibler divergence. Typically the prior $p _ { \boldsymbol { \theta } } ( \mathbf { z } )$ and the approximate $q _ { \phi } ( { \bf z } | { \bf x } )$ are chosen to be in simple parametric form, such as a Gaussian distribution with diagonal covariance, which allows for an analytical calculation of the $K L$ -term in Eq. (4). + +# 2.3 STOCHASTIC RNNS + +An RNN captures temporal dependencies by recursively processing each input, while updating an internal state $h _ { t }$ at each time-step via its state-transition function: + +$$ +h _ { t } = f ^ { ( h ) } ( x _ { t } , h _ { t - 1 } ) \quad , +$$ + +where $f ^ { ( h ) }$ is a deterministic transition function such as LSTM (Hochreiter & Schmidhuber, 1997) or GRU (Cho et al., 2014) cells. The computation has to be sequential because $h _ { t }$ depends on $h _ { t - 1 }$ . + +The VAE framework has been extended for sequential data, where a latent variable $z _ { t }$ augments the RNN state $h _ { t }$ at each sequence step. The joint distribution $p _ { \boldsymbol { \theta } } ( \mathbf { x } , \mathbf { z } )$ is modeled via an auto-regressive model which results in the following factorization: + +$$ +p _ { \theta } ( \mathbf { x } , \mathbf { z } ) = \prod _ { t = 1 } ^ { T } p _ { \theta } ( x _ { t } | z _ { 1 : t } , x _ { 1 : t - 1 } ) p _ { \theta } ( z _ { t } | x _ { 1 : t - 1 } , z _ { 1 : t - 1 } ) \quad . +$$ + +In contrast to the fixed prior of VAEs, $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ , sequential variants define prior distributions conditioned on the RNN hidden state $\mathbf { h }$ and implicitly on the input sequence $\mathbf { X }$ (Chung et al., 2015). + +![](images/c0aec47397b8ede7adba3b46cdcc820188b2ad1e6dfda787b03aa04c1a251b89.jpg) +Figure 2: Graphical model view of generative models of STCN (left) and STCN-dense (middle), and the inference model (right), which is shared by both variants. Diamonds represent the outputs of deterministic dilated convolution blocks where the dependence of $d _ { t }$ on the past inputs is not shown for clarity (see Eq. (2)). $x _ { t }$ and $z _ { t }$ are observable inputs and latent random variables, respectively. The generative task is to predict the next step in the sequence, given all past steps. Note that in the STCN-dense variant the next step is conditioned on all latent variables $z _ { t } ^ { l }$ for $l = 1 \ldots L$ . + +# 3 STOCHASTIC TEMPORAL CONVOLUTIONAL NETWORKS + +The mechanics of STCNs are related to those of VRNNs and LVAEs. Intuitively, the RNN state $h _ { t }$ is replaced by temporally independent TCN layers $d _ { t } ^ { l }$ . In the absence of an internal state, we define hierarchical latent variables $\dot { \boldsymbol { z } } _ { t } ^ { l }$ that are conditioned vertically, i.e., in the same time-step, but independent horizontally, i.e., across time-steps. We follow a similar approach to LVAEs (Sønderby et al., 2016) in defining the hierarchy in a top-down fashion and in how we estimate the approximate posterior. The inference network first computes the approximate likelihood, and then this estimate is corrected by the prior, resulting in the approximate posterior. The TCN layers $\mathbf { d }$ are shared between the inference and generator networks, analogous to VRNNs (Chung et al., 2015). + +Figure 2 depicts the proposed STCN as a graphical model. STCNs consist of two main modules: the deterministic temporal convolutional network and the stochastic latent variable hierarchy. For a given input sequence $\mathbf { x } = \{ x _ { t } \} , t = 1 . . . T$ we first apply dilated convolutions over the entire sequence to compute a set of deterministic representations $\dot { d } _ { t } ^ { \check { l } } , l = 1 \ldots L$ . Here, $d _ { t } ^ { l }$ corresponds to the output of a block of dilated convolutions at layer $l$ and time-step $t$ . The output $d _ { t } ^ { l }$ is then used to update a set of random latent variables $z _ { t } ^ { l }$ arranged to correspond with different time-scales. + +To preserve the parallelism of TCNs, we do not introduce an explicit dependency between different time-steps. However, we suggest that conditioning a latent variable $z _ { t } ^ { l - \bar { 1 } }$ on the preceding variable $z _ { t } ^ { l }$ implicitly introduces temporal dependencies. Importantly, the random latent variables in the upper layer have access to a larger receptive field due to its deterministic input $d _ { t - 1 } ^ { l }$ , whereas latent random variables in lower layers are updated with different, more local information. However, the latent variable $z _ { t } ^ { l - 1 }$ may receive longer-range information from $z _ { t } ^ { l }$ . + +The generative and inference models are jointly trained by optimizing a step-wise variational lower bound on the log-likelihood (Kingma $\&$ Welling, 2013; Rezende et al., 2014). In the following sections we describe these components and build up the lower-bound for a single time-step $t$ . + +# 3.1 GENERATIVE MODEL + +Each sequence step $x _ { t }$ is generated from a set of latent variables $z _ { t }$ , split into layers as follows: + +$$ +p _ { \theta } \big ( z _ { t } \vert x _ { 1 : t - 1 } \big ) = p _ { \theta } \big ( z _ { t } ^ { L } \vert d _ { t - 1 } ^ { L } \big ) \prod _ { l = 1 } ^ { L - 1 } p _ { \theta } \big ( z _ { t } ^ { l } \vert z _ { t } ^ { l + 1 } , d _ { t - 1 } ^ { l } \big ) \quad , +$$ + +$$ +p _ { \theta } ( z _ { t } ^ { l } | z _ { t } ^ { l + 1 } , d _ { t - 1 } ^ { l } ) = \mathcal { N } ( \mu _ { t , p } ^ { l } , \sigma _ { t , p } ^ { l } ) \quad \mathrm { a n d } \quad [ \mu _ { t , p } ^ { l } , \sigma _ { t , p } ^ { l } ] = f _ { p } ^ { ( l ) } ( z _ { t } ^ { l + 1 } , d _ { t - 1 } ^ { l } ) \quad . +$$ + +Here the prior is modeled by a Gaussian distribution with diagonal covariance, as is common in the VAE framework. The subscript $p$ denotes items of the generative distribution. For the inference distribution we use the subscript $q$ . The distributions are parameterized by a neural network $f _ { p } ^ { ( l ) }$ and conditioned on: (1) the $d _ { t - 1 } ^ { l }$ computed by the dilated convolutions from the previous time-step, and (2) a sample from the preceding level at the same time-step zl+1t . Please note that at inference time we draw samples from the approximate posterior distribution $z _ { t } ^ { l + 1 } \sim q _ { \phi } ( z _ { t } ^ { l + 1 } | \cdot )$ . The generative model, on the other hand, uses the prior $z _ { t } ^ { l + 1 } \sim p _ { \theta } ( z _ { t } ^ { l + 1 } | \cdot )$ . + +We propose two variants of the observation model. In the non-sequential scenario, the observations are defined to be conditioned on only the last latent variable in the hierarchy, i.e., $p _ { \theta } ( x _ { t } | z _ { t } ^ { 1 } )$ , following Sønderby et al. (2016); Gulrajani et al. (2016) and Rezende et al. (2014) our STCN variant uses the same observation model, allowing for an efficient optimization. However, latent units are likely to become inactive during training in this configuration (Burda et al., 2015; Bowman et al., 2015; Zhao et al., 2017) resulting in a loss of representational power. + +The latent variables at different layers are conditioned on different contexts due to the inputs $d _ { t } ^ { l }$ . Hence, the latent variables are expected to capture complementary aspects of the temporal context. To propagate the information all the way to the final prediction and to ensure that gradients flow through all layers, we take inspiration from Huang et al. (2017) and directly condition the output probability on samples from all latent variables. We call this variant of our architecture STCN-dense. + +The final predictions are then computed by the respective observation functions: + +$$ +p _ { \theta } ( x _ { t } | z _ { t } ) = f ^ { ( o ) } ( z _ { t } ^ { 1 } ) \quad \mathrm { a n d } \quad p _ { \theta } ^ { d e n s e } ( x _ { t } | z _ { t } ) = f ^ { ( o ) } ( z _ { t } ^ { 1 } , z _ { t } ^ { 2 } \dots z _ { t } ^ { L } ) \quad , +$$ + +where $f ^ { ( o ) }$ corresponds to the output layer constructed by stacking 1D convolutions or Wavenet blocks depending on the dataset. + +# 3.2 INFERENCE MODEL + +In the original VAE framework the inference model is defined as a bottom-up process, where the latent variables are conditioned on the stochastic layer below. Furthermore, the parameterization of the prior and approximate posterior distributions are computed separately (Burda et al., 2015; Rezende et al., 2014). In contrast, Sønderby et al. (2016) propose a top-down dependency structure shared across the generative and inference models. From a probabilistic point of view, the approximate Gaussian likelihood, computed bottom-up by the inference model, is combined with the Gaussian prior, computed top-down from the generative model. We follow a similar procedure in computing the approximate posterior. + +First, the parameters of the approximate likelihood are computed for each stochastic layer $l$ : + +$$ +[ \hat { \mu } _ { t , q } ^ { l } , \hat { \sigma } _ { t , q } ^ { l } ] = f _ { q } ^ { ( l ) } ( z _ { t } ^ { l + 1 } , d _ { t } ^ { l } ) \quad , +$$ + +followed by the downward pass, recursively computing the prior and approximate posterior by precision-weighted addition: + +$$ +\begin{array} { l } { { \sigma _ { t , q } ^ { l } = \frac { 1 } { ( \hat { \sigma } _ { t , q } ^ { l } ) ^ { - 2 } + ( \sigma _ { t , p } ^ { l } ) ^ { - 2 } } \quad , } } \\ { { \mu _ { t , q } ^ { l } = \sigma _ { t , q } ^ { l } ( \hat { \mu } _ { t , q } ^ { l } ( \hat { \sigma } _ { t , q } ^ { l } ) ^ { - 2 } + \mu _ { t , p } ^ { l } ( \sigma _ { t , p } ^ { l } ) ^ { - 2 } ) \quad . } } \end{array} +$$ + +Finally, the approximate posterior has the same decomposition as the prior (see Eq. (7)): + +$$ +q _ { \phi } ( z _ { t } | x _ { 1 : t } ) = q _ { \phi } ( z _ { t } ^ { L } | d _ { t } ^ { L } ) \prod _ { l = 1 } ^ { L - 1 } q _ { \phi } ( z _ { t } ^ { l } | z _ { t } ^ { l + 1 } , d _ { t } ^ { l } ) \quad , +$$ + +$$ +\begin{array} { r } { q _ { \phi } ( z _ { t } ^ { l } | z _ { t } ^ { l + 1 } , d _ { t } ^ { l } ) = \mathcal { N } ( \mu _ { t , q } ^ { l } , \sigma _ { t , q } ^ { l } ) \quad . } \end{array} +$$ + +Note that the inference and generative network share the parameters of dilated convolutions $\mathrm { C o n v } ^ { ( l ) }$ + +# 3.3 LEARNING + +The variational lower-bound on the log-likelihood at time-step $t$ can be defined as follows: + +$$ +\begin{array} { r l } & { \log p ( x _ { t } ) \geq \mathbb { E } _ { q _ { \phi } ( z _ { t } | x _ { t } ) } [ \log p \theta ( x _ { t } | z _ { t } ) ] - D _ { K L } ( q _ { \phi } ( z _ { t } | x _ { 1 : t } ) | | p \theta ( z _ { t } | x _ { 1 : t - 1 } ) ) } \\ & { \qquad = \mathbb { E } _ { q _ { \phi } ( z _ { t } ^ { 1 } \dots z _ { t } ^ { L } | x _ { t } ) } [ \log p \theta ( x _ { t } | z _ { t } ^ { 1 } \dots z _ { t } ^ { L } ) ] - D _ { K L } ( q _ { \phi } ( z _ { t } ^ { 1 } \dots z _ { t } ^ { L } | x _ { 1 : t } ) | | p \theta ( z _ { t } ^ { 1 } \dots z _ { t } ^ { L } | x _ { 1 : t - 1 } ) ) } \\ & { \mathcal { C } _ { t } ( \theta , \phi ; x _ { t } ) = \mathcal { L } _ { t } ^ { R e c o n } + \mathcal { L } _ { t } ^ { K L } . } \end{array} +$$ + +Using the decompositions from Eq. (7) and (12), the Kullback-Leibler divergence term becomes: + +$$ +\begin{array} { r l } { \displaystyle \mathcal { L } _ { t } ^ { K L } = - D _ { K L } \big ( q _ { \phi } ( \boldsymbol { z } _ { t } ^ { L } | \boldsymbol { d } _ { t } ^ { L } ) | | p _ { \theta } \big ( \boldsymbol { z } _ { t } ^ { L } | \boldsymbol { d } _ { t - 1 } ^ { L } \big ) \big ) } & { } \\ { \displaystyle - \sum _ { l = 1 } ^ { L - 1 } \mathbb { E } _ { q _ { \phi } ( \boldsymbol { z } _ { t } ^ { l + 1 } | \cdot ) } \big [ D _ { K L } \big ( q _ { \phi } \big ( \boldsymbol { z } _ { t } ^ { l } | \boldsymbol { z } _ { t } ^ { l + 1 } , \boldsymbol { d } _ { t } ^ { l } \big ) | | p _ { \theta } \big ( \boldsymbol { z } _ { t } ^ { l } | \boldsymbol { z } _ { t } ^ { l + 1 } , \boldsymbol { d } _ { t - 1 } ^ { l } \big ) \big ) \big ] } & { . } \end{array} +$$ + +The KL term is the same for the STCN and STCN-dense variants. The reconstruction term $\mathcal { L } _ { t } ^ { R e c o n }$ , however, is different. In STCN we only use samples from the lowest layer of the hierarchy, whereas in STCN-dense we use all latent samples in the observation model: + +$$ +\begin{array} { r l } { \mathcal { L } _ { t } ^ { R e c o n } = \mathbb { E } _ { q _ { \phi } ( z _ { t } ^ { 1 } \ldots z _ { t } ^ { L } | x _ { t } ) } [ \log p _ { \theta } ( x _ { t } | z _ { t } ^ { 1 } ) ] } & { { } , } \\ { \mathcal { L } _ { t } ^ { R e c o n - d e n s e } = \mathbb { E } _ { q _ { \phi } ( z _ { t } ^ { 1 } \ldots z _ { t } ^ { L } | x _ { t } ) } [ \log p _ { \theta } ( x _ { t } | z _ { t } ^ { 1 } \ldots z _ { t } ^ { L } ] } & { { } . } \end{array} +$$ + +In the dense variant, samples drawn from the latent variables $z _ { t } ^ { l }$ are carried over the dense connections. Similar to Maaløe et al. (2016), the expectation over $z _ { t } ^ { l }$ variables are computed by Monte Carlo sampling using the reparameterization trick (Kingma & Welling, 2013; Rezende et al., 2014). + +Please note that the computation of $\mathcal { L } _ { t } ^ { R e c o n - d e n s e }$ does not introduce any additional computational cost. In STCN, all latent variables have to be visited in terms of ancestral sampling in order to draw the latent sample $z _ { t } ^ { 1 }$ for the observation $x _ { t }$ . Similarly in STCN-dense, the same intermediate samples $z _ { t } ^ { l }$ are used in the prediction of $x _ { t }$ . + +One alternative option to use the latent samples could be to sum individual samples before feeding them into the observation model, i.e., $s u m ( \dot { [ } z _ { t } ^ { 1 } \dots z _ { t } ^ { L } ] )$ , (Maaløe et al., 2016). We empirically found that this does not work well in STCN-dense. Instead, we concatenate all samples $\left[ z _ { t } ^ { 1 } \circ \cdots \circ z _ { t } ^ { L } \right]$ analogously to DenseNet (Huang et al., 2017) and (Kaiser et al., 2018). + +# 4 EXPERIMENTS + +We evaluate the proposed variants STCN and STCN-dense both quantitatively and qualitatively on modeling of digital handwritten text and speech. We compare with vanilla TCNs, RNNs, VRNNs and state-of-the art models on the corresponding tasks. + +In our experiments we use two variants of the Wavenet model: (1) the original model proposed in (Van Den Oord et al., 2016) and (2) a variant that we augment with skip connections analogously to STCN-dense. This additional baseline evaluates the benefit of learning multi-scale representations in the deterministic setting. Details of the experimental setup are provided in the Appendix. Our code is available at https://ait.ethz.ch/projects/2019/stcn/. + +Handwritten text: The IAM-OnDB and Deepwriting datasets consist of digital handwriting sequences where each time-step contains real-valued $( x , y )$ pen coordinates and a binary pen-up event. The IAM-OnDB data is split and pre-processed as done in (Chung et al., 2015). Aksan et al. (2018) extend this dataset with additional samples and better pre-processing. + +Table 1 reveals that again both our variants outperform the vanilla variants of TCNs and RNNs on IAM-OnDB. While the stochastic VRNN and SWaveNet are competitive wrt to the STCN variant, both are outperformed by the STCN-dense version. The same relative ordering is maintained on the Deepwriting dataset, indicating that the proposed architecture is robust across datasets. + +![](images/b93a1887df7d73e452966757899db96ab3e51bdbb1aecfabae9ef2b6ba19969a.jpg) +Figure 3: (a) Handwriting samples from IAM-OnDB dataset. Generated samples from (b) VRNN, (c) SWaveNet and (d) our model STCN-dense. Each line corresponds to one sample. + +Table 1: Average log-likelihood per sequence on TIMIT, Blizzard, IAM-OnDB and Deepwriting datasets. (Normal) and (GMM) stand for unimodal Gaussian or multi-modal Gaussian Mixture Model (GMM) as the observation model (Graves, 2013; Chung et al., 2015). Asterisks ∗ indicate that we used our re-implementation only for the Deepwriting dataset. + +
ModelsTIMITBlizzardIAM-OnDBDeepwriting
Wavenet (GMM)3018881901381612
Wavenet-dense (GMM)3063682121380642
RNN (GMM) Chung et al. (2015)2664374131358528 *
VRNN (Normal) Chung et al.(2015)~30235~9516≈1354≥ 495 *
VRNN (GMM) Chung et al. (2015)≈ 29604~9392≈1384≥ 673 *
SRNN (Normal) Fraccaro et al. (2016)≥ 60550≥11991n/an/a
Z-forcing (Normal) Goyal etal. (2017)≥ 70469≥ 15430n/an/a
Var.Bi-LSTM (Normal) Shabanian et al.(2017)≥ 73976≥ 17319n/an/a
SWaveNet (Normal) Lai etal. (2018)≥ 72463≥ 15708≥1301n/a
STCN (GMM)≥ 69195M 15800≥ 1338≥ 605
STCN-dense (GMM)≥ 71386≥ 16288≥ 1796≥ 797
STCN-dense-large (GMM)≥ 77438≥ 17670n/an/a
+ +Fig. 3 compares generated handwriting samples. While all models produce consistent style, our model generates more natural looking samples. Note that the spacing between words is clearly visible and most of the letters are distinguishable. + +Speech modeling: TIMIT and Blizzard are standard benchmark dataset in speech modeling. The models are trained and tested on 200 dimensional real-valued amplitudes. We apply the same pre-processing as Chung et al. (2015). For this task we introduce STCN-dense-large, with increased model capacity. Here we use 512 instead of 256 convolution filters. Note that the total number of model parameters is comparable to SWaveNet and other SOA models. + +On TIMIT, STCN-dense (Table 1) significantly outperforms the vanilla TCN and RNN, and stochastic models. On the Blizzard dataset, our model is marginally better than the Variational Bi-LSTM. Note that the inference models of SRNN (Fraccaro et al., 2016), Z-forcing (Goyal et al., 2017), and Variational Bi-LSTM (Shabanian et al., 2017) receive future information by using backward RNN cells. Similarly, SWaveNet (Lai et al., 2018) applies causal convolutions in the backward direction. Hence, the latent variable can be expected to model future dynamics of the sequence. In contrast, our models have only access to information up to the current time-step. These results indicate that the STCN variants perform very well on the speech modeling task. + +Latent Space Analysis: Zhao et al. (2017) observe that in hierarchical latent variable models the upper layers have a tendency to become inactive, indicated by a low KL loss (Sønderby et al., 2016; Dieng et al., 2018). Table 2 shows the KL loss per latent variable and the corresponding log-likelihood measured by ELBO in our models. Across the datasets it can be observed that our models make use of many of the latent variables which may explain the strong performance across tasks in terms of log-likelihoods. Note that STCN uses a standard hierarchical structure. However, individual latent variables have different information context due to the corresponding TCN block’s receptive field. This observation suggests that the proposed combination of TCNs and stochastic variables is indeed effective. Furthermore, in STCN we see a similar utilization pattern of the $z$ variables across tasks, whereas STCN-dense may have more flexibility in modeling the temporal dependencies within the data due to its dense connections to the output layer. + +Table 2: KL-loss per latent variable computed over the entire test split. KL5 corresponds to the KL-loss of the top-most latent variable. + +
Dataset (Model)ELBOKLKL1KL2KL3KL4KL5
IAM-OnDB (sTCN-dense)≥ 1796.31653.917.91287.4305.341.02.4
IAM-OnDB (sTCN)≥ 1339.2964.2846.0105.212.90.10.0
TIMIT (sTCN-dense)≥ 71385.922297.516113.05641.6529.08.35.7
TIMIT (STCN)≥ 69194.923118.322275.5487.2355.50.00.0
+ +Replacing TCN with RNN: To better understand potential symergies between dilated CNNs and the proposed latent variable hierarchy, we perform an ablation study, isolating the effect of TCNs and the latent space. To this end the deterministic TCN blocks are replaced with LSTM cells by keeping the latent structure intact. We dub this condition LadderRNN. We use the TIMIT and IAM-OnDB datasets for evaluation. Table 3 summarizes performance measured by the ELBO. + +The most direct translation of the the STCN architecture into an RNN counterpart has 25 stacked LSTM cells with 256 units each. Similar to STCN, we use 5 stochastic layers (see Appendix 7.1). Note that stacking this many LSTM cells is unusual and resulted in instabilities during training. Hence, the performance is similar to vanilla RNNs. The second LadderRNN configuration uses 5 stacked LSTM cells with 512 units and a one-to-one mapping with the stochastic layers. On the TIMIT dataset, all LadderRNN configurations show a significant improvement. We also observe a pattern of improvement with densely connected latent variables. + +This experiments shows that the proposed modular latent variable design does allow for the usage of different building blocks. Even when attached to LSTM cells, it boosts the log-likelihood performance (see 5x512- LadderRNN), in particular when used with dense connections. However, the empirical results suggest that the densely connected latent hierarchy interacts particularly well with dilated CNNs. We suggest this is due to the hierarchical nature on both sides of the architecture. On both datasets STCN models achieved the best performance and significantly improve with dense connections. This supports our contribution of a latent variable hierarchy, which models different aspects of information from the input time-series. + +Table 3: ELBO of LadderRNN and STCN models using the same latent space configuration. The prefix of a model entries denote the number of RNN or TCN layers and unit size per layer. Models have similar number of trainable parameters. + +
ModelsTIMITIAM-OnDB
25x256-LadderRNN (Normal)≥ 28207≥ 1305
25x256-LadderRNN-dense (Normal)≥ 27413>I >I 1278
25x256-LadderRNN (GMM)≥ 248391381
25x256-LadderRNN-dense (GMM)≥ 26240≥ 1377
5x512-LadderRNN (Normal)≥ 49770≥ 1299
5x512-LadderRNN-dense (Normal)M 486121374
5x512-LadderRNN (GMM)M 47179>I >I 1359
5x512-LadderRNN-dense (GMM)≥ 50113≥ 1581
25x256-STCN (Normal)≥ 64913≥ 1327
25x256-STCN-dense (Normal)M 70294N 1729
25x256-STCN (GMM)M :69195≥ 1339
25x256-STCN-dense (GMM)M 71386≥ 1796
+ +# 5 RELATED WORK + +Rezende et al. (2014) propose Deep Latent Gaussian Models (DLGM) and Sønderby et al. (2016) propose the Ladder Variational Autoencoder (LVAE). In both models the latent variables are hierarchically defined and conditioned on the preceding stochastic layer. LVAEs improve upon DLGMs via implementation of a top-down hierarchy both in the generative and inference model. The approximate posterior is computed via a precisionweighted update of the approximate likelihood (i.e., the inference model) and prior (i.e., the generative model). Similarly, the PixelVAE (Gulrajani et al., 2016) incorporates a hierarchical latent space decomposition and uses an autoregressive decoder. Zhao et al. (2017) show under mild conditions that straightforward stacking of latent variables (as is done e.g. in LVAE and PixelVAE) can be ineffective, because the latent variables that are not directly conditioned on the observation variable become inactive. + +Due to the nature of the sequential problem domain, our approach differs in the crucial aspects that STCNs use dynamic, i.e., conditional, priors (Chung et al., 2015) at every level. Moreover, the hierarchy is not only implicitly defined by the network architecture but also explicitly defined by the information content, i.e., receptive field size. Dieng et al. (2018) both theoretically and empirically show that using skip connections from the latent variable to every layer of the decoder increases mutual information between the latent and observation variables. Similar to Dieng et al. (2018) in STCN-dense, we introduce skip connections from all latent variables to the output. In STCN the model is expected to encode and propagate the information through its hierarchy. + +Yang et al. (2017) suggest using autoregressive TCN decoders to remedy the posterior collapse problem observed in language modeling with LSTM decoders (Bowman et al., 2015). van den Oord et al. (2017) and Dieleman et al. (2018) use TCN decoders conditioned on discrete latent variables to model audio signals. + +Stochastic RNN architectures mostly vary in the way they employ the latent variable and parametrize the approximate posterior for variational inference. Chung et al. (2015) and Bayer & Osendorfer (2014) use the latent random variable to capture high-level information causing the variability observed in sequential data. Particularly Chung et al. (2015) shows that using a conditional prior rather than a standard Gaussian distribution is very effective in sequence modeling. In (Fraccaro et al., 2016; Goyal et al., 2017; Shabanian et al., 2017), the inference model, i.e., the approximate posterior, receives both the past and future summaries of the sequence from the hidden states of forward and backward RNN cells. The KL-divergence term in the objective enforces the model to learn predictive latent variables in order to capture the future states of the sequence. + +Lai et al. (2018)’s SWaveNet is most closely related to ours. SWaveNet also introduces latent variables into TCNs. However, in SWaveNet the deterministic and stochastic units are coupled which may prevent stacking of larger numbers of TCN blocks. Since the number of stacked dilated convolutions determines the receptive field size, this directly correlates with the model capacity. For example, the performance of SWaveNet on the IAM-OnDB dataset degrades after stacking more than 3 stochastic layers (Lai et al., 2018), limiting the model to a small receptive field. In contrast, we aim to preserve the flexibility of stacking dilated convolutions in the base TCN. In STCNs, the deterministic TCN units do not have any dependency on the stochastic variables (see Figure 1) and the ratio of stochastic to deterministic units can be adjusted, depending on the task. + +# 6 CONCLUSION + +In this paper we proposed STCNs, a novel auto-regressive model, combining the computational benefits of convolutional architectures and expressiveness of hierarchical stochastic latent spaces. We have shown the effectivness of the approach across several sequence modelling tasks and datasets. The proposed models are trained via optimization of the ELBO objective. Tighter lower bounds such as IWAE (Burda et al., 2015) or FIVO (Maddison et al., 2017) may further improve modeling performance. We leave this for future work. + +# ACKNOWLEDGEMENTS + +This work was supported in parts by the ERC grant OPTINT (StG-2016-717054). We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Titan Xp GPU used for this research. + +REFERENCES +Martin Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek G. Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. Tensorflow: A system for large-scale machine learning. In 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI 16), pp. 265–283, 2016. URL https://www.usenix.org/system/files/conference/osdi16/osdi16-abadi.pdf. +Emre Aksan, Fabrizio Pece, and Otmar Hilliges. DeepWriting: Making Digital Ink Editable via Deep Generative Modeling. In SIGCHI Conference on Human Factors in Computing Systems, CHI ’18, New York, NY, USA, 2018. ACM. +Shaojie Bai, J Zico Kolter, and Vladlen Koltun. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271, 2018. +Justin Bayer and Christian Osendorfer. Learning stochastic recurrent networks. arXiv preprint arXiv:1411.7610, 2014. +Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015. +Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015. +Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger ¨ Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014. +Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In Advances in neural information processing systems, pp. 2980–2988, 2015. +Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. arXiv preprint arXiv:1612.08083, 2016. +Sander Dieleman, Aaron van den Oord, and Karen Simonyan. The challenge of realistic music generation: ¨ modelling raw audio at scale. arXiv preprint arXiv:1806.10474, 2018. +Adji B Dieng, Yoon Kim, Alexander M Rush, and David M Blei. Avoiding latent variable collapse with generative skip models. arXiv preprint arXiv:1807.04863, 2018. +Otto Fabius and Joost R van Amersfoort. Variational recurrent auto-encoders. arXiv preprint arXiv:1412.6581, 2014. +Marco Fraccaro, Søren Kaae Sønderby, Ulrich Paquet, and Ole Winther. Sequential neural models with stochastic layers. In Advances in neural information processing systems, pp. 2199–2207, 2016. +Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122, 2017. +Anirudh Goyal ALIAS PARTH Goyal, Alessandro Sordoni, Marc-Alexandre Cotˆ e, Nan Ke, and Yoshua Ben- ´ gio. Z-forcing: Training stochastic recurrent networks. In Advances in Neural Information Processing Systems, pp. 6713–6723, 2017. +Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013. +Ishaan Gulrajani, Kundan Kumar, Faruk Ahmed, Adrien Ali Taiga, Francesco Visin, David Vazquez, and Aaron Courville. Pixelvae: A latent variable model for natural images. arXiv preprint arXiv:1611.05013, 2016. +Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8):1735–1780, 1997. +Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, volume 1, pp. 3, 2017. +Łukasz Kaiser, Aurko Roy, Ashish Vaswani, Niki Pamar, Samy Bengio, Jakob Uszkoreit, and Noam Shazeer. Fast decoding in sequence models using discrete latent variables. arXiv preprint arXiv:1803.03382, 2018. +Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +Guokun Lai, Bohan Li, Guoqing Zheng, and Yiming Yang. Stochastic wavenet: A generative latent variable model for sequential data, 2018. +Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016. +Chris J Maddison, John Lawson, George Tucker, Nicolas Heess, Mohammad Norouzi, Andriy Mnih, Arnaud Doucet, and Yee Teh. Filtering variational objectives. In Advances in Neural Information Processing Systems, pp. 6573–6583, 2017. +Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014. +Samira Shabanian, Devansh Arpit, Adam Trischler, and Yoshua Bengio. Variational bi-lstms. arXiv preprint arXiv:1711.05717, 2017. +Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. Ladder variational autoencoders. In Advances in neural information processing systems, pp. 3738–3746, 2016. +Aaron Van Den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalch- ¨ brenner, Andrew W Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. In SSW, pp. 125, 2016. +Aaron van den Oord, Nal Kalchbrenner, Lasse Espeholt, Oriol Vinyals, Alex Graves, et al. Conditional image ¨ generation with pixelcnn decoders. In Advances in Neural Information Processing Systems, pp. 4790–4798, 2016. +Aaron van den Oord, Oriol Vinyals, et al. Neural discrete representation learning. In Advances in Neural Information Processing Systems, pp. 6306–6315, 2017. +Zichao Yang, Zhiting Hu, Ruslan Salakhutdinov, and Taylor Berg-Kirkpatrick. Improved variational autoencoders for text modeling using dilated convolutions. arXiv preprint arXiv:1702.08139, 2017. +Fisher Yu and Vladlen Koltun. Multi-scale context aggregation by dilated convolutions. arXiv preprint arXiv:1511.07122, 2015. +Shengjia Zhao, Jiaming Song, and Stefano Ermon. Learning hierarchical features from generative models. arXiv preprint arXiv:1702.08396, 2017. + +# 7 APPENDIX + +# 7.1 NETWORK DETAILS + +![](images/19aa4d2b81f05aacc2011ed44ab2ccd4481cbc37a564cfc54e2d0bf8b1253e60.jpg) +Figure 4: Generative model of STCN-dense architecture. Building blocks are highlighted. Note that the dependence of $d _ { t } ^ { l } , l = 1 \cdots L$ on past inputs is not visualized for clarity. + +The network architecture of the proposed model is illustrated in Fig. 4. We make only a small modification to the vanilla Wavenet architecture. Instead of using skip connections from Wavenet blocks, we only use the latent sample $z _ { t }$ in order to make a prediction of $x _ { t }$ . In STCN-dense configuration, $z _ { t }$ is the concatenation of all latent variables in the hierarchy, i.e., $\boldsymbol { z } _ { t } = [ \boldsymbol { z } _ { t } ^ { 1 } \circ \cdot \cdot \cdot \circ \boldsymbol { z } _ { t } ^ { L } ]$ , whereas in STCN only $z _ { t } ^ { 1 }$ is fed to the output layer. + +Each stochastic latent variable $z _ { t } ^ { l }$ (except the top-most $z _ { t } ^ { L }$ ) is conditioned on a deterministic TCN representation $d _ { t } ^ { l }$ and the preceding random variable $z _ { t } ^ { l + 1 }$ . The latent variables are calculated by using the latent layers $f _ { p } ^ { ( l ) }$ or $f _ { q } ^ { ( l ) }$ which are neural networks. + +We do not define a latent variable per TCN layer. Instead, the stochastic layers are uniformly distributed where each random variable is conditioned on a number of stacked TCN layers $\dot { d } _ { t } ^ { l }$ . We stack $K$ Wavenet blocks (see figure 4 left) with exponentially increasing dilation size. + +Observation Model: We use Normal or GMM distributions with 20 components to model real-valued data. +All Gaussian distributions have diagonal covariance matrix. + +Output layer $f ^ { ( o ) }$ : For the IAM-OnDB and Deepwriting datasets we use 1D convolutions with ReLU nonlinearity. We stack 5 of these layers with 256 filters and filter size 1. + +For TIMIT and Blizzard datasets Wavenet blocks in the output layer perform significantly better. We stack 5 Wavenet blocks with dilation size 1. For each convolution operation in the block we use 256 filters. The filter size of the dilated convolution is set to 2. The STCN-dense-large model is constructed by using 512 filters instead of 256. + +TCN blocks $d _ { t } ^ { l }$ : The number of Wavenet blocks is usually determined by the desired receptive field size. + +• For the handwriting datasets $K = 6$ and $L = 5$ . In total we have 30 Wavenet blocks where each convolution operation has 256 filters with size 2. • For speech datasets $K = 5$ and $L = 5$ . In total we have 25 Wavenet blocks where each convolution operation has 256 filters with size 2. The large model configuration uses 512 filters. + +Latent layers $f _ { p } ^ { ( l ) }$ and $f _ { q } ^ { ( l ) }$ : The number of stochastic layers per task is given by $L$ . We used [32, 16, 8, 5, 2] dimensional latent variables for the handwriting tasks. It is [256, 128, 64, 32, 16] for speech datasets. Note that the first entry of the list corresponds to $z ^ { 1 }$ . + +The mean and sigma parameters of the Normal distributions modeling the latent variables are calculated by the $f _ { p } ^ { ( l ) }$ and $f _ { q } ^ { ( l ) }$ networks. We stack $^ { 2 1 0 }$ convolutions with ReLU nonlinearity and filter size 1. The number of filters are the same as the number of Wavenet block filters for the corresponding task. + +Finally, we clamped the latent sigma predictions between 0.001 and 5. + +# 7.2 TRAINING DETAILS + +In all STCN experiments we applied KL annealing. In all tasks, the weight of the KL term is initialized with 0 and increased by $1 \times e ^ { - 4 }$ at every step until it reaches 1. + +The batch size was 20 for all datasets except for Blizzard where it was 128. + +We use the ADAM optimizer with its default parameters and exponentially decay the learning rate. For the handwriting datasets the learning rate was initialized with $5 \times e ^ { - 4 }$ and followed a decay rate of 0.94 over 1000 decay steps. On the speech datasets it was initialized with $1 \times e ^ { - 3 }$ and decayed with a rate of 0.98. We applied early stopping by measuring the ELBO performance on the validation splits. + +We implement STCN models in Tensorflow (Abadi et al., 2016). Our code and models achieving the SOA results are available at https://ait.ethz.ch/projects/2019/stcn/. + +# 7.3 DETAILED RESULTS + +Here we provide the extended results table with Normal observation model entries for available models. + +Table 4: Average log-likelihood per sequence on TIMIT, Blizzard, IAM-OnDB and Deepwriting datasets. (Normal) and (GMM) stand for unimodal Gaussian or multi-modal Gaussian Mixture Model (GMM) as the observation model (Graves, 2013; Chung et al., 2015). Asterisks ∗ indicate that we used our re-implementation only for the Deepwriting dataset. + +
ModelsTIMITBlizzardIAM-OnDBDeepwriting
Wavenet (Normal)-744337841053337
Wavenet (GMM)3018881901381612
Wavenet-dense (Normal)-857937121030323
Wavenet-dense (GMM)3063682121380642
RNN (Normal) Chung et al. (2015)-190035391016363 *
RNN (GMM) Chung et al. (2015)2664374131358528 *
VRNN (Normal)Chung et al. (2015)~ 30235~9516≈1354≥ 495 *
VRNN (GMM) Chung et a. (2015)~ 29604~9392≈1384≥673 *
SRNN (Normal) Fraccaro et al. (2016)≥ 60550≥ 11991n/an/a
Z-forcing (Normal)Goyal etal. (2017)≥ 70469≥ 15430n/an/a
Var.Bi-LSTM (Normal)Shabanian et al. (2017)≥ 73976≥ 17319n/an/a
SWaveNet (Normal)Lai et al.(2018)≥ 72463M 15708≥1301n/a
STCN(Normal)≥ 64913M 13273≥ 1327≥ 575
STCN(GMM)≥ 69195≥15800≥ 1338≥ 605
STCN-dense(Normal)≥ 70294≥ 15950≥ 1729≥ 740
STCN-dense(GMM)≥ 71386M 16288≥ 1796≥ 797
STCN-dense-large (GMM)≥ 77438≥ 17670n/an/a
\ No newline at end of file diff --git a/md/train/HyEtjoCqFX/HyEtjoCqFX.md b/md/train/HyEtjoCqFX/HyEtjoCqFX.md new file mode 100644 index 0000000000000000000000000000000000000000..3b42086d2a082254504a1ad271985886b9af5a89 --- /dev/null +++ b/md/train/HyEtjoCqFX/HyEtjoCqFX.md @@ -0,0 +1,499 @@ +# SOFT Q-LEARNING WITH MUTUAL-INFORMATION REGULARIZATION + +Jordi Grau-Moya, Felix Leibfried and Peter Vrancx +PROWLER.io +Cambridge, United Kingdom +{jordi}@prowler.io + +# ABSTRACT + +We propose a reinforcement learning (RL) algorithm that uses mutual-information regularization to optimize a prior action distribution for better performance and exploration. Entropy-based regularization has previously been shown to improve both exploration and robustness in challenging sequential decision-making tasks. It does so by encouraging policies to put probability mass on all actions. However, entropy regularization might be undesirable when actions have significantly different importance. In this paper, we propose a theoretically motivated framework that dynamically weights the importance of actions by using the mutualinformation. In particular, we express the RL problem as an inference problem where the prior probability distribution over actions is subject to optimization. We show that the prior optimization introduces a mutual-information regularizer in the RL objective. This regularizer encourages the policy to be close to a nonuniform distribution that assigns higher probability mass to more important actions. We empirically demonstrate that our method significantly improves over entropy regularization methods and unregularized methods. + +# 1 INTRODUCTION + +Reinforcement Learning (RL) (Sutton & Barto, 1998) is a framework for solving sequential decision-making problems under uncertainty. Contemporary state-of-the-art RL methods often use an objective that includes an entropy regularization term (Haarnoja et al., 2018c; 2017; Teh et al., 2017). Entropy regularized RL has been shown to capture multi-modal behaviour, as well as exhibiting superior exploration (Haarnoja et al., 2017). Additionally, the learned policies are more robust, as the entropy bonus accounts for future action stochasticity (Grau-Moya et al., 2016) and reduces value overestimation (Fox et al., 2016). + +While encouraging high-entropy policies can provide several benefits, it is possible to devise examples where entropy regularization actually impedes exploration. Since high-entropy policies tend to spread the probability mass across all actions equally, they can perform poorly when the RL problem contains actions that are rarely useful. In this paper, we propose to overcome the previous limitation by designing a reinforcement learning algorithm that dynamically adjusts the importance of actions while learning. We motivate our algorithm by phrasing RL as an inference problem with an adaptive prior action distribution. Where previous work assumes a uniform prior distribution over the actions (Rawlik et al., 2012; Levine, 2018), we generalize the formulation by optimizing the prior. We show that this optimization process leads to an RL objective function with a regularizer based on the mutual information between states and actions. + +Additionally, we develop a novel algorithm that uses such mutual-information regularization to obtain an optimal action-prior for better performance and exploration in high-dimensional state spaces. This novel regularizer for RL encourages policies to be close to the marginal distribution over actions. This results in assigning higher probability to actions frequently used by the optimal policy, while actions that are used infrequently have lower probability under the prior. We demonstrate significant improvements on 19 Atari games over a deep Q-network (Mnih et al., 2015) (DQN) baseline without any regularization and over soft Q-learning (Schulman et al., 2017; Leibfried et al., 2018) (SQL) that employs standard entropy regularization without prior adaptation. + +# 2 BACKGROUND + +# 2.1 REINFORCEMENT LEARNING + +We consider the standard Markov decision process (MDP) setting. Formally, an MDP is defined as the tuple $\langle S , A , P , R , \gamma \rangle$ where $s$ is the state space, $\mathcal { A }$ the action space, and $P : \mathcal { S } \times \mathcal { A } \times \mathcal { S }$ $s [ 0 , 1 ]$ denotes the state transition function. Upon taking action $a _ { t } \in \mathcal A$ in state $s _ { t } \in S$ , the agent transitions to $s _ { t + 1 }$ with probability $\textstyle P ( s _ { t + 1 } | s _ { t } , a _ { t } )$ . The reward function $\mathcal { R } : \mathcal { S } \times \mathcal { A } \mathbb { R }$ i.e. quantifies the agent’s performance. The goal is to find a policy that maximizes the value function, $\pi ^ { * } ( a | s ) = \arg \operatorname* { m a x } _ { \pi } V ^ { \pi } ( s )$ , where $\begin{array} { r } { V ^ { \pi } ( s ) = \mathbb { E } \Big [ \sum _ { t = 0 } ^ { T } \gamma ^ { t } r ( s _ { t } , a _ { t } ) | s _ { 0 } = s \Big ] } \end{array}$ . Here, $\gamma$ is a discount factor ( $0 < \gamma < 1$ ) that allows to account for the future in different ways. + +The policy-dependent state transition probabilities are defined as $\begin{array} { r } { P _ { \pi } ( s ^ { \prime } | s ) : = \sum _ { a } P ( s ^ { \prime } | a , s ) \pi ( a | s ) } \end{array}$ which can be written in matrix notation as $P _ { \pi } \in \mathbb { R } ^ { | S | } \times \mathbb { R } ^ { | S | }$ where the rows are indexed by $s$ and the columns by $s ^ { \prime }$ . This allows us to conveniently define the agent’s stationary distribution over states $\mu _ { \pi } ( s )$ and actions $\rho _ { \pi } ( a )$ as follows: + +Definition 1 (Stationary distribution over states). The stationary distribution over states (assumed to exist and to be unique) is defined in vector form as $\begin{array} { r } { \mu _ { \pi } ^ { \top } : = \operatorname* { l i m } _ { t \infty } \nu _ { 0 } ^ { \top } P _ { \pi } ^ { t } } \end{array}$ with $\nu _ { 0 }$ being an arbitrary vector of probabilities over states at time $t ~ = ~ 0$ . The stationary distribution satisfies $\begin{array} { r } { \mu _ { \pi } ( s ^ { \prime } ) = \sum _ { s } P _ { \pi } ( s ^ { \prime } | s ) \mu _ { \pi } ( s ) } \end{array}$ and therefore is a fixed point under the state transition probabilities $\pmb { \mu } _ { \pi } ^ { \top } = \pmb { \mu } _ { \pi } ^ { \top } \pmb { P } _ { \pi }$ . + +Definition 2 (Stationary distribution over actions). Let $\mu _ { \pi } ( s )$ be the stationary distribution over states induced by the policy $\pi$ . Then the stationary distribution over actions under the policy $\pi$ is defined as $\begin{array} { r } { \rho _ { \pi } ( a ) : = \sum _ { s \in { \cal S } } \mu _ { \pi } ( s ) \pi ( a | s ) } \end{array}$ . + +# 2.2 MAXIMUM ENTROPY REINFORCEMENT LEARNING + +Maximum entropy reinforcement learning augments the standard RL reward objective with an additional policy entropy term. The optimal value function under entropy regularization (Haarnoja et al., 2017) is defined as: + +$$ +\mathcal V ^ { * } ( s ) = \operatorname* { m a x } _ { \pi } \mathbb E \Bigg [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \bigg ( r ( s _ { t } , a _ { t } ) - \frac { 1 } { \beta } \log \pi ( a _ { t } | s _ { t } ) \bigg ) \Bigg | s _ { 0 } = s \Bigg ] , +$$ + +where $\frac { 1 } { \beta }$ trades off between reward and entropy maximization, and the expectation operation is over state-action trajectories. The optimal policy that solves (1) can be written in closed form as: $\begin{array} { r } { \pi ^ { * } ( a | s ) = \frac { e ^ { \beta Q ^ { * } \tilde { ( s , a ) } } } { \sum _ { a \in \mathcal { A } } e ^ { \beta Q ^ { * } ( s , a ) } } } \end{array}$ eβQ (s,a)Pa∈A eβQ∗(s,a) , where Q∗(s, a) := r(s, a) + Ps0∈S P (s0|s, a)V ∗(s0). Note that the above represents a generalization of standard RL settings, where $\beta \to \infty$ corresponds to a standard RL valuation $( \mathrm { l i m } _ { \beta \infty } \mathcal { V } ^ { * } ( s ) = \mathrm { m a x } _ { \pi } V ^ { \pi } ( s ) )$ , while for $\beta 0$ we recover the valuation under a random uniform policy. For intermediate values of $\beta$ , we can trade off between reward maximization and entropy maximization. + +Interestingly, one can formulate the maximum entropy RL objective as an inference problem (Levine, 2018) by specifying a prior distribution over trajectories that assumes a fixed uniform distribution over actions. Precisely this assumption is what encourages the policies to maximize entropy. As outlined in the introduction, encouraging policies to be close to a uniform distribution might be undesirable when some actions are simply non-useful or not frequently used. + +In Section 3, we show that when relaxing the previous assumption, i.e. allowing for prior optimization, we obtain a novel variational inference formulation of the RL problem that constrains the policy’s mutual-information between states and actions. We show that such policies must be close to the marginal distribution over actions which automatically assigns high probability mass to overall useful actions and low probability to infrequently used actions. + +Before proceeding, however, it is insightful to show how prior optimization bridges the gap between entropy regularization and mutual-information regularization in a non-sequential decision-making scenario that considers one time step only. + +2.3 MUTUAL-INFORMATION REGULARIZATION FOR ONE-STEP DECISION-MAKING + +In a one-step decision-making scenario, entropy regularization assumes the following form + +$$ +\operatorname* { m a x } _ { \pi } \sum _ { s , a } p ( s ) \pi ( a | s ) \left( r ( s , a ) - \frac { 1 } { \beta } \log \pi ( a | s ) \right) , +$$ + +where $p ( s )$ is some arbitrary distribution over states and the optimal policy balances expected reward maximization versus expected entropy maximization. + +Entropy regularization discourages deviations from a uniform prior policy. In a more general setting, when discouraging deviations from an arbitrary prior $\rho ( a )$ , a similar objective can be written as + +$$ +\begin{array} { r l } & { \underset { \pi } { \mathop { \operatorname* { m a x } } } \displaystyle \sum _ { s , a } p ( s ) \pi ( a | s ) \left( r ( s , a ) - \frac { 1 } { \beta } \log \frac { \pi ( a | s ) } { \rho ( a ) } \right) = } \\ & { \underset { \pi } { \mathop { \operatorname* { m a x } } } \displaystyle \sum _ { s , a } p ( s ) \pi ( a | s ) r ( s , a ) - \frac { 1 } { \beta } \displaystyle \sum _ { s } p ( s ) \mathrm { K L } ( \pi ( \cdot | s ) | | \rho ( \cdot ) ) , } \end{array} +$$ + +where KL refers to the Kullback-Leiber (KL) divergence. This framework has been proposed before in the literature under the name information-theory for decision-making (Ortega & Braun, 2013). + +Going one step further, one can also optimize for $\rho$ in addition to $\pi$ , which essentially means that policies are discouraged to deviate from an optimal prior distribution, leading to the following optimization problem + +$$ +\operatorname* { m a x } _ { \pi } \sum _ { s , a } p ( s ) \pi ( a | s ) r ( s , a ) - \frac { 1 } { \beta } \operatorname* { m i n } _ { \rho } \sum _ { s } p ( s ) \mathrm { K L } ( \pi ( \cdot | s ) | | \rho ( \cdot ) ) , +$$ + +where we utilize the fact that only the expected $\mathrm { K L }$ penalty depends on $\rho$ + +The minimum expected $\mathrm { K L }$ relates to the mutual information as follows: + +Proposition 1 (Mutual Information). Let $I _ { f }$ be a functional, in particular: $I _ { f } ( p _ { X } , p _ { Y | X } , q _ { Y } ) : =$ $\begin{array} { r } { \sum _ { x } p _ { X } ( x ) \mathrm { K L } ( p _ { Y | X } ( \cdot | x ) | | q _ { Y } ( \cdot ) ) } \end{array}$ , where $p _ { X } ( x )$ is the distribution of the input, $p _ { Y \mid X } ( y | x )$ is the conditional distribution of the output conditioned on the input, and $q _ { Y } ( y )$ a variational distribution of the output. Then, the mutual information 1 is recovered with + +$$ +I [ X , Y ] = \operatorname* { m i n } _ { q _ { Y } } I _ { f } \big ( p _ { X } , p _ { Y | X } , q _ { Y } \big ) , +$$ + +where the optimal variational distribution is $\begin{array} { r } { q _ { Y } ^ { \star } ( y ) = \sum _ { x } p _ { X } ( x ) p _ { Y | X } ( y | x ) , } \end{array}$ , i.e. the true marginal distribution. See e.g. (Cover & Thomas, 2006, Lemma 10.8.1) for details. + +This allows us to rewrite the problem from Equation (3) as + +$$ +\operatorname* { m a x } _ { \pi } \sum _ { s , a } p ( s ) \pi ( a | s ) r ( s , a ) - \frac { 1 } { \beta } I [ S ; A ] , +$$ + +yielding a penalty on the mutual information between states and actions. + +Notice that this problem is mathematically equivalent to rate-distortion theory from informationtheory (Shannon, 1959) which formulates how to efficiently send information over an informationtheoretic channel with limited transmission rate. This framework has also been used to describe decision-making problems with limited information budgets (Sims, 2011; Genewein et al., 2015; Leibfried & Braun, 2015; 2016; Peng et al., 2017; Hihn et al., 2018). In a decision-making context, the agent is considered as information-theoretic channel $\pi ( a | s )$ where $s$ is the channel input and $a$ the channel output. The agent aims at maximizing expected reward under the constraint that the information transmission rate is limited, where the transmission rate is given by the mutual-information between states and actions (Cover & Thomas, 2006). Intuitively, this means that the agent has to discard reward-irrelevant information in $s$ to not exceed the limits in information transmission. + +In the following section, we generalize the rate-distortion formulation for decision-making to be applicable to a sequential decision-making scenario, i.e. the RL setting. We propose an inferencebased formulation where the mutual information arises as a consequence of allowing for optimizing the action-prior distribution. + +$$ +\begin{array} { r } { ^ { 1 } I ( X ; Y ) : = \sum _ { x , y } p ( x , y ) \log \frac { p ( x , y ) } { p _ { Y } ( y ) p _ { X } ( x ) } = \sum _ { x } p _ { X } ( x ) \mathrm { K L } \big ( p _ { Y | X } ( \cdot | x ) | | p _ { Y } ( \cdot ) \big ) } \end{array} +$$ + +# 3 MUTUAL-INFORMATION REGULARIZATION IN RL + +In this section, we first derive mutual-information regularization for the RL setting from a variational inference perspective. Subsequently, we derive expressions for the optimal policy and the optimal prior that are useful for constructing a practical algorithm. + +# 3.1 VARIATIONAL INFERENCE RL FORMULATION WITH OPTIMAL ACTION-PRIORS + +The RL problem can be expressed as an inference problem by introducing a binary random variable $R$ that denotes whether the trajectory $\tau : = ( s _ { 0 } , a _ { 0 } , \dots s _ { T } , a _ { T } )$ is optimal $R = 1$ ) or not $( R = 0$ ). The likelihood of an optimal trajectory can then be expressed as $\begin{array} { r } { p ( R = 1 | \tau ) \propto \exp ( \sum _ { t = 0 } ^ { T } r ( s _ { t } , a _ { t } ) ) } \end{array}$ (Levine, 2018). We additionally introduce a scaling factor $\beta > 0$ into the exponential, i.e. $p ( R =$ $\begin{array} { r } { 1 | \tau ) \propto \exp ( \beta \sum _ { t = 0 } ^ { T } r ( s _ { t } , a _ { t } ) ) } \end{array}$ . This will allow us to trade off reward and entropy maximization 2. Next, we can define the posterior trajectory probability assuming optimality, i.e. $p ( \tau | R = 1 )$ . Here we treat $\tau$ as a latent variable with prior probability $p ( \tau )$ , and we specify the log-evidence as $\begin{array} { r } { \log p ( R = 1 ) = \log \int p ( R = 1 | \tau ) p ( \tau ) \dot { d } \tau } \end{array}$ . We now introduce a variational distribution $q ( \tau )$ to approximate the posterior $p ( \tau | R = 1 )$ . This leads to an Evidence Lower BOund (ELBO) of the previous expression (scaled by $\textstyle { \frac { 1 } { \beta } } ) ^ { 3 }$ : + +$$ +\begin{array} { r l } & { \displaystyle \frac { 1 } { \beta } \log p ( R = 1 ) = \frac { 1 } { \beta } \log \int p ( R = 1 | \tau ) p ( \tau ) d \tau } \\ & { \quad \quad \quad \geq \displaystyle \frac { 1 } { \beta } \mathbb { E } _ { \tau \sim q ( \tau ) } \left[ \log \frac { p ( R = 1 | \tau ) p ( \tau ) } { q ( \tau ) } \right] } \end{array} +$$ + +The generative model is written as $\begin{array} { r } { p ( \tau ) \ = \ p ( s _ { 0 } ) \prod _ { t = 0 } ^ { T - 1 } \rho ( a _ { t } ) P ( s _ { t + 1 } | s _ { t } , a _ { t } ) } \end{array}$ and the variational +distribution as maximization $\begin{array} { r } { q ( \tau ) = p ( s _ { 0 } ) \prod _ { t = 0 } ^ { T - 1 } \pi ( a _ { t } | s _ { t } ) P ( s _ { t + 1 } | s _ { t } , a _ { t } ) } \end{array}$ . The RL problem can now be stated as aRL objective is recovered when assuming $\pi$ +a fixed uniform prior distribution over actions, i.e. $\begin{array} { r } { \rho ( a _ { t } ) = \frac { 1 } { | \mathcal { A } | } } \end{array}$ for all $t$ . + +We obtain a novel variational RL formulation by introducing an adaptive prior over actions $\rho$ . Contrary to maximum entropy RL, where the prior of the generative model is fixed and uniform, here the prior over actions is subject to optimization. Starting from Equation (5) and substituting $p ( \tau )$ and $q ( \tau )$ we obtain the following ELBO: $\begin{array} { r l } & { \operatorname* { m a x } _ { \pi , \rho } \mathbb { E } _ { q } \left[ \sum _ { t = 0 } ^ { T } \left( r ( s _ { t } , a _ { t } ) - \frac { 1 } { \beta } \log \frac { \pi ( a _ { t } | s _ { t } ) } { \rho ( a _ { t } ) } \right) \right] . } \end{array}$ . Since we are interested in infinite horizon problems, we introduce a discount factor and take the limit $\operatorname* { l i m } _ { T \to \infty }$ (Haarnoja et al., 2017). This leads to the optimization objective that we use in our experiments: + +$$ +\operatorname* { m a x } _ { \pi , \rho } \mathbb { E } _ { q } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \left( r ( s _ { t } , a _ { t } ) - \frac { 1 } { \beta } \log \frac { \pi ( a _ { t } | s _ { t } ) } { \rho ( a _ { t } ) } \right) \right] , +$$ + +where $0 < \gamma < 1$ is the discount factor. In the following, we show that the the solution for the prior and the policy can be expressed in a concise form giving rise to a novel RL regularization scheme. + +# 3.2 RECURSION, OPTIMAL POLICIES AND OPTIMAL PRIORS + +Crucial for the construction of a practical algorithm are concise expressions for the optimal policy and the prior. More concretely, the optimal policy takes the form of a Boltzmann distribution weighted by the prior $\rho$ . When fixing the policy, the optimal prior is the marginal distribution over actions under the discounted stationary distribution over states. This finding is important to devise a method for efficiently learning an optimal prior in practice. + +Optimal policy for a fixed prior $\rho$ : We start by defining the value function with the information cost as $\begin{array} { r } { \mathcal { V } _ { \pi , \rho } ( s ) : = \mathbb { E } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \left( r ( s _ { t } , a _ { t } ) - \frac { 1 } { \beta } \log \frac { \pi ( a _ { t } | s _ { t } ) } { \rho ( a _ { t } ) } \right) | s _ { 0 } = s \right] } \end{array}$ where one can show that $\nu _ { \pi , \rho }$ satisfies a recursion similar to the Bellman equation: + +$$ +\boldsymbol { \mathcal { V } } _ { \pi , \rho } ( s ) = \mathbb { E } _ { \pi } \left[ r ( s , a ) - \frac { 1 } { \beta } \log \frac { \pi ( a | s ) } { \rho ( a ) } + \gamma \mathbb { E } _ { s ^ { \prime } } [ \boldsymbol { \mathcal { V } } _ { \pi , \rho } ( s ^ { \prime } ) ] \right] . +$$ + +When considering a fixed $\rho$ , the problem of maximizing Equation (7) over the policy can be solved analytically by standard variational calculus (Rubin et al., 2012; Genewein et al., 2015). The optimal policy is then given by + +$$ +\pi ^ { * } ( a | s ) : = \frac { 1 } { Z } \rho ( a ) \exp ( \beta Q _ { \pi ^ { * } , \rho } ( s , a ) ) +$$ + +with $\begin{array} { r } { Z = \sum _ { a } \rho ( a ) \exp ( \beta Q _ { \pi ^ { * } , \rho } ( s , a ) ) } \end{array}$ , and the the soft Q-function is defined as + +$$ +Q _ { \pi , \rho } ( s , a ) : = r ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } } [ \mathcal { V } _ { \pi , \rho } ( s ^ { \prime } ) ] . +$$ + +Being able to write the optimal policy in this way as a function of Q-values is needed in order to estimate the optimal prior as we show next. + +Optimal prior for a fixed policy: In order to solve for the optimal prior, we rewrite the problem in Equation (6) as + +$$ +\operatorname* { m a x } _ { \pi , \rho } \sum _ { t = 0 } ^ { \infty } \sum _ { s } \gamma ^ { t } \nu _ { t } ( s ) \sum _ { a } \pi ( a | s ) \left( r ( s , a ) - \frac { 1 } { \beta } \log \frac { \pi ( a | s ) } { \rho ( a ) } \right) , +$$ + +where we have defined the marginal distribution over states at time $t$ as + +$$ +\nu _ { t } ( s ) : = \sum _ { s _ { 0 } , a _ { 0 } , \ldots , s _ { t - 1 } , a _ { t - 1 } } p ( s _ { 0 } ) \left( \prod _ { t ^ { \prime } = 0 } ^ { t - 2 } \pi ( a _ { t ^ { \prime } } | s _ { t ^ { \prime } } ) P ( s _ { t ^ { \prime } + 1 } | s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ) \right) \pi ( a _ { t - 1 } | s _ { t - 1 } ) P ( s | s _ { t - 1 } , a _ { t - 1 } ) . +$$ + +For fixed $\pi$ , we eliminate the max operator for $\pi$ and all components that do not depend on $\rho$ + +$$ +\operatorname* { m a x } _ { \rho } - \frac { 1 } { \beta } \sum _ { t = 0 } ^ { \infty } \sum _ { s } \gamma ^ { t } \nu _ { t } ( s ) \mathbf { K L } ( \pi ( \cdot | s ) | | \rho ( \cdot ) ) . +$$ + +Swapping the sums and letting $\begin{array} { r } { p ( s ) : = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \nu _ { t } ( s ) } \end{array}$ be the unnormalized discounted marginal distribution over states, we obtain $\begin{array} { r } { \operatorname* { m a x } _ { \rho } - \frac { 1 } { \beta } \sum _ { s } p ( s ) \mathbf { K L } ( \pi ( \cdot | s ) | | \rho ( \cdot ) ) } \end{array}$ . The solution to the latter, $\begin{array} { r } { \rho ^ { \star } ( a ) = \frac { \sum _ { s } p ( s ) \pi ( a \mid s ) } { \sum _ { s , a } p ( s ) \pi ( a \mid s ) } } \end{array}$ , can easily be obtained by adding the constraint that the action-prior is a valid distribution (i.e., $\textstyle \sum _ { a } \rho ( a ) \ = \ 1$ and $\rho ( a ) \ > \ 0 \ \forall a )$ , and using the method of Lagrange multipliers and standard variational calculus. The connection to the mutual information becomes clear when plugging $\rho ^ { \star }$ back into the objective yielding $- k \cdot { \textstyle \frac { 1 } { \beta } } I ( S , A )$ scaled by a positive constant $k$ (because $p ( s )$ is not normalized) that can be absorbed into $\beta$ . Additionally, we also formalize the connection to the stationary mutual-information for the limit case of $\gamma 1$ in the Appendix. + +With the form of the optimal prior for a fixed policy at hand, one can easily devise a stochastic approximation method (e.g. $\bar { \rho _ { i + 1 } } ( a ) = ( 1 - \bar { \alpha _ { \rho } } ) \rho _ { i } ( \bar { a } ) + \alpha _ { \rho } \pi ( a | s )$ with $\alpha _ { \rho } \in [ 0 , 1 ]$ and $s \sim p ( \cdot )$ to estimate the optimal $\rho$ using the current estimate of the optimal policy from Equation (8). We note that here we sample from the undiscounted distribution over states instead, rather than the true discounted state-distribution in the equation above. This is a common practice used in actor-critic RL that results in a biased estimator of the objective (Thomas, 2014). + +# 4 MIRL: A PRACTICAL MUTUAL INFORMATION RL ALGORITHM + +In this section, we present the MIRL agent. We focus on the tabular setting first and then port our algorithm to high-dimensional state spaces that require parametric function approximators. + +# 4.1 MIRL FOR TABULAR Q-LEARNING + +Our tabular MIRL agent is a modification of an ordinary Q-learning agent with a different update scheme for Q-values. In parallel to updating Q-values, the MIRL agent needs to update the prior $\rho$ as well as the parameter $\beta$ . The behavioral policy $\pi$ is also different and utilizes soft Q-values. This is outline in more detail below. + +Prior Updates: We approximate the optimal prior by employing the following update equation, + +$$ +\rho _ { i + 1 } ( a ) = ( 1 - \alpha _ { \rho } ) \rho _ { i } ( a ) + \alpha _ { \rho } \pi _ { i } ( a | s _ { i } ) +$$ + +where $s _ { i } \sim \nu _ { i } ( \cdot )$ and $\alpha _ { \rho }$ is a learning rate. Assuming a fixed policy, it is easy to show that this iterative update converges to $\begin{array} { r } { \rho _ { \pi } ( a ) = \bar { \sum } _ { s } \mu _ { \pi } ( s ) \pi ( a | s ) } \end{array}$ , thus estimating correctly the optimal prior. + +-function Updates: Concurrently to learning the prior, MIRL updates the tabular Q-function as + +$$ +Q ( s , a ) Q ( s , a ) + \alpha _ { Q } ( ( T _ { \mathrm { s o f t } } ^ { \rho } Q _ { \bar { \theta } } ) ( s , a , s ^ { \prime } ) - Q ( s , a ) ) +$$ + +where $\alpha _ { Q }$ is a learning rate and $T _ { \mathrm { s o f t } } ^ { \rho } Q$ is the empirical soft-operator defined as $( T _ { \mathrm { s o f t } } ^ { \rho } Q ) ( s , a , s ^ { \prime } ) : =$ $\begin{array} { r l } { r ( s , a ) + \gamma \frac { 1 } { \beta } \log \sum _ { a ^ { \prime } } \rho ( a ^ { \prime } ) \exp \left( \beta Q ( s ^ { \prime } , a ^ { \prime } ) \right) } & { { } } \end{array}$ . Importantly, this operator differs from other soft operators arising when employing entropy regularization. Entropy regularization assumes a fixed uniform prior, whereas in our case, the optimal prior is estimated in the course of learning. + +Behavioural policy: Since the Q-function can be learned off-policy, the experience samples can conveniently be drawn from a behavioural policy $\pi _ { b }$ different from the current estimate of the optimal policy. As such, the behavioural policy used in our experiments is similar in spirit to an $\epsilon$ -greedy policy but it better exploits the existence of the estimated optimal prior when both exploring and exploiting. When exploring, MIRL’s behavioural policy samples from the current estimate of the optimal prior $\rho _ { i }$ which has adjusted probabilities, in contrast to vanilla $\epsilon$ -greedy that samples all actions with equal frequency. Additionally, when exploiting, MIRL selects the maximum probability action that depends not only on the Q-values but also on the current estimate of the optimal action-prior, instead of selecting the action with highest Q-value as in traditional $\epsilon$ -greedy. More formally, given a random sample $u \sim$ Uniform[0,1] and epsilon $\epsilon$ , the action $a _ { i }$ is obtained by + +$$ +a _ { i } = { \displaystyle \left\{ \begin{array} { l l } { \arg \operatorname* { m a x } _ { a } \pi _ { i } ( a | s _ { i } ) , } & { { \mathrm { i f ~ } } u > \epsilon } \\ { a \sim \rho _ { i } ( \cdot ) } & { { \mathrm { i f ~ } } u \leq \epsilon , } \end{array} \right. } +$$ + +where $\begin{array} { r } { \pi _ { i } ( a | s ) = \frac { 1 } { Z } \rho _ { i } ( a ) \exp ( \beta _ { i } Q _ { i } ( s , a ) ) } \end{array}$ , see Equation (8). + +Parameter $\beta$ Updates: The parameter $\beta$ can be seen as a Lagrange multiplier that quantifies the magnitude of penalization for deviating from the prior. As such, a small fixed value of $\beta$ would restrict the class of available policies and evidently constrain the asymptotic performance of MIRL. In order to remedy this problem and obtain better asymptotic performance, we use the same adaptive $\beta$ -scheduling over rounds $i$ from (Fox et al., 2016) in which $\beta _ { i }$ is updated linearly according to $\beta _ { i + 1 } = c \cdot i$ with some positive constant $c$ . This update favours small values of $\beta$ at the beginning of training and large values towards the end of training when the error over Q-values is small. Therefore, towards the end of training when $\beta$ is large, MIRL recovers ordinary Q-learning without a constraint. This ensures that the asymptotic performance of MIRL is not hindered. + +# 4.2 MIRL WITH PARAMETRIC FUNCTION APPROXIMATORS + +For parametric function approximators, the scheme for updating the prior and the behavioural policy is the same as in the tabular setting but Q-function updates and $\beta$ -scheduling need to be adjusted for high-dimensional state spaces. The pseudocode of our proposed algorithm is outlined in Algorithm 1 and follows standard literature for parametric value learning, see e.g. Mnih et al. (2015). + +Q-function Updates: Q-function parameters are obtained by minimizing the following loss + +$$ +L ( \theta , \rho ) : = \mathbb { E } _ { s , a , r , s ^ { \prime } \sim \mathcal { M } } \left[ \Big ( ( T _ { \mathrm { s o f t } } ^ { \rho } Q _ { \bar { \theta } } ) ( s , a , s ^ { \prime } ) - Q _ { \theta } ( s , a ) \Big ) ^ { 2 } \right] +$$ + +where $\mathcal { M }$ is a replay memory (Mnih et al., 2015), $Q _ { \bar { \theta } }$ is a target network that is updated after a certain number of training iterations and $T _ { \mathrm { s o f t } } ^ { \rho } Q$ is the empirical soft-operator from the tabular setting, here repeated for convenience $\begin{array} { r } { ( T _ { \mathrm { s o f f } } ^ { \rho } Q ) ( \vec { s , a } , s ^ { \prime } ) : = r ( s , a ) + \gamma \frac { 1 } { \beta } \log \sum _ { a ^ { \prime } } \rho ( a ^ { \prime } ) \exp { ( \beta Q ( s ^ { \prime } , a ^ { \prime } ) ) } . } \end{array}$ . + +Parameter $\beta$ Updates: We use the same adaptive $\beta$ -scheduling from Leibfried et al. (2018) in which $\beta _ { i }$ is updated according to the inverse of the empirical loss of the Q-function, i.e. $\beta _ { i + 1 } =$ $\begin{array} { r } { ( 1 - \alpha _ { \beta } ) \beta _ { i } + \dot { \alpha } _ { \beta } \big ( \frac { 1 } { L ( \theta _ { i } , \rho _ { i + 1 } ) } \big ) } \end{array}$ . This provides more flexibility than the linear scheduling scheme from the tabular setting, more suitable for high-dimensional state spaces where it is impossible to visit all state-action pairs. + +# Algorithm 1 MIRL + +1: Input: the learning rates $\alpha _ { \rho }$ , $\alpha _ { Q }$ and $\alpha _ { \beta }$ , a $\mathrm { Q }$ -network $Q _ { \theta } ( s , a )$ , a target network $Q _ { \bar { \theta } } ( s , a )$ , a +behavioural policy $\pi _ { b }$ , an initial prior $\rho _ { 0 }$ and parameters $\theta _ { 0 }$ at $t = 0$ . +2: for $i = 1$ to $N$ iterations do +3: Get environment state $s _ { i }$ and apply action $a _ { i } \sim \pi _ { b } ( \cdot | s _ { i } )$ +4: Get $r _ { i }$ , $s _ { i + 1 }$ and store $\left( { { s _ { i } } , { a _ { i } } , { r _ { i } } , { s _ { i + 1 } } } \right)$ in replay memory $\mathcal { M }$ +5: Update prior $\rho _ { i + 1 } ( \cdot ) = \rho _ { i } ( \cdot ) ( 1 - \alpha _ { \rho } ) + \alpha _ { \rho } \pi _ { i } ( \cdot | s _ { i } )$ +6: if $i$ mod update frequency $= = 0$ then +7: Update Q-function $\theta _ { i + 1 } = \theta _ { i } - \alpha _ { Q } \nabla _ { \theta } L ( \theta , \rho _ { i + 1 } ) | _ { \theta _ { i } }$ according to Equation (13) +8: Update parameter βi+1 = (1 − αβ)βi + αβ  1L(θi,ρi+1)  +9: end if + +![](images/4c3e170141d92a001d1ef29f961995bbcc06a91314da26b9a44a68dce0ef33d8.jpg) +Figure 1: Grid world experiments. Left column: The top shows a corridor grid world with $3 \times 2 0$ cells where the goal is on the right. The bottom shows an $8 \times 8$ grid world where an important action (left) has to be made exactly once to arrive at the goal. Middle column: Evaluation of Qlearning (QL), SQL with standard uniform exploration and with marginal exploration ${ ( \mathrm { S Q L } } . \mathrm { m } )$ , and MIRL. We clearly see that MIRL outperforms the baselines on the corridor, and is comparable to the baselines on the $8 \times 8$ world. Right column: We see that MIRL is able to identify the correct action (go right) faster than the baselines in the corrider (top). The bottom reports how having infrequent but important actions does not affect the performance of MIRL. + +# 5 EXPERIMENTS + +We evaluate our MIRL agent both in the tabular setting using a grid world domain, and in the parametric function approximator setting using the Atari domain. + +# 5.1 GRID WORLD + +As an intuitive example, we evaluate our method in a grid world domain where the agent has to reach a goal. Reaching the goal gives a reward of 9 but each step yields a reward of $- 1$ . After the end of an episode (when reaching the goal), the agent’s location is randomly re-sampled uniformly over the state space. We compare against two baselines, Q-learning without any regularization, and SQL (Fox et al., 2016) which employs entropy regularization with the dynamic $\beta$ -scheduling scheme outlined earlier. We train the agents for $2 . 5 \cdot 1 0 ^ { \overline { { 5 } } }$ environment steps following the procedure outlined in Fox et al. (2016). Both SQL and MIRL update the Lagrange multiplier $\beta$ over time by using a linear scheduling scheme with a constant $c = \mathrm { i } 0 ^ { - 3 }$ . MIRL additionally updates the estimate of the optimal prior by using a learning rate $\alpha _ { \rho } = 2 \cdot 1 0 ^ { - 3 }$ . In all experiments, we use an adaptive learning rate for Q-values $\alpha _ { Q } = n ( s , a ) ^ { - \omega }$ that depends on the state-action-visitation frequencies $n ( s , a )$ (Fox et al., 2016). See Appendix for further details. + +![](images/0cced82d500d8cf4d6b3f77a23007820d0dc4375db7685e24c2cb7c4224f36ad.jpg) +Figure 2: Left panel: Median normalized score across 19 Atari games. Comparison between our method mutual information RL (MIRL), SQL and DQN, demonstrating MIRL’s superior performance. Right panels: Top figures show the raw score for 2 example games reporting MIRL’s superior performance on RoadRunner and Seaquest. The bottom plots show the evolution of the estimated prior over actions. For RoadRunner the prior converges to stable values during training. In Seaquest, the algorithm seems not to have converged yet after 50 million environment steps which is why the prior probabilities have not converged yet either (however, the formation of separate trajectory clusters towards the end of training indicates the ongoing process of convergence). See Appendix for details and plots for all environments. The curves are smoothed with an exponential moving average with effective window size of $1 0 ^ { 6 }$ environment steps. + +During the training of each algorithm, snapshots of the Q-tables (and the estimate of the prior in the case of MIRL) are stored every 100 environment steps for evaluation. The evaluation for a single snapshot is conducted by running the policy for 30 episodes lasting at most 100 environment steps. The epsilon value when in evaluation mode is set to $\epsilon = 0 . 0 5$ (same as in training). Every individual experiment is repeated with 10 different initial random seeds and results are averaged across seeds. + +Figure 1 summarizes our grid world experiments on two instances: a corridor where the goal is to the right, and a square world where one important action has to be executed exactly once. In the corridor, MIRL clearly outperforms competing approaches (Q-learning and SQL), whereas in the square world, MIRL attains comparable performance as the baselines. Note that these results remain valid when equipping SQL with the same marginal exploration scheme as MIRL. + +# 5.2 ATARI + +We conduct experiments on 19 Atari games (Brockman et al., 2016) with Algorithm 1 (MIRL), and compare against DQN (Mnih et al., 2015) and SQL (Haarnoja et al., 2018c) with a dynamic $\beta$ -scheduling scheme based on loss evolution that leads to improved performance over vanilla SQL with fixed $\beta$ (Leibfried et al., 2018). The three algorithms use a neural network for the estimation of Q-values as in (Mnih et al., 2015). The network receives as an input the state $s$ which is composed of the last four frames of the game with some extra pre-processing (see Appendix), and it outputs a vector of Q-values, i.e. one value for each valid action. We train the network for $5 \cdot 1 0 ^ { 7 }$ environment steps, where a training iteration is performed every four steps. The target network $Q _ { \bar { \theta } }$ is updated every $1 0 ^ { 4 }$ training iterations. Both SQL and MIRL update the Lagrange multiplier $\beta$ over time by using an exponential moving average of the inverse loss 4 (Leibfried et al., 2018) with $\alpha _ { \beta } = 3 { \cdot } 1 0 ^ { - 5 }$ . In addition, MIRL updates the estimate of the optimal prior by using a learning rate $\alpha _ { \rho } = 5 \cdot 1 0 ^ { - 5 }$ . Additional details can be found in the Appendix. + +For evaluation, we create snapshots of the network agents every $1 0 ^ { 5 }$ environment steps. Evaluating a single snapshot offline is done by running the policy for 30 episodes that last at most $4 . 5 \cdot 1 0 ^ { 5 }$ environment steps but terminate earlier in case of a terminal event. When evaluating the agents, the epsilon value is $\epsilon = 0 . 0 5$ , whereas in training $\epsilon$ is linearly annealed over the first $1 0 ^ { 6 }$ steps (Mnih et al., 2015) from 1.0 to 0.1. + +To summarize the results across all games, we normalize the episodic rewards obtained in the evaluation. The normalized episodic rewards are computed as follows $\begin{array} { r l r } { z _ { \mathrm { n o r m a l i z e d } } } & { = } & { \frac { z - z _ { \mathrm { r a n d o m } } } { z _ { \mathrm { h u m a n } } - z _ { \mathrm { r a n d o m } } } \cdot 1 0 0 \% , } \end{array}$ where $z$ stands for the score obtained from our agent at test time, $\tilde { z } _ { \mathrm { r a n d o m } }$ stands for the score that a random agent obtains and $z _ { \mathrm { h u m a n } }$ for the score a human obtains. Random and human scores are taken from Mnih et al. (2015) and Van Hasselt et al. (2016). As seen in Figure 2, our algorithm significantly outperforms the baselines in terms of the median normalized score. In particular, after 50 million interactions we obtain about $3 0 \%$ higher median normalized score compared to SQL and $5 0 \%$ higher score compared to DQN. MIRL attains the final performance of SQL in about half the amount of interactions with the environment and, similarly, it attains DQN’s final performance in about five times less interactions. + +In Table 1 we show the comparison between best-performing agents for all the + +Table 1: Mean Normalized score in 19 Atari games for DQN, SQL and our approach MIRL. + +
GameDQN (%)SQL (%)MIRL (%)
Alien101.5851.0240.23357.40330.197.80
AssaultAsterixAsteroidsBankHeistBeamRiderBoxingChopperCommandDemonAttackGopherKangarooKrullKungFuMasterRiverraidRoadRunnerSeaquestSpaceInvadersStarGunnerUpNDown250.61283.62
166.32242.73
9.748.57
97.1294.62166.26117.212338.89
99.16113.64
2178.572283.33
72.7126.3765.03469.30
350.95451.78
474.18538.87429.44
351.48393.16405.9
843.16886.681036.04
122.14142.04121.41
77.21109.3776.02
548.90613.62695.88
21.9536.0064.86
166.62200.38164.79574.89
653.44681.12574.89
183.19230.82394.21
Mean356.26388.83413.46
+ +environments, where the best-performing agent is the agent that achieves the best score in evaluation mode considering all snapshots. Although this measure is not very robust, we include it since it is a commonly reported measure of performance in the field. MIRL outperforms the other baselines in 11 out of 19 games compared to SQL and DQN that are best on 5 and 3 games respectively. + +In Figure 3, we conduct additional experiments on a subset of eight Atari games comparing MIRL and DQN with two different ablations of SQL: one ablation using uniform exploration and another ablation using the same marginal exploration scheme as MIRL (denoted SQL m). These experiments confirm the importance of the difference in values between MIRL and SQL rather than the difference in the exploration protocol. + +# 6 RELATED WORK + +The connection between reinforcement learning and inference is well established (Dayan & Hinton, 1997; Levine, 2018). Several authors have proposed RL algorithms based on optimizing the ELBO in Equation (5). In policy search, a popular approach is to optimize the lower bound using an iterative procedure similar to expectation maximization (Deisenroth et al., 2013). Different approximations can then be used for the trajectory distributions, resulting in different algorithms (Kober & Peters, 2009; Peters et al., 2010; Hachiya et al., 2011). The recent maximum a posteriori policy optimisation (MPO) (Abdolmaleki et al., 2018) framework uses a similar approach and combines an expectation maximization style update with off-policy estimation of a regularized Q-function. A key difference between MPO and our method is that MPO treats the approximate distribution $q ( \tau )$ as an auxiliary distribution used to optimize the policy that generates $p ( \tau )$ . In our method, as well as in the maximum entropy based methods discussed below, we optimize the policy used to generate $q ( \tau )$ , while using the distribution $p ( \tau )$ generated by the prior as an auxiliary distribution. While both approaches can be related to optimizing the ELBO, they can be shown to optimize different versions of the KL constraint on the target policy (Levine, 2018). + +Maximum entropy reinforcement learning represents another family of inference-based RL methods. This formulation can be derived from the same evidence lower bound in Equation (5), by fixing the generative policy for $p ( \tau )$ to be a uniform prior. Maximum entropy RL has been derived under different conditions in many different settings. Ziebart et al. (2008) proposed maximum entropy learning for inverse reinforcement learning problems. Several authors have applied the same principles for trajectory optimization (Kappen, 2005; Todorov, 2008; Levine & Koltun, 2013). These maximum entropy methods typically assume the availability of some sort of transition model. More recently, maximum entropy learning has also been studied in model-free settings by introducing alternative soft-operators (Asadi & Littman, 2017) or soft Q-learning approaches (Rawlik et al., 2012; Fox et al., 2016; Haarnoja et al., 2017). Soft Q-learning learns a softened value function by replacing the hard maximum operator in the Q-learning update with a softmax operator. Several authors have discussed the benefits of this approach and provided generalizations under linear programming formulations (Neu et al., 2017). In particular, Fox et al. (2016) and Haarnoja et al. (2017) show that maximum entropy learning improves exploration and robustness. Furthermore, Haarnoja et al. (2018b) show that the resulting policies are composable and can be used to directly build solutions to unseen problems. Additionally, entropy-regularization has shown to be crucial to prove convergence guarantees on value learning with non-linear function approximators (Dai et al., 2018). The soft Qlearning framework has also been used in actor-critic settings (Haarnoja et al., 2018c) and to show a connection between value-based and policy gradient methods (Schulman et al., 2017; Nachum et al., 2017). The method has also been extended to hierarchical settings (Florensa et al., 2017; Haarnoja et al., 2018a). In the multi-task setting, the Distral framework (Teh et al., 2017) combines entropy regularization with an additional KL regularization used to transfer knowledge between tasks. + +![](images/7779cad5a55fe58cf2f0bb5c6ec3c4720f75d2708622034c4407a9d637a7ac97.jpg) +Figure 3: Normalized score for eight games comparing MIRL against standard SQL and a modified version of SQL that explores with the marginal distribution over actions (SQL m). The exploration method slightly improves SQL but not sufficiently enough to achieve MIRL’s performance. See individual plots and games in the Appendix. + +The mutual information, central to our approach, is a basic quantity in information theory to measure the statistical dependence between two random variables. Machine learning applications that use the mutual information are numerous including the information-bottleneck method (Tishby et al., 1999), rate-distortion theory (Cover & Thomas, 2006; Tishby & Polani, 2011), clustering (Still & Bialek, 2004) and curiosity driven exploration (Still & Precup, 2012). + +# 7 DISCUSSION AND CONCLUSION + +Using a variational inference perspective, we derived a novel RL objective that allows optimization of the prior over actions. This generalizes previous methods in the literature that assume fixed uniform priors. We show that our formulation is equivalent to applying a mutual-information regularization and derive a novel algorithm (MIRL) that learns the prior over actions. We demonstrate that MIRL significantly improves performance over SQL and DQN. + +We recognize that our approach might fail under certain conditions. For example, in the case when there is an action that is useful only once (similar to our + +$8 \times 8$ grid world example) but is most of the times penalized with a negative reward. When the negative reward is too strong, MIRL might assign very low probability to that action and never explore it. However, this problem might be alleviated by a weighted mixing of our exploration policy with a uniform distribution. + +An interesting direction for future work is to investigate the convergence properties of the alternating optimization problem presented here. We believe that, at least in the tabular case, the framework of stochastic approximation for two timescales (Borkar, 2009) is sufficient to prove convergence. On the experimental side, one could also investigate how our approach can be combined with the Rainbow framework (Hessel et al., 2017) which is the current state of the art in performance. + +# 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. + +Kavosh Asadi and Michael L Littman. An alternative softmax operator for reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 243– 252. JMLR. org, 2017. + +Dimitri P Bertsekas. Dynamic Programming and Optimal Control: Volume 2. Athena Scientific, 1995. + +Vivek S Borkar. Stochastic approximation: a dynamical systems viewpoint, volume 48. Springer, 2009. + +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. + +Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, second edition, 2006. + +Bo Dai, Albert Shaw, Lihong Li, Lin Xiao, Niao He, Zhen Liu, Jianshu Chen, and Le Song. Sbeed: Convergent reinforcement learning with nonlinear function approximation. In International Conference on Machine Learning, pp. 1133–1142, 2018. + +Peter Dayan and Geoffrey E Hinton. Using expectation-maximization for reinforcement learning. Neural Computation, 9(2):271–278, 1997. + +Marc Peter Deisenroth, Gerhard Neumann, Jan Peters, et al. A survey on policy search for robotics. Foundations and Trends $\textsuperscript { \textregistered }$ in Robotics, 2(1–2):1–142, 2013. + +Carlos Florensa, Yan Duan, and Pieter Abbeel. Stochastic neural networks for hierarchical reinforcement learning. arXiv preprint arXiv:1704.03012, 2017. + +Roy Fox, Ari Pakman, and Naftali Tishby. Taming the noise in reinforcement learning via soft updates. In Proceedings of the Thirty-Second Conference on Uncertainty in Artificial Intelligence, pp. 202–211. AUAI Press, 2016. + +Tim Genewein, Felix Leibfried, Jordi Grau-Moya, and Daniel Alexander Braun. Bounded rationality, abstraction, and hierarchical decision-making: An information-theoretic optimality principle. Frontiers in Robotics and AI, 2:27, 2015. + +Jordi Grau-Moya, Felix Leibfried, Tim Genewein, and Daniel A Braun. Planning with informationprocessing constraints and model uncertainty in markov decision processes. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 475–491. Springer, 2016. + +Tuomas Haarnoja, Haoran Tang, Pieter Abbeel, and Sergey Levine. Reinforcement learning with deep energy-based policies. In International Conference on Machine Learning, pp. 1352–1361, 2017. + +Tuomas Haarnoja, Kristian Hartikainen, Pieter Abbeel, and Sergey Levine. Latent space policies for hierarchical reinforcement learning. In International Conference on Machine Learning, 2018a. + +Tuomas Haarnoja, Vitchyr Pong, Aurick Zhou, Murtaza Dalal, Pieter Abbeel, and Sergey Levine. Composable deep reinforcement learning for robotic manipulation. arXiv preprint arXiv:1803.06773, 2018b. + +Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018c. + +Hirotaka Hachiya, Jan Peters, and Masashi Sugiyama. Reward-weighted regression with sample reuse for direct policy search in reinforcement learning. Neural Computation, 23(11):2798–2832, 2011. + +Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. arXiv preprint arXiv:1710.02298, 2017. + +Heinke Hihn, Sebastian Gottwald, and Daniel Alexander Braun. Bounded rational decision-making with adaptive neural network priors. In IAPR Workshop on Artificial Neural Networks in Pattern Recognition, 2018. + +Hilbert J Kappen. Path integrals and symmetry breaking for optimal control theory. Journal of statistical mechanics: theory and experiment, 2005(11):P11011, 2005. + +Jens Kober and Jan R Peters. Policy search for motor primitives in robotics. In Advances in neural information processing systems, pp. 849–856, 2009. + +Felix Leibfried and Daniel Alexander Braun. A reward-maximizing spiking neuron as a bounded rational decision maker. Neural Computation, 27:1682–1720, 2015. + +Felix Leibfried and Daniel Alexander Braun. Bounded rational decision-making in feedforward neural networks. In Conference on Uncertainty in Artificial Intelligence, 2016. + +Felix Leibfried, Jordi Grau-Moya, and Haitham B Ammar. An information-theoretic optimality principle for deep reinforcement learning. arXiv preprint arXiv:1708.01867, 2018. + +Sergey Levine. Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909, 2018. + +Sergey Levine and Vladlen Koltun. Variational policy search via trajectory optimization. In Advances in Neural Information Processing Systems, pp. 207–215, 2013. + +Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015. + +Ofir Nachum, Mohammad Norouzi, Kelvin Xu, and Dale Schuurmans. Bridging the gap between value and policy based reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2775–2785, 2017. + +Gergely Neu, Anders Jonsson, and Vicenc¸ Gomez. A unified view of entropy-regularized markov ´ decision processes. arXiv preprint arXiv:1705.07798, 2017. + +Pedro Ortega and Daniel Alexander Braun. Thermodynamics as a theory of decision-making with information-processing costs. Proceedings of the Royal Society A, 469(2153):20120683, 2013. + +Zhen Peng, Tim Genewein, Felix Leibfried, and Daniel Alexander Braun. An information-theoretic on-line update principle for perception-action coupling. In IEEE/RSJ International Conference on Intelligent Robots and Systems, 2017. + +Jan Peters, Katharina Mulling, and Yasemin Altun. Relative entropy policy search. In ¨ AAAI, pp. 1607–1612. Atlanta, 2010. + +Martin Puterman. Markov decision processes: Discrete stochastic dynamic programming. 1994. + +Konrad Rawlik, Marc Toussaint, and Sethu Vijayakumar. On stochastic optimal control and reinforcement learning by approximate inference. In Robotics: science and systems, volume 13, pp. 3052–3056, 2012. + +Jonathan Rubin, Ohad Shamir, and Naftali Tishby. Trading value and information in mdps. In Decision Making with Imperfect Decision Makers, pp. 57–74. Springer, 2012. + +John Schulman, Xi Chen, and Pieter Abbeel. Equivalence between policy gradients and soft qlearning. arXiv preprint arXiv:1704.06440, 2017. + +Claude Shannon. Coding theorems for a discrete source with a fidelity criterion. Institute of Radio Engineers, International Convention Record, 7:142–163, 1959. + +Christopher Sims. Rational inattention and monetary economics. Handbook of Monetary Economics, 3, 2011. + +Susanne Still and William Bialek. How many clusters? an information-theoretic perspective. Neural computation, 16(12):2483–2506, 2004. + +Susanne Still and Doina Precup. An information-theoretic approach to curiosity-driven reinforcement learning. Theory in Biosciences, 131(3):139–148, 2012. + +R Sutton and A Barto. Reinforcement learning. MIT Press, Cambridge, 1998. + +Yee Teh, Victor Bapst, Wojciech M Czarnecki, John Quan, James Kirkpatrick, Raia Hadsell, Nicolas Heess, and Razvan Pascanu. Distral: Robust multitask reinforcement learning. In Advances in Neural Information Processing Systems, pp. 4496–4506, 2017. + +Philip Thomas. Bias in natural actor-critic algorithms. In International Conference on Machine Learning, pp. 441–448, 2014. + +Naftali Tishby and Daniel Polani. Information theory of decisions and actions. In Perception-Action Cycle. Springer, 2011. + +Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. The 37th Annual Allerton Conference on Communication, Control, and Computing., 1999. + +Emanuel Todorov. General duality between optimal control and estimation. In Decision and Control, 2008. CDC 2008. 47th IEEE Conference on, pp. 4286–4292. IEEE, 2008. + +Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. 2016. + +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. + +# A APPENDIX + +# A.1 CONNECTION TO MUTUAL INFORMATION FOR $\gamma 1$ + +The goal of this section is to show that when $\gamma 1$ , Equation (6) can be expressed as the following average-reward formulation (Puterman, 1994) with a constraint on the stationary mutual information + +$$ +\operatorname* { m a x } _ { \pi } \mathbb { E } _ { s \sim \mu _ { \pi } } \left[ \sum _ { a } \pi ( a | s ) r ( s , a ) \right] \quad { \mathrm { s . t . ~ } } I _ { f } ( \mu _ { \pi } , \pi , \rho _ { \pi } ) \leq C , +$$ + +where $\mu _ { \pi }$ and $\rho _ { \pi }$ are the stationary distributions induced by the policy $\pi$ over states and actions, respectively, and thus $I _ { f } ( \mu _ { \pi } , \pi , \rho _ { \pi } )$ is defined as the stationary mutual-information. Note that for a fixed stationary distribution over states, this problem coincides exactly with the well-known ratedistortion problem (Cover & Thomas, 2006). + +We start by expressing (6) as a constrained problem + +$$ +\operatorname* { m a x } _ { \pi } \mathbb { E } _ { q } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] \mathrm { ~ s . t . ~ } \operatorname* { m i n } _ { \rho } \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } I _ { f } ( \nu _ { t } , \pi , \rho ) \leq K ( \gamma ) , +$$ + +where $\begin{array} { r } { K ( \gamma ) : = \frac { C } { 1 - \gamma } } \end{array}$ (although we have set $K ( \cdot )$ as a function of $\gamma$ , it is without loss of generality since we can always obtain a desired $K ( \cdot )$ by choosing an appropriate $C$ for a given $\gamma$ ) and the marginal probability of state $s _ { t }$ at time $t$ following the Markovian dynamics is written as in Equation (10). + +A standard result in the MDP literature (Bertsekas, 1995) is that + +$$ +\arg \operatorname* { m a x } _ { \pi } \operatorname* { l i m } _ { \gamma 1 } ( 1 - \gamma ) \mathbb { E } _ { q } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) ] \iff \arg \operatorname* { m a x } _ { \pi } \mathbb { E } _ { s \sim \mu _ { \pi } } [ \sum _ { a } \pi ( a | s ) r ( s , a ) ] +$$ + +which basically says that the optimal policy for the limit $\gamma 1$ of an infinite horizon problem is equivalent to the average reward formulation. Now it only remains to make explicit a similar equivalence on the constraint. + +We rewrite the constraint by multiplying on both sides by $( 1 - \gamma )$ assuming $\gamma \in ( 0 , 1 )$ + +$$ +\operatorname* { m i n } _ { \rho } \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } I _ { f } ( \nu _ { t } , \pi , \rho ) \leq K ( \gamma ) \iff \operatorname* { m i n } _ { \rho } ( 1 - \gamma ) \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } I _ { f } ( \nu _ { t } , \pi , \rho ) \leq C . +$$ + +Taking the limit $\gamma 1$ in the last inequality and interchanging the limit and the min operators 5, we obtain the constraint $\begin{array} { r } { \operatorname* { m i n } _ { \rho } \operatorname* { l i m } _ { \gamma \to 1 } ( 1 - \gamma ) \dot { \sum } _ { t = 0 } ^ { \infty } \gamma ^ { t } I _ { f } ( \nu _ { t } , \mathbf { \bar { \pi } } , \mathbf { \bar { \rho } } ) \leq C } \end{array}$ . Then, we see the connection between the last inequality and the constraint on Equation (14) using the following Proposition 2. + +Proposition 2. Let $\mu _ { \pi } ( s )$ and $\rho _ { \pi } ( a )$ be the stationary distribution over states and actions under policy $\pi$ according to Definitions (1) and (2). Then the stationary mutual information defined as $\begin{array} { r } { I _ { f } ( \mu _ { \pi } , \pi , \rho _ { \pi } ) : = \operatorname* { m i n } _ { \rho } I _ { f } ( \mu _ { \pi } \pi , \rho ) } \end{array}$ can also be written as + +$$ +I _ { f } ( \mu _ { \pi } , \pi , \rho _ { \pi } ) = \operatorname* { m i n } _ { \rho } \operatorname* { l i m } _ { \gamma 1 } ( 1 - \gamma ) \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } I _ { f } ( \nu _ { t } , \pi , \rho ) +$$ + +where $\nu _ { t } ( s )$ is defined as in (10). + +Proof. Following similar steps as in (Bertsekas, 1995, p.186) we have + +$$ +\begin{array} { r l r } { { I _ { f } ( \mu _ { \pi } , \pi , \rho _ { \pi } ) = \operatorname* { m i n } _ { \rho } \operatorname* { l i m } _ { N \to \infty } \frac { 1 } { N } \sum _ { t = 0 } ^ { N - 1 } I _ { f } ( \nu _ { t } , \pi , \rho ) } } \\ & { } & { = \underset { \rho } { \operatorname* { m i n } } \underset { N \to \infty } { \operatorname* { l i m } } \operatorname* { l i m } _ { \rho \to 1 } \frac { \sum _ { t = 0 } ^ { N - 1 } \gamma ^ { t } I _ { f } ( \nu _ { t } , \pi , \rho ) } { \sum _ { t = 0 } ^ { N } \gamma ^ { t } } } \\ & { } & { = \underset { \rho \ \gamma \to 1 } { \operatorname* { m i n } } \underset { N \to \infty } { \operatorname* { l i m } } \ \frac { \sum _ { t = 0 } ^ { N } \gamma ^ { t } I _ { f } ( \nu _ { t } , \pi , \rho ) } { \sum _ { t = 0 } ^ { N } \gamma ^ { t } } } \\ & { } & { = \underset { \rho \ \gamma \to 1 } { \operatorname* { m i n } } ( 1 - \gamma ) \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } I _ { f } ( \nu _ { t } , \pi , \rho ) , } \end{array} +$$ + +where we used Proposition 3 (shown next) in the first equality and where the limits in the third equality can be interchanged due to the monotone convergence theorem. □ + +Proposition 3. Let $\mu _ { \pi } ( s )$ and $\rho _ { \pi } ( a )$ be the stationary distribution over states and actions under policy $\pi$ according to Definitions (1) and (2). Then the stationary mutual information defined as $I _ { f } ( \mu _ { \pi } , \pi , \rho _ { \pi } )$ can also be written as + +$$ +I _ { f } ( \mu _ { \pi } , \pi , \rho _ { \pi } ) = \operatorname* { m i n } _ { \rho } \operatorname* { l i m } _ { N \to \infty } \frac { 1 } { N } \sum _ { t = 0 } ^ { N - 1 } \sum _ { s _ { t } } \nu _ { t } ( s _ { t } ) K L ( \pi ( \cdot | s _ { t } ) | | \rho ( \cdot ) ) , +$$ + +where $\nu _ { t } ( s )$ is defined as in (10). + +Proof. Let ${ \mathcal { T } } _ { \rho } ( s ) : = \mathrm { K L } ( \pi ( \cdot | s ) | | \rho ( \cdot ) )$ and $\begin{array} { r } { \mathcal { T } _ { \rho _ { \pi } } ( s ) : = \mathrm { K L } ( \pi ( \cdot | s ) | | \rho _ { \pi } ( \cdot ) ) } \end{array}$ . Note that both previous quantities are bounded for all $t$ . Then + +$$ +\begin{array} { r l } & { \operatorname* { m i n } _ { \theta \to \theta \to \pi } \frac { 1 } { N } \displaystyle \sum _ { i = \theta \to \pi } ^ { N } \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) - \sum _ { \theta \to \pi } \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) - \sum _ { \theta \to \pi } \rho _ { i } \rangle } \\ & { \quad - \operatorname* { m i n } _ { \theta \to \theta \to \pi } \frac { 1 } { N } \displaystyle \sum _ { i = \theta \to \pi } ^ { N } \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) - \sum _ { \theta \to \pi } \rho _ { i } \rangle \displaystyle \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) \rangle } \\ & { \quad = \operatorname* { m i n } _ { \theta \to \theta \to \pi } \frac { 1 } { N } \displaystyle \sum _ { i = \theta \to \pi } ^ { N } \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) } \\ & { \quad = \operatorname* { m i n } _ { \theta \to \theta \to \pi } \frac { 1 } { N } \displaystyle \sum _ { i = \theta \to \pi } ^ { N } \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) } \\ & { \quad = \operatorname* { m i n } _ { \theta \to \theta \to \pi } \frac { 1 } { N } \displaystyle \sum _ { i = \theta \to \pi } ^ { N } \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) , \mathcal { D } _ { \theta } ( \theta ) } \\ & { \quad = \operatorname* { m i n } _ { \theta \to \theta \to \pi } \frac { 1 } { N } \displaystyle \sum _ { i = \theta \to \pi } ^ { N } \sum _ { \theta \to \theta \to \pi } \frac { 1 } { N } \displaystyle \sum _ { \theta \to \pi } \frac { 1 } { N } \sum _ { \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) \rangle } \\ & \quad = \sum _ { \theta \to \theta \to \pi } \rho _ { i } \langle \mathcal { D } _ { \theta } ( \theta ) \rangle \operatorname* { m a x } \frac { 1 } { N } \displaystyle \sum _ { \theta \to \pi } \ \end{array} +$$ + +where we assumed that $\nu _ { t } ( s ) = \mu _ { \pi } ( s )$ for all $t > K$ and finite but large enough $K$ + +Since in practice we use a discount factor $\gamma \lessapprox 1$ , our original problem formulation in (6) can be seen as an approximation to the problem with stationary mutual-information constraints in (14). + +The conclusion of this section is that we have established a clear link between the ELBO with optimizable priors and the average reward formulation with stationary mutual-information constraints. + +# A.2 HYPERPARAMETERS + +Here we describe the hyperparameters used for both the Grid World experiments (see Table 2) and the Atari experiments (see Table 3). + +Table 2: Hyperparameters for tabular experiments. + +
ParameterValue
Y αp0.99 2·10-3
+ +Table 3: Hyperparameters for Atari experiments. + +
ParameterValue
Frame size Frame skip[84,84] 4
History frames (in s)4
Reward clipping{-1,0,+1}
Max environment steps27000
Target update frequency (train. steps)10000
Training update frequency (env. steps)4
Batch size32
Memory capacity106
Y0.99
αp2.10-6
αQ2.10-5
αβ β3.3 ·10-6 0.01
+ +# A.3 SPECIFIC PLOTS FOR INDIVIDUAL GAMES + +![](images/e2f76d4b9bc965fa8690ae92b31a2af80f82b310d2495bd8bd9a49d7d600cf3c.jpg) +Figure 4: Prior Evolution for all games. We can see that MIRL’s prior has fully converged for some games whereas for other games it is still about to converge. + +![](images/bdcafa79e226ffba4fcda7c506723a23cf82ac590865c8687f64a4974c5e4eca.jpg) +Figure 5: Scores for all games on the evaluation snapshots. + +# A.4 ABLATION STUDY + +In the ablation study summarized in Figure 3, we show how marginal exploration affects SQL. In Figure 6, we show the same plot for individual games. We clearly see that the marginal exploration improves performance, but is not the defining factor for all the improvements obtained by MIRL. + +![](images/0e13fbdd9df81a1c8270c5a038f83c335d782bdb75dd14c872b7b4059a5e6774.jpg) +Figure 6: Comparison between standard SQL $( \mathbf { S } \mathbf { Q } \mathbf { L } \mathbf { - } \mathbf { u } )$ , SQL with marginal exploration $( \mathrm { S Q L } \mathrm { . m } )$ , and MIRL. + +# A.5 EVOLUTION OF THE LAGRANGE MULTIPLIER + +In Figure 7, we show the evolution of $\beta$ over time (environment steps) for the MIRL agent. As we can see, the $\beta$ -values usually start at a high value (not shown for visual reasons) and typically go down and stabilize at some value. At first sight, this might be seen as a negative side effect since lower $\beta$ values imply a stronger constraint. However, we note that the constraint is highly dependent on the scale of the reward (or its sparsity), and therefore, the $\beta$ value is not meaningful without a proper specification of this reward scaling. + +![](images/19d374c8ccb736686a9c97aae73b02816a02f67f71f245ff81a92262891953e2.jpg) +Figure 7: Beta evolution over time. + +Consequently, given that $\beta$ -values are not meaningful here, we propose to instead show the multiplication of $\beta$ times the current maximum Q-value estimates denoted as $\beta \times \operatorname* { m a x } Q$ . Note that $\bar { \beta Q } ( s , a )$ appears on the exponential term of the policy, i.e. $\begin{array} { r } { \pi ( a | s ) = \frac { 1 } { Z } \rho ( a ) \exp ( \beta Q ( s , a ) ) } \end{array}$ , and therefore, is the term that shapes the deviation from the action-prior distribution. Additionally, the Q-values serve us as proper scaling for each game and account also for the learning of the agent. In particular, while the agent is learning and increasing its reward acquisition, the Q-values are going to be higher, thus, effectively needing a smaller $\beta$ to shape the policy probabilities. + +On Figure 8, we show the evolution of the term $\beta \times \operatorname* { m a x } Q$ for all the games. As we can see for the majority of games, $\beta \times \operatorname* { m a x } Q$ increases over time or has high value. This is important since a high value denotes that the policy is highly affected by this term. + +![](images/d3b3fc3cd4ca797fa254c2bd49e7760b567d1a91c373bc77b9ab23854a38a96c.jpg) +Figure 8: Evolution of $\beta \times \operatorname* { m a x } Q$ over time while training. Specifically, for an environment step $i$ , we compute the $\beta _ { i } \operatorname* { m a x } _ { a } Q _ { \theta _ { i } } ( s _ { i } , a )$ , where $\beta _ { i }$ is the current $\beta$ -value, $Q _ { \theta _ { i } }$ the current approximation of $\mathrm { Q }$ and $s _ { i }$ is the state at the step $i$ . \ No newline at end of file diff --git a/md/train/HygUOoC5KX/HygUOoC5KX.md b/md/train/HygUOoC5KX/HygUOoC5KX.md new file mode 100644 index 0000000000000000000000000000000000000000..9a41792fc7a4022c69c2c6dbcf4aed47d5e48d49 --- /dev/null +++ b/md/train/HygUOoC5KX/HygUOoC5KX.md @@ -0,0 +1,517 @@ +# ARE GENERATIVE CLASSIFIERS MORE ROBUST TO ADVERSARIAL ATTACKS? + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +There is a rising interest in studying the robustness of deep neural network classifiers against adversaries, with both advanced attack and defence techniques being actively developed. However, most recent work focuses on discriminative classifiers, which only model the conditional distribution of the labels given the inputs. In this paper, we propose and investigate the deep Bayes classifier, which improves classical naive Bayes with conditional deep generative models. We further develop detection methods for adversarial examples, which reject inputs with low likelihood under the generative model. Experimental results suggest that deep Bayes classifiers are more robust than deep discriminative classifiers, and that the proposed detection methods are effective against many recently proposed attacks. + +# 1 INTRODUCTION + +Deep neural networks have been shown to be vulnerable to adversarial examples (Szegedy et al., 2013; Goodfellow et al., 2014). The latest attack techniques can easily fool a deep neural network with imperceptible perturbations (Goodfellow et al., 2014; Papernot et al., 2016b; Carlini & Wagner, 2017a; Kurakin et al., 2016; Madry et al., 2018; Chen et al., 2017a), even in the black-box case, where the attacker does not have access to the network’s weights (Papernot et al., 2017b; Chen et al., 2017b; Alzantot et al., 2018a). Adversarial attacks are serious security threats to machine learning systems, threatening applications beyond image classification (Carlini & Wagner, 2018; Alzantot et al., 2018b). + +To address this outstanding security issue, researchers have proposed defence mechanisms against adversarial attacks. Adversarial training, which augments the training data with adversarially perturbed inputs, has shown moderate success at defending against recently proposed attack techniques (Szegedy et al., 2013; Goodfellow et al., 2014; Tramer et al., 2017; Madry et al., 2018). In addition, \` recent advances in Bayesian neural networks have demonstrated that uncertainty estimates can be used to detect adversarial attacks (Li & Gal, 2017; Feinman et al., 2017; Louizos & Welling, 2017; Smith & Gal, 2018). Another notable category of defence techniques involves the usage of generative models. For example, Gu & Rigazio (2014) used an auto-encoder to denoise the inputs before feeding them to the classifier. This denoising approach has been extensively investigated, and the “denoisers” in usage include generative adversarial networks (Samangouei et al., 2018), PixelCNNs (Song et al., 2018) and denoising auto-encoders (Kurakin et al., 2018). These developments rely on the “off-manifold” conjecture, that is, that adversarial examples are far away from the data manifold, although Gilmer et al. (2018) has challenged this observation with a synthetic example. + +Surprisingly, much less recent work has investigated the robustness of generative classifiers (Ng & Jordan, 2002) against adversarial attacks for multi-class classification, where such classifiers explicitly model the conditional distribution of the inputs given labels. Typically, a generative classifier produces predictions by comparing between the likelihood of the labels for a given input, which is closely related to the “distance” of the input to the data manifold associated with a class. Therefore, generative classifiers should be robust to many recently proposed adversarial attacks if the “off-manifold” conjecture holds for many real-world applications. Unfortunately, many generative classifiers in popular use, including naive Bayes and linear discriminant analysis (Fisher, 1936), perform poorly on natural image classification tasks, making it difficult to verify the “off-manifold” conjecture and the robustness of generative classifiers with these tools. In recent work, $\mathbf { k }$ -nearest neighbors (Cover & Hart, 1967), a method which shares many similarities with generative classifiers, has been significantly improved in handling natural images by leveraging deep feature representations (Papernot & McDaniel, 2018). To the best of our knowledge, an approach which targets a similar contribution has not yet been proposed for generative classifiers. + +Are generative classifiers more robust to recently proposed adversarial attack techniques? To answer this, we improve the naive Bayes algorithm by using conditional deep generative models, and evaluate the conjecture on the proposed generative classifier. In summary, our contributions include: + +• We propose deep Bayes as an extension of naive Bayes, in which the conditional distribution of an input, given a label, is parameterised by a deep latent variable model (LVM). We learn the LVM with the variational auto-encoder algorithm (Kingma & Welling, 2013; Rezende et al., 2014), and approximate Bayes’ rule using importance sampling. We propose three detection methods for adversarial perturbations. The first two use the learned generative model as a proxy of the data manifold, and reject inputs that are far away from it. The third computes statistics for the classifier’s output probability vector on training data, and rejects inputs that lead to under-confident predictions. We evaluate the robustness of the proposed generative classifier on the MNIST multi-class and CIFAR binary classification tasks. We also improve the robustness of deep neural networks on CIFAR-10 multi-class classification, by fusing discriminatively learned visual feature representations with the proposed generative classifiers. We further compare the generative classifiers with a number of discriminative classifiers, including Bayesian neural networks and discriminative latent variable models. + +# 2 DEEP BAYES: CONDITIONAL DEEP LVM AS A GENERATIVE CLASSIFIER + +Denote $p _ { \mathcal { D } } ( \pmb { x } , \pmb { y } )$ the data distribution for the input $\pmb { x } \in \mathbb { R } ^ { D }$ and label $\pmb { y } \in \{ \pmb { y } _ { c } | c = 1 , . . . , C \}$ , where $\mathbf { \nabla } \mathbf { \textbf { { y } } } _ { c }$ denotes the one-hot encoding vector for class $c$ . For a given $\pmb { x } \in \mathbb { R } ^ { D }$ we can define the ground-truth label by + +$$ +\pmb { y } \sim p _ { \mathcal { D } } ( \pmb { y } | \pmb { x } ) \quad \mathrm { ~ i f ~ } \pmb { x } \in \mathrm { s u p p } ( p _ { \mathcal { D } } ( \pmb { x } ) ) . +$$ + +We assume the data distribution $p _ { \mathcal { D } } ( \pmb { x } , \pmb { y } )$ follows the manifold assumption: for every class $c$ , the conditional distribution $p _ { \mathcal { D } } ( \pmb { x } | \pmb { y } _ { c } )$ has a low-dimensional manifold support $\mathcal { M } _ { c } = \operatorname { s u p p } ( p _ { \mathcal { D } } ( \pmb { x } | \pmb { y } _ { c } ) )$ . Therefore the training dataset $\mathcal { D } = \{ ( \pmb { x } ^ { ( n ) } , \pmb { y } ^ { ( n ) } ) \} _ { n = 1 } ^ { N }$ is generated as the following: + +$$ +( { \pmb x } ^ { ( n ) } , { \pmb y } ^ { ( n ) } ) \sim p _ { \mathcal { D } } ( { \pmb x } , { \pmb y } ) \Leftrightarrow { \pmb y } ^ { ( n ) } \sim p _ { \mathcal { D } } ( { \pmb y } ) , { \pmb x } ^ { ( n ) } \sim p _ { \mathcal { D } } ( { \pmb x } | { \pmb y } ) . +$$ + +A (Bayesian) generative classifier first builds a generative model $p ( { \pmb x } , { \pmb y } ) = p ( { \pmb x } | { \pmb y } ) p ( { \pmb y } )$ , and then, in prediction time, predicts the label $\boldsymbol { y } ^ { * }$ of a test input $\pmb { x } ^ { * }$ using Bayes’ rule, + +$$ +p ( { \pmb y } ^ { * } | { \pmb x } ^ { * } ) = \frac { p ( { \pmb x } ^ { * } | { \pmb y } ^ { * } ) p ( { \pmb y } ^ { * } ) } { p ( { \pmb x } ^ { * } ) } = \mathrm { s o f t m a x } _ { c = 1 } ^ { C } \left[ \log p ( { \pmb x } ^ { * } , { \pmb y } _ { c } ) \right] , +$$ + +where $\mathrm { s o f t m a x } _ { c = 1 } ^ { C }$ denotes the softmax operator over the $c$ axis. Therefore, the output probability vector is computed analogously to many deep discriminative classifiers which use softmax activation in the output layer, so many existing attacks can be tested directly. However, unlike discriminative classifiers, the “logit” values prior to softmax activation have a clear meaning here, which is the (approximated) log joint distribution $\log p ( { \pmb x } ^ { * } , { \pmb y } _ { c } )$ of input $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } } \ast \mathbf { \ v { x } }$ conditioned on a given label $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } _ { c } }$ . Therefore, one can also analyse the logit values to determine whether the unseen pair $( { \boldsymbol { \it x } } ^ { * } , { \boldsymbol { \it y } } ^ { * } )$ is legitimate, a utility which will be discussed further in later sections. + +Naive Bayes is perhaps the most well-known generative classifier; it assumes a factorised distribution for the conditional generator, i.e. $\begin{array} { r } { p ( \pmb { x } | \pmb { y } ) = \prod _ { d = 1 } ^ { D } p ( x _ { d } | \pmb { y } ) } \end{array}$ . However, this factorisation assumption is inappropriate for e.g. image and speech data. Fortunately, we can leverage the recent advances in generative modelling and apply a deep generative model for the joint distribution $p ( { \pmb x } , { \pmb y } )$ . We refer to such generative classifiers that use deep generative models as deep Bayes classifiers. + +In this paper, we consider a deep latent variable model (LVM) $p ( { \pmb x } , { \pmb z } , { \pmb y } )$ , which will be used for classification. In this case, the conditional distribution is p(x|y) = R p(x,z,y)dzR p(x,z,y)dzdx . Importantly, this leads to a conditional distribution $p ( { \pmb x } | { \pmb y } )$ that is not factorised (even when $p ( \pmb { x } | \pmb { z } , \pmb { y } )$ is), which is much more powerful than naive Bayes. Since maximum likelihood is intractable, we follow + +![](images/220140844094a3f088b10ef70c1787e4802498efb521d87e87e0c1adf30847b7.jpg) +Figure 1: A visualisation of the graphical models, including both Generative and Discriminative ones, as well as Fully connected and Bottleneck ones. The last character indicates the first node in the topological order of the graph. The colour encoding is the same as those in experiments. + +Kingma & Welling (2013) and Rezende et al. (2014) to introduce an amortised approximate posterior $q ( \boldsymbol { z } | \boldsymbol { x } , \boldsymbol { y } )$ , and train both $p$ and $q$ by maximising the variational lower-bound: + +$$ +\mathbb { E } _ { \mathcal { D } } [ \mathcal { L } _ { \mathrm { V I } } ( \pmb { x } , \pmb { y } ) ] = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathbb { E } _ { q } \left[ \log \frac { p ( \pmb { x } _ { n } , \pmb { z } _ { n } , \pmb { y } _ { n } ) } { q ( \pmb { z } _ { n } | \pmb { x } _ { n } , \pmb { y } _ { n } ) } \right] . +$$ + +After training, the predicted class probability vector $\boldsymbol { y } ^ { * }$ for a future input $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } } \ast \mathbf { \ v { x } }$ is computed by an approximation to Bayes’ rule with importance sampling: + +$$ +p ( \pmb { y } ^ { * } | \pmb { x } ^ { * } ) \approx \mathrm { s o f t m a x } _ { c = 1 } ^ { C } \left[ \log \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \frac { p ( \pmb { x } ^ { * } , \pmb { z } _ { c } ^ { k } , \pmb { y } _ { c } ) } { q ( \pmb { z } _ { c } ^ { k } | \pmb { x } ^ { * } , \pmb { y } _ { c } ) } \right] , \quad \pmb { z } _ { c } ^ { k } \sim q ( \pmb { z } | \pmb { x } ^ { * } , \pmb { y } _ { c } ) . +$$ + +We evaluate the effect of the following factorisation structures on the robustness of the induced classifier from the generative model $p ( \pmb { x } , \pmb { z } , \pmb { y } )$ (see Figure 1). + +$$ +\begin{array} { l l l } { p ( { \pmb x } , { \pmb z } , { \pmb y } ) = p ( { \pmb z } ) p ( { \pmb y } | { \pmb z } ) p ( { \pmb x } | { \pmb z } , { \pmb y } ) \quad } & { ( { \mathrm { G F Z } } ) } \\ { p ( { \pmb x } , { \pmb z } , { \pmb y } ) = p _ { \mathcal { D } } ( { \pmb y } ) p ( { \pmb z } | { \pmb y } ) p ( { \pmb x } | { \pmb z } , { \pmb y } ) \quad } & { ( { \mathrm { G F Y } } ) } \\ { p ( { \pmb x } , { \pmb z } , { \pmb y } ) = p ( { \pmb z } ) p ( { \pmb y } | { \pmb z } ) p ( { \pmb x } | { \pmb z } ) \quad } & { ( { \mathrm { G B Z } } ) \quad } & { p ( { \pmb x } , { \pmb z } , { \pmb y } ) = p _ { \mathcal { D } } ( { \pmb x } ) p ( { \pmb z } | { \pmb x } ) p ( { \pmb y } | { \pmb z } ) } \\ { p ( { \pmb x } , { \pmb z } , { \pmb y } ) = p _ { \mathcal { D } } ( { \pmb y } ) p ( { \pmb z } | { \pmb y } ) p ( { \pmb x } | { \pmb z } ) \quad } & { ( { \mathrm { G B Y } } ) } \end{array} +$$ + +We use the initial character “G” to denote generative classifiers and “D” to denote discriminative classifiers. Models with the second character as “F” have a fully connected graph, while “B” models enforce the usage of the latent code $_ { z }$ as a bottleneck. The last character of the model name indicates the first node in topological order. Model DFZ is somewhat intermediate, as it builds a generative model for the inputs $_ { \textbf { \em x } }$ but also directly parameterises the conditional distribution $p ( \pmb { y } | \pmb { x } , z )$ . We do not test other architectures under this nomenclature, as either the graph contains directed cycles (e.g. $\pmb { x } \pmb { y } \pmb { z } \pmb { x } ,$ ), or $_ z$ is the last node in topological order (e.g. $\pmb { x } \pmb { y } , ( \pmb { x } , \pmb { y } ) \pmb { z } )$ so that the marginalisation of $_ z$ does not affect classification. + +# 3 DETECTING ADVERSARIAL ATTACKS WITH GENERATIVE CLASSIFIERS + +We propose detection methods for adversarial examples using generative classifier’s logit values. As an illustrating example, consider a labelled dataset of “cat” and “dog” images. If an adversarial image of a cat $\pmb { x } _ { \mathrm { a d v } }$ is incorrectly labelled as “dog”, then either this image is ambiguous, or, under a perfect generative model, the logit $\log p ( \pmb { x } _ { \mathrm { a d v } }$ , “dog”) will be significantly lower than normal. This means we can detect attacks using the logits $\log p ( { \pmb x } ^ { * } , { \pmb y } _ { c } ) , c = 1 , . . . , C$ computed on a test input $\mathbf { \boldsymbol { x } } ^ { * }$ , by comparing them with the logits computed on legitimate training inputs. + +Concretely, the proposed detection algorithms are as follows. We aim to reject both unlabelled input $_ { \textbf { \em x } }$ that have low probability under $p _ { \bar { D } } \bar { ( } \pmb { x } )$ , and labelled data $( { \pmb x } , { \pmb y } )$ that have low $p _ { \mathcal { D } } ( \pmb { x } , \pmb { y } )$ values. + +• Marginal detection: rejecting inputs that are far away from the manifold. One can select a threshold $\delta$ and reject an input $_ { \textbf { \em x } }$ if $- \log p ( { \pmb x } ) > \delta$ . To determine the threshold $\delta$ , we can compute $\bar { d } _ { \mathcal { D } } = \mathbb { E } _ { \pmb { x } \sim \mathcal { D } } [ - \log p ( \pmb { x } ) ]$ and $\sigma _ { \mathcal { D } } = \sqrt { \mathbb { V } _ { \pmb { x } \sim \mathcal { D } } [ \log p ( \pmb { x } ) ] }$ , then set $\delta = \bar { d } _ { D } + \alpha \sigma _ { D }$ . It is also possible to compute the statistics ${ \bar { d } } _ { p } , \sigma _ { p }$ on the images generated by the generative model accordingly. +Logit detection: rejecting inputs using joint density. Given a victim model $\pmb { y } = F ( \pmb { x } )$ , one can reject $_ { \textbf { \em x } }$ if $- \log p ( { \pmb x } , F ( { \pmb x } ) ) > \delta _ { \pmb y }$ . We can use the mean and variance statistics $\bar { d } _ { c } , \sigma _ { c }$ computed on $\log p ( { \pmb x } , { \pmb y } _ { c } )$ and select $\delta _ { y _ { c } } = \bar { d } _ { c } + \alpha \sigma _ { c }$ . + +![](images/63ac3a599fb3fd7f9b0ceeb289e5088441fbf7ba011a0d3f9a13300e966b86cc.jpg) +Figure 2: Visualising detection mechanisms. The scattered dots are training data points, with different classes shown in different colours (red for $c = 0$ and blue for $c = 1$ ). Same labels are manually assigned for inputs when the detection method requires $\textbf { { y } }$ . Decision regions are shown in the corresponding colours. Input points in the shaded area are rejected by detection. + +• Divergence detection: rejecting inputs with over- and/or under-confident predictions. + +Denote ${ \pmb p } ( { \pmb x } )$ as a $C$ -dimensional probability vector outputted by the classifier. For each class $c$ , we first collect the mean classification probability vector $\pmb { p } _ { c } = \mathbb { E } _ { ( \pmb { x } , \pmb { y } _ { c } ) \in \mathcal { D } } [ \pmb { p } ( \pmb { x } ) ]$ , then compute the mean $\bar { d } _ { c }$ and standard deviation $\sigma _ { c }$ on a selected divergence/distance measure $\bar { \mathrm { D } } [ p _ { c } | | p ( { \pmb x } ) ]$ for all $( \pmb { x } , \pmb { y } _ { c } ) \in \mathcal { D }$ . A test input $\pmb { x } ^ { * }$ with prediction label $c ^ { * } =$ arg max $\pmb { p } ( \pmb { x } ^ { * } )$ is rejected if $\mathrm { D } [ p _ { c ^ { * } } | | p ( { \pmb x } ^ { * } ) ] > \bar { d } _ { c ^ { * } } + \bar { \alpha \sigma } _ { c ^ { * } }$ . Therefore, an example $\pmb { x } ^ { * }$ will be rejected if the classifier is over-confident or under-confident (ambiguous inputs). + +When $\mathrm { D }$ is selected as the KL-divergence, we call this detection method $K L$ detection. +Other divergence/distance measures such as total variation (TV) can also be used. + +For better intuition, we visualise the detection mechanisms in Figure 2 with a synthetic “two rings” binary classification example. In this case we sample $2 \times 1 0 0 0$ training data points as: + +( $\begin{array} { r l } & { x , y ) \sim p _ { D } \Leftrightarrow y \sim \mathrm { B e r n } ( 0 . 5 ) , \theta \sim \mathrm { U n i f o r m } ( 0 , 2 \pi ) , x | y \sim \mathcal { N } ( x ; c _ { y } + r _ { y } [ c o s ( \theta ) , s i n ( \theta ) ] ^ { \mathrm { T } } , \sigma ^ { 2 } { \bf I } ) . } \end{array}$ We consider a generative classifier $p ( \pmb { x } , \pmb { y } ) = p ( \pmb { x } | \pmb { y } ) p _ { \mathscr { D } } ( \pmb { y } ) = \mathcal { N } ( \pmb { x } ; \pmb { \mu _ { y } } , \sigma ^ { 2 } \mathbf { I } ) \mathbf { B e r n } ( 0 . 5 )$ ) with $\mu _ { y } =$ $\operatorname { p r o j } ( x , \operatorname { r i n g } _ { y } ) = \arg \operatorname* { m i n } _ { \hat { x } \in \mathbb { R } ^ { 2 } }$ , $| | \hat { \mathbf { x } } - \pmb { c } _ { y } | | _ { 2 } = { r } _ { y } \ | | \pmb { x } - \hat { \pmb { x } } | | _ { 2 }$ . The $\delta$ thresholds are selected to achieve $1 0 \%$ false positive rates on training data. From the visualisations we see that inputs that are far away from the model manifold are rejected by marginal/logit detection. At the same time, logit detection rejects data points that are not on the manifold of the given class. KL/TV detection does not construct manifold-aware acceptance regions, which is as expected since the proposed divergence detection method does not require the classifier to be generative. However, both detection methods have some success in rejecting uncertain predictions, especially for TV, which also rejects ambiguous inputs (see the ring-cross regions in the last two plots). Combining all three methods, we see that the rejected inputs are either far away from the manifold, or are ambiguous. Again we emphasise that a suitable generative model is required to make the detection methods work in practice, since the data distribution $p _ { \mathcal { D } } ( \pmb { x } , \pmb { y } )$ is approximated by $p ( { \pmb x } , { \pmb y } )$ . + +Detection methods using logit values have also been proposed in Li & Gal (e.g. 2017); Feinman et al. (e.g. 2017). However it is unclear whether the logits values in discriminative classifiers have a clear semantic meaning, while the logit values in deep Bayes represent the log probability of generating the input $_ { \textbf { \em x } }$ given the class label ${ \mathbf { \nabla } } y = y _ { c }$ . Our approach is also distinct from previous “denoising” approaches (e.g. Song et al., 2018; Samangouei et al., 2018; Kurakin et al., 2018) that require training an additional generative model separately. The deep Bayes classifiers share the same generative model as the detection methods, meaning that detected adversarial examples are indeed far away from the classifier’s manifold (which is also an approximation to the data manifold). Therefore the claim “detection neural networks can be bypassed” (Carlini & Wagner, 2017a; Athalye et al., 2018) does not directly transfer to our approach, and we can use the marginal and logit detection methods to directly verify the “off-manifold” adversarial example conjecture. + +# 4 EXPERIMENTS + +We carry out a number of tests on the proposed deep Bayes classifiers (3), where $q ( z | \cdot )$ and $p ( z | \cdot )$ are factorised Gaussians, and the conditional probability $p ( { \pmb x } | \cdot )$ , if required, is parameterised by an $\ell _ { 2 }$ loss. Besides the LVM-based classifiers, we further train a Bayesian neural network (BNN) with Bernoulli dropout (dropout rate 0.3), as it has been shown in Li & Gal (2017) and Feinman et al. (2017) that BNNs are more robust than their deterministic counterparts. The constructed BNN has $2 \mathbf { x }$ more channels than LVM-based classifiers, making the comparison slightly “unfair”, as the BNN layers have more capacity. We use $K = 1 0$ Monte Carlo samples for all the classifiers. + +![](images/00ae51d305686cd331a0a614d4028a57298f23ffcfe3de3c5e0e296f5308977e.jpg) +Figure 3: Accuracies (column 1), detection rates (columns 2-4) and minimum $\ell _ { \mathrm { i n f } }$ perturbation (column 6) against white-box zero-knowledge $\ell _ { \infty }$ attacks on MNIST. The higher the better. The second from right most column visualises crafted adversarial examples on an image of digit “7”, with $\ell _ { \infty }$ distortion $\epsilon$ growing from 0.1 to 0.5. + +The adversarial attacks in test include both $\ell _ { \infty }$ and $\ell _ { 2 }$ untargeted attacks from CleverHans 2.0 library (Papernot et al., 2017a): fast gradient sign method (FGSM, Goodfellow et al., 2014), projected gradient descent (PGD, Madry et al., 2018), momentum iterative attack (MIM, Dong et al., 2017) and Carlini & Wagner $\ell _ { 2 }$ (CW, Carlini & Wagner, 2017a). Two metrics are reported: accuracy of the classifier on crafted adversarial examples, and detection rate on adversarial examples that have successfully caused the classifier to misclassify. This detection rate is defined as the true positive (TP) rate of finding an adversarial example, and the detection threshold is selected to achieve a $5 \%$ false positive rate on clean training data. + +The experiments are performed under various threat model settings. We further evaluate the transferability of crafted adversarial examples across different classifiers in the same way as done in Papernot et al. (2016a). We only provide visualisations in the main text; full table results can be found in the appendix. Readers are also referred to the appendix for further experiments, including a quantitative analysis of the bottleneck effect on robustness and detection. + +# 4.1 MNIST + +The first set of experiments evaluate the robustness of generative classifiers on MNIST. Here the image pixel values are normalised to [0, 1], and the LVM-based classifiers have $\dim ( z ) ~ = ~ 6 4$ . We first perform white-box zero-knowledge attacks, i.e. the attacker can differentiate through the classifier to craft adversarial examples, but he/she is not aware of the existence of the detector. Then we perform white-box perfect-knowledge attacks, where the attacker can differentiate through both the classifier and the detector, and he/she knows the usage of random $_ { z }$ samples by the VAE-based classifiers (Biggio et al., 2013; Carlini & Wagner, 2017b). Lastly we consider grey-box and blackbox attacks, and evaluate the robustness of generative classifiers against transferred attacks. + +White-box attacks (zero-knowledge, $\ell _ { \infty , }$ ) Results for $\ell _ { \infty }$ attacks are reported in Figure 3, and in general generative classifiers perform better in terms of victim accuracy and minimum perturbation of the attacks.1 By contrast, DFX & DFZ are not robust to the weakest attack (FGSM) even when $\epsilon =$ 0.2 (where the adversarial examples are still visually close to the original digit “7”). Interestingly, DBX is the most robust against FGSM & $\mathbf { M I M } ^ { 2 }$ , which agrees with the preliminary tests in Alemi et al. (2017). But DBX is less robust to PGD, and here GBZ is a clear winner. These results show that the bottleneck is sometimes beneficial for better robustness of MNIST classifiers. + +For detection, generative classifiers have successfully detected the adversarial examples with $\epsilon \geq$ 0.3, which is reasonable as the visual distortion is already significant. Importantly, generative classifier’s victim accuracy decreases as the $\ell _ { \infty }$ distortion $\epsilon$ increases, but at the same time the TP rates for marginal and logit detection also increase. Therefore these $\ell _ { \infty }$ attacks fail to find near-manifold adversarial examples that fool both the classifier and the detection methods. DFZ, as an intermediate between generative and discriminative classifiers, has worse robustness results, but has good detection performance for the marginal and logit metrics. This is because with softmax activation, the marginal distribution $p ( { \pmb x } )$ is dropped, but in marginal/logit detection $p ( { \pmb x } )$ is still in use. + +Table 1: White-box zero-knowledge CW- $\cdot \ell _ { 2 }$ attack results. Here, accuracy (adv) measures classifying the adversarial inputs to the original classes. + +
acc.(clean)acc. (adv)l2 dist.TP KL
BNN99.12%24.40%2.12995.31
GFZ98.55%28.58%2.66395.37
GBZ97.45%81.51%2.44691.01
GFY99.15%28.64%2.73296.03
GBY98.72%32.72%2.73594.46
DFX99.10%20.31%2.09599.96
DBX98.87%30.19%1.80696.76
DFZ99.10%13.60%2.18899.57
+ +![](images/7155749b68688828aa6066f627f9693ca5bbdeeaa7d46d33450c322e20420f9b.jpg) +Figure 4: Visualising the clean inputs and the CW adversarial examples crafted on GFZ, digits in red rectangles show significant ambiguity. + +White-box attack (zero-knowledge, $\ell _ { 2 }$ ) For the CW $\ell _ { 2 }$ attack, we performed a hyperparameter search for the loss-balancing parameter $c$ $\ell _ { 2 }$ distortion increases with larger $c$ ) in $\{ 0 . 1 , 1 , 1 0 , 1 0 0 , 1 0 0 0 \}$ on the first 100 test images, and we found $c = 1 0$ returns the highest success rate. Results are reported in Table 1. Although being successful on fooling many classifiers, CW failed on attacking GBZ. Also, the mean $\ell _ { 2 }$ distortions of the successful attacks on generative classifiers are significantly larger. Furthermore, we found the success of the attack on other generative classifiers is mainly due to the ambiguity of the crafted adversarial images. As visualised in Figure 4 (also see Figure D.1 in appendix), the induced distortion from CW leads to ambiguous digits which sit at the perceptual boundary between the original and the adversarial classes. With the KL detection method, all classifiers achieve $> 9 5 \%$ detection rates, which is as expected as the default CW attack configuration, by construction, generates adversarial examples that lead to minimal difference between the logit values of the most and the second most probable classes. + +White-box attack (perfect-knowledge, $\ell _ { \infty }$ ) The PGD-based perfect-knowledge $\ell _ { \infty }$ attack is designed following (Carlini & Wagner, 2017b): we construct an (approximate) Bayes classifier $p _ { k } ( \pmb { y } | \pmb { x } )$ using (3) for each set of samples $\{ z _ { c } ^ { k } \} _ { c = 1 } ^ { C }$ , and minimize the following with PGD: + +$$ +\mathcal { L } ( \eta ) = \sum _ { k = 1 } ^ { K } \log p _ { k } ( \boldsymbol { y } | \boldsymbol { x } + \eta ) + \lambda _ { \mathrm { d e t e c t } } \operatorname* { m a x } ( 0 , \Phi ( \boldsymbol { x } + \eta , \boldsymbol { y } ) - \delta ) . +$$ + +The detection statistic $\Phi ( { \pmb x } + { \pmb \eta } , { \pmb y } )$ is $- \log p ( { \pmb x } + { \pmb \eta } )$ for marginal detection, and $\delta$ is the corresponding threshold computed on training data. For logit/KL detection, the detection statistics and thresholds are constructed accordingly. We label the three attacks against the marginal, logit and KL based detection schemes ’-PKM’, ’-PKL’ and ’-PKK’ respectively. When we only have knowledge of the $K$ samples and not the detection method we call this attack ’-PK0’ (ie $\lambda _ { \mathrm { d e t e c t } } { = } 0$ in Eq. 4). + +Results are visualised in Figure 5. We see that although the attacker can reduce detection levels, this comes with the trade-off of increasing accuracy, suggesting that a perfect-knowledge adversary cannot break both the classifier and detector working in tandem. + +Sanity checks on gradient masking Athalye et al. (2018) claimed that if a successful defence against white-box attacks is due to gradient masking, then this defence is likely to be less effective against grey-box/black-box attacks, as they do not differentiate through the victim classifier and the defence mechanism (Papernot et al., 2017b). Therefore, we consider two transfer attacks based on distilling the victim classifier using a “student” CNN which has no gradient masking. The two attacks differ in their threat models: in the grey-box setting the attacker has access to the output probability vectors of the classifiers on the training data, while in the black-box setting the attacker has access to queried labels only. For the latter black-box setting, we follow Papernot et al. (2017b) to train a substitute CNN using Jacobian-based dataset augmentation, and we refer to appendix B.1 for the detailed algorithm. The grey-box substitutes achieve $> 9 9 \%$ agreement with the victims on test data, and the black-box substitutes obtained $\sim 9 6 \%$ accuracy on test data. + +![](images/92fbc68f077b0912c224d9aa79a22a044fe5d692681f9182450b3127b5751d73.jpg) +Figure 5: Accuracy and detection rates of DBX, GBY, and GBZ against PGD-based perfectknowledge attack $( \epsilon = 0 . 2 )$ ) on MNIST. The solid area denotes accuracy and the hatched area denotes detection rate with each considered detector. Zero knowledge attacks are labelled ’-ZK’, other attack labels are described in the main text. + +![](images/a9d0675f4478e57a95c5946f6c2e9e26184ee8ec7905a49a23ceeb8edb588c24.jpg) +Figure 6: Accuracy and detection rates against distillation-based attacks on MNIST. The higher the better. We only present generative classifiers’ results here, for full results see appendix E. + +Figure 6 shows the accuracy and detection metrics on transferred $\ell _ { \infty }$ attacks crafted on the substitute models, with a comparison to their white-box counterparts. Note that these crafted attacks achieve $\sim$ $1 0 0 \%$ success rates on fooling the substitute models when $\epsilon \geq 0 . 2$ (see appendix E). However, they do not transfer very well to the generative classifiers. Importantly, for a fixed $\epsilon$ setting, the whitebox attacks achieve significantly higher success rates (i.e. lower victim accuracies) than their grey/black-box counterparts, and the gap is at least $> 2 0 \%$ for $\epsilon \leq 0 . 3$ (see Table 2). We further present the mean minimum $\ell _ { \infty }$ perturbation in Table 2, and we see that the minimum perturbation obtained by grey-/black-box attacks are significantly higher than those obtained by white-box attacks. + +All these results suggest that the robustness of generative classifiers is unlikely to be caused by gradient masking. Again on the detection side, the detection rates increase as the perturbation size increase, and they are near $1 0 0 \%$ for $\epsilon = 0 . 3$ . This means that most of the successfully transferred adversarial images are off the generative classifier’s manifold (as a proxy to the data manifold). + +SPSA (evolutionary strategies) We consider another black-box setting that only assumes access to the logit values of the prediction given an input. We use the SPSA $\ell _ { \infty }$ attack (Uesato et al., 2018), which is similar to the white-box zero-knowledge attacks, except that gradients are numerically estimated using the logit values from the victim classifier. Results in Table 3 clearly show that SPSA performs much worse on generative classifiers when compared to white-box PGD. Again this means gradient masking is unlikely to be responsible for the improved robustness of generative classifiers, as utilising the exact gradient yielded improved results. + +Table 2: Mean minimum $\ell _ { \infty }$ perturbation (in red, computed on $\epsilon \in \{ 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 , 0 . 5 \} )$ and victim accuracy (in blue, for $\epsilon \leq 0 . 3 )$ for $\ell _ { \infty }$ attacks on MNIST. We manually assign the min. perturbation $\epsilon = 0 . 6$ to inputs that all attacks failed to find adversarial perturbations. + +
AttackGFZGBZGFYGBY
PGD(white-box)0.23 /7.71%0.30 /30.78%0.21 / 5.52%0.23 / 8.89%
MIM(white-box)0.24 / 9.02%0.21 /4.97%0.22 / 6.72%0.21 /1.54%
PGD(grey-box)0.37 /51.08%0.36 / 50.64%0.38 / 53.29%0.36 / 48.66%
MIM(grey-box)0.34 / 43.00%0.33 / 40.94%0.34 / 46.64%0.33 /40.06%
PGD(black-box)0.40 / 61.93%0.42 /66.75%0.38 / 56.35%0.43 / 68.50%
MIM(black-box)0.36 / 50.44%0.38 / 59.86%0.36 / 48.07%0.39 / 61.78%
+ +![](images/539526329232367bbefc7f3dde85c40b740d2252d0a5700694c8065b953efdca.jpg) +Figure 7: Results on cross-model transfer attacks on MNIST. The horizontal axis corresponds to the source victim that the adversarial examples are crafted on, and the vertical axis corresponds to the target victim that the attacks are transferred to. The higher (i.e. the lighter) the better. + +Cross-model attack transferability Finally, we report in Figure 7 the transferability results of the crafted adversarial examples between different models (Papernot et al., 2016a). Here we take adversarial examples crafted in the white-box setting with PGD and MIM $\acute { \epsilon } = 0 . 3$ ), and transfer successful attacks to other classifiers. The transfer is effective between generative classifiers but not from generative to discriminative (and vice versa). The attacks crafted on DBX do not transfer in general, while at the same time, DBX is the least robust model in this case. Furthermore, the generative classifiers obtain very high detection rates on all transferred attacks $( > 9 5 \% )$ . In summary, generative classifiers are more robust against the tested transfer attacks across different models. + +# 4.2 CIFAR PLANE-VS-FROG BINARY CLASSIFICATION + +We consider the same set of evaluations on CIFAR-10, in order to validate the robustness of generative classifiers on natural images (c.f. Carlini & Wagner, 2017b). Unfortunately, we failed to train fully generative classifiers with comparable test accuracies to discriminative CNNs (typically $> 8 0 \%$ ): the clean accuracies for GFZ & GFY are all $< 5 0 \%$ . Even when using the conditional PixelC $\mathrm { N N } { + } { + }$ (Salimans et al., 2017) (which uses much deeper networks), the clean accuracy on the test data is $7 2 . 4 \%$ . Instead, we consider a simpler binary classification problem and construct a dataset containing CIFAR images from the “airplane” and “frog” categories. The images in this dataset are scaled to [0, 1]. On this dataset, the generative classifiers use $\mathrm { d i m } ( z ) = 1 2 8$ and obtain $> 9 0 \%$ clean test accuracy (see appendix). The attacks are performed on the test images that all models initially correctly classify, leading to a test set of 1577 instances. Due to the page limit, we only present white-box zero-knowledge attacks here, and discuss further attacks in the appendix. + +White-box attacks (zero-knowledge, $\ell _ { \infty }$ ) We present the white-box $\ell _ { \infty }$ attack results in Figure 8, where the distortion strengths are selected as $\epsilon \in \lbrace 0 . 0 1 , 0 . 0 2 , 0 . 0 5 , 0 . 1 , 0 . 2 \rbrace$ . Again, generative classifiers are more robust than the discriminative ones, and GBZ is the most robust, much better than the others when $\epsilon \geq 0 . 0 5$ . BNN is significantly better than other discriminative VAE-based classifiers, presumably due to higher randomness. Detection results are less satisfactory: marginal/logit detection fail to detect attacks with $\epsilon = 0 . 1$ (which attain both high success rate and induce visually perceptible distortion). KL detection performs better, and interestingly, discriminative classifiers dominate in this metric. These results suggest that the $\ell _ { 2 }$ likelihood might not be best suited for modelling natural images (c.f. Larsen et al., 2016; van den Oord et al., 2016). Still, the minimum distortion required to fool generative classifiers are much higher than that for discriminative ones, indeed the visual distortion of the adversarial examples on generative classifiers are more significant. + +![](images/efeb93cf87777d23548d2d32db60dccd59abcfdfbb5946443a93be80204c004d.jpg) +Figure 8: Accuracy, detection rates and minimum $\ell _ { \mathrm { i n f } }$ perturbations against white-box zeroknowledge $\ell _ { \infty }$ attacks on the CIFAR plane-vs-frog dataset. The higher the better. The second from right most column visualises crafted adversarial examples on an image of a plane, with $\ell _ { \infty }$ distortion $\epsilon \in \{ 0 . 0 1 , 0 . 0 2 , 0 . 0 5 , 0 . 1 , 0 . 2 \}$ . + +![](images/0dd2d70f1cc4886126c26f92b994f6f2f74de3b1a925e6ac9f2d7859b1aa8cd2.jpg) +Figure 9: Accuracy and detection rates against white-box zero-knowledge CW attacks on the CIFAR plane-vs-frog dataset. The higher the better. + +White-box attack (zero-knowledge, $\ell _ { 2 }$ ) As the test set is relatively small, we directly perform CW attacks on the test data with $c \in \{ 0 . 1 , 1 , 1 0 , 1 0 0 , 1 0 0 0 \}$ . Results are visualised in Figure 9. The generative classifiers are significantly more robust than the others (with the best being GBZ), and the mean $\ell _ { 2 }$ distortions computed on successful attacks are also significantly higher. The TP rates are low for marginal and logit detection, which is reasonable as the crafted images are visually similar to the clean ones. Note that the distortion for the attacks on generative classifiers is perceptible. These results indicate that this CW attack is ineffective when attacking generative classifiers. + +4.3 FULL CIFAR-10: COMBINING DEEP BAYES AND DISCRIMINATIVE FEATURES + +The final experiment examines the robustness of CIFAR-10 multi-class classifiers, with the generative classifiers trained on discriminative visual features. To do this, we download a pretrained deep convolutional net3 with VGG16-like architecture (Simonyan & Zisserman, 2014), and use its feature representation $\phi ( { \pmb x } )$ as the input to the VAE-based classifiers: $p ( { \pmb y } | { \pmb x } ) = p ( { \pmb y } | \phi ( { \pmb x } ) )$ . The classifiers in test include GBZ, GBY and DBX. We use fully-connected neural networks for these classifiers, and select from VGG16 the $9 ^ { \mathrm { t h } }$ convolution layer (CONV9) and the first fully connected layer after convolution (FC1) as the feature layers to ensure $\sim 9 0 \%$ test accuracy (see appendix). + +Results on white-box zero-knowledge $\ell _ { \infty }$ attacks are visualised in Figure 10. Compared with the VGG16 baseline, we see clear improvements in robustness and detection for all VAE-based classifiers. In particular, the generative classifiers GBZ and GBY are overall better than DBX. More importantly, generative classifiers based on CONV9 features are significantly more robust than those based on FC1 features. In contrast, for DBX, which is discriminative, the robustness results are very similar, indicating that the level of feature representation has little effect. These results suggest that one can achieve both high clean accuracy and better robustness against adversaries by combining discriminatively learned visual features and generative classifiers. + +![](images/312124c69aaa2404a21fddcb8a35efb3d4d839cf4d73b5393739a6dacb03296e.jpg) +Figure 10: Accuracy and detection rates against white-box zero-knowledge $\ell _ { \infty }$ attacks on CIFAR10. The higher the better. Note that results for the DBX classifiers are almost identical. + +# 5 DISCUSSION + +We have proposed deep Bayes as a generative classifier that uses deep latent variable models to model the joint distribution of input-output pairs. We have given evidence, on multiple classification tasks, that generative classifiers are more robust to adversarial attacks than discriminative classifiers. Furthermore, the logit in generative classifiers has a well defined meaning and can be used to detect attacks, even when the classifier is fooled. + +Our results corroborate with the Bayesian neural network literature, in particular (Li & Gal, 2017; Feinman et al., 2017; Carlini & Wagner, 2017b), in showing that modelling unobserved variables are effective for defending against adversarial attacks4. Concurrent to us, Schott et al. (2018) also demonstrated the robustness of generative classifiers on MNIST, in which the logits are computed by a tempered version of the variational lower-bound. However, their approach requires thousands of random $_ z$ samples and tens of optimisation steps to approximate $\log p ( { \pmb x } | { \pmb y } )$ for every input-output pair $( { \pmb x } , { \pmb y } )$ , making it less scalable than our importance sampling technique to large datasets and big architectures. Indeed, we have scaled our approach to CIFAR-10, a natural image dataset, and the robustness results are consistent with those on MNIST. In addition, we have also shown that the structure of the graphical model has a significant impact on robustness: deep LVM-based generative classifiers generally outperform the (randomised) discriminative ones. + +While we have given strong evidence to suggest that generative classifiers are more robust to current adversarial attacks, we do not wish to claim that these models will be robust to all possible attacks. Aside from many recent attacks being designed specifically for discriminative neural networks, there is also evidence for the fragility of generative models; e.g. naive Bayes as a standard approach for spam filtering is well-known to be fragile (Dalvi et al., 2004; Huang et al., 2011), and very recently Tabacof et al. (2016); Kos et al. (2017); Creswell et al. (2017) also designed attacks for (unconditional) VAE-type models. However, generative classifiers can be made more robust too, to counter these weaknesses. Dalvi et al. (2004) have shown that generative classifiers can be made more secure if aware of the attack strategy, and Biggio et al. (2011; 2014) further improved naive Bayes’ robustness by modelling the conditional distribution of the adversarial inputs. These approaches are similar to the adversarial training of discriminative classifiers, and efficient ways for doing so with generative classifiers can be an interesting research direction. + +But even with this note of caution, we believe this work offers exciting avenues for future work. Using generative classifiers offers an interesting way to evaluate generative models and can drive improvements in their ability to tackle high-dimensional datasets, where traditionally generative classifiers have been less accurate than discriminative classifiers (Efron, 1975; Ng & Jordan, 2002). In addition, the combination of generative and discriminative models investigated in this paper is a compelling direction for future research. Overall, we believe that progress on generative classifiers can inspire better designs of attack, defence and detection techniques. + +# REFERENCES + +Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. Deep variational information bottleneck. In International Conference on Learning Representations, 2017. + +Moustafa Alzantot, Yash Sharma, Supriyo Chakraborty, and Mani Srivastava. Genattack: Practical black-box attacks with gradient-free optimization. arXiv preprint arXiv:1805.11090, 2018a. + +Moustafa Alzantot, Yash Sharma, Ahmed Elgohary, Bo-Jhang Ho, Mani Srivastava, and Kai-Wei Chang. Generating natural language adversarial examples. arXiv preprint arXiv:1804.07998, 2018b. + +Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. arXiv preprint arXiv:1802.00420, 2018. + +Battista Biggio, Giorgio Fumera, and Fabio Roli. Design of robust classifiers for adversarial environments. In Systems, Man, and Cybernetics (SMC), 2011 IEEE International Conference on, pp. 977–982. IEEE, 2011. + +Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Srndi ˇ c, Pavel Laskov, Gior- ´ gio Giacinto, and Fabio Roli. Evasion attacks against machine learning at test time. In Joint European conference on machine learning and knowledge discovery in databases, pp. 387–402. Springer, 2013. + +Battista Biggio, Giorgio Fumera, and Fabio Roli. Security evaluation of pattern classifiers under attack. IEEE transactions on knowledge and data engineering, 26(4):984–996, 2014. + +Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In Security and Privacy (SP), 2017 IEEE Symposium on, pp. 39–57. IEEE, 2017a. + +Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pp. 3–14. ACM, 2017b. + +Nicholas Carlini and David Wagner. Audio adversarial examples: Targeted attacks on speech-totext. arXiv preprint arXiv:1801.01944, 2018. + +P. Y. Chen, Y. Sharma, H. Zhang, J. Yi, and C. Hsieh. Ead: Elastic-net attacks to deep neural networks via adversarial examples. arXiv preprint arXiv:1709.0414, 2017a. + +P. Y. Chen, H. Zhang, Y. Sharma, J. Yi, and C. Hsieh. Zoo: Zeroth order optimization based blackbox attacks to deep neural networks without training substitute models. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pp. 15–26. ACM, 2017b. + +Thomas Cover and Peter Hart. Nearest neighbor pattern classification. IEEE transactions on information theory, 13(1):21–27, 1967. + +Antonia Creswell, Anil A Bharath, and Biswa Sengupta. Latentpoison-adversarial attacks on the latent space. arXiv preprint arXiv:1711.02879, 2017. + +Nilesh Dalvi, Pedro Domingos, Sumit Sanghai, Deepak Verma, et al. Adversarial classification. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 99–108. ACM, 2004. + +Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Xiaolin Hu, and Jun Zhu. Discovering adversarial examples with momentum. arXiv preprint arXiv:1710.06081, 2017. + +Bradley Efron. The efficiency of logistic regression compared to normal discriminant analysis. Journal of the American Statistical Association, 70(352):892–898, 1975. + +Reuben Feinman, Ryan R Curtin, Saurabh Shintre, and Andrew B Gardner. Detecting adversarial samples from artifacts. arXiv preprint arXiv:1703.00410, 2017. + +Ronald A Fisher. The use of multiple measurements in taxonomic problems. Annals of human genetics, 7(2):179–188, 1936. + +Justin Gilmer, Luke Metz, Fartash Faghri, Samuel S Schoenholz, Maithra Raghu, Martin Wattenberg, and Ian Goodfellow. Adversarial spheres. arXiv preprint arXiv:1801.02774, 2018. + +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. + +Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014. + +Ling Huang, Anthony D Joseph, Blaine Nelson, Benjamin IP Rubinstein, and JD Tygar. Adversarial machine learning. In Proceedings of the 4th ACM workshop on Security and artificial intelligence, pp. 43–58. ACM, 2011. + +Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. + +Jernej Kos, Ian Fischer, and Dawn Song. Adversarial examples for generative models. arXiv preprint arXiv:1702.06832, 2017. + +Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016. + +Alexey Kurakin, Ian Goodfellow, Samy Bengio, Yinpeng Dong, Fangzhou Liao, Ming Liang, Tianyu Pang, Jun Zhu, Xiaolin Hu, Cihang Xie, et al. Adversarial attacks and defences competition. arXiv preprint arXiv:1804.00097, 2018. + +Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. In International Conference on Machine Learning, pp. 1558–1566, 2016. + +Yingzhen Li and Yarin Gal. Dropout inference in bayesian neural networks with alpha-divergences. In International Conference on Machine Learning, pp. 2052–2061, 2017. + +Christos Louizos and Max Welling. Multiplicative normalizing flows for variational bayesian neural networks. arXiv preprint arXiv:1703.01961, 2017. + +Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJzIBfZAb. + +Andrew Y Ng and Michael I Jordan. On discriminative vs. generative classifiers: A comparison of logistic regression and naive bayes. In Advances in neural information processing systems, pp. 841–848, 2002. + +Nicolas Papernot and Patrick McDaniel. Deep k-nearest neighbors: Towards confident, interpretable and robust deep learning. arXiv preprint arXiv:1803.04765, 2018. + +Nicolas Papernot, Patrick McDaniel, and Ian Goodfellow. Transferability in machine learning: from phenomena to black-box attacks using adversarial samples. arXiv preprint arXiv:1605.07277, 2016a. + +Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016b. + +Nicolas Papernot, Nicholas Carlini, Ian Goodfellow, Reuben Feinman, Fartash Faghri, Alexander Matyasko, Karen Hambardzumyan, Yi-Lin Juang, Alexey Kurakin, Ryan Sheatsley, Abhibhav Garg, and Yen-Chen Lin. cleverhans v2.0.0: an adversarial machine learning library. arXiv preprint arXiv:1610.00768, 2017a. + +Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519. ACM, 2017b. + +Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pp. 1278–1286, 2014. + +Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017. + +Pouya Samangouei, Maya Kabkab, and Rama Chellappa. Defense-GAN: Protecting classifiers against adversarial attacks using generative models. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BkJ3ibb0-. + +Lukas Schott, Jonas Rauber, Matthias Bethge, and Wieland Brendel. Towards the first adversarially robust neural network model on mnist. arXiv preprint arXiv:1805.09190, 2018. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. + +Lewis Smith and Yarin Gal. Understanding measures of uncertainty for adversarial example detection. In Uncertainty in Artificial Intelligence, 2018. + +Yang Song, Taesup Kim, Sebastian Nowozin, Stefano Ermon, and Nate Kushman. Pixeldefend: Leveraging generative models to understand and defend against adversarial examples. International Conference on Learning Representations, 2018. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJUYGxbCW. + +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. + +Pedro Tabacof, Julia Tavares, and Eduardo Valle. Adversarial images for variational autoencoders. arXiv preprint arXiv:1612.00155, 2016. + +Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick Mc- \` Daniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017. + +Jonathan Uesato, Brendan O’Donoghue, Aaron van den Oord, and Pushmeet Kohli. Adversarial risk and the dangers of evaluating against weak attacks. arXiv preprint arXiv:1802.05666, 2018. + +Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In International Conference on Machine Learning, pp. 1747–1756, 2016. + +# A MODEL ARCHITECTURES + +MNIST experiments The VAEs are constructed with convolutional encoders and deconvolutional generators. More specifically, the encoder network for $q ( \boldsymbol { z } | \boldsymbol { x } , \boldsymbol { y } )$ is the same across all VAE-based classifiers. It starts with a 3-layer convolutional neural network with $5 \times 5$ filters and 64 channels, with a max-pooling operation after each convolution. Then, the convolutional network is followed by a MLP with 2 hidden layers, each with 500 units, to produce the mean and variance parameters of $q$ . The label $\textbf { { y } }$ is injected into the MLP at the first hidden layer, as a one hot encoding (i.e. for MNIST, the first hidden layer has $5 0 0 { + } 1 0 $ units). The latent dimension is $\mathrm { d i m } ( z ) = 6 4$ . + +The $p$ models’ architectures are the following: + +GFZ: For $p ( \pmb { y } | \pmb { z } )$ we use a MLP with 1 hidden layer composed of 500 units. For $p ( { \pmb x } | { \pmb y } , z )$ we used an MLP with 2 hidden layers, each with 500 units, and $4 \times 4 \times 6 4$ dimension output, followed by a 3-layer deconvolutional network with $5 \times 5$ kernel size, stride 2 and [64, 64, 1] channels. +GFY: We use an MLP with 1 hidden layer composed of 500 units for $p ( z | \boldsymbol { y } )$ , and the same architecture as GFZ for $p ( { \pmb x } | { \pmb y } , z )$ . +DFZ: We use almost the same deconvolutional network architecture for $p ( { \pmb x } | z )$ as GFZ’s $p ( { \pmb x } | { \pmb y } , z )$ network, except that the input is $_ z$ only. For $p ( \pmb { y } | \pmb { x } , z )$ we use almost the same architecture as $q ( \boldsymbol { z } | \boldsymbol { x } , \boldsymbol { y } )$ except that the injected input to the MLP is $_ z$ and the MLP output is the set of logit values for $\textbf { { y } }$ . +DFX: We use the same architecture as G3 for $p ( \pmb { y } | \pmb { x } , z )$ . The network for $p ( \boldsymbol { z } | \boldsymbol { x } )$ is almost identical except that there is no injected input to the MLP, and the network returns the mean and variance parameters for $q ( \boldsymbol { z } | \boldsymbol { x } )$ . +DBX: We use GFZ’s architecture for $p ( \pmb { y } | \pmb { z } )$ and DFX’s architecture for $p ( \boldsymbol { z } | \boldsymbol { x } )$ . +GBY: We use GFY’s architecture for $p ( z | \mathbf { \boldsymbol { y } } )$ and DFZ’s architecture for $p ( { \pmb x } | { \pmb z } )$ . +GBZ: We use GFZ’s architecture for $p ( \pmb { y } | \pmb { z } )$ and DFZ’s architecture for $p ( { \pmb x } | z )$ . + +The BNN has almost the same architecture as the encoder network $q$ , except that it uses $2 \mathbf { x }$ the hidden units/channels, and the last layer is 10 dimensions. Note that here we used dropout as it is convenient to implement, and we expect better approximate inference methods (such as stochastic gradient MCMC) to return better results for robustness and detection. + +CIFAR plane-vs-frog experiments The model architectures are almost the same as used in MNIST experiments, except that the hidden layer dimensions for the MLP layers are increased to 1000. For the encoder $q$ , the channels are increased to [64, 128, 256]. For the $p$ models, the deconvolutional networks have different channel values, [128, 64, 3], and the MLP before the deconvolution outputs a $4 \times 4 \times 2 5 6$ vector (before reshaping). The BNN has $2 \mathbf { x }$ the channels but still uses 1000 hidden units. + +CIFAR-10 experiments The pre-trained VGG16 network is downloaded from https:// github.com/geifmany/cifar-vgg, where the CONV9 and FC1 layers correspond to: + +CONV9: https://github.com/geifmany/cifar-vgg/blob/master/ cifar10vgg.py#L82 FC1: https://github.com/geifmany/cifar-vgg/blob/master/ cifar10vgg.py#L109 + +The VAE-based classifiers build fully connected networks on top of the extracted features, and use $\mathrm { d i m } ( z ) = 1 2 8$ for bottleneck. The encoder $q ( \boldsymbol { z } | \phi ( \boldsymbol { x } ) , \boldsymbol { y } )$ has the network architectures $[ \mathrm { d i m } ( \phi ( { \pmb x } ) ) $ $+ \dim ( y )$ , 1000, 1000, $\mathrm { d i m } ( z ) \times 2 ]$ , and we use the same encoder architecture across all classifiers. The decoder architectures are as follows: + +DBX: We use an MLP of layers $[ \dim ( z ) , ~ 1 0 0 0 , ~ \dim ( y ) ]$ for $p ( \pmb { y } | \pmb { z } )$ and an MLP of layers $[ \mathrm { d i m } ( \phi ( { \pmb x } ) )$ , 1000, 1000, $\mathrm { d i m } ( z ) \times 2 ]$ for $p ( \pmb { z } | \phi ( \pmb { x } ) )$ . + +GBZ: We use an MLP of layers $[ \mathrm { d i m } ( z )$ , 1000, 1000, $\dim ( y ) ]$ for $p ( \pmb { y } | \pmb { z } )$ and an MLP of layers [dim(z), 1000, 1000, $\mathrm { d i m } ( \phi ( { \pmb x } ) ) ]$ for $p ( \phi ( { \pmb x } ) | z )$ . + +GBY: We use an MLP of layers $[ \mathrm { d i m } ( y )$ , 1000, $\mathrm { d i m } ( z ) \times 2 ]$ for $p ( z | \boldsymbol { y } )$ and GBZ’s architecture for $p ( \phi ( { \pmb x } ) | z )$ . + +# B ATTACK SETTINGS + +We use the Cleverhans package to perform attacks. We use the default hyper-parameters, if not specifically stated. + +PGD: We perform the attack for 40 iterations with step-size 0.01. + +MIM: We perform the attack for 40 iterations with step-size 0.01 and decay factor 1.0. + +CW- $\ell _ { 2 }$ : We use learning rate 0.01 and confidence 0, and we optimise the loss for 1000 iterations. + +SPSA: We use almost the same hyper-parameters as in Uesato et al. (2018) except for the number of samples for gradient estimates. In detail, we perform the attack for 100 iterations with perturbation size 0.01, Adam learning rate 0.01, stopping threshold -5.0 and 2000 samples for each gradient estimate. + +# B.1 JACOBIAN-BASED DATASET AUGMENTATION + +The black-box distillation attack is based on Papernot et al. (2017b), which trains a substitute CNN using Jacobian-based dataset augmentation. Assume $\boldsymbol { y } = \boldsymbol { F } ( \boldsymbol { x } )$ is the output one-hot vector of the victim, and ${ \pmb p } ( { \pmb x } )$ is the probability vector output of the substitute model, then at the $t ^ { \mathrm { { t h } } }$ outerloop, we train the substitute CNN on dataset $\mathcal { D } _ { t } \overset { \cdot } { = } \{ ( \boldsymbol { x } _ { n } , \boldsymbol { y } _ { n } ) \}$ with queried ${ \bf { { y } } } _ { n }$ for 10 epochs, and augment the dataset by + +$$ +\mathcal { D } _ { t + 1 } = \mathcal { D } _ { t } \cup \big \{ \big ( \hat { x } , F ( \hat { x } ) \big ) \mid \hat { x } = x + \lambda \nabla _ { x } p ( x ) ^ { \mathrm { T } } y , \big ( x , y \big ) \in \mathcal { D } _ { t } \big \} . +$$ + +We initialise $\mathcal { D } _ { 1 }$ with $2 0 0 \times 1 0$ datapoints from the MNIST test set, select $\lambda = 0 . 1$ , and run the algorithm for 6 outer-loops. On MNIST, this results in 64, 000 queried inputs, and $\sim 9 6 \%$ accuracy of the substitute model on test data. On CIFAR binary classification, we use $2 0 0 \times 2$ datapoints for the inital query set $\mathcal { D } _ { 1 }$ , resulting in 12, 800 queries in total. The substitutes achieved almost the same accuracy as their corresponding victim models on clean test datapoints. + +# C FURTHER EXPERIMENTS + +# C.1 FURTHER EXPERIMENTS ON CIFAR BINARY CLASSIFICATION + +White-box attack (perfect-knowledge, $\ell _ { \infty }$ ) Figure C.1 shows the perfect knowledge attack on the CIFAR binary classification task. Again we see that although the attack is effective for the detection schemes, it comes with the price of decreased mis-classification rates. Interestingly GBY seems to be robust to this attack, where the accuracies on the crafted adversarial examples increase. + +Sanity checks on gradient masking We conducted the same sets of transferred $\ell _ { \infty }$ attack experiments, and presents the results in Figure C.2 and Table C.1. Again that these crafted attacks achieve $\sim 1 0 0 \%$ success rates on fooling the substitute models when $\epsilon \geq 0 . 1$ . Similar to the MNIST experiments, these adversarial examples do not transfer very well to the generative classifiers, and for a fixed $\epsilon$ setting, the white-box attacks achieve significantly higher success rates than their grey-/black-box counterparts (with the gap at $\epsilon \leq 0 . 1$ around $3 0 \%$ ). Furthermore, the minimum perturbation obtained by grey-/black-box attacks are significantly higher than those obtained by white-box attacks. For detection, the detection rates are relatively low at $\epsilon \leq 0 . 1$ (where the classifiers achieved high accuracy). But the detection rates increase significantly for $\epsilon = 0 . 2$ , where the victim accuracies also drop. + +All these results suggest that the robustness of generative classifiers is unlikely to be caused by gradient masking. Also most of the successfully transferred adversarial images are off the generative classifier’s manifold (as a proxy to the data manifold). + +![](images/5152312abaec5bc13db7e41eea936e83e591f26cf23328722a6ed5def0474647.jpg) +Figure C.1: Accuracy and detection rates of DBX, GBY, and GBZ against PGD-based perfectknowledge attack $\epsilon = 0 . 1$ ) on CIFAR binary task. The solid area denotes accuracy and the hatched area denotes detection rate with each considered detector. Zero knowledge attacks are labelled ’- ZK’, other attack labels are the same as for the MNIST plot (Figure 5). + +![](images/efd469fdcaf929c8a6615157ea860f31d2e71ae5eb8fbeb99dfc0c6d149f3ee1.jpg) +Figure C.2: Accuracy and detection rates against distillation-based attacks on CIFAR plane-vs-frog binary classification. The higher the better. We only present generative classifiers’ results here, for full results see appendix E. + +Table C.1: Mean minimum $\ell _ { \infty }$ perturbation (in red, computed on $\epsilon \in \{ 0 . 0 1 , 0 . 0 2 , 0 . 0 5 , 0 . 1 , 0 . 2 \} )$ ) and victim accuracy (in blue, for $\epsilon \leq 0 . 1 $ ) for $\ell _ { \infty }$ attacks on CIFAR plane-vs-frog binary classification. We manually assign the min. perturbation $\epsilon = 0 . 3$ to inputs that all attacks failed to find adversarial perturbations. + +
AttackGFZGBZGFYGBY
PGD(white-box)0.11 / 21.81%0.20 / 65.63%0.11 / 25.81%0.11 / 25.24%
MIM(white-box)0.09 / 15.22%0.13 /37.60%0.10 /16.4%90.09 / 14.39%
PGD(grey-box)0.15 / 50.48%0.23 / 77.30%0.16 / 54.66%0.17 / 57.96%
MIM(grey-box)0.15 /47.62%0.21 / 75.71%0.15 / 51.11%0.16 / 53.84%
PGD(black-box)0.19 / 68.36%0.23 / 79.45%0.20 / 70.13%0.19 / 67.98%
MIM(black-box)0.18 / 66.39%0.23 / 78.38%0.19 / 68.42%0.19 / 66.52%
+ +Table C.2: Accuracy and detection rates against black-box SPSA attack $\epsilon = 0 . 0 5 )$ on CIFAR plane-vs-frog, with a comparision to white-box PGD. The higher the better. + +
GFZGBZGBYGFYDFXDBXDFZ
PGD victim acc67.7%83.9%67.9%67.3%0.3%4.2%0.4%
SPSA victim acc96.4%95.2%96.4%96.3%0.4%87.5%5.1%
SPSA TP logit10.0%17.1%15.5%10.0%N/AN/A4.5%
+ +![](images/c2212cb826926ce9d453f97e43195c2f01d46651d793cf484348cc807383b02c.jpg) +Figure C.3: Results on cross-model transfer attacks on the CIFAR plane-vs-frog dataset. The horizontal axis corresponds to the source victim, and the vertical axis corresponds to the target victim. The higher (lighter) the better. + +SPSA (evolutionary strategies) Similarly we perform the SPSA attack (Uesato et al., 2018) on the CIFAR binary classification task. The results for $\epsilon = 0 . 0 5$ are presented in Table C.2, with a comparison to the white-box PGD attacks. Again we see that SPSA fails to attack generative classifiers, and the bottleneck discriminative classifier DBX is significantly more robust than the discriminative ones with fully-connected graphical models. + +Cross-model attack transferability Finally, we present the CIFAR cross-model attack transferability results in Figure C.3, and here we select $\epsilon = 0 . 1$ instead. Again, transferred attacks are less effective across the victim models. However, the TP rates for logit detection are significantly lower than in the MNIST case (also see Figure 8). Nevertheless, the detection rates for the “discriminative to generative” transfer are considerably higher. Combined with the accuracy results, we see that discriminative models as substitutes are ineffective in the transferred attack setting. + +# C.2 QUANTIFYING THE EFFECT OF THE BOTTLENECK LAYER + +We see from the main text that classifiers with bottleneck structure may be preferred for resisting adversarial examples. To quantify this bottleneck effect, we train on MNIST models DBX, GBZ and GBY with $_ { z }$ dimensions in $\{ \dot { 1 } 6 , 3 2 , 6 4 , 1 2 8 \}$ (the main text experiments use $\dim ( z ) = 6 4 $ ).The clean test accuracy is shown in Table C.3, showing that all models in test perform reasonably well. + +Table C.3: Clean test accuracy on MNIST classification (with varied bottleneck layer sizes). + +
dim(z) = 16dim(z) = 32dim(z)= 64dim(z)=128
DBX99.11%99.01%98.98%98.91%
GBZ97.11%97.08%97.45%96.62%
GBY98.82%98.95%98.72%98.75%
+ +We repeat the same white-box zero-knowledge $\ell _ { \infty }$ attack experiments as done in the main text, where results are presented in Figure C.4 and Tables E.25, E.26 and E.27. It is clear that for discriminative classifiers, DBX, the models become less robust as the bottleneck dimension $\mathrm { d i m } ( z )$ increases. Interestingly DBX classifiers seem to be very robust against FGSM attacks, which agrees with the results in Alemi et al. (2017). For the generative ones, we also observe similar trends (although much less significant) of decreased robustness for GBY classifiers, and for GBZ the trend is unclear, presumably due to local optimum issues in optimisation. In summary, GBZ classifiers are generally more robust compared to GBY classifiers. More importantly, when the accuracy of generative classifiers on adversarial images decreases to zero, the detection rates with marginal/logit detection increases to $1 0 0 \%$ . This clearly shows that the three attacks tested here cannot fool the generative classifiers without being detected. + +![](images/ac97b61ab1e7245d921f06ec5438eb1e3ec5e1ff1b11e353e9a44c52679e086b.jpg) +Figure C.4: Accuracy and detection rates against white-box zero-knowledge $\ell _ { \infty }$ attacks on MNIST, with varied bottleneck layer sizes. + +Table D.1: Clean test accuracy on CIFAR plane-vs-frog classification. + +
BNNGFZGFYDFZDFXDBXGBZGBY
97.00%91.60%91.20%94.85%95.65%96.00%89.35%90.65
+ +# D ADDITIONAL RESULTS + +We visualise in Figure D.1 the crafted adversarial images using white-box CW attack. +We present in Table D.1 the clean accuracy on CIFAR plane-vs-frog test images (2000 in total). +We present in Table D.2 the clean accuracy on CIFAR-10 test images. + +Table D.2: Clean test accuracy on CIFAR-10 classification. + +
VGG16GBZ-FC1GBY-FC1DBX-FC1GBZ-CONV9GBY-CONV9DBX-CONV9
93.59%92.55%93.21%93.49%91.76%88.33%93.21%
+ +![](images/dbcf0906a736b6a88bfdb52b23677d578009e609628af44f312d5c13c3ee6558.jpg) +Figure D.1: Visualising the clean inputs of MNIST and the CW adversarial examples crafted on all the classifiers. + +# E RESULTS IN TABLES + +We present in tables the full results of the experiments. +See Tables E.1 to E.9 for the white-box attacks. +See Tables E.10 to E.15 for the grey-box attacks. +See Tables E.16 to E.21 for the black-box attacks. +See Tables E.22 to E.24 for CIFAR-10 results with VGG-based classifiers. +See Tables E.25 to E.27 for bottleneck effect quantification results. + +Table E. 1 : FGSM white-box zero-knowledge attack results on MNIST. + +
acc.(adv)TP marginalTP logitTP KL
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
BNN92.467.840.526.220.4N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A93.094.295.495.596.5
GFZ94.274.538.912.95.743.679.8100.0100.0100.056.489.699.9100.0100.089.291.792.292.592.2
GBZ92.580.362.042.427.237.081.7100.0100.0100.057.693.5100.0100.0100.091.690.990.391.191.5
GFY94.374.846.521.710.553.192.6100.0100.0100.066.297.9100.0100.0100.090.893.193.894.294.2
GBY93.676.447.522.310.741.984.5100.0100.0100.057.792.5100.0100.0100.089.392.792.892.992.9
DFX70.114.81.00.40.6N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A93.693.893.893.594.3
DBX91.677.858.144.536.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.693.695.296.397.0
DFZ75.219.02.41.11.012.650.6100.0100.0100.026.965.7100.0100.0100.093.195.194.594.994.8
+ +Table E.2: PGD white-box zero-knowledge attack results on MNIST. + +
acc.(adv)TP marginalTP logitTP KL
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
BNN83.212.00.50.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.192.188.720.40.2
GFZ86.737.77.71.20.343.271.891.499.4100.055.877.194.899.6100.090.392.190.990.489.7
GBZ85.157.432.519.311.633.750.384.499.7100.052.266.391.599.8100.090.091.591.591.791.8
GFY79.727.45.61.20.358.187.998.0100.0100.068.792.299.3100.0100.092.692.590.790.785.4
GBY86.735.99.01.70.445.376.194.699.7100.056.979.395.699.9100.090.192.191.691.791.4
DFX47.60.70.00.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.889.813.331.442.8
DBX DFZ58.0 49.618.36.01.30.2N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.794.094.193.784.8
1.00.00.00.011.844.394.1100.0100.025.957.694.599.9100.093.989.812.122.928.0
+ +Table E.3: MIM white-box zero-knowledge attack results on MNIST. + +
acc.(adv)TP marginalTP KL
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
BNN82.07.20.10.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.291.172.064.57.1
GFZ87.040.49.01.21.243.583.898.499.499.457.689.398.699.299.291.592.392.090.690.6
GBZ79.627.45.61.50.536.186.3100.0100.0100.053.593.199.9100.0100.091.391.491.992.292.7
GFY80.830.16.81.41.456.093.799.8100.0100.068.196.699.9100.0100.090.992.492.091.691.6
GBY84.922.91.50.10.047.491.299.9100.0100.059.892.899.9100.0100.091.492.191.286.829.0
DFX48.40.80.00.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A93.289.69.217.517.5
DBX66.728.719.717.217.2N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A93.594.394.694.794.7
DFZ50.51.20.00.00.011.950.799.4100.0100.026.463.299.0100.0100.094.389.811.517.317.3
+ +Table E.4: Perfect knowledge attacks on MNIST. This is done using the PGD attack with $\epsilon = 0 . 2$ . ‘ZK’ stands for zero knowledge, ‘PK0’ where you have knowledge of the $K$ samples but not of the detection system. ‘PKM’ ‘PKL’ and ‘PKK’ are attacks where you have knowledge of the K samples and of the marginal, logit and KL detection mechanisms respectively. + +
ZKPKK
acc.TP marg.TP logitTP KLacc.TP marg.TP logitTP KLacc.TP marg.TP logitTP KLacc.TP marg.TP logitTP KLacc.TP marg.TP logitTP KL
DBX18.3N/AN/A9417N/AN/A93.1N/AN/AN/AN/AN/AN/AN/AN/A35.9N/AN/A93.9
GBZ57.450.366.391.535.582.290.791.447.936.567.491.344.650.569.991.04573.084.891.5
GBY35.976.179.392.12290.891.992.143.847.061.991.152.056.466.990.632.889.291.893.3
+ +Table E.5: FGSM white-box zero-knowledge attack results on CIFAR plane-vs-frog binary classification. + +
acc. (adv)TP marginal
E0.010.020.050.100.200.010.020.050.100.20 0.010.020.050.100.200.010.020.050.100.20
BNN98.293.258.514.56.3N/AN/AN/AN/A N/AN/AN/AN/AN/AN/A58.655.165.554.058.5
GFZ97.194.781.856.431.411.410.15.9 17.499.311.410.46.817.299.358.640.135.941.050.6
GBZ95.193.587.174.962.026.018.615.5 38.699.626.320.319.141.999.635.541.547.043.745.6
GFY96.594.280.756.732.09.69.26.9 18.899.017.613.18.120.899.146.643.736.139.549.3
GBY96.192.982.060.536.317.215.18.1 28.599.220.218.110.031.199.249.748.039.238.747.3
DFX83.842.20.70.00.0N/AN/AN/A N/AN/AN/AN/AN/AN/AN/A63.366.648.497.7100.0
DBX90.978.650.731.718.3N/AN/AN/A N/AN/AN/AN/AN/AN/AN/A50.758.756.859.757.2
DFZ83.952.12.90.00.06.63.82.23.9 60.66.94.22.43.360.457.562.354.866.799.8
+ +Table E.6: PGD white-box zero-knowledge atack results on CIFAR plane-vs-frog binary classification. + +
acc. (adv)TP marginalTP logitTP KL
E0.010.020.050.100.200.010.020.050.100.200.010.020.050.100.200.010.020.050.100.20
BNN97.986.719.71.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A41.759.455.768.498.9
GFZ98.093.967.721.73.53.36.65.67.832.95.09.56.08.233.037.545.134.544.057.7
GBZ94.693.783.967.452.819.817.912.814.343.122.819.517.417.044.332.139.340.237.133.2
GFY98.495.067.925.84.14.26.76.47.835.73.18.27.67.833.831.243.632.939.653.3
GBY96.492.967.325.76.911.18.47.911.641.413.111.59.212.240.343.043.033.639.152.2
DFX82.735.70.30.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A64.164.769.6100.0100.0
DBX83.334.64.20.70.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A59.859.565.178.793.4
DFZ82.436.90.40.00.04.93.85.112.391.16.54.15.512.391.356.360.354.799.7100.0
+ +Table E.7 : MIM white-box zero-knowledge attack results on CIFAR plane-vs-frog binary classification. + +
acc. (adv)TP marginalTP logitTP KL
E0.010.020.050.100.200.010.020.050.100.200.010.020.050.100.200.010.020.050.100.20
BNN96.984.618.70.90.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A35.954.756.362.478.8
GFZ96.991.558.115.21.96.56.26.410.686.110.08.36.611.384.531.039.032.147.277.1
GBZ92.589.471.540.417.915.013.211.024.095.916.414.812.825.196.042.537.531.037.455.0
GFY97.692.359.516.52.35.66.96.313.388.15.76.26.813.887.623.841.433.843.974.6
GBY95.188.856.514.61.315.19.58.619.297.315.310.79.918.597.051.143.231.746.787.6
DFX82.535.20.30.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A65.567.169.6100.0100.0
DBX82.538.86.11.20.1N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A54.660.061.578.888.5
DFZ81.536.10.40.00.05.43.95.013.496.96.24.15.513.896.861.158.555.399.9100.0
+ +Table E.8: CW white-box zero-knowledge atack results on CIFAR plane-vs-frog binary classification. + +
acc. (adv)TP marginalTP logitTP KL
E0.101.0010.00100.001000.000.101.0010.001100.001000.000.101.0010.00100.001000.000.101.0010.00100.001000.00
BNN93.766.237.332.347.6N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A60.980.382.272.080.0
GFZ99.595.676.577.978.30.04.52.63.03.40.04.63.03.64.229.230.425.627.129.0
GBZ96.093.688.988.789.016.711.57.87.77.918.913.79.39.19.441.151.440.434.732.0
GFY99.895.978.880.080.50.06.64.14.75.10.06.64.84.95.475.037.326.026.431.1
GBY97.593.176.777.378.015.814.66.07.17.318.913.96.07.07.942.634.327.231.629.0
DFX82.644.234.36.10.6N/AN/AN/AN/AN/AN/AN/A N/AN/AN/A100.0100.0100.082.595.0
DBX96.572.226.36.316.2N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A61.679.485.262.267.9
DFZ94.572.329.96.317.97.35.84.34.14.214.16.95.04.44.482.697.397.183.080.2
+ +Table E.9: Perfect knowledge attacks on CIFAR binary task. This is done using the PGD attack with $\epsilon = 0 . 1$ . ‘ZK’ stands for zero knowledge, ‘PK0’ where you have knowledge of the $K$ samples but not of the detection system. ‘PKM’ , ‘PKL’ , and ‘PKK’ are attacks where you have knowledge of the K samples and of the marginal, logit and KL detection mechanisms respectively. + +
PKK
acc.TP marg.TP logitTP KLacc.TP marg. N/ATP logitTP KLacc.TP marg.TP logitTP KLacc.TP marg. N/ATP logitTP KLacc.TP marg.TP logitTP KL
DBX0.7N/AN/A78.70.7N/A82.5N/AN/AN/AN/AN/AN/AN/A0.6N/AN/A 27.682.6
GBZ67.414.317.037.15740.645.14958.49.618.546.958.51.87.847.859.925.542.4
GBY25.711.612.239.128.522.022.64929.55.67.645.929.20.81.845.427.915.615.945
+ +Table E. 1 0: Grey-box PGD attack results on MNIST. + +
substitute accvictimaccTP logit
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
GFZ86.714.30.00.00.096.683.351.326.817.249.573.899.7100.0100.0
GBZ81.29.10.00.00.093.580.155.335.025.246.773.399.6100.0100.0
GFY84.86.40.00.00.096.782.355.233.524.058.788.8100.0100.0100.0
GBY86.715.00.00.00.095.881.651.027.518.150.178.599.9100.0100.0
DFX74.25.20.50.00.091.757.719.64.31.4N/AN/AN/AN/AN/A
DBX80.65.10.00.00.093.259.222.510.98.2N/AN/AN/AN/AN/A
DFZ69.63.40.30.00.091.957.221.46.32.633.655.191.7100.0100.0
+ +Table E. 1 1 : Grey-box MIM attack results on MNIST. + +
substitute accvictim accTP logit
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
GFZ87.216.10.00.00.096.582.442.814.23.750.682.5100.0100.0100.0
GBZ81.89.10.00.00.093.378.645.317.05.246.281.7100.0100.0100.0
GFY85.26.90.00.00.096.680.848.018.97.459.896.0100.0100.0100.0
GBY87.015.90.00.00.095.779.941.813.04.051.487.1100.0100.0100.0
DFX76.512.33.62.12.191.556.122.29.99.9N/AN/AN/AN/AN/A
DBX85.119.90.60.10.193.457.014.16.36.3N/AN/AN/AN/AN/A
DFZ70.93.20.00.00.091.854.616.42.70.334.563.898.9100.0100.0
+ +Table E.12: Grey-box CW attack results on MNIST. + +
substitute accvictim accTP logit
E0.101.0010.00100.001000.000.101.0010.00100.001000.000.101.0010.00100.001000.00
GFZ98.44.60.00.00.098.896.996.093.490.253.444.241.640.643.7
GBZ98.463.20.00.00.097.495.492.988.684.545.939.733.031.238.6
GFY98.10.90.00.00.099.097.697.095.794.061.055.249.249.552.7
GBY98.35.30.00.00.098.796.896.093.891.254.241.537.638.743.6
DFX85.10.00.00.00.097.693.391.290.489.8N/AN/AN/AN/AN/A
DBX97.346.00.40.00.098.793.988.485.576.3N/AN/AN/AN/AN/A
DFZ80.50.00.00.00.097.294.692.391.591.232.928.628.136.544.5
+ +Table E. 1 3 : Grey-box PGD attack results on CIFAR plane-vs-frog binary classification. + +
substitute accvictim accTP logit
E0.010.020.050.100.200.010.020.050.100.200.010.020.050.100.20
GFZ96.788.141.74.50.197.094.984.048.38.38.411.26.17.549.8
GBZ92.983.137.85.50.095.394.891.883.165.615.512.810.919.979.8
GFY96.988.133.73.30.196.995.985.354.212.72.62.05.08.561.2
GBY95.285.632.42.80.196.895.386.459.818.521.814.310.512.575.2
DFX95.780.810.10.20.099.196.779.428.30.9N/AN/AN/AN/AN/A
DBX95.780.530.51.70.099.598.291.165.121.8N/AN/AN/AN/AN/A
DFZ96.581.910.50.30.099.196.976.926.21.34.516.56.18.559.6
+ +Table E.14: Grey-box MIM attck results on CIFAR plane-vs-frog binary classification. + +
substitute accvictim accTP logit
E0.010.020.050.100.200.010.020.050.100.200.010.020.050.100.20
GFZ96.387.942.14.70.197.194.883.044.84.98.711.15.88.575.1
GBZ92.982.536.94.90.095.594.791.481.749.514.812.613.921.997.8
GFY96.887.934.13.50.196.995.684.649.16.92.62.06.710.381.1
GBY95.185.532.02.60.196.895.585.756.210.921.814.89.213.497.6
DFX95.580.510.50.20.099.196.577.324.00.2N/AN/AN/AN/AN/A
DBX95.681.134.52.20.099.598.389.358.99.9N/AN/AN/AN/AN/A
DFZ96.381.510.70.50.099.196.974.921.90.34.516.66.49.980.2
+ +Table E.15: Grey-box CW attack results on CIFAR plane-vs-frog binary classification. + +
substitute accvictim accTP logit
E0.101.0010.00100.001000.000.101.0010.00100.001000.000.101.0010.00100.001000.00
GFZ98.761.90.00.00.098.695.894.393.893.211.710.210.99.98.5
GBZ96.369.83.30.00.095.995.794.794.794.513.512.712.313.714.4
GFY98.454.40.00.00.098.196.195.395.194.30.02.23.74.67.6
GBY97.652.92.20.00.097.795.694.594.393.725.815.714.213.718.0
DFX64.40.00.00.00.098.597.297.196.795.5N/AN/AN/AN/AN/A
DBX91.356.20.30.00.099.799.099.098.998.1N/AN/AN/AN/AN/A
DFZ80.30.00.00.00.099.297.997.597.395.40.015.714.68.86.1
+ +Table E. 1 6 : Black-box PGD attack results on MNIST. + +
substitute accvictimaccTP logit
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
GFZ44.20.70.00.00.097.388.462.733.821.848.761.092.399.8100.0
GBZ7.40.00.00.00.094.887.170.752.941.351.068.697.7100.0100.0
GFY49.40.80.00.00.097.486.558.131.921.052.570.897.499.8100.0
GBY21.70.00.00.00.096.989.370.049.737.851.270.898.2100.0100.0
DFX49.21.30.00.00.091.452.113.92.20.7N/AN/AN/AN/AN/A
DBX43.10.70.00.00.095.067.026.29.76.5N/AN/AN/AN/AN/A
DFZ53.81.70.00.00.092.956.315.23.41.534.752.894.099.9100.0
+ +Table E. 1 7 : Black-box MIM attack results on MNIST. + +
substitute accvictimaccTP logit
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
GFZ45.52.80.00.00.097.286.650.317.017.051.168.097.599.599.5
GBZ8.40.00.00.00.094.785.963.535.217.151.274.499.0100.0100.0
GFY53.12.50.30.10.197.283.749.220.120.155.180.699.099.999.9
GBY24.50.00.00.00.096.888.362.831.713.349.377.699.9100.0100.0
DFX51.32.30.10.00.091.451.713.31.91.9N/AN/AN/AN/AN/A
DBX47.81.60.10.00.094.867.023.27.67.6N/AN/AN/AN/AN/A
DFZ56.12.90.10.00.092.756.013.12.82.835.259.997.6100.0100.0
+ +Table E.18: Black-box CW attack results on MNIST. + +
substitute accvictim acc
E0.101.0010.00100.001000.000.101.0010.00 100.001000.000.101.0010.00100.001000.00
GFZ65.20.30.00.00.098.898.797.4 94.392.052.3 50.839.644.755.3
GBZ76.60.40.00.00.097.397.295.9 92.790.445.746.141.540.345.7
GFY88.43.80.00.00.099.098.998.0 94.892.060.059.251.947.657.2
GBY76.01.30.00.00.098.798.697.3 95.193.553.452.241.839.746.7
DFX82.40.00.00.00.098.896.8 92.486.284.9N/AN/AN/AN/AN/A
DBX82.50.60.00.00.098.998.495.5 85.283.1N/AN/AN/AN/AN/A
DFZ86.50.20.00.00.098.894.589.3 81.579.342.925.522.327.738.2
+ +Table E. 1 9 : Black-box PGD attack results on CIFAR plane-vs-frog binary classification. + +
substitute accvictim accTP logit
E0.010.020.050.100.200.010.02 0.050.100.200.010.020.050.100.20
GFZ95.589.945.56.80.197.695.688.768.829.76.26.76.010.871.8
GBZ92.084.133.83.50.095.694.992.785.065.916.714.612.817.976.8
GFY95.389.138.72.50.097.396.690.072.935.50.02.36.810.472.3
GBY91.880.529.76.10.297.295.990.270.830.321.816.49.613.677.3
DFX89.174.519.10.90.099.798.792.664.89.9N/AN/AN/AN/AN/A
DBX85.576.442.54.50.099.699.094.877.524.5N/AN/AN/AN/AN/A
DFZ85.573.521.11.50.099.599.293.870.115.10.05.08.915.985.1
+ +Table E.2O: Black-box MIM attack results on CIFAR plane-vs-frog binary classification. + +
substitute accvictim accTP logit
E0.010.020.050.100.200.010.020.050.100.200.010.020.050.100.20
GFZ95.589.746.47.70.297.595.788.566.520.56.26.75.912.782.7
GBZ91.884.033.13.40.095.694.992.385.160.716.715.514.221.697.9
GFY95.388.940.53.10.097.396.789.570.631.90.02.47.612.588.0
GBY91.780.229.55.90.197.395.989.669.026.122.216.19.714.095.9
DFX89.074.519.40.90.099.698.792.163.010.9N/AN/AN/AN/AN/A
DBX85.576.342.74.50.099.699.095.176.527.2N/AN/AN/AN/AN/A
DFZ85.373.421.41.60.099.699.192.967.714.90.04.57.514.291.9
+ +Table E.21: Black-box CW attack results on CIFAR plane-vs-frog binary clasification. + +
substitute accvictim acc
E0.101.0010.00100.001000.000.101.0010.00 100.001000.000.101.00TP logit 10.00100.001000.00
GFZ96.341.50.50.00.098.794.793.4 93.392.313.3 8.67.77.78.9
GBZ94.973.31.40.00.095.995.3 94.694.594.513.511.811.813.213.1
GFY96.462.01.30.00.098.196.7 94.894.794.10.02.86.56.16.8
GBY93.533.61.70.00.097.795.9 95.495.495.025.816.415.918.619.8
DFX90.310.90.00.00.099.998.8 98.598.597.9N/AN/AN/AN/AN/A
DBX87.231.80.00.00.099.997.1 94.593.994.7N/AN/AN/AN/AN/A
DFZ84.922.70.00.00.099.999.0 98.398.397.80.03.82.32.311.0
+ +Table E.22: FGSM white-box zero-knowledge attack results on CIFAR- 1 0. + +
acc. (adv) 0.020.050.100.20TP marginalTP logitTP KL
E0.010.010.020.050.100.200.010.020.050.100.200.010.020.050.100.20
VGG1644.525.816.611.910.1N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A95.195.797.097.597.1
GBZ-FC163.749.734.318.912.760.062.480.690.994.163.765.080.695.098.490.190.892.392.692.6
GBY-FC164.950.036.119.511.352.259.080.490.192.554.661.980.395.698.490.791.392.192.490.3
DBX-FC157.345.731.816.310.8N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.893.294.094.392.8
GBZ-CONV981.674.158.548.945.813.717.028.476.090.218.320.631.764.371.691.791.591.793.386.4
GBY-CONV975.866.039.722.517.514.018.229.474.488.917.720.825.855.268.989.689.990.089.189.2
DBX-CONV959.045.731.817.811.3N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A93.794.194.995.293.7
+ +Table E.23: PGD white-box zero-knowledge attack results on CIFAR-10 + +
acc. (adv)TP marginalTP logitTP KL
E0.010.020.050.100.200.010.020.050.100.200.010.020.050.100.200.010.020.050.100.20
VGG1618.80.60.00.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A93.991.867.469.966.4
GBZ-FC137.76.10.10.00.030.722.276.092.094.133.524.977.091.790.290.893.797.398.595.9
GBY-FC131.28.52.61.50.632.020.382.395.197.636.629.584.193.790.490.394.197.797.396.9
DBX-FC123.41.70.00.00.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A91.991.05.67.45.9
GBZ-CONV961.138.324.210.22.319.260.396.798.999.620.160.396.898.398.790.393.197.798.799.6
GBY-CONV966.526.63.20.40.017.055.695.799.299.617.852.795.398.697.689.691.898.799.496.9
DBX-CONV924.03.00.30.10.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A91.393.199.399.699.2
+ +Table E.24: MIM white-box zero-knowledge attack results on CIFAR-10. + +
acc. (adv)TP marginalTP logit
E0.010.02(0.050.100.200.010.020.050.100.200.010.020.050.100.200.010.020.050.10 0.20
VGG1613.10.40.00.00.0N/AN/AN/AN/A N/AN/AN/AN/AN/AN/A92.292.472.377.179.0
GBZ-FC124.52.70.10.00.034.840.988.595.896.0 38.844.090.496.496.691.395.095.797.996.8
GBY-FC133.019.611.87.24.929.138.795.799.199.3 38.449.296.399.399.490.795.097.897.997.9
DBX-FC117.30.90.00.00.0N/AN/AN/AN/A N/AN/AN/AN/AN/AN/A91.189.69.614.516.0
GBZ-CONV957.643.529.124.122.627.478.599.499.6 99.729.178.399.699.799.890.294.497.598.098.2
GBY-CONV939.118.14.31.91.525.670.498.699.699.8 28.271.198.699.799.889.694.599.499.899.7
DBX-CONV919.23.20.50.40.4N/AN/AN/AN/AN/A N/AN/AN/AN/AN/A92.196.799.9100.0100.0
+ +Table E.25 : FGSM white-box zero-knowledge attack results on MNIST (with varied bottleneck layer sizes) . + +
acc.(adv)TP marginalTP logitTP KL
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
DBX-1692.685.676.464.752.3N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A90.392.492.392.794.2
DBX-3292.684.471.157.246.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.292.392.894.995.0
DBX-6491.677.858.144.536.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A92.693.695.296.397.0
DBX-12887.847.620.112.710.3N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A94.497.697.897.196.4
GBZ-1692.075.852.534.021.728.771.599.9100.0100.049.286.399.9100.0100.090.890.692.091.990.9
GBZ-3291.174.452.433.421.626.573.599.7100.0100.049.487.299.9100.0100.091.090.691.891.491.6
GBZ-6492.580.362.042.427.237.081.7100.0100.0100.057.693.5100.0100.0100.091.690.990.391.191.5
GBZ-12890.876.857.538.924.826.663.099.6100.0100.044.978.799.8100.0100.087.990.190.791.190.6
GBY-1694.277.749.423.912.141.984.1100.0100.0100.052.991.9100.0100.0100.086.692.093.093.192.6
GBY-3294.576.945.420.09.641.483.3100.0100.0100.056.392.8100.0100.0100.089.091.693.393.293.0
GBY-6493.676.447.522.310.741.984.5100.0100.0100.057.792.5100.0100.0100.089.392.792.892.992.9
GBY-12893.072.942.218.59.037.4:71.6100.0100.0100.050.181.999.9100.0100.090.791.4 91.891.492.0
+ +Table E.26: PGD white-box zero-knowledge atack results on MNIST(with varied bottleneck layer sizes). + +
acc. (adv)TP marginalTP KL
E0.100.200.300.400.500.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
DBX-1669.836.616.05.91.8N/AN/AN/AN/A N/AN/AN/AN/AN/AN/A91.291.992.893.393.7
DBX-3263.526.812.56.22.7N/AN/AN/A N/AN/AN/AN/AN/AN/AN/A91.592.192.792.993.5
DBX-6458.018.36.01.30.2N/AN/AN/A N/AN/AN/AN/AN/AN/AN/A92.794.094.193.784.8
DBX-12842.33.01.10.30.2N/AN/A N/AN/AN/AN/AN/AN/AN/AN/A97.197.198.498.498.6
GBZ-1688.362.837.423.115.527.135.871.9 98.9100.046.353.082.399.3100.089.691.792.391.491.8
GBZ-3287.161.940.228.020.424.039.176.798.9 100.041.556.485.499.7100.091.391.091.191.391.1
GBZ-6485.157.432.519.311.633.750.384.4 99.7100.052.266.391.599.8100.090.091.591.591.791.8
GBZ-12884.457.536.825.216.825.435.466.1 96.6100.041.550.576.497.7100.088.690.490.490.090.6
GBY-1690.449.715.04.21.642.664.789.9 99.3100.051.170.892.899.5100.091.993.191.990.791.0
GBY-3288.439.89.51.80.645.674.392.8 99.5100.056.878.294.899.8100.090.892.291.791.090.6
GBY-6486.735.99.01.70.445.376.194.6 99.7100.056.979.395.699.9100.090.192.191.691.791.4
GBY-12883.335.18.72.30.839.163.986.7 98.3100.051.769.189.298.9100.089.890.790.489.789.5
+ +Table E.27 : MIM white-box zero-knowledge attack results on MNIST (with varied bottleneck layer sizes) . + +
acc. (adv)TP marginalTP logitTP KL
E0.10(0.200.300.400.500.100.200.300.400.500.100.200.300.400.500.100.200.300.400.50
DBX-1672.237.120.714.711.7N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A91.892.392.893.493.9
DBX-3266.727.616.812.510.6N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A91.892.592.493.293.5
DBX-6466.728.719.717.217.2N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A93.594.394.694.794.7
DBX-12842.31.30.20.10.0N/AN/AN/AN/AN/AN/AN/AN/AN/AN/A97.297.698.698.999.1
GBZ-1683.836.48.92.30.926.979.899.7100.0100.043.388.099.8100.0100.091.692.191.291.692.6
GBZ-3282.735.59.53.01.126.683.299.7100.0100.045.890.099.8100.0100.090.391.791.492.592.6
GBZ-6479.627.45.61.50.536.186.3100.0100.0100.053.593.199.9100.0100.091.391.491.992.292.7
GBZ-12879.232.18.72.61.226.168.599.2100.0100.041.279.199.4100.0100.089.791.591.491.492.5
GBY-1689.234.63.50.20.044.888.199.8100.0100.055.991.799.7100.0100.089.492.591.090.636.9
GBY-3286.725.81.60.10.045.191.2100.0100.0100.058.694.0100.0100.0100.090.991.891.1 68.631.1
GBY-6484.922.91.50.10.047.491.299.9100.0100.059.892.899.9100.0100.091.492.191.286.829.0
GBY-12882.123.71.90.00.040.483.099.7100.0100.051.787.599.6100.0100.091.291.289.882.844.4
\ No newline at end of file diff --git a/md/train/LSFCEb3GYU7/LSFCEb3GYU7.md b/md/train/LSFCEb3GYU7/LSFCEb3GYU7.md new file mode 100644 index 0000000000000000000000000000000000000000..ad672f0798092a80c15d215f65887250d0947e65 --- /dev/null +++ b/md/train/LSFCEb3GYU7/LSFCEb3GYU7.md @@ -0,0 +1,509 @@ +# EMERGENT SYMBOLS THROUGH BINDING IN EXTERNAL MEMORY + +Taylor W. Webb +University of California Los Angeles Los Angeles, CA +taylor.w.webb@gmail.com +Ishan Sinha, Jonathan D. Cohen +Princeton University +Princeton, NJ + +# ABSTRACT + +A key aspect of human intelligence is the ability to infer abstract rules directly from high-dimensional sensory data, and to do so given only a limited amount of training experience. Deep neural network algorithms have proven to be a powerful tool for learning directly from high-dimensional data, but currently lack this capacity for data-efficient induction of abstract rules, leading some to argue that symbol-processing mechanisms will be necessary to account for this capacity. In this work, we take a step toward bridging this gap by introducing the Emergent Symbol Binding Network (ESBN), a recurrent network augmented with an external memory that enables a form of variable-binding and indirection. This binding mechanism allows symbol-like representations to emerge through the learning process without the need to explicitly incorporate symbol-processing machinery, enabling the ESBN to learn rules in a manner that is abstracted away from the particular entities to which those rules apply. Across a series of tasks, we show that this architecture displays nearly perfect generalization of learned rules to novel entities given only a limited number of training examples, and outperforms a number of other competitive neural network architectures. + +# 1 INTRODUCTION + +Human intelligence is characterized by a remarkable capacity to detect the presence of simple, abstract rules that govern high-dimensional sensory data, such as images or sounds, and then apply these to novel data. This capacity has been extensively studied by psychologists in both the visual domain, in tasks such as Raven’s Progressive Matrices (Raven & Court, 1938), and the auditory domain, in tasks that employ novel, artificial languages (Marcus et al., 1999). + +In recent years, deep neural network algorithms have reemerged as a powerful tool for learning directly from high-dimensional data, though many studies have now demonstrated that these models suffer from similar limitations as those faced by the earlier generation of neural networks: requiring enormous amounts of training data and tending to generalize poorly outside the distribution of those training data (Lake & Baroni, 2018; Barrett et al., 2018). This stands in sharp contrast to the ability of human learners to infer abstract structure from a limited number of training examples and then systematically generalize that structure to problems involving novel entities. + +It has long been argued that the human ability to generalize in this manner depends crucially on a capacity for variable-binding, that is, the ability to represent a problem in terms of abstract symbollike variables that are bound to concrete entities (Holyoak & Hummel, 2000; Marcus, 2001). This in turn can be broken down into two components: 1) a mechanism for indirection, the ability to bind two representations together and then use one representation to refer to and retrieve the other (Kriete et al., 2013), and 2) a representational scheme whereby one of the bound representations codes for abstract variables, and the other codes for the values of those variables. + +In this work, we present a novel architecture designed around the goal of having a capacity for abstract variable-binding. This is accomplished through two important design considerations. First, the architecture possesses an explicit mechanism for indirection, in the form of a two-column external memory. Second, the architecture is separated into two information-processing streams, one that maintains learned embeddings of concrete entities (in our case, images), and one in which a recurrent controller learns to represent and operate over task-relevant variables. These two streams only interact in the form of bindings in the external memory, allowing the controller to learn to perform tasks in a manner that is abstracted away from the particular entities involved. We refer to this architecture as the Emergent Symbol Binding Network (ESBN), due to the fact that this arrangement allows abstract, symbol-like representations to emerge during the learning process, without the need to incorporate symbolic machinery. + +We evaluate this architecture on a suite of tasks involving relationships among images that are governed by abstract rules. Across these tasks, we show that the ESBN is capable of learning abstract rules from a limited number of training examples and systematically generalizing these rules to novel entities. By contrast, the other architectures that we evaluate are capable of learning these rules in some cases, but fail to generalize them successfully when trained on a limited number of problems involving a limited number of entities. We conclude from these results that a capacity for variable-binding is a necessary component for human-like abstraction and generalization, and that the ESBN is a promising candidate for how to incorporate such a capacity into neural network algorithms. + +# 2 TASKS + +![](images/dd626285c79ee67e710196f3856936479741bdc56e6485c4e26bff446cfd34c7.jpg) +Figure 1: Abstract rule learning tasks. Each task involves generalizing rules to objects not seen during training. (a) Same/different discrimination task. (b) Relational match-to-sample task (answer is 2). (c) Distribution-of-three task (answer is 2). (d) Identity rules task (ABA pattern, answer is 1). + +We consider a series of tasks, each involving the application of an abstract rule to a set of images. For all tasks, we employ the same set of $n = 1 0 0$ images, in which each image is a distinct Unicode character (the specific characters used are shown in A.7). We construct training sets in which $m$ images are withheld (where $0 \leq m \leq n - o .$ , and $o$ is the minimum number of images necessary to create a problem in a given task) consisting of problems that employ only the remaining $( n -$ $m$ ) images, and then test on problems that employ only the $m$ withheld images, thus requiring generalization to novel entities. In the easiest generalization regime $\mathbf { \bar { \rho } } m = 0$ ) the test set contains problems composed of the same entities as observed during training (though the exact order of these entities differs). In the most extreme generalization regime, we evaluate models that have only been trained on the minimum number of entities for a given task, and then must generalize what they learn to the majority of the $n$ images in the complete set. This regime poses an extremely challenging test of the ability to learn to perform these tasks from limited training experience, in a manner that is abstracted away from the specific entities observed during training. + +The first task that we study is a same/different discrimination task (Figure 1a). In this task, two images are presented, and the task is to determine whether they are the same or different. Though this task may appear quite simple, it has been shown that the ability to generalize this simple rule to novel entities is actually a significant challenge for deep neural networks (Kim et al., 2018), a pattern that we also observe in our results. + +The second task that we consider is a relational match-to-sample (RMTS) task (Figure 1b), essentially a higher-order version of a same/different task. In this task, a source pair of objects is compared to two target pairs. The task is to identify the target pair with the same relation as the source pair; e.g., if the source pair contains two of the same object, to identify the target pair that contains two of the same object. It was initially believed that the ability to perform this task is not unique to humans (Premack, 1983), but it has now been shown that this ability depends on a visual entropy confound that arises from using large arrays of objects rather than simple pairs (Fagot et al., 2001). When the task is presented in a manner that does not allow this confound to be exploited (as is the case in our experiments), the ability to perform the task with novel entities appears to be unique to humans, and therefore is a good test of the human ability for abstract rule learning. + +Next we consider a task based on Raven’s Progressive Matrices (RPM; Raven & Court (1938)). RPM is a commonly used visual problem-solving task, and is one of the most widely used tests of fluid intelligence (Snow et al., 1984), the ability to reason and make inferences in a novel domain (as opposed to crystallized intelligence, the ability to solve familiar tasks). In this task, a $3 \times 3$ array of figural elements is presented, in which the elements are governed by a simple rule, or set of rules, with the lower right element of the array left blank. The task is to infer the rule that governs the elements in the array, and then use that rule to select from among 8 candidate completions. Many of the rules that govern RPM problems are relations involving sets. One such rule is sometimes referred to as distribution-of-three (Carpenter et al., 1990), according to which the same set of three elements (e.g. a triangle, square, and circle) will appear in each row, though the order doesn’t matter. The task in this case is simply to identify the set, determining which element is missing from the final row, and locating this element among the choices. + +Though multiple RPM-inspired datasets have recently been proposed (Barrett et al., 2018; Zhang et al., 2019), in this work we choose to strip away unnecessary complexity, focusing on $2 \times 3$ arrays governed by a single rule (Figure 1c), in order to focus specifically on the capacity for generalization of an abstract rule to novel entities. We find that, even in this simplified setting, this form of generalization is extremely challenging. + +The final task that we consider is a visual version of the identity rules task studied by Marcus et al. (1999). In this task, an abstract pattern (e.g. ABA or ABB) must be inferred from a sequence of elements. For instance, in the original study, the following sequence ‘ga ni ga, li na li, wo fe wo’ is governed by an ABA rule, whereas the sequence ‘ga ni ni, li na na, wo fe fe’ is governed by an ABB rule. This study played an important role in debates concerning the presence of algebraic rulelike processes in human cognition, because it demonstrated that even 7-month-old human infants are capable of detecting this abstract regularity and generalizing it to novel entities, whereas neural networks tend to overfit to the specific entities involved and fail to generalize the rule. + +In our implementation, we use visual images rather than sounds, and present the task as a $2 \times 3$ array (Figure 1d). In this task, each problem is governed by either an ABA, ABB, or AAA rule. The task is to determine which of these patterns is present in the first row, and then to apply that pattern by selecting an element from a set of 4 choices to complete the second row. + +For all four tasks, we consider generalization regimes in which some number of images $( m \in$ $\{ 0 , 5 0 , 8 5 , 9 5 \}$ out of $n = 1 0 0$ ) are withheld from training. For the same/different discrimination task, on which only two images are necessary to construct a problem, we also consider the case in which $m = 9 8$ (such that the training set consists of problems involving only $n - m = 2$ images, the minimum number necessary to construct the task). + +In most settings, we construct training sets consisting of $1 0 ^ { 4 }$ problems. This is a tiny fraction of all possible problems (on the order of $\mathrm { { \bar { 1 0 } ^ { 9 } } }$ when the multiple choice options are considered)1 Thus, even in the easiest generalization regime $( m = 0$ ) this is an extremely small amount of training data relative to the size of the task space. In the most extreme regimes, in which $m \geq 9 5$ , it is only possible to construct a few hundred problems, resulting in even more limited training experience. + +# 3 APPROACH + +For each task, we treat the problem as a sequence of images $\pmb { x } _ { t = 1 } . . . \pmb { x } _ { t = T }$ , with an associated target $\textbf { { y } }$ . In the same/different discrimination task, there are $T \ = \ 2$ images, and $\textbf { { y } }$ is a binary target indicating whether the images are the same or different. In the RMTS task, there are $T = 6$ images, consisting of the source pair followed by two target pairs, and $\textbf { { y } }$ is a binary target indicating which target pair matches the source pair. In both the distribution-of-three task and the identity rules task, there are $T = 9$ images, consisting of the three entries in the first row, the two non-empty entries in the second row, and the four multiple-choice options, and $\textbf { { y } }$ is a four-way classification target, indicating which of the multiple-choice options is correct. + +All images are $3 2 \times 3 2$ grayscale images containing a single Unicode character. For each problem, we first process each image independently by a shared encoder $f _ { e }$ , generating image embeddings $z _ { t = 1 } , . . . z _ { t = T }$ , and then pass these embeddings to a sequential model component $f _ { s }$ that generates a response (either through a sigmoid output layer for tasks with a binary target, or a softmax layer for tasks with a four-way classification target). The sequential component is either the ESBN or one of a number of alternative architectures described below. We use the same encoder architecture $f _ { e }$ (detailed in A.3) for all models. All components are trained end-to-end, including the encoder. + +# 3.1 TEMPORAL CONTEXT NORMALIZATION + +We use temporal context normalization (TCN), recently shown to improve out-of-distribution generalization in relational reasoning tasks (Webb et al., 2020). TCN is similar to batch normalization, but, instead of normalizing over the batch dimension, normalizes over a task-relevant temporal window. This has the effect of preserving information about the relations between the entities present within this window (e.g. the size of those entities relative to one another), resulting in better generalization of learned relations to novel contexts (i.e. out-of-distribution). + +We found that TCN significantly improved generalization for all of the models on all of the tasks studied in the present work2. Therefore, the primary results we report all incorporate this technique ( A.5.1 includes a comparison of the performance of all models on all tasks with and without TCN). Specifically, we applied TCN to the embeddings $z _ { t = 1 } , . . . z _ { t = T }$ extracted by the encoder. Webb et al. (2020) also reported that it is sometimes useful to apply TCN separately to different components of a sequence. We found that this was the case for the RMTS task that we studied, in which we found it useful to apply TCN separately to the embeddings for the source pair and each target pair. For all of the other tasks that we studied, TCN was applied over the entire sequence for each problem. + +# 3.2 EMERGENT SYMBOL BINDING NETWORK + +![](images/476acc9f1cb7fbaf9e923b8b24ee79c4de4f1eee886b14ed4777c92f158a40c5.jpg) +Figure 2: Emergent Symbol Binding Network. $f _ { s }$ consists of an LSTM controller plus output layers for $\hat { \pmb { y } }$ , $k _ { w }$ , and $g$ (not shown). $f _ { e }$ is a multilayer feedforward encoder that translates an image $_ { \textbf { \em x } }$ into a low-dimensional embedding $_ { z }$ . These two pathways only interact indirectly via a key/value memory. + +The ESBN (Figure 2; Algorithm 1) uses an LSTM controller $( f _ { s } )$ with a differentiable external memory that is explicitly separated into keys $( M _ { k } )$ and values $( M _ { v } )$ . At each time step $t$ , a key/value pair is written to memory. The keys written to memory, $k _ { w _ { t } }$ , are generated by an output layer from the LSTM controller, and the values are the individual input embeddings, ${ \boldsymbol { z } } _ { t }$ , of the input sequence, unmodified by the LSTM. Our hypothesis was that factoring the model into two separate information processing streams would allow the LSTM to learn how to represent abstract variables in the keys it generates, which could then be explicitly bound to associated values (image embeddings) learned by the separate encoder network $( f _ { e } )$ , allowing the ESBN to employ a form of indirection. + +To retrieve keys from memory, similarity scores are computed by comparing (via a dot product) the image embedding ${ \boldsymbol { z } } _ { t }$ to all of the values in memory $M _ { v _ { t - 1 } }$ . These similarity scores are passed through a softmax nonlinearity to generate weights ${ \pmb w } _ { k _ { t } }$ , and passed through a sigmoid nonlinearity (with learned gain and bias parameters, $\gamma$ and $\beta$ ) to generate confidence values $c _ { k _ { t } }$ (one weight and confidence value per entry in memory). The weights are used to compute 1) a weighted sum of all keys in memory $M _ { k _ { t - 1 } }$ , and 2) a weighted sum of all associated confidence values $c _ { k _ { t } }$ . Finally, the retrieved key and associated confidence value are concatenated and multiplied by a learned sigmoidal gate $g _ { t }$ to form $\boldsymbol { k } _ { \boldsymbol { r } _ { t } }$ , the input to the LSTM controller at the next time step. + +
Algorithm 1: Emergent Symbol Binding Network. (ll) indicates the concatenation of a vector and a scalar, forming a vector with one additional dimension.{,} indicates the concatenation of a matrix and a vector,forming a matrix with one additional row. o() is the logistic sigmoid function.
ht=0←0; Mkt=0←{}; Mut=o←{; for t in1...Tdo Zt←fe(xt);
yt,gt,kwt,ht ←fs(ht-1,krt-1); if t is 1 then krt←0; else
Wkt ← softmax(Mut-1·zt); Ckt← σ(γ(Mvt-1·zt)+β);
t-1 krt←gt M Wkt(i)(Mkt-1(i)llckt (i)) ; i=1
+ +# 3.3 ALTERNATIVE ARCHITECTURES + +The simplest alternative architecture that we consider is an LSTM (Hochreiter & Schmidhuber, 1997) without external memory. We pass the low-dimensional embeddings $z _ { t = 1 } , . . . z _ { t = T }$ directly to the LSTM, and generate a prediction $\hat { \pmb { y } }$ by passing the final hidden state through an output layer. + +Next we consider two alternative external memory architectures: the Neural Turing Machine (NTM; Graves et al. (2014)) and Metalearned Neural Memory (MNM; Munkhdalai et al. (2019)). This comparison allows us to determine to what extent our results depend on the specific details of the ESBN’s external memory, and, in particular, the separation between its two informationprocessing pathways vs. the mere presence of an external memory. Our NTM implementation consists of an LSTM controller (which takes image embeddings as input, and generates a prediction $\hat { \textbf { \textit { y } } }$ as output) that interacts with an external memory using both content-based and location-based read/write mechanisms. Our MNM implementation employs the publicly available code from the original paper, modified so as to employ the same encoder architecture and TCN procedure as the other architectures that we test. Just as with the ESBN, we allow both of these architectures an extra time step to process the information retrieved from memory following the final input. + +We also consider the Relation Net (RN; Santoro et al. (2017)), an architecture that has proven to be an effective approach for a wide range of relational reasoning tasks. In our implementation, we treat the low-dimensional image embeddings as individual ‘objects’ in the RN framework, using a shared MLP to process all pair-wise combinations of these embeddings, summing the outputs from this MLP, and then passing them to another MLP that generates the prediction $\hat { \boldsymbol y }$ . + +We also compare our model against the Transformer (Vaswani et al., 2017), an architecture originally developed in the domain of natural language processing, but has proven to be effective for a wide range of sequential data, and demonstrated a capacity for some degree of extrapolation (Saxton et al., 2019). After applying the transformer architecture to the sequence of image embeddings (allowing self-attention between these embeddings), we compute an average of the (transformed) embeddings, and then pass this to a small MLP that then generates the task output $\hat { \pmb { y } }$ . + +Finally, we consider the PrediNet (Shanahan et al., 2019). PrediNet was designed with the goal of being ‘explicitly relational,’ and has been shown to be effective at generalizing learned relations to novel entities. We apply the PrediNet’s multi-head attention over the 1D temporal sequence of image embeddings (as opposed to applying attention over a 2D image, as in the original work), and then pass the output of the PrediNet module to a small MLP that generates $\hat { \boldsymbol y }$ . + +![](images/4779e2f7fc5d68739eae072614bbe070f56d2a84d5b7a937fd32aecfc5d1091a.jpg) +Figure 3: Results for all four tasks with $m$ objects withheld (out of $n = 1 0 0$ ) during training. Results reflect test accuracy averaged over 10 trained networks ( $\pm$ the standard error of the mean). + +Figure 3 shows the generalization results for all four tasks. Our primary finding is that the ESBN displayed nearly perfect generalization $( \geq 9 5 \% )$ of the learned rule in all four tasks, even when trained on a very limited number of problems (just hundreds of problems, in the case of the most extreme generalization regimes) involving a limited number of entities (as few as just two entities, in the case of the same/different task), and tested on completely novel entities. Some of the alternative architectures that we evaluated showed a surprising capability to generalize to novel entities in some tasks as seen, for instance, in the generalization results for the Transformer and RN on the same/different and RMTS tasks (though we note that all architectures incorporate TCN, without which generalization is significantly worse, as shown in A.5.1). Nevertheless, none of these alternative architectures were able to generalize what they learned in the most extreme generalization regimes, whereas the ESBN performed comparably well across all regimes. + +Notably, the RN performed very poorly on the distribution-of-three and identity rules tasks, even in the easiest regime $( m = 0$ ). We speculate that this results from the fact that the RN is biased toward pair-wise relations, whereas these tasks are both based on a ternary relation. It is possible to represent this ternary relation as a combination of pair-wise relations, but doing so requires a more complex strategy and therefore likely more training data. We include results in A.5.2 demonstrating that the RN is capable of successfully generalizing in this task (though not in the most extreme regimes) when trained on an order of magnitude more data $1 0 ^ { 5 }$ instead of $1 0 ^ { 4 }$ examples). We also present results for the Temporal Relation Network (Zhou et al., 2018), an RN variant that incorporates ternary relations via subsampling, though we find that this doesn’t help as much as increasing the amount of training data. + +![](images/a290863da2658abe383e52e522aff79c3ca9a9e6836ac6dd48ca5ac230ec8b77.jpg) +Figure 4: Training accuracy time courses for all models on the $m = 0$ regime. Each time course reflects an average over 10 trained networks. Error bars reflect the standard error of the mean. + +In addition to requiring a very small amount of training data and generalizing systematically to novel entities, the ESBN also requires very little training time. Figure 4 shows training accuracy time courses for the RMTS, distribution-of-three, and identity rules tasks for all models 3. The ESBN converged to nearly perfect training accuracy within 100 to 200 training updates on all four tasks, whereas the other models required thousands, or even tens of thousands of training updates to reach convergence4. + +We also performed some experiments to better understand how the ESBN operates, and why it was so effective. First, we tested whether the systematic generalization exhibited by the ESBN was dependent on the use of convolutional layers in the encoder, which naturally confer a significant degree of generalization in tasks that involve shape recognition. We found that the ESBN generalized to novel entities comparably well when using either an MLP encoder or a random projection (see A.5.4 for details), suggesting that the ESBN is capable of generalizing learned rules to any arbitrary set of entities, regardless of how those entities are encoded. For comparison, we also performed the same experiments with the Transformer (the best performing alternative architecture on our tasks) and found that, by contrast, its performance was significantly impaired by the use of a random projection instead of a convolutional encoder. + +Second, we performed an ablation experiment on the confidence value appended to retrieved memories. We found that ablation of these confidence values impaired the ESBN’s performance in both the same/different and RMTS tasks, but not the distribution-of-three or identity rules tasks (see A.5.5 for details). A likely reason for this result is that the distribution-of-three and identity rules tasks only require retrieval of the best match from memory, whereas the same/different and RMTS tasks require a sense of how good of a match that memory is, which is exactly the information that the confidence value conveys. This dissociation mirrors the distinction sometimes made in cognitive psychology between recollection and familiarity (Yonelinas, 2001). + +Third, we performed an analysis of the key representations learned by the controller. We hypothesized that the controller would learn to represent abstract variables in the keys that it writes to memory, and that these representations therefore shouldn’t vary based on the values to which they are bound. This analysis revealed a high degree of overlap between the keys written during training and test (involving entirely different entities), suggesting that this was indeed the case (see A.6 for details). This ability to arbitrarily bind values to variables, without affecting the representations of those variables, is a key property of symbol-processing systems, and is likely the basis of the strong systematic generalization exhibited by the ESBN. + +# 5 RELATED WORK + +There have been a number of proposals for augmenting neural networks with an external memory. An influential early line of work, Complementary Learning Systems (McClelland et al., 1995), proposed that neural systems benefit from having components that learn on different time scales, and argues that this combination allows neural networks both to learn general, abstract structure (using standard learning algorithms) and to rapidly encode arbitrary new items (using an external memory). In recent years, there have been a number of proposals for how to implement the latter efficiently, including Fast Weights (Ba et al., 2016a), the NTM and closely related Differentiable Neural Computer (Graves et al., 2016), and the Differentiable Neural Dictionary (DND; Pritzel et al. (2017)). Our external memory approach is most closely related to the DND, which also involves a two-column key/value memory. Variations on key/value memory have also been employed in other more recently proposed approaches, such as the Memory Recall Agent (Fortunato et al., 2019) and the Dual-Coding Episodic Memory (Hill et al., 2020), where it afforded various benefits in terms of generalization. One critical difference between our model and this previous work is that the ESBN’s controller is forced to interact with perceptual inputs only indirectly through its memory, a design decision that we argue is crucial to its ability to systematically generalize what it learns. + +It is worth noting that architectures such as Fast Weights and the NTM are, in principle, capable of implementing variable-binding, though it is a separate question whether such a strategy will result from learning in any particular task. Along these lines, a recent study from Chen et al. (2019) found that both of these architectures are capable of generalizing learned structure to novel entities when allowed a sufficiently dense sampling of the space of potential objects (the ‘objects’ in their study were randomly sampled 50-dimensional vectors). This contrasts with our findings, in which the NTM performed poorly when trained on far fewer samples from a much higher-dimensional space (in the $m = 9 5$ regime). This suggests that indirection and variable-binding, though possible in principle for architectures such as the NTM, do not emerge in practice when given only a limited amount of training experience, whereas this capacity is explicitly built into the ESBN. + +At a high level, the idea of factoring a model into two distinct information processing streams, one that codes abstract task-relevant variables or roles and one that codes concrete entities, has been explored before. Kriete et al. (2013) proposed the PBWM Indirection model, in which one population of neurons acted as a pointer to another population of neurons by gating its activity, and showed that this model enabled a significant degree of generalization to novel role/filler bindings. Whittington et al. (2019) proposed the Tolman-Eichenbaum machine, a model that is capable of learning abstract relational structure (such as 2D spatial maps), and showed that this model captured a number of phenomena relating to grid cells and place cells. Russin et al. (2019) proposed Syntactic Attention, an architecture involving separate pathways for processing syntax vs. semantics, and showed that this approach was capable of a significant degree of compositional generalization on the challenging SCAN dataset. Relative to this previous work, our central contribution is the development of a simple model that can learn abstract rules directly from high-dimensional data (images), exploiting this same high-level idea to enable nearly perfect generalization of those rules to novel entities. + +There has been extensive modeling work focusing on some of the tasks that we study. The recent development of two datasets modeled after Raven’s Progressive Matrices, Procedurally Generated Matrices (Barrett et al., 2018), and RAVEN (Zhang et al., 2019), has spurred the development of models that are capable of solving RPM-like problems (Jahrens & Martinetz, 2020; Wu et al., 2020). However, these models typically require very large training sets (on the order of $1 0 ^ { 6 }$ training examples), and largely fail to generalize outside of the specific conditions under which they are trained, whereas the ESBN exhibits the ability to learn rapidly and generalize out-of-distribution. + +There have also been a number of models proposed to account for the human ability to rapidly learn identity rules (Alhama & Zuidema, 2019). Though some of these models achieved significant generalization of learned identity rules to novel entities, they did so mostly through the inclusion of highly task-specific mechanisms. By contrast, our aim in the present work was to present a general approach that could be applied to a wider range of tasks. + +Finally, there have been a number of recent proposals for so-called ‘neurosymbolic’ models, incorporating elements from both the neural network and symbolic modeling frameworks (Mao et al., 2019; Nye et al., 2020). Though we have emphasized the notion of ‘emergent symbols’ in the present work, we stress that this is quite distinct from neurosymbolic modeling efforts since we do not explicitly incorporate any symbolic machinery into the ESBN. Instead, our approach was to show how the functional equivalent of symbols can emerge in a neural network model with an appropriate architecture and binding mechanism. + +# 6 DISCUSSION + +# 6.1 LIMITATIONS AND FUTURE WORK + +One open question is whether the strict division between the two information processing streams in the ESBN is necessary, and whether it limits the sorts of relations and rules that it can learn. In future work, it may be desirable to soften this division, for instance by encouraging it in a regularization term, rather than strictly enforcing it architecturally. + +A second limitation is that the tasks we study are not as complex as other similar tasks that have recently been studied, such as the two recently proposed RPM-like benchmarks (Barrett et al., 2018; Zhang et al., 2019). In the present work, we intentionally stripped away some of this complexity in order to make progress on the issue of out-of-distribution generalization. Extending the ESBN to more complex tasks will likely require the incorporation of visual attention mechanisms to enable selective sequential processing of individual elements within a scene. There are many recently proposed approaches for doing this (Gregor et al., 2015; Locatello et al., 2020). In future work, we look forward to extending the ESBN in this manner and testing it on more complex tasks. + +# 6.2 RELATION TO WORK IN NEUROSCIENCE + +It is worth considering how the present work relates to pre-existing theories of how the brain might implement variable-binding. Classic proposals for variable-binding in neural systems emphasize dynamic binding of representations, either by computing the tensor product between those representations (Smolensky, 1990), or by establishing synchronous activation between two pools of units (Hummel & Holyoak, 1997). An alternative proposal is that variable-binding is accomplished via semi-permanent synaptic changes in the hippocampus, relying on the same mechanism that plays a central role in episodic memory (Cer & O’Reilly, 2006). This approach relies on contextual information and retrieval processes to prevent potential interference between conflicting memories, rather than explicit unbinding mechanisms. Our model is more in line with the latter account, since it does not possess an unbinding mechanism. As such, our model can be seen as part of a recent trend toward the reinterpretation of putatively working memory functions in terms of episodic memory (Beukers et al., 2020). + +# 7 CONCLUSION + +In this work, we have presented a model of abstract rule learning based on a novel architecture, the ESBN, and shown that this model is capable of rapidly learning abstract rules directly from images given only a small amount of training experience, and then successfully generalizing those rules to novel entities. Key to the model’s performance is its separation into two streams that only interact through indirection, allowing the ESBN to learn tasks in a manner that is abstracted away from the specific entities involved, and resulting in the emergence of symbol-like representations. We believe that these results suggest that such a variable-binding capacity is an essential ingredient for achieving human-like abstraction and generalization, and hope that the ESBN will be a useful tool for doing so. + +# ACKNOWLEDGMENTS + +We would like to thank Zachary Dulberg, Steven Frankland, Randall O’Reilly, Alexander Petrov, and Simon Segert for their helpful feedback and discussions. + +# REFERENCES + +Raquel G Alhama and Willem Zuidema. A review of computational models of basic rule learning: The neural-symbolic debate and beyond. Psychonomic bulletin & review, 26(4):1174–1194, 2019. + +Jimmy Ba, Geoffrey E Hinton, Volodymyr Mnih, Joel Z Leibo, and Catalin Ionescu. Using fast weights to attend to the recent past. In Advances in Neural Information Processing Systems, pp. 4331–4339, 2016a. + +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016b. + +David GT Barrett, Felix Hill, Adam Santoro, Ari S Morcos, and Timothy Lillicrap. Measuring abstract reasoning in neural networks. arXiv preprint arXiv:1807.04225, 2018. + +Andrew Beukers, Kenneth A Norman, and Jonathan D Cohen. Is activity silent working memory just episodic memory?, 2020. + +Patricia A Carpenter, Marcel A Just, and Peter Shell. What one intelligence test measures: a theoretical account of the processing in the raven progressive matrices test. Psychological review, 97 (3):404, 1990. + +Daniel M Cer and Randall C O’Reilly. Neural mechanisms of binding in the hippocampus and neocortex: insights from computational models., 2006. + +Catherine Chen, Qihong Lu, Andre Beukers, Christopher Baldassano, and Kenneth A Norman. Learning to perform role-filler binding with schematic knowledge. arXiv preprint arXiv:1902.09006, 2019. + +Joel Fagot, Edward A Wasserman, and Michael E Young. Discriminating the relation between ¨ relations: the role of entropy in abstract conceptualization by baboons (papio papio) and humans (homo sapiens). Journal of Experimental Psychology: Animal Behavior Processes, 27(4):316, 2001. + +Meire Fortunato, Melissa Tan, Ryan Faulkner, Steven Hansen, Adria Puigdom \` enech Badia, Gavin \` Buttimore, Charles Deck, Joel Z Leibo, and Charles Blundell. Generalization of reinforcement learners with working and episodic memory. In Advances in Neural Information Processing Systems, pp. 12469–12478, 2019. + +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. + +Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014. + +Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, 2016. + +Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015. + +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. + +Felix Hill, Olivier Tieleman, Tamara von Glehn, Nathaniel Wong, Hamza Merzic, and Stephen Clark. Grounded language learning fast and slow. arXiv preprint arXiv:2009.01719, 2020. + +Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997. + +Keith J Holyoak and John E Hummel. The proper treatment of symbols in a connectionist architecture. Cognitive dynamics: Conceptual change in humans and machines, 229:263, 2000. + +John E Hummel and Keith J Holyoak. Distributed representations of structure: A theory of analogical access and mapping. Psychological review, 104(3):427, 1997. + +Marius Jahrens and Thomas Martinetz. Solving raven’s progressive matrices with multi-layer relation networks. arXiv preprint arXiv:2003.11608, 2020. + +Junkyung Kim, Matthew Ricci, and Thomas Serre. Not-so-clevr: learning same–different relations strains feedforward neural networks. Interface focus, 8(4):20180011, 2018. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +Trenton Kriete, David C Noelle, Jonathan D Cohen, and Randall C O’Reilly. Indirection and symbol-like processing in the prefrontal cortex and basal ganglia. Proceedings of the National Academy of Sciences, 110(41):16390–16395, 2013. + +Brenden Lake and Marco Baroni. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In International Conference on Machine Learning, pp. 2873–2882. PMLR, 2018. + +Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. Object-centric learning with slot attention. arXiv preprint arXiv:2006.15055, 2020. + +Jiayuan Mao, Chuang Gan, Pushmeet Kohli, Joshua B Tenenbaum, and Jiajun Wu. The neurosymbolic concept learner: Interpreting scenes, words, and sentences from natural supervision. arXiv preprint arXiv:1904.12584, 2019. + +Gary Marcus. The algebraic mind, 2001. + +Gary F Marcus, Sugumaran Vijayan, S Bandi Rao, and Peter M Vishton. Rule learning by sevenmonth-old infants. Science, 283(5398):77–80, 1999. + +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. + +Tsendsuren Munkhdalai, Alessandro Sordoni, Tong Wang, and Adam Trischler. Metalearned neural memory. In Advances in Neural Information Processing Systems, pp. 13331–13342, 2019. + +Maxwell I Nye, Armando Solar-Lezama, Joshua B Tenenbaum, and Brenden M Lake. Learning compositional rules via neural program synthesis. arXiv preprint arXiv:2003.05562, 2020. + +David Premack. The codes of man and beasts. Behavioral and Brain Sciences, 6(1):125–136, 1983. + +Alexander Pritzel, Benigno Uria, Sriram Srinivasan, Adria Puigdomenech, Oriol Vinyals, Demis Hassabis, Daan Wierstra, and Charles Blundell. Neural episodic control. arXiv preprint arXiv:1703.01988, 2017. + +John C Raven and JH Court. Raven’s progressive matrices. Western Psychological Services Los Angeles, CA, 1938. + +Jake Russin, Jason Jo, Randall C O’Reilly, and Yoshua Bengio. Compositional generalization in a deep seq2seq model by separating syntax and semantics. arXiv preprint arXiv:1904.09708, 2019. + +Adam Santoro, David Raposo, David G Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. In Advances in neural information processing systems, pp. 4967–4976, 2017. + +David Saxton, Edward Grefenstette, Felix Hill, and Pushmeet Kohli. Analysing mathematical reasoning abilities of neural models. arXiv preprint arXiv:1904.01557, 2019. + +Murray Shanahan, Kyriacos Nikiforou, Antonia Creswell, Christos Kaplanis, David Barrett, and Marta Garnelo. An explicitly relational neural network architecture. arXiv preprint arXiv:1905.10307, 2019. + +Ishan Sinha, Taylor W Webb, and Jonathan D Cohen. A memory-augmented neural network model of abstract rule learning. arXiv preprint arXiv:2012.07172, 2020. + +Paul Smolensky. Tensor product variable binding and the representation of symbolic structures in connectionist systems. Artificial intelligence, 46(1-2):159–216, 1990. + +Richard E Snow, Patrick C Kyllonen, and Brachia Marshalek. The topography of ability and learning correlations. Advances in the psychology of human intelligence, 2(S 47):103, 1984. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017. + +Taylor W Webb, Zachary Dulberg, Steven M Frankland, Alexander A Petrov, Randall C O’Reilly, and Jonathan D Cohen. Learning representations that support extrapolation. arXiv preprint arXiv:2007.05059, 2020. + +James CR Whittington, Timothy H Muller, Shirley Mark, Guifen Chen, Caswell Barry, Neil Burgess, and Timothy EJ Behrens. The tolman-eichenbaum machine: Unifying space and relational memory through generalisation in the hippocampal formation. BioRxiv, pp. 770495, 2019. + +Yuhuai Wu, Honghua Dong, Roger Grosse, and Jimmy Ba. The scattering compositional learner: Discovering objects, attributes, relationships in analogical reasoning. arXiv preprint arXiv:2007.04212, 2020. + +Andrew P Yonelinas. Consciousness, control, and confidence: the 3 cs of recognition memory. Journal of Experimental Psychology: General, 130(3):361, 2001. + +Chi Zhang, Feng Gao, Baoxiong Jia, Yixin Zhu, and Song-Chun Zhu. Raven: A dataset for relational and analogical visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5317–5327, 2019. + +Bolei Zhou, Alex Andonian, Aude Oliva, and Antonio Torralba. Temporal relational reasoning in videos. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 803–818, 2018. + +# A APPENDIX + +# A.1 CODE AVAILABILITY + +All code, including code for dataset generation, model implementation, training, and evaluation, is available on GitHub. + +# A.2 DATASET GENERATION + +In this section, we provide details on the dataset generation process for all tasks. In all of our simulations, a dataset was generated from scratch (according to the procedures described below) at the beginning of each training run, such that different runs involved different datasets, though the statistics were the same across these datasets. We did this to prevent the possibility that our results would reflect biases present in a particular dataset. + +Table 1: Training and test set sizes for the same/different discrimination task. + +
m=0m= 50m= 85m= 95m=98
Training18,8104,900420404
Test9904,90010,00010,00010,000
+ +# A.2.1 SAME/DIFFERENT DISCRIMINATION + +Given $n = 1 0 0$ total images, with $m = 0$ withheld during training, there are $n ^ { 2 } = 1 0 ^ { 4 }$ possible same/different problems. To prevent the potential for networks to be biased by the fact that the overwhelming majority of these are ‘different’ problems, we created balanced datasets by including duplicates of the ‘same’ problems. Specifically, we randomly sampled (with replacement) $n ( n - 1 )$ of the $n$ unique ‘same’ trials and combined them with the $n ( n - 1 )$ unique ‘different’ trials, resulting in $2 n ( n - 1 ) = 1 9$ , 800 total problems. We reserved 990 of these problems for test, yielding training sets including 18, 810 problems (ensuring that duplicates of the same problem did not appear in both the training and test sets). + +We followed a similar procedure for the other regimes, generating balanced datasets by duplicating the ‘same’ problems when necessary. These datasets incorporated either all of the problems that resulted from this procedure (given the $n { - } m$ images available for training, or the $m$ images available for test), or $1 0 , 0 0 0$ problems, whichever was smaller. The exact size of each of these datasets is shown in Table 1. + +# A.2.2 RMTS + +Table 2: Training and test set sizes for the RMTS task. + +
m=0m= 50m=85m= 95
Training10,00010,00010,000480
Test10.00010,00010,00010,000
+ +For the RMTS task, we constructed balanced training and test sets ensuring that there were an equal number of problems with a ‘same’ vs. ‘different’ source pair. These datasets contained either 10, 000 problems, or the minimum number of problems possible in a given regime, whichever was smaller (Table 2). For most regimes, 10, 000 problems constitutes a tiny fraction of the full space of possible problems (ranging from $1 0 ^ { 9 }$ for the $m = 0$ regime to $1 0 ^ { 5 }$ for the training set in the $m = 8 5$ regime), and thus there was no need to duplicate problems to achieve balanced datasets. For the $m = 9 5$ regime, there are only 480 possible training problems, which happen to include the same number of ‘same’ and ‘different’ trial types. + +# A.2.3 DISTRIBUTION-OF-THREE + +Table 3: Training and test set sizes for the distribution-of-three task. + +
m=0m= 50m=85m= 95
Training10,00010,00010,000360
Test10,00010,00010,00010,000
+ +For the distribution-of-three task, we generated problems by randomly selecting three of the available images in a given regime (either $n - m$ images during training, or $m$ images during test), and then randomly sampling two permutations of those images for the two rows (allowing the possibility that the same permutation appears in both rows) of the $2 \times 3$ matrix. We then randomly selected a fourth image to appear with the other three as possible answers, and randomly permuted these four answer choices. When taking into account the identity of this fourth image, and the permutation of the answer choices, the number of unique distribution-of-three problems in the $m = 0$ regime is on the order of $1 0 ^ { 1 0 }$ . + +For most regimes, we randomly created training and test sets consisting of 10, 000 randomly sampled problems. For the $m = 9 5$ regime, the training set consisted of 360 problems (the total number of unique problems possible in this regime when not considering the identity and order of the answer choices, which were randomly selected). + +# A.2.4 IDENTITY RULES + +Table 4: Training and test set sizes for the identity rules task. + +
m=0m= 50m=85m=95
Training10,00010,00010,0008,640
Test10,00010,00010,00010,000
+ +For the identity rules task, we constructed datasets with an approximately balanced (through uniform random sampling) number of ABA, ABB, and AAA problems. These datasets consisted of either $1 0 , 0 0 0$ problems, or the minimum number of possible problems in a given regime, whichever was smaller (Table 4). For the training set in the $m = 9 5$ regime, datasets consisting of 8, 640 problems were constructed from the 7, 200 possible unique problems in this regime, by duplicating the AAA problems to match the number of ABA/ABB problems. For all other datasets, $1 0 , 0 0 0$ problems constituted a small fraction of the total number of possible problems (ranging from $1 0 ^ { \bar { 9 } }$ for the $m = 0$ regime to $1 0 ^ { 6 }$ for the training set in the $m = 8 5$ regime), and no duplication was necessary to achieve balanced problem types. + +# A.3 IMPLEMENTATION DETAILS FOR ALL MODELS + +# A.3.1 ENCODER + +We used the same feedforward encoder architecture to process each of the images in a sequence $\pmb { x } _ { t = 1 } . . . \pmb { x } _ { t = T }$ , generating low-dimensional embeddings $z _ { t = 1 } , . . . z _ { t = T }$ that were then passed to the core sequential component of each model (either the ESBN or one of the alternative architectures)5. This encoder consisted of three convolutional layers, each with 32 channels, a $4 \times 4$ kernel, and a stride of 2, followed by two fully-connected layers with 256 units and 128 units respectively. All layers used ReLU nonlinearities. All weights were initialized using a Kaiming normal distribution (He et al., 2015), and all biases were initialized to 0. + +# A.3.2 TASK OUTPUT LAYER + +All models had an output layer for generating $\hat { \boldsymbol y }$ . The number of units and the nonlinearity depended on the task. For the same/different and RMTS tasks, the output layer had 1 unit and a sigmoid nonlinearity (producing a number between 0 and 1 to code for ‘same’ vs. ‘different’, or pair 1 vs. pair 2). For the distribution-of-three and identity rules tasks, the output layer had 4 units and a softmax nonlinearity (to select 1 of the 4 answer choices). The weights of the output layer were initialized using an Xavier normal distribution (Glorot & Bengio, 2010), and the biases were initialized to 0. + +# A.3.3 ESBN + +The details of the ESBN’s operations are given in Algorithm 1. The LSTM controller had 1 layer with 512 units, and employed the standard tanh nonlinearities and sigmoidal gates. The controller also had output layers for $k _ { w }$ (256 units with a ReLU nonlinearity), $g$ (1 unit with a sigmoid nonlinearity), and $\hat { \boldsymbol y }$ . The input to the controller at each time step was $k _ { r }$ , the key retrieved from memory at the previous time step (along with the associated confidence value, $c _ { k } .$ ). At the beginning of each sequence, $k _ { r }$ and the controller’s hidden state $^ { h }$ were initialized to 0. + +After processing a full sequence, the ESBN was allowed an additional time step for the controller to process the retrieved key associated with the final input. After this additional time step, the final hidden state of the LSTM was passed through the task output layer to generate the prediction $\hat { \pmb { y } }$ . We note that it is also possible to retrieve values from memory (from $M _ { v }$ ) using a similar procedure and then decode these values to make predictions in image space (Sinha et al., 2020), but in the present work we focus only on the classification component of the model. + +The input weights for the LSTM controller were initialized using an Xavier normal distribution with a gain value of $5 / 3$ . The weights for the LSTM’s gates, as well as the weights for the output layer for the gate $g$ , were initialized with an Xavier normal distribution (with a gain of 1). The weights for the output layer that produced $k _ { w }$ were initialized using a Kaiming normal distribution. All biases were initialized to 0. The parameters $\gamma$ and $\beta$ were initialized to 1 and 0 respectively. + +# A.3.4 LSTM + +The LSTM architecture had 1 layer with 512 units. Image embeddings were passed to the LSTM as a sequence, after which $\hat { \pmb { y } }$ was generated through a task output layer. The LSTM’s hidden state was initialized to 0 at the beginning of each sequence. The LSTM’s weights were initialized using the same scheme as the LSTM controller in the ESBN (using an Xavier normal distribution, with a gain of $5 / 3$ for the input weights and 1 for the gates), and biases were initialized to 0. + +# A.3.5 NTM + +The NTM had an LSTM controller (1 layer with 512 units). The LSTM’s hidden state was initialized to 0 at the beginning of each sequence, and the LSTM’s parameters were initialized in the same way as the LSTM architecture and the controller for the ESBN. The NTM had one write head and one read head. The read head had the following output layers: + +1. read key: 256 units, tanh nonlinearity, weights initialized using an Xavier normal distribution with a gain of $5 / 3$ . +2. key strength: 1 unit, softplus nonlinearity, weights initialized using a Kaiming normal distribution. +3. interpolation gate: 1 unit, sigmoid nonlinearity, weights initialized using an Xavier normal distribution with a gain of 1. +4. shift weights: 3 units (corresponding to the allowable shifts $- 1 , 0$ , and 1), softmax nonlinearity, weights initialized using an Xavier normal distribution with a gain of 1. + +The write head had the following output layers: + +1. erase vector: 256 units, sigmoid nonlinearity, weights initialized using an Xavier normal distribution with a gain of 1. +2. add vector: 256 units, tanh nonlinearity, weights initialized using an Xavier normal distribution with a gain of $5 / 3$ . +3. write key: 256 units, tanh nonlinearity, weights initialized using an Xavier normal distribution with a gain of $5 / 3$ . +4. key strength: 1 unit, softplus nonlinearity, weights initialized using a Kaiming normal distribution. +5. interpolation gate: 1 unit, sigmoid nonlinearity, weights initialized using an Xavier normal distribution with a gain of 1. +6. shift weights: 3 units (corresponding to the allowable shifts $- 1 , 0$ , and 1), softmax nonlinearity, weights initialized using an Xavier normal distribution with a gain of 1. + +All biases for these output layers were initialized to 0. The NTM used these outputs to interact with its external memory, employing all of the location- and content-based mechanisms described in the original work (Graves et al., 2014). Cosine similarity was used as a similarity measure for the content-based mechanisms. The memory matrix had 10 rows of size 256. The initial state of the memory at the beginning of each sequence was learned. The learned initial state was initialized (at the beginning of training) using an Xavier normal distribution. + +The input to the LSTM controller at each time step consisted of the image embedding corresponding to that time step and the read vector from the previous time step. At the beginning of each sequence, the read vector, read weights, and write weights were initialized to 0. Just as with the ESBN, the NTM was allowed an additional time step to process the read vector retrieved from memory after observing the final image embedding, after which $\hat { \pmb { y } }$ was generated through an output layer from the LSTM controller. + +# A.3.6 MNM + +We implemented the MNM using publicly available code released with the original publication (Munkhdalai et al., 2019). Specifically, we used the version of MNM that employs a learned local update (‘MNM-p’ in the original paper). Before passing the images in our tasks to the MNM model, we applied the same encoder and TCN procedure used for the other architectures that we tested. Other than this modification, the original implementation, including all architectural hyperparameters, was unmodified. + +# A.3.7 RN + +The RN implementation consisted of two MLPs. The first MLP (used to process all pair-wise combinations of image embeddings) had a hidden layer of size 512 and an output layer of size 256. The outputs from the first MLP were summed, and then passed to the second MLP, which had a hidden layer of size 256 and an output layer for generating $\hat { y }$ . All layers (except the output layer) used ReLU nonlinearities. All weights were initialized using a Kaiming normal distribution (except the output layer, which was initialized according to the description in A.3.2), and all biases were initialized to 0. Before passing the image embeddings to the first MLP, they were appended with a tag (an integer from 0 to $T - 1$ ) indicating their position in the input sequence. + +# A.3.8 TRN + +The TRN employs two key design decisions intended to prevent the combinatorial explosion that would naturally result from the inclusion of n-ary relations: + +1. Only considering temporally ordered, non-redundant sets (whereas the original RN considers all possible pairs of objects, including both permutations of the same pair, and the pair of each object with itself). +2. Subsampling from these sets. + +We found that it was computationally feasible to implement a TRN with ternary relations in our tasks by only using (1), without the need to subsample. Thus, our implementation considers all temporally ordered, non-redundant sets of two and three. + +Each pair of image embeddings was processed by an MLP with a hidden layer of size 512 and an output layer of size 256. The outputs of this MLP for all pairs were then summed, and processed by an additional fully-connected layer with 256 units, yielding a single vector representing all pairs. + +Each set of three image embeddings was processed by a separate MLP with the same hyperparameters (hidden layer of 512 units, output layer of 256 units). The outputs of this MLP for all sets of three were then summed, and processed by a separate fully-connected layer with 256 units, yielding a single vector representing all sets of three. + +These two vectors, representing all pairs and sets of three, were then summed and passed to an additional fully-connected layer with 256 units, and then to the output layer to generate $\hat { \pmb { y } }$ . All layers (except for the output layer) used ReLU nonlinearities. All weights in these layers were initialized using a Kaiming normal distribution, and all biases were initialized to 0. + +Just as with the RN, we append the image embeddings with a tag indicating their position in the sequence before passing them to the first MLP in the TRN. + +# A.3.9 TRANSFORMER + +The Transformer implementation consisted of a single Transformer encoder layer. We also experimented with 2- and 3-layer Transformers but these did not generalize as well as the 1-layer Transformer in the tasks that we studied. Positional encoding (as described by Vaswani et al. (2017)) was applied to the sequence of image embeddings, which were then passed to the Transformer layer. The self-attention layer had 8 heads. The MLP had a single hidden layer with 512 units, and used ReLU nonlinearities. Residual connections and layer normalization (Ba et al., 2016b) were used following both the self-attention layer and the MLP. The self-attention weights (for generating the keys, queries, and values) were initialized using an Xavier normal distribution. The MLP weights were initialized using a Kaiming normal distribution. + +After applying the Transformer layer, the (transformed) embeddings were averaged and passed to an output MLP. The output MLP had a single hidden layer with 256 units, and an output layer for generating $\hat { \pmb { y } }$ . The hidden layer used ReLU nonlinearities, and the weights were initialized using a Kaiming normal distribution. All biases were initialized to 0. + +# A.3.10 PREDINET + +The PrediNet implementation was as close as possible to the model described in the original work (Shanahan et al., 2019), except that the multi-head attention was applied over the 1D temporal sequence of image embeddings, rather than over a 2D feature map (since there was no spatial component to the tasks that we studied). Before being passed to the PrediNet module, the image embeddings were appended with a tag (an integer from 0 to $T - 1 \dot s$ ) indicating their temporal position. The PrediNet module used keys of size 16, 32 heads, and 16 relations. All weights in the PrediNet module were initialized using an Xavier normal distribution. + +The output of all PrediNet heads was concatenated and passed to an output MLP. This MLP had a single hidden layer with 8 units, and an output layer for generating $\hat { \boldsymbol y }$ . The hidden layer used ReLU nonlinearities, and the weights were initialized using a Kaiming normal distribution. All biases were initialized to 0. + +# A.4 TRAINING DETAILS + +Table 5: Learning rates for all models trained without TCN. + +
Same/differentRMTSDistribution-of-threeIdentity rules
ESBN5e-55e-55e-55e-5
Transformer5e-45e-45e-45e-4
NTM5e-45e-45e-45e-4
MNM5e-45e-45e-45e-4
LSTM5e-45e-45e-45e-4
PrediNet5e-45e-45e-55e-5
RN5e-45e-55e-45e-4
+ +All models were trained with a batch size of 32 using the ADAM optimizer (Kingma & Ba, 2014). The learning rate for all models trained with TCN was $5 e ^ { - } 4$ . Some of the models failed to converge when trained without TCN, requiring a smaller learning rate of $5 e ^ { - } 5$ . The learning rates used for all models when trained without TCN are shown in Table 5. + +Because different generalization regimes (different values for $m$ ) involved different training set sizes, and therefore involved fewer training updates per epoch, the number of training epochs required to reliably achieve convergence varied based on the regime. The default number of training epochs for all tasks and regimes is shown in Table 6. + +Some models required additional training on some tasks to reach convergence. The PrediNet and the RN required longer training on the distribution-of-three task (Table 7), and the PrediNet, RN, and Transformer required longer training on the identity rules task (Table 8). + +Table 6: Default number of training epochs for all tasks and regimes. + +
m=0m=50 m=85m=95m=98
Same/different505050100100
RMTS5050502001
Distribution-of-three505050150
Identity rules505050501
+ +$$ +m = 0 \quad m = 5 0 \quad m = 8 5 \quad m = 9 5 +$$ + +Table 7: Number of training epochs for the PrediNet and RN on the distribution-of-three task. + +
PrediNet100100100150
RN150150150800
+ +Table 8: Number of training epochs for the PrediNet, RN, and Transformer on the identity rules task. + +
100 100100
+ +$$ +m = 0 \quad m = 5 0 \quad m = 8 5 \quad m = 9 5 +$$ + +When training the RN on larger datasets for the distribution-of-three and identity rules tasks, the same learning rate and number of training epochs as used when training on smaller datasets was sufficient to reach convergence. + +# A.5 SUPPLEMENTARY RESULTS + +# A.5.1 RESULTS WITH AND WITHOUT TCN + +Tables 9 - 12 show the results for all models trained both with and without TCN. With the exception of the PrediNet on the same/different task, every model benefited on every task from the incorporation of TCN, in many cases substantially. Results for models trained with TCN (indicated by $^ \bullet +$ TCN’) correspond to the results presented in Figure 3 (except for the results of the PrediNet on the same/different task, for which the version of the model trained without TCN is plotted in Figure 3). + +We note that, even with a lower learning rate of $5 e ^ { - } 5$ , some models failed to converge without TCN, such as the ESBN on the same/different task, or the RN on the RMTS task. It is possible that some of these models might have performed better if we had optimized them further by training for longer or trying different learning rates, but we opted not to do that since TCN was so effective across all of the models and tasks that we studied. + +Table 9: Results for same/different task. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). + +
m=0m= 50m=85m= 95m=98
ESBN+TCN100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0
ESBN50.0 ± 0.0250.0 ± 0.050.1 ± 0.149.8 ± 0.250.1 ± 0.1
Transformer+ TCN100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.072.3 ± 5.2
Transformer100.0 ± 0.099.9 ± 0.0295.4 ± 0.673.7 ± 1.856.1 ± 1.3
NTM+ TCN100.0 ± 0.099.99 ± 0.094.9 ± 0.666.7 ± 2.553.3 ± 1.4
NTM99.0 ± 0.998.6 ± 0.384.9 ± 2.457.0 ± 2.252.5 ± 0.9
MNM+ TCN100.0 ± 0.099.95 ± 0.0397.8 ± 0.472.0 ± 2.452.3 ± 0.5
MNM98.9 ± 0.195.1 ± 1.888.6 ±1.159.1 ± 1.651.7 ± 0.7
LSTM+TCN100.0 ± 0.099.97 ± 0.0196.9 ± 0.369.4 ± 1.554.8 ± 1.1
LSTM88.2 ±3.297.0 ± 0.585.5 ± 2.461.8 ± 1.756.5 ± 1.6
PrediNet+ TCN100.0 ± 0.099.7 ± 0.196.0 ± 1.367.2 ± 2.961.6 ± 2.3
PrediNet100.0 ± 0.099.9 ± 0.0397.0 ± 0.490.0 ± 1.668.5 ± 2.8
RN + TCN100.0 ± 0.0100.0 ± 0.0100.0 ± 0.099.9 ± 0.0466.8 ± 6.6
RN99.98 ± 0.0298.5 ± 0.453.2 ±1.450.5 ± 0.252.3 ± 0.7
+ +Table 10: Results for relational match-to-sample task. Results reflect test accuracy averaged over 10 trained networks ( $\pm$ the standard error of the mean). + +
m=0m= 50m= 85m= 95
ESBN+TCN100.0 ± 0.0100.0 ± 0.0100.0 ± 0.095.0 ± 0.7
ESBN86.4 ± 6.169.4 ± 6.550.0 ± 0.151.0 ± 0.5
Transformer100.0 ± 0.099.98 ± 0.0199.1 ± 0.479.8 ± 2.5
Transformer99.4 ± 0.196.8 ± 0.786.4 ± 1.949.9 ± 0.2
NTM+TCN100.0 ± 0.099.97 ± 0.0196.8 ± 0.580.1 ± 2.3
NTM99.5 ± 0.192.5 ± 4.781.2 ± 1.550.1 ± 0.2
MNM+TCN99.99 ± 0.099.9 ± 0.0398.7 ± 0.350.0 ± 0.2
MNM74.6 ± 7.663.6 ± 5.778.3 ± 3.750.0 ± 0.2
LSTM+ TCN99.99 ± 0.099.8 ± 0.0394.9 ± 1.360.7 ± 3.7
LSTM99.1 ± 0.390.2 ± 2.080.9 ± 1.150.2 ± 0.1
PrediNet+TCN99.7 ± 0.199.6 ± 0.194.6 ± 2.268.4 ± 2.7
PrediNet54.9 ± 4.750.1 ± 0.265.9 ± 3.749.7 ± 0.2
RN+TCN100.0 ± 0.099.99 ± 0.099.5 ± 0.379.6 ± 2.1
RN50.1 ± 0.249.9 ± 0.250.2 ± 0.250.0 ± 0.1
+ +Table 11: Results for distribution-of-three task. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). + +
m=0m= 50m= 85 m= 95
ESBN+TCN98.7 ± 0.499.0 ± 0.399.5 ± 0.2 99.7 ± 0.1
ESBN99.98 ± 0.097.4 ± 0.292.4 ± 1.1 62.0 ± 4.0
Transformer+ TCN88.7 ± 2.695.0 ± 1.292.7 ± 1.5 32.1 ± 1.0
Transformer62.1 ± 3.368.6 ± 3.6 72.6 ± 4.428.0 ± 0.8
NTM+TCN95.5 ± 0.495.2 ± 0.494.3 ± 0.8 34.0 ± 0.5
NTM92.9 ± 0.587.1 ± 1.478.2 ± 1.4 26.7 ± 0.3
MNM+ TCN94.7 ± 0.393.6 ± 0.4 90.6 ± 0.732.2 ± 0.6
MNM58.5 ± 8.968.7 ± 6.2 48.4 ± 5.525.6 ± 0.3
LSTM+TCN96.0 ± 0.694.8 ± 0.592.9 ± 0.8 34.8 ± 0.8
LSTM91.3 ± 0.685.3 ± 1.571.6 ± 4.3 27.5 ± 0.3
PrediNet+TCN95.2 ± 0.394.6 ± 0.493.3 ± 0.9 27.8 ± 0.5
PrediNet75.1 ± 3.065.7 ± 7.478.0 ± 6.0 25.7 ± 0.1
RN+TCN35.6 ± 3.050.6 ± 7.672.2 ± 6.8 26.5 ± 0.3
RN25.1 ± 0.124.9 ± 0.1 25.7 ± 0.325.2 ± 0.1
+ +Table 12: Results for identity rules task. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). + +
m=0m= 50m=85m= 95
ESBN+TCN99.6 ± 0.299.6 ± 0.199.9 ± 0.0499.2 ± 0.4
ESBN100.0 ± 0.099.4 ± 0.197.8 ± 0.295.2 ± 0.4
Transformer+ TCN98.3 ± 0.797.1 ± 1.092.0 ±1.767.1 ± 2.4
Transformer75.5 ± 4.171.6 ± 5.185.4 ± 4.638.6 ± 2.2
NTM+TCN98.2 ± 0.697.8 ± 0.593.9 ± 0.664.9 ± 1.2
NTM94.6 ± 0.390.1 ± 0.882.2 ± 1.225.0 ± 0.1
MNM+TCN95.2 ± 0.493.8 ± 0.490.8 ± 0.561.5 ± 1.5
MNM70.9 ± 10.269.5 ± 9.749.8 ± 8.424.9 ± 0.2
LSTM+TCN98.9 ± 0.197.7 ± 0.392.1 ± 0.762.5 ± 1.1
LSTM93.8 ± 0.589.3 ± 0.673.7 ± 5.724.8 ± 0.1
PrediNet+ TCN93.0 ± 0.892.8 ± 0.789.8 ± 0.859.9 ± 2.6
PrediNet40.8 ± 0.440.5 ± 1.940.3 ± 2.232.2 ± 0.6
RN+ TCN41.5 ± 6.740.2 ± 1.048.7 ± 2.041.4 ± 2.0
RN41.1 ± 7.237.3 ± 3.431.6 ± 2.825.4 ± 0.4
+ +# A.5.2 PERFORMANCE OF RN ON TERNARY RELATIONS + +Table 13 shows the results for the RN (w/ TCN) on the distribution-of-three and identity rules tasks when trained on larger training sets $1 0 ^ { 5 }$ instead of $1 0 ^ { 4 }$ training examples). These results show that with more training data, the RN, which is biased toward processing pair-wise relations, is able to learn these tasks (which are based on ternary relations) in a manner that enables some degree of generalization. Note that these results do not include the $m = 9 5$ regime, because there are not enough images in that regime to create larger training sets than were originally used. + +Table 13: Results for the RN on the distribution-of-three and identity rules tasks when trained on a larger training set. Results reflect test accuracy averaged over 10 trained networks ( $\pm$ the standard error of the mean). + +
m=0m= 50m=85
Distribution-of-three84.5 ± 10.084.6 ± 9.972.4 ± 9.7
Identity rules89.2 ± 5.099.7 ± 0.186.6 ± 4.1
+ +We also tested the TRN, which incorporates ternary relations through subsampling, on these tasks (with the standard training set size of $1 0 ^ { 4 }$ training examples). Table 14 shows the results. This yielded a slight improvement over the RN (when trained on $1 0 ^ { 4 }$ training examples), though not as much of an improvement as resulted from training the RN with a larger training set. This result may seem surprising given that the TRN explicitly incorporates ternary relations. We note two possible explanations for this result: + +1. The systematic comparison of every pair of objects, including permutations and comparisons of each object with itself, allows the RN to take advantage of a very powerful form of data augmentation, enforcing a certain degree of systematicity in the relations that it learns. By only considering temporally ordered and non-redundant sets, the TRN is not able to take advantage of this to the same extent, and therefore might not learn relations that generalize as well. +2. The distribution-of-three and identity rules tasks both involve not only ternary sets, but the higher-order comparison of multiple pairs of ternary sets (the first row vs. the combination of the second row with each candidate answer). One could presumably engineer a solution to this problem within the RN framework, but we take it as a strength of the ESBN that no such special engineering is necessary in this case. + +Table 14: Results for the TRN on the distribution-of-three and identity rules tasks. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). +A.5.3 TRAINING TIME COURSES FOR SAME/DIFFERENT TASK + +
m=0m= 50m= 85m = 95
Distribution-of-three60.2±5.4 77.5±5.7 88.7±0.8327.8±0.5
Identity rules40.3 ± 2.0 43.6± 2.052.8 ± 2.744.9 ± 1.0
+ +Figure 5 shows the training time courses for all models on the same/different task. Unlike the other three tasks we studied (for which training time courses are shown in Figure 4), all models were able to learn this task within a few hundred training updates (though all models except the ESBN failed to generalize in the most extreme regime). + +# A.5.4 ALTERNATIVE ENCODER ARCHITECTURES + +In order to determine whether the systematic generalization exhibited by the ESBN depended to some extent on the convolutional layers in its encoder, we performed experiments with two alternative encoder architectures: a multilayer perceptron (MLP) encoder, and a random projection. + +![](images/aaa7fb6a3176c2b300c4bdc9fc10c870841ebe3d2619a27cc2e4ec70c2d07eb7.jpg) +Figure 5: Training accuracy time courses on $m = 0$ regime of the same/different task. Each time course reflects an average over 10 trained networks. Error bars reflect the standard error of the mean. + +![](images/c366872be7b0df16e430db884b2883ef8a8ba7fd1f3bd25e27dc986eb9ad5467.jpg) +Figure 6: Results for all four tasks with convolutional (conv), multilayer perceptron (MLP), or random (rand) encoders. Results reflect test accuracy averaged over 10 trained networks ( $\pm$ the standard error of the mean). + +The MLP encoder consisted of 3 fully-connected layers, with 512, 256, and 128 units, each of which used ReLU nonlinearities. All weights were initialized using a Kaiming normal distribution, and all biases were set to 0. + +The random projection encoder involved only a single, untrained, fully-connected layer that projected from the flattened image to 128 units, followed by a ReLU nonlinearity. Weights were sampled from a Kaiming normal distribution, and biases were set to 0. + +Figure 6 and Tables 15 - 18 show the results for these experiments, along with the original version of the model (with a convolutional encoder) for comparison. To enable a fair comparison with the original model, all experiments employed TCN. The results show that the ESBN performed comparably well with all three of the encoder architectures. This was confirmed by performing paired t-tests on the average test accuracy in each task/generalization condition (each combination of task and value of $m$ ) for the MLP vs. convolutional encoder $t = - 1 . 7$ , $p = 0 . 1$ ) and for the random vs. convolutional encoder $t = 1 . 6$ , $p = 0 . 1 3$ ). + +For comparison, we also performed experiments with these alternative encoders in the Transformer architecture. These experiments revealed that, in contrast with the ESBN, the Transformer’s performance was significantly impaired by the use of a random vs. convolutional encoder $( t = - 4 . 0$ , $p = 0 . 0 0 1 )$ , though it appeared to perform comparably well with an MLP vs. convolutional encoder $t = - 1 . 6$ , $p = 0 . 1 4 )$ ). + +Table 15: Results for same/different task with convolutional (conv), multilayer perceptron (MLP), or random (rand) encoders. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). + +
m=0m= 50m=85m=95m=98
ESBN (conv)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0
ESBN (MLP)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0
ESBN (rand)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0
Transformer (conv)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.072.3 ± 5.2
Transformer (MLP)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.077.6 ± 4.6
Transformer (rand)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.050.6 ± 0.3
+ +Table 16: Results for relational match-to-sample task with convolutional (conv), multilayer perceptron (MLP), or random (rand) encoders. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). + +
m=0m= 50m=85m= 95
ESBN (conv)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.095.0 ± 0.7
ESBN (MLP)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.097.2 ± 0.2
ESBN (rand)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.093.8 ± 0.4
Transformer (conv)100.0 ± 0.099.98 ± 0.0199.1 ± 0.479.8 ± 2.5
Transformer (MLP)100.0 ± 0.0100.0 ± 0.099.9 ± 0.173.6 ± 5.3
Transformer (rand)99.99 ± 0.0199.9 ± 0.0495.4 ± 3.246.8 ± 1.7
+ +Table 17: Results for distribution-of-three task with convolutional (conv), multilayer perceptron (MLP), or random (rand) encoders. Results reflect test accuracy averaged over 10 trained networks ( $\pm$ the standard error of the mean). + +
m=0m= 50m=85m= 95
ESBN (conv)98.7 ± 0.499.0 ± 0.399.5 ± 0.299.7 ± 0.1
ESBN (MLP)99.0 ± 0.198.4 ± 0.398.0 ± 0.395.9 ± 0.5
ESBN (rand)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0
Transformer (conv)88.7 ± 2.695.0 ± 1.292.7 ± 1.532.1 ± 1.0
Transformer (MLP)92.7 ± 2.193.3 ± 1.592.1 ± 0.835.3 ± 1.2
Transformer (rand)66.0 ± 6.280.8 ± 2.560.9 ± 2.426.9 ± 0.4
+ +Table 18: Results for identity rules task with convolutional (conv), multilayer perceptron (MLP), or random (rand) encoders. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). + +
m=0m= 50m= 85m= 95
ESBN (conv.)99.6 ± 0.299.6 ± 0.199.9 ± 0.0499.2 ± 0.4
ESBN (MLP)99.3 ± 0.298.6 ± 0.397.7 ± 0.495.5 ± 1.0
ESBN (random)100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0100.0 ± 0.0
Transformer (conv.)98.3 ± 0.797.1 ± 1.092.0 ±1.767.1 ± 2.4
Transformer (MLP)85.5 ± 4.084.8 ± 3.886.4 ± 2.359.8 ± 1.5
Transformer (random)47.8 ±1.151.4 ± 1.948.6 ±1.127.5 ± 0.6
+ +# A.5.5 CONFIDENCE ABLATION EXPERIMENT + +In order to determine the importance of the confidence values appended to retrieved memories, we tested a version of the ESBN without these confidence values. These results are shown in Table 19 and Figure 7. The ablation of confidence values prevented the ESBN from being able to perform the same/different task at all, and resulted in much slower training on the RMTS task. By contrast, ablation of confidence values did not affect performance, either in terms of generalization or training time, for the distribution-of-three or identity rules tasks. This can be explained by the fact that these tasks only require the retrieval of the best match from memory, whereas the same/different and RMTS tasks require the model to know how good of a match the best match is, which is precisely the information conveyed by confidence values. + +Table 19: Results for the confidence ablation experiment. Results reflect test accuracy averaged over 10 trained networks $\pm$ the standard error of the mean). + +
m=0m= 50m= 85m= 95m= 98
Same/different50.0 ± 0.0250.0 ± 0.050.0 ± 0.0549.8 ± 0.150.0 ± 0.1
RMTS99.95 ± 0.0199.9 ± 0.0299.9 ± 0.0296.0 ± 0.6
Distribution-of-three99.2 ± 0.299.0 ± 0.399.5 ± 0.399.8 ± 0.1
Identity rules99.6 ± 0.199.6 ± 0.299.8 ± 0.199.2 ± 0.2
+ +![](images/4f3140e98ad78df5a251cc44698547758bc2b3dc25ada989b5a077dd22f67752.jpg) +Figure 7: Training accuracy time courses for the ESBN model without confidence values on the $m = 0$ regime, shown with the time courses for all other models for comparison. Each time course reflects an average over 10 trained networks. Error bars reflect the standard error of the mean. + +It is also worth noting one potential alternative to an explicit, inbuilt confidence value. In our implementation, the ESBN’s memory is empty at the beginning of each sequence that it processes. However, when multiple entries are present in memory, as will generally be the case in realistic, temporally extended settings, the presentation of a previously unseen item will result in the retrieval of a mixture of (weakly matched) memories. This mixed representation can therefore serve as a reliable cue for the degree to which the current percept matches a stored memory, obviating the need for an explicit confidence value. To demonstrate this, we implemented a version of the ESBN that begins each sequence with a single, learned key/value entry stored in memory (initialized to 0 at the beginning of training). Table 20 shows that this approach allows the ESBN to learn and perfectly generalize on the same/different task. Figure 8 shows that this approach allows the ESBN to retain the short training time of the original model on the RMTS task. + +Table 20: Results on the same/different task for the ESBN model with a learned default memory instead of confidence values. Results reflect test accuracy averaged over 10 trained networks ( $\pm$ the standard error of the mean). + +![](images/c31ae8d2cb9633c10939d6f607f5e27e2afb3fd53d987d9a72940c252af1aef8.jpg) +Figure 8: Training accuracy time courses on $m = 0$ regime of the RMTS task for the ESBN model with a learned default memory instead of confidence values. Each time course reflects an average over 10 trained networks. Error bars reflect the standard error of the mean. + +![](images/ca9d748d252c788908ecf5de7247e9e4f232304204241105a959dc8695758a69.jpg) +Figure 9: Representations learned by ESBN (projected along first two principal components). (a) Keys written to memory during time steps 1-9 (training set). (b) Keys written to memory during time steps 1-3 (training set vs. test set). (c) Keys retrieved from memory following second appearance of objects that first appeared during time steps 1-3 (training set vs. test set). + +To better understand how the ESBN works, we performed an analysis of the representations that it learned on the distribution-of-three task. Specifically, we performed an analysis of a network trained on the most difficult generalization regime $( m = 9 5 $ ), by performing principal component analysis (PCA) on all key vectors written to and retrieved from memory for both the training and test sets, and visualizing these vectors along the first two principal components. + +First, we looked at the keys that were written to memory $( k _ { w } )$ . We found that the keys for the first three time steps were tightly clustered, whereas the keys for the subsequent time steps (4-9) were more diffuse (Figures 9a and 9b). This makes sense because, in the distribution-of-three task, the ESBN only needs to be able to reliably retrieve what it wrote during the first three time steps (when the objects in the first row were presented). For time steps 4-9, the only important consideration is that the keys written to memory not overlap with those written during the first three time steps, which also appears to be the case. + +Second, we compared the keys written to memory for the first three time steps in the training vs. test sets (Figure 9b). This revealed that, for a given time step, the keys written to memory in the training vs. test sets were remarkably similar (so much so that they are completely overlapping for time steps 1 and 2). + +Third, we looked at the keys that were retrieved from memory following the second appearance of the objects that appeared on time steps 1-3. We found that 1) these closely matched the distribution of keys written to memory during time steps 1-3, and 2) these were highly overlapping for the training vs. test sets (Figure 9c). + +Taken together, these results help to explain why the ESBN was so successful in this generalization regime, despite the very small degree of overlap between the distribution of training and test images. Because the ESBN’s controller was relatively isolated from the part of the model that deals with image embeddings, it was able to learn to encode abstract symbol-like representations (such as ‘first image’, ‘second image’, and ‘third image’), that did not depend on the identity of the images. Then, when queried with an image, was able to successfully retrieve the image’s corresponding abstract encoding, even when that image was quite different than those observed during training. That is, the model learned representations to use as keys that could be used for binding and indirection in the same way that symbols are used in traditional computational architectures. + +# A.7 UNICODE CHARACTERS + +Figure 10 shows all 100 images that were used to construct the abstract rule learning tasks. + +![](images/887b1ae25cca3a239fbf94d507ce08a8916ce532f8964e7f75552108e7422ff2.jpg) +Figure 10 \ No newline at end of file diff --git a/md/train/LU687itn08w/LU687itn08w.md b/md/train/LU687itn08w/LU687itn08w.md new file mode 100644 index 0000000000000000000000000000000000000000..a0274eca2ee9967c2c9cd932a505db9ce184a1ec --- /dev/null +++ b/md/train/LU687itn08w/LU687itn08w.md @@ -0,0 +1,342 @@ +# Offline RL Without Off-Policy Evaluation + +# David Brandfonbrener + +William F. Whitney + +Rajesh Ranganath + +# Joan Bruna + +Department of Computer Science, Center for Data Science New York University david.brandfonbrener@nyu.edu + +# Abstract + +Most prior approaches to offline reinforcement learning (RL) have taken an iterative actor-critic approach involving off-policy evaluation. In this paper we show that simply doing one step of constrained/regularized policy improvement using an on-policy Q estimate of the behavior policy performs surprisingly well. This onestep algorithm beats the previously reported results of iterative algorithms on a large portion of the D4RL benchmark. The one-step baseline achieves this strong performance while being notably simpler and more robust to hyperparameters than previously proposed iterative algorithms. We argue that the relatively poor performance of iterative approaches is a result of the high variance inherent in doing off-policy evaluation and magnified by the repeated optimization of policies against those estimates. In addition, we hypothesize that the strong performance of the one-step algorithm is due to a combination of favorable structure in the environment and behavior policy. + +# 1 Introduction + +An important step towards effective real-world RL is to improve sample efficiency. One avenue towards this goal is offline RL (also known as batch RL) where we attempt to learn a new policy from data collected by some other behavior policy without interacting with the environment. Recent work in offline RL is well summarized by Levine et al. [2020]. + +In this paper, we challenge the dominant paradigm in the deep offline RL literature that primarily relies on actor-critic style algorithms that alternate between policy evaluation and policy improvement [Fujimoto et al., 2018a, 2019, Peng et al., 2019, Kumar et al., 2019, 2020, Wang et al., 2020b, Wu et al., 2019, Kostrikov et al., 2021, Jaques et al., 2019, Siegel et al., 2020, Nachum et al., 2019]. All these algorithms rely heavily on off-policy evaluation to learn the critic. Instead, we find that a simple baseline which only performs one step of policy improvement using the behavior Q function often outperforms the more complicated iterative algorithms. Explicitly, we find that our one-step algorithm beats prior results of iterative algorithms on most of the gym-mujoco [Brockman et al., 2016] and Adroit [Rajeswaran et al., 2017] tasks in the the D4RL benchmark suite [Fu et al., 2020]. + +We then dive deeper to understand why such a simple baseline is effective. First, we examine what goes wrong for the iterative algorithms. When these algorithms struggle, it is often due to poor off-policy evaluation leading to inaccurate Q values. We attribute this to two causes: (1) distribution shift between the behavior policy and the policy to be evaluated, and (2) iterative error exploitation whereby policy optimization introduces bias and dynamic programming propagates this bias across the state space. We show that empirically both issues exist in the benchmark tasks and that one way to avoid these issues is to simply avoid off-policy evaluation entirely. + +Finally, we recognize that while the the one-step algorithm is a strong baseline, it is not always the best choice. In the final section we provide some guidance about when iterative algorithms can perform better than the simple one-step baseline. Namely, when the dataset is large and behavior policy has good coverage of the state-action space, then off-policy evaluation can succeed and iterative algorithms can be effective. In contrast, if the behavior policy is already fairly good, but as a result does not have full coverage, then one-step algorithms are often preferable. + +![](images/cf6e42d2a672364d97aa78052a83104499bb9082e0e6b593f15addb41a4cfc26.jpg) +Figure 1: A cartoon illustration of the difference between one-step and multi-step methods. All algorithms constrain themselves to a neighborhood of “safe” policies around $\beta$ . A one-step approach (left) only uses the on-policy ${ \widehat Q } ^ { \beta }$ , while a multi-step approach (right) repeatedly uses off-policy $\widehat { Q } ^ { \pi _ { i } }$ . + +Our main contributions are: + +• A demonstration that a simple baseline of one step of policy improvement outperforms more complicated iterative algorithms on a broad set of offline RL problems. • An examination of failure modes of off-policy evaluation in iterative offline RL algorithms. • A description of when one-step algorithms are likely to outperform iterative approaches. + +# 2 Setting and notation + +We will consider an offline RL setup as follows. Let $\mathcal { M } = \{ { S } , \mathcal { A } , \rho , P , R , \gamma \}$ be a discounted infinitehorizon MDP. In this work we focus on applications in continuous control, so we will generally assume that both $s$ and $\mathcal { A }$ are continuous and bounded. We consider the offline setting where rather than interacting with $\mathcal { M }$ , we only have access to a dataset $D _ { N }$ of $N$ tuples of $\left( { { s _ { i } } , { a _ { i } } , { r _ { i } } } \right)$ collected by some behavior policy $\beta$ with initial state distribution $\rho$ . Let $r ( s , a ) = \mathbb { E } _ { r \mid s , a } [ r ]$ be the expected reward. Define the state-action value function for any policy $\pi$ by $Q ^ { \pi } ( s , a ) : = \mathbb { E } _ { P , \pi | s _ { 0 } = s }$ , $\begin{array} { r } { { \bf \Gamma } _ { a _ { 0 } = a } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) ] } \end{array}$ The objective is to maximize the expected return $J$ of the learned policy: + +$$ +J ( \pi ) : = \underset { \rho , P , \pi } { \mathbb { E } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] = \underset { a \sim \pi | s } { \mathbb { E } } \left[ Q ^ { \pi } ( s , a ) \right] . +$$ + +Following $\mathrm { F u }$ et al. [2020] and others in this line of work, we allow access to the environment to tune a small $( < 1 0 )$ set of hyperparameters. See Paine et al. [2020] for a discussion of the active area of research on hyperparameter tuning for offline RL. We also discuss this further in Appendix $\textrm { C }$ . + +# 3 Related work + +Iterative algorithms. Most prior work on deep offline RL consists of iterative actor-critic algorithms. The primary innovation of each paper is to propose a different mechanism to ensure that the learned policy does not stray too far from the data generated by the behavior policy. Broadly, we group these methods into three camps: policy constraints/regularization, modifications of imitation learning, and Q regularization: + +1. The majority of prior work acts directly on the policy. Some authors have proposed explicit constraints on the learned policy to only select actions where $( s , a )$ has sufficient support under the data generating distribution [Fujimoto et al., 2018a, 2019, Laroche et al., 2019]. Another proposal is to regularize the learned policy towards the behavior policy [Wu et al., 2019] usually either with a KL divergence [Jaques et al., 2019] or MMD [Kumar et al., 2019]. This is a very straighforward way to stay close to the behavior with a hyperparameter that determines just how close. All of these algorithms are iterative and rely on off-policy evaluation. + +2. Siegel et al. [2020], Wang et al. [2020b], Chen et al. [2020] all use algorithms that filter out datapoints with low Q values and then perform imitation learning. Wang et al. [2018], Peng et al. [2019] use a weighted imitation learning algorithm where the weights are determined by exponentiated Q values. These algorithms are iterative. + +3. Another way to prevent the learned policy from choosing unknown actions is to incorporate some form of regularization to encourage staying near the behavior and being pessimistic about unknown state, action pairs [Wu et al., 2019, Nachum et al., 2019, Kumar et al., 2020, Kostrikov et al., 2021, Gulcehre et al., 2021]. However, being able to properly quantify uncertainty about unknown states is notoriously difficult when dealing with neural network value functions [Buckman et al., 2020]. + +One-step algorithms. Some recent work has also noted that optimizing policies based on the behavior value function can perform surprisingly well. As we do, Goo and Niekum [2020] studies the continuous control tasks from the D4RL benchmark, but they examine a complicated algorithm involving ensembles, distributional Q functions, and a novel regularization technique. In contrast, we analyze a substantially simpler algorithm and get better performance on the D4RL tasks. We also focus more of our contribution on understanding and explaining this performance. Gulcehre et al. [2021] studies the discrete action setting and finds that a one-step algorithm (which they call “behavior value estimation”) outperforms prior work on Atari games and other discrete action tasks from the RL Unplugged benchmark [Gulcehre et al., 2020]. They also introduce a novel regularizer for the evaluation step. In contrast, we consider the continuous control setting. This is a substantial difference in setting since continuous control requires actor-critic algorithms with parametric policies while in the discrete setting the policy improvement step can be computed exactly from the Q function. Moreover, while Gulcehre et al. [2021] attribute the poor performance of iterative algorithms to “overestimation”, we define and separate the issues of distribution shift and iterative error exploitation which can combine to cause overestimation. This separation helps to expose the difference between the fundamental limits of off-policy evaluation from the specific problems induced by iterative algorithms, and will hopefully be a useful distinction to inspire future work. Finally, a one-step variant is also briefly discussed in Nadjahi et al. [2019], but is not the focus of that work. + +There are also important connections between the one-step algorithm and the literature on conservative policy improvement [Kakade and Langford, 2002, Schulman et al., 2015, Achiam et al., 2017], which we discuss in more detail in Appendix B. + +# 4 Defining the algorithms + +In this section we provide a unified algorithmic template for model-free offline RL algorithms as offline approximate modified policy iteration. We show how this template captures our one-step algorithm as well as a multi-step policy iteration algorithm and an iterative actor-critic algorithm. Then any choice of policy evaluation and policy improvement operators can be used to define one-step, multi-step, and iterative algorithms. + +# 4.1 Algorithmic template + +# Algorithm 1: OAMPI + +We consider a generic offline approximate modified policy iteration (OAMPI) scheme, shown in Algorithm 1 (and based off of Puterman and Shin [1978], Scherrer et al. [2012]). Essentially the algorithm alternates between two steps. First, there is a policy evaluation step where we estimate the Q function of the cur + +input : $K$ , dataset $D _ { N }$ , estimated behavior $\hat { \beta }$ +Set $\pi _ { 0 } = \hat { \beta }$ . Initialize $\widehat { Q } ^ { \pi _ { - 1 } }$ randomly. +for $k = I$ , . . . , $K$ do Policy evaluation: $\widehat { Q } ^ { \pi _ { k - 1 } } = \mathcal { E } ( \pi _ { k - 1 } , D _ { N } , \widehat { Q } ^ { \pi _ { k - 2 } } )$ Policy improvement: $\pi _ { k } = \mathcal { I } ( \widehat { Q } ^ { \pi _ { k - 1 } } , \widehat { \beta } , D _ { N } , \pi _ { k - 1 } )$ +end + +rent policy $\pi _ { k - 1 }$ by $\widehat { Q } ^ { \pi _ { k - 1 } }$ using only the dataset $D _ { N }$ . Implementations also often use the prior $\mathrm { Q }$ estimate $\widehat { Q } ^ { \pi _ { k - 2 } }$ to warm-start the approximation process. Second, there is a policy improvement step. This step takes in the estimated $\mathrm { Q }$ function $\widehat { Q } ^ { \pi _ { k - 1 } }$ , the estimated behavior $\hat { \beta }$ , and the dataset $D _ { N }$ and produces a new policy $\pi _ { k }$ . Again an algorithm may use $\pi _ { k - 1 }$ to warm-start the optimization. Moreover, we expect this improvement step to be regularized or constrained to ensure that $\pi _ { k }$ remains in the support of $\beta$ and $D _ { N }$ . Choices for this step are discussed below. Now we discuss a few ways to instantiate the template. + +One-step. The simplest algorithm sets the number of iterations $K = 1$ . We learn $\hat { \beta }$ by maximum likelihood and train the policy evaluation step to estimate $Q ^ { \beta }$ . Then we use any one of the policy improvement operators discussed below to learn $\pi _ { 1 }$ . Importantly, this algorithm completely avoids off-policy evaluation. + +Multi-step. The multi-step algorithm now sets $K > 1$ . The evaluation operator must evaluate off-policy since $D _ { N }$ is collected by $\beta$ , but evaluation steps for $K \geq 2$ require evaluating policies $\pi _ { k - 1 } \neq \beta$ . Each iteration is trained to convergence in both the estimation and improvement steps. + +Iterative actor-critic. An actor critic approach looks somewhat like the multi-step algorithm, but does not attempt to train to convergence at each iteration and uses a much larger $K$ . Here each iteration consists of one gradient step to update the Q estimate and one gradient step to improve the policy. Since all of the evaluation and improvement operators that we consider are gradient-based, this algorithm can adapt the same evaluation and improvement operators used by the multi-step algorithm. Most algorithms from the literature fall into this category [Fujimoto et al., 2018a, Kumar et al., 2019, 2020, Wu et al., 2019, Wang et al., 2020b, Siegel et al., 2020]. + +# 4.2 Policy evaluation operator + +Following prior work on continuous state and action problems, we always evaluate by simple fitted Q evaluation [Fujimoto et al., 2018a, Kumar et al., 2019, Siegel et al., 2020, Wang et al., 2020b, Paine et al., 2020, Wang et al., 2021]. In practice this is optimized by TD-style learning with the use of a target network [Mnih et al., 2015] as in DDPG [Lillicrap et al., 2015]. We do not use any double Q learning or Q ensembles [Fujimoto et al., 2018b]. For the one-step and multi-step algorithms we train the evaluation procedure to convergence on each iteration and for the iterative algorithm each iteration takes a single stochastic gradient step. See Voloshin et al. [2019], Wang et al. [2021] for more comprehensive examinations of policy evaluation and some evidence that this simple fitted Q iteration approach is reasonable. It is an interesting direction for future work to consider other operators that use things like importance weighting [Munos et al., 2016] or pessimism [Kumar et al., 2020, Buckman et al., 2020]. + +# 4.3 Policy improvement operators + +To instantiate the template, we also need to choose a specific policy improvement operator $\mathcal { T }$ . We consider the following improvement operators selected from those discussed in the related work section. Each operator has a hyperparameter controlling deviation from the behavior policy. + +Behavior cloning. The simplest baseline worth including is to just return $\hat { \beta }$ as the new policy $\pi$ Any policy improvement operator ought to perform at least as well as this baseline. + +Constrained policy updates. Algorithms like BCQ [Fujimoto et al., 2018a] and SPIBB [Laroche et al., 2019] constrain the policy updates to be within the support of the data/behavior. In favor of simplicity, we implement a simplified version of the BCQ algorithm that removes the “perturbation network” which we call Easy BCQ. We define a new policy $\hat { \pi } _ { k } ^ { M }$ by drawing $M$ samples from $\hat { \beta }$ and then executing the one with the highest value according to ${ \widehat Q } ^ { \beta }$ . Explicitly: + +$$ +\hat { \pi } _ { k } ^ { M } ( a | s ) = \mathbb { 1 } [ a = \arg \operatorname* { m a x } _ { a _ { j } } \{ \widehat { Q } ^ { \pi _ { k - 1 } } ( s , a _ { j } ) : a _ { j } \sim \pi _ { k - 1 } ( \cdot | s ) , 1 \leq j \leq M \} ] . +$$ + +Regularized policy updates. Another common idea proposed in the literature is to regularize towards the behavior policy [Wu et al., 2019, Jaques et al., 2019, Kumar et al., 2019]. For a general divergence $D$ we can define an algorithm that maximizes a regularized objective: + +$$ +\hat { \pi } _ { k } ^ { \alpha } = \arg \operatorname* { m a x } _ { \pi } \sum _ { i } \underset { a \sim \pi | s } { \mathbb { E } } \big [ \widehat { Q } ^ { \pi _ { k - 1 } } ( s _ { i } , a ) \big ] - \alpha D ( \hat { \beta } ( \cdot | s _ { i } ) , \pi ( \cdot | s _ { i } ) ) +$$ + +A comprehensive review of different variants of this method can be found in $\mathrm { W u }$ et al. [2019] which does not find dramatic differences across regularization techniques. In practice, we will use reverse KL divergence, i.e. $K L ( \pi ( \cdot | s _ { i } ) | | \hat { \beta } ( \cdot | s _ { i } ) )$ . To compute the reverse KL, we draw samples from $\pi ( \cdot | s _ { i } )$ and use the density estimate $\hat { \beta }$ to compute the divergence. Intuitively, this regularization forces $\pi$ to remain within the support of $\beta$ rather than incentivizing $\pi$ to cover $\beta$ . + +Variants of imitation learning. Another idea, proposed by [Wang et al., 2018, Siegel et al., 2020, Wang et al., 2020b, Chen et al., 2020] is to modify an imitation learning algorithm either by filtering or weighting the observed actions to incentivize policy improvement. The weighted version that we implement uses exponentiated advantage estimates to weight the observed actions: + +$$ +\hat { \pi } _ { k } ^ { \tau } = \arg \operatorname* { m a x } _ { \pi } \sum _ { i } \exp ( \tau ( \widehat { Q } ^ { \pi _ { k - 1 } } ( s _ { i } , a _ { i } ) - \widehat { V } ( s _ { i } ) ) ) \log \pi ( a _ { i } | s _ { i } ) . +$$ + +With these definitions, we can now move on to testing various combinations of algorithmic template (one-step, multi-step, or iterative) and improvement operator (Easy BCQ, reverse KL regularization, or exponentially weighted imitation). + +# 5 Benchmark Results + +Our main empirical finding is that one step of policy improvement is sufficient to beat state of the art results on much of the D4RL benchmark suite [Fu et al., 2020]. This is striking since prior work focuses on iteratively estimating the Q function of the current policy iterate, but we only use one step derived from ${ \widehat Q } ^ { \beta }$ . Results are shown in Table 1. Full experimental details are in Appendix C and code can be found at https://github.com/davidbrandfonbrener/onestep-rl. + +Table 1: Results of one-step algorithms on the D4RL benchmark. The first column gives the best results across several iterative algorithms considered in Fu et al. [2020]. Each algorithm is tuned over 6 values of their respective hyperparameter. We report the mean and standard error over 10 seeds of the training process and using 100 evaluation episodes per seed. We bold the best result on each dataset and blue any result where a one-step algorithm beat the best reported iterative result from Fu et al. [2020]. We use m for medium, m-e for medium-expert, m-re for medium-replay, r for random, and c for cloned. + +
IterativeOne-step
Fu et al. [2020]BCEasy BCQRev. KL RegExp.Weight
halfcheetah-m46.342.1 ± 0.152.6 ± 0.155.6 ± 0.248.6± 0.0
walker2d-m81.170.2 ±1.386.9 ± 0.485.6 ± 0.480.3 ±1.1
hopper-m58.849.8 ± 0.669.7 ± 2.183.3 ± 1.456.7 ± 0.8
halfcheetah-m-e64.760.1 ± 0.877.0 ± 0.993.5 ± 0.191.7 ± 0.9
walker2d-m-e111.093.6 ± 5.6111.8 ± 0.2110.9 ± 0.1112.9 ± 0.2
hopper-m-e111.948.1 ± 1.581.4 ± 1.9102.1 ± 1.383.1 ± 7.0
halfcheetah-m-re47.734.9 ± 0.338.4± 0.342.4± 0.138.6 ± 0.5
walker2d-m-re26.723.9 ± 1.666.4 ± 2.071.6 ± 3.149.3 ± 3.5
hopper-m-re48.621.2 ± 1.377.3 ± 2.771.0 ± 8.194.1 ± 2.4
halfcheetah-r35.42.2 ± 0.05.4 ± 0.16.9 ± 1.03.7± 0.2
walker2d-r7.30.7 ± 0.14.2 ± 0.26.1 ± 0.35.2 ± 0.2
hopper-r12.22.6± 0.46.7 ± 0.17.8± 0.35.6 ± 0.6
pen-c56.949.3 ± 2.267.0 ± 1.155.3 ± 1.954.7 ± 2.3
hammer-c2.10.5 ± 0.12.8 ± 0.50.2±0.01.2 ± 0.2
relocate-c-0.10.0± 0.00.3 ± 0.00.1 ± 0.00.1 ± 0.0
door-c0.40.0± 0.00.4 ± 0.20.0 ± 0.10.1 ± 0.1
+ +As we can see in the table, all of the one-step algorithms usually outperform the best iterative algorithms tested by Fu et al. [2020]. The one notable exception is the case of random data (especially on halfcheetah), where iterative algorithms have a clear advantage. We will discuss potential causes of this further in Section 7. + +To give a more direct comparison that controls for any potential implementation details, we use our implementation of reverse KL regularization to create multi-step and iterative algorithms. We are not using algorithmic modifications like Q ensembles, regularized Q values, or early stopping that have been used in prior work. But, our iterative algorithm recovers similar performance to prior regularized actor-critic approaches. These results are shown in Table 2. + +Table 2: Results of reverse KL regularization on the D4RL benchmark across one-step, multi-step, and iterative algorithms. Again we run 6 hyperparameters and report the mean and standard error across 10 seeds using 100 evaluation episodes. + +
One-stepMulti-stepIterative
halfcheetah-m55.6± 0.240.8 ± 8.647.4 ± 3.5
walker2d-m85.6 ± 0.475.9 ± 0.575.4 ± 0.8
hopper-m83.3 ± 1.453.0 ±1.054.2 ± 0.6
halfcheetah-m-e93.5 ± 0.193.6 ± 0.393.6 ± 0.2
walker2d-m-e110.9 ± 0.176.3 ± 15.9108.2 ± 0.3
hopper-m-e102.1 ± 1.3101.3 ± 3.982.7 ± 7.4
halfcheetah-r6.9 ± 1.013.7 ± 1.716.3 ± 1.6
walker2d-r6.1 ± 0.35.0±0.35.1± 0.3
hopper-r7.8 ± 0.315.4 ± 2.99.7 ± 0.1
+ +Put together, these results immediately suggest some guidance to the practitioner: it is worthwhile to run the one-step algorithm as a baseline before trying something more elaborate. The one-step algorithm is substantially simpler than prior work, but frequently achieves better performance. + +# 6 What goes wrong for iterative algorithms? + +The benchmark experiments show that one step of policy improvement often beats iterative and multi-step algorithms. In this section we dive deeper to understand why this happens. First, by examining the learning curves of each of the algorithms we note that iterative algorithms require stronger regularization to avoid instability. Then we identify two causes of this instability: distribution shift and iterative error exploitation. + +Distribution shift causes evaluation error by reducing the effective sample size in the fixed dataset for evaluating the current policy and has been extensively considered in prior work as discussed below. Iterative error exploitation occurs when we repeatedly optimize policies against our Q estimates and exploit their errors. This introduces a bias towards overestimation at each step (much like the training error in supervised learning is biased to be lower than the test error). Moreover, by iteratively re-using the data and using prior Q estimates to warmstart training at each step, the errors from one step are amplified at the next. This type of error is particular to multi-step and iterative algorithms. + +# 6.1 Learning curves and hyperparameter sensitivity + +To begin to understand why iterative and multi-step algorithms can fail it is instructive to look at the learning curves. As shown in Figure 2, we often observe that the iterative algorithm will begin to learn and then crash. Regularization can help to prevent this crash since strong enough regularization towards the behavior policy ensures that the evaluation is nearly on-policy. + +![](images/bbd4b958be2971ecaf3cafc93b6bd3c079cf9f34558ea6eefef0e6a511b802b6.jpg) +Figure 2: Learning curves and final performance on halfcheetah-medium across different algorithms and regularization hyperparameters (all using the reverse KL regularized improvement operator). Error bars show min and max over 3 seeds. Similar figures for other datasets from D4RL can be found in Appendix D. + +In contrast, the one-step algorithm is more robust to the regularization hyperparameter. The rightmost panel of the figure shows this clearly. While iterative and multi-step algorithms can have their performance degrade very rapidly with the wrong setting of the hyperparameter, the one-step approach is more stable. Moreover, we usually find that the optimal setting of the regularization hyperparameter is lower for the one-step algorithm than the iterative or multi-step approaches. + +# 6.2 Distribution shift + +Any algorithm that relies on off-policy evaluation will struggle with distribution shift in the evaluation step. Trying to evaluate a policy that is substantially different from the behavior reduces the effective sample size and increases the variance of the estimates. Explicitly, by distribution shift we mean the shift between the behavior distribution (the distribution over state-action pairs in the dataset) and the evaluation distribution (the distribution that would be induced by the policy $\pi$ we want to evaluate). + +Prior work. There is a substantial body of prior theoretical work that suggests that off-policy evaluation can be difficult and this difficulty scales with some measure of distribution shift. Wang et al. [2020a], Amortila et al. [2020], Zanette [2021] give exponential (in horizon) lower bounds on sample complexity in the linear setting even with good feature representations that can represent the desired Q function and assuming good data coverage. Upper bounds generally require very strong assumptions on both the representation and limits on the distribution shift [Wang et al., 2021, Duan et al., 2020, Chen and Jiang, 2019]. Moreover, the assumed bounds on distribution shift can be exponential in horizon in the worst case. On the empirical side, Wang et al. [2021] demonstrates issues with distribution shift when learning from pre-trained features and provides a nice discussion of why distribution shift causes error amplification. Fujimoto et al. [2018a] raises a similar issue under the name “extrapolation error”. Regularization and constraints are meant to reduce issues stemming from distribution shift, but also reduce the potential for improvement over the behavior. + +Empirical evidence. Both the multi-step and iterative algorithms in our experiments rely on offpolicy evaluation as a key subroutine. We examine how easy it is to evaluate the policies encountered along the learning trajectory. To control for issues of iterative error exploitation (discussed in the next subsection), we train Q estimators from scratch on a heldout evaluation dataset sampled from the behavior policy. We then evaluate these trained Q function on rollouts from 1000 datapoints sampled from the replay buffer. Results are shown in Figure 3. + +The results show a correlation betweed KL and MSE. Moreover, we see that the MSE generally increases over training. One way to mitigate this, as seen in the figure, is to use a large value of $\alpha$ . We just cannot take a very large step before running into problems with distribution shift. But, when we take such a small step, the information from the on-policy ${ \widehat Q } ^ { \beta }$ is about as useful as the newly estimated ${ \widehat { Q } } ^ { \pi }$ . This is seen, for example, in Figure 2 where we get very similar performance across algorithms at high levels of regularization. + +![](images/7cdca1b44030fc8a1f0c53056fe81e9e58f7cbc3b78dd6f5341ba10b8b54469b.jpg) +Figure 3: Results of running the iterative algorithm on halfcheetah-medium. Each checkpointed policy is evaluated by a Q function trained from scratch on heldout data. MSE refers to $\mathbb { E } _ { s , a \sim \beta } [ ( \hat { Q } ^ { \pi _ { i } } ( s , a ) -$ $Q ^ { \pi _ { i } } ( s , a ) ) ^ { 2 } ]$ and KL refers to $\mathbb { E } _ { s \sim \beta } [ K L ( \pi ( \cdot | s ) | | \beta ( \cdot | s ) ]$ . Left: 90 policies taken from various points in training with various hyperaparmeters and random seeds. Center: MSE learning curves. Right: KL learning curves. Error bars show min and max over 3 random seeds. + +# 6.3 Iterative error exploitation + +The previous subsection identifies how any algorithm that uses off-policy evaluation is fundamentally limited by distribution shift, even if we were given fresh data and trained Q functions from scratch at every iteration. But, in practice, iterative algorithms repeatedly iterate between optimizing policies against estimated Q functions and re-estimating the Q functions using the same data and using the Q function from the previous step to warm-start the re-estimation. This induces dependence between steps that causes a problem that we call iterative error exploitation. + +Intuition about the problem. In short, iterative error exploitation happens because $\pi _ { i }$ tends to choose overestimated actions in the policy improvement step, and then this overestimation propagates via dynamic programming in the policy evaluation step. To illustrate this issue more formally, consider the following: at each $s , a$ we suffer some Bellman error $\varepsilon _ { \beta } ^ { \pi } ( s , a )$ based on our fixed dataset collected by $\beta$ . Formally, + +$$ +\widehat { Q } ^ { \pi } ( s , a ) = r ( s , a ) + \gamma \operatorname * { \mathbb { E } } _ { \mathbf { \Phi } _ { s ^ { \prime } \mid s , a } \atop { a ^ { \prime } \sim \pi \mid s ^ { \prime } } } [ \widehat { Q } ^ { \pi } ( s ^ { \prime } , a ^ { \prime } ) ] + \varepsilon _ { \beta } ^ { \pi } ( s , a ) . +$$ + +Intuitively, $\varepsilon _ { \beta } ^ { \pi }$ will be larger at state-actions with less coverage in the dataset collected by $\beta$ . Note that $\varepsilon _ { \beta } ^ { \pi }$ can absorb all error whether it is caused by the finite sample size or function approximation error. + +All that is needed to cause iterative error exploitation is that the $\epsilon _ { \beta } ^ { \pi }$ are highly correlated across different $\pi$ , but for simplicity, we will assume that $\varepsilon _ { \beta } ^ { \pi }$ is the same for all policies $\pi$ estimated from our fixed offline dataset and instead write $\varepsilon _ { \beta }$ . Now that the errors do not depend on the policy we can treat the errors as auxiliary rewards that obscure the true rewards and see that + +$$ +\widehat { Q } ^ { \pi } ( s , a ) = Q ^ { \pi } ( s , a ) + \widetilde { Q } _ { \beta } ^ { \pi } ( s , a ) , \qquad \widetilde { Q } _ { \beta } ^ { \pi } ( s , a ) : = \underset { \pi | s _ { 0 } , a _ { 0 } = s , a } { \mathbb { E } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \varepsilon _ { \beta } ( s _ { t } , a _ { t } ) \right] . +$$ + +This assumption is somewhat reasonable since we expect the error to primarily depend on the data. And, when the prior Q function is used to warm-start the current one (as is generally the case in practice), the approximation errors are automatically passed between steps. + +Now we can explain the problem. Recall that under our assumption the $\varepsilon _ { \beta }$ are fixed once we have a dataset and likely to have larger magnitude the further we go from the support of the dataset. So, with each step $\pi _ { i }$ is able to better maximize $\varepsilon _ { \beta }$ , thus moving further from $\beta$ and increasing the magnitude of $\widetilde { Q } _ { \beta } ^ { \pi _ { i } }$ relative to $Q ^ { \pi _ { i } }$ . Even though $Q ^ { \pi _ { i } }$ may provide better signal than $Q ^ { \beta }$ , it can easily be drowned out by $\widetilde { Q } _ { \beta } ^ { \pi _ { i } }$ . In contrast, $\widetilde { Q } _ { \beta } ^ { \beta }$ has small magnitude, so the one-step algorithm is robust to errors1. + +An example. Now we consider a simple gridworld example to illustrate iterative error exploitation. This example fits exactly into the setup outlined above since all errors are due to reward estimation so the $\varepsilon _ { \beta }$ is indeed constant over all $\pi$ . The gridworld we consider has one deterministic good state with reward 1 and many stochastic bad states that have rewards distributed as $\mathcal { N } ( - 0 . 5 , 1 )$ . We collect a dataset of 100 trajectories, each of length 100. One run of the multi-step offline regularized policy iteration algorithm is illustrated in Figure 4. + +In the example we see that one step often outperforms multiple steps of improvement. Intuitively, when there are so many noisy states, it is likely that a few of them will be overestimated. Since the data is re-used for each step, these overestimations persist and propagate across the state space due to iterative error exploitation. This property of having many bad, but poorly estimated states likely also exists in the high-dimensional control problems encountered in the benchmark where there are many ways for the robots to fall down that are not observed in the data for non-random behavior. Moreover, both settings have larger errors in areas where we have less data. So even though the errors in the gridworld are caused by noise in the rewards, while errors in D4RL are caused by function approximation, we think this is a useful mental model of the problem. + +![](images/28bd37725a9c5e57318c91a7a0e7430e58e28336dddb89607a085861be130769.jpg) +Figure 4: An illustration of multi-step offline regularized policy iteration. The leftmost panel in each row shows the true reward (top) or error $\varepsilon _ { \beta }$ (bottom). Then each subsequent panel plots $\pi _ { i }$ (with arrow size proportional to $\pi _ { i } ( a | s ) .$ ) over either $Q ^ { \pi _ { i } }$ (top) or $\widetilde { Q } _ { \beta } ^ { \pi }$ (bottom), averaged over actions at each state. The one-step policy $( \pi _ { 1 } )$ has the highest value. The behavior policy here is a mixture of optimal $\pi ^ { * }$ and uniform $u$ with coefficient 0.2 so that $\beta = 0 . 2 \cdot \pi ^ { * } + 0 . 8 \cdot u$ . We set $\alpha = 0 . 1$ as the regularization parameter for reverse KL regularization. + +![](images/3b10a08795d9696e39c5ae064a78494e5e6e4ed0576dc9e69d03724bd61efe1d.jpg) +Figure 5: Histograms of overestimation error $( \widehat { Q } ^ { \pi _ { i } } ( s , a ) - Q ^ { \pi _ { i } } ( s , a ) )$ on halfcheetah-medium with the iterative algorithm. Left: errors from the training Q function. Right: errors from an independently trained Q function. + +Empirical evidence. In practice we cannot easily visualize the progression of errors. However, the dependence between steps still arises as overestimation of the Q values. We can track the overestimation of the Q values over training as a way to measure how much bias is being induced by optimizing against our dependent Q estimators. As a control we can also train Q estimators from scratch on independently sampled evaluation data. These independently trained Q functions do not have the same overestimation bias even though the squared error does tend to increase as the policy moves further from the behavior (as seen in Figure 3). Explicitly, we track 1000 state, action pairs from the replay buffer over training. For each checkpointed policy we perform 3 rollouts at each state to get an estimate of the true Q value and compare this to the estimated Q value. Results are shown in Figure 5. + +# 7 When are multiple steps useful? + +So far we have focused on why the one-step algorithm often works better than the multi-step and iterative algorithms. However, we do not want to give the impression that one-step is always better. Indeed, our own experiments in Section 5 show a clear advantage for the multi-step and iterative approaches when we have randomly collected data. While we cannot offer a precise delineation of when one-step will outperform multi-step, in this section we offer some intuition as to when we can expect to see benefits from multiple steps of policy improvement. + +As seen in Section 6, multi-step and iterative algorithms have problems when they propagate estimation errors. This is especially problematic in noisy and/or high dimensional environments. While the multi-step algorithms propagate this noise more widely than the one-step algorithm, they also propagate the signal. So, when we have sufficient coverage to reduce the magnitude of the noise, this increased propagation of signal can be beneficial. The D4RL experiments suggest that we are usually on the side of the tradeoff where the errors are large enough to make one-step preferable. + +![](images/4deab14cea5ef2dbcec99ba9f0be26cb6ad0981000685aa80269646f930309aa.jpg) +Figure 6: Performance of all three algorithms with reverse KL regularization across mixtures between halfcheetah-random and halfcheetah-medium. Error bars indicate min and max over 3 seeds. + +In Appendix A we illustrate a simple gridworld example where a slight modification of the behavior policy from Figure 4 makes multi-step dramatically outperform one-step. This modified behavior policy (1) has better coverage of the noisy states (which reduces error, helping multi-step), and (2) does a worse job propagating the reward from the good state (hurting one-step). + +We can also test empirically how the behavior policy effects the tradeoff between error and signal propagation. To do this we construct a simple experiment where we mix data from the random behavior policy with data from the medium behavior policy. Explicitly we construct a dataset $D$ out of the datasets $D _ { r }$ for random and $D _ { m }$ for medium such that each trajectory in $D$ comes from the medium dataset with probability $p _ { m }$ . So for $p _ { m } = 0$ we have the random dataset and $p _ { m } = 1$ we have the medium dataset, and in between we have various mixtures. Results are shown in Figure 6. It takes surprisingly little data from the medium policy for one-step to outperform the iterative algorithm. + +# 8 Discussion, limitations, and future work + +This paper presents the surprising effectiveness of a simple one-step baseline for offline RL. We examine the failure modes of iterative algorithms and the conditions where we might expect them to outperform the simple one-step baseline. This provides guidance to a practitioner that the simple one-step baseline is a good place to start when approaching an offline RL problem. + +But, we leave many questions unanswered. One main limitation is that we lack a clear theoretical characterization of which environments and behaviors can guarantee that one-step outperforms multi-step or visa versa. Such results will likely require strong assumptions, but could provide useful insight. We don’t expect this to be easy as it requires understanding policy iteration which has been notoriously difficult to analyze, often converging much faster than the theory would suggest [Sutton and Barto, 2018, Agarwal et al., 2019]. Another limitation is that while only using one step is perhaps the simplest way to avoid the problems of off-policy evaluation, there are possibly other more elaborate algorithmic solutions that we did not consider here. However, our strong empirical results suggest that the one-step algorithm is at least a strong baseline. + +Broader impact. Our paper studies a simple and effective baseline approach to the offline RL problem. The effectiveness of this baseline raises some serious questions about the utility of prior work proposing substantially more complicated methods. By making this observation of prior shortcomings, our paper has the potential to encourage researchers to derive new and better methods for offline RL. This has many potential impacts on fields as diverse as robotics and healthcare where better offline decision making can lead to better real-world performance. As always, we note that machine learning improvements come in the form of “building machines to do $\mathbf { X }$ better”. For a sufficiently malicious or ill-informed choice of X, almost any progress in machine learning might indirectly lead to a negative outcome, and our work is not excluded from that. + +# Acknowledgements + +This work is partially supported by the Alfred P. Sloan Foundation, NSF RI-1816753, NSF CAREER CIF 1845360, NSF CHS-1901091, Samsung Electronics, and the Institute for Advanced Study. DB is supported by the Department of Defense (DoD) through the National Defense Science & Engineering Graduate Fellowship (NDSEG) Program. + +# References + +Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International Conference on Machine Learning, pages 22–31. PMLR, 2017. + +Alekh Agarwal, Nan Jiang, and S. Kakade. Reinforcement learning: Theory and algorithms. 2019. + +P. Amortila, Nan Jiang, and Tengyang Xie. A variant of the wang-foster-kakade lower bound for the discounted setting. ArXiv, abs/2011.01075, 2020. + +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. CoRR, abs/1606.01540, 2016. URL http://arxiv.org/abs/ 1606.01540. + +Jacob Buckman, Carles Gelada, and Marc G. Bellemare. The importance of pessimism in fixed-dataset policy optimization, 2020. + +John Burkhardt. The truncated normal distribution, 2014. + +Jinglin Chen and Nan Jiang. Information-theoretic considerations in batch reinforcement learning. In Proceedings of the 36th International Conference on Machine Learning. PMLR, 2019. + +Xinyue Chen, Zijian Zhou, Zheng Wang, Che Wang, Yanqiu Wu, and Keith Ross. Bail: Bestaction imitation learning for batch deep reinforcement learning. Advances in Neural Information Processing Systems, 33, 2020. + +Yaqi Duan, Zeyu Jia, and Mengdi Wang. Minimax-optimal off-policy evaluation with linear function approximation. In International Conference on Machine Learning, pages 2701–2709. PMLR, 2020. + +Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020. + +Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. arXiv preprint arXiv:1812.02900, 2018a. + +Scott Fujimoto, Herke van Hoof, and David Meger. Addressing function approximation error in actor-critic methods. arXiv preprint arXiv:1802.09477, 2018b. + +Scott Fujimoto, Edoardo Conti, Mohammad Ghavamzadeh, and Joelle Pineau. Benchmarking batch deep reinforcement learning algorithms. arXiv preprint arXiv:1910.01708, 2019. + +Wonjoon Goo and Scott Niekum. You only evaluate once – a simple baseline algorithm for offline rl. In Offline Reinforcement Learning Workshop at Neural Information Processing Systems, 2020. + +Caglar Gulcehre, Ziyu Wang, Alexander Novikov, Tom Le Paine, Sergio Gómez Colmenarejo, Konrad Zolna, Rishabh Agarwal, Josh Merel, Daniel Mankowitz, Cosmin Paduraru, et al. Rl unplugged: Benchmarks for offline reinforcement learning. arXiv preprint arXiv:2006.13888, 2020. + +Caglar Gulcehre, Sergio Gómez Colmenarejo, Ziyu Wang, Jakub Sygnowski, Thomas Paine, Konrad Zolna, Yutian Chen, Matthew Hoffman, Razvan Pascanu, and Nando de Freitas. Regularized behavior value estimation. arXiv preprint arXiv:2103.09575, 2021. + +Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Agata Lapedriza, Noah Jones, Shixiang Gu, and Rosalind Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog, 2019. + +Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In ICML, volume 2, pages 267–274, 2002. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +Ilya Kostrikov, Jonathan Tompson, Rob Fergus, and Ofir Nachum. Offline reinforcement learning with fisher divergence critic regularization. arXiv preprint arXiv:2103.08050, 2021. + +Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, pages 11761–11771, 2019. + +Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020. + +Romain Laroche, Paul Trichelair, and Remi Tachet Des Combes. Safe policy improvement with baseline bootstrapping. In International Conference on Machine Learning, pages 3652–3661. PMLR, 2019. + +Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020. + +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. + +Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015. + +Rémi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy reinforcement learning. In Advances in Neural Information Processing Systems, pages 1054–1062, 2016. + +Ofir Nachum, Bo Dai, Ilya Kostrikov, Yinlam Chow, Lihong Li, and Dale Schuurmans. Algaedice: Policy gradient from arbitrary experience. arXiv preprint arXiv:1912.02074, 2019. + +Kimia Nadjahi, Romain Laroche, and Rémi Tachet des Combes. Safe policy improvement with soft baseline bootstrapping, 2019. + +Tom Le Paine, Cosmin Paduraru, Andrea Michi, Caglar Gulcehre, Konrad Zolna, Alexander Novikov, Ziyu Wang, and Nando de Freitas. Hyperparameter selection for offline reinforcement learning, 2020. + +Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019. + +Martin L Puterman and Moon Chirl Shin. Modified policy iteration algorithms for discounted markov decision problems. Management Science, 24(11):1127–1137, 1978. + +Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, Giulia Vezzani, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. arXiv preprint arXiv:1709.10087, 2017. + +Bruno Scherrer, Victor Gabillon, Mohammad Ghavamzadeh, and Matthieu Geist. Approximate modified policy iteration. arXiv preprint arXiv:1205.3054, 2012. + +John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pages 1889–1897, 2015. + +Noah Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, Nicolas Heess, and Martin Riedmiller. Keep doing what worked: Behavior modelling priors for offline reinforcement learning. In International Conference on Learning Representations, 2020. + +Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. + +Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In Thirtieth AAAI conference on artificial intelligence, 2016. + +Cameron Voloshin, Hoang M Le, Nan Jiang, and Yisong Yue. Empirical study of off-policy policy evaluation for reinforcement learning. arXiv preprint arXiv:1911.06854, 2019. + +Qing Wang, Jiechao Xiong, Lei Han, Han Liu, Tong Zhang, et al. Exponentially weighted imitation learning for batched historical data. In Advances in Neural Information Processing Systems, pages 6288–6297, 2018. + +Ruosong Wang, Dean P. Foster, and Sham M. Kakade. What are the statistical limits of offline rl with linear function approximation?, 2020a. + +Ruosong Wang, Yifan Wu, Ruslan Salakhutdinov, and Sham M Kakade. Instabilities of offline rl with pre-trained neural representation. arXiv preprint arXiv:2103.04947, 2021. + +Ziyu Wang, Alexander Novikov, Konrad Zolna, Josh S Merel, Jost Tobias Springenberg, Scott E Reed, Bobak Shahriari, Noah Siegel, Caglar Gulcehre, Nicolas Heess, et al. Critic regularized regression. Advances in Neural Information Processing Systems, 33, 2020b. + +Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning, 2019. + +Andrea Zanette. Exponential lower bounds for batch reinforcement learning: Batch rl can be exponentially harder than online rl, 2021. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] See Section 8 and Section 7. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 8. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See supplement. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix C +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] In all relevant figures. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix C + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] Data from Fu et al. [2020]. +(b) Did you mention the license of the assets? [Yes] The license is Apache 2.0. +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code in supplement. +(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] Data is simulated. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] Data is simulated. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/md/train/LVWcGZr-8h/LVWcGZr-8h.md b/md/train/LVWcGZr-8h/LVWcGZr-8h.md new file mode 100644 index 0000000000000000000000000000000000000000..ebc982cf49f0951a2926f47ad568ac14038a59ee --- /dev/null +++ b/md/train/LVWcGZr-8h/LVWcGZr-8h.md @@ -0,0 +1,322 @@ +# On Success and Simplicity: A Second Look at Transferable Targeted Attacks + +Zhengyu Zhao, Zhuoran Liu, Martha Larson Radboud University {z.zhao,z.liu,m.larson}@cs.ru.nl + +# Abstract + +Achieving transferability of targeted attacks is reputed to be remarkably difficult. The current state of the art has resorted to resource-intensive solutions that necessitate training model(s) for each target class with additional data. In our investigation, we find, however, that simple transferable attacks which require neither model training nor additional data can achieve surprisingly strong targeted transferability. This insight has been overlooked until now, mainly because the widespread practice of attacking with only few iterations has largely limited the attack convergence to optimal targeted transferability. In particular, we, for the first time, identify that a very simple logit loss can largely surpass the commonly adopted crossentropy loss, and yield even better results than the resource-intensive state of the art. Our analysis spans a variety of transfer scenarios, especially including three new, realistic scenarios: an ensemble transfer scenario with little model similarity, a worse-case scenario with low-ranked target classes, and also a real-world attack on the Google Cloud Vision API. Results in these new transfer scenarios demonstrate that the commonly adopted, easy scenarios cannot fully reveal the actual strength of different attacks and may cause misleading comparative results. We also show the usefulness of the simple logit loss for generating targeted universal adversarial perturbations in a data-free manner. Overall, the aim of our analysis is to inspire a more meaningful evaluation on targeted transferability. Code is available at https://github.com/ZhengyuZhao/Targeted-Tansfer. + +# 1 Introduction + +Deep neural networks have achieved remarkable performance in various machine learning tasks, but are known to be vulnerable to adversarial attacks [1]. A key property of adversarial attacks that makes them critical in realistic, black-box scenarios is their transferability [2, 3]. Current work on adversarial transferability has achieved great success for non-targeted attacks [4–12], while several initial attempts [3, 4, 13] at targeted transferability have shown its extreme difficulty. Targeted transferability is known to be much more challenging and worth exploring since it can raise more critical concerns by fooling models into predicting a chosen, highly dangerous target class. + +However, so far state-of-the-art results can only be secured by resource-intensive transferable attacks [14–16]. Specifically, the FDA approach [14, 15] is based on modeling layer-wise feature distributions by training target-class-specific auxiliary classifiers on large-scale labeled data, and then optimizing adversarial perturbations using these auxiliary classifiers from across the deep feature space. The TTP approach [16] is based on training target-class-specific Generative Adversarial Networks (GANs) through global and local distribution matching, and then using the trained generator to directly generate perturbations on any given input image. + +In this paper, we take a second, thorough look at current research on targeted transferability. Our main contribution is the finding that simple transferable attacks [4, 6, 8] that require neither model training nor additional data can actually achieve surprisingly strong targeted transferability. We argue that this insight has been overlooked mainly because current research has unreasonably restricted the attack convergence by only using a small number of iterations (see detailed discussion in Section 3). Another key contribution of our work is, for the first time, demonstrating the general superiority of a very simple logit loss, which even outperforms the resource-intensive state of the art. + +In order to validate the general effectiveness of simple transferable attacks, in Section 4.1, we conduct extensive experiments in a wide range of transfer scenarios. We test the commonly adopted single-model and ensemble transfer scenarios, but also introduce three new scenarios that are more challenging and realistic: an ensemble transfer scenario with little model similarity, a worse-case scenario with low-ranked target classes, and also a real-world attack on the Google Cloud Vision API. Experimental results in these new scenarios suggest that evaluation in only the commonly adopted, easy scenarios cannot reveal the actual strength of different attacks, and may cause misleading comparative results. Additional experiments in Section 4.2 have shown the better performance of the simple transferable attacks than the state-of-the-art resource-intensive approaches. Finally, in Section 4.3, inspired by the observation that the generated perturbations themselves reflect specific target semantics, we use the simple Logit attack to generate targeted Universal Adversarial Perturbations (UAPs) in a data-free manner. In contrast, recent advances in targeted UAPs [16–19] have inevitably relied on large-scale optimization over additional data. + +Overall, we hope our analysis of the weakness of commonly adopted attack settings and transfer scenarios will inspire a more meaningful evaluation on targeted transferability. + +# 2 Related Work + +In this section, we review existing simple transferable attacks (Section 2.1), and also recent resourceintensive transferable attacks (Section 2.2). Finally, we discuss related work on generating universal adversarial perturbations. + +# 2.1 Simple Transferable Attacks + +We refer to transferable attacks that require neither model training nor additional data, but only use iterative optimization on a single (original) image as simple transferable attacks. Simple transferable attacks have been extensively studied in the non-targeted case [4–12], and also attempted in the targeted case [3, 4, 20]. These attacks are commonly built up on the well-known Iterative-Fast Gradient Sign Method (I-FGSM) [21, 22], which can be formulated as: + +$$ +\begin{array} { r } { \pmb { x } _ { 0 } ^ { \prime } = \pmb { x } , \pmb { x } _ { i + 1 } ^ { \prime } = \pmb { x } _ { i } ^ { \prime } - \alpha \cdot \mathrm { s i g n } ( \nabla _ { \pmb { x } } J ( \pmb { x } _ { i } ^ { \prime } , y _ { t } ) ) , } \end{array} +$$ + +where $\pmb { x } _ { i } ^ { \prime }$ denotes the perturbed image in the $i$ -th iteration, and $y _ { t }$ is the target class label. In order to ensure the imperceptibility, the added perturbations are restricted with respect to some $L _ { p }$ distance, i.e., satisfying $\| { \pmb x } ^ { \prime } - { \pmb x } \| _ { p } \overset { \cdot } { \le } \epsilon$ . Current transferable attack methods have commonly adopted the $L _ { \infty }$ distance, but can also be easily adapted to the $L _ { 2 }$ distance based on an $L _ { 2 }$ normalization [23]. + +For the loss function $J ( \cdot , \cdot )$ , most simple transferable attacks have adopted the Cross-Entropy (CE) loss. However, the CE loss has been recently shown to be insufficient in the targeted case due to its decreasing gradient problem [20]. To address this problem, the authors in [20] have proposed the $\mathbf { P 0 + T r i p }$ loss, in which the Poincare distance was used to adapt the gradients’ magnitude: ´ + +$$ +L _ { P o } = d ( { \pmb u } , { \pmb v } ) = \mathrm { a r c c o s h } ( 1 + \delta ( { \pmb u } , { \pmb v } ) ) , +$$ + +$$ +\delta ( \pmb { u } , \pmb { v } ) = \frac { 2 \cdot \| \pmb { u } - \pmb { v } \| _ { 2 } ^ { 2 } } { ( 1 - \| \pmb { u } \| _ { 2 } ^ { 2 } ) ( 1 - \| \pmb { v } \| _ { 2 } ^ { 2 } ) } , \pmb { u } = \frac { l ( \pmb { x } ^ { \prime } ) } { \| l ( \pmb { x } ^ { \prime } ) \| } , \pmb { v } = \operatorname* { m a x } \{ \pmb { v } - \pmb { \xi } , 0 \} , +$$ + +where $\textbf { \em u }$ is the normalized logit vector and $\pmb { v }$ is the one-hot vector with respect to the target class. $\xi = 1 0 ^ { - 5 }$ is a small constant to ensure numerical stability. The following triplet loss is also integrated for pushing the image away from the original class while pulling it into the target class: + +$$ +L _ { T r i p } = [ D ( l ( \pmb { x } ^ { \prime } ) , y _ { t } ) - D ( l ( \pmb { x } ^ { \prime } ) , y _ { o } ) + \gamma ] _ { + } , D ( l ( \pmb { x } ^ { \prime } ) , y ) = 1 - \frac { \| l ( \pmb { x } ^ { \prime } ) \cdot \pmb { y } \| _ { 1 } } { \| l ( \pmb { x } ^ { \prime } ) \| _ { 2 } \| y \| _ { 2 } } . +$$ + +The overall loss function is then formulated as $L _ { P o + T r i p } = L _ { P o } + \lambda L _ { T r i p }$ . Note that in the original work, ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ was evaluated in the commonly adopted, easy ensemble transfer scenario, which only involves models with similar architectures. + +In addition to devising new loss functions, there are other transfer methods [4, 6, 8, 9] developed based on the assumption that preventing the attack optimization from overfitting to the specific source model can improve transferability. Such transfer methods can be easily plugged into different attacks without modifications, in contrast to the above methods that need to apply new attack loss functions. In this paper, we consider three [4, 6, 8] of such transfer methods that have been widely used in the literature, as described in the following text. + +Momentum Iterative-FGSM (MI-FGSM) [4] integrates a momentum term, which accumulates previous gradients in order to achieve more stable update directions. It can be expressed as: + +$$ +{ \bf \mathcal { G } } _ { i + 1 } = \mu \cdot { \bf g } _ { i } + \frac { \nabla _ { x } J ( { \pmb x } _ { i } ^ { \prime } , y _ { t } ) } { \| \nabla _ { \pmb x } J ( { \pmb x } _ { i } ^ { \prime } , y _ { t } ) \| _ { 1 } } , ~ { \pmb x } _ { i + 1 } ^ { \prime } = { \pmb x } _ { i } ^ { \prime } - \alpha \cdot \mathrm { ~ \mathrm { s i g n } } ( { \pmb g } _ { i } ) , +$$ + +where $\mathbf { \pmb { g } } _ { i }$ is the accumulated gradients at the $i$ -th iteration, and $\mu$ is a decay factor. Another similar technique that instead uses the Nesterov accelerated gradient was explored in [9]. + +Translation Invariant-FGSM (TI-FGSM) [6] randomly translates the input image during attack optimization in order to prevent the attack from overfitting to the specific source model. This approach is inspired by the data augmentation techniques used for preventing overfitting in normal model training. Instead of calculating gradients for multiple translated images separately, the authors have proposed an approximate solution to accelerate the implementation. It is achieved by directly computing locally smoothed gradients on the original image via convolution with a kernel: + +$$ +\pmb { x } _ { i + 1 } ^ { \prime } = \pmb { x } _ { i } ^ { \prime } - \alpha \cdot \mathrm { s i g n } ( W * \nabla _ { \pmb { x } } J ( \pmb { x } _ { i } ^ { \prime } , y _ { t } ) ) , +$$ + +where $W$ is the convolution kernel used for smoothing. TI-FGSM was originally designed for boosting transferability with adversarially-trained models as target models and has been recently shown that a smaller kernel size should be used when transferring to normally-trained models [12]. + +Diverse Input-FGSM (DI-FGSM) [8] follows a similar idea to TI-FGSM, but applies random resizing and padding for data augmentation. Another important difference is that DI-FGSM randomizes augmentation parameters over iterations rather than fixing them as in TI-FGSM. The attack optimization of DI-FGSM can be formulated as: + +$$ +\pmb { x } _ { i + 1 } ^ { \prime } = \pmb { x } _ { i } ^ { \prime } - \alpha \cdot \mathrm { s i g n } \big ( \nabla _ { \pmb { x } } J ( T ( \pmb { x } _ { i } ^ { \prime } , p ) , y _ { t } ) \big ) , +$$ + +where the stochastic transformation $T ( \pmb { x } _ { i } ^ { \prime } , p )$ is implemented with probability $p$ at each iteration. In Section 4.1, we demonstrate that simple transfer attacks with these three transfer methods can actually achieve surprisingly strong targeted transferability in a wide range of transfer scenarios. + +# 2.2 Resource-Intensive Transferable Attacks + +Due to the broad consensus that achieving targeted transferability is extremely difficult, recent researchers have resorted to resource-intensive approaches that require training target-class-specific models on large-scale additional data. Specifically, the Feature Distribution Attack (FDA) [14] follows the same attack pipeline as the above simple transferable attacks, but requires auxiliary classifiers that have been trained on additional labeled data as part of the source model. Each auxiliary classifier is a small, binary, one-versus-all classifier trained for a specific target class at a specific layer. That is to say, the number of auxiliary classifiers is the number of layers that are probed multiplied by the number of target classes that are required to model [14]. The attack loss function of FDA can be formulated as: + +$$ +L _ { F D A } = J ( \mathcal { F } _ { l } ( \pmb { x } ^ { \prime } ) , y _ { t } ) - \eta \frac { \| \mathcal { F } _ { l } ( \pmb { x } ^ { \prime } ) - \mathcal { F } _ { l } ( \pmb { x } ) \| _ { 2 } } { \| \mathcal { F } _ { l } ( \pmb { x } ) \| _ { 2 } } , +$$ + +where each auxiliary classifiers $F _ { l } ( \cdot )$ can model the probability that a feature map at layer $l$ is from a specific target class $y _ { t }$ . $\mathbf { F D A } ^ { ( N ) } \mathbf { + x e n t }$ [15] extends FDA by aggregating features from $L$ layers and also incorporating the cross-entropy loss $H ( \cdot , \cdot )$ of the original network $\mathcal F ( \cdot )$ . The loss function of $\mathrm { F D A } ^ { ( N ) } -$ +xent can be expressed as: + +$$ +L _ { F D A ^ { ( N ) } + x e n t } = \sum _ { l \in L } \lambda _ { l } ( L _ { F D A } + \gamma H ( \mathcal { F } ( \pmb { x } ^ { \prime } ) , y _ { t } ) ) , \mathrm { ~ w h e r e ~ } \sum _ { l \in L } \lambda _ { l } = 1 . +$$ + +Very recently, TTP [16] has achieved state-of-the-art targeted transferability by directly generating perturbations using target-class-specific GANs that have been trained via matching the distributions of perturbations and a specific target class both globally and locally. Specifically, the global distribution matching is achieved by minimizing the Kullback Leibler (KL) divergence, and the local distribution matching is by enforcing the neighbourhood similarity. In order to further boost the performance, data augmentation techniques, such as image rotation, crop resize, horizontal flip, color jittering and gray-scale transformation, have been applied during model training. We refer the readers to [16] for more technical details of TTP. + +These two transferable attacks, $\mathrm { F D A } ^ { ( N ) } +$ xent and TTP, are resource intensive due to the use of largescale model training and additional data. However, in Section 4.2, we show that simple transferable attacks, which require neither model training nor additional data, can actually achieve even better performance than them. + +# 2.3 Universal Adversarial Perturbations + +Previous research has shown the existence of Universal Adversarial Perturbations (UAPs), i.e., a single image perturbation vector that fools a classifier on multiple images [24]. UAPs have been extensively studied for non-targeted attacks [24–28], but also explored in the more challenging, targeted case [17–19]. Although recent studies have shown comparable performance of using reconstructed class impressions [25] or proxy datasets [18] to original training data, large-scale optimization over image data is still necessary for most existing methods. Differently, a data-free approach [26] has been proposed for non-targeted UAPs by iteratively optimizing randomly-initialized perturbations with an objective of disrupting the intermediate features of the model at multiple layers. However, this approach cannot be applied to targeted UAPs because targeted perturbations aim at a specific direction but not random disruption as in the non-targeted case. To bridge this gap, in Section 4.3, we demonstrate how the simple Logit attack can be used to generate targeted UAPs in a data-free manner. + +# 3 New Insights into Simple Transferable Attacks + +In this section, we revisit simple transferable targeted attacks, and provide new insights into them. Specifically, we demonstrate that simple transferable attacks that are based on existing transfer methods (TI-, MI-, and DI-FGSM) need more iterations to converge, and attacking with a simple logit loss can yield much better results than the commonly adopted Cross-Entropy (CE) loss. + +# 3.1 Existing Transfer Methods with More Iterations Yield Good Results + +Existing attempts have concluded that using simple transferable attacks to achieve targeted transferability is extremely difficult [3, 4, 13–15]. However, these attempts have been limited to the MI transfer method. Here, we tested all the three transfer methods. As can be seen form Figure 1, integrating all the three transfer methods leads to the best performance. In particular, we find that using only DI can actually yield substantial targeted transferability, while using only TI or MI makes little difference to the original poor targeted transferability. The fact that DI outperforms TI may be explained by the fact that DI randomizes the image augmentation parameters over iterations rather than fixing them as in TI. In this way, the gradients towards the target class become more generic and so avoid overfitting to the white-box source model. MI is essentially different from DI and TI because it can only stabilize update directions but not serve to achieve more accurate gradient directions towards a specific (target) class. + +As we have pointed out in Section 1, common practice of generating transferable targeted perturbations [13–15, 20] has limited the attack optimization to few iterations (typically $\leq 2 0$ ). This is somewhat understandable given that extensive research on non-targeted transferability has done the same. However, as can be seen from Figure 1, targeted attacks actually require much more iterations to converge to optimal transferability, in contrast to the fast convergence of non-targeted attacks. This implies that evaluating the targeted transferability under only few iterations is problematic. On the one hand, comparing different optimization processes that have not converged is not meaningful and may cause misleading comparisons (see evidence in Section 4.1). This observation is consistent with the evaluation suggestion in [29] that restricting the number of iterations without verifying the attack convergence is one of the common pitfalls in evaluating adversarial robustness. Several advanced defenses have been defeated by simply increasing the number of iterations [30]. On the other hand, considering the realistic threat model, it is not meaningful to artificially restrict the computational power of a practical attack (e.g., to fewer than several thousand attack iterations) [31]. + +![](images/fca3998a05bc361aeb1a80acdda333e959d92ecde001d361628249fa2a53dc0c.jpg) +Figure 1: Transfer success rates of simple transferable attacks using CE or logit loss in the non-targeted and targeted scenarios. + +![](images/e2c049957a94f6a754c65e1915a056f2b2266017247f535e6e9e8ad04ee22485.jpg) +Figure 2: White-box (wb) and black-box (bb) attack performance in terms of the predicted confidence (left, higher is better) and ranking (right, lower is better) of the target class. + +# 3.2 A Simple yet Strong Logit Attack + +Existing simple transferable attacks have commonly adopted the Cross-Entropy (CE) loss. However, as pointed out in [20], during the attack optimization, the CE loss will cause the gradient to decrease and tend to vanish as the number of iterations is increased. To address this problem, the ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ loss [20] takes a very aggressive strategy by arbitrarily reversing the decrease of the gradient, i.e., gradually increasing the magnitude of the gradients over iterations. However, we argue that this operation has led to too large step size, and as a result cause the attack optimization to overshoot the minima. Our results in Section 4.1 support this argument by showing that $\mathrm { P o + }$ Trip even yielded worse results than CE in the ensemble transfer scenario with diverse model architectures, since the loss surface is relatively non-smooth. + +Here, for the loss function, we eliminate the final softmax function used in the CE loss and just backpropagate the gradients from the logit output: + +$$ +L _ { L o g i t } = - l _ { t } ( { \bf r } ^ { \prime } ) , +$$ + +where $l _ { t } ( \cdot )$ denotes the logit output with respect to the target class. Although the idea of attacking logits is not new, its superior performance in targeted transferability has not been recognized so far. We also find that using the well-known logit-based loss, C&W [32], yields consistently worse results (see detailed comparisons in Appendix A). Another logit loss that is similar to the C&W loss has also been adopted by [18], but in the task of generating UAPs with large-scale data. + +Below, we show that this logit loss leads to stronger gradients than the CE loss. As can be observed from Equation 10, the gradient of the CE loss with respect to the target logit input, $z _ { t }$ , will monotonically decrease as the probability of the target class, $p _ { t }$ , increases during attack optimization. In addition, due to the use of the softmax function, $p _ { t }$ will quickly reach 1, and as a result the gradient tends to vanish. This phenomenon makes the attack hard to improve even with more iterations applied. Differently, as shown by Equation 11, the gradient of the logit loss equals a constant. In this way, the attack can keep improving as the number of iterations is increased. In Appendix B, we provide further comparisons on the trends of loss/gradient magnitude and the target logit value over iterations, which show that the logit loss leads to better results than both CE and ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ . + +$$ +\begin{array} { c } { { { \cal L } _ { C E } = - 1 \cdot \log ( p _ { t } ) = - \log ( { \displaystyle \frac { e ^ { z _ { t } } } { \sum e ^ { z _ { j } } } } ) = - z _ { t } + \log ( \sum _ { } e ^ { z _ { j } } ) , } } \\ { { { \cal \frac { \partial L _ { C E } } { \partial z _ { t } } } = - 1 + { \displaystyle \frac { \partial \log ( \sum e ^ { z _ { j } } ) } { \partial e ^ { z _ { t } } } } \cdot { \displaystyle \frac { \partial e ^ { z _ { t } } } { \partial z _ { t } } } = - 1 + { \displaystyle \frac { e ^ { z _ { t } } } { \sum e ^ { z _ { j } } } } = - 1 + p _ { t } . } } \end{array} +$$ + +$$ +L _ { L o g i t } = - z _ { t } , \frac { \partial L _ { L o g i t } } { \partial z _ { t } } = - 1 . +$$ + +Table 1: Targeted transfer success rates $( \% )$ in the single-model transfer scenario. We consider three attacks with different loss functions: cross-entropy (CE), Poincare distance with Triplet loss ´ $( { \mathrm { P o } } + { \mathrm { T r i p } } )$ [20], and the logit loss. Results with 20/100/300 iterations are reported. + +
AttackSource Model: Res50Source Model: Dense121
→Dense121→VGG16→Inc-v3→Res50→VGG16→Inc-v3
CE26.9/39.4/42.617.3/27.3/30.42.4/3.8/4.113.1/17.3/19.47.7/10.8/10.91.9/3.3/3.5
Po+Trip26.7/53.0/54.718.8/34.2/34.42.9/6.0/5.910.1/14.7/14.76.7/8.3/7.72.1/3.0/2.7
Logit29.3/63.3/72.524.0/55.7/62.73.0/7.2/9.417.2/39.7/43.713.5/35.3/38.72.7/6.9/7.6
AttackSource Model: VGG16Source Model: Inc-v3
→Res50→Dense121→Inc-v3→Res50→Dense121→VGG16
CE0.7/0.4/0.60.5/0.3/0.10/0.1/00.6/2.1/2.40.8/2.5/2.90.7/1.6/2.0
Po+Trip0.6/0.8/0.50.6/0.6/0.70.2/0.1/0.10.6/2.0/2.50.8/3.1/3.30.5/2.1/2.0
Logit3.3/8.7/11.23.6/11.7/13.20.2/0.7/0.90.8/1.6/2.91.2/2.8/5.30.7/2.2/3.7
+ +# 4 Experimental Evidence on Simple Transferable Attacks + +In this section, we provide experimental evidence to show the general effectiveness of simple transferable attacks. Firstly, in Section 4.1, we evaluate the simple transferable attacks in a variety of transfer scenarios, including single-model transfer, ensemble transfer (easy and challenging scenarios), a worse-case scenario with low-ranked target classes, and a real-world attack on the Google Cloud Vision API. Then, in Section 4.2, we compare the simple transferable attacks with two state-of-the-art resource-intensive transferable attacks, $\mathrm { F D A } ^ { ( N ) } { + } \mathrm { x e n i }$ [15] and TTP [16]. Finally, in Section 4.3, we apply the Logit attack to achieving targeted UAPs in a data-free manner. + +Following recent work [14–16, 20], we focus on targeted transferability of ImageNet-like images, which is known to be much more difficult than other data sets (e.g, MNIST and CIFAR-10) with smaller-size images and fewer classes. Specifically, we used the 1000 images from the development set of the ImageNet-Compatible Dataset1, which was introduced along with the NIPS 2017 Competition on Adversarial Attacks and Defenses. All these images are associated with 1000 ImageNet class labels and cropped to $2 9 9 \times 2 9 9$ before use. Our experiments were run on an NVIDIA Tesla P100 GPU with 12GB of memory. + +# 4.1 Simple Transferable Attacks in Various Transfer Scenarios + +We tested three different attack losses: CE, ${ \mathrm { P o + T r i p } }$ [20] and Logit. All attacks used TI, MI, and DI with optimal hyperparameters provided in their original work. Specifically, $\| \mathbf { W } \| _ { 1 } = 5$ was used for ‘TI’ as suggested by [12]. For each image, we used the target label that was officially specified in the dataset. If not mentioned specifically, all attacks were run with 300 iterations to ensure convergence. When being executed with a batch size of 20, the optimization process took about three seconds per image. A moderate step size of 2 was used for all attacks, and the results were shown to be not sensitive to the setting of step size (see evidence in Appendix C). We considered four diverse classifier architectures: ResNet [33], DenseNet [34], VGGNet [35], and Inception [36]. Following the common practice, the perturbations were restricted by $L _ { \infty }$ norm with $\epsilon = 1 6$ . + +Single-model transfer. Table 1 reports the targeted transferability when transferring between each pair of different model architectures. As can be seen, the logit loss outperformed CE and ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ by a large margin in almost all cases. When comparing different model architectures, we can find that the attacks achieved lower performance when transferring from the VGGNet16 or Inception-v3 than from ResNet50 or DenseNet121. This is consistent with the observations in [14, 15] and may be explained by the fact that skip connections in ResNet50 and DenseNet121 boosts transferability [37]. Another finding is that when using Inception-v3 as the target model, the transfer success rates were always low. This might be explained by the heavily engineered nature of the Inception architecture, i.e., the Inception architecture has multiple-size convolution and two auxiliary classifiers. + +Table 2: Targeted transfer success rates $( \% )$ in the commonly adopted, easy ensemble transfer scenario, where the hold-out target model (denoted by $\cdot \underline { { \cdot } }$ ) and the ensemble models share similar architectures. Results with 20/100 iterations are reported. + +
Attack-Inc-v3-Inc-v4-IncRes-v2-Res50-Res101-Res152Average
CE48.8/85.347.2/83.347.5/83.950.9/89.858.5/93.256.7/90.751.6/87.7
Po+Trip59.3/84.455.0/82.451.4/80.856.9/85.060.5/87.957.6/85.756.8/84.4
Logit56.4/85.552.9/85.854.4/85.157.5/90.064.4/91.461.3/90.857.8/88.1
+ +![](images/fdd5ac90f4750155748fa1b30949e95ff900d67c18e964d24e5a9e0a6a8ee7a4.jpg) +Figure 3: Targeted transfer success rates $( \% )$ in our challenging ensemble transfer scenario, where each hold-out target model shares no similar architecture with the source models used for ensemble. + +Ensemble transfer in both easy and challenging scenarios. A common approach to further boosting transferability is to generate perturbations on an ensemble of white-box source models. Following the common practice, we simply assigned equal weights to all the source models. We first look at the commonly adopted ensemble transfer scenario [4, 6, 20, 38] in which each hold-out target model shares a similar architecture with some of the white-box ensemble models. As can be seen from Table 2, the transfer success rates of all three attacks have got saturated when given enough iterations to converge. As a result, this transfer scenario could not fully reveal the actual strength of different attacks. We can also observe that ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ performed better than the CE loss only when the attack optimization is unreasonably restricted to 20 iterations, but became even worse with enough iterations. This finding suggests that evaluating different attacks under only few iterations may cause misleading comparative results. + +We next considered a more challenging transfer scenario with no architectural overlap between the source ensemble models and the target model, in order to fully reveal the potential of different attacks. This scenario is also more realistic since it is hard for an attacker to know the specific architecture of a real-world target mode. Figure 3 shows that in this scenario, the Logit largely outperformed CE and ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ . In addition, the results of both CE and Logit were substantially improved over the single-model transfer results reported in Table 1. However, ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ performed even worst in some cases maybe because its use of arbitrarily increasing the gradient magnitude has caused the optimization to overshoot the minima in this ensemble transfer scenario where the loss surface is relatively non-smooth due to the model diversity. Note that as in the single transfer scenario, transferring to Inception-v3 is still the most difficult. + +Table 3: Targeted transfer success rates $( \% )$ when varying the target from the high-ranked class to low. + +
Attack2nd10th200th500th800th1000th
CE89.976.749.743.137.025.1
Po+Trip82.677.658.453.649.138.2
Logit83.881.375.071.065.152.8
+ +A worse-case transfer scenario with lowranked target classes. In conventional security studies, a comprehensive evaluation commonly involves a range of attack scenarios with varied difficulty. Existing work on white-box adversarial attacks [32, 21, 23, 38] has also looked at different cases with varied difficulty regarding the ranking position of the target class in the prediction list of the original image. + +Specifically, in the best case, the targeted success is basically equal to non-targeted success, i.e., an attack is regarded to be successful as long as it can succeed on any arbitrary target other than the original class. In the average case, the target class is randomly specified, while in the worst case, the target is specified as the lowest-ranked/least-likely class. + +![](images/38b602e565fc865a9d8cfba5c4abadd7750ba6e392a528b19f1cb12a999c026c.jpg) +Figure 4: Successful targeted adversarial images on Google Cloud Vision generated by the Logit attack with ensemble transfer. More examples can be found in Appendix D. + +Table 4: Non-targeted and targeted transfer success rates $( \% )$ of different attacks on Google Cloud Vision. + +
CEPo+TripLogit
Targeted7818
Non-targeted514451
+ +However, to the best of our knowledge, current evaluation of transfer-based attacks has been limited to the best and average cases. To address this limitation, we consider a worse-case transfer scenario by varying the target from the highest-ranked class gradually to the lowest one. As can be seen from Table 3, there exists a non-negligible correlation between the ranking position of the target class and the targeted transferability. More specifically, it becomes increasingly difficult as the target moves down the prediction list. We can also observe that the results with higher-ranked targets might not reveal the actual strength of different attacks as in the more realistic, worse cases with lower-ranked targets. In particular, only looking the best case with the highest-ranked target may lead to a misleading conclusion that CE leads to the most effective attack. This finding suggests that a more meaningful evaluation on targeted transferability should further increase difficulty beyond the current best and average cases. + +Transfer-based attacks on Google Cloud Vision. Most existing work on fooling real-world computer vision systems has been focused on the query-based attacks, where a large number of queries are required [39–41]. Although several recent studies have also explored real-world transfer-based attacks, they were limited to face recognition and the non-targeted attacks [42–44]. In contrast, we applied the simple transferable attacks in the more challenging, targeted case on a more generallyused image recognition system, the Google Cloud Vision API. Specifically, we used the targeted adversarial images generated on the ensemble of all four diverse source models with 300 iterations. + +The API predicts a list of semantic labels along with confidence scores. Specifically, only the top classes with confidence no lower than $5 0 \%$ are returned, and at most 10 classes are shown. Note that the confidence score here is not a probability (which would sum to one). We measured both the targeted and non-targeted transferability. Since all returned labels are with relatively high confidence $( \geq 5 0 \% )$ ), we do not limit our measure of success rates to only top-1 class. Instead, for non-targeted success, we measured whether or not the ground-truth class appeared in the returned list, while for targeted success, whether or not the target class appeared. Due to the fact that the semantic label set predicted by the API does not exactly correspond to the 1000 ImageNet classes, we treated semantically similar classes as the same class. + +Table 4 reports the results averaged over 100 images that originally yield correct predictions. As can be seen, in general, achieving targeted transfer success is much more difficult than non-targeted success. In particular, the Logit attack achieved the best targeted transferability, with quasi-imperceptible perturbations shown in Figure 4. Our results reveal the potential vulnerability of Google Cloud Vision against simple transfer-based attacks, which require no query interaction. + +# 4.2 Simple vs. Resource-Intensive Transferable Attacks + +In this subsection, we compared simple transferable attacks with state-of-the-art resource-intensive approaches, TTP [16] and FDA(N)+xent [15], which necessitate training target-class-specific models on additional data. + +Compared with TTP. We compared the Logit attack with the state-of-the-art TTP, which is based on training target-class-specific GANs on additional data. We tested both Logit and TTP on our dataset following the “10-Targets (all-source)” setting in [16]. We chose ResNet50 as the white-box model in the single-model transfer scenario and an ensemble of $\mathrm { R e s N e t } \{ 1 8 , 5 0 , 1 0 1 , 1 5 2 \}$ in the ensemble transfer scenario. DenseNet121 and VGG16 bn are tested as the target models. Note that the same knowledge of the white-box model is available to both attacks but it is leveraged in different ways. + +Specifically, for the Logit attack, the white-box model is used as a source model for iterative attack optimization, while for TTP, it is used as a discriminator during training the GANs. + +As shown in Table 5, under the commonly adopted $\epsilon = 1 6$ , the Logit attack can achieve comparable results to TTP in all cases. Specifically, we can observe that the model ensemble is more helpful to Logit than for TTP. This might be because even with the single model as the discriminator, TTP can learn good enough features of target semantics by training with the objective of matching the perturbation and target class distributions with large-scale data. The clearer target semantics learned by TTP can be confirmed by comparing the unbounded perturbations achieved by TTP (e.g., Figure 3 in [16]) with those by the Logit shown in Figure 5. + +Table 5: Targeted transfer success rates $( \% )$ of Logit vs. TTP in single-model and ensemble transfer scenarios under two norm bounds. + +
BoundAttackD121V16D121-ensV16-ens
e= 16TTP79.678.692.989.6
Logit75.972.599.497.7
e=8TTP37.546.763.266.2
Logit44.546.892.687.0
+ +This fact that TTP perturbations heavily rely on semantic patterns of the target class might cause TTP to degrade under lower norm bounds. To validate this assumption, we further compared Logit and TTP under $\epsilon = 8$ . As expected, the Logit attack consistently surpassed TTP, especially with a very large margin in the ensemble transfer scenario. The different comparing results for the two perturbation sizes also suggest that comparing attacks only under a single perturbation size may not reveal their characteristics. + +Table 6: Targeted transfer success rates $( \% )$ of unbounded adversarial images by different attacks with the same iteration budget. + +
FDA(4) +xentCEPo+TripLogit
Res50-→Dense12165.869.388.184.1
Res50→VGG1648.154.167.874.2
+ +![](images/d0c0f928a7bbb988714c9d633bdb653be7f458932d6324a2cba9b55e81b07fd1.jpg) +Figure 5: Unbounded adversarial examples that reflect target semantics. More examples can be found in Appendix E. + +Compared with FDA(N)+xent. We compared the three simple transferable attacks (CE, ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ and Logit) with $\mathrm { F D A } ^ { ( N ) }$ +xent on generating unbounded adversarial images, in consistence with “distal transfer” in $[ 1 5 ] ^ { 2 }$ . Specifically, the adversarial perturbations were initialized as random Gaussian noise and allowed to be as large as possible. Although such unbounded adversarial images may not be practically compelling, they can provide better isolated indication on transferability by eliminating the dependency on the source images and the bound restrictions. The results were averaged over 4000 image examples, each of which was optimized towards a random target class. As suggested by [15], the MI transfer method was removed since it empirically harms the performance in this unbounded case. + +Table 6 shows that all the three simple transferable attacks achieved stronger targeted transferability than $\mathrm { F D A } ^ { ( N ) } \mathrm { + x e n t }$ . As can be seen from Figure 5, the unbounded adversarial perturbations can somehow reflect the target semantics. This finding suggests that achieving targeted transferability relies on robust, semantic features [45] that are expected to be learned by various models and also understood by humans. In this way, achieving targeted transferability is fundamentally different from non-targeted transferability, for which attacking non-robust features is known to be sufficient [45]. It is also worth noting that in practical scenarios with small norm bounds, the semantically-aligned perturbations would not be expected to change human judgements. + +# 4.3 Simple Logit Attack for Targeted UAPs in a Data-Free Manner + +The above observation that the perturbations can reflect certain target semantics motivates us to apply the Logit attack to achieving targeted Universal Adversarial Perturbations (UAPs), which can drive multiple original images into a specific target class. Existing attempts at achieving targeted UAPs have mainly relied on large-scale optimization over additional data [17–19]. However, the simple Logit attack can be easily extended to generate targeted UAPs in a data-free manner. The only difference from the above transferable Logit attack is that here a mean image (all pixel values set as 0.5 out of [0,1]) is used as the original image. + +Table 7: Success rates $( \% )$ of targeted UAPs generated by CE and Logit attacks for different models. + +
AttackInc-v3Res50Dense121VGG16
CE2.69.28.720.1
Logit4.722.821.865.9
+ +![](images/a965d24ae8b97cf0eca96389dc830cba0f3a40618f1425879de5ff1b25bee39a.jpg) +Figure 6: UAPs $\epsilon = 1 6$ , VGG16) with different classes using CE and Logit. More examples can be found in Appendix F. + +In our experiment, for each target class, we generated a single targeted UAP vector $\epsilon = 1 6$ ) with 300 iterations and applied it to all 1000 images in our dataset. Table 7 reports the results averaged over all the 1000 ImageNet classes. As can be seen, the logit loss can yield substantial success, remarkably outperforming the CE loss. This can be confirmed by Figure 6, which shows the Logit attack can yield more semantically-aligned perturbations than CE. This observation also supports the claim from [18] that universal perturbations contain dominant features, and images act like noise with respect to perturbations. + +# 5 Conclusion and Outlook + +In this paper, we have demonstrated that achieving targeted transferability is not as difficult as current work concludes. Specifically, we find that simple transferable attacks can actually achieve surprisingly strong targeted transferability when given enough iterations for convergence. We have validated the effectiveness of simple transferable attacks in a wide range of transfer scenarios, including three newly-introduced challenging scenarios. These challenging scenarios have better revealed the actual strength of different attacks. In particular, we demonstrate that a very simple Logit attack is superior in all transfer scenarios, achieving even better results than the state-of-the-art resource-intensive approaches. We also show the potential usefulness of the Logit attack for generating targeted universal adversarial perturbations in a data-free manner. Overall, we hope our findings will inspire future research to conduct a more meaningful evaluation on targeted transferability. Our future work will focus on studying why different model architectures yield different transferability. In particular, the very low success rates when targeting Inception-v3 should be explored. Moving forward, there needs to be a more comprehensive discussion on the resource consumption of different attacks from multiple aspects, such as training and inference time, hardware resources, and data size. + +Strong transferability can obviously benefit black-box applications of adversarial images for social good, such as protecting user privacy [42, 43, 46–48]. In addition, it will also motivate the community to design stronger defenses given our finding that even simple attacks can generate highly transferable adversarial images. It remains a possibility that our methodology may be misused by malicious actors to break legitimate systems. However, we firmly believe that the help that our paper can provide to researchers significantly outweighs the help that it may provide an actual malicious actor. + +# Acknowledgments + +This work was carried out on the Dutch national e-infrastructure with the support of SURF Cooperative. + +# References + +[1] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2014. +[2] Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2015. +[3] Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In ICLR, 2017. +[4] Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In CVPR, 2018. +[5] Wen Zhou, Xin Hou, Yongjun Chen, Mengyun Tang, Xiangqi Huang, Xiang Gan, and Yong Yang. Transferable adversarial perturbations. In ECCV, 2018. +[6] Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Evading defenses to transferable adversarial examples by translation-invariant attacks. In CVPR, 2019. +[7] Qian Huang, Isay Katsman, Horace He, Zeqi Gu, Serge Belongie, and Ser-Nam Lim. Enhancing adversarial example transferability with an intermediate level attack. In ICCV, 2019. +[8] Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan L Yuille. Improving transferability of adversarial examples with input diversity. In CVPR, 2019. +[9] Jiadong Lin, Chuanbiao Song, Kun He, Liwei Wang, and John E Hopcroft. Nesterov accelerated gradient and scale invariance for adversarial attacks. In ICLR, 2020. +[10] Yingwei Li, Song Bai, Yuyin Zhou, Cihang Xie, Zhishuai Zhang, and Alan L Yuille. Learning transferable adversarial examples via ghost networks. In AAAI, 2020. +[11] Weibin Wu, Yuxin Su, Xixian Chen, Shenglin Zhao, Irwin King, Michael R Lyu, and Yu-Wing Tai. Boosting the transferability of adversarial samples via attention. In CVPR, 2020. +[12] Lianli Gao, Qilong Zhang, Jingkuan Song, Xianglong Liu, and Heng Tao Shen. Patch-wise attack for fooling deep neural network. In ECCV, 2020. +[13] Nathan Inkawhich, Wei Wen, Hai Helen Li, and Yiran Chen. Feature space perturbations yield more transferable adversarial examples. In CVPR, 2019. +[14] Nathan Inkawhich, Kevin Liang, Lawrence Carin, and Yiran Chen. Transferable perturbations of deep feature distributions. In ICLR, 2020. +[15] Nathan Inkawhich, Kevin J Liang, Binghui Wang, Matthew Inkawhich, Lawrence Carin, and Yiran Chen. Perturbing across the feature hierarchy to improve standard and strict blackbox attack transferability. In NeurIPS, 2020. +[16] Muzammal Naseer, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Fatih Porikli. On generating transferable targeted perturbations. In ICCV, 2021. +[17] Omid Poursaeed, Isay Katsman, Bicheng Gao, and Serge Belongie. Generative adversarial perturbations. In CVPR, 2018. +[18] Chaoning Zhang, Philipp Benz, Tooba Imtiaz, and In So Kweon. Understanding adversarial examples from the mutual influence of images and perturbations. In CVPR, 2020. +[19] Philipp Benz, Chaoning Zhang, Tooba Imtiaz, and In So Kweon. Double targeted universal adversarial perturbations. In ACCV, 2020. +[20] Maosen Li, Cheng Deng, Tengjiao Li, Junchi Yan, Xinbo Gao, and Heng Huang. Towards transferable targeted attack. In CVPR, 2020. +[21] Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In ICLR, 2017. +[22] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018. +[23] Jer´ ome Rony, Luiz G. Hafemann, Luiz S. Oliveira, Ismail Ben Ayed, Robert Sabourin, and Eric ˆ Granger. Decoupling direction and norm for efficient gradient-based $L _ { 2 }$ adversarial attacks and defenses. In CVPR, 2019. +[24] Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. In CVPR, 2017. +[25] Konda Reddy Mopuri, Phani Krishna Uppala, and R Venkatesh Babu. Ask, acquire, and attack: Data-free UAP generation using class impressions. In ECCV, 2018. +[26] Konda Reddy Mopuri, Aditya Ganeshan, and R Venkatesh Babu. Generalizable data-free objective for crafting universal adversarial perturbations. IEEE TPAMI, 41(10):2452–2465, 2018. +[27] Muzammal Naseer, Salman H Khan, Harris Khan, Fahad Shahbaz Khan, and Fatih Porikli. Cross-domain transferability of adversarial perturbations. In NeurIPS, 2019. +[28] Yingwei Li, Song Bai, Cihang Xie, Zhenyu Liao, Xiaohui Shen, and Alan L Yuille. Regional homogeneity: Towards learning transferable universal adversarial perturbations against defenses. In ECCV, 2020. +[29] Nicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras, Ian Goodfellow, Aleksander Madry, and Alexey Kurakin. On evaluating adversarial robustness. In arXiv preprint arXiv:1902.06705, 2019. +[30] Florian Tramer, Nicholas Carlini, Wieland Brendel, and Aleksander Madry. On adaptive attacks to adversarial example defenses. In NeurIPS, 2020. +[31] Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In ICML, 2018. +[32] Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In IEEE S&P, 2017. +[33] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. +[34] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, 2017. +[35] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015. +[36] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016. +[37] Dongxian Wu, Yisen Wang, Shu-Tao Xia, James Bailey, and Xingjun Ma. Skip connections matter: On the transferability of adversarial examples generated with resnets. In ICLR, 2020. +[38] Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick \` McDaniel. Ensemble adversarial training: Attacks and defenses. In ICLR, 2018. +[39] Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In AISec, 2017. +[40] Wieland Brendel, Jonas Rauber, and Matthias Bethge. Decision-based adversarial attacks: Reliable attacks against black-box machine learning models. In ICLR, 2018. +[41] Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Black-box adversarial attacks with limited queries and information. In ICML, 2018. +[42] Valeriia Cherepanova, Micah Goldblum, Harrison Foley, Shiyuan Duan, John Dickerson, Gavin Taylor, and Tom Goldstein. LowKey: Leveraging adversarial attacks to protect social media users from facial recognition. In ICLR, 2021. +[43] Arezoo Rajabi, Rakesh B Bobba, Mike Rosulek, Charles Wright, and Wu-chi Feng. On the (im) practicality of adversarial perturbation for image privacy. PoPETs, 2021. +[44] Shawn Shan, Emily Wenger, Jiayun Zhang, Huiying Li, Haitao Zheng, and Ben Y Zhao. Fawkes: Protecting privacy against unauthorized deep learning models. In USENIX Security, 2020. +[45] Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Logan Engstrom, Brandon Tran, and Aleksander Madry. Adversarial examples are not bugs, they are features. In NeurIPS, 2019. +[46] Martha Larson, Zhuoran Liu, Simon Brugman, and Zhengyu Zhao. Pixel privacy: Increasing image appeal while blocking automatic inference of sensitive scene information. In MediaEval Multimedia Benchmark Workshop, 2018. +[47] Zhuoran Liu, Zhengyu Zhao, and Martha Larson. Who’s afraid of adversarial queries? the impact of image modifications on content-based image retrieval. In ICMR, 2019. +[48] Seong Joon Oh, Mario Fritz, and Bernt Schiele. Adversarial image perturbation for privacy protection a game theory perspective. In ICCV, 2017. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] We described the limitation in the first sentence of the final section. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] We discuss them at the end of the final section. +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code (including instructions and a link to data we have used) has been submitted as the supplemental material. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Our experiments did not involve any model training, but all the algorithm details were specified. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We fixed the random seed for all the experiments. Now the main randomness comes from the $p$ in the existing method, DI (see Eq. 6). We confirm that it has little impact on the results. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We mentioned the run time of the attacks and our hardware settings in Section 4. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] In Section 4. +(b) Did you mention the license of the assets? [Yes] In a footnote of Section 4. +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] We did not use any new assets. +(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] In the same footnote as above. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] In the same footnote as above. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/md/train/MNVjrDpu6Yo/MNVjrDpu6Yo.md b/md/train/MNVjrDpu6Yo/MNVjrDpu6Yo.md new file mode 100644 index 0000000000000000000000000000000000000000..3250b0f384fdb6e7346e40cbd11f3c362cc391d6 --- /dev/null +++ b/md/train/MNVjrDpu6Yo/MNVjrDpu6Yo.md @@ -0,0 +1,285 @@ +# Sparse Training via Boosting Pruning Plasticity with Neuroregeneration + +Shiwei Liu1∗, Tianlong Chen2, Xiaohan Chen2, Zahra Atashgahi3, $\mathbf { L u \ Y i n ^ { 1 } }$ , Huanyu $\mathbf { K o u } ^ { 4 }$ , Li Shen5, Mykola Pechenizkiy1,6, Zhangyang Wang2, Decebal Constantin Mocanu1,3 1Eindhoven University of Technology, 2University of Texas at Austin 3University of Twente,4University of Leeds, $^ 5 \mathrm { J D }$ Explore Academy, 6University of Jyväskylä {s.liu3,l.yin,m.pechenizkiy}@tue.nl, {tianlong.chen,xiaohan.chen,atlaswang}@utexas.edu {z.atashgahi,d.c.mocanu}@utwente.nl, {khydouble1,mathshenli}@gmail.com + +# Abstract + +Works on lottery ticket hypothesis (LTH) and single-shot network pruning (SNIP) have raised a lot of attention currently on post-training pruning (iterative magnitude pruning), and before-training pruning (pruning at initialization). The former method suffers from an extremely large computation cost and the latter usually struggles with insufficient performance. In comparison, during-training pruning, a class of pruning methods that simultaneously enjoys the training/inference efficiency and the comparable performance, temporarily, has been less explored. To better understand during-training pruning, we quantitatively study the effect of pruning throughout training from the perspective of pruning plasticity (the ability of the pruned networks to recover the original performance). Pruning plasticity can help explain several other empirical observations about neural network pruning in literature. We further find that pruning plasticity can be substantially improved by injecting a brain-inspired mechanism called neuroregeneration, i.e., to regenerate the same number of connections as pruned. We design a novel gradual magnitude pruning (GMP) method, named gradual pruning with zerocost neuroregeneration (GraNet), that advances state of the art. Perhaps most impressively, its sparse-to-sparse version for the first time boosts the sparse-tosparse training performance over various dense-to-sparse methods with ResNet50 on ImageNet without extending the training time. We release all codes in https://github.com/Shiweiliuiiiiiii/GraNet. + +# 1 Introduction + +Neural network pruning is the most common technique to reduce the parameter count, storage requirements, and computational costs of modern neural network architectures. Recently, posttraining pruning [49, 29, 18, 47, 10, 54, 74, 5, 57, 75] and before-training pruning [31, 30, 67, 63, 6, 11] have been two fast-rising fields, boosted by lottery tickets hypothesis (LTH) [10] and singleshot network pruning (SNIP) [31]. The process of post-training pruning typically involves fully pre-training a dense network as well as many cycles of retraining (either fine-tuning [18, 17, 39] or rewinding [12, 54]). As the training costs of the state-of-the-art models, e.g., GPT-3 [4] and FixEfficientNet-L2 [64] have exploded, this process can lead to a large amount of overhead cost. + +Recently emerged methods for pruning at initialization significantly reduce the training cost by identifying a trainable sub-network before the main training process. While promising, the existing methods fail to match the performance achieved by the magnitude pruning after training [11]. + +![](images/af59a1e56490518e8d401f0013dfad93dbe5e7acc35baaaec44d4e8e171492f4.jpg) +Figure 1: Schematic view of GraNet. Left: Gradual pruning starts with a sparse subnetwork and gradually prune the subnetwork to the target sparsity during training. Right: We perform zero-cost neuroregeneration after each gradual pruning step. Light blue blocks/lines refer to the “damaged” connections and orange blocks/lines refer to the regenerated new connections. + +Compared with the above-mentioned two classes of pruning, during-training pruning is a class of methods that reap the acceleration benefits of sparsity early on the training and meanwhile achieve promising performance by consulting the information obtained during training. There are some works [77, 13, 33] attempting to gradually prune the network to the desired sparsity during training, while they mainly focus on the performance improvement. Up to now, the understanding of duringtraining pruning has been less explored due to its more complicated dynamical process, and the performance gap still exists between pruning during training and full dense training. + +To better understand the effect of pruning during the optimization process (not at inference), we study the ability of the pruned models to recover the original performance after a short continued training with the current learning rate, which we call pruning plasticity (see Section 3.1 for a more formal definition). Inspired by the neuroregeneration mechanism in the nervous system where new neurons and connections are synthesized to recover the damage in the nervous system [26, 41, 73], we examine if allowing the pruned network to regenerate new connections can improve pruning plasticity, and hence contribute to pruning during training. We consequently propose a parameter-efficient method to regenerate new connections during the gradual pruning process. Different from the existing works for pruning understanding which mainly focus on dense-to-sparse training [42] (training a dense model and prune it to the target sparsity), we also consider sparse-to-sparse training (training a sparse model yet adaptively re-creating the sparsity pattern) which recently has received an upsurge of interest in machine learning [44, 3, 9, 48, 8, 37, 36]. + +In short, we have the following main findings during the course of the study: + +#1. Both pruning rate and learning rate matter for pruning plasticity. When pruned with low pruning rates (e.g., 0.2), both dense-to-sparse training and sparse-to-sparse training can easily recover from pruning. On the contrary, if too many parameters are removed at one time, almost all models suffer from accuracy drops. This finding makes a connection to the success of the iterative magnitude pruning [10, 54, 5, 6, 65], where usually a pruning process with a small pruning rate (e.g., 0.2) needs to be iteratively repeated for good performance. + +Pruning plasticity also gradually decreases as the learning rate drops. When pruning happens during the training phase with large learning rates, models can easily recover from pruning (up to a certain level). However, pruning plasticity drops significantly after the second learning rate decay, leading to a situation where the pruned networks can not recover with continued training. This finding helps to explain several observations (1) for gradual magnitude pruning (GMP), it is always optimal to end pruning before the second learning rate drop [77, 13]; (2) dynamic sparse training (DST) benefits from a monotonically decreasing pruning rate with cosine or linear update schedule [8, 9]; (3) rewinding techniques [12, 54] outperform fine-tuning as rewinding retrains subnetworks with the original learning rate schedule whereas fine-tuning often retrains with the smallest learning rate. + +#2. Neuroregeneration improves pruning plasticity. Neuroregeneration [41, 73] refers to the regrowth or repair of nervous tissues, cells, or cell products. Conceptually, it involves synthesizing new neurons, glia, axons, myelin, or synapses, providing extra resources in the long term to replace those damaged by the injury, and achieving a lasting functional recovery. Such mechanism is closely related to the brain plasticity [51], and we borrow this concept to developing a computational regime. + +We show that, while regenerating the same number of connections as pruned, the pruning plasticity is observed to improve remarkably, indicating a more neuroplastic model being developed. However, it increases memory and computational overheads and seems to contradict the benefits of pruningduring-training. This however raises the question: can we achieve efficient neuroregeneration during training with no extra costs? We provide an affirmative answer to this question. + +#3. Pruning plasticity with neuroregeneration can be leveraged to substantially boost sparse training performance. The above-mentioned findings of pruning plasticity can generalize to the final performance level under a full continued training to the end. Imitating the neuroregeneration behavior [41, 73], we propose a new sparse training method – gradual pruning with zero-cost neuroregeneration (GraNet), which is capable of performing regeneration without increasing the parameter count. + +In experiments, GraNet establishes the new state-of-the-art performance bar for dense-to-sparse training and sparse-to-sparse training, respectively. Particularly, the latter for the first time boosts the sparse-to-sparse training performance over various dense-to-sparse methods by a large margin without extending the training time, with ResNet-50 on ImageNet. Besides the consistent performance improvement, we find the subnetworks that GraNet learns are more accurate than the ones learned by the existing gradual pruning method, providing explanations for the success of GraNet. + +# 2 Related Work + +Post-Training Pruning. Methods that yield a sparse neural network from a pre-trained network by pruning the unimportant weights or neurons, to the best of our knowledge, were proposed in [24] and [50]. After that, various pruning methods have emerged to provide increasingly efficient methods to identify sparse neural networks for inference. The pruning criterion includes weight magnitude [18, 10], gradient [61] Hessian [29, 19, 59], Taylor expansion [47, 46], etc. Low-rank decomposition [7, 23, 17, 71] are also used to induce structured sparsity in terms of channels or filters. Most of the above-mentioned pruning methods require many pruning and re-training cycles to achieve the desired performance. + +During-Training Pruning. Instead of inheriting weights from a pre-trained model, some works attempt to discover well-performing sparse neural networks with one single training process. + +Gradual Magnitude Pruning (GMP), introduced in [77] and studied further in [13], gradually sparsifies the neural network during the training process until the desired sparsity is reached. Besides, [40] and [68] are prior works that enforce the network to sparse during training via $L _ { 0 }$ and $L _ { 1 }$ regularization, respectively. [60, 34, 55, 70, 28] moved further by introducing trainable sparsity heuristics to learn the sparse masks and weights simultaneously. These methods are all classified as dense-to-sparse training as they start from a dense network. + +Dynamic Sparse Training (DST) [44, 3, 48, 8, 9, 36, 35, 25] is another class of methods that prune models during training. The key factor of DST is that it starts from a random initialized sparse network and optimizes the sparse topology as well as the weights simultaneously during training (sparse-to-sparse training). Without an extended training time [37], sparse-to-sparse training usually falls short of dense-to-sparse training in terms of the prediction accuracy. For further details, see the survey of [43, 21]. + +Before-Training Pruning. Motivated by SNIP [31], many works [67, 63, 6] have emerged recently to explore the possibility of obtaining a trainable sparse neural network before the main training process. [11] demonstrates that the existing methods for pruning at initialization perform equally well when the unpruned weights are randomly shuffled, which reveals that what these methods discover is the layer-wise sparsity ratio, rather than the indispensable weight values and positions. Our analysis shows that both the mask positions and weight values are crucial for GraNet. + +# 3 Methodology for Pruning Plasticity + +The primary goal of this paper is to study the effect of pruning as well as neuroregeneration on neural networks during the standard training process. Therefore, we do not consider post-training pruning and before-training pruning. Below, we introduce in detail the definition of pruning plasticity and the experimental design that we used to study pruning plasticity. + +# 3.1 Metrics + +Let us denote $W _ { t } \in \mathbb { R } ^ { d }$ as the weights of the network and $m _ { t } \in \{ 0 , 1 \} ^ { d }$ as the binary mask yielded from the pruning method at epoch $t$ . Thus, the pruned network can be denoted as $W _ { t } \odot m _ { t }$ . Let $T$ be the total number of epochs the model should be trained. Let $\mathbf { C O N T R A I N } ^ { k } ( W _ { t } \odot m _ { t } , a )$ refers to the function that continues to train the pruned model for $k$ epochs with the learning rate schedule $a$ . + +Definition of Pruning plasticity. We define pruning plasticity as $t _ { \mathrm { C O N T R A I N } ^ { k } ( W _ { t } \odot m _ { t } , a _ { t } ) } - t _ { \mathrm { P R E } }$ , where $t _ { \mathrm { P R E } }$ is the test accuracy measured before pruning and $t _ { \mathrm { C O N T R A I N } ^ { k } \left( W _ { t } \odot m _ { t } , a _ { t } \right) }$ is the test accuracy measured after $k$ epoch of continued training $\mathbf { C O N T R A I N } ^ { k } ( W _ { t } \odot m _ { t } , a _ { t } )$ . Specifically, to better understand the effect of pruning on the current model status and to avoid the effect of learning rate decay, we fix the learning rate as the one when the model is pruned, i.e, $a _ { t }$ . This setting is also appealing to GMP [77, 13] and DST [44, 9, 48, 37] in which most of the pruned models are continually trained with the current learning rate for some time. + +Final performance gap. Nevertheless, we also investigate the effect of pruning on the final performance, that is, continually training the pruned networks to the end with the remaining learning rate schedule CONTRAINT −t(Wt mt, a[t+1:T ]). In this case, we report tCONTRAINT−t(Wt mt,a[t+1:T]) − $t _ { \mathrm { F I N A L } }$ , where $t _ { \mathrm { F I N A L } }$ is the final test accuracy of the unpruned models. + +# 3.2 Architectures and Datasets + +We choose two commonly used architectures to study pruning plasticity, VGG-19 [58] with batch normalization on CIFAR-10 [27], and ResNet-20 [20] on CIFAR-10. + +We share the summary of the networks, data, and hyperparameters of dense-to-sparse training in Table 1. We use standard implementations and hyperparameters available online, with the exception of the small batch size for the ResNet-50 on ImageNet due to the limited hardware resources $( 2 \times$ Tesla V100). All accuracies are in line with the baselines reported in the references [8, 11, 67, 9, 37]. + +Table 1: Summary of the architectures and hyperparameters we study in this paper. + +
ModelData#EpochBatch SizeLRLR Decay, EpochWeight DecayTest Accuracy
ResNet-20CIFAR-101601280.1(β= 0.9)10×,[80,120]0.000592.41±0.04
VGG-19CIFAR-101601280.1(β=0.9)10×,[80,120]0.000593.85±0.05
CIFAR-1001601280.1 (β=0.9)10×,[80,120]0.000573.43±0.08
ResNet-50CIFAR-101601280.1(β=0.9)10×,[80,120]0.000594.75±0.01
CIFAR-1001601280.1 (β=0.9)10×,[80,120]0.000578.23±0.18
ImageNet100640.1(β=0.9)10×,[30,60,90]0.000476.80±0.09
+ +# 3.3 How to Prune, and How to Regenerate + +Structured and Unstructured Pruning. We consider unstructured and structured pruning in this paper. Structured pruning prunes weights in groups, or removes the entire neurons, convolutional filters, or channels, enabling acceleration with the off-the-shelf hardware. In particular, we choose the filter pruning method used in Li et al. [32]. Unstructured sparsity is a more promising direction not only due to its outstanding performance at extreme sparsities but the increasing support for sparse operation in the practical hardware [35, 14, 52, 76, 22]. For example, Liu et al. [35] illustrated for the first time the true potential of DST, demonstrating significant training/inference efficiency improvement over the dense training. Different from prior conventions [77, 13, 33, 2] where values of the pruned weights are kept, we set the pruned weights to zero to eliminate the historical information for all implementations in this paper. + +Magnitude pruning. We prune the weights with the smallest magnitude, as it has evolved as the standard method when pruning happens during training, e.g., GMP [77, 13] and DST [44, 9, 37]. We are also aware of other pruning criteria including but not limited to Hessian [29, 19, 59], Taylor expansion [47, 46], connection sensitivity [31], Gradient Flow [67], Neural Tangent Kernel [38, 16]. + +One-shot pruning. To isolate the pruning effect at different training stages and to avoid the interaction between two iterations of pruning, we focus on one-shot pruning. Please note that iterative pruning can also be generalized in our setting, as our experimental design includes neural networks trained at various sparsities and each of them is further pruned with various pruning rates. + +Layer-wise pruning and global pruning. We study both the layer-wise magnitude pruning and global magnitude pruning for pruning plasticity. Global magnitude pruning prunes different layers together and leads to non-uniform sparsity distributions; layer-wise pruning operates layer by layer, resulting in uniform distributions. + +Gradient-based regeneration. The simplest regeneration scheme is to randomly activate new connections [3, 44]. However, it would take a lot of time for random regeneration to discover the important connections, especially for the very extreme sparsities. Alternatively, gradients, including those for the connections with zero weights, provide good indicators for the connection importance. For this reason, we focus on gradient-based regeneration proposed in Rigged Lottery ( RigL) [9], i.e., regenerating the same number of connections as pruned with the largest gradient magnitude. + +# 3.4 Experimental Results + +We study pruning plasticity during training with/without regeneration, for both dense training and sparse training. We report the results of ResNet-20 on CIFAR-10 with unstructured global pruning in the main body of the paper. The rest of the experiments are given in Appendix A. Unless otherwise stated, results are qualitatively similar across all networks. Concretely, we first pre-train networks at four sparsity levels, including 0, 0.5, 0.9, and 0.98. The sparse neural networks are trained with uniform distribution (i.e., all layers have the same sparsity). We further choose four pruning rates, e.g., 0.2, 0.5, 0.9, and 0.98, to measure the corresponding pruning plasticity of the pre-trained networks. + +Pruning plasticity. We continue to train the pruned model for 30 epochs and report pruning plasticity in Figure 2. Overall, the learning rate schedule, the pruning rate, and the sparsity of the original models all have a big impact on pruning plasticity. Pruning plasticity decreases as the learning rate decays for all models with different sparsity levels. The models trained with a large learning rate 0.1 can easily recover, or exceed the original performance except for the extremely large pruning rate 0.98. However, the models obtained during the later training phases can recover only with the mild pruning rate choices, e.g., 0.2 (orange lines) and 0.5 (green lines). + +We next demonstrate the effect of connection regeneration on pruning plasticity in the bottom row of Figure 2. It is clear to see that connection regeneration significantly improves pruning plasticity of all the cases, especially for the models that are over-pruned (purple lines). Still, even with connection regeneration, pruning plasticity suffers from performance degradation when pruning occurs after the learning rate drops. + +![](images/c338301a4ebef994b551eeb1f67f260d2b4f5344dde37b82b7c5b30eebc84265.jpg) +Figure 2: Unstructured Pruning: Pruning plasticity (see Section 3.1 for definition) under a 30- epoch continued training with and without connection regeneration for ResNet-20 on CIFAR-10. The vertical red lines refer to the points when the learning rate is decayed. “Pre-trained Sparsity” refers to the original sparsity of the pre-trained networks before pruning. The pruning method is the magnitude global pruning. + +Final performance gap. Compared with the current model status, people might be more interested in the effect of pruning on the final performance. We further measure the performance gap between the original test accuracy of the unpruned models and the final test accuracy of the pruned model under a full continued training $\mathrm { C O N T R A I N } ^ { T - t } ( W _ { t } \odot m _ { t } , a _ { [ t + 1 : T ] } )$ in Figure 3. + +We observe that, in this case, large learning rates do not enjoy large performance improvement, but still, the performance gap increases as the learning rate drops. It is reasonable to conjecture that the accuracy improvement of pruning plasticity with the large learning rate, 0.1, is due to the unconverged performance during the early phase of training. Besides, it is surprising to find that the final performance of extreme sparse networks (e.g., the third column and the fourth column) significantly benefits from mild pruning. Again, the ability of the pruned model to recover from pruning remarkably improves after regenerating the connections back. + +![](images/78e7ffb5d0599e001dd0778df1062b6ee6477a20a43770d2c2a2cc2ef03df9be.jpg) +Figure 3: Unstructured Pruning: Final performance gap between the unpruned models and the pruned models for ResNet-20 on CIFAR-10. The vertical red lines refer to the points when the learning rate is decayed. “Pre-trained Sparsity” refers to the original sparsity of the pre-trained networks before pruning. The pruning method is the magnitude global pruning. + +# 4 Gradual Pruning with Zero-Cost Neuroregeneration + +So far, we have known that regenerating the important connections to the pruned models during training substantially improves pruning plasticity as well as the final performance. However, naively regenerating extra connections increases the parameter count and conflicts with the motivation of gradual pruning. + +Inspired by the mechanism of neuroregeneration in the nervous system, we propose a novel sparse training method which we call gradual pruning with zero-cost neuroregeneration (GraNet). GraNet consults the information produced throughout training and regenerates important connections during training in a parameter-efficient fashion. See Appendix B.1 for the pseudocode of GraNet. We introduce the main components of GraNet below. + +# 4.1 Gradual Pruning + +We follow the gradual pruning scheme used in [77] and gradually sparsifies the dense network to the target sparsity level over $n$ pruning iterations. Let us define $s _ { i }$ is the initial sparsity, $s _ { f }$ is the target sparsity, $t _ { 0 }$ is is the starting epoch of gradual pruning, $t _ { f }$ is the end epoch of gradual pruning, and $\Delta t$ is the pruning frequency. The pruning rate of each pruning iteration is: + +$$ +s _ { t } = s _ { f } + ( s _ { i } - s _ { f } ) \left( 1 - \frac { t - t _ { 0 } } { n \Delta t } \right) ^ { 3 } , t \in \left\{ t _ { 0 } , t _ { 0 } + \Delta t , . . . , t _ { 0 } + n \Delta t \right\} . +$$ + +We choose global pruning for our method as it generally achieves better performance than uniform pruning. We also report the performance of the uniform sparsity as used in [13] in Appendix C.3. + +The conventional gradual pruning methods [77, 13] change the mask (not the weight values) to fulfill the pruning operation, so that the pruned connections have the possibility to be reactivated in the later training phases. Despite this, since the weights of the pruned connections are not updated, they have a small chance to receive sufficient updates to exceed the pruning threshold. This hinders the regeneration of the important connections. + +# 4.2 Zero-Cost Neuroregeneration + +The main difference between GraNet and the conventional GMP methods [77, 13] is the Zero-Cost Neuroregeneration. Imitating the neuroregeneration of the peripheral nervous system [41, 73] where new neurons and connections are synthesized to replace the damaged ones, we first detect and eliminate the “damaged” connections, and then regenerate the same number of new connections. By doing this, we can achieve connection regeneration without increasing the number of connections. + +Concretely, we identify the “damaged” connections as the ones with the smallest weight magnitudes. Small magnitude indicates that either the weight’s gradient is small or a large number of oscillations occur to the gradient direction. Therefore, these weights have a small contribution to the training loss and can be removed. Again, we use the gradient as the importance score for regeneration, same as the regrow method as used in RigL [9]. + +Why we call it “Zero-Cost Neuroregeneration"? In addition to not increasing the connection (parameter) count, the backward pass of our method is sparse most of the time even though our regeneration utilizes the dense gradient to identify the important connections. We perform neuroregeneration immediately after each gradual pruning step, meaning that the regeneration occurs only once every several thousand iterations. The extra overhead to calculate the dense gradient can be amortized compared with the whole training costs. Compared with the methods [33, 69] that require updating all the weights in the backward pass, our method is much more training efficient, as around 2/3 of the training FLOPs is owing to the backward pass [9, 72]. + +Let us denote $r$ as the ratio of the number of the regenerated connections to the total number of connections; $W$ is the network weight. We first remove $r$ proportion of “damaged” weights with the smallest magnitude by: + +$$ +W ^ { \prime } = \mathrm { T o p K } \left( | W | , 1 - r \right) . +$$ + +Here $\mathrm { T o p K } ( v , k )$ returns the weight tensor retaining the top $k$ -proportion of elements from $v$ . Immediately after that, we regenerate $r$ proportion of new connections based on the gradient magnitude: + +$$ +W = W ^ { \prime } + \mathrm { T o p K } \left( | \mathbf { g } _ { i \notin W ^ { \prime } } | , r \right) , +$$ + +where $\left| { \bf g } _ { i \notin W ^ { \prime } } \right|$ are the gradient magnitude of the zero weights. We perform Zero-Cost Neuroregeneration layer by layer from the beginning of the training to the end. + +GraNet can naturally generalize to the dense-to-sparse training scenario and the sparse-to-sparse training scenario by setting the initial sparsity level $s _ { i } = 0$ and $s _ { i } > 0$ in Eq. (1), respectively. For simplicity, we set $s _ { i } = 0 . 5$ , $t _ { 0 } = 0$ , and $t _ { f }$ as the epoch when performing the first learning rate decay for the sparse-to-sparse training. Different from the existing sparse-to-sparse training methods, i.e., SET [44], RigL [9], and ITOP [37], in which the sparsity is fixed throughout training, GraNet starts from a denser yet still sparse model and gradually prunes the sparse model to the desired sparsity. Although starting with more parameters, the global pruning technique of gradual pruning helps GraNet quickly evolve to a better sparsity distribution than RigL with lower feedforward FLOPs and higher test accuracy. What’s more, GraNet sparsifies all layers including the first convolutional layer and the last fully-connected layer. + +# 4.3 Experimental Results + +We conduct various experiments to evaluate the effectiveness of GraNet. We compare GraNet with various dense-to-sparse methods and sparse-to-sparse methods. The results of Rigged Lottery (RigL) and GMP with CIFAR-10/100 were reproduced by our implementation with PyTorch so that the only difference between GraNet and GMP is the Zero-Cost Neuroregeneration. For each model, we divide the results into three groups from top to bottom: pruning at initialization, dynamic sparse training and dense-to-sparse methods. See Appendix B for more implementation details used in the experiments. GraNet $\mathit { s } _ { i } = 0 . 5$ ) refers to the sparse-to-sparse version and the and GraNet ${ \bf \nabla } _ { s _ { i } } = 0$ ) refers to the dense-to-sparse version. + +CIFAR-10/100. The results of CIFAR-10/100 are shared in Table 2. We can observe that performance differences among different methods on CIFAR-10 are generally small, but still, GraNet ${ \bf \Phi } _ { s _ { i } } = 0 $ ) consistently improves the performance over GMP except for the sparsity $9 5 \%$ , and achieves the highest accuracy in 4 out of 6 cases. In terms of the more complex data CIFAR-100, the performance differences between the during-training pruning methods and before-training pruning methods are much larger. GraNet $( s _ { i } = 0$ ) again consistently outperforms GMP with all sparsities, highlighting the benefits of Zero-Cost Neuroregeneration. It is maybe more interesting that GraNet ${ \bf \nabla } _ { s _ { i } } = 0$ ) even outperforms the post-training method, subdifferential inclusion for sparsity (SIS), by a large margin. + +In terms of sparse-to-sparse training, our proposed GraNet ( $s _ { i } = 0 . 5$ ) has a dominant performance over other methods. Especially at the very extreme sparsity 0.98, our method outperforms RigL by $1 . 4 0 \%$ and $2 . 2 2 \%$ with VGG-19 on CIFAR-10 and CIFAR-100, respectively. + +ImageNet. Due to the small data size, the experiments with CIFAR-10/100 may not be sufficient to draw a solid conclusion. We further evaluate our method with ResNet-50 on ImageNet in Table 3. + +Table 2: Test accuracy of pruned VGG-19 and ResNet-50 on CIFAR-10/100. We mark the best sparse-to-sparse training results in blue and the best dense-to-sparse training results in bold. The results reported with (mean $\pm$ std) are run with three different random seeds by us. The rest are obtained from [66] and [67]. Note that the accuracy of RigL is higher than the ones reported in [66], as we choose a large update interval following the In-Time Over-Parameterization strategy [37]. $s _ { i }$ refers to the initial sparsity of GraNet. + +
DatasetCIFAR-10CIFAR-100
Pruning ratio90%95%98%90%95%98%
VGG-19 (Dense)93.85±0.051173.43±0.081=
SNIP [31]93.6393.4392.0572.8471.8358.46
GraSP[67]93.3093.0492.1971.9571.2368.90
SynFlow [63]93.3593.4592.2471.7771.7270.94
Deep-R [3]90.8189.5986.7766.8363.4659.58
SET[44]92.4691.7389.1872.3669.8165.94
RigL[9]93.38±0.1193.06±0.0991.98±0.0973.13±0.2872.14±0.1569.82±0.09
GraNet (si= 0.5) (ours)93.73±0.0893.66±0.0793.38±0.1573.30±0.1373.18±0.3172.04±0.13
STR [28]93.7393.2792.2171.9371.1469.89
SIS [66]93.9993.3193.1672.0671.8571.17
GMP [13]93.59±0.1093.58±0.0793.52±0.0373.10±0.1272.30±0.1572.07±0.37
GraNet (si= O) (ours)93.80±0.1093.72±0.1193.63±0.0873.74±0.3073.10±0.0472.35±0.26
ResNet-50 (Dense)94.75±0.0178.23±0.18
SNIP [31]92.6590.8687.2173.1469.2558.43
GraSP [67]92.4791.3288.7773.2870.2962.12
SynFlow [63]92.4991.2288.8273.3770.3762.17
RigL [9]94.45±0.4393.86±0.2593.26±0.2276.50±0.3376.03±0.3475.06±0.27
GraNet (si= 0.5) (ours)94.64±0.2794.38±0.2894.01±0.2377.89±0.3377.16±0.5277.14±0.45
STR [28]92.5991.3588.7573.4570.4562.34
SIS [66]92.8191.6990.1173.8170.6262.75
GMP[13]94.34±0.0994.52±0.0894.19±0.0476.91±0.2376.42±0.5175.58±0.20
GraNet (si = O) (ours)94.49±0.0894.44±0.0194.34±0.1777.29±0.4576.71±0.2676.10±0.20
+ +Table 3: Test accuracy of pruned ResNet-50 on ImageNet dataset. The best results of DST methods are marked as blue and the best results of pruning during training methods are marked in bold. The training/test FLOPs are normalized with the FLOPs of a dense model. $s _ { i }$ refers to the initial sparsity of GraNet. + +
MethodTop-1 AccuracyFLOPs (Train)FLOPs (Test)TOP-1 AccuracyFLOPs (Train)FLOPs (Test)
Dense76.8±0.091x (3.2e18)1x (8.2e9)76.8±0.091x (3.2e18)1x (8.2e9)
Pruning ratio80%90%
Static (ERK) Small-Dense72.1±0.040.42×0.42×67.7±0.120.24×0.24×
72.1±0.060.23×0.23×67.2±0.120.10×0.10×
72.0±0.060.23×0.23×67.2±0.120.10×0.10×
SET [44] DSR[48] RigL (ERK) [9]72.9±0.390.23×0.23×69.6±0.230.10×0.10×
73.30.40×0.40×71.60.30×0.30×
75.1±0.050.42×0.42×73.0±0.040.25×0.24×
75.2±0.110.61×0.42×72.9±0.060.50×0.24×
76.00.37×0.35×74.50.25×0.20×
STR [28]76.1n/a0.17×74.0n/a0.08×
DPF [33]75.10.71×0.23×n/an/an/a
GMP[13]75.60.56×0.23×73.90.51×0.10×
GraNet (si = 0) (ours)75.80.34×0.28×74.20.23×0.16×
+ +We only run this experiment once due to the limited resources. We set $t _ { 0 } = 0$ and $t _ { f } = 3 0$ for both GraNet $( s _ { i } = 0$ ) and GraNet ${ \mathit { s } } _ { i } = 0 . 5 { \mathit { \Sigma } }$ ) on ImageNet. Again, GraNet $( s _ { i } = 0$ ) outperforms GMP consistently with only half training FLOPs and achieves the highest accuracy among all the dense-to-sparse methods at sparsity of 0.9. Surprisingly, GraNet ${ \mathit { s } } _ { i } = 0 . 5 { \mathit { \Sigma } }$ ) significantly boosts the sparse-to-sparse training performance, even over the dense-to-sparse training. Concretely, GraNet + +$s _ { i } = 0 . 5 )$ ) outperforms RigL by $0 . 9 \%$ and $1 . 5 \%$ at sparsity 0.8 and 0.9, respectively. To the best of our knowledge, this is the first time in the literature that sparse-to-sparse training reaches a test accuracy of $76 \%$ with ResNet-50 on ImageNet at sparsity 0.8, without extension of training time. It is reasonable for GraNet $\mathit { s } _ { i } = 0 . 5$ ) to achieve better accuracy than RigL, since the denser models at the beginning help GraNet explore more the parameter space. According to the In-Time Over-Parameterization hypothesis [37], the performance of sparse training methods is highly correlated with the total number of parameters that the sparse model has visited. + +We further report the training/inference FLOPs required by all pruning methods. Compared with other dense-to-sparse methods, the final networks learned by GraNet $( s _ { i } = 0 )$ ) require more FLOPs to test, whereas the overall training FLOPs required by GraNet ${ { s } _ { i } } = 0$ ) are smaller than others. Even though starting from a denser model, GraNet $\mathit { s } _ { i } = 0 . 5$ ) requires less training and inference FLOPs than the state-of-the-art method, i.e., RigL. The sparsity budgets for 0.9 sparse ResNet-50 on ImageNet-1K learned by our methods are reported in Appendix D. We also report how FLOPs of the pruned ResNet-50 evolve during the course of training in Appendix E. + +# 4.4 Effect of the Initial Sparsity + +As we mentioned earlier, the denser initial network is the key factor in the success of GraNet. We conducted experiments to study the effect of the initial sparsity on GraNet with ResNet-50 on ImageNet. The initial sparsity is chosen from [0.0, 0.5, 0.6, 0.7, 0.8, 0.9] and the final sparsity is fixed as 0.9. The results are shared in Table 4. We can see the training FLOPs of GraNet are quite robust to the initial sparsity. Surprisingly yet reasonably, it seems that the the smaller the initial sparsity is (up to 0.5), the better final sparsity distribution GraNet finds, with higher test accuracy and fewer feedforward FLOPs. The lower feedforward FLOPs of the final network perfectly balance the overhead caused by the denser initial network. + +Table 4: Effect of the initial sparsity on GraNet with ResNet-50 on ImageNet. The training/test FLOPs are normalized with the FLOPs of a dense model. + +
MethodSiSfTop-1 [%] AccuracyFLOPs (Train)FLOPs (Test)
GraNet0.00.974.20.23×0.16×
GraNet0.50.974.50.25×0.20×
GraNet0.60.974.40.25×0.22×
GraNet0.70.974.20.24×0.22×
GraNet0.80.974.10.25×0.24×
RigL0.90.973.00.25×0.24×
+ +# 4.5 Performance of GraNet at Extreme Sparsities + +In this section, we share the results of GraNet and RigL at extreme sparsities. The initial sparsity is set as 0.5. When the final sparsity is relatively smaller (e.g., 0.8, 0.9), GraNet requires a lower (or the same) number of training FLOPs than RigL, whereas GraNet requires more training FLOPs than RigL when the final sparsity is extremely high (e.g., 0.95, 0.965). This makes sense since when the sparsity is extremely high, the saved FLOPs count of the distribution discovered by GraNet is too small to amortize the overhead caused by denser initial models. Yet, the increased number of training FLOPs of GraNet leads to substantial accuracy improvement $( > 2 \% )$ over RigL. The efficiency of GraNet ( $s _ { i } = 0 . 5$ ) comes from two important technical differences compared with RigL: (1) better final sparse distribution discovered by global pruning; (2) a shorter period of gradual pruning time (the first 30 epochs for ResNet-50 on ImageNet). Although starting with more parameters, the global pruning enables GraNet to quickly (first 30 epochs) evolve to a better sparsity distribution with lower test FLOPs than ERK. After 30 epochs of gradual pruning, the network continues to be trained with this better distribution for 70 epochs, so that the overhead in the early training phase with larger training FLOPs is amortized by the later and longer training phase with fewer training FLOPs. + +Table 5: Comparison between GraNet and RigL at extreme sparsities with ResNet-50 on ImageNet. The training/test FLOPs are normalized with the FLOPs of a dense model. + +
MethodSisfTop-1[%] AccuracyFLOPs (Train)FLOPs (Test)
RigL GraNet0.80.875.10.42×0.42×
RigL0.5 0.90.8 0.976.0 73.00.37× 0.25×0.35× 0.24×
GraNet0.50.974.50.25×0.20×
RigL GraNet0.95 0.50.95 0.9569.7 72.30.12× 0.17×0.12× 0.12×
RigL0.9650.96567.20.11×0.11×
GraNet0.50.96570.50.15×0.09×
+ +# 4.6 Ablation Study of Random Reinitialization + +Next, we ask whether what GraNet learned are the specific sparse connectivity or the sparse connectivity together with the weight values. We randomly reinitialize the pruned network with the same mask and retrain it. The results are given in Figure 4. The performance of the reinitialized networks falls significantly short of the performance achieved by GraNet $( s _ { i } = 0 )$ ), indicating that what was learned by GraNet is the sparse connectivity together with the weight values. Besides, we find that the retraining performance of GraNet is higher than GMP. This further confirms that Zero-Cost Neuroregeneration helps the gradual pruning find more accurate mask positions. + +![](images/b4612ffd943999f6ebf8e6d2174a5adff7df303bbba6e527696f4121417ff7ad.jpg) +Figure 4: Reinitialization ablation on subnetworks discovered by GMP and GraNet $( s _ { i } = 0$ + +# 4.7 Comparison between Re-training and Extended Training + +In this section, we study if re-training techniques can further improve the performance of the subnetworks discovered by GraNet. The authors of Lottery Ticket Hypothesis (LTH) [10] introduced a retraining technique, even if they did not evaluate it as such, where the subnetworks discovered by iterative magnitude pruning can be re-trained in isolation to full accuracy with the original initializations. Later on, learning rate rewinding (LRR) [54] was proposed further to improve the re-training performance by only rewinding the learning rate. Since GraNet also utilizes magnitude pruning to discover subnetworks, it is natural to test if these re-training techniques can bring benefits to GraNet. As shown in Table 6, both re-training techniques do not bring benefits to GraNet. Instead of re-training the subnetworks, we find that simply extending the training time significantly boosts the performance of GraNet with similar computational costs. + +Table 6: Effects of LTH and LRR on the subnetworks learned by GraNet. Methods with $_ 2 \times$ refer to extending the training steps by 2 times. The results are reported with top-1 test accuracy $[ \% ]$ . + +
DatasetCIFAR-10CIFAR-100
Pruning ratio90%95%98%90%95%98%
VGG-19 (Dense)93.85±0.05=73.43±0.08=1
GraNet (si = 0)93.80±0.1093.72±0.1193.63±0.0873.74±0.3073.10±0.0472.35±0.26
+Lottery Ticket Hypothesis93.63±0.0493.29±0.0592.46±0.0872.97±0.2571.76±0.2269.28±0.36
+ Learning Rate Rewinding93.84±0.1493.72±0.0693.53±0.0473.71±0.0873.24±0.2472.50±0.26
GraNet2x (si = 0)94.17±0.0393.98±0.0793.94±0.1174.80±0.2973.65±0.3273.63±0.05
ResNet-50 (Dense)94.75±0.0178.23±0.18
GraNet (si = 0)94.49±0.0894.44±0.0194.34±0.1777.29±0.4576.71±0.2676.10±0.20
+Lottery Ticket Hypothesis93.96±0.1093.70±0.1592.94±0.1475.74±0.1974.31±0.1071.99±0.08
+ Learning Rate Rewinding94.55±0.1394.39±0.1394.20±0.2577.40±0.1476.90±0.1975.75±0.25
GraNet2× (si= 0)95.09±0.1594.84±0.1194.69±0.2478.18±0.2078.17±0.2077.15±0.29
+ +# 5 Conclusion, and Reflection of Broader Impacts + +In this paper, we re-emphasize the merit of during-training pruning. Compared with the recently proposed works, i.e., LTH and SNIP, during-training pruning is an efficient yet performant class of pruning methods that have received much less attention. We quantitatively study pruning during training from the perspective of pruning plasticity. Inspired by the findings from pruning plasticity and the mechanism of neuroregeneration in the nervous system, we further proposed a novel sparse training method, GraNet, that performs the cost-free connection regeneration during training. GraNet advances the state of the art in both dense-to-sparse training and sparse-to-sparse training. + +Our paper re-emphasizes the great potential of during-training pruning in reducing the training/inference resources required by ML models without sacrificing accuracy. It has a significant environmental impact on reducing the energy cost of the ML models and CO2 emissions [1, 53, 15, 56, 62]. + +# 6 Acknowledgement + +This project is partially financed by the Dutch Research Council (NWO). We thank the reviewers for the constructive comments and questions, which improved the quality of our paper. + +# References + +[1] Z. Atashgahi, G. Sokar, T. van der Lee, E. Mocanu, D. C. Mocanu, R. Veldhuis, and M. Pechenizkiy. Quick and robust feature selection: the strength of energy-efficient sparse training for autoencoders. arXiv:2012.00560, 2020. +[2] B. Bartoldson, A. Morcos, A. Barbu, and G. Erlebacher. The generalization-stability tradeoff in neural network pruning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 20852–20864. Curran Associates, Inc., 2020. +[3] G. Bellec, D. Kappel, W. Maass, and R. Legenstein. Deep rewiring: Training very sparse deep networks. In International Conference on Learning Representations, 2018. arXiv:1711.05136 (2017). +[4] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020. +[5] T. Chen, J. Frankle, S. Chang, S. Liu, Y. Zhang, M. Carbin, and Z. Wang. The lottery tickets hypothesis for supervised and self-supervised pre-training in computer vision models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 16306–16316, June 2021. +[6] P. de Jorge, A. Sanyal, H. Behl, P. Torr, G. Rogez, and P. K. Dokania. Progressive skeletonization: Trimming more fat from a network at initialization. In International Conference on Learning Representations, 2021. arXiv:cs.CV/2006.09081. +[7] E. Denton, W. Zaremba, J. Bruna, Y. LeCun, and R. Fergus. Exploiting linear structure within convolutional networks for efficient evaluation. Twenty-eighth Conference on Neural Information Processing Systems. arXiv:1404.0736, 2014. +[8] T. Dettmers and L. Zettlemoyer. Sparse networks from scratch: Faster training without losing performance. arXiv preprint arXiv:1907.04840, 2019. +[9] U. Evci, T. Gale, J. Menick, P. S. Castro, and E. Elsen. Rigging the lottery: Making all tickets winners. In International Conference on Machine Learning, pages 2943–2952. PMLR, 2020. +[10] J. Frankle and M. Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019. arXiv:1803.03635. +[11] J. Frankle, G. K. Dziugaite, D. Roy, and M. Carbin. Pruning neural networks at initialization: Why are we missing the mark? In International Conference on Learning Representations, 2021. arXiv:2009.08576. +[12] J. Frankle, G. K. Dziugaite, D. M. Roy, and M. Carbin. The lottery ticket hypothesis at scale. arXiv preprint arXiv:1903.01611, 2019. +[13] T. Gale, E. Elsen, and S. Hooker. The state of sparsity in deep neural networks. arXiv preprint arXiv:1902.09574, 2019. +[14] T. Gale, M. Zaharia, C. Young, and E. Elsen. Sparse gpu kernels for deep learning. arXiv preprint arXiv:2006.10901, 2020. +[15] E. García-Martín, C. F. Rodrigues, G. Riley, and H. Grahn. Estimation of energy consumption in machine learning. Journal of Parallel and Distributed Computing, 134:75–88, 2019. +[16] T. Gebhart, U. Saxena, and P. Schrater. A unified paths perspective for pruning at initialization. arXiv preprint arXiv:2101.10552, 2021. +[17] J. Guo, Y. Li, W. Lin, Y. Chen, and J. Li. Network decoupling: From regular to depthwise separable convolutions. arXiv preprint arXiv:1808.05517, 2018. +[18] S. Han, J. Pool, J. Tran, and W. Dally. Learning both weights and connections for efficient neural network. In Advances in neural information processing systems, pages 1135–1143, 2015. +[19] B. Hassibi and D. G. Stork. Second order derivatives for network pruning: Optimal brain surgeon. Morgan Kaufmann, 1993. +[20] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770– 778, 2016. +[21] T. Hoefler, D. Alistarh, T. Ben-Nun, N. Dryden, and A. Peste. Sparsity in deep learning: Pruning and growth for efficient inference and training in neural networks. Journal of Machine Learning Research, 22(241):1–124, 2021. +[22] I. Hubara, B. Chmiel, M. Island, R. Banner, S. Naor, and D. Soudry. Accelerated sparse neural training: A provable and efficient method to find n: M transposable masks. arXiv preprint arXiv:2102.08124, 2021. +[23] M. Jaderberg, A. Vedaldi, and A. Zisserman. Speeding up convolutional neural networks with low rank expansions. arXiv preprint arXiv:1405.3866, 2014. +[24] S. A. Janowsky. Pruning versus clipping in neural networks. Physical Review A, 39(12):6600, 1989. +[25] S. Jayakumar, R. Pascanu, J. Rae, S. Osindero, and E. Elsen. Top-kast: Top-k always sparse training. Advances in Neural Information Processing Systems, 33:20744–20754, 2020. +[26] E. R. Kandel, J. H. Schwartz, T. M. Jessell, S. Siegelbaum, A. J. Hudspeth, and S. Mack. Principles of neural science, volume 4. McGraw-hill New York, 2000. +[27] A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Master’s thesis, Department of Computer Science, University of Toronto, 2009. +[28] A. Kusupati, V. Ramanujan, R. Somani, M. Wortsman, P. Jain, S. Kakade, and A. Farhadi. Soft threshold weight reparameterization for learnable sparsity. In International Conference on Machine Learning, pages 5544–5555. PMLR, 2020. +[29] Y. LeCun, J. S. Denker, and S. A. Solla. Optimal brain damage. In Advances in neural information processing systems, pages 598–605, 1990. +[30] N. Lee, T. Ajanthan, S. Gould, and P. H. S. Torr. A signal propagation perspective for pruning neural networks at initialization. In International Conference on Learning Representations, 2020. arXiv:1906.06307. +[31] N. Lee, T. Ajanthan, and P. H. Torr. Snip: Single-shot network pruning based on connection sensitivity. International Conference on Learning Representations, 2018. +[32] H. Li, A. Kadav, I. Durdanovic, H. Samet, and H. P. Graf. Pruning filters for efficient convnets. International Conference on Learning Representations, 2016. +[33] T. Lin, S. U. Stich, L. Barba, D. Dmitriev, and M. Jaggi. Dynamic model pruning with feedback. In International Conference on Learning Representations, 2020. +[34] J. Liu, Z. Xu, R. Shi, R. C. C. Cheung, and H. K. So. Dynamic sparse training: Find efficient sparse network from scratch with trainable masked layers. In International Conference on Learning Representations, 2020. +[35] S. Liu, D. C. Mocanu, A. R. R. Matavalam, Y. Pei, and M. Pechenizkiy. Sparse evolutionary deep learning with over one million artificial neurons on commodity hardware. Neural Computing and Applications, 33(7):2589–2604, 2021. +[36] S. Liu, D. C. Mocanu, Y. Pei, and M. Pechenizkiy. Selfish sparse rnn training. In Proceedings of the 39th International Conference on Machine Learning, pages 6893–6904. PMLR, 2021. +[37] S. Liu, L. Yin, D. C. Mocanu, and M. Pechenizkiy. Do we actually need dense overparameterization? in-time over-parameterization in sparse training. In Proceedings of the 39th International Conference on Machine Learning, pages 6989–7000. PMLR, 2021. +[38] T. Liu and F. Zenke. Finding trainable sparse networks through neural tangent transfer. In International Conference on Machine Learning, pages 6336–6347. PMLR, 2020. +[39] Z. Liu, M. Sun, T. Zhou, G. Huang, and T. Darrell. Rethinking the value of network pruning. International Conference on Learning Representations, 2019. +[40] C. Louizos, M. Welling, and D. P. Kingma. Learning sparse neural networks through l_0 regularization. International Conference on Learning Representations, 2018. +[41] M. Mahar and V. Cavalli. Intrinsic mechanisms of neuronal axon regeneration. Nature Reviews Neuroscience, 19(6):323–337, 2018. +[42] D. Mittal, S. Bhardwaj, M. M. Khapra, and B. Ravindran. Recovering from random pruning: On the plasticity of deep convolutional neural networks. In 2018 IEEE Winter Conference on Applications of Computer Vision (WACV), pages 848–857. IEEE, 2018. +[43] D. C. Mocanu, E. Mocanu, T. Pinto, S. Curci, P. H. Nguyen, M. Gibescu, D. Ernst, and Z. A. Vale. Sparse training theory for scalable and efficient agents. International Conference on Autonomous Agents and Multiagent Systems (AAMAS). arXiv:2103.01636, 2021. +[44] D. C. Mocanu, E. Mocanu, P. Stone, P. H. Nguyen, M. Gibescu, and A. Liotta. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by network science. Nature communications, 9(1):2383, 2018. +[45] D. Molchanov, A. Ashukha, and D. Vetrov. Variational dropout sparsifies deep neural networks. In International Conference on Machine Learning, pages 2498–2507. PMLR, 2017. +[46] P. Molchanov, A. Mallya, S. Tyree, I. Frosio, and J. Kautz. Importance estimation for neural network pruning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11264–11272, 2019. +[47] P. Molchanov, S. Tyree, T. Karras, T. Aila, and J. Kautz. Pruning convolutional neural networks for resource efficient inference. International Conference on Learning Representations, 2016. +[48] H. Mostafa and X. Wang. Parameter efficient training of deep convolutional neural networks by dynamic sparse reparameterization. International Conference on Machine Learning, 2019. +[49] M. C. Mozer and P. Smolensky. Skeletonization: A technique for trimming the fat from a network via relevance assessment. In Advances in neural information processing systems, pages 107–115, 1989. +[50] M. C. Mozer and P. Smolensky. Using relevance to reduce network size automatically. Connection Science, 1(1):3–16, 1989. +[51] P. G. Nagappan, H. Chen, and D.-Y. Wang. Neuroregeneration and plasticity: a review of the physiological mechanisms for achieving functional recovery postinjury. Military Medical Research, 7(1):1–16, 2020. +[52] Nvidia. Nvidia a100 tensor core gpu architecture. https://www.nvidia.com/content/dam/enzz/Solutions/Data-Center/nvidia-ampere-architecture-whitepaper.pdf, 2020. +[53] D. Patterson, J. Gonzalez, Q. Le, C. Liang, L.-M. Munguia, D. Rothchild, D. So, M. Texier, and J. Dean. Carbon emissions and large neural network training. arXiv preprint arXiv:2104.10350, 2021. +[54] A. Renda, J. Frankle, and M. Carbin. Comparing rewinding and fine-tuning in neural network pruning. In International Conference on Learning Representations, 2020. arXiv:2003.02389. +[55] P. Savarese, H. Silva, and M. Maire. Winning the lottery with continuous sparsification. arXiv preprint arXiv:1912.04427, 2019. +[56] R. Schwartz, J. Dodge, N. A. Smith, and O. Etzioni. Green ai. arXiv preprint arXiv:1907.10597, 2019. +[57] Y. Shen, L. Shen, H.-Z. Huang, X. Wang, and W. Liu. Cpot: Channel pruning via optimal transport. arXiv preprint arXiv:2005.10451, 2020. +[58] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations, 2014. +[59] S. P. Singh and D. Alistarh. Woodfisher: Efficient second-order approximation for neural network compression. Advances in Neural Information Processing Systems, 33, 2020. +[60] S. Srinivas, A. Subramanya, and R. Venkatesh Babu. Training sparse neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 138–145, 2017. +[61] N. Strom. Scalable distributed dnn training using commodity gpu cloud computing. In Sixteenth Annual Conference of the International Speech Communication Association, 2015. +[62] E. Strubell, A. Ganesh, and A. McCallum. Energy and policy considerations for deep learning in nlp. arXiv preprint arXiv:1906.02243, 2019. +[63] H. Tanaka, D. Kunin, D. L. Yamins, and S. Ganguli. Pruning neural networks without any data by iteratively conserving synaptic flow. Advances in Neural Information Processing Systems. arXiv:2006.05467, 2020. +[64] H. Touvron, A. Vedaldi, M. Douze, and H. Jegou. Fixing the train-test resolution discrepancy. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. +[65] S. Verdenius, M. Stol, and P. Forré. Pruning via iterative ranking of sensitivity statistics. arXiv preprint arXiv:2006.00896, 2020. +[66] S. Verma and J.-C. Pesquet. Sparsifying networks via subdifferential inclusion. In M. Meila and T. Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 10542–10552. PMLR, 18–24 Jul 2021. +[67] C. Wang, G. Zhang, and R. Grosse. Picking winning tickets before training by preserving gradient flow. In International Conference on Learning Representations, 2020. +[68] W. Wen, C. Wu, Y. Wang, Y. Chen, and H. Li. Learning structured sparsity in deep neural networks. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. +[69] M. Wortsman, A. Farhadi, and M. Rastegari. Discovering neural wirings. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. +[70] X. Xiao, Z. Wang, and S. Rajasekaran. Autoprune: Automatic network pruning by regularizing auxiliary parameters. Advances in neural information processing systems, 32, 2019. +[71] Y. Xu, Y. Li, S. Zhang, W. Wen, B. Wang, Y. Qi, Y. Chen, W. Lin, and H. Xiong. Trained rank pruning for efficient deep neural networks. arXiv preprint arXiv:1812.02402, 2018. +[72] D. Yang, A. Ghasemazar, X. Ren, M. Golub, G. Lemieux, and M. Lis. Procrustes: a dataflow and accelerator for sparse deep neural network training. In 2020 53rd Annual IEEE/ACM International Symposium on Microarchitecture (MICRO), pages 711–724. IEEE, 2020. +[73] G. Yiu and Z. He. Glial inhibition of cns axon regeneration. Nature Reviews Neuroscience, 7(8):617–627, 2006. +[74] H. You, C. Li, P. Xu, Y. Fu, Y. Wang, X. Chen, R. G. Baraniuk, Z. Wang, and Y. Lin. Drawing early-bird tickets: Towards more efficient training of deep networks. arXiv preprint arXiv:1909.11957, 2019. +[75] G. Yuan, L. Shen, and W.-S. Zheng. A block decomposition algorithm for sparse optimization. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 275–285, 2020. +[76] A. Zhou, Y. Ma, J. Zhu, J. Liu, Z. Zhang, K. Yuan, W. Sun, and H. Li. Learning n:m fine-grained structured sparse neural networks from scratch. In International Conference on Learning Representations, 2021. +[77] M. H. Zhu and S. Gupta. To prune, or not to prune: Exploring the efficacy of pruning for model compression, 2018. \ No newline at end of file diff --git a/md/train/N9oPAFcuYWX/N9oPAFcuYWX.md b/md/train/N9oPAFcuYWX/N9oPAFcuYWX.md new file mode 100644 index 0000000000000000000000000000000000000000..de929cc06da58b850bc5fc07bee45f84dabdaaaf --- /dev/null +++ b/md/train/N9oPAFcuYWX/N9oPAFcuYWX.md @@ -0,0 +1,562 @@ +# UNDERSTANDING AND MITIGATING ACCURACY DISPARITY IN REGRESSION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +With the widespread deployment of large-scale prediction systems in high-stakes domains, e.g., face recognition, criminal justice, etc., disparity on prediction accuracy between different demographic subgroups has called for fundamental understanding on the source of such disparity and algorithmic intervention to mitigate it. In this paper, we study the accuracy disparity problem in regression. To begin with, we first propose an error decomposition theorem, which decomposes the accuracy disparity into the distance between label populations and the distance between conditional representations, to help explain why such accuracy disparity appears in practice. Motivated by this error decomposition and the general idea of distribution alignment with statistical distances, we then propose an algorithm to reduce this disparity, and analyze its game-theoretic optima of the proposed objective function. We conduct experiments on four real-world datasets. The experimental results suggest that our proposed algorithms can effectively mitigate accuracy disparity while maintaining the predictive power of the regression models. + +# 1 INTRODUCTION + +Recent progress in machine learning has led to its widespread use in many high-stakes domains, such as criminal justice, healthcare, student loan approval, and hiring. Meanwhile, it has also been widely observed that accuracy disparity could occur inadvertently under various scenarios in practice (Barocas & Selbst, 2016). For example, errors are inclined to occur for individuals of certain underrepresented demographic groups (Kim, 2016). In other cases, Buolamwini & Gebru (2018) showed that notable accuracy disparity gaps exist across different racial and gender demographic subgroups on several real-world image classification systems. Moreover, Bagdasaryan et al. (2019) found out that a differentially private model even enlarges such accuracy disparity gaps. Such accuracy disparity gaps across demographic subgroups not only raise concerns in high-stake applications but also can be utilized by malicious parties causing information leakage (Yaghini et al., 2019). + +Despite the ample needs of accuracy parity, most prior work limits its scope to studying the problem in binary classification settings (Hardt et al., 2016; Zafar et al., 2017b; Zhao et al., 2019; Jiang et al., 2019). In a seminal work, Chen et al. (2018) analyzed the impact of data collection on accuracy disparity in general learning models. They provided a descriptive analysis of such parity gaps and advocated for collecting more training examples and introducing more predictive variables. While such a suggestion is feasible in applications where data collection and labeling is cheap, it is not applicable in domains where it is time-consuming, expensive, or even infeasible to collect more data, e.g., in autonomous driving, education, etc. + +Our Contributions In this paper, we provide a prescriptive analysis of accuracy disparity and aim at providing algorithmic interventions to reduce the disparity gap between different demographic subgroups in the regression setting. To start with, we first formally characterize why accuracy disparity appears in regression problems by depicting the feasible region of the underlying group-wise errors. We also provide a lower bound on the joint error and a complementary upper bound on the error gap across groups. Based on these results, we illustrate why regression models aiming to minimize the global loss will inevitably lead to accuracy disparity if the input distributions or decision functions differ across groups (see Figure 1a). + +We further propose an error decomposition theorem that decomposes the accuracy disparity into the distance between the label populations and the distance between conditional representations. To mitigate such disparities, we propose two algorithms to reduce accuracy disparity via joint distribution alignment with total variation distance and Wasserstein distance, respectively. Furthermore, we analyze the game-theoretic optima of the objective function and illustrate the principle of our algorithms from a game-theoretic perspective (see Figure 1b). To corroborate the effectiveness of our proposed algorithms in reducing accuracy disparity, we conduct experiments on four real-world datasets. Experimental results suggest that our proposed algorithms help to mitigate accuracy disparity while maintaining the predictive power of the regression models. We believe our theoretical results contribute to the understanding of why accuracy disparity occurs in machine learning models, and the proposed algorithms provides an alternative for intervention in real-world scenarios where accuracy parity is desired but collecting more data/features is time-consuming or infeasible. + +![](images/891e7f92ac7328647dee0b27c8534c91ab8deb7ee8f5266ef04821a7a1099349.jpg) +Figure 1: The left figure illustrates how accuracy disparity arises by minimizing the global squared loss. The right figure gives a schematic illustration of the proposed algorithmic framework. + +# 2 PRELIMINARIES + +Notation We use $\boldsymbol { \mathcal { X } } \subseteq \mathbb { R } ^ { d }$ and $\mathcal { V } \subseteq \mathbb { R }$ to denote the input and output space. We use $X$ and $Y$ to denote random variables which take values in $\mathcal { X }$ and $\mathcal { V }$ , respectively. Lower case letters $\mathbf { x }$ and $y$ denote the instantiation of $X$ and $Y$ . We use $H ( X )$ to denote the Shannon entropy of random variable $X$ , $H ( X \mid Y )$ to denote the conditional entropy of $X$ given $Y$ , and $I ( X ; Y )$ to denote the mutual information between $X$ and $Y$ . To simplify the presentation, we use $A \in \{ 0 , 1 \}$ as the sensitive attribute, $e . g .$ ., gender, race, etc. Let $\mathcal { H }$ be the hypothesis class of regression models. In other words, for $h \in \mathcal H$ , $h : \mathcal { X } \mathcal { Y }$ is a predictor. Note that even if the predictor does not explicitly take the sensitive attribute $A$ as an input variable, the prediction can still be biased due to the correlations with other input variables. In this work we study the stochastic setting where there is a joint distribution $\mathcal { D }$ over $X , Y$ and $A$ from which the data are sampled. For $a \in \{ 0 , 1 \}$ and $y \in \mathbb { R }$ , we use $\mathcal { D } _ { a }$ to denote the conditional distribution of $\mathcal { D }$ given $A = a$ and $\mathcal { D } ^ { y }$ to denote the conditional distribution of $\mathcal { D }$ given $Y = y$ . For an event $E$ , $\mathcal { D } ( E )$ denotes the probability of $E$ under $\mathcal { D }$ . Given a feature transformation function $g : \mathcal { X } \mathcal { Z }$ that maps instances from the input space $\mathcal { X }$ to feature space $\mathcal { Z }$ , we define $g _ { \sharp } \mathcal { D } : = \mathcal { D } \circ g ^ { - 1 }$ to be the induced (pushforward) distribution of $\mathcal { D }$ under $g$ , i.e., for any event $E ^ { \prime } \subseteq { \mathcal { Z } }$ , $g _ { \sharp } \mathcal { D } ( E ^ { \prime } ) : = \mathcal { D } ( \{ x \in \mathcal { X } \mid g ( x ) \in E ^ { \prime } \} )$ . We use $( \cdot ) _ { + }$ to indicate the value of a variable remains unchanged if it is positive or otherwise $0$ , i.e., $( Y ) _ { + }$ equals to $Y$ if the value of $Y$ is positive or otherwise 0. + +Given a joint distribution $\mathcal { D }$ , the error of a predictor $h$ under $\mathcal { D }$ is defined as $\mathrm { E r r } _ { \mathcal { D } } ( h ) : = \mathbb { E } _ { \mathcal { D } } [ ( Y -$ $h ( X ) ) ^ { 2 } ]$ . To make the notation more compact, we may drop the subscript $\mathcal { D }$ when it is clear from the context. Furthermore, we also use $\mathrm { M S E } _ { \mathcal { D } } ( \widehat { Y } , Y )$ to denote the mean squared loss between the predicted variable ${ \widehat { Y } } = h ( X )$ and the true label $Y$ over the joint distribution $\mathcal { D }$ . Similarly, we also use $\operatorname { C E } _ { \mathcal { D } } ( A \parallel \widehat { A } )$ denote the cross-entropy loss between the predicted variable $\widehat { A }$ and the true label $A$ over the joint distribution $\mathcal { D }$ . Throughout the paper, we make the following standard assumption in regression problems: + +Assumption 2.1. There exists $M > 0$ , such that for any hypothesis $\mathcal { H } \ni h : \mathcal { X } \xrightarrow { } \mathcal { Y }$ , $\| h \| _ { \infty } \leq M$ and $| Y | \leq M$ . + +Problem Setup We study the fair regression problem: the goal is to learn a regressor that is fair in the sense that the errors of the regressor are approximately equal across the groups given by the sensitive attribute $A$ . We assume that the sensitive attribute $A$ is only available to the learner during the training phase and is not visible during the inference phase. We would like to point out that there are many other different and important definitions of fairness (Narayanan, 2018) even in the sub-category of group fairness, and our discussion is by no means comprehensive. For example, two frequently used definitions of fairness in the literature are the so-called statistical parity (Dwork et al., 2012) and equalized odds (Hardt et al., 2016). Nevertheless, throughout this paper we mainly focus accuracy parity as our fairness notion, due to the fact that machine learning systems have been shown to exhibit substantial accuracy disparities between different demographic subgroups (Barocas & Selbst, 2016; Kim, 2016; Buolamwini & Gebru, 2018). This observation has already brought huge public attention (e.g., see New York Times, The Verge, and Insurance Journal) and calls for machine learning systems that (at least approximately) satisfy accuracy parity. Formally, accuracy parity is defined as follows: + +Definition 2.1 (Accuracy Parity). Given a joint distribution $\mathcal { D }$ , a predictor $h$ satisfies accuracy parity if $\mathrm { E r r } _ { \mathcal { D } _ { 0 } } ( h ) = \mathrm { E r r } _ { \mathcal { D } _ { 1 } } ( h )$ . + +The violation of accuracy parity is also known as disparate mistreatment (Zafar et al., 2017a). In practice the exact equality of on accuracy between two groups is often hard to ensure, so we define error gap to measure how well the model satisfies accuracy parity: + +Definition 2.2 (Error Gap). Given a joint distribution $\mathcal { D }$ , the error gap of a hypothesis $h$ is $\Delta _ { \mathrm { E r r } } ( h ) : =$ $\vert \mathrm { E r r } _ { \mathscr { D } _ { 0 } } ( h ) - \mathrm { E r r } _ { \mathscr { D } _ { 1 } } ( h ) \vert$ . + +By definition, if a model satisfies accuracy parity, $\Delta _ { \mathrm { E r r } } ( h )$ will be zero. Next we introduce two distance metrics that will be used in our theoretical analysis and algorithm design: + +• Total variation distance: it measures the largest possible difference between the probabilities that the two probability distributions can assign to the same event $E$ . We use $d _ { \mathrm { T V } } ( \mathcal { P } , \mathcal { Q } )$ to denote the total variation: + +$$ +d _ { \mathrm { T V } } ( \mathcal { P } , \mathcal { Q } ) : = \operatorname* { s u p } _ { E } | \mathcal { P } ( E ) - \mathcal { Q } ( E ) | . +$$ + +• Wasserstein distance: the Wasserstein distance between two probability distributions is + +$$ +W _ { 1 } ( \mathcal { P } , \mathcal { Q } ) = \operatorname* { s u p } _ { f \in \{ f : \| f \| _ { L } \leq 1 \} } \left| \int _ { \Omega } f d \mathcal { P } - \int _ { \Omega } f d \mathcal { Q } \right| , +$$ + +where $\| f \| _ { L }$ is the Lipschitz semi-norm of a real-valued function of $f$ and $\Omega$ is the sample space over which two probability distributions $\mathcal { P }$ and $\mathcal { Q }$ are defined. By the Kantorovich-Rubinstein duality theorem (Villani, 2008), we recover the primal form of the Wasserstein distance, defined as + +$$ +W _ { 1 } ( \mathcal { P } , \mathcal { Q } ) : = \operatorname* { i n f } _ { \gamma \in \Gamma ( \mathcal { P } , \mathcal { Q } ) } \int d ( X , Y ) { \mathrm d } \gamma ( X , Y ) , +$$ + +where $\Gamma ( \mathcal { P } , \mathcal { Q } )$ denotes the collection of all couplings of $\mathcal { P }$ and $\mathcal { Q }$ , and $X$ and $Y$ denote the random variables with law $\mathcal { P }$ and $\mathcal { Q }$ respectively. Note that we use $L _ { 1 }$ distance for $d ( \cdot , \cdot )$ throughout the paper, but the extensions to other distance, e.g., $L _ { 2 }$ distance, is straightforward. + +# 3 MAIN RESULTS + +In this section, we first characterize why accuracy disparity arises in regression models. More specifically, given a hypothesis $h \in \mathcal H$ , we first describe the feasible region of $\mathrm { E r r } _ { \mathcal { D } _ { 0 } }$ and $\mathrm { E r r } _ { \mathscr D _ { 1 } }$ by proving a lower bound of joint errors and an upper bound of the error gap. Then, we give a geometric interpretation to visualize the feasible region of $\mathrm { E r r } _ { \mathcal { D } _ { 0 } }$ and $\mathrm { E r r } _ { \mathcal { D } _ { 1 } }$ and illustrate how error gap arises when learning a hypothesis $h$ that minimizes the global squared error. We further analyze the accuracy disparity by decomposing it into the distance between label populations and the distance between conditional representations. Motivated by the decomposition, we propose two algorithms to reduce accuracy disparity, connect the game-theoretic optima of the objective functions in our algorithms with our theorems, and describe the practical implementations of the algorithms. Due to the space limit, we defer all the detailed proofs to the appendix. + +# 3.1 BOUNDS ON CONDITIONAL ERRORS AND ACCURACY DISPARITY GAP + +When we learn a predictor, the prediction function induces $X \xrightarrow { h } \widehat { Y }$ , where $\widehat { Y }$ is the predicted target variable given by hypothesis $h$ . Hence for any distribution $\mathcal { D } _ { 0 }$ $\mathcal { D } _ { 1 } )$ of $X$ , the predictor also induces a + +distribution $h _ { \sharp } \mathcal { D } _ { 0 } \left( h _ { \sharp } \mathcal { D } _ { 1 } \right)$ of $\widehat { Y }$ . Recall that the Wasserstein distance is metric, hence the following chain of triangle inequalities holds: + +$$ +W _ { 1 } ( \mathcal D _ { 0 } ( Y ) , \mathcal D _ { 1 } ( Y ) ) \leq W _ { 1 } ( \mathcal D _ { 0 } ( Y ) , h _ { \sharp } \mathcal D _ { 0 } ) + W _ { 1 } ( h _ { \sharp } \mathcal D _ { 0 } , h _ { \sharp } \mathcal D _ { 1 } ) + W _ { 1 } ( h _ { \sharp } \mathcal D _ { 1 } , \mathcal D _ { 1 } ( Y ) ) +$$ + +Intuitively, $W _ { 1 } ( \mathcal { D } _ { 0 } ( Y ) , h _ { \sharp } \mathcal { D } _ { 0 } )$ and $W _ { 1 } ( h _ { \sharp } \mathcal { D } _ { 1 } , \mathcal { D } _ { 1 } ( Y ) )$ measure the distance between the true label distribution and the predicted one on $A \stackrel { \cdot } { = } 0 / 1$ cases, respectively. This distance is related to the prediction error of function $h$ conditioned on $A = a$ : + +Lemma 3.1. Let ${ \widehat { Y } } = h ( X ) \in \mathbb { R }$ , then for $a \in \{ 0 , 1 \} , W _ { 1 } ( \mathcal { D } _ { a } ( Y ) , h _ { \sharp } \mathcal { D } _ { a } ) \leq \sqrt { \mathrm { E r r } _ { \mathcal { D } _ { a } } ( h ) } .$ + +With the above results, we can get the following theorem that characterizes the lower bound of joint error on different groups: + +Theorem 3.1. Let ${ \widehat { Y } } = h ( X ) \in \mathbb { R }$ , we have $\begin{array} { r } { { \mathrm { E r r } } _ { \mathcal { D } _ { 0 } } ( h ) + { \mathrm { E r r } } _ { \mathcal { D } _ { 1 } } ( h ) \geq \frac { 1 } { 2 } \big [ \big ( W _ { 1 } ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) - } \end{array}$ $W _ { 1 } \big ( h _ { \sharp } \mathcal { D } _ { 0 } , h _ { \sharp } \mathcal { D } _ { 1 } \big ) \big ) _ { + } \big ] ^ { 2 }$ . + +In Theorem 3.1, we see that if the difference between the label distribution across groups is large, then statistical disparity could potentially lead to a large joint error. Moreover, Theorem 3.1 could be extended to give a lower bound on the joint error incurred by $h$ as well: + +Corollary 3.1. Let ${ \widehat { Y } } = h ( X ) \in \mathbb { R }$ and $\alpha = { \mathcal { D } } ( A = 0 ) \in [ 0 , 1 ]$ , we have $\begin{array} { r } { \mathrm { E r r } _ { \mathcal D } ( h ) \geq \frac { 1 } { 2 } \operatorname* { m i n } \{ \alpha , 1 - } \end{array}$ $\alpha \} \cdot \left[ \big ( W _ { 1 } ( \mathcal D _ { 0 } ( Y ) , \mathcal D _ { 1 } ( Y ) ) - W _ { 1 } ( h _ { \sharp } \mathcal D _ { 0 } , h _ { \sharp } \mathcal D _ { 1 } ) \big ) _ { + } \right] ^ { 2 }$ . + +Next, we upper bound the error gap to gain more insights on accuracy disparity. For $a \in \{ 0 , 1 \}$ , define the conditional variance $\begin{array} { r } { \dot { \mathrm { V a r } _ { \mathcal { D } _ { a } } } [ \check { Y } | X ] = \mathbb { E } _ { \mathcal { D } _ { a } } [ ( \check { Y } - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ^ { \widehat { 2 } } | X ] } \end{array}$ and it shows up as the irreducible error of predicting $Y$ when we only use the knowledge of $X$ . We also know that the optimal decision function conditioned on $A = a$ under mean squared error to be $\mathbb { E } _ { D _ { a } } [ Y | X ]$ . The following theorem characterizes the upper bound of the error gap between two groups: + +Theorem 3.2. For any hypothesis $\mathcal { H } \ni h : \mathcal { X } \xrightarrow { } \mathcal { Y }$ , if the Assumption 2.1 holds, then: + +$$ +\begin{array} { r l } & { \Delta _ { \mathrm { E r r } } ( h ) \leq 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( X ) , \mathcal { D } _ { 1 } ( X ) ) + | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ \mathrm { V a r } _ { \mathcal { D } _ { 0 } } [ Y | X ] ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ \mathrm { V a r } _ { \mathcal { D } _ { 1 } } [ Y | X ] ] | } \\ & { \qquad + 4 M \operatorname* { m i n } \{ \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } ( Y | X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } ( Y | X ) | ] , \mathbb { E } _ { \mathcal { D } _ { 1 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } ( Y | X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } ( Y | X ) | ] \} . } \end{array} +$$ + +Remark Theorem 3.2 upper bounds the error gap across groups by three terms: the first term corresponds to the distance of input distribution across groups, the second term is the noise (variance) difference, and third term is the discrepancy of optimal decision functions across different groups. In an ideal and fair setting, where both distributions are noiseless, and the optimal decision functions are insensitive to the group membership, then Theorem 3.2 implies a sufficient condition to guarantee accuracy parity is to find group-invariant representation that minimize $d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( \boldsymbol { X } ) , \mathcal { D } _ { 1 } ( \boldsymbol { X } ) )$ . + +Geometric Interpretation By Theorem 3.1 and Theorem 3.2, in Figure 1a, we visually illustrate how accuracy disparity arises given data distribution and the learned hypothesis that aims to minimize the global squared error. In Figure 1a, given the hypothesis class $\mathcal { H }$ , we use the line $\mathrm { E r r } _ { \mathcal { D } _ { 0 } } + \mathrm { E r r } _ { \mathcal { D } _ { 1 } } = B$ to denote the lower bound in Theorem 3.1 and the two lines $\vert \mathrm { E r r } _ { \mathcal { D } _ { 0 } } - \mathrm { E r r } _ { \mathcal { D } _ { 1 } } \vert = A$ to denote the upper bound in Theorem 3.2. These three lines form a feasible region (the green area) of $\mathrm { E r r } _ { \mathcal { D } _ { 0 } }$ and $\mathrm { E r r } _ { \mathcal { D } _ { 1 } }$ under the hypothesis class $\mathcal { H }$ . For any optimal hypothesis $h$ which is solely designed to minimize the overall error, the best the hypothesis $h$ can do is to intersect with one of the two bottom vertices. For example, the hypotheses (the red dotted line and the blue dotted line) trying to minimize overall error intersect with the two vertices of the region to achieve the smallest $\mathrm { E r r } _ { \mathcal { D } _ { 0 } }$ -intercept $( \mathrm { E r r } _ { \mathcal { D } _ { 1 } }$ -intercept), due to the imbalance between these two groups. However, since these two vertices are not on the diagonal of the feasible region, there is no guarantee that the hypothesis can satisfy accuracy parity $( \mathrm { E r r } _ { \mathscr { D } _ { 0 } } = \mathrm { E r r } _ { \mathscr { D } _ { 1 } } ,$ ), unless we can shrink the width of green area to zero. + +Conditional Distribution Alignment Reduces Accuracy Parity In Theorem 3.2, we illustrate how accuracy disparity arises in regression models due to noise, distance between representations, and distance between decision functions. However, it is nearly impossible to collect noiseless data with group-invariant input distribution. Moreover, there is no guarantee that the upper bound will be lower if we learn the group-invariant representation that minimizes $d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( \boldsymbol { X } ) , \mathcal { D } _ { 1 } ( \boldsymbol { X } ) )$ alone, since the learned representation could potentially increase the variance. In this regard, we prove a novel upper bound which is free from the above noise term to motivate aligning conditional distributions to mitigate the error disparity across groups. To do so, we relate the error gap to the label distribution and the predicted distribution condition on $Y = y$ : + +Theorem 3.3. If Assumption 2.1 holds, then for $\forall h \in { \mathcal { H } }$ , let ${ \widehat { Y } } = h ( X )$ , the following inequality holds: + +$$ +\begin{array} { r l } & { \Delta _ { \mathrm { E r r } } ( h ) \leq 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal D _ { 0 } ( \boldsymbol Y ) , \mathcal D _ { 1 } ( \boldsymbol Y ) ) } \\ & { \qquad + 3 M \operatorname* { m i n } \{ { \mathbb { E } } _ { \mathcal D _ { 0 } } [ | { \mathbb { E } } _ { \mathcal D _ { 0 } ^ { \upsilon } } [ \widehat { Y } ] - { \mathbb { E } } _ { \mathcal D _ { 1 } ^ { \upsilon } } [ \widehat { Y } ] | ] , { \mathbb { E } } _ { \mathcal D _ { 1 } } [ | { \mathbb { E } } _ { \mathcal D _ { 0 } ^ { \upsilon } } [ \widehat { Y } ] - { \mathbb { E } } _ { \mathcal D _ { 1 } ^ { \upsilon } } [ \widehat { Y } ] | ] \} . } \end{array} +$$ + +Remark We see that the error gap is upper bounded by two terms: the distance between label distributions and the discrepancy between conditional predicted distributions across groups. Note that this is different from the decomposition we have in Theorem 3.2, where the marginal distribution is on $X$ instead of $Y$ . Given a dataset, the distance of label distributions is a constant since the label distribution is fixed. For the second term, if we can minimize the discrepancy of the conditional predicted distribution across groups, we then have a model that is free of accuracy disparity when the label distribution is well aligned. + +# 3.2 ALGORITHM DESIGN + +Inspired by Theorem 3.3, we can mitigate the error gap if we align the group distributions via minimizing the distance of the conditional distributions across groups. However, it is intractable to do so explicitly in regression problems since $Y$ can take infinite values on $\mathbb { R }$ . Next we will present two algorithms to approximately solve the problem through adversarial representation learning. + +Given a Markov chain $X \xrightarrow { g } Z \xrightarrow { h } \widehat { Y }$ , we are interested in learning group-invariant conditional representations so that the discrepancy between the induced conditional distributions ${ \mathcal { D } } _ { 0 } ^ { Y } ( Z = g ( X ) )$ and $\mathcal { D } _ { 1 } ^ { Y } ( Z = g ( X ) )$ is minimized. In this case, the second term of the upper bound in Theorem 3.3 is minimized. However, it is in general not feasible since $Y$ is a continuous random variable. Instead, we propose to learn the representations of $Z$ to minimize the discrepancy between the joint distributions $\mathbf { \bar { \mathcal { D } } } _ { 0 } \bar { ( } Z = g ( X ) , Y )$ and $\mathcal { D } _ { 1 } ( Z = g ( X ) , Y )$ . Next, we will show the distances between conditional predicted distributions ${ \mathcal { D } } _ { 0 } ^ { Y } ( Z = g ( X ) )$ and $\mathcal { D } _ { 1 } ^ { Y } ( Z = g ( X ) )$ are minimized when we minimize the joint distributions ${ \mathcal { D } } _ { 0 } ( Z = g ( X ) , Y )$ and $\mathcal { D } _ { 1 } ( Z = g ( X ) , Y )$ in Theorem 3.4 and Theorem 3.5. + +To proceed, we first consider using the total variation distance to measure the distance between two distributions. In particular, we can choose to learn a binary discriminator $f : Z \times Y \longrightarrow { \widehat { A } }$ that achieves minimum binary classification error on discriminating between points sampled from two distributions. In practice, we use the cross-entropy loss as a convex surrogate loss. Formally, we are going to consider the following minimax game between $g$ and $f$ : + +$$ +\operatorname* { m i n } _ { f \in { \mathcal { F } } } \operatorname* { m a x } _ { g } \quad \operatorname { C E } _ { \mathcal { D } } ( A \parallel f ( g ( X ) , Y ) ) +$$ + +Next we show that for the above equation, the optimal feature transformation $g$ corresponds to the one that induces invariant conditional feature distributions. + +Theorem 3.4. Consider the minimax game in (1). The equilibrium $( g ^ { * } , f ^ { * } )$ of the game is attained when 1). $Z = g ^ { * } ( X )$ is independent of $A$ conditioned on $Y ; 2$ ). $f ^ { * } ( Z , Y ) = { \mathcal { D } } ( A = 1 \mid Y , Z )$ . + +Since in the equilibrium of the game $Z$ is independent of $A$ conditioned on $Y$ , the optimal $f ^ { * } ( Z , Y )$ could also be equivalently written as $f ^ { * } ( Z , \bar { Y } ) = { \mathcal { D } } ( A = 1 \mid Y )$ , i.e., the only useful information for the discriminator in the equilibrium is through the external information $Y$ . In Theorem 3.4, the minimum cross-entropy loss that the discriminator (the equilibrium of the game) can achieve is $H ( A \mid Z , Y )$ (see Proposition A.1 in Appendix A). By the basic property of conditional entropy, we have: + +$$ +\operatorname* { m i n } _ { f \in { \mathcal { F } } } \mathrm { C E } _ { \mathcal { D } } ( A \parallel f ( g ( X ) , Y ) ) = H ( A \mid Z , Y ) = H ( A \mid Y ) - I ( A ; Z \mid Y ) . +$$ + +We know that $H ( A \mid Y )$ is a constant given the data distribution. The maximization of $g$ in (1) is equivalent to the minimization of $\scriptstyle \operatorname* { m i n } _ { Z = g ( X ) } I ( A ; Z \mid Y )$ , and it follows that the optimal strategy for the transformation $g$ is the one that induces conditionally invariant features, e.g., $I ( A ; Z \mid Y ) = 0$ . Formally, we arrive at the following minimax problem: + +$$ +\operatorname* { m i n } _ { h , g } \operatorname* { m a x } _ { f \in { \mathcal { F } } } \quad \mathrm { M S E } _ { { \mathcal { D } } } ( h ( g ( X ) ) , Y ) - \lambda \cdot \mathrm { C E } _ { { \mathcal { D } } } ( A \parallel f ( g ( X ) , Y ) ) +$$ + +In the above formulation, the first term corresponds to the minimization of prediction loss of the target task and the second term is the loss incurred by the adversary $f$ . As a whole, the minimax optimization problem expresses a trade-off (controlled by the hyper-parameter $\lambda > 0$ ) between accuracy and accuracy disparity through the representation learning function $g$ . + +Wasserstein Variant Similarly, if we choose to align joint distributions via minimizing Wasstertein distance, the following theorem holds. + +Theorem 3.5. Let $\begin{array} { r } { g ^ { * } : = \arg \operatorname* { m i n } _ { g } W _ { 1 } ( \mathcal { D } _ { 0 } ( g ( X ) , Y ) , \mathcal { D } _ { 1 } ( g ( X ) , Y ) ) } \end{array}$ , then ${ \mathcal D } _ { 0 } ^ { Y } ( Z = g ^ { * } ( X ) ) =$ ${ \mathcal { D } } _ { 1 } ^ { Y } ( Z = g ^ { * } ( X ) )$ almost surely. + +One notable advantage of using the Wasserstein distance instead of the TV distance is that, the Wasserstein distance is a continuous functional of both the feature map $g$ as well as the discriminator $f$ (Arjovsky et al., 2017). Furthermore, if both $g$ and $f$ are continuous functions of their corresponding model parameters, (which is the case for models we are going to use in experiments), the objective function will be continuous in both model parameters. This property of the Wasserstein distance makes it more favorable from an optimization perspective. Using the dual formulation, equivalently, we can learn a Lipschitz function $f : Z \times Y \to \mathbb { R }$ as a witness function: + +$$ +\operatorname* { m i n } _ { \substack { h , g , Z _ { 0 } \sim g _ { \sharp } \mathcal { D } _ { 0 } , Z _ { 1 } \sim g _ { \sharp } \mathcal { D } _ { 1 } f ; \lVert f \rVert _ { L } \le 1 } } \quad \mathrm { M S E } _ { \mathcal { D } } ( h ( g ( X ) ) , Y ) + \lambda \cdot \big | f ( Z _ { 0 } , Y ) - f ( Z _ { 1 } , Y ) \big | . +$$ + +Game-Theoretic Interpretation To make our algorithms easier to follow, we provide a gametheoretic interpretation of our algorithms in Figure 1b. Consider Alice (encoder) and Bob (discriminator) participate a two-player game: upon receiving a set of inputs $X$ , Alice applies a transformation to the inputs to generate the corresponding features $Z$ and then send them to Bob. Besides the features sent by Alice, Bob also has access to the external information $Y$ , which corresponds to the corresponding labels for the set of features sent by Alice. Once having both the features $Z$ and the corresponding labels $Y$ from external resources, Bob’s goal is to guess the group membership $A$ of each feature sent by Alice, and to maximize his correctness as much as possible. On the other hand, Alice’s goal is to compete with Bob, i.e., to find a transformation to confuse Bob as much as she can. Different from the traditional game without external information, here due to the external information $Y$ Bob has access to, Alice cannot hope to fully fool Bob, since Bob can gain some insights about the group membership $A$ of features from the external label information. Nevertheless, Theorem 3.4 and Theorem 3.5 both state that when Bob uses a binary discriminator or a Wasstertein discriminator to learn $A$ , the best Alice could do is to to learn a transformation $g$ so that the transformed representation $Z$ is insensitive to the values of A conditioned on any values of $Y$ . + +# 4 EXPERIMENTS + +Inspired by our theoretical results that decompose accuracy disparity into the distance between label populations and the distance between conditional representations, we propose two algorithms to mitigate it. In this section, we conduct experiments to evaluate the effectiveness of our proposed algorithms in reducing the accuracy disparity. + +# 4.1 EXPERIMENTAL SETUP + +Datasets We conduct experiments on four real-world benchmark datasets: the Adult dataset (Dua & Graff, 2017), COMPAS dataset (Dieterich et al., 2016), Law School dataset (Wightman & Ramsey, 1998), and Communities and Crime dataset (Dua & Graff, 2017). All datasets contain binary sensitive attributes (e.g., male/female, white/non-white). We refer readers to Appendix B for detailed descriptions of the datasets and the data pre-processing pipelines. + +Methods We term the proposed algorithms CENET and WASSERSTEINNET for our two proposed algorithms respectively. For each dataset, we perform controlled experiments by fixing the regression neural network architecture to be the same. We train the regression nets via mean squared loss. Note that although the Adult dataset and COMPAS dataset are for binary classification tasks, we can still take them as regression tasks with two distinctive ordinal values. To the best of our knowledge, no previous study aims to minimize accuracy disparity in regression using representation learning. However, there are other similar fairness notions and mitigation techniques proposed for regression and we add them as our baselines: (1) Bounded group loss (BGL) (Agarwal et al., 2019), which asks for the prediction errors for any groups to remain below a pre-defined level $\epsilon$ ; (2) Coefficient of determination (COD) (Komiyama et al., 2018), which asks for the coefficient of determination between the sensitive attributes and the predictions to remain below a pre-defined level $\epsilon$ . + +![](images/63c019fddb8487bfdf34544ec7641a9af7f25eaaed4f95ab97f1019523852f32.jpg) +Figure 2: Overall results: $R ^ { 2 }$ regression scores and error gaps in different datasets. Our goal is to achieve high $R ^ { 2 }$ scores with small error gap values (i.e., the points located in the upper-left corner). + +Among all methods, we vary the trade-off parameter (i.e., $\lambda$ in CENET and WASSERSTEINNET and $\epsilon$ in BGL and COD) and report and the corresponding $R ^ { 2 }$ scores and the error gap values. For each experiment, we average the results for ten random seeds. We refer readers to Appendix B for detailed parameter and hyper-parameter settings in our experiments. We also defer the additional experimental results and analyses on how the trade-off parameters $\lambda$ and $\epsilon$ affects the performance of different algorithms to Appendix C. + +# 4.2 RESULTS AND ANALYSES + +The overall results are visualized in Figure 2.1 The following summarizes our observations and analyses: (1) Overall, trade-offs exist between the predictive power of the regressors and accuracy parity: for each method we test, the general trend is that with the decrease of the values of error gaps, the values of $R ^ { 2 }$ also decrease. The exception is CENET in the Adult dataset and Crime dataset since training CENET is unstable when $\lambda$ is large and we will provide more details in Appendix C; (2) Our proposed methods WASSERSTEINNET and CENET are effective in reducing the error gaps while keeping the $R ^ { 2 }$ scores relatively high in the Adult, COMPAS and Crime dataset. In the Law dataset, the error gaps decrease with high utility losses in our proposed methods; (3) Among our proposed methods, WASSERSTEINNET achieves better accuracy and accuracy disparity trade-offs while CENET suffers significant accuracy loss and may fail to decrease the error gaps in the Adult and Crime dataset. The reason behind it is that the minimax optimization in the training of CENET could lead to an unstable training process under the presence of a noisy approximation to the optimal discriminator (Arjovsky & Bottou, 2017; Arjovsky et al., 2017); (4) Compared to our proposed methods, BGL and COD can also decrease error gaps to a certain extent. This is because: (i) BGL aims to keep errors remaining relatively low in each group, which helps to reduce accuracy disparity; (ii) CoD aims to reduce the correlation between the sensitive attributes and the predictions (or the inputs) in the feature space, which might somehow reduce the dependency between the distributions of these two variables. In comparison, our proposed methods do better in mitigating the error gaps. + +# 5 RELATED WORK + +Algorithmic Fairness In the literature, two main notions of fairness, i.e., group fairness and individual fairness, has been widely studied (Dwork et al., 2012; Zemel et al., 2013; Feldman et al., 2015; Hardt et al., 2016; Zafar et al., 2017b; Madras et al., 2019; Khani & Liang, 2019). In particular, Chen et al. (2018) analyzed the impact of data collection on discrimination (e.g., false positive rate, false negative rate, and zero-one loss) from the perspectives of bias-variance-noise decomposition, and they suggested collecting more training examples and collect additional variable to reduce discrimination. In comparison, our work precisely characterizes the disparate predictive accuracy in terms of the distance between label populations and the distance between conditional representation and propose algorithms to reduce accuracy disparity across groups in regression. + +Fair Regression A series of work focus on fairness under the regression problems (Calders et al., 2013; Johnson et al., 2016; Berk et al., 2018; Komiyama et al., 2018; Chzhen et al., 2020; Bigot, 2020; Zink & Rose, 2020; Mary et al., 2019; Narasimhan et al., 2020). To the best of our knowledge, no previous study aimed to minimize accuracy disparity in regression from representation learning. However, there are other similar fairness notions proposed for regression: Agarwal et al. (2019) proposed fair regression with bounded group loss (i.e., it asks that the prediction error for any protected group remain below some pre-defined level) and used exponentiated-gradient approach to satisfy BGL; Komiyama et al. (2018) aimed to reduce the coefficient of determination between the sensitive attributes between the predictions to some pre-defined level and used off-the-shelf convex optimizer to solve the problem. In contrast, we source out the root of accuracy disparity through the lens of information theory and reducing it via distributional alignment in a minimax game. + +Fair Representation A line of work focus on building algorithmic fair decision making systems using adversarial techniques to learn fair representations (Edwards & Storkey, 2015; Beutel et al., 2017; Adel et al., 2019; Zhao et al., 2019). The main idea behind is to learn a good representation of the data so that the data owner can maximize the accuracy while removing the information related to the sensitive attribute. Madras et al. (2018) proposed a generalized framework to learn adversarially fair and transferable representations and suggests using the label information in the adversary to learn equalized odds or equal opportunity representations in the classification setting. Apart from adversarial representation, recent work also proposed to use distance metrics, e.g., the maximum mean discrepancy (Louizos et al., 2015) and the Wasserstein distance (Jiang et al., 2019) to remove group-related information. Compared to their work, we propose to align (conditional) distributions across groups to reduce accuracy disparity using minimax optimization and analyze the game-theoretic optima in the minimax game in the regression setting. + +# 6 CONCLUSION + +In this paper, we theoretically and empirically study accuracy disparity in regression problems. Specifically, we prove an information-theoretic lower bound on the joint error and a complementary upper bound on the error gap across groups to depict the feasible region of group-wise errors. Our theoretical results indicate that accuracy disparity occurs inevitably due to the label distributions differ across groups. To reduce such disparity, we further propose to achieve accuracy parity by learning conditional group-invariant representations using statistical distances. The game-theoretic optima of the objective functions in our proposed methods are achieved when the accuracy disparity is minimized. Our empirical results on four real-world datasets demonstrate that our proposed algorithms help to reduce accuracy disparity effectively. We believe our results take an important step towards better understanding accuracy disparity in machine learning models. + +# REFERENCES + +Tameem Adel, Isabel Valera, Zoubin Ghahramani, and Adrian Weller. One-network adversarial fairness. In Thirty-Third AAAI Conference on Artificial Intelligence, 2019. + +Alekh Agarwal, Miroslav Dudik, and Zhiwei Steven Wu. Fair regression: Quantitative definitions and reduction-based algorithms. In International Conference on Machine Learning, pp. 120–129, 2019. + +Martin Arjovsky and Léon Bottou. Towards principled methods for training generative adversarial networks. arxiv e-prints, art. arXiv preprint arXiv:1701.04862, 2017. + +Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International Conference on Machine Learning, pp. 214–223, 2017. + +Eugene Bagdasaryan, Omid Poursaeed, and Vitaly Shmatikov. Differential privacy has disparate impact on model accuracy. In Advances in Neural Information Processing Systems, pp. 15453– 15462, 2019. + +Solon Barocas and Andrew D Selbst. Big data’s disparate impact. Calif. L. Rev., 104:671, 2016. + +Richard Berk, Hoda Heidari, Shahin Jabbari, Michael Kearns, and Aaron Roth. Fairness in criminal justice risk assessments: The state of the art. Sociological Methods & Research, pp. 0049124118782533, 2018. + +Alex Beutel, Jilin Chen, Zhe Zhao, and Ed H Chi. Data decisions and theoretical implications when adversarially learning fair representations. arXiv preprint arXiv:1707.00075, 2017. + +Jérémie Bigot. Statistical data analysis in the wasserstein space. ESAIM: Proceedings and Surveys, 68:1–19, 2020. + +Sarah Bird, Miro Dudík, Richard Edgar, Brandon Horn, Roman Lutz, Vanessa Milan, Mehrnoosh Sameki, Hanna Wallach, and Kathleen Walker. Fairlearn: A toolkit for assessing and improving fairness in AI. Technical Report MSR-TR-2020-32, Microsoft, May 2020. URL https://www.microsoft.com/en-us/research/publication/ fairlearn-a-toolkit-for-assessing-and-improving-fairness-in-ai/. + +Joy Buolamwini and Timnit Gebru. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Conference on fairness, accountability and transparency, pp. 77–91, 2018. + +Toon Calders, Asim Karim, Faisal Kamiran, Wasif Ali, and Xiangliang Zhang. Controlling attribute effect in linear regression. In 2013 IEEE 13th international conference on data mining, pp. 71–80. IEEE, 2013. + +Irene Chen, Fredrik D Johansson, and David Sontag. Why is my classifier discriminatory? In Advances in Neural Information Processing Systems, pp. 3539–3550, 2018. + +Evgenii Chzhen, Christophe Denis, Mohamed Hebiri, Luca Oneto, and Massimiliano Pontil. Fair regression with wasserstein barycenters. arXiv preprint arXiv:2006.07286, 2020. + +Constantinos Daskalakis and Ioannis Panageas. The limit points of (optimistic) gradient descent in min-max optimization. In Advances in Neural Information Processing Systems, pp. 9236–9246, 2018. + +William Dieterich, Christina Mendoza, and Tim Brennan. Compas risk scales: Demonstrating accuracy equity and predictive parity. Northpointe Inc, 2016. + +Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml. + +Cynthia Dwork, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Richard Zemel. Fairness through awareness. In Proceedings of the 3rd innovations in theoretical computer science conference, pp. 214–226, 2012. + +Harrison Edwards and Amos Storkey. Censoring representations with an adversary. arXiv preprint arXiv:1511.05897, 2015. + +Michael Feldman, Sorelle A Friedler, John Moeller, Carlos Scheidegger, and Suresh Venkatasubramanian. Certifying and removing disparate impact. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 259–268. ACM, 2015. + +Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1):2096–2030, 2016. + +Alison L Gibbs and Francis Edward Su. On choosing and bounding probability metrics. International statistical review, 70(3):419–435, 2002. + +Moritz Hardt, Eric Price, Nati Srebro, et al. Equality of opportunity in supervised learning. In Advances in neural information processing systems, pp. 3315–3323, 2016. + +Ray Jiang, Aldo Pacchiano, Tom Stepleton, Heinrich Jiang, and Silvia Chiappa. Wasserstein fair classification. arXiv preprint arXiv:1907.12059, 2019. + +Kory D Johnson, Dean P Foster, and Robert A Stine. Impartial predictive modeling: Ensuring fairness in arbitrary models. arXiv preprint arXiv:1608.00528, 2016. + +Fereshte Khani and Percy Liang. Noise induces loss discrepancy across groups for linear regression. arXiv preprint arXiv:1911.09876, 2019. + +Pauline T Kim. Data-driven discrimination at work. Wm. & Mary L. Rev., 58:857, 2016. + +Junpei Komiyama, Akiko Takeda, Junya Honda, and Hajime Shimao. Nonconvex optimization for regression with fairness constraints. In International conference on machine learning, pp. 2737–2746, 2018. + +Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard Zemel. The variational fair autoencoder. arXiv preprint arXiv:1511.00830, 2015. + +David Madras, Elliot Creager, Toniann Pitassi, and Richard Zemel. Learning adversarially fair and transferable representations. arXiv preprint arXiv:1802.06309, 2018. + +David Madras, Elliot Creager, Toniann Pitassi, and Richard Zemel. Fairness through causal awareness: Learning causal latent-variable models for biased data. In Proceedings of the Conference on Fairness, Accountability, and Transparency, pp. 349–358, 2019. + +Jérémie Mary, Clément Calauzènes, and Noureddine El Karoui. Fairness-aware learning for continuous attributes and treatments. In International Conference on Machine Learning, pp. 4382–4391, 2019. + +Harikrishna Narasimhan, Andrew Cotter, Maya R Gupta, and Serena Wang. Pairwise fairness for ranking and regression. In AAAI, pp. 5248–5255, 2020. + +Arvind Narayanan. Translation tutorial: 21 fairness definitions and their politics. In Proc. Conf. Fairness Accountability Transp., New York, USA, 2018. + +Cédric Villani. Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008. + +Linda F Wightman and Henry Ramsey. LSAC national longitudinal bar passage study. Law School Admission Council, 1998. + +Mohammad Yaghini, Bogdan Kulynych, and Carmela Troncoso. Disparate vulnerability: On the unfairness of privacy attacks against machine learning. arXiv preprint arXiv:1906.00389, 2019. + +Muhammad Bilal Zafar, Isabel Valera, Manuel Gomez Rodriguez, and Krishna P Gummadi. Fairness beyond disparate treatment & disparate impact: Learning classification without disparate mistreatment. In Proceedings of the 26th International Conference on World Wide Web, pp. 1171–1180. International World Wide Web Conferences Steering Committee, 2017a. + +Muhammad Bilal Zafar, Isabel Valera, Manuel Gomez Rogriguez, and Krishna P Gummadi. Fairness constraints: Mechanisms for fair classification. In Artificial Intelligence and Statistics, pp. 962–970, 2017b. + +Rich Zemel, Yu Wu, Kevin Swersky, Toni Pitassi, and Cynthia Dwork. Learning fair representations. In International Conference on Machine Learning, pp. 325–333, 2013. + +Han Zhao, Amanda Coston, Tameem Adel, and Geoffrey J Gordon. Conditional learning of fair representations. arXiv preprint arXiv:1910.07162, 2019. + +Anna Zink and Sherri Rose. Fair regression for health care spending. Biometrics, 76(3):973–982, 2020. + +# APPENDIX + +In the appendix, we give the proofs of the theorems and claims in our paper, the experimental details and more experimental results. + +# A MISSING PROOFS + +Lemma 3.1. Let ${ \widehat { Y } } = h ( X ) \in \mathbb { R }$ , then for $a \in \{ 0 , 1 \} , W _ { 1 } ( \mathcal { D } _ { a } ( Y ) , h _ { \sharp } \mathcal { D } _ { a } ) \leq \sqrt { \mathrm { E r r } _ { \mathcal { D } _ { a } } ( h ) } .$ + +Proof. The prediction error conditioned on $a \in \{ 0 , 1 \}$ is + +$$ +\begin{array} { r l } & { \mathrm { E r r } _ { \mathcal { D } _ { a } } ( h ) = \mathbb { E } [ \left( Y - h ( X ) \right) ^ { 2 } | A = a ] } \\ & { \quad \quad \quad \geq \mathbb { E } ^ { 2 } [ | Y - h ( X ) | | A = a ] } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \mathbb { E } [ | Y - h ( X ) | ] ) ^ { 2 } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \quad \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \quad \\ \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \ \end{array} +$$ + +Taking square root at both sides then completes the proof. + +Theorem 3.1. Let ${ \widehat { Y } } = h ( X ) \in \mathbb { R }$ , we have $\begin{array} { r } { { \mathrm { E r r } } _ { \mathcal { D } _ { 0 } } ( h ) + { \mathrm { E r r } } _ { \mathcal { D } _ { 1 } } ( h ) \geq \frac { 1 } { 2 } \big [ \big ( W _ { 1 } ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) - } \end{array}$ $W _ { 1 } \big ( h _ { \sharp } \mathcal { D } _ { 0 } , h _ { \sharp } \mathcal { D } _ { 1 } \big ) \big ) _ { + } \big ] ^ { 2 }$ . + +Proof. Since $W _ { 1 } ( \cdot , \cdot )$ is a distance metric, the result follows immediately the triangle inequality and Lemma 3.1: + +$$ +W _ { 1 } ( \mathcal D _ { 0 } ( Y ) , \mathcal D _ { 1 } ( Y ) ) \leq \sqrt { \mathrm { E r r } _ { \mathcal D _ { 0 } } ( h ) } + W _ { 1 } ( h _ { \sharp } \mathcal D _ { 0 } , h _ { \sharp } \mathcal D _ { 1 } ) + \sqrt { \mathrm { E r r } _ { \mathcal D _ { 1 } } ( h ) } . +$$ + +Rearrange the equation above and by AM-GM inequality, we have + +$$ +\begin{array} { r } { V _ { 1 } ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) - W _ { 1 } ( h _ { \sharp } \mathcal { D } _ { 0 } , h _ { \sharp } \mathcal { D } _ { 1 } ) \le \sqrt { \mathrm { E r r } _ { \mathcal { D } _ { 0 } } ( h ) } + \sqrt { \mathrm { E r r } _ { \mathcal { D } _ { 1 } } ( h ) } \le \sqrt { 2 ( \mathrm { E r r } _ { \mathcal { D } _ { 0 } } ( h ) + \mathrm { E r r } _ { \mathcal { D } _ { 1 } } ( h ) + \mathrm { E r r } _ { \mathcal { D } _ { 1 } } ( h ) ) } \le \sqrt { \pi } \beta _ { 1 } \beta _ { 1 } , } \end{array} +$$ + +Taking square at both sides then completes the proof. + +Corollary 3.1. Let ${ \widehat { Y } } = h ( X ) \in \mathbb { R }$ and $\alpha = { \mathcal { D } } ( A = 0 ) \in [ 0 , 1 ]$ , we have $\begin{array} { r } { \mathrm { E r r } _ { \mathcal D } ( h ) \geq \frac { 1 } { 2 } \operatorname* { m i n } \{ \alpha , 1 - } \end{array}$ $\alpha \} \cdot \left[ \left( W _ { 1 } ( \mathcal D _ { 0 } ( Y ) , \mathcal D _ { 1 } ( Y ) ) - W _ { 1 } ( h _ { \sharp } \mathcal D _ { 0 } , h _ { \sharp } \mathcal D _ { 1 } ) \right) _ { + } \right] ^ { \sharp }$ . + +Proof. The joint error is + +$$ +\begin{array} { r l } & { \quad \mathrm { E r r } _ { \mathcal D } ( h ) } \\ & { = \alpha \mathrm { E r r } _ { \mathcal D _ { 0 } } ( h ) + ( 1 - \alpha ) \mathrm { E r r } _ { \mathcal D _ { 1 } } ( h ) } \\ & { \geq \operatorname* { m i n } \{ \alpha , 1 - \alpha \} \big ( \mathrm { E r r } _ { \mathcal D _ { 0 } } ( h ) + \mathrm { E r r } _ { \mathcal D _ { 1 } } ( h ) \big ) } \\ & { \geq \frac { 1 } { 2 } \operatorname* { m i n } \{ \alpha , 1 - \alpha \} \big [ \big ( W _ { 1 } ( \mathcal D _ { 0 } ( Y ) , \mathcal D _ { 1 } ( Y ) ) - W _ { 1 } ( h _ { \sharp } \mathcal D _ { 0 } , h _ { \sharp } \mathcal D _ { 1 } ) \big ) _ { + } \big ] ^ { 2 } . \quad \mathrm { ( T h e o r e m ~ 3 . 1 ) } } \end{array} +$$ + +Lemma A.1. If Assumption 2.1 holds, then the following inequality holds: $| \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) \ -$ $\begin{array} { r } { \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( \bar { X } ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] | \le 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( \bar { X } ) , \bar { \mathcal { D } _ { 1 } } ( X ) ) } \end{array}$ . + +Proof. First, we know that $\| h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] \| _ { \infty } \leq 2 M , \forall a \in \{ 0 , 1 \}$ , since $\| h \| _ { \infty } \leq M$ and $| Y | \leq M$ . Now it suffices to bound: + +$$ +\begin{array} { r l r } & { ~ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] | } \\ & { = | \langle ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } , d { \mathcal { D } _ { 0 } } - d { \mathcal { D } _ { 1 } } \rangle | } \\ & { \leq \| h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] \| _ { \infty } ^ { 2 } \| d { \mathcal { D } _ { 0 } } - d { \mathcal { D } _ { 1 } } \| _ { 1 } } & { \mathrm { ( H i s l d e r ' s ~ i n ~ } } \\ & { \leq 4 M ^ { 2 } \| d { \mathcal { D } _ { 0 } } - d { \mathcal { D } _ { 1 } } \| _ { 1 } } & { \mathrm { ( A s s u m p t i o n ~ } } \\ & { = 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( X ) , \mathcal { D } _ { 1 } ( X ) ) . } \end{array} +$$ + +Note that the last equation follows the definition of total variation distance. + +Lemma A.2. If Assumption 2.1 holds, then the following inequality holds: $| \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) \ -$ $\mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ] ^ { 2 } - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( \dot { X } ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ] ^ { 2 } | \le 4 M \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \dot { \mathbb { E } } _ { \mathcal { D } _ { 1 } } [ Y | X ] | ]$ . + +Proof. + +$$ +\begin{array} { r l } & { \quad \big | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ] ^ { 2 } - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ] ^ { 2 } \big | } \\ & { = | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ h ^ { 2 } ( X ) - 2 h ( X ) \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] + \mathbb { E } _ { \mathcal { D } _ { 0 } } ^ { 2 } [ Y | X ] - h ^ { 2 } ( X ) + 2 h ( X ) \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } ^ { 2 } [ Y | X ] ] \big | } \\ & { \leq 2 M \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] | ] + 2 M \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ] \big | } \\ & { = 4 M \mathbb { E } _ { \mathcal { D } _ { 0 } } \big [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] \big | \big ] . } \end{array} +$$ + +Theorem 3.2. For any hypothesis $\mathcal { H } \ni h : \mathcal { X } \xrightarrow { } \mathcal { Y }$ , if the Assumption 2.1 holds, then: + +$$ +\begin{array} { r l } & { \Delta _ { \mathrm { E r r } } ( h ) \leq 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( X ) , \mathcal { D } _ { 1 } ( X ) ) + | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ \mathrm { V a r } _ { \mathcal { D } _ { 0 } } [ Y | X ] ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ \mathrm { V a r } _ { \mathcal { D } _ { 1 } } [ Y | X ] ] | } \\ & { \qquad + 4 M \operatorname* { m i n } \{ \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } ( Y | X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } ( Y | X ) | ] , \mathbb { E } _ { \mathcal { D } _ { 1 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } ( Y | X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } ( Y | X ) | ] \} . } \end{array} +$$ + +Proof. First, we show that for $a \in \{ 0 , 1 \}$ , + +$$ +\begin{array} { r l } & { \quad \ \mathrm { E r r } _ { \mathcal { D } _ { a } } ( h ) } \\ & { = \mathbb { E } _ { \mathcal { D } _ { a } } [ ( h ( X ) - Y ) ^ { 2 } ] } \\ & { = \mathbb { E } _ { \mathcal { D } _ { a } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] + \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] - Y ) ^ { 2 } ] } \\ & { = \mathbb { E } _ { \mathcal { D } _ { a } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ^ { 2 } ] + \mathbb { E } _ { \mathcal { D } _ { a } } [ ( Y - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ^ { 2 } ] } \\ & { \quad - 2 \mathbb { E } _ { \mathcal { D } _ { a } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ( Y - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ] } \\ & { = \mathbb { E } _ { \mathcal { D } _ { a } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ^ { 2 } ] + \mathbb { E } _ { \mathcal { D } _ { a } } [ ( Y - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ^ { 2 } ] . } \end{array} +$$ + +Note that the last equation holds since + +$$ +\begin{array} { r l } & { \quad \mathbb { E } _ { \mathcal { D } _ { a } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ( Y - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ] } \\ & { = \mathbb { E } _ { \mathcal { D } _ { a } ( X ) } [ \mathbb { E } _ { \mathcal { D } _ { a } ( Y | X ) } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ( Y - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) \vert X ] ] } \\ & { = \mathbb { E } _ { \mathcal { D } _ { a } ( X ) } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) \mathbb { E } _ { \mathcal { D } _ { a } ( Y | X ) } ( Y - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] \vert X ) ] } \\ & { = \mathbb { E } _ { \mathcal { D } _ { a } ( X ) } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ( \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { a } } [ Y | X ] ) ] } \\ & { = 0 . } \end{array} +$$ + +Next we bound the error gap: + +$$ +\begin{array} { r l } { } & { \quad | \mathrm { E r r } _ { \mathcal { D } _ { 0 } } ( h ) - \mathrm { E r r } _ { \mathcal { D } _ { 1 } } ( h ) | } \\ & { = | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] } \\ & { \quad + \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( Y - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( Y - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] | } \\ & { \leq | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] | } \\ & { \quad + | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ \mathrm { V a r } _ { \mathcal { D } _ { 0 } } [ Y | X ] ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ \mathrm { V a r } _ { \mathcal { D } _ { 1 } } [ Y | X ] ] | . } \end{array} +$$ + +Now it suffices to bound: + +$$ +\begin{array}{c} \begin{array} { r l } & { \quad \vert \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y \vert X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y \vert X ] ) ^ { 2 } ] \vert } \\ & { = \vert \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y \vert X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y \vert X ] ) ^ { 2 } ] } \\ & { \quad + \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y \vert X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y \vert X ] ) ^ { 2 } ] \vert } \\ & { \le \vert \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y \vert X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y \vert X ] ) ^ { 2 } ] \vert } \\ & { \quad + \vert \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y \vert X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y \vert X ] ) ^ { 2 } ] \vert . } \end{array} \quad \mathrm { ( T r ~ } \qquad \mathrm { ~ a ~ n ~ d ~ \mathcal ~ { D } ~ ) ~ } \end{array} +$$ + +iangle inequality) + +Invoke Lemma A.1 and Lemma A.2 to bound the above two terms: + +$$ +\begin{array} { r l } & { \quad \big | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] \big | } \\ & { \quad + \left| \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] \right| } \\ & { \leq 4 M \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] | ] + 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( X ) , \mathcal { D } _ { 1 } ( X ) ) . } \end{array} +$$ + +By symmetry, we also have: + +$$ +\begin{array} { r l } & { \quad \big | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] \big | } \\ & { \quad + \left| \mathbb { E } _ { \mathcal { D } _ { 0 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } ] \right| } \\ & { \leq 4 M \mathbb { E } _ { \mathcal { D } _ { 1 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] | ] + 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( X ) , \mathcal { D } _ { 1 } ( X ) ) . } \end{array} +$$ + +Combining the two inequalities above together, we have: + +$$ +\begin{array} { r l } & { \quad | \mathbb { E } _ { \mathcal { D } _ { 0 } } ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] ) ^ { 2 } - \mathbb { E } _ { \mathcal { D } _ { 0 } } ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } | } \\ & { \quad + \left| \mathbb { E } _ { \mathcal { D } _ { 0 } } ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } - \mathbb { E } _ { \mathcal { D } _ { 1 } } ( h ( X ) - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ) ^ { 2 } \right| } \\ & { \le 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( X ) , \mathcal { D } _ { 1 } ( X ) ) } \\ & { \quad + 4 M \operatorname* { m i n } \{ \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ] , \mathbb { E } _ { \mathcal { D } _ { 1 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y | X ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y | X ] ] \} . } \end{array} +$$ + +Incorporating the two variance terms back to the above inequality then completes the proof. + +Theorem 3.3. If Assumption 2.1 holds, then for $\forall h \in { \mathcal { H } }$ , let ${ \widehat { Y } } = h ( X )$ , the following inequality holds: + +$$ +\begin{array} { r l } & { \Delta _ { \mathrm { E r r } } ( h ) \leq 8 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal D _ { 0 } ( \boldsymbol Y ) , \mathcal D _ { 1 } ( \boldsymbol Y ) ) } \\ & { \qquad + 3 M \operatorname* { m i n } \{ { \mathbb { E } } _ { \mathcal D _ { 0 } } [ | { \mathbb { E } } _ { \mathcal D _ { 0 } ^ { \upsilon } } [ \widehat { Y } ] - { \mathbb { E } } _ { \mathcal D _ { 1 } ^ { \upsilon } } [ \widehat { Y } ] | ] , { \mathbb { E } } _ { \mathcal D _ { 1 } } [ | { \mathbb { E } } _ { \mathcal D _ { 0 } ^ { \upsilon } } [ \widehat { Y } ] - { \mathbb { E } } _ { \mathcal D _ { 1 } ^ { \upsilon } } [ \widehat { Y } ] | ] \} . } \end{array} +$$ + +Proof. First, we show that for $a \in \{ 0 , 1 \}$ : + +$\operatorname { \arg r } _ { \mathcal { D } _ { a } } ( h ) = \mathbb { E } _ { \mathcal { D } _ { a } } [ ( h ( X ) - Y ) ^ { 2 } ] = \mathbb { E } _ { \mathcal { D } _ { a } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) + Y ^ { 2 } ] = \mathbb { E } _ { \mathcal { D } _ { a } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] + \mathbb { E } _ { \mathcal { D } _ { a } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] .$ [ Y 2 ] . Next, we bound the error gap: + +$$ +\begin{array} { r l } & { \quad \vert \mathrm { E r r } _ { \mathcal { D } _ { 0 } } ( h ) - \mathrm { E r r } _ { \mathcal { D } _ { 1 } } ( h ) \vert } \\ & { = \vert \mathbb { E } _ { \mathcal { D } _ { 0 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] + \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y ^ { 2 } ] \vert } \\ & { \le \vert \mathbb { E } _ { \mathcal { D } _ { 0 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] \vert + \vert \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y ^ { 2 } ] \vert . } \end{array} +$$ + +For the second term, we can easily prove that + +$$ +\begin{array} { r } { \mathbb { E } _ { \mathcal { D } _ { 0 } } [ Y ^ { 2 } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ Y ^ { 2 } ] | = | \langle Y ^ { 2 } , d D _ { 0 } - d D _ { 1 } \rangle | \le \| Y \| _ { \infty } ^ { 2 } \| d D _ { 0 } - d D _ { 1 } \| _ { 1 } \le 2 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) , } \end{array} +$$ + +where the second equation follows Hölder’s inequality and the last equation follow the definition of total variation distance. Now it suffices to bound the remaining term: + +$$ +\begin{array} { l } { { \displaystyle | \mathbb { E } _ { { \mathcal { D } } _ { 0 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] - \mathbb { E } _ { { \mathcal { D } } _ { 1 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] | } \ ~ } \\ { { \displaystyle = \bigg | \int h ( { \mathbf x } ) ( h ( { \mathbf x } ) - 2 y ) \mathrm { d } \mu _ { 0 } ( { \mathbf x } , y ) - \int h ( { \mathbf x } ) ( h ( { \mathbf x } ) - 2 y ) \mathrm { d } \mu _ { 1 } ( { \mathbf x } , y ) \bigg | } \ ~ } \\ { { \displaystyle \le \bigg | \iint h ( { \mathbf x } ) ( h ( { \mathbf x } ) - 2 y ) \mathrm { d } \mu _ { 0 } ( { \mathbf x } | y ) d \mu _ { 0 } ( y ) - \iint h ( { \mathbf x } ) ( h ( { \mathbf x } ) - 2 y ) \mathrm { d } \mu _ { 0 } ( { \mathbf x } | y ) d \mu _ { 1 } ( y ) \bigg | } \ ~ } \\ { { \displaystyle ~ + \bigg | \iint h ( { \mathbf x } ) ( h ( { \mathbf x } ) - 2 y ) \mathrm { d } \mu _ { 1 } ( { \mathbf x } | y ) d \mu _ { 1 } ( y ) - \iint h ( { \mathbf x } ) ( h ( { \mathbf x } ) - 2 y ) \mathrm { d } \mu _ { 0 } ( { \mathbf x } | y ) d \mu _ { 1 } ( y ) \bigg | } . } \end{array} +$$ + +(Triangle inequality) + +We upper bound the first term: + +$$ +\begin{array} { r l } & { \quad \displaystyle \iint h ( \mathbf x ) ( h ( \mathbf x ) - 2 y ) \mathrm d \mu _ { 0 } ( \mathbf x \vert y ) \mathrm d \mu _ { 0 } ( y ) - \displaystyle \iint h ( \mathbf x ) ( h ( \mathbf x ) - 2 y ) \mathrm d \mu _ { 0 } ( \mathbf x \vert y ) \mathrm d \mu _ { 1 } ( y ) } \\ & { \le \displaystyle \iint h ( \mathbf x ) ( h ( \mathbf x ) - 2 y ) ( \mathrm d \mu _ { 0 } ( y ) - \mathrm d \mu _ { 1 } ( y ) ) \mathrm d \mu _ { 0 } ( \mathbf x \vert y ) } \\ & { \le \displaystyle \int \mathrm d \mu _ { 0 } ( y ) - \mathrm d \mu _ { 1 } ( y ) \displaystyle \int \operatorname* { s u p } _ { \mathbf x } h ( \mathbf x ) \vert h ( \mathbf x ) - 2 y \big \vert \mathrm d \mu _ { 0 } ( \mathbf x \vert y ) } \\ & { \le M \displaystyle \int \mathbb { E } _ { \mathcal { D } _ { 0 } } [ \vert h ( X ) - 2 Y \vert ] Y = y _ { 1 } \mathrm d \mu _ { 0 } ( y ) - \mathrm d \mu _ { 1 } ( y ) } \\ & { \le 3 M ^ { 2 } \displaystyle \int \mathrm d \mu _ { 0 } ( y ) - \mathrm d \mu _ { 1 } ( y ) } \\ & { \le 6 M ^ { 2 } d \mathrm T \nabla ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) . } \end{array} +$$ + +Note that the last equation follows the definition of total variation distance. For the second term, we have: + +$$ +\begin{array} { l } { \displaystyle \left. \iint h ( \mathbf x ) ( h ( \mathbf x ) - 2 y ) \mathrm d \mu _ { 1 } ( \mathbf x \vert y ) \mathrm d \mu _ { 1 } ( y ) - \displaystyle \iint h ( \mathbf x ) ( h ( \mathbf x ) - 2 y ) \mathrm d \mu _ { 0 } ( \mathbf x \vert y ) \mathrm d \mu _ { 1 } ( y ) \right. } \\ { \displaystyle \le \left. \iint h ^ { 2 } ( \mathbf x ) ( \mathrm d \mu _ { 1 } ( \mathbf x \vert y ) - \mathrm d \mu _ { 0 } ( \mathbf x \vert y ) ) \mathrm d \mu _ { 1 } ( y ) \right. + \left. \iint 2 y h ( \mathbf x ) ( \mathrm d \mu _ { 1 } ( \mathbf x \vert y ) - \mathrm d \mu _ { 0 } ( \mathbf x \vert y ) ) \mathrm d \mu _ { 1 } ( y ) \right. } \\ { \displaystyle \le 3 M \mathbb E _ { \mathcal D _ { 1 } } [ \| \mathbb E _ { \mathcal D _ { 0 } ^ { y } } [ \widehat { Y } ] - \mathbb E _ { \mathcal D _ { 1 } ^ { y } } [ \widehat { Y } ] \| . } \end{array} +$$ + +To prove the last equation, we first see that: + +$$ +\begin{array} { r l } & { \quad \displaystyle \left. \iint h ^ { 2 } ( \mathbf { x } ) ( \mathrm { d } \mu _ { 1 } ( \mathbf { x } \vert y ) - \mathrm { d } \mu _ { 0 } ( \mathbf { x } \vert y ) ) \mathrm { d } \mu _ { 1 } ( y ) \right. } \\ & { \leq \displaystyle \left. \iint \left( \operatorname* { s u p } h ( \mathbf { x } ) \right) h ( \mathbf { x } ) ( \mathrm { d } \mu _ { 1 } ( \mathbf { x } \vert y ) - \mathrm { d } \mu _ { 0 } ( \mathbf { x } \vert y ) ) \mathrm { d } \mu _ { 1 } ( y ) \right. } \\ & { \leq M \displaystyle \int \left. \mathbb { E } _ { \mathcal { D } _ { 0 } } [ h ( X ) \vert Y = y ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ h ( X ) \vert Y = y ] \right. \mathrm { d } \mu _ { 1 } ( y ) \quad \mathrm { ( A s s u m p t i o n ~ 2 . 1 ) } } \\ & { = M \mathbb { E } _ { \mathcal { D } _ { 1 } } [ \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { y } } [ \widehat { Y } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } ^ { y } } [ \widehat { Y } ] \vert ] . } \end{array} +$$ + +Similarly, we also have: + +$$ +\begin{array} { l } { \displaystyle \left. \iint 2 y h ( { \bf x } ) ( \mathrm { d } \mu _ { 1 } ( { \bf x } \vert y ) - \mathrm { d } \mu _ { 0 } ( { \bf x } \vert y ) ) \mathrm { d } \mu _ { 1 } ( y ) \right. } \\ { \displaystyle \leq 2 \left. \iint ( \mathrm { s u p } y ) h ( { \bf x } ) ( \mathrm { d } \mu _ { 1 } ( { \bf x } \vert y ) - \mathrm { d } \mu _ { 0 } ( { \bf x } \vert y ) ) \mathrm { d } \mu _ { 1 } ( y ) \right. } \\ { \displaystyle \leq 2 M \int \left. \mathbb { E } _ { \mathcal { D } _ { 0 } } [ h ( X ) \vert Y = y ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ h ( X ) \vert Y = y ] \right. d \mu _ { 1 } ( y ) ~ \mathrm { ~ ( A s s u m p t i o n ~ 2 . 1 ) } } \\ { \displaystyle = 2 M \mathbb { E } _ { \mathcal { D } _ { 1 } } [ \big \vert \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { \flat } } [ \hat { Y } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } ^ { \flat } } [ \hat { Y } ] \big \vert ] . } \end{array} +$$ + +By symmetry, we can also see that: + +$$ +\begin{array} { r } { \mathbb { E } _ { \mathcal { D } _ { 0 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] | \le 6 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) + 3 M \mathbb { E } _ { \mathcal { D } _ { 1 } } [ \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { \upsilon } } [ \hat { \mathrm { T } } _ { \mathcal { D } _ { 0 } ^ { \upsilon } } ] - \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { \upsilon } } [ h ^ { 2 } ( X ) - 2 ( Y ) ] | \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { \upsilon } } [ \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { \upsilon } } [ \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { \upsilon } } ] ] ) . } \end{array} +$$ + +Combine the above two equations yielding: + +$$ +\begin{array} { r l } & { \quad | \mathbb { E } _ { \mathcal { D } _ { 0 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] - \mathbb { E } _ { \mathcal { D } _ { 1 } } [ h ^ { 2 } ( X ) - 2 Y h ( X ) ] | } \\ & { \leq 6 M ^ { 2 } d _ { \mathrm { T V } } ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) + 3 M \operatorname* { m i n } \{ \mathbb { E } _ { \mathcal { D } _ { 0 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { y } } [ \widehat { Y } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } ^ { y } } [ \widehat { Y } ] | ] , \mathbb { E } _ { \mathcal { D } _ { 1 } } [ | \mathbb { E } _ { \mathcal { D } _ { 0 } ^ { y } } [ \widehat { Y } ] - \mathbb { E } _ { \mathcal { D } _ { 1 } ^ { y } } [ \widehat { Y } ] | ] \} . } \end{array} +$$ + +Incorporating the terms back to the upper bound of the error gap then completes the proof. + +Theorem 3.4. Consider the minimax game in (1). The equilibrium $( g ^ { * } , f ^ { * } )$ of the game is attained when 1). $Z = g ^ { * } ( X )$ is independent of $A$ conditioned on $Y ; 2 )$ ). $f ^ { * } ( Z , Y ) = { \mathcal { D } } ( A = 1 \mid Y , Z )$ . + +Proof. To prove Theorem 3.4, we first give Proposition A.1. + +Proposition A.1. For any feature map $g : \mathcal { X } \mathcal { Z }$ , assume that $\mathcal { F }$ contains all the randomized binary classifiers and $\mathcal { F } \ni f : \mathcal { Z } \times \mathcal { Y } \mathcal { A }$ , then $\begin{array} { r } { \operatorname* { m i n } _ { f \in { \mathcal { F } } } \operatorname { C E } _ { \mathcal { D } } ( A \parallel f ( g ( X ) , Y ) ) = H ( A \mid Z , Y ) } \end{array}$ . + +Proof. By the definition of cross-entropy loss, we have: + +$$ +\begin{array} { r l } & { \mathrm { C E } _ { \mathcal { D } } ( A \parallel f ) = - \mathbb { E } _ { \mathcal { D } } \left[ \mathbb { I } ( A = 0 ) \log ( 1 - f ( g ( X ) , Y ) ) + \mathbb { I } ( A = 1 ) \log ( f ( g ( X ) , Y ) ) \right] } \\ & { \quad \quad \quad = - \mathbb { E } _ { g _ { \sharp } \mathcal { D } } \left[ \mathbb { I } ( A = 0 ) \log ( 1 - f ( Z , Y ) ) + \mathbb { I } ( A = 1 ) \log ( f ( Z , Y ) ) \right] } \\ & { \quad \quad = - \mathbb { E } _ { Z , Y } \mathbb { E } _ { A \mid Z , Y } \left[ \mathbb { I } ( A = 0 ) \log ( 1 - f ( Z , Y ) ) + \mathbb { I } ( A = 1 ) \log ( f ( Z , Y ) ) \right] } \\ & { \quad \quad = - \mathbb { E } _ { Z , Y } \left[ \mathcal { D } ( A = 0 \mid Z , Y ) \log ( 1 - f ( Z , Y ) ) + \mathcal { D } ( A = 1 \mid Z , Y ) \log ( f ( Z , Y ) ) \right] } \\ & { \quad \quad = \mathbb { E } _ { Z , Y } \left[ D _ { \mathbb { K L } } ( \mathcal { D } ( A \mid Z , Y ) \parallel f ( Z , Y ) ) \right] + H ( A \mid Z , Y ) } \\ & { \quad \quad \ge H ( A \mid Z , Y ) , } \end{array} +$$ + +where $D _ { \mathrm { K L } } ( \cdot \| \cdot )$ denotes the KL divergence between two distributions. From the above inequality, it is also clear that the minimum value of the cross-entropy loss is achieved when $f ( Z , Y )$ equals the conditional probability ${ \mathcal { D } } ( A = 1 \mid Z , Y )$ , i.e., $f ^ { * } ( Z , Y ) { \bar { } } = { \mathcal { D } } ( A = 1 \mid Z = g ( X ) , Y )$ .  + +Proposition A.1 states that the minimum cross-entropy loss that the discriminator can achieve is $H ( A \mid Z , Y )$ when $f$ is the conditional distribution ${ \mathcal { D } } ( A = 1 \mid Z = g ( X ) , Y )$ . By the basic property of conditional entropy, we have: + +$$ +\operatorname* { m i n } _ { f \in { \mathcal { F } } } \mathrm { C E } _ { \mathcal { D } } ( A \parallel f ( g ( X ) , Y ) ) = H ( A \mid Z , Y ) = H ( A \mid Y ) - I ( A ; Z \mid Y ) . +$$ + +Note that $H ( A \mid Y )$ is a constant given the distribution $\mathcal { D }$ , so the maximization of $g$ is equivalent to the minimization of $\scriptstyle \operatorname* { m i n } _ { Z = g ( X ) } \ I ( A ; Z \mid Y )$ , and it follows that the optimal strategy for the transformation $g$ is the one that induces conditionally invariant features, e.g., $I ( A ; Z \mid Y ) = 0$ . On the other hand, if $g ^ { * }$ plays optimally, then the optimal response of the discriminator $f$ is given by + +$$ +f ^ { * } ( Z , Y ) = { \mathcal { D } } ( A = 1 \mid Z = g ^ { * } ( X ) , Y ) = { \mathcal { D } } ( A = 1 \mid Y ) . +$$ + +Theorem 3.5. Let $\begin{array} { r } { g ^ { * } : = \arg \operatorname* { m i n } _ { g } W _ { 1 } ( \mathcal { D } _ { 0 } ( g ( X ) , Y ) , \mathcal { D } _ { 1 } ( g ( X ) , Y ) ) } \end{array}$ , then ${ \mathcal D } _ { 0 } ^ { Y } ( Z = g ^ { * } ( X ) ) =$ ${ \mathcal { D } } _ { 1 } ^ { Y } ( Z = g ^ { * } ( X ) )$ almost surely. + +Proof. By the definition of Wasstertein distance, we have: + +$$ +\begin{array} { r l } { V _ { 1 } ( \mathcal { D } _ { 0 } ( Z , Y ) , \mathcal { D } _ { 1 } ( Z , Y ) ) = } & { \underset { \gamma \in \Gamma ( \mathcal { D } _ { 0 } , \mathcal { D } _ { 1 } ) } { \operatorname* { i n f } } \int d ( ( z _ { 0 } , y _ { 0 } ) , ( \mathbf { z } _ { 1 } , y _ { 1 } ) ) \mathrm { d } \gamma \big ( ( \mathbf { z } _ { 0 } , y _ { 0 } ) , ( z _ { 1 } , y _ { 1 } ) \big ) } \\ & { = \underset { \gamma \in \Gamma ( \mathcal { D } _ { 0 } , \mathcal { D } _ { 1 } ) } { \operatorname* { i n f } } \iint d ( ( z _ { 0 } , y _ { 0 } ) , ( \mathbf { z } _ { 1 } , y _ { 1 } ) ) \mathrm { d } \gamma \big ( \mathbf { z } _ { 0 } , z _ { 1 } \mid y _ { 0 } , y _ { 1 } \big ) \mathrm { d } \gamma ( y _ { 0 } , y _ { 1 } ) } \\ & { = \underset { \gamma \in \Gamma ( \mathcal { D } _ { 0 } , \mathcal { D } _ { 1 } ) } { \operatorname* { i n f } } \iint \lVert \mathbf { z } _ { 0 } - \mathbf { z } _ { 1 } \rVert _ { 1 } + \lvert y _ { 0 } - y _ { 1 } \rvert \mathrm { d } \gamma ( z _ { 0 } , \mathbf { z } _ { 1 } \mid y _ { 0 } , y _ { 1 } ) \mathrm { d } \gamma ( y _ { 0 } , y _ { 1 } ) } \\ & { \geq \underset { \gamma \in \Gamma ( \mathcal { D } _ { 0 } , \mathcal { D } _ { 1 } ) } { \operatorname* { i n f } } \iint \lvert y _ { 0 } - y _ { 1 } \rvert \mathrm { d } \gamma ( y _ { 0 } , y _ { 1 } ) \mathrm { d } \gamma ( \mathbf { z } _ { 0 } , \mathbf { z } _ { 1 } \mid y _ { 0 } , y _ { 1 } ) } \\ & { = \underset { \gamma \in \Gamma ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) } { \operatorname* { i n f } } \int \lvert y _ { 0 } - y _ { 1 } \rvert \mathrm { d } \gamma ( y _ { 0 } , y _ { 1 } ) } \\ & { = W _ { 1 } ( \mathcal { D } _ { 0 } ( Y ) , \mathcal { D } _ { 1 } ( Y ) ) . } \end{array} +$$ + +To finish the proof, next we prove the lower bound is achieved when $\mathcal { D } _ { 0 } ^ { Y } ( Z = g ^ { * } ( X ) ) = \mathcal { D } _ { 1 } ^ { Y } ( Z =$ $g ^ { * } ( X ) )$ : it is easy to see $\begin{array} { r } { \dot { W _ { 1 } } ( \mathcal { D } _ { 0 } ^ { Y } ( Z ) , \mathcal { D } _ { 0 } ^ { Y } ( Z ) ) = \int \| { \mathbf z } _ { 0 } - { \mathbf z } _ { 1 } \| _ { 1 } \mathrm { d } \gamma ( { \mathbf z } _ { 0 } , { \mathbf z } _ { 1 } \mid \dot { y _ { 0 } } , \dot { y _ { 1 } } ) \stackrel { \sim } { = } 0 } \end{array}$ when the conditional distributions are equal. In this case, when the Wasserstein distance is minimized, then $Z$ is conditionally independent of $A$ given $Y$ .  + +# B EXPERIMENTAL DETAILS + +Adult The Adult dataset contains 48,842 examples for income prediction. The task is to predict whether the annual income of an individual is greater or less than 50K/year based on the attributes of the individual, such as education level, age, occupation, etc. In our experiment, we use gender (binary) as the sensitive attribute. The target variable (income) is an ordinal binary variable: 0 if $<$ 50K/year otherwise 1. After data pre-processing, the dataset contains 30,162/15,060 training/test instances where the input dimension of each instance is 113. We show the data distributions for different demographic subgroups in Table 1. + +To preprocess the dataset, we first filter out the data records that contain the missing values. We then remove the sensitive attribute from the input features and normalize the input features with its means and standard deviations. Note that we use one-hot encoding for the categorical attributes. + +For our proposed methods, we use a three-layer neural network with ReLU as the activation function of the hidden layers and the sigmoid function as the output function for the prediction task (we take the first two layers as the feature mapping). The number of neurons in the hidden layers is 60. We train the neural networks with the ADADELTA algorithm with the learning rate 0.1 and a batch size of 512. The models are trained in 50 epochs. For the adversary networks in CENET and WASSERSTEINNET, we use a two-layer neural network with ReLU as the activation function. The number of neurons in the hidden layers of the adversary networks is 60. The adversary network in CENET also use sigmoid function as the output function. The weight clipping norm in the adversary network of WASSERSTEINNET is 0.005. We use the gradient reversal layer (Ganin et al., 2016) to implement the gradient descent ascent (GDA) algorithm for optimization of the minimax problem since it makes the training process more stable (Daskalakis & Panageas, 2018). For the rest of the datasets we used in our experiments, we also use gradient reversal layer to implement our algorithms. + +We use the Fairlearn toolkit (Bird et al., 2020) to implement BGL: we use the exponentiated-gradient algorithm with the default setting as the mitigator and vary the upper bound $\epsilon \in \mathsf { \bar { \{ 0 . 0 7 , 0 . 1 , 0 . 2 , 0 . 5 \} } }$ of the bounded group loss constraint. For each value of , we run ten random seeds and compute the means and standard deviations. + +COMPAS The COMPAS dataset 6,172 instances to predict whether a criminal defendant will recidivate within two years or not. It contains attribute such as age, race, etc. In our experiment, we use race (white or non-white) as the sensitive attribute and recidivism as the target variable. We split the dataset into training and test set with the ratio 7/3. We show the data distributions for different demographic subgroups in Table 2. + +For all methods, we use a two-layer neural network with ReLU as the activation function of the hidden layers and the sigmoid function as the output function for the prediction task (we take the first layer as the feature mapping). The number of neurons in the hidden layers is 60. We train the neural networks with the ADADELTA algorithm with the learning rate 1.0 and a batch size of 512. The models are trained in 50 epochs. For the adversary networks in CENET and WASSERSTEINNET, we use a two-layer neural network with ReLU as the activation function. The number of neurons in the hidden layers of the adversary networks is 10. The adversary network in CENET also use sigmoid function as the output function. The weight clipping norm in the adversary network of WASSERSTEINNET is 0.05. + +We use the Fairlearn toolkit to implement BGL: we use the exponentiated-gradient algorithm with the default setting as the mitigator and vary the upper bound $\epsilon \overset { \cdot } { \in } \{ 0 . 1 , 0 . 2 , 0 . 3 , 0 . 5 \}$ of the bounded group loss constraint. For each value of $\epsilon .$ , we run ten random seeds and compute the means and standard deviations. + +As for COD, we follow the source implementation.2 We use the same hyper-parameter settings as (Komiyama et al., 2018): We use the kernelized optimization with the random Fourier features and the RBF kernel (we vary hyper-parameter of the RBF kernel $\gamma \in \{ 0 . 1 , 1 . 0 , 1 0 , 1 0 0 \} )$ and report the best results with minimal MSE loss for each time we change the fairness budget $\epsilon$ . We also vary $\epsilon \in \{ 0 . 0 1 , 0 . 1 , 0 . 5 , 1 . 0 \}$ and run ten random seeds and compute the means and standard deviations. + +Table 1: Data distribution of $Y$ and $A$ in Adult dataset. + +
Y=0 Y=1
A=0209889539
A=1130261669
+ +Table 2: Data distribution of $Y$ and $A$ in COMPAS dataset. + +
Y=0 Y=1
A=0 18491148
A=1 15141661
+ +Communities and Crime The Communities and Crime dataset contains 1,994 examples of socioeconomic, law enforcement, and crime data about communities in the United States. The task is to predict the number of violent crimes per 100K population. All attributes in the dataset have been curated and normalized to [0, 1]. In our experiment, we use race (binary) as the sensitive attribute: 1 if the population percentage of the white is greater or equal to $80 \%$ otherwise 0. After data pre-processing, the dataset contains 1,595/399 training/test instances where the input dimension of each instance is 96. We visualize the data distributions for different demographic subgroups in Figure 3b. + +To preprocess the dataset, we first remove the non-predictive attributes and sensitive attributes from the input features. Note that all features in the dataset have already been normalized in [0, 1] so that we do not perform additional normalization to the features. We then replace the missing values with the mean values of the corresponding attributes. + +For all methods, we use a two-layer neural network with ReLU as the activation function of the hidden layers and the sigmoid function as the output function for the prediction task (we take the first layer as the feature mapping). The number of neurons in the hidden layers is 50. We train the neural networks with the ADADELTA algorithm with the learning rate 0.1 and a batch size of 256. The models are trained in 100 epochs. For the adversary networks in CENET and WASSERSTEINNET, we use a two-layer neural network with ReLU as the activation function. The number of neurons in the hidden layers of the adversary networks is 100. The adversary network in CENET also use sigmoid function as the output function. The weight clipping norm in the adversary network of WASSERSTEINNET is 0.002. + +We use the Fairlearn toolkit to implement BGL: we use the exponentiated-gradient algorithm with the default setting as the mitigator and vary the upper bound $\epsilon \in \{ 0 . 0 1 , 0 . 0 2 , 0 . 0 3 , 0 . 0 5 \}$ of the bounded group loss constraint. For each value of $\epsilon .$ , we run ten random seeds and compute the means and standard deviations. + +As for COD, we follow the same hyper-parameter settings as (Komiyama et al., 2018): We use the kernelized optimization with the random Fourier features and the RBF kernel (we vary hyperparameter of the RBF kernel $\gamma \in \{ 0 . 1 , 1 . 0 , 1 0 , 1 0 0 \} )$ and report the best results with minimal MSE loss for each time we change the fairness budget $\epsilon$ . The hyper-parameter settings follow from (Komiyama et al., 2018). We also vary $\epsilon \in \{ 0 . 0 1 , 0 . 1 , 0 . 5 , 1 . 0 \}$ and run ten random seeds and compute the means and standard deviations. + +![](images/fac6d3d4ea2c81eca46d4b4e51b56e0cff74503bb3c07135de333c900b678588.jpg) +Figure 3: Data distributions for different demographic subgroups in two datasets. + +Law School The Law School dataset contains 1,823 records for law students who took the bar passage study for Law School Admission3. The features in the dataset include variables such as undergraduate GPA, LSAT score, full-time status, family income, gender, etc. In our experiment, we use gender as the sensitive attribute and undergraduate GPA as the target variable. We split the dataset into training and test set with the ratio 8/2. We show the data distributions for different demographic subgroups in Figure 3a. + +For all methods, we use a two-layer neural network with ReLU as the activation function of the hidden layers and the sigmoid function as the output function for the prediction task (we take the first layer as the feature mapping). The number of neurons in the hidden layers is 10. We train the neural networks with the ADADELTA algorithm with the learning rate 0.1 and a batch size of 256. The models are trained in 100 epochs. For the adversary networks in CENET and WASSERSTEINNET, we use a two-layer neural network with ReLU as the activation function. The number of neurons in the hidden layers of the adversary networks is 10. The adversary network in CENET also use sigmoid function as the output function. The weight clipping norm in the adversary network of WASSERSTEINNET is 0.2. + +We use the Fairlearn toolkit to implement BGL: we use the exponentiated-gradient algorithm with the default setting as the mitigator and vary the upper bound $\epsilon \in \left. 0 . 0 1 , 0 . 0 2 , \bar { 0 } . 0 3 , 0 . 0 5 \right.$ of the bounded group loss constraint. For each value of $\epsilon$ , we run ten random seeds and compute the means and standard deviations. + +As for COD, we follow the same hyper-parameter settings as (Komiyama et al., 2018): We use the kernelized optimization with the random Fourier features and the RBF kernel (we vary hyperparameter of the RBF kernel $\gamma \in \{ 0 . 1 , 1 . 0 , 1 0 , 1 0 0 \} )$ and report the best results with minimal MSE loss for each time we change the fairness budget $\epsilon$ . The hyper-parameter settings follow from (Komiyama et al., 2018). We also vary $\epsilon \in \{ 0 . 0 1 , 0 . 1 , 0 . 5 , 1 . 0 \}$ and run ten random seeds and compute the means and standard deviations. + +C ADDITIONAL EXPERIMENTAL RESULTS AND ANALYSES + +In this section, we provide additional experimental results and analyses. + +# C.1 IMPACT OF FAIRNESS TRADE-OFF PARAMETERS + +We present additional experimental results and analyses to gain more insights into how the fairness trade-off parameters (e.g., $\lambda$ and $\epsilon$ ) affect the performance of the model predictive performance and accuracy disparity in each methods. + +Table 3: $R ^ { 2 }$ regression scores and error gaps when $\lambda$ changes in CENET and WASSERSTEINNET. + +
0.01.01050100
AdultR △ErrCENET 0.4419±0.0024 0.4179±0.0019 0.3908±0.0136 0.3440±0.0210 0.2813±0.0215
WASSERSTEINNET 0.4419±0.0024 0.4388±0.0023 0.4136±0.0032 0.3891±0.0063 0.3653±0.0120
CENET 0.0697±0.00040.0647±0.0010 0.0596±0.0027 0.0621±0.0057 0.0678±0.0051 WASSERSTEINNET 0.0697±0.0004 0.0691±0.0006 0.0698±0.0011 0.0631±0.0022 0.0592±0.0033
A0.00.1 0.51.05.0
COMPASRCENET 0.1631±0.0127 0.1610±0.0119 0.1542±0.0129 0.1515±0.0125 0.1418±0.0151
WASSERSTEINNET 0.1631±0.0127 0.1645±0.0136 0.1564±0.0125 0.1471±0.01510.1439±0.0143 CENET 0.0088±0.00480.0075±0.00440.0067±0.0046 0.0066±0.0039 0.0063±0.0046
△ErrWASSERSTEINNET 0.0088±0.0048 0.0088±0.0045 0.0079±0.0041 0.0070±0.0036 0.0072±0.0032
0.00.11.0 5.010
CrimeCENET 0.5435±0.0077 0.5290±0.0107 0.1632±0.0573 0.1334±0.0720 0.1692±0.1509 WASSERSTEINNET 0.5435±0.0077 0.5467±0.0063 0.5472±0.0065 0.5446±0.0091 0.5319±0.0143
△ErrCENET0.0191±0.00030.0175±0.0004 0.0230±0.0027 0.0221±0.0079 0.0265±0.0051
AWASSERSTEINNET 0.0191±0.0003 0.0194±0.0004 0.0191±0.0004 0.0180±0.0005 0.0173±0.0010
0.0 CENET 0.1197±0.0314 0.1200±0.0299 0.1059±0.0277 0.0464±0.0542 0.0235±0.07320.11.05.010
Law△ErrWASSERSTEINNET 0.1197±0.0314 0.1134±0.0339 0.0902±0.0292 0.0316±0.0476 0.0146±0.0553 CENET 0.0102±0.0010 0.0101±0.0009 0.0090±0.0018 0.0070±0.0030 0.0066±0.0030 WASSERSTEINNET 0.0102±0.0010 0.0098±0.0016 0.0090±0.0019 0.0072±0.0025 0.0069±0.0027
+ +Table 3 shows $R ^ { 2 }$ regression scores and error gaps when $\lambda$ changes in CENET and WASSERSTEINNET. We see that the error gap gradually decreases with the increase of the trade-off parameter $\lambda$ in most scenarios with small accuracy loss (except for CENET in Adult dataset and Crime dataset when $\lambda$ is large), which demonstrates the overall effectiveness of our proposed algorithms. Plus, the increase of $\lambda$ generally leads to the instability of training processes with larger variances of both values of $R ^ { 2 }$ and error gap. In contrast to WASSERSTEINNET, CENET outperforms in mitigating the accuracy disparity while achieving similar or better accuracy in COMPAS and Law dataset. In Adult and Crime dataset, when $\lambda$ is small, CENET also does better in reducing the error gap than WASSERSTEINNET with similar accuracy loss. The results follow the fact that minimizing total variation distance between two continuous distributions ensures the minimization of Wasserstein distance (Gibbs & Su, 2002). However, when $\lambda$ increases, WASSERSTEINNET achieves better accuracy and performance disparity trade-off while CENET suffers significant accuracy loss and may fail to decrease the error gap. It is not surprising since the estimation of total variation in minimax optimization could lead to an unstable training process (Arjovsky & Bottou, 2017; Arjovsky et al., 2017). + +Table 4 shows $R ^ { 2 }$ regression scores and error gaps when $\epsilon$ changes in BGL. We see that with the decrease of the trade-off parameter $\epsilon$ , both the values of $R ^ { 2 }$ and error gaps decrease. This is because when upper bound $\epsilon$ of BGL is small, the accuracy disparity is also mitigated. When $\epsilon$ is above/below a certain threshold, the values of $R ^ { 2 }$ and error gaps then increase/decrease. It is also worth to note that the exponentiated-gradient approach to solve BGL does not introduce the randomness during optimization. + +Table 4: $R ^ { 2 }$ regression scores and error gaps when $\epsilon$ changes in BGL. + +
AdultE0.070.10.20.5
0.3508±0.00000.3508±0.00000.3696±0.00000.3696±0.0000
Err0.0612±0.00000.0612±0.00000.0726±0.00000.0726±0.0000
COMPASE0.10.20.30.5
0.1478±0.00000.1478±0.00000.1507±0.00000.1507±0.0000
△Err0.0072±0.00000.0072±0.00000.0086±0.00000.0086±0.0000
CrimeE0.010.020.030.05
0.3922±0.00000.3922±0.00000.5380±0.00000.5380±0.0000
△Err0.0189±0.00000.0189±0.00000.0238±0.00000.0238±0.0000
LawE0.010.020.030.05
0.1407±0.00000.1407±0.00000.1407±0.00000.1412±0.0000
△Err0.0094±0.00000.0094±0.00000.0094±0.00000.0101±0.0000
+ +Table 5: $R ^ { 2 }$ regression scores and error gaps when $\epsilon$ changes in COD. + +
COMPASE0.010.10.51.0
R0.1033±0.01110.1144±0.01000.1146±0.00990.1146±0.0099
△Err0.0064±0.00420.0083±0.00580.0085±0.00600.0085±0.0060
CrimeE0.010.10.51.0
R0.1262±0.00000.3284±0.00000.3603±0.00000.3603±0.0000
△Err0.0312±0.00000.0307±0.00000.0343±0.00000.0343±0.0000
LawE0.010.10.51.0
0.1262±0.00000.3284±0.00000.3606±0.00000.3603±0.0000
△Err0.0312±0.00000.0307±0.00000.0343±0.00000.0343±0.0000
+ +Table 5 shows $R ^ { 2 }$ regression scores and error gaps when $\epsilon$ changes in COD. We see that with the decrease of the trade-off parameter $\epsilon$ , both the values of $R ^ { 2 }$ and error gaps decrease. It is worth to note that the the optimization of QCQP to solve COD does not introduce the randomness, and the only randomness introduced in COMPAS dataset is because using the random Fourier features in prediction achieves the best performance in COMPAS dataset. + +# C.2 VISUALIZATION OF TRAINING PROCESSES + +We visualize the training processes of our proposed methods CENET and WASSERSTEINNET in the Adult dataset and COMPAS dataset in Figure 4 and Figure 5, respectively. We also compare their training dynamics with the model performance that we solely minimize the MSE loss (i.e., $\lambda = 0$ ) and we term it as NO DEBIAS. + +![](images/3b11d17fccb0c045e9cecca6c28ff5a43e661c4298482cd4be66cbcb5a603d96.jpg) +Figure 4: Training visualization of CENET, WASSERSTEINNET $\lambda = 5 0$ ) and NO DEBIAS $\lambda = 0$ ) in the Adult dataset. + +![](images/b4ea29a627e82506681a5ba896d756a732a647573fb7b83e4afc157920c50ac0.jpg) +Figure 5: Training visualization of CENET, WASSERSTEINNET $\lambda = 5$ ) and NO DEBIAS $\lambda = 0$ ) in the COMPAS dataset. + +In Figure 4 and Figure 5, we can see that as the training progress, the MSE losses in both datasets are decreasing and finally converge. However, the training dynamics of error gaps are much more complex even in the NO DEBIAS case. Before convergence, the training dynamics of error gaps differs among different datasets. Our methods enforce the models to converge to the points where error gap are smaller while preserving the models’ predictive performance. It is also worth to note that minimax optimization makes the training processes somehow unstable. \ No newline at end of file diff --git a/md/train/QYjO70ACDK/QYjO70ACDK.md b/md/train/QYjO70ACDK/QYjO70ACDK.md new file mode 100644 index 0000000000000000000000000000000000000000..fa6b657315e4d794f44217c1a608b9f6a3a58aa1 --- /dev/null +++ b/md/train/QYjO70ACDK/QYjO70ACDK.md @@ -0,0 +1,278 @@ +# DISTRIBUTIONAL SLICED-WASSERSTEIN AND APPLICATIONS TO GENERATIVE MODELING + +Khai Nguyen VinAI Research, Vietnam v.khainb@vinai.io + +Nhat $\mathbf { H o } ^ { * }$ University of Texas, Austin VinAI Research, Vietnam minhnhat@utexas.edu + +Tung Pham VinAI Research, Vietnam v.tungph4@vinai.io + +# Hung Bui + +VinAI Research, Vietnam v.hungbh1@vinai.io + +# ABSTRACT + +Sliced-Wasserstein distance (SW) and its variant, Max Sliced-Wasserstein distance (Max-SW), have been used widely in the recent years due to their fast computation and scalability even when the probability measures lie in a very high dimensional space. However, SW requires many unnecessary projection samples to approximate its value while Max-SW only uses the most important projection, which ignores the information of other useful directions. In order to account for these weaknesses, we propose a novel distance, named Distributional Sliced-Wasserstein distance (DSW), that finds an optimal distribution over projections that can balance between exploring distinctive projecting directions and the informativeness of projections themselves. We show that the DSW is a generalization of Max-SW, and it can be computed efficiently by searching for the optimal push-forward measure over a set of probability measures over the unit sphere satisfying certain regularizing constraints that favor distinct directions. Finally, we conduct extensive experiments with large-scale datasets to demonstrate the favorable performances of the proposed distances over the previous sliced-based distances in generative modeling applications. + +# 1 INTRODUCTION + +Optimal transport (OT) is a classical problem in mathematics and operation research. Due to its appealing theoretical properties and flexibility in practical applications, it has recently become an important tool in the machine learning and statistics community; see for example, (Courty et al., 2017; Arjovsky et al., 2017; Tolstikhin et al., 2018; Gulrajani et al., 2017) and references therein. The main usage of OT is to provide a distance named Wasserstein distance, to measure the discrepancy between two probability distributions. However, that distance suffers from expensive computational complexity, which is the main obstacle to using OT in practical applications. + +There have been two main approaches to overcome the high computational complexity problem: either approximate the value of OT or apply the OT adaptively to specific situations. The first approach was initiated by (Cuturi, 2013) using an entropic regularizer to speed up the computation of the OT (Sinkhorn, 1967; Knight, 2008). The entropic regularization approach has demonstrated its usefulness in several application domains (Courty et al., 2014; Genevay et al., 2018; Bunne et al., 2019). Along this direction, several works proposed efficient algorithms for solving the entropic OT (Altschuler et al., 2017; Lin et al., 2019b;a) as well as methods to stabilize these algorithms (Chizat et al., 2018; Peyré & Cuturi, 2019; Chizat et al., 2018; Schmitzer, 2019). However, these algorithms have complexities of the order $\mathcal { O } ( k ^ { 2 } )$ , where $k$ is the number of supports. It is expensive when we need to compute the OT repeatedly, especially in learning the data distribution. + +The second approach, known as "slicing", takes a rather different perspective. It leverages two key ideas: the OT closed-form expression for two distributions in one-dimensional space, and the transformation of a distribution into a set of projected one-dimensional distributions by the Radon transform (RT) (Helgason, 2010). The popular proposal along this direction is Sliced-Wasserstein (SW) distance (Bonneel et al., 2015), which samples the projecting directions uniformly over a unit sphere in the data ambient space and takes the expectation of the resulting one-dimensional OT distance. The SW distance hence requires a significantly lower computation cost than the original Wasserstein distance and is more scalable than the first approach. Due to its solid statistical guarantees and efficient computation, the SW distance has been successfully applied to a variety of practical tasks (Deshpande et al., 2018; Liutkus et al., 2019; Kolouri et al., 2018; Wu et al., 2019; Deshpande et al., 2019) where it has been shown to have comparative performances to other distances and divergences between probability distributions. However, there is an inevitable bottleneck of computing the SW distance. Specifically, the expectation with respect to the uniform distribution of projections in SW is intractable to compute; therefore, the Monte Carlo method is employed to approximate it. Nevertheless, drawing from a uniform distribution of directions in high-dimension can result in an overwhelming number of irrelevant directions, especially when the actual data lies in a low-dimensional manifold. Hence, SW typically needs to have a large number of samples to yield an accurate estimation of the discrepancy. Alternatively, in the other extreme, Max Sliced-Wasserstein (Max-SW) distance (Deshpande et al., 2019) uses only one important direction to distinguish the probability distributions. However, other potentially relevant directions are ignored in Max-SW. Therefore, Max-SW can miss some important differences between the two distributions in high dimension. We note that the linear projections in the Radon transform can be replaced by non-linear projections resulting in the generalized sliced-Wasserstein distance and its variants (Beylkin, 1984; Kolouri et al., 2019). + +Apart from these main directions, there are also few proposals that try either to modify them or to combine the advantages of the above-mentioned approaches. In particular, Paty & Cuturi (2019) extended the idea of the max-sliced distance to the max-subspace distance by considering finding an optimal orthogonal subspace. However, this approach is computationally expensive, since it could not exploit the closed-form of the one-dimensional Wasserstein distance. Another approach named the Projected Wasserstein distance (PWD), which was proposed in (Rowland et al., 2019), uses sliced decomposition to find multiple one-dimension optimal transport maps. Then, it computes the average cost of those maps equally in the original dimension. + +Our contributions. Our paper also follows the slicing approach. However, we address key friction in this general line of work: how to obtain a relatively small number of slices simultaneously to maintain the computational efficiency, but at the same time, cover the major differences between two high-dimensional distributions. We take a probabilistic view of slicing by using a probability measure on the unit sphere to represent how important each direction is. From this viewpoint, SW uses the uniform distribution while Max-SW searches for the best delta-Dirac distribution over the projections, both can be considered as special cases. In this paper, we propose to search for an optimal distribution of important directions. We regularize this distribution such that it prefers directions that are far away from one another, hence encouraging an efficient exploration of the space of directions. In the case of no regularization, our proposed method recovers max-(generalized) SW as a special case. In summary, our main contributions are two-fold: + +1. First, we introduce a novel distance, named Distributional Sliced-Wasserstein distance (DSW), to account for the issues of previous sliced distances. Our main idea is to search for not just a single most important projection, but an optimal distribution over projections that could balance between an expansion of the area around important projections and the informativeness of projections themselves, i.e., how well they can distinguish the two target probability measures. We show that DSW is a proper metric in the probability space and possesses appealing statistical and computational properties as the previous sliced distances. + +2. Second, we apply the DSW distance to generative modeling tasks based on the generative adversarial framework. The extensive experiments on real and large-scale datasets show that DSW distance significantly outperforms the SW and Max-SW distances under similar computational time on these tasks. Furthermore, the DSW distance helps model distribution converge to the data distribution faster and provides more realistic generated images than the SW and Max-SW distances. + +Organization. The remainder of the paper is organized as follows. In Section 2, we provide backgrounds for Wasserstein distance and its slice-based versions. In Section 3, we propose distributional (generalized) sliced-Wasserstein distance and analyze some of its theoretical properties. Section 4 includes extensive experiment results followed by discussions in Section 5. Finally, we defer the proofs of key results and extra materials in the Appendices. + +Notation. For any $\theta , \theta ^ { \prime } \in \mathbb { R } ^ { d }$ , $\begin{array} { r } { \cos ( \theta , \theta ^ { \prime } ) = \frac { \theta ^ { \dagger } \overset { \star } { \theta ^ { \prime } } } { \| \theta \| \| \theta ^ { \prime } \| } } \end{array}$ θ>θ0kθkkθ0k , where k.k is \`2 norm. For any d ≥ 2, Sd−1 denotes the unit sphere in $d$ dimension in $\ell _ { 2 }$ norm . Furthermore, $\delta$ denotes the Dirac delta function, and $\langle \cdot , \cdot \rangle$ is the Euclidean inner-product. For any $p \geq 1$ , $\mathbb { L } ^ { p } ( \mathbb { R } ^ { d } )$ is the set of real-valued functions on $\mathbb { R } ^ { d }$ with finite $p$ -th moment. + +# 2 BACKGROUND + +In this section, we provide necessary backgrounds for the (generalized) Radon transform, the Wasserstein, and sliced-Wasserstein distances. + +# 2.1 WASSERSTEIN DISTANCE + +We start with a formal definition of Wasserstein distance. For any $p \geq 1$ , we define $\mathcal { P } _ { p } ( \mathbb { R } ^ { d } )$ as the set of Borel probability measures with finite $p$ -th moment defined on a given metric space $( \mathbb { R } ^ { d } , \lVert . \rVert )$ For any probability measures $\mu , \nu$ defined on $\boldsymbol { \mathcal { X } } , \boldsymbol { \mathcal { Y } } \subseteq \mathbb { R } ^ { d }$ , we denote their corresponding probability density functions as $I _ { \mu }$ and $I _ { \nu }$ . The Wasserstein distance of order $p$ between $\mu$ and $\nu$ is given by (Villani, 2008; Peyré & Cuturi, 2019): + +$$ +W _ { p } ( \mu , \nu ) : = \Big ( \operatorname* { i n f } _ { \pi \in \Pi ( \mu , \nu ) } \int _ { \mathcal { X } \times \mathcal { Y } } \| x - y \| ^ { p } d \pi ( x , y ) \Big ) ^ { \frac { 1 } { p } } , +$$ + +where $\Pi ( \mu , \nu )$ is a set of all transportation plans $\pi$ such that the marginal distributions of $\pi$ are $\mu$ and $\nu$ , respectively. In order to simplify the presentation, we abuse the notation by using both $W _ { p } ( \mu , \nu )$ and $W _ { p } ( I _ { \mu } , I _ { \nu } )$ interchangeably for the Wasserstein distance between $\mu$ and $\nu$ . When $\mu$ and $\nu$ are one-dimension measures, the Wasserstein distance between $\mu$ and $\nu$ has a closed-form expression $\begin{array} { l } { { W _ { p } ( \mu , \nu ) ~ = ~ ( \int _ { 0 } ^ { 1 } | F _ { \mu } ^ { - 1 } ( z ) - F _ { \nu } ^ { - 1 } ( z ) | ^ { p } d z ) ^ { 1 / p } } } \end{array}$ where $F _ { \mu }$ and $F _ { \nu }$ are the cumulative distribution function (CDF) of $I _ { \mu }$ and $I _ { \nu }$ , respectively. + +# 2.2 (GENERALIZED) RADON TRANSFORMS + +Now, we review (generalized) Radon transform maps, which are key to the notion of (generalized) sliced-Wasserstein distance and its variants. The Radon transform (RT) maps a function $\mathbf { \bar { \chi } } _ { I } \in \mathbb { L } ^ { 1 } ( \mathbb { R } ^ { d } )$ to the space of functions defined over space of lines in $\mathbb { R } ^ { d }$ . In particular, for any $t \in \mathbb { R }$ and direction $\theta \in \mathbb { S } ^ { d - 1 }$ , the RT is defined as follows (Helgason, $\begin{array} { r } { 2 0 1 0 ) : \mathcal { R } \bar { I } ( t , \theta ) : = \int _ { \mathbb { R } ^ { d } } I ( \bar { x } ) \delta ( t - \langle x , \theta \rangle ) d x } \end{array}$ . + +The generalized Radon transform (GRT) (Beylkin, 1984) extends the original one from integration over hyperplanes of $\mathbb { R } ^ { d }$ to integration over hypersurfaces. In particular, it is defined as: $\mathcal { G } I ( t , { \boldsymbol { \theta } } ) : =$ $\textstyle \int _ { \mathbb { R } ^ { d } } I ( { \bar { x } } ) \delta ( { \bar { t } } - g ( x , \theta ) ) d x$ , where $t \in \mathbb R$ and $\theta \in \Omega _ { \theta }$ . Here, $\Omega _ { \theta }$ is a compact subset of $\mathbb { R } ^ { d }$ and $\boldsymbol { g } : \mathbb { R } ^ { d } \times \mathbb { S } ^ { d - 1 } \mapsto \mathbb { R }$ is a defining function (cf. Assumptions H1-H4 in (Kolouri et al., 2019) for the definition of defining function) inducing the hypersurfaces. When $g ( x , \theta ) = \langle x , \theta \rangle$ and $\Omega _ { \theta } = \mathbb { S } ^ { d - 1 }$ , the generalized Radon transform becomes the standard Radon transform. + +# 2.3 (GENERALIZED) SLICED-WASSERSTEIN DISTANCES + +The sliced-Wasserstein distance (SW) between two probability measures $\mu$ and $\nu$ is defined as (Bonneel et al., 2015): $\begin{array} { r } { S W _ { p } ( \mu , \nu ) : = ( \int _ { \mathbb { S } ^ { d - 1 } } W _ { p } ^ { p } \big ( \mathcal { R } I _ { \mu } ( \cdot , \theta ) , \mathcal { R } I _ { \nu } ( \cdot , \theta ) \big ) d \theta ) ^ { 1 / p } } \end{array}$ . Similarly, the generalized sliced-Wasserstein distance (Kolouri et al., 2019) (GSW) is given by $\mathrm { G S W } _ { p } ( \mu , \nu ) : =$ $\begin{array} { r } { ( \int _ { \Omega _ { \theta } } W _ { p } ^ { p } \bigl ( \mathcal { G } I _ { \mu } ( \cdot , \theta ) , \mathcal { G } I _ { \nu } ( \cdot , \theta ) \bigr ) d \theta ) ^ { 1 / p } } \end{array}$ , where $\Omega _ { \theta }$ is the compact set of feasible parameter. However, these integrals are usually intractable. Thus, they are often approximated by using Monte Carlo scheme to draw uniform samples $\{ \theta _ { i } \} _ { i = 1 } ^ { N }$ from $\bar { \mathbb { S } } ^ { d - 1 }$ and $\Omega _ { \theta }$ . In particular, $S W _ { p } ^ { p } ( \mu , \nu ) \approx$ $\begin{array} { r } { \frac { 1 } { N } \sum _ { i = 1 } ^ { N } W _ { p _ { \cdot } } ^ { p } \big ( \mathscr { R } I _ { \mu } ( \cdot , \theta _ { i } ) , \mathscr { R } I _ { \nu } ( \cdot , \theta _ { i } ) \big ) } \end{array}$ and $\begin{array} { r } { \mathbf { G S W } _ { p } ^ { p } ( \mu , \nu ) \approx \frac { 1 } { N } \sum _ { i = 1 } ^ { N } W _ { p } ^ { p } \big ( \mathcal { G } I _ { \mu } ( \cdot , \theta _ { i } ) , \mathcal { G } I _ { \nu } ( \cdot , \theta _ { i } ) \big ) } \end{array}$ . In order to obtain a good approximation of (generalized) SW distances, $N$ needs to be sufficiently large. + +However, important directions are not distributed uniformly over the sphere. Thus, this approach will draw potentially many unimportant projections that are not only expensive but also greatly reduce the effect of the SW distance. + +# 2.4 MAX (GENERALIZED) SLICED-WASSERSTEIN DISTANCES + +An approach to using only informative directions is to simply take the best slice in discriminating two given probability distributions. That distance is max sliced-Wasserstein distance (Max-SW) (Deshpande et al., 2019), which is given by $\begin{array} { r l } & { \operatorname* { m a x } S W _ { p } ( \mu , \nu ) : = \operatorname* { m a x } _ { \theta \in \mathbb { S } ^ { d - 1 } } W _ { p } ( \mathcal { R } I _ { \mu } ( \cdot , \theta ) , \mathcal { R } I _ { \nu } ( \cdot , \theta ) ) } \end{array}$ . By combining this idea with non-linear projections from generalized Radon transform, we obtain max generalized sliced-Wasserstein distance (Max-GSW) (Kolouri et al., 2019). The formal definition of that distance is: $\begin{array} { r } { \operatorname* { m a x } G S W _ { p } ( \mu , \nu ) : = \operatorname* { m a x } _ { \theta \in \Omega _ { \theta } } W _ { p } ( \mathcal { G } I _ { \mu } ( \cdot , \theta ) , \mathcal { G } I _ { \nu } ( \cdot , \theta ) ) } \end{array}$ . The (generalized) MaxSW distances focus on finding only the most important direction. Meanwhile, other informative directions play no role in the distance. Therefore, (generalized) Max-SW distances can ignore useful information about the structure of high dimensional probability measures. + +# 3 DISTRIBUTIONAL SLICED-WASSERSTEIN DISTANCE + +With the aim of improving the limitations of the previous sliced distances, we propose a novel distance, named Distributional Sliced-Wasserstein distance (DSW), that can search for not just a single but a distribution of important directions on the unit sphere. We prove that it is a well-defined metric and discuss its connection to the existing sliced-based distances in Section 3.1. Then, we provide a procedure to approximate DSW based on its dual form in Section 3.2. + +# 3.1 DEFINITION AND METRICITY + +We first start with a definition of distributional sliced-Wasserstein distance. We say $C > 0$ admissible if the set $\mathbb { M } _ { C }$ of probability measures $\sigma$ on $\mathbb { S } ^ { d - 1 }$ satisfying $\begin{array} { r } { \mathbb { E } _ { \boldsymbol { \theta } , \boldsymbol { \theta } ^ { \prime } \sim \sigma } \left[ \vert \boldsymbol { \theta } ^ { \top } \boldsymbol { \theta } ^ { \prime } \vert \right] \le \dot { C } } \end{array}$ is not empty. + +Definition 1. Given two probability measures $\mu$ and $\nu$ on $\mathbb { R } ^ { d }$ with finite $p$ -th moments where $p \geq 1$ and an admissible regularizing constant $C > 0$ . The distributional sliced-Wasserstein distance (DSW) of order $p$ between $\mu$ and $\nu$ is given by: + +$$ +{ D S W } _ { p } ( \mu , \nu ; C ) : = \operatorname* { s u p } _ { \sigma \in \mathbb { M } _ { C } } \bigg ( \mathbb { E } _ { \theta \sim \sigma } \bigg [ W _ { p } ^ { p } ( \mathcal { R } I _ { \mu } ( \cdot , \theta ) , \mathcal { R } I _ { \nu } ( \cdot , \theta ) ) \bigg ] \bigg ) ^ { \frac { 1 } { p } } , +$$ + +where $\mathcal { R }$ is the Radon transform operator. + +The DSW aims to find the optimal probability measure of slices on the unit sphere $\mathbb { S } ^ { d - 1 }$ . Note that, the Max-SW distance is equivalent to searching for the best Dirac measure on a single point in $\mathbb { S } ^ { d - 1 }$ , which puts all weights in only one direction. Meanwhile, the uniform measure in the formulation of SW distance distributes the same weights in all directions. Indeed, the uniform and Dirac measures are two special cases, because they view that either all directions are equally important or only one direction is important. That view is too restricted if the data actually lie on low dimensional space. Thus, we aim to find a probability measure which concentrates only on areas around important directions. Furthermore, we do not want these directions to lie in only one small area, because under the orthogonal projection of RT, their corresponding one-dimensional distributions will become similar. In order to achieve this, we search for an optimal measure $\sigma$ that satisfies the regularization constraint $\begin{array} { r } { \mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma } [ \left| \theta ^ { \top } \theta ^ { ' } \right| ] \leq C } \end{array}$ . By Cauchy-Schwarz inequality, $C$ is no greater than 1, thus $\mathbb { M } _ { 1 }$ contains all probability measures on the unit sphere. Optimizing over $\mathbb { M } _ { 1 }$ simply returns the best Dirac measure corresponding to the Max-SW distance. When $C$ is small, the constraint forces the measure $\sigma$ to distribute more weights to directions that are far from each other (in terms of their angles). Thus, a small appropriate value of $C$ will help to balance between the distinctiveness and informativeness of these targeted directions. For further discussion about $C$ , see Appendix B.1. + +Next, we show that DSW is a well-defined metric on the probability space. + +Theorem 1. For any $p \geq 1$ and admissible $C > 0$ , $D S W _ { p } ( \cdot , \cdot ; C )$ is a well-defined metric in the space of Borel probability measures with finite $p$ -th moment. In particular, it is non-negative, symmetric, identity, and satisfies the triangle inequality. + +The proof of Theorem 1 is in Appendix A.1. Our next result establishes the topological equivalence between DSW distance and (max)-sliced Wasserstein and Wasserstein distances. + +Theorem 2. For any $p \geq 1$ and admissible $C > 0 ;$ , the following holds + +$$ +D S W _ { p } ( \mu , \nu ; C ) \leq m a x S W _ { p } ( \mu , \nu ) \leq W _ { p } ( \mu , \nu ) . +$$ + +(b) If $C \geq 1 / d ,$ , we have $\begin{array} { r } { D S W _ { p } ( \mu , \nu ; C ) \geq \left( \frac { 1 } { d } \right) ^ { 1 / p } m a x { S W _ { p } ( \mu , \nu ) } \geq \left( \frac { 1 } { d } \right) ^ { 1 / p } S W _ { p } ( \mu , \nu ) . } \end{array}$ + +As a consequence, when $p \geq 1$ and $C \geq 1 / d , D S W _ { p } ( \cdot , \cdot ; C ) , \cdot$ $S W _ { p }$ , max $S W _ { p }$ , and $W _ { p }$ are topologically equivalent, namely, the convergence of probability measures under $D \bar { S } W _ { p } ( \cdot , \cdot ; \mathbf { \bar { C } } )$ implies the convergence of these measures under other metrics and vice versa. + +The proof of Theorem 2 is in Appendix A.2. As a consequence of Theorem 2, the statistical error of estimating the unknown distribution based on the empirical distribution of $n$ i.i.d data under DSW distance is $C _ { d } \cdot n ^ { - 1 / 2 }$ with high probability where $C _ { d }$ is some universal constant depending on dimension $d$ (see Appendix B.3). Therefore, as other sliced-based Wasserstein distances, the DSW distance does not suffer from the curse of dimensionality. + +# 3.2 COMPUTATION OF DSW DISTANCE + +Direct computation of DSW distance is challenging. Hence we consider a dual form of DSW distance and a reparametrization of $\sigma$ as follows. + +Definition 2. For any $p \geq 1$ and admissible $C > 0$ , there exists a non-negative constant $\lambda _ { C }$ depending on $C$ such that the dual form of DSW distance takes the following form + +$$ +\begin{array} { r } { { 2 } S W _ { p } ^ { * } ( \mu , \nu ; C ) = \underset { \sigma \in \mathbb { H } } { \operatorname* { s u p } } \left. \left( \mathbb { E } _ { \theta \sim \sigma } \left[ W _ { p } ^ { p } ( \mathcal { R } I _ { \mu } ( \cdot , \theta ) , \mathcal { R } I _ { \nu } ( \cdot , \theta ) ) \right] \right) ^ { \frac { 1 } { p } } - \lambda _ { C } \mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma } \left[ | \theta ^ { \top } \theta ^ { \prime } | \right] \right. + \lambda _ { C } C , } \end{array} +$$ + +where M denotes the space of all probability measures on the unit sphere $\mathbb { S } ^ { d - 1 }$ + +By the Lagrangian duality theory, $\mathrm { D S W } _ { p } ( \mu , \nu ; C ) \geq \mathrm { D S W } _ { p } ^ { * } ( \mu , \nu ; C )$ for any $p \geq 1$ and admissible $C > 0$ . In Definition 2, the set $\mathbb { M } _ { C }$ disappears and $\lambda _ { C }$ plays the tuning role for the regularized term $\mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma } \big [ | \theta ^ { \top } \theta ^ { \prime } | \big ]$ . When $\lambda _ { C }$ is large, $\mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma } ^ { \sim } \big [ | \theta ^ { \top } \theta ^ { \prime } | \big ]$ needs to be small, meaning that $C$ is small. When $\lambda _ { C }$ is small, the value of $\mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma } \big [ | \theta ^ { \top } \theta ^ { \prime } | \big ]$ becomes less important, i.e., $C$ is large. + +For reparametrizing the measure $\sigma$ , we use a pushforward of uniform measure on the unit sphere through some measurable function $f$ . In particular, let $f$ be a Borel measurable function from $\mathbb { S } ^ { d - 1 }$ to ${ \mathbb S } ^ { d - 1 }$ . For any Borel set $A \subset \mathbb { S } ^ { d - \mathrm { \ i } }$ , we define $\sigma ( A ) \stackrel { \circ } { = } \sigma ^ { d - 1 } ( f ^ { - 1 } ( A ) )$ , where $\sigma ^ { d - 1 }$ is the uniform probability measure on $\mathbb { S } ^ { d - 1 }$ . Then for any Borel measurable function $g : { \mathbb { S } } ^ { d - 1 } \mathbb { R }$ , we have $\begin{array} { r } { \int _ { \theta \sim \sigma } g ( \theta ) \dot { d } \sigma ( \theta ) = \int _ { \theta \sim \sigma ^ { d - 1 } } ( g \circ f ) ( \theta ) d \sigma ^ { d - \bar { 1 } } ( \theta ) } \end{array}$ . Therefore, we obtain the equivalent dual form of DSW as follows: + +$$ +\begin{array} { r l } & { \mathrm { D S W } _ { p } ^ { * } ( \mu , \nu ; C ) = \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \Bigg \{ \Bigg ( \mathbb { E } _ { \theta \sim \sigma ^ { d - 1 } } \big [ W _ { p } ^ { p } \big ( \mathcal { R } I _ { \mu } ( \cdot , f ( \theta ) ) , \mathcal { R } I _ { \nu } ( \cdot , f ( \theta ) ) \big ) \big ] \Bigg ) ^ { 1 / p } } \\ & { \qquad - \lambda _ { C } \mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma ^ { d - 1 } } \Big [ \big | f ( \theta ) ^ { \top } f ( \theta ^ { \prime } ) \big | \Big ] \Bigg \} + \lambda _ { C } C : = \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \mathrm { D S } ( f ) , } \end{array} +$$ + +where $\mathcal { F }$ is a class of all Borel measurable functions from $\mathbb { S } ^ { d - 1 }$ to $\mathbb { S } ^ { d - 1 }$ . + +Finding the optimal $f$ : We parameterize $f$ in the dual form (2) by using a deep neural network with parameter $\phi$ , defined as $f _ { \phi }$ . Then, we estimate the gradient of the objective function $\mathrm { D S } ( f _ { \phi } )$ in equation (2) with respect to $\phi$ and use stochastic gradient ascent algorithm to update $\phi$ . Since there are expectations over uniform distribution in the gradient of $\mathrm { D S } ( f _ { \phi } )$ , we use the Monte Carlo method to approximate these expectations. Note that, we can use the fixed point from the stochastic ascent algorithm to approximate the dual value of DSW in equation (2). A detailed argument for this point is in Appendix B.2. Finally, in generative model applications with DSW being the loss function, we only need to use the gradient of the function $\mathrm { D S } ( . )$ to update the parameters of interest. Therefore, we can treat $\lambda _ { C }$ as a regularized parameter and tune it to find suitable value in these applications. + +![](images/e1cac424355623855569b7071b820cc80a55f82017ef08e0ff626e2af202f5c0.jpg) +Figure 1: Empirical behavior of optimal measure $\sigma$ , approximated by 1000 samples, on a circle for different values of $\lambda _ { C }$ (the constant in the dual form of DSW in Definition 2) when $\mu$ and $\nu$ are bivariate Gaussian distributions sharing the same eigenvectors. When $\lambda _ { C } = 0$ , $C = 1$ . When $\lambda _ { C }$ increases, $C$ becomes small. + +Illustration of the roles of $\lambda _ { C }$ and $C$ : To illustrate the roles of $\lambda _ { C }$ and $C$ in finding optimal distribution $\sigma$ , we conduct a simple experiment on two Gaussian distributions with zero means and covariance matrices given by $\left( \begin{array} { l l } { 2 } & { 0 } \\ { 0 } & { 2 } \end{array} \right)$ and $\left( \begin{array} { l l } { 5 } & { 0 } \\ { 0 } & { 1 } \end{array} \right)$ . The experiment optimizes the empirical form of Definition 2 with different choices of $\lambda _ { C }$ . The results are shown in Figure 1 with the reported value of $\lambda _ { C }$ and $\mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma } \big [ | \theta ^ { \top } \theta ^ { \prime } | \big ]$ . For $\lambda _ { C } = 0$ , the obtained distribution concentrates only on one direction. When $\lambda _ { C } = 5 0$ , optimal $\sigma$ distributes more weights to other directions on the circle. When $\lambda _ { C } = 1 0 0 0$ , optimal $\sigma$ is close to the discrete distribution concentrated on two eigenvectors of the covariance matrices, which are the main directions differentiating the two Gaussian distributions. + +Extension of DSW and comparison of DSW to Max-GSW-NN: Similar to SW, we extend DSW to distributional generalized sliced Wasserstein (DGSW) by using the non-linear projecting operator via GRT. The definition of the DGSW and its properties are in Appendix C. Finally, in Appendix E.1, we show the distinction of the DSW to Max-GSW-NN (Kolouri et al., 2019) when the neural network defining function in Max-GSW-NN is $g ( x , \theta ) = \langle x , f ( \theta ) \rangle$ where $f : \mathbb { S } ^ { d - 1 } \to \mathbb { S } ^ { d - 1 }$ . + +# 4 EXPERIMENTS + +In this section, we conduct extensive experiments comparing the performance in both generative quality and computational speed of the proposed DSW distance with other sliced-based distances, namely the SW, Max-SW, Max-GSW-NN (Kolouri et al., 2019) and projected robust subspace Wasserstein (PRW) (Paty & Cuturi, 2019; Lin et al., 2020) using the minimum expected distance estimator (MEDE) (Bernton et al., 2019) on MNIST (LeCun et al., 1998), CIFAR10 (Krizhevsky, 2009), CelebA (Liu et al., 2015) and LSUN (Yu et al., 2015) datasets. The details of the MEDE framework are described in Appendix D. We would like to note that the wall-clock timing of different methods may be subject to the differences in the hyperparameter settings and software implementations of different methods. On MNIST dataset, we train generative models with different distances and then evaluate their performances by comparing Wasserstein-2 distances between 10000 random generated images and all images from the MNIST test set. Due to the very large size of other datasets, e.g., 3 million images in LSUN, it is expensive to compute empirical Wasserstein-2 distance as its complexity is of order ${ \mathcal { O } } ( k ^ { 2 } \log k )$ where $k$ is the number of support points. Therefore, after we train generative models, we use FID score (Heusel et al., 2017) to evaluate the generative quality of these generators. The FID score is calculated from 10000 random generated images and all training samples using precomputed statistics in (Heusel et al., 2017). Finally, for $\lambda _ { C }$ in DSW (see Definition 2), it is chosen in the set $\{ 1 , 1 0 , 1 0 0 , 1 0 0 0 \}$ such that its Wasserstein-2 (FID score) (between 10000 random generated images and all images from corresponding validation set) is the lowest among the four values. Detailed experiment settings are in Appendix G. Finally, we also apply the DSW into color transfer task (Rabin et al., 2010; 2014; Bonneel et al., 2015; Perrot et al., 2016) in Appendix F, where we find that DSW also performs better than SW and Max-SW in this task. + +# 4.1 RESULTS ON MNIST + +Generative quality and computational speed: We report the performance of the learned generative models for MNIST in Figure 2(a). To plot this figure, we vary the number of projections $N \in$ $\{ 1 , 1 0 , 1 0 ^ { 2 } , 5 \times 1 0 ^ { 2 } , 1 0 ^ { 3 } , 5 \times 1 0 ^ { 3 } , 1 0 ^ { 4 } \}$ for the SW, and $N \in \{ 1 , 1 0 , 1 0 ^ { 2 } , 5 \times 1 0 ^ { 2 } , 1 0 ^ { 3 } , 5 \times 1 0 ^ { 3 } \}$ for the DSW. Then we measure the computational time per minibatch and the Wasserstein-2 score of the learned generators for each $N$ . We plot the Wasserstein-2 score and computational time of Max-SW and Max-GSW-NN in their standard settings (Kolouri et al., 2019). Except for the regime with very fast but low-quality learned models, DSW is better than all the existing slice-based baselines in terms of both model quality and computational speed. Moreover, DSW can learn good models with very few projections, e.g., DSW-10 achieves better model quality than Max-GSW-NN and Max-SW and is one order-of-magnitude faster than these sliced distances. Finally, with a similar computational time, a learned generator by DSW has the Wasserstein-2 score that is roughly $1 0 \%$ lower than the one got from SW. For the qualitative comparison between these distances, we show random generated images from their generative models in Figure 7 in Appendix E.1. We observe that generated images from DSW are sharper and easier to classify into numbers than those from other baseline distances. + +![](images/05313ea7c1db89d713694264a662043e8a53b0f9cae59afe10da003d67a7180a.jpg) +Figure 2: (a) Comparison between DSW, SW, Max-SW, Max-GSW-NN, PRW and WD based on execution time and performance. Here, each dot of SW and DSW corresponds to the number of projections chosen in $\{ 1 , 1 0 , 1 0 ^ { \cdot 2 } , 5 \times 1 0 ^ { 2 } , 1 0 ^ { 3 } , 5 \times 1 0 ^ { 3 } , 1 0 ^ { 4 } \}$ . Each dot of PRW corresponds to the dimension of the subspace chosen in $\{ 2 , 5 , 1 0 , 5 0 \}$ ; (b) Comparison between SW, DSW, Max-SW and Max-GSW-NN based on Wasserstein-2 distance between distributions of learned model and test set over iterations; (c) Computation speed of distances based on the number of minibatch’s samples (log-log scale); (d) Effect of $\lambda _ { C }$ on the mean of absolute values of pairwise cosine similarity between 10 random directions from the found distribution $\sigma$ of DSW. + +Comparison with projected robust subspace Wasserstein (PRW) and Wasserstein distance: In Figure 2(a), we plot the Wasserstein-2 score and computational time of Wasserstein distance (WD) and PRW, where the subspace dimension of PRW varies in the range $\{ 2 , 5 , 1 0 , 5 0 \}$ . PRW is able to improve upon the model quality of slice-based methods including DSW, however at the cost of being an order of magnitude slower than DSW with 10 projections (DSW-10). We observe that DSW-10 obtains a better Wasserstein-2 score than PRW with 5-dimensional subspace, while its corresponding computational time is 30 times faster than that of PRW-5. Using 50 dimension, PRW’s Wasserstein-2 score improves about $2 9 \%$ to that of DSW-10 but the computational cost is also around 40 times slower. The model trained by WD gives good Wasserstein-2 score; however, it is computational expensive (about 40 times slower than DSW-10). The main computational advantage of DSW comes from the exact calculation of Wasserstein distance in one-dimension. The visual comparison between PRW, WD and DSW based on their generated images is in Figure 12 in Appendix E.2. + +Convergence behavior: Figure 2(b) shows that DSW learns better models at a faster speed of convergence than other baseline distances with a very small number of projections, e.g., DSW-10 is the second lowest curve compared to curves from other sliced-based distances. + +Scalability over sample size of minibatch: Results in Figure 2(c) show that DSW has a computational complexity of the order ${ \mathcal { O } } ( k \log k )$ , which is similar to those of other sliced-based distances, where $k$ is the number of samples per batch. + +Effect of the reguloptimal distribution ization paraof DSW with $\lambda _ { C }$ : For each value of projections, and the $\lambda _ { C } \in \{ 1 , 1 0 , 1 0 0 , 1 0 0 0 \}$ $\sigma$ $N = 1 0$ $\begin{array} { r } { A _ { N } = \frac { 1 } { N ^ { 2 } } \sum _ { i , j = 1 } ^ { N } | \boldsymbol { \theta } _ { i } ^ { \top } \boldsymbol { \theta } _ { j } | } \end{array}$ an approximation of the regularized term $\mathbb { E } _ { \theta , \theta ^ { \prime } \sim \sigma } \left[ \left| \theta ^ { \top } \theta ^ { \prime } \right| \right]$ in the dual form of DSW in equation (2), where $\{ \theta _ { i } \} _ { i = 1 } ^ { N } \sim \sigma$ . The results are shown in Figure 2(d). We observe that when $\lambda _ { C }$ increases, $A _ { N }$ goes down. When $\lambda _ { C } = 0$ , i.e., no regularization, $A _ { N }$ gets close to 1, meaning that all projected directions collapse to one direction. When $\lambda _ { C } = 1 0 0 0$ , $A _ { N }$ is close to 0.1, suggesting that all projected directions are nearly orthogonal. + +![](images/2f0215c39c5f57dc4c0277750b8548580cc04641cc662db46352e1c8edb4a65c.jpg) +Figure 3: Comparison between DSW, SW, Max-SW and Max-GSW-NN in terms of execution time and performance. Here, each dot of SW and DSW corresponds to the number of projections chosen in $\{ 1 0 ^ { 2 } , 5 \times$ $\mathrm { \dot { 1 } 0 ^ { 2 } , 1 0 ^ { 3 } , 5 \times 1 0 ^ { 3 } , 1 0 ^ { 4 } } \}$ . We set the minibatch size be 512 on CelebA and CIFAR, and be 4096 on LSUN. + +Additional experiments: We also investigate how the number of gradient-steps used for updating distribution of directions $\sigma$ , and how the size of minibatches affects the quality of DSW (see Appendix E.1). The results show that an increasing number of gradient steps to update $\sigma$ leads to better performance of DSW but also slows down the computation speed. Furthermore, we carry out experiments with DGSW, an extension of DSW to non-linear projections, and test the new proposed distances in training encoder-generator models on MNIST using joint contrastive inference (JCI) in Appendices E.1 and E.3. The description of these models is in Appendix D. + +# 4.2 RESULTS ON LARGE-SCALE DATASETS + +Next, we conduct large-scale experiments on a range of more realistic image datasets. We train generative models using CIFAR10, CelebA, and LSUN datasets (all these datasets are rescaled to $6 4 \mathrm { x } 6 4$ resolution). When working with high dimensional distributions, Deshpande et al. (2018) proposed a trick to improve the quality of the generator by learning a feature function which maps data to a new feature space that is more manageable in size. When the feature function is fixed, the generator is trained to match the distribution of features. When the generator is fixed, the feature function tries to tease apart the data empirical features from the generated feature distribution. For the experiments in this section, we use the same technique with DSW and all other baseline distances. + +We compare DSW with SW, Max-SW, and Max-GSW-NN in both generative quality (FID score) and computational time in Figure 3. We could not compare DSW with PRW on the large-scale datasets since PRW is computationally expensive to train to obtain good generated images. On CelebA and CIFAR10, we let $N$ , the number of projections of both DSW and SW, vary in the set $\{ 1 0 ^ { 2 } , 5 \times 1 0 ^ { 2 } , 1 0 ^ { 3 } , 5 \times 1 0 ^ { 3 } , 1 0 ^ { 4 } \}$ . For LSUN, since it takes considerably longer time to train each model, we only vary $N$ in the set $\{ 1 0 ^ { 2 } , 1 0 ^ { 4 } \}$ . On all these large datasets, DSW outperforms all the other baselines in both FID score of the learned model and computational efficiency. The gap of FID scores between DSW and other methods is especially large on CIFAR10 and LSUN. For example, on CIFAR10, with the same computational time, FID scores of DSW are always lower than those of SW about 20 units. On LSUN, with 100 projections, DSW can achieve an FID score of 46 while SW with 10000 projections still has a worse FID score of over 60. It is interesting to note that on these high-dimensional datasets, Max-SW performs rather poorly: it obtains the highest FID scores among all distances while requires heavy computation. Max-GSW-NN has better FID scores than (Max)-SW; however, it is still worse than DSW and while being slower. This is consistent with the intuition that as the number of dimension of the data grows, the use of a single important slice in Max-SW becomes a less efficient approximation. DSW, on the other hand, is able to make use of more important slices, and at the same time avoids SW’s inefficiency of uniform slice-sampling. + +Generated images from CelebA, CIFAR10 and LSUN are deferred to Appendix E.1. Comparing to other sliced-based Wasserstein distances, generated samples obtained from the DSW’s generative model are also more visually realistic. Further experiments to compare DGSW with GSW, Max-GSW, and Max-GSW-NN are also given in the Appendix E.1. Based on these experiments, we can conclude that the distributional approach also improves the generative quality of non-linear slicing distances. + +# 5 CONCLUSION + +In this paper, we have presented the novel distributional sliced-Wasserstein (DSW) distances between two probability measures. Our main idea is to search for the best distribution of important directions while regularizing towards orthogonal directions. We prove that they are well-defined metrics and provide their theoretical and computational properties. We compare our proposed distances to other sliced-based distances in a variety of generative modeling tasks, including estimating generative models and jointly estimating both generators and inference models. Extensive experiments demonstrate that our new distances yield significantly better models and convergence behaviors during training than the previous sliced-based distances. One important future direction is to investigate theoretically the optimal choice of the regularization parameter $\lambda _ { C }$ such that the DSW distance can capture all the important directions that can distinguish two target probability measures well. + +# REFERENCES + +Jason Altschuler, Jonathan Niles-Weed, and Philippe Rigollet. Near-linear time approximation algorithms for optimal transport via Sinkhorn iteration. In Advances in neural information processing systems, pp. 1964–1974, 2017. + +Luca Ambrogioni, Umut Güçlü, Yagmur Güçlütürk, Max Hinne, Marcel AJ van Gerven, and Eric ˘ Maris. Wasserstein variational inference. In Advances in Neural Information Processing Systems, pp. 2473–2482, 2018. + +Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International Conference on Machine Learning, pp. 214–223, 2017. + +Erhan Bayraktar and Gaoyue Guo. Strong equivalence between metrics of Wasserstein type. arXiv preprint arXiv:1912.08247, 2019. + +Espen Bernton, Pierre E Jacob, Mathieu Gerber, and Christian P Robert. On parameter estimation with the Wasserstein distance. Information and Inference: A Journal of the IMA, 8(4):657–676, 2019. + +Gregory Beylkin. The inversion problem and applications of the generalized Radon transform. Communications on pure and applied mathematics, 37(5):579–599, 1984. + +Nicolas Bonneel and David Coeurjolly. Spot: sliced partial optimal transport. ACM Transactions on Graphics (TOG), 38(4):1–13, 2019. + +Nicolas Bonneel, Julien Rabin, Gabriel Peyré, and Hanspeter Pfister. Sliced and Radon Wasserstein barycenters of measures. Journal of Mathematical Imaging and Vision, 1(51):22–45, 2015. + +Nicolas Bonnotte. Unidimensional and evolution methods for optimal transportation. PhD thesis, Paris 11, 2013. + +Charlotte Bunne, David Alvarez-Melis, Andreas Krause, and Stefanie Jegelka. Learning generative models across incomparable spaces. In International Conference on Machine Learning, 2019. + +Xiongjie Chen, Yongxin Yang, and Yunpeng Li. Augmented sliced Wasserstein distances. arXiv preprint arXiv:2006.08812, 2020. + +Lenaic Chizat, Gabriel Peyré, Bernhard Schmitzer, and François-Xavier Vialard. Scaling algorithms for unbalanced optimal transport problems. Mathematics of Computation, 87(314):2563–2609, 2018. + +Nicolas Courty, Rémi Flamary, and Devis Tuia. Domain adaptation with regularized optimal transport. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 274–289. Springer, 2014. + +Nicolas Courty, Rémi Flamary, Amaury Habrard, and Alain Rakotomamonjy. Joint distribution optimal transportation for domain adaptation. In Advances in Neural Information Processing Systems, pp. 3730–3739, 2017. + +Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in neural information processing systems, pp. 2292–2300, 2013. + +Ishan Deshpande, Ziyu Zhang, and Alexander G Schwing. Generative modeling using the sliced Wasserstein distance. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3483–3491, 2018. + +Ishan Deshpande, Yuan-Ting Hu, Ruoyu Sun, Ayis Pyrros, Nasir Siddiqui, Sanmi Koyejo, Zhizhen Zhao, David Forsyth, and Alexander G Schwing. Max-sliced Wasserstein distance and its use for GANs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 10648–10656, 2019. + +Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Olivier Mastropietro, Alex Lamb, Martin Arjovsky, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016. + +R’emi Flamary and Nicolas Courty. Pot python optimal transport library, 2017. URL https: //pythonot.github.io/. + +Aude Genevay, Gabriel Peyre, and Marco Cuturi. Learning generative models with Sinkhorn divergences. In International Conference on Artificial Intelligence and Statistics, pp. 1608–1617, 2018. + +Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of Wasserstein Gans. In Advances in neural information processing systems, pp. 5767–5777, 2017. + +Sigurdur Helgason. Integral geometry and Radon transforms. Springer Science & Business Media, 2010. + +Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems, pp. 6626–6637, 2017. + +Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational Bayes. arXiv preprint arXiv:1312.6114, 2013. + +Philip A Knight. The Sinkhorn–Knopp algorithm: convergence and applications. SIAM Journal on Matrix Analysis and Applications, 30(1):261–275, 2008. + +Max Kochurov, Rasul Karimov, and Serge Kozlukov. Geoopt: Riemannian optimization in pytorch, 2020. + +Soheil Kolouri, Phillip E Pope, Charles E Martin, and Gustavo K Rohde. Sliced Wasserstein auto-encoders. In International Conference on Learning Representations, 2018. + +Soheil Kolouri, Kimia Nadjahi, Umut Simsekli, Roland Badeau, and Gustavo Rohde. Generalized sliced Wasserstein distances. In Advances in Neural Information Processing Systems, pp. 261–272, 2019. + +Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009. + +Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. + +Bing Li, Shaoli Wang, et al. On directional regression for dimension reduction. Journal of the American Statistical Association, 102:997–1008, 2007. + +Ker-Chau Li. Sliced inverse regression for dimension reduction. Journal of the American Statistical Association, 86(414):316–328, 1991. + +Tianyi Lin, Nhat Ho, and Michael Jordan. On efficient optimal transport: An analysis of greedy and accelerated mirror descent algorithms. In International Conference on Machine Learning, pp. 3982–3991, 2019a. + +Tianyi Lin, Nhat Ho, and Michael I Jordan. On the acceleration of the Sinkhorn and Greenkhorn algorithms for optimal transport. arXiv preprint arXiv:1906.01437, 2019b. + +Tianyi Lin, Chenyou Fan, Nhat Ho, Marco Cuturi, and Michael I. Jordan. Projection robust Wasserstein distance and Riemannian optimization. arXiv preprint arXiv:2006.07458, 2020. + +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. + +Antoine Liutkus, Umut Simsekli, Szymon Majewski, Alain Durmus, and Fabian-Robert Stöter. Sliced-Wasserstein flows: Nonparametric generative modeling via optimal transport and diffusions. In International Conference on Machine Learning, pp. 4104–4113, 2019. + +Cheng Meng, Yuan Ke, Jingyi Zhang, Mengrui Zhang, Wenxuan Zhong, and Ping Ma. Large-scale optimal transport map estimation using projection pursuit. In Advances in Neural Information Processing Systems, pp. 8118–8129, 2019. + +Boris Muzellec and Marco Cuturi. Subspace detours: Building transport plans that are optimal on subspace projections. In Advances in Neural Information Processing Systems, pp. 6917–6928, 2019. + +Kimia Nadjahi, Alain Durmus, Umut Simsekli, and Roland Badeau. Asymptotic guarantees for learning generative models with the sliced-Wasserstein distance. In Advances in Neural Information Processing Systems, pp. 250–260, 2019. + +François-Pierre Paty and Marco Cuturi. Subspace robust Wasserstein distances. In International Conference on Machine Learning, pp. 5072–5081, 2019. + +Michaël Perrot, Nicolas Courty, Rémi Flamary, and Amaury Habrard. Mapping estimation for discrete optimal transport. Advances in Neural Information Processing Systems, 29:4197–4205, 2016. + +Gabriel Peyré and Marco Cuturi. Computational optimal transport. Foundations and Trends® in Machine Learning, 11(5-6):355–607, 2019. + +Julien Rabin, Julie Delon, and Yann Gousseau. Regularization of transportation maps for color and contrast transfer. In 2010 IEEE International Conference on Image Processing, pp. 1933–1936. IEEE, 2010. + +Julien Rabin, Sira Ferradans, and Nicolas Papadakis. Adaptive color transfer with relaxed optimal transport. In 2014 IEEE International Conference on Image Processing (ICIP), pp. 4852–4856. IEEE, 2014. + +Erik Reinhard, Michael Adhikhmin, Bruce Gooch, and Peter Shirley. Color transfer between images. IEEE Computer graphics and applications, 21(5):34–41, 2001. + +Mark Rowland, Jiri Hron, Yunhao Tang, Krzysztof Choromanski, Tamas Sarlos, and Adrian Weller. Orthogonal estimation of Wasserstein distances. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 186–195, 2019. + +Bernhard Schmitzer. Stabilized sparse scaling algorithms for entropy regularized transport problems. SIAM Journal on Scientific Computing, 41(3):A1443–A1481, 2019. + +Richard Sinkhorn. Diagonal equivalence to matrices with prescribed row and column sums. The American Mathematical Monthly, 74(4):402–405, 1967. + +Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein auto-encoders. In International Conference on Learning Representations, 2018. + +Cédric Villani. Optimal transport: Old and New. Springer, 2008. + +Martin J Wainwright. High-dimensional statistics: A non-asymptotic viewpoint. Cambridge University Press, 2019. + +Jiqing Wu, Zhiwu Huang, Dinesh Acharya, Wen Li, Janine Thoma, Danda Pani Paudel, and Luc Van Gool. Sliced Wasserstein generative models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3713–3722, 2019. + +Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Lsun: Construction of a largescale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015. \ No newline at end of file diff --git a/md/train/QkRbdiiEjM/QkRbdiiEjM.md b/md/train/QkRbdiiEjM/QkRbdiiEjM.md new file mode 100644 index 0000000000000000000000000000000000000000..e6be730c9d7b64266fed9edfde0a794d9464ca01 --- /dev/null +++ b/md/train/QkRbdiiEjM/QkRbdiiEjM.md @@ -0,0 +1,416 @@ +# ADAGCN: ADABOOSTING GRAPH CONVOLUTIONAL NETWORKS INTO DEEP MODELS + +Ke Sun +Zhejiang Lab +Key Lab. of Machine Perception (MoE), School of EECS, Peking University +ajksunke@pku.edu.cn + +Zhanxing Zhu\* Beijing Institute of Big Data Research, Beijing, China zhanxing.zhu@pku.edu.cn + +Zhouchen Lin∗ +Key Lab. of Machine Perception (MoE), School of EECS, Peking University +Pazhou Lab, Guangzhou, China +zlin@pku.edu.cn + +# ABSTRACT + +The design of deep graph models still remains to be investigated and the crucial part is how to explore and exploit the knowledge from different hops of neighbors in an efficient way. In this paper, we propose a novel RNN-like deep graph neural network architecture by incorporating AdaBoost into the computation of network; and the proposed graph convolutional network called AdaGCN (Adaboosting Graph Convolutional Network) has the ability to efficiently extract knowledge from high-order neighbors of current nodes and then integrates knowledge from different hops of neighbors into the network in an Adaboost way. Different from other graph neural networks that directly stack many graph convolution layers, AdaGCN shares the same base neural network architecture among all “layers” and is recursively optimized, which is similar to an RNN. Besides, We also theoretically established the connection between AdaGCN and existing graph convolutional methods, presenting the benefits of our proposal. Finally, extensive experiments demonstrate the consistent state-of-the-art prediction performance on graphs across different label rates and the computational advantage of our approach AdaGCN 1. + +# 1 INTRODUCTION + +Recently, research related to learning on graph structural data has gained considerable attention in machine learning community. Graph neural networks (Gori et al., 2005; Hamilton et al., 2017; Velickovi ˇ c et al., 2018), particularly graph convolutional networks (Kipf & Welling, 2017; Deffer- ´ rard et al., 2016; Bruna et al., 2014) have demonstrated their remarkable ability on node classification (Kipf & Welling, 2017), link prediction (Zhu et al., 2016) and clustering tasks (Fortunato, 2010). Despite their enormous success, almost all of these models have shallow model architectures with only two or three layers. The shallow design of GCN appears counterintuitive as deep versions of these models, in principle, have access to more information, but perform worse. Oversmoothing (Li et al., 2018) has been proposed to explain why deep GCN fails, showing that by repeatedly applying Laplacian smoothing, GCN may mix the node features from different clusters and makes them indistinguishable. This also indicates that by stacking too many graph convolutional layers, the embedding of each node in GCN is inclined to converge to certain value (Li et al., 2018), making it harder for classification. These shallow model architectures restricted by oversmoothing issue limit their ability to extract the knowledge from high-order neighbors, i.e., features from remote hops of neighbors for current nodes. Therefore, it is crucial to design deep graph models such that high-order information can be aggregated in an effective way for better predictions. + +There are some works (Xu et al., 2018b; Liao et al., 2019; Klicpera et al., 2018; Li et al., 2019; Liu et al., 2020) that tried to address this issue partially, and the discussion can refer to Appendix A.1. By contrast, we argue that a key direction of constructing deep graph models lies in the efficient exploration and effective combination of information from different orders of neighbors. Due to the apparent sequential relationship between different orders of neighbors, it is a natural choice to incorporate boosting algorithm into the design of deep graph models. As an important realization of boosting theory, AdaBoost (Freund et al., 1999) is extremely easy to implement and keeps competitive in terms of both practical performance and computational cost (Hastie et al., 2009). Moreover, boosting theory has been used to analyze the success of ResNets in computer vision (Huang et al., 2018) and AdaGAN (Tolstikhin et al., 2017) has already successfully incorporated boosting algorithm into the training of GAN (Goodfellow et al., 2014). + +In this work, we focus on incorporating AdaBoost into the design of deep graph convolutional networks in a non-trivial way. Firstly, in pursuit of the introduction of AdaBoost framework, we refine the type of graph convolutions and thus obtain a novel RNN-like GCN architecture called AdaGCN. Our approach can efficiently extract knowledge from different orders of neighbors and then combine these information in an AdaBoost manner with iterative updating of the node weights. Also, we compare our AdaGCN with existing methods from the perspective of both architectural difference and feature representation power to show the benefits of our method. Finally, we conduct extensive experiments to demonstrate the consistent state-of-the-art performance of our approach across different label rates and computational advantage over other alternatives. + +# 2 OUR APPROACH: ADAGCN + +# 2.1 ESTABLISHMENT OF ADAGCN + +Consider an undirected graph $\mathcal { G } = ( \nu , \mathcal { E } )$ with $N$ nodes $v _ { i } \in \mathcal V$ , edges $( v _ { i } , v _ { j } ) \in \mathcal { E }$ . $A \in \mathbb { R } ^ { N \times N }$ is the adjacency matrix with corresponding degree matrix $\begin{array} { r } { D _ { i i } = \sum _ { j } \dot { A } _ { i j } } \end{array}$ . In the vanilla GCN model (Kipf & Welling, 2017) for semi-supervised node classification, the graph embedding of nodes with two convolutional layers is formulated as: + +$$ +Z = \hat { A } \mathrm { R e L U } ( \hat { A } X W ^ { ( 0 ) } ) W ^ { ( 1 ) } +$$ + +where $Z \in \mathbb { R } ^ { N \times K }$ is the final embedding matrix (output logits) of nodes before softmax and $K$ is the number of classes. $X \in \mathbb { R } ^ { N \times C }$ denotes the feature matrix where $C$ is the input dimension. $\hat { A } = \tilde { D } ^ { - \frac { 1 } { 2 } } \tilde { A } \tilde { D } ^ { - \frac { 1 } { 2 } }$ where ${ \tilde { A } } = A + I$ and $\tilde { D }$ is the degree matrix of $\tilde { A }$ . In addition, $W ^ { ( 0 ) } \in \mathbb { R } ^ { C \times H }$ is the input-to-hidden weight matrix for a hidden layer with $H$ feature maps and $W ^ { ( 1 ) } \in \mathbb { R } ^ { H \times K }$ is the hidden-to-output weight matrix. + +Our key motivation of constructing deep graph models is to efficiently explore information of highorder neighbors and then combine these messages from different orders of neighbors in an AdaBoost way. Nevertheless, if we naively extract information from high-order neighbors based on GCN, we are faced with stacking $l$ layers’ parameter matrix $W ^ { ( i ) } , i = 0 , . . . , l - 1$ , which is definitely costly in computation. Besides, Multi-Scale Deep Graph Convolutional Networks (Luan et al., 2019) also theoretically demonstrated that the output can only contain the stationary information of graph structure and loses all the local information in nodes for being smoothed if we simply deepen GCN. Intuitively, the desirable representation of node features does not necessarily need too many nonlinear transformation $f$ applied on them. This is simply due to the fact that the feature of each node is normally one-dimensional sparse vector rather than multi-dimensional data structures, e.g., images, that intuitively need deep convolution network to extract high-level representation for vision tasks. This insight has been empirically demonstrated in many recent works (Wu et al., 2019; Klicpera et al., 2018; Xu et al., 2018a), showing that a two-layer fully-connected neural networks is a better choice in the implementation. Similarly, our AdaGCN also follows this direction by choosing an appropriate $f$ in each layer rather than directly deepen GCN layers. + +Thus, we propose to remove ReLU to avoid the expensive joint optimization of multiple parameter matrices. Similarly, Simplified Graph Convolution (SGC) (Wu et al., 2019) also adopted this practice, arguing that nonlinearity between GCN layers is not crucial and the majority of the benefits arises from local weighting of neighboring features. Then the simplified graph convolution is: + +![](images/1a73cdd96f289c3170574f4224643074e89e71dc26fb8af0e704be928232997c.jpg) +Figure 1: The RNN-like architecture of AdaGCN with each base classifier $f _ { \theta } ^ { ( l ) }$ sharing the same neural network architecture $f _ { \theta }$ . $w ^ { l }$ and $\theta _ { l }$ denote node weights and parameters computed after the $l$ -th base classifier, respectively. + +$$ +Z = \hat { A } ^ { l } X W ^ { ( 0 ) } W ^ { ( 1 ) } \cdots W ^ { ( l - 1 ) } = \hat { A } ^ { l } X \tilde { W } , +$$ + +where we collapse $W ^ { ( 0 ) } W ^ { ( 1 ) } \cdot \cdot \cdot W ^ { ( l - 1 ) }$ as $\tilde { W }$ and $\hat { A } ^ { l }$ denotes $\hat { A }$ to the $l$ -th power. In particular, one crucial impact of ReLU in GCN is to accelerate the convergence of matrix multiplication since the ReLU is a contraction mapping intuitively. Thus, the removal of ReLU operation could also alleviate the oversmoothing issue, i.e. slowering the convergence of node embedding to indistinguishable ones (Li et al., 2018). Additionally, without ReLU this simplified graph convolution is also able to avoid the aforementioned joint optimization over multiple parameter matrices, resulting in computational benefits. Nevertheless, we find that this type of stacked linear transformation from graph convolution has insufficient power in representing information of high-order neighbors, which is revealed in our experiment described in Appendix A.2. Therefore, we propose to utilize an appropriate nonlinear function $f _ { \theta }$ , e.g., a two-layer fully-connected neural network, to replace the linear transformation $\tilde { W }$ in Eq. 2 and enhance the representation ability of each base classifier in AdaGCN as follows: + +$$ +Z ^ { ( l ) } = f _ { \theta } ( \hat { A } ^ { l } X ) , +$$ + +where $Z ^ { ( l ) }$ represents the final embedding matrix (output logits before Softmax) after the $l$ -th base classifier in AdaGCN. This formulation also implies that the $l$ -th base classifier in AdaGCN is extracting knowledge from features of current nodes and their $l$ -th hop of neighbors. Due to the fact that the function of $l$ -th base classifier in AdaGCN is similar to that of the $l$ -th layer in other traditional GCN-based methods that directly stack many graph convolutional layers, we regard the whole part of l-th base classifier as the $l$ -th layers in AdaGCN. As for the realization of Multi-class AdaBoost, we apply SAMME (Stagewise Additive Modeling using a Multi-class Exponential loss function) algorithm (Hastie et al., 2009), a natural and clean multi-class extension of the two-class AdaBoost adaptively combining weak classifiers. + +As illustrated in Figure 1, we apply base classifie r f (l) to extract knowledge from current node feature and $l$ -th hop of neighbors by minimizing current weighted loss. Then we directly compute the weighted error rate $e r r ^ { ( l ) }$ and corresponding weight $\alpha ^ { ( l ) }$ of current base classifier $f _ { \theta } ^ { ( l ) }$ as follows: + +$$ +\begin{array} { c } { { e r r ^ { ( l ) } = \displaystyle \sum _ { i = 1 } ^ { n } w _ { i } \mathbb { I } \left( c _ { i } \neq f _ { \theta } ^ { ( l ) } \left( x _ { i } \right) \right) / \sum _ { i = 1 } ^ { n } w _ { i } } } \\ { { \displaystyle \alpha ^ { ( l ) } = \log \frac { 1 - e r r ^ { ( l ) } } { e r r ^ { ( l ) } } + \log ( K - 1 ) , } } \end{array} +$$ + +where $w _ { i }$ denotes the weight of $i$ -th node and $c _ { i }$ represents the category of current $i$ -th node. To attain a positive $\alpha ^ { ( l ) }$ , we only need $( 1 - e r r ^ { ( l ) } ) > 1 / K$ , i.e., the accuracy of each weak classifier + +should be better than random guess (Hastie et al., 2009). This can be met easily to guarantee the weights to be updated in the right direction. Then we adjust nodes’ weights by increasing weights on incorrectly classified ones: + +$$ +w _ { i } \gets w _ { i } \cdot \exp \left( \alpha ^ { ( l ) } \cdot \mathbb { I } \left( c _ { i } \neq f _ { \theta } ^ { ( l ) } \left( x _ { i } \right) \right) \right) , i = 1 , \dots , n +$$ + +After re-normalizing the weights, we then compute $\hat { A } ^ { l + 1 } X = \hat { A } \cdot ( \hat { A } ^ { l } X )$ to sequentially extract knowledge from of AdaGCN is t $l { + } 1$ -th hop of neighbors in the following base classifier different from traditional AdaBoost, we only define $f _ { \theta } ^ { ( l + 1 ) }$ One crucial point, e.g. a two-layer $f _ { \theta }$ fully connected neural network, which in practice is recursively optimized in each base classifier just similar to a recurrent neural network. This also indicates that the parameters from last base classifier are leveraged as the initialization of next base classifier, which coincides with our intuition that $l + 1$ -th hop of neighbors are directly connected from $l$ -th hop of neighbors. The efficacy of this kind of layer-wise training has been similarly verified in (Belilovsky et al., 2018) recently. Further, we combine the predictions from different orders of neighbors in an Adaboost way to obtain the final prediction $C ( A , X )$ : + +$$ +C ( A , X ) = \arg \operatorname* { m a x } _ { k } \sum _ { l = 0 } ^ { L } \alpha ^ { ( l ) } f _ { \theta } ^ { ( l ) } ( \hat { A } ^ { l } X ) +$$ + +Finally, we obtain the concise form of AdaGCN in the following: + +$$ +\begin{array} { r l } & { \hat { A } ^ { l } X = \hat { A } \cdot ( \hat { A } ^ { l - 1 } X ) } \\ & { Z ^ { ( l ) } = f _ { \theta } ^ { ( l ) } ( \hat { A } ^ { l } X ) } \\ & { Z = \mathrm { A d a B o o s t } ( Z ^ { ( l ) } ) } \end{array} +$$ + +Note that $f _ { \theta }$ is non-linear, rather than linear in SGC (Wu et al., 2019), to guarantee the representation power. As shown in Figure 1, the architecture of AdaGCN is a variant of RNN with synchronous sequence input and output. Although the same classifier architecture is adopted for $f _ { \theta } ^ { ( \bar { l } ) }$ , their parameters are different, which is different from vanilla RNN. We provide a detailed description of the our algorithm in Section 3. + +# 2.2 COMPARISON WITH EXISTING METHODS + +Architectural Difference. As illustrated in Figure 1 and 2, there is an apparent difference among the architectures of GCN (Kipf & Welling, 2017), SGC (Wu et al., 2019), Jumping Knowledge (JK) (Xu et al., 2018b) and AdaGCN. Compared with these existing graph convolutional approaches that sequentially convey intermediate result $Z ^ { ( l ) }$ to compute final prediction, our AdaGCN transmits weights of nodes $w ^ { i }$ , aggregated features of different hops of neighbors ${ \hat { A } } ^ { l } X$ . More importantly, in AdaGCN the embedding $Z ^ { ( l ) }$ is independent of the flow of computation in the network and the sparse adjacent matrix $\hat { A }$ is also not directly involved in the computation of individual network because we compute + +![](images/2d1ea197072ef3f76ecf7d5e86939afa479f716a2e4be601ef8cb8d2f3fec644.jpg) +Figure 2: Comparison of the graph model architectures. $f _ { a }$ in JK network denotes one aggregation layer with aggregation function such as concatenation or max pooling. + +${ \hat { A } } ^ { ( l + 1 ) } X$ in advance and then feed it instead of $\hat { A }$ into the classifier $f _ { \theta } ^ { ( l + 1 ) }$ , thus yielding significant computation reduction, which will be discussed further in Section 3. + +Connection with PPNP and APPNP. We also established a strong connection between AdaGCN and previous state-of-the-art Personalized Propagation of Neural Predictions (PPNP) and Approximate PPNP (APPNP) (Klicpera et al., 2018) method that leverages personalized pagerank to reconstruct graph convolutions in order to use information from a large and adjustable neighborhood. The analysis can be summarized in the following Proposition 1. Proof can refer to Appendix A.3. + +Proposition 1. Suppose that $\gamma$ is the teleport factor. Let matrix sequence $\{ Z ^ { ( l ) } \}$ be from the output of each layer l in AdaGCN, then PPNP is equivalent to the Exponential Moving Average (EMA) with exponentially decreasing factor $\gamma$ on $\{ Z ^ { ( l ) } \}$ in a sharing parameters version, and its approximate version APPNP can be viewed as the approximated form of EMA with a limited number of terms. + +Proposition 1 illustrates that AdaGCN can be viewed as an adaptive form of APPNP, formulated as: + +$$ +Z = \sum _ { l = 0 } ^ { L } \alpha ^ { ( l ) } f _ { \theta } ^ { ( l ) } ( \hat { A } ^ { l } X ) +$$ + +Specifically, the first discrepancy between AdaGCN and APPNP lies in the adaptive coefficient $\alpha ^ { ( l ) }$ in AdaGCN determined by the error of $l$ -th base classifier $f _ { \theta } ^ { ( l ) }$ rather than fixed exponentially decreased weights in APPNP. In addition, AdaGCN employs classifier $f _ { \theta } ^ { ( l ) }$ with different parameters to learn the embedding of different orders of neighbors, while APPNP shares these parameters in its form. We verified this benefit of our approach in our experiments shown in Section 4.2. + +Comparison with MixHop MixHop (Abu-El-Haija et al., 2019) applied the similar way of graph convolution by repeatedly mixing feature representations of neighbors at various distance. Proposition 2 proves that both AdaGCN and MixHop are able to represent feature differences among neighbors while previous GCNs-based methods cannot. Proof can refer to Appendix A.4. Recap the definition of general layer-wise Neighborhood Mixing (Abu-El-Haija et al., 2019) as follows: + +Definition 1. General layer-wise Neighborhood Mixing: $A$ graph convolution network has the ability to represent the layer-wise neighborhood mixing if for any $b _ { 0 } , b _ { 1 } , . . . , b _ { L } ,$ , there exists an injective mapping $f$ with a setting of its parameters, such that the output of this graph convolution network can express the following formula: + +$$ +f \left( \sum _ { l = 0 } ^ { L } b _ { l } \sigma \left( \hat { A } ^ { l } X \right) \right) +$$ + +Proposition 2. AdaGCNs defined by our proposed approach (Eq. equation 7) are capable of representing general layer-wise neighborhood mixing, i.e., can meet the Definition $^ { l }$ . + +Albeit the similarity, AdaGCN distinguishes from MixHop in many aspects. Firstly, MixHop concatenates all outputs from each order of neighbors while we combines these predictions in an Adaboost way, which has theoretical generalization guarantee based on boosting theory Hastie et al. (2009). Oono & Suzuki (2020) have recently derived the optimization and generalization guarantees of multi-scale GNNs, serving as the theoretical backbone of AdaGCN. Meantime, MixHop allows full linear mixing of different orders of neighboring features, while AdaGCN utilizes different nonlinear transformation $f _ { \theta } ^ { ( l ) }$ among all layers, enjoying stronger expressive power. + +# 3 ALGORITHM + +In practice, we employ SAMME.R (Hastie et al., 2009), the soft version of SAMME, in AdaGCN. SAMME.R (R for Real) algorithm (Hastie et al., 2009) leverages real-valued confidence-rated predictions, i.e., weighted probability estimates, rather than predicted hard labels in SAMME, in the prediction combination, which has demonstrated a better generalization and faster convergence than SAMME. We elaborate the final version of AdaGCN in Algorithm 1. We provide the analysis on the choice of model depth $L$ in Appendix A.7, and then we elaborate the computational advantage of AdaGCN in the following. + +Analysis of Computational Advantage. Due to the similarity of graph convolution in MixHop (Abu-El-Haija et al., 2019), AdaGCN also requires no additional memory or computational complexity compared with previous GCN models. Meanwhile, our approach enjoys huge computational advantage compared with GCN-based models, e.g., PPNP and APPNP, stemming from excluding the additional computation involved in sparse tensors, such as the sparse tensor multiplication between $\hat { A }$ and other dense tensors, in the forward and backward propagation of the neural network. Specifically, there are only $L$ times sparse tensor operations for an AdaGCN model with $L$ layers, i.e., $\hat { A } ^ { l } X = \overset { \cdot } { A } \cdot ( \hat { A } ^ { l - 1 } X )$ for each layer $l$ . This operation in each layer yields a dense tensor + +# Algorithm 1 AdaGCN based on SAMME.R Algorithm + +Input: Features Matrix $X$ , normalized adjacent matrix $\hat { A }$ , a two-layer fully connected network $f _ { \theta }$ , number of layers $L$ and number of classes $K$ . + +Output: Final combined prediction $C ( A , X )$ + +1: Initialize the node weights $w _ { i } = 1 / n , i = 1 , 2 , . . . , n$ on training set, neighbors feature matrix ${ \hat { X } } ^ { ( 0 ) } = X$ and classifier $f _ { \theta } ^ { ( - 1 ) }$ . + +2: for $l = 0$ to do + +3: Fit the graph convolutional classifier f (l) on neighbor feature matrix $\hat { X } ^ { ( l ) }$ based on $f _ { \theta } ^ { ( l - 1 ) }$ by minimizing current weighted loss. + +4: Obtain the weighted probability estimates $p ^ { ( l ) } ( \hat { X } ^ { ( l ) } )$ for $f _ { \theta } ^ { ( l ) }$ + +5: Compute the individual prediction $h _ { k } ^ { ( l ) } ( x )$ for the current graph convolutional classifier $f _ { \theta } ^ { ( l ) }$ + +$$ +h _ { k } ^ { ( l ) } ( \hat { X } ^ { ( l ) } ) \gets ( K - 1 ) \left( \log p _ { k } ^ { ( l ) } ( \hat { X } ^ { ( l ) } ) - \frac { 1 } { K } \sum _ { k ^ { \prime } } \log p _ { k ^ { \prime } } ^ { ( l ) } ( \hat { X } ^ { ( l ) } ) \right) +$$ + +where $k = 1 , \ldots , K$ + +6: Adjust the node weights $w _ { i }$ for each node $x _ { i }$ with label $y _ { i }$ on training set: + +$$ +w _ { i } w _ { i } \cdot \exp ( - \frac { K - 1 } { K } y _ { i } ^ { \top } \log p ^ { ( l ) } ( x _ { i } ) ) , i = 1 , \ldots , n +$$ + +7: Re-normalize all weights $w _ { i }$ + +8: Update $l { + } 1$ -hop neighbor feature matrix $\hat { X } ^ { ( l + 1 ) }$ : + +$$ +\hat { X } ^ { ( l + 1 ) } = \hat { A } \hat { X } ^ { ( l ) } +$$ + +# 9: end for + +10: Combine all predictions $h _ { k } ^ { ( l ) } ( \hat { X } ^ { ( l ) } )$ for $l = 0 , . . . , L$ + +$$ +C ( A , X ) = \arg \operatorname* { m a x } _ { k } \sum _ { l = 0 } ^ { L } h _ { k } ^ { ( l ) } ( \hat { X } ^ { ( l ) } ) +$$ + +11: return Final combined prediction $C ( A , X )$ . + +$B ^ { l } = \hat { A } ^ { l } X$ for the $l$ -th layer, which is then fed into the computation in a two-layer fully-connected network, i.e., $f _ { \theta } ^ { ( l ) } ( B ^ { l } ) = \mathrm { \bar { R e L U } } ( B ^ { l } W ^ { ( 0 ) } ) W ^ { ( 1 ) }$ . Due to the fact that dense tensor $B ^ { l }$ has been computed in advance, there is no other computation related to sparse tensors in the multiple forward and backward propagation procedures while training the neural network. By contrast, this multiple computation involved in sparse tensors in the GCN-based models, e.g., GCN: $\hat { A } \mathrm { R e L U } ( \hat { A } X W ^ { ( 0 ) } ) W ^ { ( 1 ) }$ , is highly expensive. AdaGCN avoids these additional sparse tensor operations in the neural network and then attains huge computational efficiency. We demonstrate this viewpoint in the Section 4.3. + +# 4 EXPERIMENTS + +Experimental Setup. We select five commonly used graphs: CiteSeer, Cora-ML (Bojchevski & Gunnemann, 2018; McCallum et al., 2000), PubMed (Sen et al., 2008), MS-Academic (Shchur ¨ et al., 2018) and Reddit. Dateset statistics are summarized in Table 1. Recent graph neural networks suffer from overfitting to a single splitting of training, validation and test datasets (Klicpera et al., 2018). To address this problem, inspired by (Klicpera et al., 2018), we test all approaches on multiple random splits and initialization to conduct a rigorous study. Detailed dataset splittings are provided in Appendix A.6. + +Table 1: Dateset statistics + +
DatesetNodesEdgesClassesFeaturesLabelRate
CiteSeer3,3274,73263,7033.6%
Cora2,7085,42971,4335.2%
PubMed19,71744,33835000.3%
MS Academic18,33381,894156,8051.6%
Reddit232,96511,606,9194160265.9%
+ +![](images/08c70065488901989e7be342ddee25f0d0fd482f68fda0d5da2a451fb95c7178.jpg) +Figure 3: Comparison of test accuracy of different models as the layer increases. We regard the $l$ -th base classifier as the $l$ -th layer in AdaGCN as both of them are leveraged to exploit the information from $l$ -th order of neighbors for current nodes. + +Basic Setting of Baselines and AdaGCN. We compare AdaGCN with GCN (Kipf & Welling, 2017) and Simple Graph Convolution (SGC) (Wu et al., 2019) in Figure 3. In Table 2, we employ the same baselines as (Klicpera et al., 2018): V.GCN (vanilla GCN) (Kipf & Welling, 2017) and GCN with our early stopping, N-GCN (network of GCN) (Abu-El-Haija et al., 2018a), GAT (Graph Attention Networks) (Velickovi ˇ c et al., 2018), BT.FP (bootstrapped feature propagation) (Buchnik ´ & Cohen, 2018) and JK (jumping knowledge networks with concatenation) (Xu et al., 2018b). In the computation part, we additionally compare AdaGCN with FastGCN (Chen et al., 2018) and GraphSAGE (Hamilton et al., 2017). We refer to the result of baselines from (Klicpera et al., 2018) and the implementation of AdaGCN is adapted from APPNP. For AdaGCN, after the line search on hyper-parameters, we set $h = 5 0 0 0$ hidden units for the first four datasets except Ms-academic with $h = 3 0 0 0$ , and 15, 12, 20 and 5 layers respectively due to the different graph structures. In addition, we set dropout rate to 0 for Citeseer and Cora-ML datasets and 0.2 for the other datasets and $5 \times 1 0 ^ { - 3 } L _ { 2 }$ regularization on the first linear layer. We set weight decay as $1 \times 1 0 ^ { - 3 }$ for Citeseer while $1 \times 1 0 ^ { - 4 }$ for others. More detailed model parameters and analysis about our early stopping mechanism can be referred from Appendix A.6. + +# 4.1 DESIGN OF DEEP GRAPH MODELS TO CIRCUMVENT OVERSMOOTHING EFFECT + +It is well-known that GCN suffers from oversmoothing (Li et al., 2018) with the stacking of more graph convolutions. However, combination of knowledge from each layer to design deep graph models is a reasonable method to circumvent oversmoothing issue. In our experiment, we aim to explore the prediction performance of GCN, GCN with residual connection (Kipf & Welling, 2017), SGC and our AdaGCN with a growing number of layers. + +Table 2: Average accuracy under 100 runs with uncertainties showing the $95 \%$ confidence level calculated by bootstrapping. OOM denotes “out of memory”. “(ours)” denotes the results based on our implementation, which are slight lower than numbers above from original literature (Klicpera et al., 2018). P values of paired t test between APPNP (ours) and AdaGCN are provided in the last row. + +
ModelCiteseerCora-MLPubmedMSAcademic
V.GCN73.51±0.4882.30±0.3477.65±0.4091.65±0.09
GCN75.40±0.3083.41±0.3978.68±0.3892.10±0.08
N-GCN74.25±0.4082.25±0.3077.43±0.4292.86±0.11
GAT75.39±0.2784.37±0.2477.76±0.4491.22±0.07
JK73.03±0.4782.69±0.3577.88±0.3891.71±0.10
BT.FP73.55±0.5780.84±0.9772.94±1.0091.61±0.24
PPNP75.83±0.2785.29±0.25OOMOOM
APPNP75.73±0.3085.09±0.2579.73±0.3193.27±0.08
PPNP (ours)75.53±0.3284.39±0.28OOMOOM
APPNP (ours)75.41±0.3584.28±0.2879.41±0.3492.98±0.07
AdaGCN76.68±0.2085.97±0.2079.95±0.2193.17±0.07
P value1.8×10-152.2×10-161.1×10-52.1×10-9
+ +
CiteseerCora-MLPubmedMSAcademic
Label Rates1.0% / 2.0%2.0% / 4.0%0.1% / 0.2%0.6% / 1.2%
V.GCN67.6±1.4/70.8±1.476.4±1.3/81.7±0.870.1±1.4/74.6±1.689.7±0.4/91.1±0.2
GCN70.3±0.9/72.7±1.180.0±0.7/82.8±0.971.1±1.1/75.2±1.089.8±0.4/91.2±0.3
PPNP APPNP72.5±0.9/74.7±0.7 72.2±1.3/74.2±1.180.1±0.7/83.0±0.6OOMOOM
AdaGCN80.1±0.7/83.2±0.674.0±1.5/77.2±1.291.7±0.2/92.6±0.2
74.2±0.3/75.5±0.383.7±0.3/85.3±0.277.1±0.5/79.3±0.392.1±0.1/92.7±0.1
+ +Table 3: Average accuracy across different label rates with 20 splittings of datasets under 100 runs. + +From Figure 3, it can be easily observed that oversmoothing leads to the rapid decreasing of accuracy for GCN (blue line) as the layer increases. In contrast, the speed of smoothing (green line) of SGC is much slower than GCN due to the lack of ReLU analyzed in Section 2.1. Similarly, GCN with residual connection (yellow line) partially mitigates the oversmoothing effect of original GCN but fails to take advantage of information from different orders of neighbors to improve the prediction performance constantly. Remarkably, AdaGCN (red line) is able to consistently enhance the performance with the increasing of layers across the three datasets. This implies that AdaGCN can efficiently incorporate knowledge from different orders of neighbors and circumvent oversmoothing of original GCN in the process of constructing deep graph models. In addition, the fluctuation of performance for AdaGCN is much lower than GCN especially when the number of layer is large. + +# 4.2 PREDICTION PERFORMANCE + +We conduct a rigorous study of AdaGCN on four datasets under multiple splittings of dataset. The results from Table 2 suggest the state-of-the-art performance of our approach and the improvement compared with APPNP validates the benefit of adaptive form for our AdaGCN. More rigorously, p values under paired t test demonstrate the significance of improvement for our method. + +In the realistic setting, graphs usually have different labeled nodes and thus it is necessary to investigate the robust performance of methods on different number of labeled nodes. Here we utilize label rates to measure the different numbers of labeled nodes and then sample corresponding labeled nodes per class on graphs respectively. Table 3 presents the consistent state-of-the-art performance of AdaGCN under different label rates. An interesting manifestation from Table 3 is that AdaGCN yields more improvement on fewer label rates compared with APPNP, showing more efficiency on graphs with few labeled nodes. Inspired by the Layer Effect on graphs (Sun et al., 2019), we argue that the increase of layers in AdaGCN can result in more benefits on the efficient propagation of label signals especially on graphs with limited labeled nodes. + +More rigorously, we additionally conduct the comparison on a larger dataset, i.e., Reddit. We choose the best layer as 4 due to the fact that AdaGCN with larger number of layers tends to suffer from overfitting on this relatively simple dataset (with high label rate $6 5 . 9 \%$ ). Table 4 suggests that AdaGCN can still outperform other typical baselines, including V.GCN, PPNP and APPNP. More experimental details can be referred from Appendix A.6. + +Table 4: Average F1-scores and per-epoch training time of typical methods on Reddit dataset under 5 runs. + +
RedditF1-ScorePer-epoch training time
V.GCN94.46±0.065627.46ms
PPNPOOMOOM
APPNP95.04±0.0729489.81ms
AdaGCN95.39±0.1332.29ms
+ +# 4.3 COMPUTATIONAL EFFICIENCY + +Without the additional computational cost involved in sparse tensors in the propagation of the neural network, AdaGCN presents huge computational efficiency. From the left part of Figure 4, it exhibits that AdaGCN has the fastest speed of per-epoch training time in comparison with other methods except the comparative performance with FastGCN in Pubmed. In addition, there is a somewhat inconsistency in computation of FastGCN, with fastest speed in Pubmed but slower than + +![](images/89a94feea60c1c911e184d58c6f81cdb9979c2377be74b696a65f7feb1710e99.jpg) +Figure 4: Left: Per-epoch training time of AdaGCN vs other methods under 5 runs on four datasets. Right: Per-epoch training time of AdaGCN compared with GCN and SGC with the increasing of layers and the digit after $\mathbf { \bar { \Sigma } } ^ { 6 } = \mathbf { \bar { \Sigma } } ^ { 5 }$ denotes the slope in a fitted linear regression. + +GCN on Cora-ML and MS-Academic datasets. Furthermore, with multiple power iterations involved in sparse tensors, APPNP unfortunately has relatively expensive computation cost. It should be noted that this computational advantage of AdaGCN is more significant when it comes to large datasets, e.g., Reddit. Table 4 demonstrates AdaGCN has the potential to perform much faster on larger datasets. + +Besides, we explore the computational cost of ReLU and sparse adjacency tensor with respect to the number of layers in the right part of Figure 4. We focus on comparing AdaGCN with SGC and GCN as other GCN-based methods, such as GraphSAGE and APPNP, behave similarly with GCN. Particularly, we can easily observe that both SGC (green line) and GCN (red line) show a linear increasing tendency and GCN yields a larger slope arises from ReLU and more parameters. For SGC, stacking more layers directly is undesirable regarding the computation. Thus, a limited number of SGC layers is preferable with more advanced optimization techniques Wu et al. (2019). It also shows that the computational cost involved sparse matrices in neural networks plays a dominant role in all the cost especially when the layer is large enough. In contrast, our AdaGCN (pink line) displays an almost constant trend as the layer increases simply because it excludes the extra computation involved in sparse tensors $\hat { A }$ , such as $\cdot \cdot \cdot \hat { A } \mathrm { ~ R e L U } ( \hat { A } X W ^ { ( 0 ) } ) W ^ { ( 1 ) } \cdot \cdot \cdot ,$ , in the process of training neural networks. AdaGCN maintains the updating of parameters in the $f _ { \theta } ^ { ( l ) }$ with a fixed architecture in each layer while the layer-wise optimization, therefore displaying a nearly constant computation cost within each epoch although more epochs are normally needed in the entire layer-wise training. We leave the analysis of exact time and memory complexity of AdaGCN as future works, but boosting-based algorithms including AdaGCN is memory-efficient (Oono & Suzuki, 2020). + +# 5 DISCUSSIONS AND CONCLUSION + +One potential concern is that AdaBoost (Hastie et al., 2009; Freund et al., 1999) is established on i.i.d. hypothesis while graphs have inherent data-dependent property. Fortunately, the statistical convergence and consistency of boosting (Lugosi & Vayatis, 2001; Mannor et al., 2003) can still be preserved when the samples are weakly dependent (Lozano et al., 2013). More discussion can refer to Appendix A.5. In this paper, we propose a novel RNN-like deep graph neural network architecture called AdaGCNs. With the delicate architecture design, our approach AdaGCN can effectively explore and exploit knowledge from different orders of neighbors in an Adaboost way. Our work paves a way towards better combining different-order neighbors to design deep graph models rather than only stacking on specific type of graph convolution. + +# ACKNOWLEDGMENTS + +Z. Lin is supported by NSF China (grant no.s 61625301 and 61731018), Major Scientific Research Project of Zhejiang Lab (grant no.s 2019KB0AC01 and 2019KB0AB02), Beijing Academy of Artificial Intelligence, and Qualcomm. + +# REFERENCES + +Sami Abu-El-Haija, Amol Kapoor, Bryan Perozzi, and Joonseok Lee. N-gcn: Multi-scale graph convolution for semi-supervised node classification. International Workshop on Mining and Learning with Graphs (MLG), 2018a. + +Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Hrayr Harutyunyan, Nazanin Alipourfard, Kristina Lerman, Greg Ver Steeg, and Aram Galstyan. Mixhop: Higher-order graph convolution architectures via sparsified neighborhood mixing. International Conference on Machine Learning (ICML), 2019. + +Eugene Belilovsky, Michael Eickenberg, and Edouard Oyallon. Greedy layerwise learning can scale to imagenet. International Conference on Machine Learning (ICML), 2018. + +Aleksandar Bojchevski and Stephan Gunnemann. Deep gaussian embedding of graphs: Unsu- ¨ pervised inductive learning via ranking. International Conference on Learning Representations (ICLR), 2018. + +Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. International Conference on Learning Representations (ICLR), 2014. + +Eliav Buchnik and Edith Cohen. Bootstrapped graph diffusions: Exposing the power of nonlinearity. In Abstracts of the 2018 ACM International Conference on Measurement and Modeling of Computer Systems, pp. 8–10. ACM, 2018. + +Peter Buhlmann and Bin Yu. Boosting with the l 2 loss: regression and classification. ¨ Journal of the American Statistical Association, 98(462):324–339, 2003. + +Jie Chen, Tengfei Ma, and Cao Xiao. Fastgcn: fast learning with graph convolutional networks via importance sampling. International Conference on Learning Representations (ICLR), 2018. + +Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks ¨ on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems (NeurIPS), pp. 3844–3852, 2016. + +Santo Fortunato. Community detection in graphs. Physics reports, 486(3-5):75–174, 2010. + +Yoav Freund, Robert Schapire, and Naoki Abe. A short introduction to boosting. Journal-Japanese Society For Artificial Intelligence, 14(771-780):1612, 1999. + +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 (NeurIPS), pp. 2672–2680, 2014. + +Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pp. 729–734. IEEE, 2005. + +Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems (NeurIPS), pp. 1024–1034, 2017. + +Trevor Hastie, Saharon Rosset, Ji Zhu, and Hui Zou. Multi-class adaboost. Statistics and Its Interface, 2(3):349–360, 2009. + +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. + +Furong Huang, Jordan Ash, John Langford, and Robert Schapire. Learning deep resnet blocks sequentially using boosting theory. International Conference on Machine Learning (ICML), 2018. + +Wenxin Jiang et al. Process consistency for adaboost. The Annals of Statistics, 32(1):13–29, 2004. + +Ming Jin, Heng Chang, Wenwu Zhu, and Somayeh Sojoudi. Power up! robust graph convolutional network against evasion attacks based on graph powering. arXiv preprint arXiv:1905.10029, 2019. + +Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. International Conference on Learning Representations (ICLR), 2017. + +Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: ¨ Graph neural networks meet personalized pagerank. International Conference on Learning Representations (ICLR), 2018. + +Guohao Li, Matthias Muller, Ali Thabet, and Bernard Ghanem. Can gcns go as deep as cnns? ¨ ICCV, 2019. + +Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. Association for the Advancement of Artificial Intelligence (AAAI), 2018. + +Renjie Liao, Zhizhen Zhao, Raquel Urtasun, and Richard S Zemel. Lanczosnet: Multi-scale deep graph convolutional networks. International Conference on Learning Representations (ICLR), 2019. + +Meng Liu, Hongyang Gao, and Shuiwang Ji. Towards deeper graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 338–348, 2020. + +Aurelie C Lozano, Sanjeev R Kulkarni, and Robert E Schapire. Convergence and consistency of regularized boosting with weakly dependent observations. IEEE Transactions on Information Theory, 60(1):651–660, 2013. + +Sitao Luan, Mingde Zhao, Xiao-Wen Chang, and Doina Precup. Break the ceiling: Stronger multiscale deep graph convolutional networks. Advances in Neural Information Processing Systems (NeurIPS), 2019. + +Gabor Lugosi and Nicolas Vayatis. On the bayes-risk consistency of boosting methods. 2001. ´ + +Shie Mannor, Ron Meir, and Tong Zhang. Greedy algorithms for classification–consistency, convergence rates, and adaptivity. Journal of Machine Learning Research, 4(Oct):713–742, 2003. + +Andrew Kachites McCallum, Kamal Nigam, Jason Rennie, and Kristie Seymore. Automating the construction of internet portals with machine learning. Information Retrieval, 3(2):127–163, 2000. + +Kenta Oono and Taiji Suzuki. Optimization and generalization analysis of transduction through gradient boosting and application to multi-scale graph neural networks. Advances in Neural Information Processing Systems (NeurIPS), 2020. + +Omri Puny, Heli Ben-Hamu, and Yaron Lipman. From graph low-rank global attention to 2-fwl approximation. ICML Workshop Graph Representation Learning and Beyond, 2020. + +Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93, 2008. + +Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Gunnemann. Pitfalls ¨ of graph neural network evaluation. In Relational Representation Learning Workshop (R2L 2018), NeurIPS, 2018. + +Ke Sun, Zhanxing Zhu, and Zhouchen Lin. Multi-stage self-supervised learning for graph convolutional networks. Association for the Advancement of Artificial Intelligence (AAAI), 2019. + +Ilya O Tolstikhin, Sylvain Gelly, Olivier Bousquet, Carl-Johann Simon-Gabriel, and Bernhard Scholkopf. Adagan: Boosting generative models. In ¨ Advances in Neural Information Processing Systems (NeurIPS), pp. 5424–5433, 2017. + +Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. International Conference on Learning Representations (ICLR), 2018. + +Felix Wu, Tianyi Zhang, Amauri Holanda de Souza Jr, Christopher Fifty, Tao Yu, and Kilian Q Weinberger. Simplifying graph convolutional networks. International Conference on Machine Learning (ICML), 2019. + +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? International Conference on Learning Representations (ICLR), 2018a. + +Keyulu Xu, Chengtao Li, Yonglong Tian, Tomohiro Sonobe, Ken-ichi Kawarabayashi, and Stefanie Jegelka. Representation learning on graphs with jumping knowledge networks. International Conference on Machine Learning (ICML), 2018b. + +Hanqing Zeng, Hongkuan Zhou, Ajitesh Srivastava, Rajgopal Kannan, and Viktor Prasanna. Graphsaint: Graph sampling based inductive learning method. International Conference on Learning Representations (ICLR), 2019. + +Tong Zhang, Bin Yu, et al. Boosting with early stopping: Convergence and consistency. The Annals of Statistics, 33(4):1538–1579, 2005. + +Jun Zhu, Jiaming Song, and Bei Chen. Max-margin nonparametric latent feature models for link prediction. arXiv preprint arXiv:1602.07428, 2016. + +# A APPENDIX + +# A.1 RELATED WORKS ON DEEP GRAPH MODELS + +A straightforward solution (Kipf & Welling, 2017; Xu et al., 2018b) inspired by ResNets (He et al., 2016) was by adding residual connections, but this practice was unsatisfactory both in prediction performance and computational efficiency towards building deep graph models, as shown in our experiments in Section 4.1 and 4.3. More recently, JK (Jumping Knowledge Networks (Xu et al., 2018b)) introduced jumping connections into final aggregation mechanism in order to extract knowledge from different layers of graph convolutions. However, this straightforward change of GCN architecture exhibited inconsistent empirical performance for different aggregation operators, which cannot demonstrate the successful construction of deep layers. In addition, Graph powering-based method (Jin et al., 2019) implicitly leveraged more spatial information by extending classical spectral graph theory to robust graph theory, but they concentrated on defending adversarial attacks rather than model depth. LanczosNet (Liao et al., 2019) utilized Lanczos algorithm to construct low rank approximations of the graph Laplacian and then can exploit multi-scale information. Moreover, APPNP (Approximate Personalized Propagation of Neural Predictions, (Klicpera et al., 2018)) leveraged the relationship between GCN and personalized PageRank to derive an improved global propagation scheme. Beyond these, DeepGCNs (Li et al., 2019) directly adapted residual, dense connection and dilated convolutions to GCN architecture, but it mainly focused on the task of point cloud semantic segmentation and has not demonstrated its effectiveness in typical graph tasks. Similar to our work, Deep Adaptive Graph Neural Network (DAGNN) (Liu et al., 2020) also focused on incorporating information from large receptive fields through the entanglement of representation transformation and propagation, while our work efficiently ensembles knowledge from large receptive fields in an Adaboost manner. Other related works based on global attention models (Puny et al., 2020) and sample-based methods (Zeng et al., 2019) are also helpful to construct deep graph models. + +# A.2 INSUFFICIENT REPRESENTATION POWER OF ADASGC + +As illustrated in Figure 5, with the increasing of layers, AdaSGC with only linear transformation has insufficient representation power both in extracting knowledge from high-order neighbors and combining information from different orders of neighbors while AdaGCN exhibits a consistent improvement of performance as the layer increases. + +![](images/9104e19081c34688617941b936149f4c8b5052597b8f8093558b211df918728a.jpg) +Figure 5: AdaSGC vs AdaGCN. + +# A.3 PROOF OF PROPOSITION 1 + +Firstly, we further elaborate the Proposition 1 as follows, then we provide the proof. + +Suppose that $\gamma$ is the teleport factor. Consider the output $Z _ { \mathrm { P P N P } } = \gamma ( \mathbb { I } - ( 1 - \gamma ) \hat { A } ) ^ { - 1 } f _ { \theta } ( X )$ in PPNP and $Z _ { \mathrm { A P P N P } }$ from its approxminated version APPNP. Let matrix sequence $\{ Z ^ { ( l ) } \}$ be from the output of each layer $l$ in AdaGCN, then PPNP is equivalent to the Exponential Moving Average (EMA) with exponentially decreasing factor In add $\gamma$ , a first-order infinite impulse response filter, on ion, APPNP, which we reformulate in Eq. 10, c $\{ Z ^ { ( l ) } \}$ in a sharing parameters version, i.e., iewed as the approximated form of E $f _ { \theta } ^ { ( l ) } \equiv f _ { \theta }$ + +limited number of terms. + +$$ +Z _ { \mathrm { A P P N P } } = ( \gamma \sum _ { l = 0 } ^ { L - 1 } ( 1 - \gamma ) ^ { l } \hat { A } ^ { l } + ( 1 - \gamma ) ^ { L } \hat { A } ^ { L } ) f _ { \theta } ( X ) +$$ + +Proof. According to Neumann Theorem, $Z _ { \mathrm { P P N P } }$ can be expanded as a Neumann series: + +$$ +\begin{array} { r l } { { Z _ { \mathrm { P P N P } } = \gamma ( \mathbb { I } - ( 1 - \gamma ) \hat { A } ) ^ { - 1 } f _ { \theta } ( X ) } } \\ & { = \gamma \sum _ { l = 0 } ^ { \infty } ( 1 - \gamma ) ^ { l } \hat { A } ^ { l } f _ { \theta } ( X ) , } \end{array} +$$ + +where feature embedding matrix sequence $\{ Z ^ { ( l ) } \}$ for each order of neighbors share the same parameters $f _ { \theta }$ . If we relax this sharing nature to the adaptive form with respect to the layer and put $\hat { A } ^ { l }$ into $f _ { \theta }$ , then the output $Z$ can be approximately formulated as: + +$$ +Z _ { \mathrm { P P N P } } \approx \gamma \sum _ { l = 0 } ^ { \infty } ( 1 - \gamma ) ^ { l } f _ { \theta } ^ { ( l ) } ( \hat { A } ^ { l } X ) +$$ + +This relaxed version from PPNP is the Exponential Moving Average form of matrix sequence $\{ Z ^ { ( l ) } \}$ with exponential decreasing factor $\gamma$ . Moreover, if we approximate the EMA by truncating it after $L - 1$ items, then the weight omitted by stopping after $L - 1$ items is $( 1 - \gamma ) ^ { L }$ . Thus, the approximated EMA is exactly the APPNP form: + +$$ +Z _ { \mathrm { A P P N P } } = ( \gamma \sum _ { l = 0 } ^ { L - 1 } ( 1 - \gamma ) ^ { l } \hat { A } ^ { l } + ( 1 - \gamma ) ^ { L } \hat { A } ^ { L } ) f _ { \theta } ( X ) +$$ + +# A.4 PROOF OF PROPOSITION 2 + +Proof. We consider a two layers fully-connected neural network as $f$ in Eq. 8, then the output of AdaGCN can be formulated as: + +$$ +Z = \sum _ { l = 0 } ^ { L } \alpha ^ { ( l ) } \sigma ( \hat { A } ^ { l } X W ^ { ( 0 ) } ) W ^ { ( 1 ) } +$$ + +Particularly, we set W (0) $\begin{array} { r } { W ^ { ( 0 ) } = \frac { b _ { l } } { \mathrm { s i g n } ( b _ { l } ) \alpha ^ { ( l ) } } \mathbb { I } } \end{array}$ blsign(b )α(l) I and W (1) = sign(bl)I where sign(bl) is the signed incidence scalar w.r.t $b _ { l }$ . Then the output of AdaGCN can be presented as: + +$$ +\begin{array} { l } { { \displaystyle Z = \sum _ { l = 0 } ^ { L } \alpha ^ { ( l ) } \sigma ( \hat { A } ^ { l } X \frac { b _ { l } } { \mathrm { s i g n } ( b _ { l } ) \alpha ^ { ( l ) } } \mathbb { I } ) \mathrm { s i g n } ( b _ { l } ) \mathbb { I } } } \\ { ~ } \\ { { \displaystyle ~ = \sum _ { l = 0 } ^ { L } \alpha ^ { ( l ) } \sigma ( \hat { A } ^ { l } X ) \frac { b _ { l } } { \mathrm { s i g n } ( b _ { l } ) \alpha ^ { ( l ) } } \mathrm { s i g n } ( b _ { l } ) } } \\ { { \displaystyle ~ = \sum _ { l = 0 } ^ { L } b _ { l } \sigma \left( \hat { A } ^ { l } X \right) } } \end{array} +$$ + +The proof that GCNs-based methods are not capable of representing general layer-wise neighborhood mixing has been demonstrated in MixHop (Abu-El-Haija et al., 2019). Proposition 2 proved. □ + +# A.5 EXPLANATION ABOUT CONSISTENCY OF BOOSTING ON DEPENDENT DATA + +Definition 2. ( $\beta$ -mixing sequences.) Let $\sigma _ { i } ^ { j } = \sigma ( W ) = \sigma ( W _ { i } , W _ { i + 1 } , . . . , W _ { j } )$ be the $\sigma$ -field generated by $a$ strictly stationary sequence of random variables $W = ( W _ { i } , W _ { i + 1 } , . . . , W _ { j } )$ . The $\beta$ -mixing coefficient is defined by: + +$$ +\beta _ { W } ( n ) = \operatorname* { s u p } _ { k } \mathbb { E } \operatorname* { s u p } \left\{ \left| \mathbb { P } \left( A | \sigma _ { 1 } ^ { k } \right) - \mathbb { P } ( A ) \right| : A \in \sigma _ { k + n } ^ { \infty } \right\} +$$ + +Then a sequence $W$ is called $\beta$ -mixing if $l i m _ { n \infty } \beta _ { W } ( n ) = 0 .$ . Further, $i t$ is algebraically $\beta$ -mixing if there is a positive constant $r _ { \beta }$ such that $\beta _ { W } ( n ) = \mathcal { O } ( n ^ { - r _ { \beta } } )$ . + +Definition 3. (Consistency) $A$ classification rule is consistent for a certain distribution $P$ if $E ( L ( h _ { n } ) ) =$ $P \{ h _ { n } ( X ) ~ = ~ Y \} ~ \to ~ a$ as $n \infty$ where $a$ is a constant. It is strongly Bayes-risk consistent $i f$ $l i m _ { n \infty } L ( h _ { n } ) = a$ almost surely. + +Under these definitions, the convergence and consistence of regularized boosting method on stationary $\beta$ - mixing sequences can be proved under mild assumptions. More details can be referred from (Lozano et al., 2013). + +# A.6 EXPERIMENTAL DETAILS + +Early Stopping on AdaGCN. We apply the same early stopping mechanism across all the methods as (Klicpera et al., 2018) for fair comparison. Furthermore, boosting theory also has the capacity to perfectly incorporate early stopping and it has been shown that for several boosting algorithms including AdaBoost, this regularization via early stopping can provide guarantees of consistency (Zhang et al., 2005; Jiang et al., 2004; Buhlmann ¨ & Yu, 2003). + +Dataset Splitting. We choose a training set of a fixed nodes per class, an early stopping set of 500 nodes and test set of remained nodes. Each experiment is run with 5 random initialization on each data split, leading to a total of 100 runs per experiment. On a standard setting, we randomly select 20 nodes per class. For the two different label rates on each graph, we select 6, 11 nodes per class on citeseer, 8, 16 nodes per class on Cora-ML, 7, 14 nodes per class on Pubmed and 8, 15 nodes per class on MS-Academic dataset. + +Model parameters. For all GCN-based approaches, we use the same hyper-parameters in the original paper: learning rate of 0.01, 0.5 dropout rate, $5 \times \mathrm { \dot { 1 } 0 ^ { - 4 } ~ } L _ { 2 }$ regularization weight, and 16 hidden units. For FastGCN, we adopt the officially released code to conduct our experiments. PPNP and APPNP are adapted with best setting: $K = 1 0$ power iteration steps for APPNP, teleport probability $\gamma = 0 . 1$ on Cora-ML, Citeseer and Pubmed, $\gamma = 0 . 2$ on Ms-Academic. In addition, we use two layers with $h = 6 4$ hidden units and apply L2 regularization with $\lambda = 5 \times 1 0 ^ { - 3 }$ on the weights of the first layer and use dropout with dropout rate $d = 0 . 5$ on both layers and the adjacency matrix. The early stopping criterion uses a patience of $p = 1 0 0$ and an (unreachably high) maximum of $n = 1 0 0 0 0$ epochs.The implementation of AdaGCN is adapted from PPNP and APPNP. Corresponding patience $p = 3 0 0$ and $n = 5 0 0$ in the early stopping of AdaGCN. Moreover, SGC is re-implemented in a straightforward way without incorporating advanced optimization for better illustration and comparison. Other baselines are adopted the same parameters described in PPNP and APPNP. + +Settings on Reddit dataset. By repeatedly tuning the parameters of these typical methods on Reddit, we finally choose weight decay rate as $1 \dot { 0 } ^ { - 4 }$ , hidden layer size 100 and epoch 20000 for AdaGCN. For APPNP, we opt weight decay rate as $1 0 ^ { - 5 }$ , dropout rate as 0 and epoch 500. V.GCN applies the same parameters in (Kipf & Welling, 2017) and we choose epoch as 500. All approaches have not deployed early stopping due to the expensive computational cost on the large Reddit dataset, which is also a fair comparison. + +# A.7 CHOICE OF THE NUMBER OF LAYERS + +Different from the “forcible” behaviors in CNNs that directly stack many convolution layers, in our AdaGCN there is a theoretical guidance on the choice of model depth $L$ , i.e., the number of base classifiers or layers, derived from boosting theory. Specifically, according to the boosting theory, the increasing of $L$ can exponentially decreases the empirical loss, however, from the perspective of VC-dimension, an overly large $L$ can yield overfitting of AdaGCN. It should be noted that the deeper graph convolution layers in AdaGCN are not always better, which indeed heavily depends on the the complexity of data. In practice, $L$ can be determined via cross-validation. Specifically, we start a VC-dimension-based analysis to illustrate that too large $L$ can yield overfitting of AdaGCN. For $L$ layers of AdaGCN, its hypothesis set is + +$$ +\mathcal { F } _ { L } = \left\{ \underset { k } { \arg \operatorname* { m a x } } \left( \sum _ { l = 1 } ^ { L } \alpha ^ { ( l ) } f _ { \theta } ^ { ( l ) } \right) : \alpha ^ { ( l ) } \in \mathbb { R } , l \in [ 1 , L ] \right\} +$$ + +Then the VC-dimension of ${ \mathcal { F } } _ { T }$ can be bounded as follows in terms of the VC-dimension $d$ of the family of base hypothesis: + +$$ +\begin{array} { r } { \mathrm { V C d i m } \left( \mathcal { F } _ { L } \right) \leq 2 ( d + 1 ) ( L + 1 ) \log _ { 2 } ( ( L + 1 ) e ) , } \end{array} +$$ + +where $e$ is a constant and the upper bounds grows as $L$ increases. Combined with VC-dimension generalization bounds, these results imply that larger values of $L$ can lead to overfitting of AdaBoost. This situation also happens in AdaGCN, which inspires us that there is no need to stack too many layers on AdaGCN in order to avoid overfitting. In practice, $L$ is typically determined via cross-validation. \ No newline at end of file diff --git a/md/train/QpT9Q_NNfQL/QpT9Q_NNfQL.md b/md/train/QpT9Q_NNfQL/QpT9Q_NNfQL.md new file mode 100644 index 0000000000000000000000000000000000000000..f78b28de64e2106df5dc6d98c05cdf133451d2de --- /dev/null +++ b/md/train/QpT9Q_NNfQL/QpT9Q_NNfQL.md @@ -0,0 +1,454 @@ +# NEURWIN: NEURAL WHITTLE INDEX NETWORK FOR RESTLESS BANDITS VIA DEEP RL + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Whittle index policy is a powerful tool to obtain asymptotically optimal solutions for the notoriously intractable problem of restless bandits. However, finding the Whittle indices remains a difficult problem for many practical restless bandits with convoluted transition kernels. This paper proposes NeurWIN, a neural Whittle index network that seeks to learn the Whittle indices for any restless bandits by leveraging mathematical properties of the Whittle indices. We show that a neural network that produces the Whittle index is also one that produces the optimal control for a set of Markov decision problems. This property motivates using deep reinforcement learning for the training of NeurWIN. We demonstrate the utility of NeurWIN by evaluating its performance for three recently studied restless bandit problems. Our experiment results show that the performance of NeurWIN is either better than, or as good as, state-of-the-art policies for all three problems. + +# 1 INTRODUCTION + +Many sequential decision problems can be modeled as multi-armed bandit problems. A bandit problem models each potential decision as an arm. In each round, we play $M$ arms out of a total of $N$ arms by choosing the corresponding decisions. We then receive a reward from the played arms. The goal is to maximize the long-term total discounted reward. Consider, for example, displaying advertisements on an online platform with the goal to maximize the long-term discounted clickthrough rates. This can be modeled as a bandit problem where each arm is a piece of advertisement and we choose which advertisements to be displayed every time a particular user visits the platform. It should be noted that the reward, i.e., click-through rate, of an arm is not stationary, but depends on our actions in the past. For example, a user that just clicked on a particular advertisement may be much less likely to click on the same advertisement in the near future. Such a problem is a classic case of the restless bandit problem, where the reward distribution of an arm depends on its state, which changes over time based on our past actions. + +The restless bandit problem is notoriously intractable (Papadimitriou & Tsitsiklis, 1999). Most recent efforts, such as recovering bandits (Pike-Burke & Grunewalder, 2019), rotting bandits (Seznec et al., 2020), and Brownian bandits (Slivkins & Upfal, 2008), only study some special instances of the restless bandit problem. The fundamental challenge of the restless bandit problem lies in the explosion of state space, as the state of the entire system is the Cartesian product of the states of individual arms. A powerful tool to address the explosion of state space is the Whittle index policy (Whittle, 1988). In a nutshell, the Whittle index policy calculates a Whittle index for each arm based on the arm’s current state, where the index loosely corresponds to the amount of cost that we are willing to pay to play the arm, and then plays the arm with the highest index. It has been shown that the Whittle index policy is either optimal or asymptotically optimal in many settings. + +In this paper, we present Neural Whittle Index Network (NeurWIN), a principled machine learning approach that finds the Whittle indices for virtually all restless bandit problems. We note that the Whittle index is an artificial construct that cannot be directly measured. Finding the Whittle index is typically intractable. As a result, the Whittle indices of many practical problems remain unknown except for a few special cases. + +We are able to circumvent the challenges of finding the Whittle indices by leveraging an important mathematical property of the Whittle index: Consider an alternative problem where there is only one arm and we decide whether to play the arm in each time instance. In this problem, we need to pay a constant cost of $\lambda$ every time we play the arm. The goal is to maximize the long-term discounted net reward, defined as the difference between the rewards we obtain from the arm and the costs we pay to play it. Then, the optimal policy is to play the arm whenever the Whittle index becomes larger than $\lambda$ . Based on this property, a neural network that produces the Whittle index can be viewed as one that finds the optimal policy for the alternative problem for any $\lambda$ . + +Using this observation, we propose a deep reinforcement learning method to train NeurWIN. To demonstrate the power of NeurWIN, we employ NeurWIN for three recently studied restless bandit problems, namely, recovering bandit (Pike-Burke & Grunewalder, 2019), wireless scheduling (Aalto et al., 2015), and stochastic deadline scheduling (Yu et al., 2018). There is no known Whittle index for the first problem, and there is only an approximation of the Whittle index under some relaxations for the second problem. Only the third problem has a precise characterization of the Whittle index. For the first two problems, the index policy using our NeurWIN achieves better performance than existing studies. For the third problem, the index policy using our NeurWIN has virtually the same performance as the Whittle index policy. + +The rest of the paper is organized as follows: Section 2 reviews related literature. Section 3 provides formal definitions of the Whittle index and our problem statement. Section 4 introduces our training algorithm for NeurWIN. Section 5 demonstrates the utility of NeurWIN by evaluating its performance under three recently studied restless bandit problems. Finally, Section 6 concludes the paper. + +# 2 RELATED WORK + +Restless bandit problems were first introduced in (Whittle, 1988). They are known to be intractable, and are in general PSPACE hard (Papadimitriou & Tsitsiklis, 1999). As a result, many studies focus on finding the Whittle index policy for restless bandit problems, such as in (Le Ny et al., 2008; Meshram et al., 2018; Tripathi & Modiano, 2019; Dance & Silander, 2015). However, these studies are only able to find the Whittle indices under various specific assumptions about the bandit problems. + +There has been a lot of studies on applying RL methods for bandit problems. (Dann et al., 2017) proposed a tool called Uniform-PAC for contextual bandits. (Zanette & Brunskill, 2018) described a framework-agnostic approach towards guaranteeing RL algorithms’ performance. (Jiang et al., 2017) introduced contextual decision processes (CDPs) that encompass contextual bandits for RL exploration with function approximation. (Riquelme et al., 2018) compared deep neural networks with Bayesian linear regression against other posterior sampling methods. However, none of these studies are applicable to restless bandits, where the state of an arm can change over time. + +Deep RL algorithms have been utilized in problems that resemble restless bandit problems, including HVAC control (Wei et al., 2017), cyber-physical systems (Leong et al., 2020), and dynamic multichannel access (Wang et al., 2018). In all these cases, a major limitation for deep RL is scalability. As the state spaces grows exponentially with the number of arms, these studies can only be applied to small-scale systems, and their evaluations are limited to cases when there are at most 5 zones, 6 sensors, and 8 channels, respectively. + +An emerging research direction is applying machine learning algorithms to learn Whittle indices. (Borkar & Chadha, 2018) proposed employing the LSPE(0) algorithm (Yu & Bertsekas, 2009) coupled with a polynomial function approximator. The approach was applied in (Avrachenkov & Borkar, 2019) for scheduling web crawlers. However, this work can only be applied to restless bandits whose states can be represented by a single number, and it only uses a polynomial function approximator, which may have low representational power (Sutton & Barto, 2018). (Fu et al., 2019) proposed a Q-learning based heuristic to find Whittle indices. However, as shown in its experiment results, the heuristic may not produce Whittle indices even when the training converges. + +# 3 PROBLEM SETTING + +In this section, we provide a brief overview of restless bandit problems and the Whittle index. We then formally define the problem statement. + +# 3.1 RESTLESS BANDIT PROBLEMS + +A restless bandit problem consists of $N$ restless arms. In each round $t$ , a control policy observes the state of each arm $i$ , denoted by $s _ { i } [ t ]$ , and selects $M$ arms to activate. We call the selected arms as active and the others as passive. We use $a _ { i } [ t ]$ to denote the policy’s decision on each arm $i$ , where $a _ { i } [ t ] = 1$ if the arm is active and $a _ { i } [ t ] = 0$ if it is passive at round $t$ . Each arm $i$ generates a stochastic reward $r _ { i } [ t ]$ with distribution $R _ { i , a c t } ( s _ { i } [ t ] )$ if it is active, and with distribution $R _ { i , p a s s } ( s _ { i } [ t ] )$ if it is passive. The state of each arm $i$ in the next round evolves by the transition kernel of either $\bar { P _ { i , a c t } } ( s _ { i } [ t ] )$ or $P _ { i , p a s s } ( s _ { i } [ t ] )$ , depending on whether the arm is active. The goal of the control policy is to maximize the total discounted reward, which can be expressed as $\begin{array} { r } { \sum _ { t = 1 } ^ { \infty } \sum _ { i = 1 } ^ { N } \beta ^ { t } r _ { i } [ t ] } \end{array}$ with $\beta$ + +A control policy is effectively a function that takes the vector $( s _ { 1 } [ t ] , s _ { 2 } [ t ] , \ldots , s _ { N } [ t ] )$ as the input and produces the vector $( a _ { 1 } [ t ] , a _ { 2 } [ t ] , \dotsc , a _ { N } [ t ] )$ as the output. It should be noted that the space of input is exponential in $N$ . If each arm can be in one of $K$ possible states, then the number of possible inputs is $\bar { K } ^ { N }$ . This feature, which is usually referred to as the curse of dimensionality, makes finding the optimal control policy intractable. + +# 3.2 THE WHITTLE INDEX + +An index policy seeks to address the curse of dimensionality through decomposition. In each round, it calculates an index, denoted by $W _ { i } ( s _ { i } [ t ] )$ , for each arm $i$ based on its current state. The index policy then selects the $M$ arms with the highest indices to activate. It should be noted that the index of an arm $i$ is independent from the states of any other arms. + +Obviously, the performance of an index policy depends on the design of the index function $W _ { i } ( \cdot )$ . A popular index with solid theoretical foundation is the Whittle index, which is defined below. Since we only consider one arm at a time, we drop the subscript $i$ for the rest of the paper. + +Consider a system with only one arm, and a control policy that determines whether to activate the arm in each round $t$ . Suppose that the policy needs to pay an activation cost of $\lambda$ every time it chooses to activate the arm. The goal of the control policy is to maximize the total discounted net reward, $\begin{array} { r } { \sum _ { t = 1 } ^ { \infty } \beta ^ { t } ( \boldsymbol { r } [ t ] - \lambda a [ t ] ) } \end{array}$ . The optimal control policy can be expressed by the set of states in which it would activate this arm for a particular $\lambda$ , and we denote this set by $\boldsymbol { \mathcal { A } } ( \boldsymbol { \lambda } )$ . Intuitively, the higher the cost, the less likely the optimal control policy would activate the arm in a given state, and hence the set $\boldsymbol { \mathcal { A } } ( \boldsymbol { \lambda } )$ should decrease monotonically. When an arm satisfies this intuition, we say that the arm is indexable. + +Definition 1 (Indexability). An arm is said to be indexable if $\boldsymbol { \mathcal { A } } ( \lambda )$ decreases monotonically from the set of all states to the empty set as $\lambda$ increases from $- \infty$ to $\infty$ . A restless bandit problem is said to be indexable if all arms are indexable. + +Definition 2 (The Whittle Index). If an arm is indexable, then its Whittle index of each state s is defined as $W ( s ) : = \operatorname* { s u p } _ { \lambda } \{ \lambda : s \in { \dot { A } } ( \lambda ) \}$ . + +Even when an arm is indexable, finding its Whittle index can still be intractable, especially when the transition kernel of the arm is convoluted1. Our NeurWIN finds the Whittle index by leveraging the following property of the Whittle index: Consider the single-armed bandit problem. Suppose the initial state of an indexable arm is $s$ at round one. Consider two possibilities: The first is that the control policy activates the arm at round one, and then uses the optimal policy starting from round two; and the second is that the control policy does not activate the arm at round one, and then uses the optimal policy starting from round two. Let $Q _ { \lambda , a c t } ( s )$ and $Q _ { \lambda , p a s s } ( s )$ be the expected discounted net reward for these two possibilities, respectively, and let $D _ { s } ( \lambda ) : = \left( Q _ { \lambda , a c t } ( s ) - Q _ { \lambda , p a s s } ( s ) \right)$ be their difference. Clearly, the optimal policy should activate an arm under state $s$ and activation cost $\lambda$ if $D _ { s } ( \lambda ) \geq 0$ . We then have the following: + +Theorem 1. (Zhao, 2019, Thm 3.14) If an arm is indexable, then, for every state $s _ { : }$ , $D _ { s } ( \lambda ) \geq 0 i f$ and only if $\lambda \leq W ( s )$ . + +Our NeurWIN uses Thm. 1 to train neural networks that predict the Whittle index for any indexable arms. From Def. 1, a sufficient condition for indexability is when $D _ { s } ( \lambda )$ is a decreasing function. Thus, we define the concept of strong indexability as follows: + +Definition 3 (Strong Indexability). An arm is said to be strongly indexable if $D _ { s } ( \lambda )$ is strictly decreasing in λ for every state s. + +# 3.3 PROBLEM STATEMENT + +We now formally describe the objective of this paper. We assume that we are given a simulator of one single restless arm as a black box. The simulator provides two functionalities: First, it allows us to set the initial state of the arm to any arbitrary state $s$ . Second, in each round $t$ , the simulator takes $a [ t ]$ , the indicator function that the arm is activated, as the input and produces the next state $s [ t + 1 ]$ and the reward $r [ t ]$ as the outputs. + +Our goal is to derive low-complexity index algorithms for restless bandit problems by training a neural network that approximates the Whittle index of each restless arm using its simulator. A neural network takes the state $s$ as the input and produces a real number $f _ { \theta } ( s )$ as the output, where $\theta$ is the vector containing all weights and biases of the neural network. Recall that $W ( s )$ is the Whittle index of the arm. We aim to find appropriate $\theta$ that makes $| f _ { \theta } ( s ) - W ( s ) |$ small for all $s$ . Such a neural network is said to be Whittle-accurate. + +Definition 4 (Whittle-accurate). A neural network with parameters $\theta$ is said to be $\gamma$ -Whittleaccurate $i f \vert f _ { \theta } ( s ) - W ( s ) \vert \leq \gamma ,$ , for all $s$ . + +# 4 NEURWIN ALGORITHM: NEURAL WHITTLE INDEX NETWORK + +In this section, we present NeurWIN, a deep-RL algorithms that trains neural networks to predict the Whittle indices. Since the Whittle index of an arm is independent from other arms, NeurWIN trains one neural network for each arm independently. In this section, we discuss how NeurWIN trains the Whittle index for one single arm. + +# 4.1 CONDITIONS FOR WHITTLE-ACCURATE + +![](images/813104b72f4ae619d291e6960f1af44abcaecd868b99cd51f9720a4ea53cb9d6.jpg) +Figure 1: An illustrative motivation of NeurWIN. + +Before presenting NeurWIN, we first discuss the conditions for a neural network to be $\gamma \cdot$ -Whittleaccurate. + +Suppose we are given a simulator of an arm and a neural network with parameters $\theta$ . We can then construct an environment of the arm along with an activation cost $\lambda$ as shown in Fig. 1. In each round $t$ , the environment takes the real number $f _ { \theta } ( s [ t ] )$ as the input. The input is first fed into a step function to produce $a [ t ] = 1 \bigl ( f _ { \theta } ( s [ t ] ) \geq \lambda \bigr )$ , where $1 ( \cdot )$ is the indicator function. Then, $a ( t )$ is fed into the simulator of the arm to produce $r [ t ]$ and $s [ t + 1 ]$ . Finally, the environment outputs the net reward $r [ t ] - \lambda a [ t ]$ and the next state $s [ t + 1 ]$ . We call this environment $E n v ( \lambda )$ . Thus, the neural network can be viewed as a controller for $E n v ( \lambda )$ . The following corollary is a direct result from Thm. 1. + +Corollary 1. If $f _ { \boldsymbol { \theta } } ( s ) = W ( s ) , \forall s$ , then the neural network with parameters $\theta$ is the optimal controller for $E n v ( \lambda )$ , for any $\lambda$ and initial state $s [ 1 ]$ . Moreover, given $\lambda$ and $s [ 1 ]$ , the optimal discounted net reward is $\operatorname* { m a x } \{ Q _ { \lambda , a c t } ( s [ 1 ] ) , Q _ { \lambda , p a s s } ( \bar { s } [ 1 ] ) \}$ . + +Corollary 1 can be viewed as a necessary condition for a neural network to be 0-Whittle-accurate. +Below, we establish a sufficient condition for $\gamma$ -Whittle-accuracy. + +Theorem 2. If the arm is strongly indexable, then for any $\gamma > 0$ and an arbitrarily small positive constant $\delta$ , there exists a positive  such that the following statement holds: $H ,$ for any states $s _ { 0 } , s _ { 1 }$ and any activation cost $\bar { \lambda ^ { \prime } } \in [ f _ { \theta } ( s _ { 0 } ) - \delta , f _ { \theta } ( s _ { 0 } ) + \delta ]$ , the discounted net reward of applying a neural network to $E n v ( \lambda )$ with initial state $s _ { 1 }$ is at least $\dot { \operatorname* { m a x } } \{ Q _ { \lambda , a c t } ( s _ { 1 } ) , Q _ { \lambda , p a s s } ( s _ { 1 } ) \} - \epsilon _ { \ i }$ , then the neural network is $\gamma$ -Whittle-accurate. + +Proof. For a given $\gamma$ , let $\epsilon = \operatorname * { m i n } _ { s } \lbrace \operatorname * { m i n } \lbrace Q _ { W ( s ) + \gamma , p a s s } ( s ) - Q _ { W ( s ) + \gamma , a c t } ( s ) , Q _ { W ( s ) - \gamma , a c t } ( s ) -$ $Q _ { W ( s ) - \gamma , p a s s } ( s ) \} \} / 2$ . Since the arm is strongly indexable and $W ( s )$ is its Whittle index, we have $\epsilon > 0$ . + +We prove the theorem by establishing the following equivalent statement: If the neural network is not $\gamma$ -Whittle-accurate, then there exists states $s _ { 0 } , s _ { 1 }$ , activation cost $\lambda \in [ f _ { \theta } ( s _ { 0 } ) - \delta , f _ { \theta } ( s _ { 0 } ) + \delta ]$ , such that the discounted net reward of applying a neural network to $E n v ( \lambda )$ with initial state $s _ { 1 }$ is strictly less than $\operatorname* { m a x } \{ Q _ { \lambda , a c t } ( s _ { 1 } ) , Q _ { \lambda , p a s s } ( s _ { 1 } ) \} - \epsilon$ . + +Suppose the neural network is not $\gamma$ -Whittle-accurate, then there exists a state $s ^ { \prime }$ such that $\left| f _ { \theta } ( s ^ { \prime } ) - \right.$ $W ( s ^ { \prime } ) | > \gamma$ . We set $s _ { 0 } = s _ { 1 } = s ^ { \prime }$ . For the case $f _ { \theta } ( s ^ { \prime } ) > W ( s ^ { \prime } ) + \gamma$ , we set $\lambda = f _ { \boldsymbol { \theta } } ( s ^ { \prime } ) + \delta$ . Since $\lambda > W ( s ^ { \prime } ) + \gamma$ , we have $\operatorname* { m a x } \{ Q _ { \lambda , a c t } ( s ^ { \prime } ) , Q _ { \lambda , p a s s } ( s ^ { \prime } ) \} = Q _ { \lambda , p a s s } ( s ^ { \prime } )$ and $Q _ { \lambda , p a s s } ( s ^ { \prime } ) \_$ $Q _ { \lambda , a c t } ( s ^ { \prime } ) \geq 2 \epsilon$ . On the other hand, since $f _ { \theta } ( s ^ { \prime } ) > \lambda$ , the neural network would activate the arm in the first round and its discounted reward is at most + +$$ +Q _ { \lambda , a c t } ( s ^ { \prime } ) < Q _ { \lambda , p a s s } ( s ^ { \prime } ) - 2 \epsilon < \operatorname * { m a x } \{ Q _ { \lambda , a c t } ( s ^ { \prime } ) , Q _ { \lambda , p a s s } ( s ^ { \prime } ) \} - \epsilon . +$$ + +For the case $f _ { \theta } ( s ^ { \prime } ) < W ( s ^ { \prime } ) - \gamma$ , a similar argument shows that the discounted reward for the neural network when $\lambda = f _ { \boldsymbol { \theta } } \big ( \boldsymbol { s } ^ { \prime } \big ) - \delta$ is smaller than $\operatorname* { m a x } \{ Q _ { \lambda , a c t } ( s ^ { \prime } ) , Q _ { \lambda , p a s s } ( s ^ { \prime } ) \} - \epsilon$ . This completes the proof. □ + +# 4.2 TRAINING PROCEDURES FOR NEURWIN + +Thm. 2 states that a neural network that yields near-optimal net reward for any environments $E n v ( \lambda )$ is also Whittle-accurate. This observation motivates the usage of deep reinforcement learning to find Whittle-accurate neural networks. To make the output of the environments differentiable with respect to the input $f _ { \theta } ( s [ t ] )$ , we replace the step function in Fig. 1 with a sigmoid function $\sigma _ { m } ( f _ { \theta } ( s [ t ] ) - \lambda ) : = \left( 1 + e x p ( - m ( f _ { \theta } ( s [ t ] ) - \lambda ) ) \right) ^ { - 1 }$ , where $m$ is a sensitivity parameter. The environment then chooses $a [ t ] = 1$ with probability $\sigma _ { m } ( f _ { \theta } ( s [ t ] ) - \lambda )$ , and $a [ t ] = 0$ with probability $1 - \sigma _ { m } ( f _ { \theta } ( s [ t ] ) - \lambda )$ . We call this differentiable environment $E n v ^ { * } ( \lambda )$ . + +Our training procedure consists of multiple mini-batches, where each mini-batch is composed of a fixed number of episodes. At the beginning of each mini-batch, we randomly select two states $s _ { 0 }$ and $s _ { 1 }$ . Motivated by the condition in Thm. 2, we consider the environment $\Dot { E n } v ^ { * } ( f _ { \theta } ( s _ { 0 } ) )$ with initial state $s _ { 1 }$ and aim to improve the empirical discounted net reward of applying the neural network to such an environment. + +Our approach is based on the REINFORCE algorithm (Williams, 1992). In each episode $e$ , we set $\lambda = f _ { \theta } ( s _ { 0 } )$ and initial state to be $s _ { 1 }$ . We then apply the neural network with parameters $\theta$ to $E n v ^ { * } ( \lambda )$ and observe the sequences of actions $( a [ 1 ] , a [ 2 ] , \dots )$ and states $( s [ 1 ] , s [ 2 ] , \dots )$ . We can use these sequences to calculate their gradients with respect to $\theta$ through backward propagation, which we denote by $h _ { e }$ . We also observe the discounted net reward and denote it by $G _ { e }$ . After all episodes in the mini-batch finish, we calculate the average of all $G _ { e }$ as a bootstrapped baseline and denote it by $\bar { G } _ { b }$ . Finally, we do a weighted gradient ascent with the weight for episode $e$ being its offset net reward, $G _ { e } - \bar { G } _ { b }$ . When the step size is chosen appropriately, the neural network will be more likely to follow the sequences of actions of episodes with larger $G _ { e }$ after the weighted gradient ascent, and thus will have a better empirical discounted net reward. The complete algorithm is described in Alg. 1. + +Obviously, the choice of $s _ { 0 }$ and $s _ { 1 }$ can have significant impact on the convergence speed of Alg. 1. In our implementation, we choose $s _ { 0 }$ uniformly at random in each mini-batch. The choice of $s _ { 1 }$ depends on the bandit problems. Some bandit problems naturally visit certain states far less frequently than other states. For such problems, we choose $s _ { 1 }$ to be those less-frequently-visited states with higher probabilities, so as to ensure that Alg. 1 is able to learn the optimal control for these states. For other problems, we simply choose $s _ { 1 } = s _ { 0 }$ . + +# Algorithm 1: NeurWIN Training + +
Input: Parameters 0,discount factor β ∈ (O,1),learning rate L,sigmoid parameter m Output: Trained neural network parameters 0+ foreachmini-batchbdo Randomly choose so and s1,and set X ← fe(so) ; foreach episode ein themini-batch do Set the arm to state s1,and set he ←O ; foreach round t in the episode do Choose a[t] =1 w.p.δm(fe(s[t])-λ),and a[t]=O w.p.1-δm(fe(s[t])-λ); if a[t]=1then he←he+Vθln(om(fe(s[t])-λ));
else end Ge ← empirical discounted net reward in episode e;
end
he←he+Vθln(1-δm(fe(s[t])-λ)) ;
+ +# 5 EXPERIMENTS + +# 5.1 OVERVIEW + +In this section, we demonstrate NeurWIN’s utility by evaluating it under three recently studied applications of restless bandit problems. In each application, we consider that there are $N$ arms and a controller can play $M$ of them in each round. We evaluate three different pairs of $( N , M )$ : $( 4 , 1 )$ , (100, 10), and (100, 25), and average the results of 200 independent runs when the problems are stochastic. Some applications consider that different arms can have different behaviors. For such scenarios, we consider that there are multiple types of arms and train a separate NeurWIN for each type. During testing, the controller calculates the index of each arm based on the arm’s state and schedules the $M$ arms with the highest indices. + +The performance of NeurWIN is compared against the proposed policies in the respective recent studies. In addition, we also implement and evaluate the REINFORCE algorithm (Williams, 1992) and the QWIC algorithm $\mathrm { F u }$ et al., 2019). The REINFORCE algorithm aims to find the optimal control by viewing a restless bandit problem as a Markov decision problem. Under this view, the number of states is exponential in $N$ and the number of possible actions is $\textstyle { \binom { N } { M } }$ . Thus, we are only able to evaluate REINFORCE for the case $N = 4$ and $M = 1$ . The QWIC algorithm aims to find the Whittle index through Q-learning. It is a tabular method and does not scale well as the state space increases. Thus, we only evaluate QWIC when the size of the state space is small. + +We use the same neural network architecture for NeurWIN in all three applications. The neural network is a fully connected one that consists of one input layer, one output layer, and two hidden layers. There are 16 and 32 neurons in the two hidden layers. The output layer has one neuron, and the input layer size is the same as the dimension of the state of one single arm. As for the REINFORCE algorithm, we choose the neural network architecture so that the total number of parameters is slightly more than $N$ times as the number of parameters in NeurWIN to make a fair comparison. ReLU activation function is used for the two hidden layers. An initial learning rate $L = 0 . 0 0 1$ is set for all cases, with the Adam optimizer (Kingma & Ba, 2015) employed for the gradient ascent step. The discount factor is $\beta = 0 . 9 9 9$ and each mini-batch consists of five episodes. + +For all cases, we implement the NeurWIN algorithm using PyTorch (Paszke et al., 2019), and train the agent on a single arm modelled after OpenAI’s Gym API (Brockman et al., 2016). We provide a brief overview of each application and the experiment setting in the following sections. We refer readers to the appendices for detailed discussions on experiment settings. + +# 5.2 RECOVERING BANDITS + +The recovering bandits (Pike-Burke & Grunewalder, 2019) aim to model the time-varying behaviors of consumers. In particular, it considers that a consumer who has just bought a certain product, say, a television, would be much less interested in advertisements of the same product in the near future. However, the consumer’s interest in these advertisements may recover over time. Thus, the recovering bandit models the reward of playing an arm, i.e., displaying an advertisement, by a function $f ( \operatorname* { m i n } \{ z , z _ { m a x } \} )$ , where $z$ is the time since the arm was last played and $z _ { m a x }$ is a constant specified by the arm. There is no known Whittle index or optimal control policy for this problem. + +The recent study (Pike-Burke & Grunewalder, 2019) on recovering bandit focuses on learning the function $f ( \cdot )$ for each arm. Once it obtains an estimate of $f ( \cdot )$ , it uses a heuristic called $d$ -lookahead to determine which arms to play. The $d$ -lookahead policy enumerates all possible actions in the next $d$ rounds, and then pick the sequence of actions that yield that highest reward. Since the controller can choose $M$ arms out of $N$ arms to activate, with $\mathbf { \bar { \rho } } _ { ( \mathcal { M } ) }$ different possibilities, in each round, the complexity of the heuristic is $O ( { \bigl ( } _ { M } ^ { N } ) ^ { d } )$ when $d > 1$ . Thus, we are only able to evaluate 1-lookahead when $N = 1 0 0$ . When $N = 4$ and $M = 1$ , we evaluate 1-lookahead and 3-lookahead. + +In our experiment, we consider that there are four types of arms and there are $\textstyle { \frac { N } { 4 } }$ arms for each type. Different types of arms have different functions $f ( \cdot )$ . The state of each arm is its value of $\operatorname* { m i n } \{ z , z _ { m a x } \}$ and we set $z _ { m a x } = 2 0$ for all arms. + +Experiment results are shown in Fig. 2. It can be observed that NeurWIN is able to outperform 1-lookahead in all settings with just a few thousands of training episodes. In contrast, for the case $N = 4$ and $M = 1$ , REINFORCE only sees slight performance improvement over 50,000 training episodes and remains far worse than NeurWIN. This may be due to the explosion of state space. Even though $N$ is only 4, the total number of possible states is $2 0 ^ { 4 } = 1 6 0 , \bar { 0 } 0 0$ , making it difficult for REINFORCE to learn the optimal control in just 50, 000 episodes. In contrast, since NeurWIN learns the Whittle index of each arm separately, its size of state space is only 20. QWIC performs poorly. This suggests that it does not learn a good approximation to the Whittle index. + +![](images/5bf56f13c24ed50b504ac17e4972420531b4eecafb0182c59a68e16219fd1c75.jpg) +Figure 2: Experiment results for the recovering bandits. + +# 5.3 WIRELESS SCHEDULING + +A recent paper (Aalto et al., 2015) studies the problem of wireless scheduling over fading channels. In this problem, each arm corresponds to a wireless client. Each wireless client has some data to be transmitted and it suffers from a holding cost of 1 unit per round until it has finished transmitting all its data. The channel quality of a wireless client, which determines the amount of data can be transmitted if the wireless client is scheduled, changes over time. The goal is to minimize the sum of holding costs of all wireless clients. Equivalently, we view the reward of the system as the negative of the total holding cost. + +Finding the Whittle index through theoretical analysis is difficult. Even for the simplified case when the channel quality is i.i.d. over time and can only be in one of two possible states, the recent paper (Aalto et al., 2015) can only derive the Whittle index under some approximations. It then proposes a size-aware index policy using its approximated index. + +In the experiment, we adopt the settings of channel qualities of the recent paper. The channel of a wireless client can be in either a good state or a bad state. The amount of data that can be transmitted in a round is $3 3 . 6 \mathrm { k b }$ in a good state, and $8 . 4 \mathrm { k b }$ in a bad state. Initially, the amount of load is uniformly between 0 and 1Mb. The state of each arm is its channel state and the amount of remaining load. The size of state space is $2 \times 1 0 ^ { 6 }$ for each arm. We consider that there are two types of arms, and different types of arms have different probabilities of being in the good state. We train a NeurWIN for each type. During testing, there are $\begin{array} { l } { { \frac { N } { 2 } } } \end{array}$ arms of each type. + +Experiment results are shown in Fig. 3. It can be observed that NeurWIN is able to outperform the size-aware index policy with about 100, 000 training episodes. This result is significant when one considers the fact that the size-aware index is itself an approximation to the Whittle index. The experiment results thus suggest that NeurWIN is able to find a more accurate approximation to the Whittle index than the best known theoretical result. It can also be observed that REINFORCE performs poorly. + +![](images/b00a6b2b41d42aa0651721728336d2c9be570df757da20cb7f02d66a31be05af.jpg) +Figure 3: Average rewards and confidence bounds of different policies for wireless scheduling. + +# 5.4 DEADLINE SCHEDULING + +A recent study (Yu et al., 2018) proposes a deadline scheduling problem for the scheduling of electrical vehicle charging stations. In this problem, a charging station has $N$ charging spots and enough power to charge $M$ vehicles in each round. When a charging spot is available, a new vehicle may join the system and occupy the spot. Upon occupying the spot, the vehicle announces the time that it will leave the station and the amount of electricity that it needs to be charged. The charging station obtains a reward for each unit of electricity that it provides to a vehicle. However, if the station cannot fully charge the vehicle by the time it leaves, then the station needs to pay a penalty. The goal of the station is to maximize its net reward, defined as the difference between the amount of reward and the amount of penalty. Under an i.i.d. arrival assumption, the recent study has derived the precise characterization of the Whittle index, which we refer to as the deadline Whittle index. We further prove that this problem is strongly indexable in the appendix. + +We use exactly the same setting as in the recent study (Yu et al., 2018) for our experiment. In this problem, the state of an arm is denoted by a pair of integers $( D , B )$ , where $B$ is the amount of electricity that the vehicle still needs and $D$ is the time until the vehicle leaves the station. When a charging spot is available, its state is $( 0 , 0 )$ . $B$ is upper-bounded by 9 and $D$ is upper-bounded by 12. Hence, the size of state space is 109 for each arm. + +The experiment results are shown in Fig. 4. It can be observed that the performance of NeurWIN converges to that of the deadline Whittle index in less than 500 training episodes. + +![](images/2bbc46602e332d404ac7433f5a1535d09e1cd933747c841a3a8b26b17d64317e.jpg) +Figure 4: Average rewards and confidence bounds of different policies for deadline scheduling. + +# 5.5 EXPERIMENT RESULTS WITH NOISY SIMULATORS + +The training of NeurWIN requires a simulator for each arm. In this section, we evaluate the performance of NeurWIN when the simulator is not perfectly precise. In particular, let $R _ { a c t } ( s )$ and $R _ { p a s s } ( s )$ be the rewards of an arm in state $s$ when it is activated and not activated, respectively. Then, the simulator estimates that the rewards are $R _ { a c t } ^ { \prime } ( s ) = ( 1 + G _ { a c t , s } ) R _ { a c t } ( s )$ and $R _ { p a s s } ^ { \prime } ( s ) = ( 1 + G _ { p a s s , s } ) R _ { i , p a s s } ( s )$ , respectively, where $G _ { a c t , s }$ and $G _ { p a s s , s }$ are independent Gaussian random variables with mean 0 and variance 0.05. In other words, the simulator has an average $5 \%$ error in its reward estimation. + +We train NeurWIN using the noisy simulators for the recovering bandits problem and the deadline scheduling problem. For each problem, we compare the performance of NeurWIN against the respective baseline policies. Unlike NeurWIN, the baseline policies make decisions based on the true reward functions rather than the estimated ones. The results for the case $N = 1 0 0$ and $M = 2 5$ are shown in Fig. 5. It can be observed that NeurWIN is still able to achieve superior performance. + +![](images/3e0feb9328226ec698239a24b784b0f767b13523662b428e1d2fd6ff24192b24.jpg) +Figure 5: Experiment results for NeurWIN with noisy simulators. + +# 6 CONCLUSION + +This paper introduced NeurWIN: a deep RL method for estimating the Whittle index for restless bandit problems. The performance of NeurWIN is evaluated by three different restless bandit problems. In each of them, NeurWIN significantly outperforms state-of-the-art control policies in terms of the total discounted reward. + +NeurWIN can have important implications for restless bandit problems. There are many problems where the environments are well-defined, but the optimal control is not known. NeurWIN can obviously be used for such problems. For problems where the environments are not known a priori, NeurWIN nicely compliments existing studies that aim to learn the environments through online learning but fail to find the optimal control policy. + +# REFERENCES + +Samuli Aalto, Pasi Lassila, and Prajwal Osti. Whittle index approach to size-aware scheduling with time-varying channels. In Proceedings of the 2015 ACM SIGMETRICS International Conference on Measurement and Modeling of Computer Systems, pp. 57–69, 2015. + +K. Avrachenkov and V. S. Borkar. A learning algorithm for the whittle index policy for scheduling web crawlers. In 2019 57th Annual Allerton Conference on Communication, Control, and Computing (Allerton), pp. 1001–1006, 2019. + +V. S. Borkar and K. Chadha. A reinforcement learning algorithm for restless bandits. In 2018 Indian Control Conference (ICC), pp. 89–94, 2018. + +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. + +Christopher R Dance and Tomi Silander. When are kalman-filter restless bandits indexable? In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 1711–1719. Curran Associates, Inc., 2015. URL http://papers.nips.cc/paper/5922-when-are-kalman-filterrestless-bandits-indexable.pdf. + +Christoph Dann, Tor Lattimore, and Emma Brunskill. Unifying pac and regret: Uniform pac bounds for episodic reinforcement learning. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, pp. 5717–5727, Red Hook, NY, USA, 2017. Curran Associates Inc. ISBN 9781510860964. + +J. Fu, Y. Nazarathy, S. Moka, and P. G. Taylor. Towards q-learning the whittle index for restless bandits. In 2019 Australian New Zealand Control Conference (ANZCC), pp. 249–254, 2019. + +Nan Jiang, Akshay Krishnamurthy, Alekh Agarwal, John Langford, and Robert E. Schapire. Contextual decision processes with low Bellman rank are PAC-learnable. volume 70 of Proceedings of Machine Learning Research, pp. 1704–1713, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http://proceedings.mlr.press/v70/ jiang17c.html. + +Diederick P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. + +J. Le Ny, M. Dahleh, and E. Feron. Multi-uav dynamic routing with partial observations using restless bandit allocation indices. In 2008 American Control Conference, pp. 4220–4225, 2008. + +Alex S. Leong, Arunselvan Ramaswamy, Daniel E. Quevedo, Holger Karl, and Ling Shi. Deep reinforcement learning for wireless sensor scheduling in cyber–physical systems. Automatica, 113:108759, 2020. ISSN 0005-1098. doi: https://doi.org/ 10.1016/j.automatica.2019.108759. URL http://www.sciencedirect.com/science/ article/pii/S0005109819306223. + +R. Meshram, D. Manjunath, and A. Gopalan. On the whittle index for restless multiarmed hidden markov bandits. IEEE Transactions on Automatic Control, 63(9):3046–3053, 2018. + +Jose Ni ´ no-Mora. Dynamic priority allocation via restless bandit marginal productivity indices. ˜ Top, 15(2):161–198, 2007. + +Christos H. Papadimitriou and John N. Tsitsiklis. The complexity of optimal queuing network control. Mathematics of Operations Research, 24(2):293–305, 1999. ISSN 0364765X, 15265471. URL http://www.jstor.org/stable/3690486. + +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, ´ and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8026–8037. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/9015-pytorchan-imperative-style-high-performance-deep-learning-library.pdf. + +Ciara Pike-Burke and Steffen Grunewalder. Recovering bandits. In Advances in Neural Information Processing Systems, pp. 14122–14131, 2019. + +Carlos Riquelme, George Tucker, and Jasper Snoek. Deep bayesian bandits showdown: An empirical comparison of bayesian deep networks for thompson sampling. In International Conference on Learning Representations (ICLR), 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SyYe6k-CW. + +Julien Seznec, Pierre Menard, Alessandro Lazaric, and Michal Valko. A single algorithm for both restless and rested rotting bandits. In International Conference on Artificial Intelligence and Statistics, pp. 3784–3794, 2020. + +Aleksandrs Slivkins and Eli Upfal. Adapting to a changing environment: the brownian restless bandits. In COLT, pp. 343–354, 2008. + +Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. The MIT Press, second edition, 2018. URL http://incompleteideas.net/book/the-book2nd.html. + +V. Tripathi and E. Modiano. A whittle index approach to minimizing functions of age of information. In 2019 57th Annual Allerton Conference on Communication, Control, and Computing (Allerton), pp. 1160–1167, 2019. + +S. Wang, H. Liu, P. H. Gomes, and B. Krishnamachari. Deep reinforcement learning for dynamic multichannel access in wireless networks. IEEE Transactions on Cognitive Communications and Networking, 4(2):257–265, 2018. + +T. Wei, Yanzhi Wang, and Q. Zhu. Deep reinforcement learning for building hvac control. In 2017 54th ACM/EDAC/IEEE Design Automation Conference (DAC), pp. 1–6, 2017. + +Peter Whittle. Restless bandits: Activity allocation in a changing world. Journal of applied probability, pp. 287–298, 1988. + +Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn., 8(3–4):229–256, May 1992. ISSN 0885-6125. doi: 10.1007/ BF00992696. URL https://doi.org/10.1007/BF00992696. + +Huizhen Yu and Dimitri P Bertsekas. Convergence results for some temporal difference methods based on least squares. IEEE Transactions on Automatic Control, 54(7):1515–1531, 2009. + +Z. Yu, Y. Xu, and L. Tong. Deadline scheduling as restless bandits. IEEE Transactions on Automatic Control, 63(8):2343–2358, 2018. + +Andrea Zanette and Emma Brunskill. Problem dependent reinforcement learning bounds which can identify bandit structure in MDPs. volume 80 of Proceedings of Machine Learning Research, pp. 5747–5755, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL ¨ http: //proceedings.mlr.press/v80/zanette18a.html. + +Qing Zhao. Multi-armed bandits: Theory and applications to online learning in networks. Synthesis Lectures on Communication Networks, 12(1):1–165, 2019. + +# A RECOVERING BANDITS’ TRAINING AND INFERENCE DETAILS + +A.1 FORMULATED RESTLESS BANDIT FOR THE RECOVERING BANDITS’ CASE + +We list here the terms that describes one restless arm in the recovering bandits’ case: + +State $s [ t ]$ : The state is a single value $s [ t ] = z [ t ]$ called the waiting time. The waiting time $z [ t ]$ indicates the time since the arm was last played. The arm state space is determined by the maximum allowed waiting time $z _ { m a x }$ , giving a state space $\begin{array} { r } { \boldsymbol { S } : = [ 1 , \boldsymbol { z } _ { m a x } ] } \end{array}$ . + +Action $a [ t ]$ : As with all other considered cases, the agent can either activate the arm $a [ t ] = 1$ , or not select it $a [ t ] = 0$ . The action space is then $\mathcal { A } : = \{ 0 , \bar { 1 } \}$ . + +Reward $r [ t ]$ : The reward is provided by the recovering function $f ( z [ t ] )$ , where $z [ t ]$ is the time since the arm was last played at time $t$ . If the arm is activated, the function value at $z [ t ]$ is the earned reward. A reward of zero if given if the arm is left passive $a [ t ] = 0$ . Figure 6 shows the four recovering functions used in this work. The recovering functions are generated from, + +$$ +f ( z [ t ] ) = \theta _ { 0 } ( 1 - e ^ { - \theta _ { 1 } \cdot z [ t ] } ) +$$ + +Where the $\Theta = [ \theta _ { 0 } , \theta _ { 1 } ]$ values specify the recovering function. The $\Theta$ values for each class are given in table 1. + +Table 1: $\Theta$ values used in the recovering bandits’ case + +
Class00Value01 Value
0.2
A B100.4
C8.5
70.6
D5.50.8
+ +Next state $s [ t + 1 ]$ : The state evolves based on the selected action. If $a [ t ] = 1$ , the state is reset to $s [ t + 1 ] = 1$ , meaning that bandit’s reward decayed to the initial waiting time $z [ t + 1 ] = 1$ . If the arm is left passive $a [ t ] = 0$ , the next state becomes $s [ t + 1 ] = \operatorname* { m i n } \{ z [ t ] \stackrel { . } { + } 1 , z _ { m a x } \stackrel { . } { } \}$ . + +![](images/af098c94a1f0a3ff3003bc87e200546e98380804865b6986ea25688d9ac2b542.jpg) +Figure 6: The selected recovering functions for the recovering bandits’ case. For testing, we set each quarter of the instantiated $N$ arms to one of the shown $f ( z )$ functions. + +# A.2 TRAINING SETTING + +The general training procedure for the NeurWIN algorithm is outlined in its pseudo code in section 4. Here we discuss the parameter selection and details specific to the recovering bandits’ case. We train the neural network using NeurWIN for 50, 000 episode, and save the trained parameters at an episode interval of 100 episodes. The purpose of saving the parameters is to infer their control policies, and compare it with the 1-lookahead policy. In total, for 50, 000 training episodes, we end up with 500 models for inference. The selected neural network has 609 trainable parameters given as $\{ 1 , 1 6 , 3 2 , 1 \}$ layer neurons. + +For training parameters, we select the sigmoid value $m = 5$ , the episode’s time horizon $T = 1 0 0$ timesteps, the mini-batch size to 5 episodes, and the discount factor $\beta = 0 . 9 9 9$ . As with all other cases, each mini-batch of episodes has the same initial state $s [ t = 1 ]$ which is provided by the arm. To ensure the agent experiences as many states in $[ 1 , z _ { m a x } ]$ as possible, we set an initial state sampling distribution given as P r{s[t = 1] = z} = 2z21+22+...+2zmax . H ence, the probability of selecting the initial state to be $s [ t = 1 ] = z _ { m a x }$ is 0.5. This initialization distribution allows the agent to experience the recovery function’s awards at higher $z$ values. + +At the agent side, we set the activation cost $\lambda$ at the beginning of each mini-batch. $\lambda$ is chosen to be the estimate index value $f _ { \theta } ( s ^ { ' } )$ of a randomly selected state in $s ^ { ' } \in [ 1 , z _ { m a x } ]$ . The training continues as described in NeurWIN’s pseudo code: the agent receives the state, and selects an action $a [ t ]$ . If the agent activates the arm $a [ t ] = 1$ , it receives a reward equal to the recovery function’s value at $z$ , and subtracts $\lambda$ from it. Otherwise, the reward $r [ t ]$ is kept the same for $a [ t ] = 0$ . We note that no noise was added with the clean simulator, and the agent discounts the original reward value $\beta ^ { t } r [ t ] = \beta ^ { t } f ( z [ t ] )$ . The process continues for all timesteps in the episode up to $T = 1 0 0$ , and for remaining mini-batch episodes. A gradient ascent step is taken on the bootstrapped mini-batch return as described in section 4. + +# A.3 INFERENCE SETTING + +The inference setup measures NeurWIN’s control policy for several $\binom { N } { M }$ settings. We test, for a single run, the control policies of NeurWIN and 1-lookahead over a time horizon $T \ : = \ : 3 0 0 0$ timesteps. We set $N$ arms such that a quarter have one recovering function class from table 1. For example, when $N = 1 0 0$ , 25 arms would have recovering function A that generates their rewards. + +At each timestep, the 1-lookahead policy ranks the recovering functions reward values, and selects the $M$ arms with the highest reward values for activation. The incurred discounted reward at time $t$ is the discounted sum of all activated arms’ rewards. The total discounted reward is then the discounted rewards over time horizon $T = 3 0 0 0$ . For inferring NeurWIN’s control policy, we record the total discounted reward for each of the 500 models. An example testing procedure is as follows: we instantiate $N$ arms each having a neural network trained to 10, 000 episodes. At each timestep $t$ , the neural networks provide the estimated index $f _ { i , \theta } ( s _ { i } [ t ] )$ for $i = 1 , 2 , \dots , N$ . The control policy activates the $M$ arms with the highest index values. The incurred discounted reward at time $t$ is the discounted sum of all activated arm’s rewards $\begin{array} { r } { \beta ^ { t } R [ t ] = \beta ^ { t } \sum _ { j = 1 } ^ { M } f _ { j } ( z [ t ] ) } \end{array}$ . The same process continues for all timesteps in the horizon $T = 3 0 0 0$ . We then load the model parameters trained on 10, 100 episodes, and repeat the aforementioned testing process using the same seed values. + +# A.4 REINFORCE TRAINING AND INFERENCE SETTING ON RECOVERING BANDITS + +The REINFORCE algorithm was applied only the $\textstyle { \binom { N } { M } }$ case where $N \ = \ 4$ , and $M \ = \ 1$ . For training, REINFORCE had four arms each with one of the recovery functions detailed in table 1. The training parameters are: initial learning rate $L = 0 . 0 0 1$ , mini-batch size is 5 episodes, and a training episode time horizon $T = 1 0 0$ timesteps. Training was done up to 50, 000 episodes, where the trained parameters were saved at an interval of 100 episodes. The selected neural network had 2504 trainable parameters. This neural network size is larger than $6 0 9 \times 4 = 2 4 3 6$ parameters of four NeurWIN neural networks. + +For testing, the same procedure is followed as in A.3. The trained REINFORCE models were loaded, and each tested on the same arms as NeurWIN and deadline Whittle index policies. The testing was made for all 500 trained model (each being trained up to a different episode count). The final control policy result was plotted along with NeurWIN and the 1-lookahead policies for $\binom { 4 } { 1 }$ arms. + +# A.5 QWIC TRAINING AND INFERENCE SETTING ON RECOVERING BANDITS + +The Q-learning Whittle Index Controller (was trained in an offline setting using fixed WIC) pserestless a deth given in activatio $\mathrm { F u }$ et a(i.e. . $N$ $M$ ${ \binom { 4 } { 1 } } \ { \binom { 1 0 0 } { 1 0 } } \ { \binom { \bar { 1 } 0 0 } { 2 5 } } \ )$ $\lambda \in \Lambda$ as index for each state. The algorithm +learns $\mathrm { Q }$ function $Q \in \mathbb { R } ^ { \Lambda \times S \times \{ 0 , 1 \} }$ . The estimated index $\tilde { \lambda } [ s ]$ per state $s$ is determined during +training as, + +$$ +\tilde { \lambda } [ s ] = \operatorname * { a r g m i n } _ { \lambda \in \Lambda } \vert Q ( \lambda , s , 1 ) - Q ( \lambda , s , 0 ) \vert +$$ + +Hence, the converged index values and control performance depends on the initial set of candidate values $\Lambda$ . We select $\Lambda$ to be 100 values evenly spaced in the interval [0, 10]. We note the set selection was based on NeurWIN’s learned index values, which provides an advantage to QWIC training. + +The exploration-exploitation trade-off is steered by parameter $\epsilon$ . $\epsilon$ is initialized to $\epsilon _ { m a x } = 1$ , and decays with factor $\alpha = 0 . 0 1$ to $\epsilon _ { m i n } = 0 . 0 1$ . $\epsilon$ is updated at each timestep during training until it settles at $\epsilon _ { m i n }$ . + +Other training parameters were selected as: initial learning rate $L = 0 . 0 0 1$ , training episode time horizon of $T = 1 0 0$ timesteps, discount factor $\beta ~ = ~ 0 . 9 9 9$ , . Training was done up to 50, 000 episodes, where the Q-learned indices $\bar { \Lambda }$ were saved at an interval of 100 episodes. + +For testing, we use the same testing setting as in NeurWIN and REINFORCE. The learned indices are loaded for each training interval. In total, 500 estimated index mappings were tested for 200 independent runs, each trained up to a certain episode limit. + +# B WIRELESS SCHEDULING TRAINING AND INFERENCE DETAILS + +B.1 RESTLESS ARM DEFINITION FOR THE WIRELESS SCHEDULING CASE + +As with the recovering bandits’ case, we first list the state $s [ t ]$ , action $a [ t ]$ , reward $r [ t ]$ , and next state $s [ t + 1 ]$ that forms one restless arm: + +State $s [ t ]$ : The state is a vector $( y [ t ] , v [ t ] )$ , where $y [ t ]$ is the arm’s remaining load in bits, and $v [ t ]$ is the wireless channel’s state indicator. $v [ t ] = 1$ means a good channel state and a higher transmission rate $r _ { 2 }$ , while $v [ t ] = 0$ is a bad channel state with a lower transmission rate $r _ { 1 }$ . + +Action $a [ t ]$ : The agent either activates the arm $a [ t ] = 1$ , or keeps it passive $a [ t ] = 0$ . The reward and next state depend on the chosen action. + +Reward $r [ t ]$ : The arm’s reward is the negative of holding cost $\psi$ , which is a cost incurred at each timestep for not completing the job. If the selected action $a [ t ] = 1$ , then the reward at time $t$ is $r [ t ] = \bar { - } \psi - \lambda$ . Otherwise, reward is just $r [ t ] = - \psi$ . + +Next state $s [ t + 1 ]$ : The next state evolves differently as given below, + +$$ +s [ t + 1 ] = \left\{ { \begin{array} { l l } { ( y [ t ] - r _ { 2 } , 1 ) \qquad } & { { \mathrm { i f ~ } } q ( v [ t ] ) = 1 , a [ t ] = 1 } \\ { \qquad } \\ { ( y [ t ] - r _ { 1 } , 0 ) \qquad } & { { \mathrm { i f ~ } } q ( v [ t ] ) = 0 , a [ t ] = 1 } \\ { \qquad } \\ { ( y [ t ] , q ( v [ t ] ) ) \qquad } & { { \mathrm { o t h e r w i s e } } } \end{array} } \right. +$$ + +Where $q ( v [ t ] )$ is the probability of a good channel state. + +# B.2 TRAINING SETTING + +We again emphasize that NeurWIN training happens only on one restless arm. The general training procedure was described in NeurWIN’s pseudo code. This discussion pertains only to the wireless scheduling case. + +The neural network has 625 trainable parameters given as $\{ 2 , 1 6 , 3 2 , 1 \}$ neuron layers. The training happens for 1, 000, 000 episodes, and we save the model parameters at each 1000 episodes. Hence, the training results in 1000 models trained up to different episode limit. + +For the wireless scheduling case, we set the sigmoid value $m = 0 . 0 1$ , mini-batch size to 5 episodes, and the discount factor to $\beta = 0 . 9 9 9$ . Episode time horizon is dependent on the remaining job size $y [ t ]$ . The episode terminates either if $y [ t ] = 0$ or $t = 3 0 0 0$ . The holding cost is set to $c = 1$ , which is incurred for each timestep the job is not completed. We also set the good transmission rate $r _ { 2 } = 3 3 . 6 \mathrm { k b }$ , and the bad channel transmission rate $r _ { 1 } = 8 . 4 \mathrm { k b }$ . During training, the good channel probability is $q ( v [ t ] ) = 0 . 5$ . + +The episode defines one job size sampled uniformly from the range $y [ t = 1 ] \sim ( 0 , 1 \mathrm { M b } ]$ . All episodes in one mini-batch have the same initial state, as well as the same sequence of good channel states $[ v [ t = 1 ] , v [ t = 2 ] , \ldots , v [ t = T ] ]$ . + +At the agent side, NeurWIN receives the initial state $s [ t = 1 ]$ , and sets the activation cost $\lambda =$ $f _ { \theta } ( s [ t = 1 ] )$ for all timesteps of all mini-batch episodes. As mentioned before, we save the trained model at an interval of 1000 episodes. For $1 , 0 0 0 , 0 0 0$ episodes, this results in 1000 models trained up to their respective episode limit. + +# B.3 INFERENCE SETTING + +For testing, the aim is to measure the trained models’ control performance against the size-aware index. We instantiate $N$ arms and activate $M$ arms at each timestep $t$ until all users’ jobs terminate. We average the total discounted reward for all control policies over 200 independent inference runs. Half of the arms have a good channel probability $q ( v [ \bar { t } ] ) = 0 . 7 5$ . The other half has a good channel probability $q ( v [ t ] ) = 0 . 1$ . + +We compare NeurWIN’s control policy at different training episodes’ limits with the size-aware index policy. The size-aware index is defined as follows: at each timestep, the policy prioritizes arms in the good channel state, and calculates their secondary index. The secondary index $\hat { v } _ { i }$ of arm $i$ state $( y _ { i } [ t ] , v _ { i } [ t ] )$ is defined as, + +$$ +\hat { v } _ { i } ( y _ { i } [ t ] , v _ { i } [ t ] ) = \frac { c _ { i } r _ { i , 2 } } { y _ { i } [ t ] } +$$ + +The size-aware policy then activates the highest $M$ indexed arms. In case the number of good channel arms is below $M$ , the policy also calculate the primary index of all remaining arms. The primary index $v _ { i }$ of arm $i$ state $( y _ { i } [ t ] , v _ { i } [ t ] )$ is defined as, + +$$ +v _ { i } ( y _ { i } [ t ] , v _ { i } [ t ] ) = \frac { c _ { i } } { q _ { i } [ t ] ( r _ { i , 2 } / r _ { i , 1 } ) - 1 } +$$ + +Rewards received from all arms are summed, and discounted using $\beta = 0 . 9 9 9$ . The inference phase proceeds until all jobs have been completed. + +For NeurWIN’s control policy, we record the total discounted reward for the offline-trained models. For example, we set $N$ arms each coupled with a model trained on $1 0 , 0 0 0$ episodes. The models output their arms’ indices, and the top $M$ indexed arms are activated. In case the remaining arms are less than the sum $M$ , we activate all remaining arms at timestep ll arms’ rewards. Once testing for the curre $t$ . timestep reward t model is finishe $\begin{array} { r } { \beta ^ { t } R [ t ] = \beta ^ { t } \sum _ { i = 1 } ^ { N } r [ t ] } \end{array}$ isel 11, 000 for each arm, and repeat the process. We note that the arms’ initial loads are the same across runs, and that the sequence of good channel states is random. + +# B.4 REINFORCE TRAINING AND INFERENCE SETTING ON WIRELESS SCHEDULING + +The REINFORCE algorithm was applied only the $\binom { 4 } { 1 }$ case. The four arms have the same training setting as described in section B.2. The training parameters are: initial learning rate $L = 0 . 0 0 1$ mini-batch size is 5 episodes, and good channel probability for all four arms $q ( v [ t ] ) = 0 . 5$ . The episode time horizon has a hard limit of $\bar { T } = \dot { 3 0 0 0 }$ timesteps. However, an episode can terminate if all arms’ loads were fully processed (i.e. episodes, where the trained parameters were sav $\begin{array} { r } { \sum _ { i = 1 } ^ { 4 } y _ { i } [ t ] = 0 } \end{array}$ ). Training was done up to 100, 000of 1000 episodes. The selected neural network had 2532 trainable parameters so to have slightly more parameters than four NeurWIN neural networks. + +For testing, the same procedure is followed as in B.3. The trained REINFORCE models were loaded, and each tested on the same arms as NeurWIN and size-aware index. The final control policy result was plotted along with NeurWIN and Whittle index policy for the $\binom { 4 } { 1 }$ testing setup. + +# C DEADLINE SCHEDULING TRAINING AND INFERENCE DETAILS + +C.1 FORMULATED RESTLESS BANDIT FOR THE DEADLINE SCHEDULING CASE + +The state $s [ t ]$ , action $a [ t ]$ , reward $r [ t ]$ , and next state $s [ t + 1 ]$ of one arm are listed below: + +State $s [ t ]$ : The state is a vector $( D , B )$ . $B$ denotes the job size (i.e. amount of electricity needed for an electric vehicle), and $D$ is the job’s time until the hard drop deadline $d$ is reached (i.e. time until an electric vehicle leaves). + +Action $a [ t ]$ : The agent can either activate the arm $a [ t ] = 1$ , or leave it passive $a [ t ] = 0$ . The next state changes based on two different transition kernels depending on the selected action. The reward is also dependent on the action at time $t$ . + +Reward $r [ t ]$ : The agent, at time $t$ , receives a reward $r [ t ]$ from the arm, + +$$ +r [ t ] = \left\{ \begin{array} { l l } { ( 1 - c ) a [ t ] } & { \mathrm { ~ i f ~ } B [ t ] > 0 , D [ t ] > 1 } \\ { \qquad } \\ { ( 1 - c ) a [ t ] - F ( B [ t ] - a [ t ] ) } & { \mathrm { ~ i f ~ } B [ t ] > 0 , D [ t ] = 1 } \\ { \qquad } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right. +$$ + +Where $c$ is a constant processing cost incurred when activating the arm, $F ( B [ t ] - a [ t ] )$ is the penalty function for failing to complete the job before $D = 1$ . The penalty function was chosen to be $F ( B [ t ] - a [ t ] ) = \bar { 0 } . 2 ( B [ t ] - a [ t ] ) ^ { 2 }$ . + +Next state $s [ t + 1 ]$ : The next state $D [ t + 1 ]$ decreases by one, while the job size $B$ depends on the selected action as, + +$$ +s [ t + 1 ] = \left\{ \begin{array} { l l } { ( D [ t ] - 1 , B [ t ] - a [ t ] ) \qquad } & { \mathrm { ~ i f ~ } D [ t ] > 1 } \\ { \qquad } \\ { ( D , B ) \mathrm { ~ w i t h ~ p r o b . ~ } Q ( D , B ) \qquad } & { \mathrm { ~ i f ~ } D [ t ] \leq 1 } \end{array} \right. +$$ + +Where $Q ( D , B )$ is the arrival probability of a new job (i.e. a new electric vehicle arriving at a charging station) if the position is empty. For training and inference, we set $Q ( D , B ) = 0 . 7$ . + +C.2 STRONG INDEXABILITY PROOF FOR THE DEADLINE SCHEDULING CASE + +It has been shown that the Whittle index for this problem is, + +$$ +v ( D , B ) : = \left\{ \begin{array} { l l } { 0 \qquad } & { \mathrm { i f } \ B = 0 } \\ { \qquad } \\ { 1 - c \qquad } & { \mathrm { i f } \ 1 \leq B \leq D - 1 } \\ { \qquad } \\ { \beta ^ { D - 1 } F ( B - D + 1 ) \qquad } \\ { - \beta ^ { D - 1 } F ( B - D ) + 1 - c \qquad } & { \mathrm { i f } \ D \leq B } \end{array} \right. +$$ + +We further demonstrate that this problem is strongly indexable. + +Theorem 3. The restless bandit for the deadline scheduling problem is strongly indexable. + +Proof. Fix a state $s = ( D , B )$ , the function $D _ { s } ( \lambda ) : = ( Q _ { \lambda , a c t } ( s ) - Q _ { \lambda , p a s s } ( s ) )$ is a continuous and piece-wise linear function since the number of states is finite. Thus, it is sufficient to prove that $D _ { s } ( \lambda )$ is strictly decreasing at all points of $\lambda$ where $D _ { s } ( \lambda )$ is differentiable. Let $L _ { \lambda , a c t } ( s )$ be the sequence of actions taken by a policy that activates the arm at round 1, and then uses the optimal policy starting from round 2. Let $L _ { \lambda , p a s s } ( s )$ be the sequence of actions taken by a policy that does not activate the arm at round 1, and then uses the optimal policy starting from round 2. We prove this theorem by comparing $L _ { \lambda , a c t } ( s )$ and $L _ { \lambda , p a s s } ( s )$ on every sample path. We consider the following two scenarios: + +In the first scenario, $L _ { \lambda , a c t } ( s )$ and $L _ { \lambda , p a s s } ( s )$ are the same starting from round 2. Let $b$ be the remaining job size when the current deadline expires under $L _ { \lambda , a c t } ( s )$ . Since $L _ { \lambda , p a s s } ( s )$ is the same as $L _ { \lambda , a c t } ( s )$ starting from round 2, its remaining job size when the current deadline expires is $b + 1$ . Thus, $D _ { s } ( \lambda ) = 1 - c - \lambda + \beta ^ { D - 1 } ( F ( b + 1 ) - F ( b ) )$ , which is strictly decreasing in $\lambda$ whenever $D _ { s } ( \lambda )$ is differentiable. + +In the second scenario, $L _ { \lambda , a c t } ( s )$ and $L _ { \lambda , p a s s } ( s )$ are not the same after round 2. Let $\tau$ be the first time after round 2 that they are different. Since they are the same between round 2 and round $\tau$ , the remaining job size under $L _ { \lambda , a c t } ( s )$ is no larger than that under $L _ { \lambda , p a s s } ( s )$ . Moreover, the Whittle index is increasing in job size. Hence, we can conclude that, on round $\tau$ , $L _ { \lambda , p a s s } ( s )$ activates the arm and $L _ { \lambda , a c t } ( s )$ does not activate the arm. After round $\tau$ , $L _ { \lambda , a c t } ( s )$ and $L _ { \lambda , p a s s } ( s )$ are in the same state and will choose the same actions for all following rounds. Thus, the two sequences only see different rewards on round 1 and round $\tau$ , and we have $D _ { s } ( \lambda ) = ( 1 - c - \lambda ) ( 1 - \bar { \beta } ^ { \tau - 1 } )$ , which is strictly decreasing in $\lambda$ whenever $D _ { s } ( \lambda )$ is differentiable. + +Combining the two scenarios, the proof is complete. + +# C.3 TRAINING SETTING + +NeurWIN training is made for 1000 episodes on the deadline scheduling case. We save the trained model parameters at an interval of 5 episodes for inferring the control policy after training. Hence, the training produces 200 different set of parameters that output the estimated index given their respective training limit. The neural network had 625 trainable parameters given as $\{ 2 , 1 6 , 3 2 , 1 \}$ , where the input layer matches the state size. + +For the deadline scheduling training, we set the sigmoid value $m = 1$ , episode’s time horizon $T =$ 3000 timesteps, mini-batch size to 5 episodes, and the discount factor $\beta = 0 . 9 9 9$ . The processing cost $c = 0 . 5$ , with the job arrival rate $Q ( D , B ) = 0 . 7 $ . Training procedure follows section 4.2 from the main text. The arm randomly picks an initial state $s [ t = 1 ] = ( D , B )$ , with a maximum $\bar { D } = 1 2$ , and maximum $\bar { B } = 9$ . The arm fixes the initial states across episodes in the same minibatch for proper return comparison. The sequence of job arrivals in an episode’s horizon is also fixed across a mini-batch. For example, one episode in mini-batch 1 would have the sequence $[ ( 1 1 , 5 ) , ( 6 , 2 ) , ( 8 , 4 ) , \dots , ( 3 , 5 ) ]$ , then all other episodes in the same mini-batch would pass the same sequence. This way, the actions taken by the agent would be the critical factor in comparing a mini-batch return, and ultimately in tuning the estimated index value $f _ { \theta } ( \cdot )$ . + +At the agent side, NeurWIN receives the initial state $s [ t = 1 ]$ , sets the activation cost $\begin{array} { r } { \lambda = f _ { \theta } ( s [ t = } \end{array}$ 1]). This activation cost $\lambda$ selection method hence depends on the current network parameters $\theta$ , which are modified after every gradient ascent step. Training follows as described in NeurWIN’s pseudo code. + +In figure 7, we plot the trained NeurWIN index for all possible state enumerations of $\bar { B } = 9$ and $D \in \{ 1 , 2 , 3 \}$ . The output index from the untrained neural network is also plotted for convergence comparison. + +In figure 8, the trained restless bandit indices for noisy reward function is given. All possible states in $\bar { B } = 9$ for $D \in \{ 1 , 2 , 3 \}$ . For $\mathcal { N } ( 0 , 0 . 0 5 )$ added noise per timestep, the learned indices still match the state ordering found when trained with the true reward function. + +![](images/a86f16ada89204cc2a7caa48332f0e559f03826f3f8d9cc091a5819021d55ca5.jpg) +Figure 7: Trained indices using the true reward function. + +![](images/102af8a16f22b31d92b1abdad3ce5377cc2697aeb8f23927ee37a54d5e48cc95.jpg) +Figure 8: Trained indices using the noisy reward function. + +# C.4 INFERENCE SETTING + +In order to infer the resultant control policy, we are required to test the performance on models saved at different episodes’ intervals. In other words, the trained models’ parameters are tested at an interval of episodes, and their discounted rewards are plotted for comparison. + +From the trained models described in C.3, we instantiate $N$ arms, and activate $M$ arms at each timestep. The inference step compares the resultant control policy with the deadline Whittle index $v ( D , B )$ . + +The testing is done for a time horizon of $T = 3 0 0 0$ timesteps. The queue, modelled as $N$ restless arms, has $M$ positions activated at each timestep. Each arm has a unique sequence of job arrivals from other arms that differentiates its index value. For the deadline Whittle index, we calculate the indices according to 8, and activate the highest $M$ indices-associated arms. The accumulated reward from all arm (activated and passive) is then discounted with $\beta$ . + +For NeurWIN control policy, we instantiate $N$ arms, and test the trained models up to a given episode. For example, we load a NeurWIN model trained for 100 episodes on one arm, and set $N$ arms each with its own trained agent on 100 episodes. Once the testing is complete, we load the next model trained at 105 episodes, and repeat the process for 105 episodes. The final result is NeurWIN’s control policy’s performance on $N$ arms given the models’ training. + +We perform the testing over 200 independent runs up to 1000 episodes, where each run the arms are seeded differently. We stress that both the deadline Whittle index and NeurWIN policies were applied on identical seeded arms across the 200 runs. Meaning the sequence of arrivals and rewards experienced was fixed for each arm in each run. Results were provided in the main text for this setting. + +# C.5 REINFORCE TRAINING AND INFERENCE SETTING ON DEADLINE SCHEDULING + +The REINFORCE algorithm was applied on the $\binom { 4 } { 1 }$ testing case. For training, REINFORCE was trained on the same training setting as described in C.3 with the same parameters when appropriate. + +The four restless arms were seeded differently to give unique job sequences. Training was made until 1000 episodes, where the trained parameters were saved at an interval of 5 episodes. The selected neural network had 2532 trainable parameters. The REINFORCE parameters’ count are purposefully slightly larger than $6 2 5 \times 4 = 2 5 0 0$ parameters of four NeurWIN neural networks. + +For testing, the same procedure is followed as explained in C.4. The trained REINFORCE models were loaded, and each tested on the same arms as NeurWIN and deadline Whittle index policies. The testing was made for all 200 trained model (each being trained up to a different episode count). The final control policy result was plotted along with NeurWIN and Whittle index policy for $\binom { 4 } { 1 }$ arms. + +C.6 QWIC TRAINING AND INFERENCE SETTING ON DEADLINE SCHEDULING + +QWIC was trained in an offline setting for the sets ${ \binom { 4 } { 1 } } \ { \binom { 1 0 0 } { 1 0 } } \ { \binom { 1 0 0 } { 2 5 } }$ . We select the same candidate set $\Lambda$ as in the recovering bandits case, which is 100 values evenly spaced in the interval [0, 10]. $\epsilon$ was initialized to $\epsilon _ { m a x } = 1$ , and decays with factor $\alpha = 0 . 0 1$ to $\epsilon _ { m i n } = 0 . 0 1$ . $\epsilon$ is updated at each timestep during training until it decays to $\epsilon _ { m i n }$ . + +Other training parameters: initial learning rate $L = 0 . 0 0 1$ , training episode time horizon of $T =$ 3000 timesteps, discount factor $\beta = 0 . 9 9 9$ , . Training was done up to $1 , 0 0 0$ episodes, where the select $\mathsf { q }$ -learned indices $\bar { \Lambda }$ were saved at an interval of 5 episodes. We test the Q-learning indices using the same setting as NeurWIN and REINFORCE. The estimated index mappings were tested for 200 independent runs. + +We refer the reader to the code for further implementation details. \ No newline at end of file diff --git a/md/train/RHY_9ZVcTa_/RHY_9ZVcTa_.md b/md/train/RHY_9ZVcTa_/RHY_9ZVcTa_.md new file mode 100644 index 0000000000000000000000000000000000000000..1d1cffc842b6e1770bfa5ee084aee3b9764c7c4f --- /dev/null +++ b/md/train/RHY_9ZVcTa_/RHY_9ZVcTa_.md @@ -0,0 +1,467 @@ +# ON LINEAR IDENTIFIABILITY OF LEARNED REPRESENTATIONS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Identifiability is a desirable property of a statistical model: it implies that the true model parameters may be estimated to any desired precision, given sufficient computational resources and data. We study identifiability in the context of representation learning: discovering nonlinear data representations that are optimal with respect to some downstream task. When parameterized as deep neural networks, such representation functions lack identifiability in parameter space, because they are overparameterized by design. In this paper, building on recent advances in nonlinear Independent Components Analysis, we aim to rehabilitate identifiability by showing that a large family of discriminative models are in fact identifiable in function space, up to a linear indeterminacy. Many models for representation learning in a wide variety of domains have been identifiable in this sense, including text, images and audio, state-of-the-art at time of publication. We derive sufficient conditions for linear identifiability and provide empirical support for the result on both simulated and real-world data. + +# 1 INTRODUCTION + +An increasingly common methodology in machine learning is to improve performance on a primary down-stream task by first learning a high-dimensional representation of the data on a related, proxy task. In this paradigm, training a model reduces to fine-tuning the learned representations for optimal performance on a particular sub-task (Erhan et al., 2010). Deep neural networks (DNNs), as flexible function approximators, have been surprisingly successful in discovering effective high-dimensional representations for use in downstream tasks such as image classification (Sharif Razavian et al., 2014), text generation (Radford et al., 2018; Devlin et al., 2018), and sequential decision making (Oord et al., 2018). + +When learning representations for downstream tasks, it would be useful if the representations were reproducible, in the sense that every time a network relearns the representation function on the same data distribution, they were approximately the same, regardless of small deviations in the initialization of the parameters or the optimization procedure. In some applications, such as learning real-world causal relationships from data, such reproducible learned representations are crucial for accurate and robust inference (Johansson et al., 2016; Louizos et al., 2017). A rigorous way to achieve reproducibility is to choose a model whose representation function is identifiable in function space. Informally speaking, identifiability in function space is achieved when, in the limit of infinite data, there exists a single, global optimum in function space. Interestingly, Figure 1 exhibits learned representation functions that appear to be the same up to a linear transformation, even on finite data and optimized without convergence guarantees (see Appendix A.1 for training details). + +In this paper, we account for Figure 1 by making precise the relationship it exemplifies. We prove that a large class of discriminative and autoregressive models are identifiable in function space, up to a linear transformation. Our results extend recent advances in the theory of nonlinear Independent Components Analysis (ICA), which have recently provided strong identifiability results for generative models of data (Hyvärinen et al., 2018; Khemakhem et al., 2019; 2020; Sorrenson et al., 2020). Our key contribution is to bridge the gap between these results and discriminative models, commonly used for representation learning (e.g., (Hénaff et al., 2019; Brown et al., 2020)). + +The rest of the paper is organized as follows. In Section 2, we describe a general discriminative model family, defined by its canonical mathematical form, which generalizes many supervised, selfsupervised, and contrastive learning frameworks. In Section 3, we prove that learned representations in this family have an asymptotic property desirable for representation learning: equality up to a linear transformation. In Section 4, we show that this family includes a number of highly performant models, state-of-the-art at publication for their problem domains, including CPC (Oord et al., 2018), BERT (Devlin et al., 2018), and GPT-2 and GPT-3 (Radford et al., 2018; 2019; Brown et al., 2020). Section 5 investigates the actually realizable regime of finite data and partial optimization, showing that representations learned by members of the identifiable model family approach equality up to a linear transformation as a function of dataset size, neural network capacity, and optimization progress. + +![](images/d6a3113bbeed129e0a21ecfef6c9065bb07fca469ea52e4866e6213f0c68bc18.jpg) +Figure 1: Left and Middle: Two learned DNN representation functions ${ \bf f } _ { \pmb { \theta } _ { 1 } } ( { \boldsymbol { B } } )$ , $\cdot$ visualized on held-out data $\boldsymbol { B }$ . The DNNs are word embedding models Mnih and Teh (2012) trained on the Billion Word Dataset (Chelba et al., 2013) (see Appendix A.1 for code release and training details). Right: $A \mathbf { f } _ { \pmb { \theta } _ { 1 } } ( B )$ and $\cdot$ , where $\pmb { A }$ is a linear transformation learned after training. The overlap exhibits linear identifiability (see Section 3): different representation functions, learned on the same data distribution, live within linear transformations of each other in function space. + +# 2 MODEL FAMILY AND DATA DISTRIBUTION + +The learned embeddings of a DNN are a function not only of the parameters, but also the network architecture and size of dataset (viewed as a sample from the underlying data distribution). This renders any analysis in full generality challenging. To make such an analysis tractable, in this section, we begin by specifying a set of assumptions about the underlying data distribution and model family that must hold for the learned representations to be similar up to a linear transformation. These assumptions are, in fact, satisfied by a number of already published, highly performant models. We establish definitions in this section, and discuss these existing approaches in depth in Section 4. + +Data Distribution We assume the existence of a generalized dataset in the form of an empirical distribution $p _ { \mathcal { D } } ( \mathbf { x } , \mathbf { y } , \mathbf { S } )$ over random variables $\mathbf { x }$ , y and S with the following properties: + +• The random variable $\mathbf { x }$ is an input variable, typically high-dimensional, such as text or an image. +• The random variable y is a target variable whose value the model predicts. In case of object classification, this would be some semantically meaningful class label. However, in our model family, y may also be a high-dimensional context variable, such a text, image, or sentence fragment. +• S is a set containing the possible values of y given x, so $p _ { \mathcal { D } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } ) > 0 \iff \mathbf { y } \in \mathbf { S } .$ + +Note that the set of labels S is not fixed, but a random variable. This allows supervised, contrastive, and self-supervised learning frameworks to be analyzed together: the meaning of S encodes the task. For supervised classification, S is deterministic and contains class labels. For self-supervised pretraining, S contains randomly-sampled high-dimensional variables such as image embeddings. For deep metric learning (Hoffer and Ailon, 2015; Sohn, 2016), the set S contains one positive and $k$ negative samples of the class to which $\mathbf { x }$ belongs. + +Canonical Discriminative Form Given a data distribution as above, a generalized discriminative model family may be defined by its parameterization of the probability of a target variable $\mathbf { y }$ conditioned on an observed variable x and a set S that contains not only the true target label $\mathbf { y }$ , but + +also a collection of distractors $\mathbf { y } ^ { \prime }$ : + +$$ +p _ { \theta } ( \mathbf { y } \vert \mathbf { x } , \mathbf { S } ) = \frac { \exp ( \mathbf { f } _ { \theta } ( \mathbf { x } ) ^ { \top } \mathbf { g } _ { \theta } ( \mathbf { y } ) ) } { \sum _ { \mathbf { y } ^ { \prime } \in \mathbf { S } } \exp ( \mathbf { f } _ { \theta } ( \mathbf { x } ) ^ { \top } \mathbf { g } _ { \theta } ( \mathbf { y } ^ { \prime } ) ) } , +$$ + +The codomain of the functions $\mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } )$ and $\mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } )$ is $\mathbb { R } ^ { M }$ , and the domains vary according to modelling task. For notational convenience both are parameterized by $\pmb \theta \in \Theta$ , but f and $\mathbf { g }$ may use disjoint parts of $\pmb { \theta }$ , meaning that they do not necessarily share parameters. + +With $\mathcal { F }$ and $\mathcal { G }$ we denote the function spaces of $\mathbf { f } _ { \theta }$ and $\mathbf { g } _ { \pmb { \theta } }$ respectively. Our primary domain of interest is when $\mathbf { f } _ { \theta }$ and $\mathbf { g } _ { \theta }$ are highly flexible function approximators, such as DNNs. This brings certain analytical challenges. In neural networks, different choices of parameters $\pmb \theta$ can result in the same functions $\mathbf { f } _ { \pmb { \theta } }$ and $\mathbf { g } _ { \theta }$ , hence the map $\Theta \to { \mathcal { F } } \times { \mathcal { G } }$ is many-to-one. In the context of representation learning, the function $\mathbf { f } _ { \theta }$ is typically viewed as a nonlinear feature extractor, e.g., the learned representation of the input data. While other choices meet the membership conditions for the family defined by the canonical form of Equation (1), in the remainder, we will focus on DNNs in the remainder. We next present a definition of identifiability suitable for DNNs, and prove that members of the above family satisfy it under additional assumptions. + +# 3 MODEL IDENTIFIABILITY + +In this section, we derive identifiability conditions for models in the family defined in Section 2. + +# 3.1 IDENTIFIABILITY IN PARAMETER SPACE + +Identifiability analysis answers the question of whether it is theoretically possible to learn the parameters of a statistical model exactly. Specifically, given some estimator $\pmb { \theta } ^ { \prime }$ for model parameters $\pmb { \theta } ^ { * }$ , identifiability is the property that, for any $\{ \theta ^ { \prime } , \theta ^ { \ast } \} \subset \Theta$ , + +$$ +p _ { \pmb { \theta } ^ { \prime } } = p _ { \pmb { \theta } ^ { * } } \quad \Longrightarrow \quad \pmb { \theta } ^ { \prime } = \pmb { \theta } ^ { * } . +$$ + +Models that do not have this property are said to be non-identifiable. This happens when different values $\{ \theta ^ { \prime } , \theta ^ { \ast } \} \subset \Theta$ can give rise to the same model distribution $p _ { \pmb { \theta } ^ { \prime } } ( \mathbf { y } | \mathbf { x } , \bar { \mathbf { S } } ) = p _ { \pmb { \theta } ^ { * } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } )$ . In such a case, observing an empirical distribution $p _ { \pmb { \theta } ^ { * } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } )$ , and fitting a model $p _ { \pmb { \theta } ^ { \prime } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } )$ to it perfectly does not guarantee that $\pmb { \theta } ^ { \prime } = \pmb { \theta } ^ { * }$ . + +Neural networks exhibit various symmetries in parameter space such that there is almost always a many-to-one correspondence between a choice of $\pmb { \theta }$ and resulting probability function $p _ { \pmb { \theta } }$ . A simple example in neural networks is that one can swap the (incoming and outgoing) connections of two neurons in a hidden layer. This changes the value of the parameters, but does not change the network’s function. Thus, when representation functions $\mathbf { f } _ { \theta }$ or $\mathbf { g } _ { \pmb { \theta } }$ are parameterized as DNNs, equation 2 is not satisfiable. + +# 3.2 IDENTIFIABILITY IN FUNCTION SPACE + +For reliable and efficient representation learning, we want learned representations $\mathbf { f } _ { \theta }$ from two identifiable models to be sufficiently similar for interchangeable use in downstream tasks. The most general property we wish to preserve among learned representations is their ability to discriminate among statistical patterns corresponding to categorical groupings. In the model family defined in Section 2, the data and context functions $\mathbf { f } _ { \theta }$ and $\mathbf { g } _ { \pmb { \theta } }$ parameterize $p _ { \pmb { \theta } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } )$ , the probability of label assignment, through a normalized inner product. This induces a hyperplane boundary, for discrimination, in a joint space of learned representations for data $\mathbf { x }$ and context $\mathbf { y }$ . Therefore, in the following, we will derive identifiability conditions up to a linear transformation, using a notion of similarity in parameter space inspired by Hyvärinen et al. (2018). + +Definition 1. Let $\overset { L } { \sim }$ be a pairwise relation on $\Theta$ defined as: + +$$ +\begin{array} { r } { \pmb { \theta } ^ { \prime } \stackrel { L } { \sim } \pmb { \theta } ^ { * } \iff \mathbf { f } _ { \pmb { \theta } ^ { \prime } } ( \mathbf { x } ) = A \mathbf { f } _ { \pmb { \theta } ^ { * } } ( \mathbf { x } ) } \\ { \mathbf { g } _ { \pmb { \theta } ^ { \prime } } ( \mathbf { y } ) = B \mathbf { g } _ { \pmb { \theta } ^ { * } } ( \mathbf { y } ) } \end{array} +$$ + +where $\pmb { A }$ and $\textbf { { B } }$ are invertible $M \times M$ matrices. See Appendix $\mathbf { B }$ for proof that $\stackrel { \mathrm { L } } { \sim }$ is an equivalence relation. In the remainder, we refer to identifiability up to the equivalence relation $\stackrel { \mathrm { L } } { \sim }$ as $\overset { L } { \sim }$ -identifiable or linearly identifiable. + +# 3.3 LINEAR IDENTIFIABILITY OF LEARNED REPRESENTATIONS + +We next present a simple derivation of the $\stackrel { \mathrm { L } } { \sim }$ -identifiability of members of the generalized discriminative family defined in Section 2. This result reveals sufficient conditions under which a discriminative probabilistic model $p _ { \pmb { \theta } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } )$ has a useful property: the learned representations of the input $\mathbf { x }$ and target random variables $\mathbf { y }$ for any two pairs of parameters $( \theta ^ { \prime } , \theta ^ { * } )$ are related as $\theta ^ { \prime } \stackrel { \triangledown } { \sim } \theta ^ { * }$ , that is, $\mathbf { f } _ { \pmb { \theta } ^ { \prime } } ( \mathbf { x } ) = A \mathbf { f } _ { \pmb { \theta } ^ { * } } ( \mathbf { x } )$ and $\mathbf { g } _ { \pmb { \theta } ^ { \prime } } ( \mathbf { y } ) = \mathbf { \bar { \phi } } B \mathbf { g } _ { \pmb { \theta } ^ { \ast } } ( \mathbf { \bar { y } } )$ . + +We first review the notation for the proof, which is introduced in detail in Section 2. We then highlight an important requirement on the diversity of the data distribution, which must be satisfied for the proof statement to hold. We prove the result immediately after. + +Notation. The target random variables $\mathbf { y }$ , associated with input random variables x, may be class labels (as in supervised classification), or they could be stochastically generated from datapoints x as, e.g., perturbed image patches (as in self-supervised learning). We account for this additional stochasticity as a set-valued random variable S, containing all possible values of $\mathbf { y }$ conditioned on some $\mathbf { x }$ . For brevity, we will use shorthands that drop the parameters $\pmb { \theta }$ : $p ^ { \prime } : = p _ { \pmb { \theta } ^ { \prime } } , p ^ { * } : = p _ { \pmb { \theta } ^ { * } }$ , $\mathbf { f } ^ { * } : = \mathbf { f } _ { \theta ^ { * } } , \mathbf { f } ^ { \prime } : = \mathbf { f } _ { \theta ^ { \prime } } , \mathbf { g } ^ { \prime } : = \mathbf { g } _ { \theta ^ { \prime } }$ . + +Diversity condition. We assume that for any $( \theta ^ { \prime } , \theta ^ { * } )$ for which it holds that $p ^ { \prime } = p ^ { * }$ , and for any distinct tuples given $\mathbf { x }$ , by repeated sampling $\{ ( \mathbf { y } _ { A } ^ { ( i ) } , \mathbf { y } _ { B } ^ { ( i ) } ) \} _ { i = 1 } ^ { M }$ $\mathbf { S } \sim p _ { \mathcal { D } } ( \mathbf { S } | \mathbf { x } )$ such that the matrices and picking $\mathbf { L } ^ { \prime }$ $\mathbf { y } _ { A } , \mathbf { y } _ { B } \in \mathbf { S }$ and $\mathbf { L } ^ { \ast }$ are invertible, where , we can construct a set of $\mathbf { L } ^ { \prime }$ consists $M$ of columns $( \mathbf { g } ^ { \prime } ( \mathbf { y } _ { A } ^ { ( i ) } ) - \mathbf { g } ^ { \prime } ( \mathbf { y } _ { B } ^ { ( i ) } ) )$ , and $\mathbf { L } ^ { \ast }$ consists of columns $\mathbf { g } ^ { * } ( \mathbf { y } _ { A } ^ { ( i ) } ) - \mathbf { g } ^ { * } ( \mathbf { y } _ { B } ^ { ( i ) } )$ , $i \in \{ 1 , \ldots , M \}$ . See Section 3.4 for detailed discussion. + +Theorem 1. Under the diversity condition, models in the family defined by Equation (1) are linearly identifiable. That is, for any $\theta ^ { \prime } , \theta ^ { \ast } \in \Theta$ , and $\mathbf { f } ^ { * } , \mathbf { f } ^ { \prime } , \mathbf { g } ^ { * } , \mathbf { g } ^ { \prime } , p ^ { * } , \bar { p ^ { \prime } }$ defined as in Section 2, + +$$ +p ^ { \prime } = p ^ { * } \implies \pmb { \theta } ^ { \prime } \stackrel { \perp } { \sim } \pmb { \theta } ^ { * } . +$$ + +To establish the result, we proceed by directly constructing an invertible linear transformation that satisfies Definition 1. Consider $\mathbf { y } _ { A } , \mathbf { y } _ { B } \in \mathbf { S }$ . The likelihood ratios for these points + +$$ +\frac { p ^ { \prime } ( \mathbf { y } _ { A } | \mathbf { x } , \mathbf { S } ) } { p ^ { \prime } ( \mathbf { y } _ { B } | \mathbf { x } , \mathbf { S } ) } = \frac { p ^ { * } ( \mathbf { y } _ { A } | \mathbf { x } , \mathbf { S } ) } { p ^ { * } ( \mathbf { y } _ { B } | \mathbf { x } , \mathbf { S } ) } +$$ + +are equal. Substituting our model definition from equation (1), we find: + +$$ +\frac { \exp ( \mathbf { f } ^ { \prime } ( \mathbf { x } ) ^ { \top } \mathbf { g } ^ { \prime } ( \mathbf { y } _ { A } ) ) } { \exp ( \mathbf { f } ^ { \prime } ( \mathbf { x } ) ^ { \top } \mathbf { g } ^ { \prime } ( \mathbf { y } _ { B } ) ) } = \frac { \exp ( \mathbf { f } ^ { * } ( \mathbf { x } ) ^ { \top } \mathbf { g } ^ { * } ( \mathbf { y } _ { A } ) ) } { \exp ( \mathbf { f } ^ { * } ( \mathbf { x } ) ^ { \top } \mathbf { g } ^ { * } ( \mathbf { y } _ { B } ) ) } , +$$ + +where the normalizing constants cancelled out on the left- and right-hand sides. Taking the logarithm, this simplifies to: + +$$ +( \mathbf { g } ^ { \prime } ( \mathbf { y } _ { A } ) - \mathbf { g } ^ { \prime } ( \mathbf { y } _ { B } ) ) ^ { \top } \mathbf { f } ^ { \prime } ( \mathbf { x } ) = ( \mathbf { g } ^ { * } ( \mathbf { y } _ { A } ) - \mathbf { g } ^ { * } ( \mathbf { y } _ { B } ) ) ^ { \top } \mathbf { f } ^ { * } ( \mathbf { x } ) . +$$ + +Note that this equation is true for any triple $\left( \mathbf { x } , \mathbf { y } _ { A } , \mathbf { y } _ { B } \right)$ for which $p _ { \mathcal { D } } ( \mathbf { x } , \mathbf { y } _ { B } , \mathbf { y } _ { B } ) > 0$ . + +We next collect $M$ distinct tuples $( \mathbf { y } _ { A } ^ { ( i ) } , \mathbf { y } _ { B } ^ { ( i ) } )$ so that by repeating Equation (7) $M$ times and by the diversity condition noted above, the resulting difference vectors are linearly independent. We collect these vectors together as the columns of $( M \times M )$ -dimensional matrices $\mathbf { L } ^ { \prime }$ and $\mathbf { L } ^ { \ast }$ , forming the following system of $M$ linear equations: + +$$ +\mathbf { L ^ { \prime } } ^ { \top } \mathbf { f ^ { \prime } } ( \mathbf { x } ) = \mathbf { L ^ { * } } ^ { \top } \mathbf { f ^ { * } } ( \mathbf { x } ) . +$$ + +Since $\mathbf { L } ^ { \prime }$ and $\mathbf { L } ^ { \ast }$ are invertible, we rearrange: + +$$ +\mathbf { f } ^ { \prime } ( \mathbf { x } ) = ( \mathbf { L } ^ { * } \mathbf { L } ^ { \prime - 1 } ) ^ { \top } \mathbf { f } ^ { * } ( \mathbf { x } ) . +$$ + +Hence, $\mathbf { f } ^ { \prime } ( \mathbf { x } ) = \mathbf { A } \mathbf { f } ^ { * } ( \mathbf { x } )$ where $\mathbf { A } = ( \mathbf { L } ^ { * } \mathbf { L } ^ { \prime - 1 } )$ . This completes the first half of the proof. See Appendix $\textrm { C }$ for the second half of the proof, which is similar, and handles the function g. + +# 3.4 DISCUSSION: WHEN DOES THE DIVERSITY CONDITION HOLD? + +Theorem 1 is a constructive proof of existence that exhibits invertible $( M \times M )$ matrices $\mathbf { L } ^ { \prime }$ and $\mathbf { L } ^ { \ast }$ . We require the diversity condition to hold in order to guarantee invertibility. Such a requirement is similar to the conditions in earlier work on nonlinear ICA such as (Hyvärinen et al., 2018), as discussed in Section 6. Informally, this means that there needs to be a sufficient number of possible values $\mathbf { y } \in \mathbf { S }$ . In the case of supervised classification with $K$ classes, S is fixed and of size $K$ . Then, we need $K \ge M + 1$ in order to generate $M$ difference vectors $\mathbf { g } _ { \theta } ( \mathbf { y } ^ { ( 1 ) } ) - \mathbf { g } _ { \theta } ( \mathbf { y } ^ { ( j ) } )$ , $j = 2 , \ldots , M + 1$ . In case of self-supervised or deep metric learning, where $\mathbf { S }$ and y may be algorithmically generated from $\mathbf { x }$ , this requirement is easy to satisfy, as there will typically be a diversity of values of y. The same holds for language models with large vocabularies. However, for supervised classification with a small number of classes, this requirement on the size of S may be restrictive, as we discuss further in Section 4. + +Note that by placing the diversity requirement on the number of classes $K$ , we implicitly assumed that the context representation function $\mathbf { g } _ { \theta }$ has the following property: the $M$ difference vectors span the range of $\mathbf { g } _ { \theta }$ . This is a mild assumption in the context of DNNs: for random initialization and iterative weight updates, this property follows from the stochasticity of the distribution used to initialize the network. Briefly, a set of $M + 1$ unique points $\mathbf { y } ^ { ( j ) }$ such that the $M$ vectors $\mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } ^ { ( 1 ) } ) - \mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } ^ { ( j ) } ) , j = 2 , \dots , M + 1$ are not linearly independent has measure zero. For other choices of $\mathbf { g } _ { \pmb { \theta } }$ , care must be taken to ensure this condition is satisfied. + +What can be said when $\mathbf { L } ^ { \prime }$ and $\mathbf { L } ^ { \ast }$ are ill-conditioned, that is, the ratio between maximum and minimum singular value $\frac { \sigma _ { \mathrm { m a x } } ( \mathbf { L } ) } { \sigma _ { \mathrm { m i n } } ( \mathbf { L } ) }$ (dropping superscripts when a statement apply to both) is large? In the context of a data representation matrix such as $\mathbf { L }$ , this implies that there exists at least one column $\ell _ { j }$ of $\mathbf { L }$ and constants $\lambda _ { k }$ for $k \neq j$ such that $\begin{array} { r } { \| \ell _ { j } - \sum _ { k \neq j } \bar { \lambda } _ { k } \ell _ { k } \| _ { 2 } < \varepsilon } \end{array}$ for small $\varepsilon$ . In other words, sometuple $( \mathbf { y } ^ { ( k ) } , \mathbf { y } ^ { ( i ) } )$ early a linear combination of the others. T such that the resulting difference vector $\ell _ { j } = \dot { \mathbf { g } } _ { \pmb { \theta } } ( \mathbf { y } _ { A } ^ { ( k ) } ) - \mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } _ { B } ^ { ( i ) } )$ ere exists somecan nearly (in the sense above) be written as a linear combination of the other columns. Such near singularity is in this case a function of the choice of samples $\mathbf { y }$ that yield the difference vectors. The issue could be handled by resampling different data points until the condition number of the matrices is satisfactory. This amounts to strengthening the diversity condition. We leave more detailed analysis to future work, as the result will depend on the choice of architectures for f and $\mathbf { g }$ . + +# 4 EXAMPLES OF LINEARLY IDENTIFIABLE MODELS + +The form of Equation (1) is already used as a general approach for a variety of machine learning problems. We present a non-exhaustive sample of such publications, chosen to exhibit the range of applications. Many of these approaches were state-of-the-art at the time of their release: Contrastive Predictive Coding (Hénaff et al., 2019), BERT (Devlin et al., 2018), GPT-2 and GPT-3 (Radford et al., 2018; 2019; Brown et al., 2020), XLNET (Yang et al., 2019), and the triplet loss for deep metric learning (Sohn, 2016). In this section, we discuss how to interpret the functional components of these frameworks with respect to the generalized data distribution of Section 2 and canonical parameterization of Equation (1). See Appendix D for reductions to the canonical form of Equation (1). + +Supervised Classification. Although the scope of this paper is identifiable representation learning, under certain conditions, standard supervised classifiers can learn identifiable representations as well. In this case, the number of classes must be strictly greater than the feature dimension, as noted in Section 3.4. We simulate such a model in Section 5.1 to show evidence of its linear identifiability. We stress that representation learning as pretraining for classification is a way to ensure that the conditions on label diversity are met, rather than relying on the supervised classifier itself to generate identifiable representations. This paradigm is discussed in the next subsection. + +Representations learned during supervised classification can be linearly identifiable under the following model specification. The input random variables $\mathbf { x }$ represent some data domain to be classified, such as images or word embeddings. The target variables $\mathbf { y }$ represent label assignments for $\mathbf { x }$ typically semantically meaningful. These are often encoded these as the standard basis vectors $\mathbf { e _ { y } }$ a “one-hot encoding." The set $\mathbf { S }$ contains all $K$ possible values of $\mathbf { y }$ . In this case, notice that S is not stochastic: the empirical distribution $p _ { \mathcal { D } } ( \mathbf { S } | \mathbf { x } )$ is modelled as a Dirac measure with all probability mass on the set $\mathbf { S } = \{ 0 , \ldots , K - 1 \}$ (using integers, here, to represent distinct labels) . The representation function $\mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } )$ of a classifier is often implemented as DNN that maps from the input layer to the layer just prior to the model logits. The context map $\mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } )$ is given by the weights in the final, linear projection layer, which outputs unnormalized logits. Concretely, $\mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } ) = \mathbf { W } \mathbf { e } _ { \mathbf { y } }$ , where $\mathbf { W } \in \mathbb { R } ^ { M \times M }$ is a learnable weight matrix. In order satisfy the diversity condition, the dimension $M$ of the number of classes $K$ must be strictly greater than the dimension of the learned representation $M$ , that is, $| \mathbf { S } | \geq M + 1$ . Finally, the output of the final, linear projection layer is normalized through a Softmax function, yielding the parameterization of Equation (1). + +Self-Supervised Pretraining for Image Classification. Self-supervised learning is a framework that first pretrains a DNN before deploying it on some other, related task. The pretraining task often takes the form of Equation (1) and meets the sufficient conditions to be linearly identifiable. A paradigmatic example is Contrastive Predictive Coding (CPC) (Oord et al., 2018). CPC is a general pretraining framework, but we focus for the sake of clarity on its use in image models here. CPC as applied to images involves: (1) preprocessing an image into augmented patches, (2) assigning labels according to which image the patch came from, and then (3) predicting the representations of the patches whether below, to the right, to the left, or above a certain level (Oord et al., 2018). + +The context function of CPC, $\mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } )$ , encodes a particular position in the sequence of patches, and the representation function, $\mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } )$ , is an autoregressive function of the previous $k$ patches, according to some predefined patch ordering. Given some $\mathbf { x }$ , the collection of all patches from the sequence, from a given minibatch of images, is the set $\mathbf { S } \sim p _ { \mathit { D } } ( \mathbf { S } | \mathbf { x } )$ , where the randomness enters via the patch preprocessing algorithm. Since the preprocessing phase is part of the algorithm design, it is straightforward to make it sufficiently diverse (enough transformations of enough patches) so as to meet the requirements for the model to be linearly identifiable. + +Multi-task Pretraining for Natural Language Generation. Autoregressive language models, such as (Mikolov et al., 2010; Dai and Le, 2015) and more recently GPT-2 and GPT-3 (Radford et al., 2018; 2019; Brown et al., 2020), are typically also instances of the model family of Equation 1. Data points $\mathbf { x }$ are the past tokens, $\mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } )$ is a nonlinear representation of the past estimated by either an LSTM (Hochreiter and Schmidhuber, 1997) or an autoregressive Transformer model (Vaswani et al., 2017), y is the next token, and $\mathbf { w } _ { i } = \mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } = i )$ is a learned representation of the next token, often implemented as a simple look-up table, as in supervised classification. + +BERT (Devlin et al., 2018) is also a member of the linearly identifiable family. This model pretrains word embeddings through a denoising autoencoder-like (Vincent et al., 2008) architecture. For a given sequence of tokenized text, some fixed percentage of the symbols are extracted and set aside, and their original values set to a special null symbol, “corrupting" the original sequence. The pretraining task in BERT is to learn a continuous representation of the extracted symbols conditioned on the remainder of the text. A transformer (Vaswani et al., 2017) function approximator is used to map from the corrupted sequence into a continuous space. The transformer network is the $\mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } )$ function of Equation 1. The context map $\mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } )$ is a lookup map into the learned basis vector for each token. + +# 5 EXPERIMENTS + +The derivation in Section 3 shows that, for models in the general discriminative family defined in Section 2, the functions $\mathbf { f } _ { \theta }$ and $\mathbf { g } _ { \theta }$ are identifiable up to a linear transformation given unbounded data and assuming model convergence. The question remains as to how close a model trained on finite data and without convergence guarantees will approach this limit. One subtle issue is that poor architecture choices (such as too few hidden units, or inadequate inductive priors) or insufficient data samples when training can interfere with model estimation and thereby linear identifiability of the learned representations, due to underfitting. In this section, we study this issue over a range of models, from low-dimensional language embedding and supervised classification (Figures 1 and 2 respectively) to GPT-2 (Radford et al., 2019), an approximately $1 . 5 * 1 0 ^ { 9 }$ -parameter generative model of natural language (Figure 4). See Appendix A and the code release for details needed to reproduce. + +Through these experiments, we show that (1) in the small dimensional, large data regime, linearly identifiable models yield learned representations that lie approximately within a linear transformation of each other (Figures 1 and 2) as predicted by Theorem 1; and (2) in the high dimensional, large data regime, linearly identifiable models yield learned representations that exhibit a strong trend towards linear identifiability. The learned representations approach a linear transformation of each other monotonically, as a function of dataset sample size, neural network capacity (number of hidden units), and optimization progress. In the case of GPT-2, which has benefited from substantial tuning by engineers to improve model estimation, we find strong evidence of linear identifiability. + +Measuring linear similarity between learned representations. How can we measure whether pairs of learned representations live within a linear transformation of each other in function space? We adapt Canonical Correlation Analysis (CCA) (Hotelling, 1936) for this purpose, which finds the optimal linear transformations to maximize correlation among two random vectors. On a randomly selected held-out subset $B \subset D$ of the training data we compute $\mathbf { f } _ { \pmb { \theta } _ { 1 } } ( \pmb { \cal { B } } )$ and $\mathbf { f } _ { \pmb { \theta } _ { 2 } } ( { \pmb { \cal { B } } } )$ for two models with parameters $\pmb { \theta } _ { 1 }$ and $\pmb { \theta } _ { 2 }$ respectively. Assume without loss of generality that $\mathbf { f } _ { \pmb { \theta } _ { 1 } } ( \pmb { \cal { B } } )$ and $\mathbf { f } _ { \pmb { \theta } _ { 2 } } ( { \pmb { \cal { B } } } )$ are centered. CCA finds the optimal linear transformations $C$ and $_ { D }$ such that the pairwise correlations $\rho _ { i }$ between the $i ^ { t h }$ columns of $C ^ { \top } \mathbf { f } _ { \pmb { \theta } _ { 1 } } ( B )$ and $D ^ { \top } \mathbf { f } _ { \theta _ { 2 } } ( B )$ are maximized. We collect correlations together in $\rho$ . If after linear transformation the two matrices are aligned, the mean of $\rho$ will be 1; if they are instead uncorrelated, then the mean of $\rho$ will be 0. We use the mean of $\rho$ as a proxy for the existence of a linear transformation between $\mathbf { f } _ { \pmb { \theta } _ { 1 } } ( \pmb { \cal { B } } )$ and $\mathbf { f } _ { \pmb { \theta } _ { 2 } } ( { \pmb { \cal { B } } } )$ . For DNNs, it is a well known phenomenon that most of the variability in a learned representation tends to concentrate in a low-dimensional subspace, leaving many noisy, random dimensions (Morcos et al., 2018). Such random noise can result in spurious high correlations in CCA. A solution to this problem is to apply Principal Components Analysis (PCA) (Pearson, 1901) to each of the two matrices ${ \bf \dot { f } } _ { \pmb { \theta } _ { 2 } } ( B )$ and ${ \bf f } _ { \pmb { \theta } _ { 1 } } ( { \pmb { \cal { B } } } )$ , projecting onto their top- $k$ principal components, before applying CCA. This technique is known as SVCCA (Raghu et al., 2017). + +![](images/2d4cb868dd22dc59ee9ae0da08d44517998df81059fa0342bf5bca962e146720.jpg) +Figure 2: Deep Supervised Classification. (a) Data distribution for a linearly identifiable K-way classification problem. (b) Mean (centered) CCA between the learned representations over the course of training. After approx. 4000 iterations, CCA finds a linear transformation that rotate the learned representations into alignment, up to optimization error. (c) Learned representations after transformation via optimal linear transformation. The first dimension of the first model’s feature space is plotted against the first dimension of second. The learned representations have a nearly linear relationship, modulo estimation noise. + +We report first on a simulation study of linearly identifiable $K$ -way classification, where all assumptions and sufficient conditions of Theorem 1 are guaranteed to be met. We generated a synthetic data distribution with the properties required by Section 2, and chose DNNs that had sufficient capacity to learn a specified nonlinear relationship between inputs $\mathbf { x }$ and targets y. In short, the data distribution $p _ { \mathcal { D } } ( \mathbf { x } , \mathbf { y } , \mathbf { S } )$ consists of inputs $\mathbf { x }$ sampled from a 2-D Gaussian with $\sigma = 3$ . The targets $\mathbf { y }$ were assigned among $K = 1 8$ classes according to their radial position (angle swept out by a ray fixed at the origin). The number of classes $K$ was chosen to ensure $K \geq \mathrm { d i m } [ { \bf f } _ { \theta } ( { \bf \bar { x } } ) ] + 1$ , the diversity condition. See Appendix D.1 for more details. + +To evaluate linear similarity, we trained two randomly initialized models of $p _ { \mathcal { D } } ( \mathbf { y } \vert \mathbf { x } , \mathbf { S } )$ . Plots show $\mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } )$ , the data representation function, on random $\mathbf { x }$ . Figure 2b shows that the mean CCA increases to its maximum value over training, demonstrating that the feature spaces converge to the same solution up to a linear transformation modulo model estimation noise. Similarly, Figure 2c shows that the learned representations exhibit a strongly linear relationship. + +![](images/76ae7e18d21d886cff12f4e1e12baa0dc100b27ba33fcaae511558cdc38dc139.jpg) +Figure 3: Self-Supervised Representation Learning. Error bars are computed over 5 pairs of models. (a) Input data. Two patches are taken (one from top half, and one from the bottom half) of an image at random. Using a contrastive loss, we predict the identity of the bottom patch encoding from the top. (b) Linear similarity of learned representations at checkpoints (see legend). As models converge, linear similarity increases. (c) Linear similarity as we increase the amount of data for $\mathbf { f } _ { \pmb { \theta } }$ and $\mathbf { g } _ { \theta }$ . Error bars are computed over 5 pairs of models. (d) As we increase model size, linear similarity after convergence increases for both $\mathbf { f } _ { \theta }$ and $\mathbf { g } _ { \pmb { \theta } }$ . + +![](images/54d8c98b0aec6fd34702d4f5ad8ccd6c87908a0105b64d122896df5365a635f7.jpg) +Figure 4: Text Embeddings by GPT-2. GPT-2 results. Representations of the last hidden layer (which is identifiable), in addition to three earlier layers (not necessarily identifiable) for four GPT-2 models. For each representation layer, SVCCA is computed over to all pairs of models, over which correlation coefficients were averaged. SVCCA was applied with 16, 64, 256 and 768 principal components. The learned representations in the last, identifiable layer more correlated than representations learned in preceding layers. + +We next investigate high-dimensional, self-supervised representation learning on CIFAR-10 (Krizhevsky et al., 2009) using CPC (Oord et al., 2018; Hénaff et al., 2019). For a given input image, this model predicts the identity of a bottom image patch representation given a top patch representation (Figure 3a.) Here, S comprises the true patch with a set of distractor patches from across the current minibatch. For each model we define both $\mathbf { f } _ { \pmb { \theta } ^ { \prime } }$ and $\mathbf { g } _ { \pmb { \theta } ^ { \prime } }$ as a 3-layer MLP with 256 units per layer (except where noted otherwise) and fix output dimensionality of 64. + +In Figure 3b, CCA coefficients are plotted over the course of training. As training progresses, alignment between the learned representations increases. In Figure 3c, we artificially limited the size of the dataset, and plot mean correlation after training and convergence. This shows that increasing availability of data correlates with closer alignment. In Figure 3d, we fix dataset size and artificially limit the model capacity (number hidden units) to investigate the effect of model size on the learned representations, varying the number of hidden units from 64 to 8192. This show that increasing model capacity correlates with increase in alignment of learned representations. + +# 5.3 GPT-2 + +Finally, we report on a study of GPT-2 (Radford et al., 2019), a massive-scale language model. The identifiable representation is the set of features just before the last linear layer of the model. We use pretrained models from HuggingFace (Wolf et al., 2019). HuggingFace provides four different versions of the GPT-2: gpt2, gpt2-medium, gpt2-large and $\mathtt { g p t 2 - x 1 }$ , which differ mainly in the hyper-parameters that determine the width and depth of the neural network layers. For approximately 2000 input sentences, per timestep, for each model, we extracted representations at the last layer (which is identifiable) in addition to the representations per timestep given by three earlier layers in the model. Then, we performed SVCCA on each possible pair of models, on each of the four representations. SVCCA was performed with 16, 64, 256 and 768 principal components, computed by applying SVD separately for each representations of each model. We chose 768 as the largest number of principal components, since that is the representation size for the smallest model in the repository (gpt2). We then averaged the CCA correlation coefficients across the pairs of models. Figure 4 shows the results. The results align well with our theory, namely that the representations at the last layer are more linearly related than the representations at other layers of the model. + +# 5.4 INTERPRETATION AND SUMMARY + +Theorem 1 establishes linear identifiability as an asymptotic property of a model that holds in the limit of infinite data and exact estimation. The experiments of this section have shown that for linear identifiable models, when the dimensionality is small relative to dataset size (Figures 1 and 2), the learned embeddings are closely linearly related, up to noise. Problems of model estimation and sufficient dataset size are more pronounced in high dimensions. Nevertheless, in GPT2, representations among different trained models do in fact approach a mean correlation coefficient of 1.0 after training (Figure 4, blue line), providing strong evidence of linear identifiability. + +# 6 RELATED WORKS + +Prior to Hyvärinen and Morioka (2016), identifiability analysis was uncommon in deep learning. We build on advances in the theory of nonlinear ICA (Hyvärinen and Morioka, 2016; Hyvärinen et al., 2018; Khemakhem et al., 2019). In this section, we carefully distinguish our results from prior and concurrent works. Our diversity assumption is similar to diversity assumptions in these earlier works, while differing on certain conditions. The main difference is that their results apply to related but distinct families of models compared to the general discriminative family outlined in this paper. Arguably most related is Theorem 3 of Hyvärinen et al. (2018) and its proof, which shows that a class of contrastive discriminative models will estimate, up to an affine transformation, the true latent variables of a nonlinear ICA model. The main difference with our result is that they additionally assume: (1) that the mapping between observed variables and latent representations is invertible; and (2) that the discriminative model is binary logistic regression exhibiting universal approximation (Hornik et al., 1989), estimated with a contrastive objective. In addition, (Hyvärinen et al., 2018) does not present conditions for affine identifiability for their version of the context representation function g. It should be noted that Theorem 1 in (Hyvärinen et al., 2018) provides a potential avenue for further generalization of our theorem 1 to discriminative models with non-linear interaction between f and g. + +Concurrent work (Khemakhem et al., 2020) has expanded the theory of identifiable nonlinear ICA to a class of conditional energy-based models (EBMs) with universal density approximation capability, therefore imposing milder assumptions than previous nonlinear ICA results. Their version of affine identifiability is similar to our result of linear identifiability in Section 3.2. The main differences are that Khemakhem et al. (2020) focus in both theory and experiment on EBMs. This allows for alternative versions of the diversity condition, assuming that the Jacobians of their versions of f or g are full rank. This is only possible if $\mathbf { x }$ or y are assumed continuous-valued; note that we do not make such an assumption. Khemakhem et al. (2020) also presents an architecture for which the conditions provably hold, in addition to sufficient conditions for identifiability up to element-wise scaling, which we did not explore in this work. While we build on these earlier results, we are, to the best of our knowledge, the first to apply identifiability analysis to state-of-the-art discriminative and autoregressive generative models. + +# 7 CONCLUSION + +We have shown that representations learned by a large family of discriminative models are identifiable up to a linear transformation, providing a novel perspective on representation learning using DNNs. Since identifiability is a property of a model class, and identification is realized in the asymptotic limit of data and compute, we perform experiments in the more realistic setting with finite datasets and finite compute. Our empirical results show that as the representational capacity of the model and dataset size increases, learned representations indeed tend towards solutions that are equal up to only a linear transformation. + +REFERENCES +J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, and S. Wandermanmilne. Jax: Composable transformations of Python+NumPy programs, 2018. URL Http: //Github.Com/Google/Jax. +T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, and Others. Language Models are Few-Shot Learners. Arxiv Preprint Arxiv:2005.14165, 2020. +C. Chelba, T. Mikolov, M. Schuster, Q. Ge, T. Brants, P. Koehn, and t. Robinson. One Billion Word Benchmark for Measuring Progress in Statistical Language Modeling. Arxiv Preprint Arxiv:1312.3005, 2013. +A. M. Dai and Q. V. Le. Semi-Supervised Sequence Learning. In Advances in Neural information Processing Systems, pages 3079–3087, 2015. +J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. Arxiv Preprint Arxiv:1810.04805, 2018. +D. Erhan, Y. Bengio, A. Courville, P.-A. Manzagol, P. Vincent, and S. Bengio. Why Does Unsupervised Pre-training Help Deep Learning? Journal of Machine Learning Research, 11(Feb):625–660, 2010. +O. J. Hénaff, A. Razavi, C. Doersch, S. Eslami, and A. V. D. Oord. Data-Efficient Image Recognition with Contrastive Predictive Coding. Arxiv Preprint Arxiv:1905.09272, 2019. +S. Hochreiter and J. Schmidhuber. Long Short-Term Memory. Neural Computation, 9(8):1735–1780, 1997. +E. Hoffer and N. Ailon. Deep Metric Learning Using Triplet Network. In International Workshop On Similarity-Based Pattern Recognition, pages 84–92. Springer, 2015. +K. Hornik, M. Stinchcombe, and H. White. Multilayer Feedforward Networks are Universal Approximators. Neural Networks, 2(5):359–366, 1989. +H. Hotelling. Relations Between Two Sets of Variates. Biometrika, 28(3/4):321–377, 1936. +A. Hyvärinen and H. Morioka. Unsupervised Feature Extraction by Time-Contrastive Learning and Nonlinear ICA. In Advances in Neural information Processing Systems, pages 3765–3773, 2016. +A. Hyvärinen, H. Sasaki, and R. E. Turner. Nonlinear ICA Using Auxiliary Variables and Generalized Contrastive Learning. Arxiv Preprint Arxiv:1805.08651, 2018. +F. Johansson, U. Shalit, and D. Sontag. Learning representations for counterfactual inference. In International conference on machine learning, pages 3020–3029, 2016. +I. Khemakhem, D. P. Kingma, and A. Hyvärinen. Variational Autoencoders and Nonlinear ICA: A Unifying Framework. Arxiv Preprint Arxiv:1907.04809, 2019. +I. Khemakhem, R. P. Monti, D. P. Kingma, and A. Hyvärinen. ICE-BeeM: Identifiable Conditional Energy-based Deep Models. Arxiv Preprint Arxiv:2002.11537, 2020. +D. P. Kingma and J. Ba. Adam: A Method for Stochastic Optimization. Arxiv Preprint Arxiv:1412.6980, 2014. +A. Krizhevsky, G. Hinton, and Others. Learning Multiple Layers of Features from Tiny Images. 2009. +P. J. Liu, M. Saleh, E. Pot, B. Goodrich, R. Sepassi, L. Kaiser, and N. Shazeer. Generating Wikipedia by Summarizing Long Sequences. Arxiv Preprint Arxiv:1801.10198, 2018. +C. Louizos, U. Shalit, J. M. Mooij, D. Sontag, R. Zemel, and M. Welling. Causal effect inference with deep latent-variable models. In Advances in Neural Information Processing Systems, pages 6446–6456, 2017. +Under review as a conference paper at ICLR 2021 +T. Mikolov, M. Karafiát, L. Burget, J. Cernock ˇ y, and S. Khudanpur. Recurrent Neural Network Based \` Language Model. In Eleventh Annual Conference of The international Speech Communication Association, 2010. +T. Mikolov, I. Sutskever, K. Chen, G. S. Corrado, and J. Dean. Distributed Representations of Words and Phrases and their Compositionality. In Advances in Neural information Processing Systems, pages 3111–3119, 2013. +A. Mnih and G. E. Hinton. A Scalable Hierarchical Distributed Language Model. In Advances in Neural information Processing Systems, pages 1081–1088, 2009. +A. Mnih and Y. W. Teh. A Fast and Simple Algorithm for Training Neural Probabilistic Language Models. Arxiv Preprint Arxiv:1206.6426, 2012. +A. S. Morcos, M. Raghu, and S. Bengio. Insights on Representational Similarity in Neural Networks with Canonical Correlation, 2018. +A. V. D. Oord, Y. Li, and O. Vinyals. Representation Learning with Contrastive Predictive Coding. Arxiv Preprint Arxiv:1807.03748, 2018. +K. Pearson. LIII. On Lines and Planes of Closest Fit to Systems of Points in Space. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 2(11):559–572, 1901. +A. Radford, K. Narasimhan, T. Salimans, and I. Sutskever. Improving Language Understanding by Generative Pre-training. 2018. +A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever. Language Models are Unsupervised Multitask Learners. Openai Blog, 1(8), 2019. +M. Raghu, J. Gilmer, J. Yosinski, and J. Sohl-Dickstein. SVCCA: Singular Vector Canonical Correlation Analysis for Deep Learning Dynamics and interpretability. In Advances in Neural information Processing Systems, pages 6076–6085, 2017. +A. Sharif Razavian, H. Azizpour, J. Sullivan, and S. Carlsson. CNN Features Off-the-Shelf: An Astounding Baseline for Recognition. In Proceedings of The Ieee Conference On Computer Vision and Pattern Recognition Workshops, pages 806–813, 2014. +K. Sohn. Improved Deep Metric Learning with Multi-class N-Pair Loss Objective. In Advances in Neural information Processing Systems, pages 1857–1865, 2016. +P. Sorrenson, C. Rother, and U. Köthe. Disentanglement by Nonlinear ICA with General Incompressible-flow Networks (Gin). Arxiv:2001.04872 [Cs, Stat], Jan. 2020. +A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is All You Need. In Advances in Neural information Processing Systems, pages 5998– 6008, 2017. +P. Vincent, H. Larochelle, Y. Bengio, and P.-A. Manzagol. Extracting and Composing Robust Features with Denoising Autoencoders. In Proceedings of The 25th international Conference On Machine Learning, pages 1096–1103, 2008. +T. Wolf, L. Debut, V. Sanh, J. Chaumond, C. Delangue, A. Moi, P. Cistac, T. Rault, R. Louf, M. Funtowicz, and J. Brew. Huggingface’s Transformers: State-of-the-art Natural Language Processing. Arxiv, Abs/1910.03771, 2019. +Z. Yang, Z. Dai, Y. Yang, J. Carbonell, R. Salakhutdinov, and Q. V. Le. XLNET: Generalized Autoregressive Pretraining for Language Understanding. Arxiv Preprint Arxiv:1906.08237, 2019. + +# A REPRODUCING EXPERIMENTS AND FIGURES + +In this section, we present training and optimization details needed to reproduce our empirical validation of Theorem 1. We also published notebooks and check-pointed weights for two crucial experiments that investigate the result in the small and massive scale regimes, for Figure 1 and GPT-2 (ANONYMIZED). + +# A.1 FIGURE 1 + +We provide a Jupyter notebook and model checkpoints for reproducing Figure 1. Please refer to this for hyperparameter settings. In short, we implemented a model (Mnih and Teh, 2012) in the family of Section 2 and trained it on the Billion Word dataset (Chelba et al., 2013). This is illustrative of the property of Theorem 1 because the relatively modest size of the parameter space (see notebook) and massive dataset minimizes model convergence and data availability restrictions, e.g., approaches the asymptotic regime. + +The word embedding space is 2-D for ease of visualization. We randomly selected a subset of words, mapped them into their learned embeddings, and visualized them as points in the left and middle panes. We then regress pane one onto pane two in order to learn the best linear transformation between them. Note that if the two are linear transformations of each other, regression will recover that transformation exactly. + +# A.2 SIMULATION STUDY: CLASSIFICATION BY DNNS + +For this experiment, we want to ensure that the chosen model can fit the data distribution exactly. Controlling this removes one possible factor that could prevent linear identifiability of learned representations despite the model formally having that property. We do this by making sure that the process that generates the dataset matches the model chosen to learn the relationships between inputs and labels. + +This is achieved through the following algorithm. We first randomly assign initialization labels based on angular position, then fit two neural networks $f _ { \theta ^ { \star } }$ and $g _ { \pmb { \theta } ^ { \star } }$ to predict the final labels, using the discriminative model of Equation (1) and Appendix D.1. Both $f _ { \theta ^ { \star } }$ and $g _ { \pmb { \theta } ^ { \star } }$ 4-hidden-layer MLPs with two 64 unit layers and one 2-D bottle neck layer. After training these representation functions to convergence, generated new batch of points $\mathbf { x }$ , and used the trained networks to predict the ground truth labels y. + +Finally, to conduct experiments, we chose $\mathbf { f } _ { \theta ^ { \prime } }$ and $\mathbf { g } _ { \pmb { \theta } ^ { \prime } }$ to be the same architecture as $\mathbf { f } _ { \theta ^ { \star } }$ and $\mathbf { g } _ { \pmb { \theta } ^ { \star } }$ . This ensures that the supervised classifier we attempted to learn would using the function approximators $\mathbf { f } _ { \pmb { \theta } ^ { \prime } }$ and $\mathbf { g } _ { \pmb { \theta } ^ { \prime } }$ would be able to capture the true data generating process, e.g, would not fail due to too few hidden units, or too complex a relationship between targets and inputs. + +Remaining training details are as follows. We optimize weights using Adam with a learning rate of $1 0 ^ { - 4 }$ for $5 * 1 0 ^ { 4 }$ iterations. To make the classification problem more challenging, we additionally add 20 input dimensions of random noise to the data. The Adam optimizer Kingma and Ba (2014) with a learning rate of $3 \cdot 1 0 ^ { - 4 }$ is used. + +# A.3 SELF-SUPERVISED LEARNING FOR IMAGE CLASSIFICATION + +To compute linear similarity between representations, we train two independent models in parallel. For each model we define both $\mathbf { f } _ { \pmb { \theta } }$ and $\mathbf { g } _ { \theta }$ as a 3-layer fully connected neural network with $\bar { 2 } ^ { 8 }$ units per layer and a fixed output dimensionality of $2 ^ { 6 }$ . We define our model following Equation (1), where $S$ is the set of the other image patches from the current minibatch and optimize the objective of (Hénaff et al., 2019). We augment both sampled patches independently with randomized brightness, saturation, hue, and contrast adjustments, following the recipe of (Hénaff et al., 2019). We train on the CIFAR10 dataset (Krizhevsky et al., 2009) with batchsize $2 ^ { 8 }$ , using the Adam optimizer with a learning rate of $1 0 ^ { - 4 }$ and the JAX (Bradbury et al., 2018) software package. For each model, we early stop based on a validation loss failing to improve further. + +Additional details about the experiments that generated Figure 3: + +Figure 3 a. Patches are sampled randomly from training images. + +Figure 3 b. For each model, we train for at most $3 * 1 0 ^ { 4 }$ iterations, early stopping when necessary based on validation loss. + +Figure $_ { 3 \mathrm { ~ c ~ } }$ . For each model, we train for at most $3 * 1 0 ^ { 4 }$ iterations, early stopping when necessary based on validation loss. + +Figure 3 d. Error bars show standard error computed over 5 pairs of models after $1 . 5 * 1 0 ^ { 4 }$ training iterations. + +# A.4 GPT-2 + +We include all details through a notebook in the code release. Pretrained GPT-2 weights as specified in the main text are publicly available from HuggingFace Wolf et al. (2019). + +# A.5 REMARK ON EFFECT OF INITIALIZATION AND HYPERPARAMETERS OF MODELS + +One question that may be of interest is whether initialization affects whether learned representations will be within a linear transformation of each other. This depends on whether the optimization routines (like Adam, AdaGrad, etc.) are robust to wider initialization within a certain range. If so, model convergence will be unaffected. However, this cannot make up for poor initialization or poor optimization: just as in any deep neural network, a poor initialization and inadequate optimizer will interfere with learning the model parameters. In the case of a linearly identifiable model, means that the learned representations would not live within a linear transformation of each other (up to noise from model fitting), since the models have failed to converge to a reasonable solution for the task at hand. + +When the hyperparameters of a DNN are changed, this changes the class of functions that the network can represent (i.e., the size and stride of convolution filters will change which input pixels could be correlated in deeper layers). Typically, hyperparameters are carefully tuned using cross validation based on held-out data. We did so in our experiments also. We expect that such a tuning procedure would yield hyperparameters that are as good as possible for the model to be optimized, allowing sufficient optimization so that the linear identifiability of the learned representations is realized. If the hyperparameters are sufficiently bad and optimization suffers, this will interfere with model fitting, and with linear identifiability of the learned representations also. + +# B PROOF THAT LINEAR SIMILARITY IS AN EQUIVALENCE RELATION + +We claim that $\stackrel { \mathrm { L } } { \sim }$ is an equivalence relation. It suffices to show that it is reflexive, transitive, and symmetric. + +Proof. Consider some function $\mathbf { g } _ { \pmb { \theta } }$ and some $\pmb { \theta } ^ { \prime } , \pmb { \theta } ^ { \star } , \pmb { \theta } ^ { \dagger } \subset \Theta$ . Suppose $\theta ^ { \prime } \stackrel { \scriptscriptstyle \perp } { \sim } \theta ^ { \star }$ . Then, there exists an invertible matrix $\mathbf { B }$ such that $\mathbf { g } _ { \pmb { \theta } ^ { \prime } } ( \mathbf { x } ) = \mathbf { B } \mathbf { g } _ { \pmb { \theta } ^ { \star } } ( \mathbf { x } )$ . Since ${ \bf g } _ { \pmb { \theta } ^ { \star } } ( { \bf x } ) = { \bf B } ^ { - 1 } { \bf g } _ { \pmb { \theta } ^ { \prime } } ( { \bf x } )$ , $\stackrel { \mathrm { L } } { \sim }$ is symmetric. Reflexivity follows from setting $\mathbf { g } _ { \pmb { \theta } ^ { \star } }$ to $\mathbf { g } _ { \pmb { \theta } ^ { \prime } }$ and $\mathbf { B }$ to the identity matrix. To show transitivity, suppose also that $\smash { \theta ^ { \star } \stackrel { \scriptscriptstyle \perp } { \sim } \theta ^ { \dagger } }$ . Then, there exists an invertible $\mathbf { C }$ such that $\mathbf { g } _ { \pmb { \theta } ^ { \star } } ( \mathbf { x } ) = \mathbf { C } \mathbf { g } _ { \pmb { \theta } ^ { \dagger } } ( \mathbf { x } )$ . Since $\mathbf { g } _ { \pmb { \theta } ^ { \prime } } \overset { \mathtt { L } } { \sim } \mathbf { g } _ { \pmb { \theta } ^ { \star } }$ , $\mathbf { B } ^ { - 1 } \mathbf { g } _ { \pmb { \theta } ^ { \prime } } ( \mathbf { x } ) = \mathbf { C } \mathbf { g } _ { \pmb { \theta } ^ { \dagger } } ( \mathbf { x } )$ . Rearranging terms, ${ \bf g } _ { \theta ^ { \prime } } ( { \bf x } ) = { \bf B } { \bf C } { \bf g } _ { \theta ^ { \dagger } } ( { \bf x } )$ , so that $\pmb { \theta } ^ { \prime } \sim \pmb { \theta } ^ { \dagger }$ as required. + +# C SECTION 3.2 CONTINUED: CASE OF CONTEXT REPRESENTATION FUNCTION g + +Our derivation of identifiability of $\mathbf { g } _ { \theta }$ is similar to the derivation of $\mathbf { f } _ { \pmb { \theta } }$ . The primary difference is that the normalizing constants in Equation (6) do not cancel out. First, note that we can rewrite Equation 1 as: + +$$ +p _ { \pmb { \theta } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } ) = \exp ( \widetilde { \mathbf { f } _ { \pmb { \theta } } } ( \mathbf { x } , \mathbf { S } ) ^ { \top } \widetilde { \mathbf { g } } _ { \pmb { \theta } } ( \mathbf { y } ) ) +$$ + +where: + +$$ +\begin{array} { r l } & { \displaystyle \widetilde { \mathbf { f } _ { \theta } } ( \mathbf { x } , \mathbf { S } ) = \left[ - Z ( \mathbf { x } , \mathbf { S } ) ; \mathbf { f } _ { \theta } ( \mathbf { x } ) \right] } \\ & { \quad \widetilde { \mathbf { g } _ { \theta } } ( \mathbf { y } ) = \left[ 1 ; \mathbf { g } _ { \theta } ( \mathbf { y } ) \right] } \\ & { \displaystyle Z ( \mathbf { x } , \mathbf { S } ) = \log \sum _ { \mathbf { y } ^ { \prime } \in \mathbf { S } } \exp ( \mathbf { f } _ { \theta } ( \mathbf { x } ) ^ { \top } \mathbf { g } _ { \theta } ( \mathbf { y } ^ { \prime } ) ) . } \end{array} +$$ + +Below, we will show that for the model family defined in Section 2, + +$$ +\begin{array} { r } { p _ { \pmb { \theta } ^ { \prime } } = p _ { \pmb { \theta } ^ { * } } \quad \Longrightarrow \quad \mathbf { g } _ { \pmb { \theta } ^ { \prime } } ( \mathbf { y } ) = \mathbf { B } \mathbf { g } _ { \pmb { \theta } ^ { \star } } ( \mathbf { y } ) , } \end{array} +$$ + +where $\mathbf { B }$ is an invertible $( M \times M )$ -dimensional matrix, concluding the proof of the linear identifiability of models in the family defined by Equation (1). We adopt the same shorthands as in the main text. + +# C.1 DIVERSITY CONDITION + +We assume that for any $( \theta ^ { \prime } , \theta ^ { \ast } ) \subset \Theta$ for which it holds that $p ^ { \prime } = p ^ { * }$ , and for any given $\mathbf { y }$ , there exist $M + 1$ tuples $\{ ( \mathbf { x } ^ { ( i ) } , \mathbf { S } ^ { ( i ) } ) \} _ { i = 0 } ^ { M }$ , such that $p _ { \mathcal { D } } ( \mathbf { x } ^ { ( i ) } , \mathbf { y } , \mathbf { S } ^ { ( i ) } ) > 0$ , and such that the $( ( M + 1 ) \times ( M + 1 ) )$ matrices $\mathbf { M } ^ { \prime }$ and $\mathbf { M } ^ { \ast }$ are invertible, where $\mathbf { M } ^ { \prime }$ consists of columns $\widetilde { \mathbf { f } } ^ { \prime } ( \mathbf { x } ^ { ( i ) } , \mathbf { S } ^ { ( i ) } )$ , and $\mathbf { M } ^ { * }$ consists of columns $\widetilde { \mathbf { f } } ^ { * } ( \mathbf { x } ^ { ( i ) } , \mathbf { S } ^ { ( i ) } )$ . + +This is similar to the diversity condition of Section 3.2 but milder, since a typical dataset will have multiple $\mathbf { x }$ for each $\mathbf { y }$ . + +# C.2 PROOF + +With the data distribution $p _ { \mathcal { D } } ( \mathbf { x } , \mathbf { y } , \mathbf { S } )$ , for a given $\mathbf { y }$ , there exists a conditional distribution $p _ { \mathcal { D } } ( \mathbf { x } , \mathbf { S } | \mathbf { y } )$ Let $( \mathbf { x } , \mathbf { S } )$ be a sample from this distribution. From equation 1 and the statement to prove, it follows that: + +$$ +p ^ { \prime } ( \mathbf { y } | \mathbf { x } , \mathbf { S } ) = p ^ { * } ( \mathbf { y } | \mathbf { x } , \mathbf { S } ) +$$ + +Substituting in the definition of our model from equation (9), we find: + +$$ +\exp ( \widetilde { \mathbf { f } } ^ { \prime } ( \mathbf { x } , \mathbf { S } ) ^ { \top } \widetilde { \mathbf { g } } ^ { \prime } ( \mathbf { y } ) ) = \exp ( \widetilde { \mathbf { f } } ^ { * } ( \mathbf { x } , \mathbf { S } ) ^ { \top } \widetilde { \mathbf { g } } ^ { * } ( \mathbf { y } ) ) , +$$ + +which, evaluating logarithms, becomes + +$$ +\widetilde { \mathbf { f } } ^ { \prime } ( \mathbf { x } , \mathbf { S } ) ^ { \top } \widetilde { \mathbf { g } } ^ { \prime } ( \mathbf { y } ) = \widetilde { \mathbf { f } } ^ { * } ( \mathbf { x } , \mathbf { S } ) ^ { \top } \widetilde { \mathbf { g } } ^ { * } ( \mathbf { y } ) , +$$ + +which is true for any triple $( \mathbf { x } , \mathbf { y } , \mathbf { S } )$ where $p _ { \mathcal { D } } ( \mathbf { y } | \mathbf { x } , \mathbf { S } ) > 0$ . + +From $\mathbf { M } ^ { \prime }$ and $\mathbf { M } ^ { * }$ (Section C.1) and equation 16 we form a linear system of equations, collecting the $M + 1$ relationships together: + +$$ +\begin{array} { r } { \mathbf { M ^ { \prime } } ^ { \top } \widetilde { \mathbf { g } } ^ { \prime } ( \mathbf { y } ) = \mathbf { M ^ { * } } ^ { \top } \widetilde { \mathbf { g } } ^ { * } ( \mathbf { y } ) } \\ { \widetilde { \mathbf { g } } ^ { \prime } ( \mathbf { y } ) = \mathbf { A } \widetilde { \mathbf { g } } ^ { * } ( \mathbf { y } ) , \quad } \end{array} +$$ + +where $\mathbf { A } = ( \mathbf { M } ^ { * } \mathbf { M } ^ { \prime - 1 } ) ^ { \top }$ , an invertible $( M + 1 ) \times ( M + 1 )$ matrix. + +It remains to show the existence of an invertible $M \times M$ matrix $\mathbf { B }$ such that + +$$ +\mathbf { g } ^ { \prime } ( \mathbf { y } ) = \mathbf { B } \mathbf { g } ^ { * } ( \mathbf { y } ) . +$$ + +We proceed by constructing $\mathbf { B }$ from A. Since A is invertible, there exist $j$ elementary matrices $\{ \mathbf { E } _ { 1 } , \hdots , \mathbf { E } _ { j } \}$ such that their action $\mathbf { R } = \mathbf { E } _ { j } \mathbf { E } _ { j - 1 } \ldots \mathbf { E } _ { 1 }$ converts $\mathbf { A }$ to a (non-unique) row echelon form. Without loss of generality, we build $\mathbf { R }$ such that the $^ { a _ { 1 , 1 } }$ entry of $\mathbf { A }$ is the first pivot, leading to the particular row echelon form: + +$$ +\mathbf { R A } = \left[ \begin{array} { c c c c c c } { a _ { 1 , 1 } } & { a _ { 1 , 2 } } & { a _ { 1 , 3 } } & { . . . } & { a _ { 1 , m \times 1 } } \\ { 0 } & { \tilde { a } _ { 2 , 2 } } & { \tilde { a } _ { 2 , 3 } } & { . . . } & { \tilde { a } _ { 2 , m \times 1 } } \\ { 0 } & { 0 } & { \tilde { a } _ { 3 , 3 } } & { . . . } & { \tilde { a } _ { 2 , m \times 1 } } \\ { \vdots } & { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { 0 } & { 0 } & { . . . } & { 0 } & { \tilde { a } _ { m \times 1 , m \times 1 } } \end{array} \right] , +$$ + +where $\tilde { a } _ { i , j }$ indicates that the corresponding entry in RA may differ from A due to the action of $\mathbf { R }$ Applying $\mathbf { R }$ to Equation (17), we have + +$$ +\mathbf { R } \widetilde { \mathbf { g } } ^ { \prime } ( \mathbf { y } ) = \mathbf { R } \mathbf { A } \widetilde { \mathbf { g } } ^ { * } ( \mathbf { y } ) . +$$ + +We now show that removing the first row and column of RA and $\mathbf { R }$ generates matrices of rank $M$ . Let $\overline { { \mathbf { R A } } }$ and $\overline { { \mathbf { R } } }$ denote the $( M \times M )$ submatrices formed by removing the first row and column of RA and $\mathbf { R }$ respectively. + +Equation (20) shows that $\overline { { { \bf R } { \bf A } } }$ has a pivot in each column, and thus has rank $M$ . To show that $\overline { { \mathbf { R } } }$ is invertible, we must show that removing the first row and column reduces the rank of $\mathbf { R } = \mathbf { E } _ { j } \mathbf { E } _ { j - 1 } \ldots \mathbf { E } _ { 1 }$ by exactly 1. Clearly, each $\mathbf { E } _ { k }$ is invertible, and their composition is invertible. We must show the same for the composition of $\overline { { \mathbf { E } _ { k } } }$ . + +There are three cases to consider, corresponding to the three unique types of elementary matrices. Each elementary matrix acts on A by either (1) swapping rows $i$ and $j$ , (2) replacing row $j$ by a multiple $m$ of itself, or (3) adding a multiple $m$ of row $i$ to row $j$ . We denote elementary matrix types by superscripts. + +In Case (1), $\mathbf { E } _ { k } ^ { 1 }$ is an identity matrix with row $i$ and row $j$ swapped. For Case (2), $\mathbf { E } _ { l } ^ { 2 }$ is an identity matrix with the $j , j ^ { t h }$ entry replaced by some $m$ . For each $\mathbf { E } _ { k } ^ { 1 }$ and $\mathbf { E } _ { l } ^ { 2 }$ in $\mathbf { R }$ , where $1 \leq k , l \leq j$ , we know that the indices $i , j \geq 2$ , because we chose the first entry of the first row of $\mathbf { A }$ to be the pivot, and hence do not swap the first row, or replace the first row by itself multiplied by a constant. This implies that removing the first row and column of $\mathbf { E } _ { k } ^ { 1 }$ and $\mathbf { E } _ { l } ^ { \bar { 2 } }$ removes a pivot entry 1 in the $( 1 , 1 )$ position, and removes zeros elsewhere. Hence, the $( M \times M )$ submatrices $\overline { { \mathbf { E } _ { k } ^ { 1 } } }$ and $\overline { { \mathbf { E } _ { l } ^ { 2 } } }$ are elementary matrices with rank $M$ . + +For Case (3), $\mathbf { E } _ { k } ^ { 3 }$ has some value $m \in \mathbb { R }$ in the $j , i ^ { t h }$ entry, and 1s along the diagonal. In this case, we may find a non-zero entry in some $\mathbf { E } _ { k } ^ { 3 }$ , so that, e.g., the second row has a pivot at position $( 2 , 2 )$ . Without loss of generality, suppose $i = 1$ , $j = 2$ and let $m$ be some nonzero constant. Removing the first row and column of ${ \bf E } _ { 1 } ^ { 3 }$ removes this $m$ also. Nevertheless, $\overline { { \mathbf { E } _ { 1 } ^ { 3 } } } = \mathbf { I } _ { M }$ , the rank $M$ identity matrix. For any other $\mathbf { E } _ { k } ^ { 3 } \ 1 < i \leq M + 1$ , $j \geq 2$ because we chose $^ { a _ { 1 , 1 } }$ as the first pivot, and hence do not swap the first row, or replace the first row by itself multiplied by a constant. In both cases, removing the first row and first column creates an $\overline { { \mathbf { E } _ { k } ^ { 3 } } }$ that is a rank $M$ elementary matrix. + +We have shown by the above that $\overline { { \mathbf { R } } }$ is a composition of rank $M$ matrices. We now construct the matrix $\mathbf { B }$ by removing the first entries of $\widetilde { \mathbf { g } } ^ { \prime }$ and $\widetilde { \mathbf { g } } ^ { \star }$ , and removing the first row and first column of $\mathbf { R }$ e eand RA in Equation (equation 21). Then, we have + +$$ +\begin{array} { r l } & { \overline { { { \bf R } } } { \bf g } ^ { \prime } ( { \bf y } ) = \overline { { { \bf R } { \bf A } } } { \bf g } ^ { * } ( { \bf y } ) , } \\ & { { \bf g } ^ { \prime } ( { \bf y } ) = \overline { { { \bf R } } } ^ { - 1 } \overline { { { \bf R } { \bf A } } } { \bf g } ^ { * } ( { \bf y } ) . } \end{array} +$$ + +Choosing ${ \bf B } = \overline { { { \bf R } } } ^ { - 1 } \overline { { { \bf R } { \bf A } } }$ proves the result. + +# D REDUCTIONS TO CANONICAL FORM OF EQUATION (1) + +In the following, we show membership in the model family of Equation 1 using the mathematical notation of the papers under discussion in Section 4. Note that each subsection will change notation to match the papers under discussion, which varies quite widely. We employ the following colour-coding scheme to aid in clarity: + +$$ +\log p _ { \theta } ( \mathbf { y } \vert \mathbf { x } , \mathbf { S } ) = \mathbf { f } _ { \theta } ( \mathbf { x } ) ^ { \top } \mathbf { g } _ { \theta } ( \mathbf { y } ) - \log \sum _ { \mathbf { y } ^ { \prime } \in \mathbf { S } } \exp ( \mathbf { f } _ { \theta } ( \mathbf { x } ) ^ { \top } \mathbf { g } _ { \theta } ( \mathbf { y } ^ { \prime } ) ) , +$$ + +where $\mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } )$ is generalized to a data representation function, $\mathbf { g } _ { \boldsymbol { \theta } } ( \mathbf { y } )$ is generalized to a context representation function, and $\begin{array} { r } { \sum _ { \mathbf { y } ^ { \prime } \in \mathbf { S } } \exp ( \mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } ) ^ { \top } \mathbf { g } _ { \pmb { \theta } } ( \mathbf { y } ^ { \prime } ) ) } \end{array}$ is some constant. + +# D.1 SUPERVISED CLASSIFICATION + +Supervised classifiers commonly employ a neural network feature extractor followed by a linear projection of the output of this network into a space of unnormalized logits. All the layers prior to the logits are the representation function $\mathbf { f } _ { \theta }$ , and the final projection layer is the context map $\mathbf { g } _ { \pmb { \theta } } ( y = i ) = \mathbf { w } _ { i }$ , where $\mathbf { w } _ { i }$ is the $i$ -th column of a weight matrix W. The set S in this case contains human-chosen labels and has no stochasticity. The loss function is the negative log-likelihood of the data under a categorical distribution with a softmax parameterization: + +$$ +\log p _ { \pmb { \theta } } ( y = i | \mathbf { x } ; \mathbf { S } ) = \mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } ) ^ { \top } \pmb { w } _ { i } - \varinjlim \sum _ { j = 1 } ^ { | \mathbf { S } | } \exp ( \mathbf { f } _ { \pmb { \theta } } ( \mathbf { x } ) ^ { \top } \pmb { w } _ { j } ) +$$ + +Supervised classification is thus an member of the family defined in Section 2. It exhibits the simplest functional form for the $\mathbf { g }$ function while allowing f to be arbitrarily complicated. + +# D.2 CPC + +Consider a sequence of points $\mathbf { x } _ { t }$ . We wish to learn the parameters $\phi$ to maximize the $k$ -step ahead predictive distribution $p ( \mathbf { x } _ { t + k } | \mathbf { x } _ { t } , \phi )$ . In the image patch example, each patch center $i , j$ is indexed by $t$ . Each $\mathbf { x } _ { t }$ is mapped to a sequence of feature vectors $z _ { t } = f _ { \theta } ( \mathbf { x } _ { t } )$ An autoregressive model, already updated with the previous latent representations $z _ { \leq t - 1 }$ , transforms the ${ \boldsymbol { z } } _ { t }$ into a “context" latent representation ${ \bf c } _ { t } = g _ { A R } ( z _ { \leq t } )$ . Instead of predicting future observations $k$ steps ahead, $\mathbf { x } _ { t + k }$ , directly through a generative model $\dot { p } _ { k } \big ( \mathbf { x } _ { t + k } | \mathbf { c } _ { t } \big )$ , Oord et al. (2018) model a density ratio in order to preserve the mutual information between $\mathbf { x } _ { t + k }$ and $\mathbf { c } _ { t }$ . + +Objective Let $\mathbf { X } = \{ \mathbf { x } _ { 1 } , \ldots , \mathbf { x } _ { N } \}$ be a set of $N$ random samples containing one positive sample from $p ( \mathbf { x } _ { t + k } | \mathbf { c } _ { t } )$ and $N - 1$ samples from the proposal distribution $p ( \mathbf { x } _ { t + k } )$ . Oord et al. (2018) define the following link function: $l _ { k } ( \mathbf { x } _ { t + k } , \mathbf { c } _ { t } ) \triangleq \exp \left( \mathbf { z } _ { t + k } ^ { \intercal } \mathbf { W } _ { k } \mathbf { c } _ { t } \right)$ . Then, CPC optimizes + +$$ +- \mathbb { E } _ { \mathbf { X } } \left[ \log \frac { l _ { k } ( \mathbf { x } _ { t + k } , \mathbf { c } _ { t } ) } { \sum _ { x _ { j } \in X } l _ { k } ( \mathbf { x } _ { j } , \mathbf { c } _ { t } ) } \right] = - \mathbb { E } _ { \mathbf { X } } \left[ \log \frac { \exp \left( \mathbf { z } _ { t + k } \mathbf { \Xi } ^ { \top } \mathbf { W } _ { k } \mathbf { c } _ { t } \right) } { \sum _ { \mathbf { x } _ { j } \in \mathbf { X } } \exp \left( \mathbf { z } _ { j } ^ { \top } \mathbf { W } _ { k } \mathbf { c } _ { t } \right) } \right] . +$$ + +Substituting in the definition of $l _ { k }$ makes equation (24) identical to the model family (Equation 1). + +D.3 AUTOREGRESSIVE LANGUAGE MODELS (E.G. GPT-2) + +Let ${ \mathcal { U } } = \{ u _ { 1 } , \ldots , u _ { n } \}$ be a corpus of tokens. Autoregressive language models maximize a loglikelihood $\begin{array} { r } { \dot { L } ( \mathcal { U } ) = \sum _ { i = 1 } ^ { n } \log P ( u _ { i } | u _ { i - k } , \dots , u _ { i - 1 } ; \Theta ) } \end{array}$ , Concretely, the conditional density is modelled as + +$$ +\begin{array} { r } { \log P ( u _ { i } | u _ { i - k : i - 1 } ; \Theta ) \qquad } \\ { = \mathbf { W } _ { i : } \mathbf { h } _ { i } - \log \displaystyle \sum _ { j } \exp ( \mathbf { W } _ { j : } \mathbf { h } _ { i } ) , } \end{array} +$$ + +where $\mathbf { h } _ { i }$ is the $m \times 1$ output of a function approximator (e.g. a Transformer decoder (Liu et al., 2018)), and $\mathbf { W } _ { i }$ : is the $i$ ’th row of the $| \mathcal { U } | \times m$ token embedding matrix. + +# D.4 BERT + +Consider a sequence of text $\mathbf x = [ x _ { 1 } , \dots , x _ { T } ]$ . Some proportion of the symbols in $\mathbf { x }$ are extracted into a vector $\bar { \bf x }$ , and then set in $\mathbf { x }$ to a special null symbol, “corrupting" the original sequence. This operation generates the corrupted sequence $\mathbf { \underline { { x } } }$ . The representational learning task is to predict $\bar { \bf x }$ conditioned on $\mathbf { \underline { { x } } }$ , that is, to maximize w.r.t. $\pmb { \theta }$ ¯: + +$$ +\log p _ { \theta } ( \bar { \mathbf { x } } | \mathbf { x } ) \approx \sum _ { t = 1 } ^ { T } m _ { t } \log p _ { \theta } ( x _ { t } | \mathbf { x } ) = \sum _ { t = 1 } ^ { T } m _ { t } \Biggl ( \overline { { H _ { \theta } ( \mathbf { x } ) _ { t } } } ^ { \top } e ( x _ { t } ) - \log \sum _ { x ^ { \prime } } \exp \left( H _ { \theta } ( \mathbf { x } ) _ { t } ^ { \top } e ( x ^ { \prime } ) \right) \Biggr ) , +$$ + +where $H$ is a transformer, $e$ is a lookup table, and $m _ { t } = 1$ if symbol $x _ { t }$ is masked. That is, corrupted symbols are “reconstructed" by the model, meaning that their index is predicted. As noted in Yang et al. (2019), BERT models the joint conditional probability $p ( { \bar { \mathbf { x } } } | \mathbf { x } )$ as factorized so that each masked token is separately reconstructed. This means that the log likelihood is approximate instead of exact. + +# D.5 QUICKTHOUGHT VECTORS + +Let f and $\mathbf { g }$ be functions that take a sentence as input and encode it into an fixed length vector. Let $s$ be a given sentence, and $S _ { c t x t }$ be the set of sentences appearing in the context of $s$ for a fixed context size. Let $S _ { c a n d }$ be the set of candidate sentences considered for a given context sentence $s _ { c t x t } \in S _ { c t x t }$ . Then, $S _ { c a n d }$ contains a valid context sentence $s _ { c t x t }$ as well as many other non-context sentences. $S _ { c a n d }$ is used for the classification objective. For any given sentence position in the context of $s$ (for example, the preceding sentence), the probability that a candidate sentence $s _ { c a n d } \in S _ { c a n d }$ is the correct sentence for that position is given by + +$$ +\log p ( s _ { c a n d } | s , S _ { c a n d } ) = f _ { \theta } ( s ) ^ { \top } \underline { { { g } _ { \theta } ( s _ { c a n d } ) ) } } - \log \sum _ { s ^ { \prime } \in S _ { c a n d } } \exp \left( f _ { \theta } ( s ) ^ { \top } g _ { \theta } ( s _ { c a n d } ^ { \prime } ) \right) . +$$ + +# D.6 DEEP METRIC LEARNING + +The multi-class N-pair loss in Sohn (2016) is proportional to + +$$ +\log N - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \left( 1 + \sum _ { j \neq i } \exp \{ \mathbf { f } _ { \theta } ( { x _ { i } } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { j } ) - \mathbf { f } _ { \theta } ( { x _ { i } } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { i } ) ) \} \right) , +$$ + +which can be simplified as + +$$ +\begin{array} { l } { { \displaystyle - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \left( \frac { 1 } { K } \sum _ { j = 1 } ^ { K } \exp \{ \mathbf { f } _ { \theta } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { j } ) - \mathbf { f } _ { \theta } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { i } ) \} \right) } } \\ { { \displaystyle = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \left( \frac { 1 } { \frac { 1 } { K } \sum _ { j = 1 } ^ { K } \exp \{ \mathbf { f } _ { \theta } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { j } ) - \mathbf { f } _ { \theta } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { i } ) \} } \right) } } \\ { { \displaystyle = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \left( \frac { \exp \{ \mathbf { f } _ { \theta } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { i } ) \} } { \frac { 1 } { K } \sum _ { j = 1 } ^ { K } \exp \{ \mathbf { f } _ { \theta } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \theta } ( y _ { j } ) \} } \right) . } } \end{array} +$$ + +Setting $\mathbf { N }$ to 1 and evaluating the log gives + +$$ +\mathbf { f } _ { \pmb { \theta } } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \pmb { \theta } } ( y _ { i } ) - \frac { 1 } { K } \sum _ { j = 1 } ^ { K } \exp ( \mathbf { f } _ { \pmb { \theta } } ( x _ { i } ) ^ { \top } \mathbf { f } _ { \pmb { \theta } } ( y _ { j } ) ) , +$$ + +which is Equation 1 where $\mathbf { f } _ { \theta } = \mathbf { g } _ { \theta }$ + +# D.7 NEURAL PROBABILISTIC LANGUAGE MODELS (NPLMS) + +Figure 1 shows results from a neural probabilistic language model as proposed in Mnih and Teh (2012). Mnih and Teh (2012) propose using a log-bilinear model (Mnih and Hinton, 2009) which, given some context $h$ , learns a context word vectors $r _ { w }$ and target word vectors $q _ { w }$ . Two different embedding matrices are maintained, in other words: one to capture the embedding of the word and the other the context. The representation for the context vectorlinear combination of the context words and a context weight matrix $\hat { q }$ , is thenso that . $C _ { i }$ $\begin{array} { r } { \hat { q } = \bar { \sum } _ { i = 1 } ^ { n - 1 } C _ { i } r _ { w _ { i } } } \end{array}$ The score for the match between the context and the next word is computed as a dot product, e.g., $s _ { \theta } ( w , h ) = \hat { q } ^ { \top } \tilde { q } _ { w } { } ^ { 1 }$ and substituting into the definition of $P _ { \theta } ^ { h } ( w )$ , we see that + +$$ +\log P _ { \theta } ^ { h } ( w ) = \boldsymbol { \hat { q } } ^ { \top } \boldsymbol { \tilde { q } } _ { w } - \log \sum _ { w ^ { \prime } } \exp \left( \boldsymbol { \hat { q } } ^ { \top } \boldsymbol { \tilde { q } } _ { w ^ { \prime } } \right) +$$ + +shows that Mnih and Teh (2012) is a member of the model family. + +Interestingly, a touchstone work in the area of NPLMs, Word2Vec (Mikolov et al., 2013), does not fall under the model family due to an additional nonlinearity applied to the score of Mnih and Teh (2012). \ No newline at end of file diff --git a/md/train/RYcgfqmAOHh/RYcgfqmAOHh.md b/md/train/RYcgfqmAOHh/RYcgfqmAOHh.md new file mode 100644 index 0000000000000000000000000000000000000000..64a01122713c9301acfd3b860a2e40d2e0ccea9c Binary files /dev/null and b/md/train/RYcgfqmAOHh/RYcgfqmAOHh.md differ diff --git a/md/train/S1lyyANYwr/S1lyyANYwr.md b/md/train/S1lyyANYwr/S1lyyANYwr.md new file mode 100644 index 0000000000000000000000000000000000000000..cc69bdb5654bcb8de401603090aebb36853a0b90 --- /dev/null +++ b/md/train/S1lyyANYwr/S1lyyANYwr.md @@ -0,0 +1,718 @@ +# CONSTRAINED MARKOV DECISION PROCESSES VIA BACKWARD VALUE FUNCTIONS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Although Reinforcement Learning (RL) algorithms have found tremendous success in simulated domains, they often cannot directly be applied to physical systems, especially in cases where there are hard constraints to satisfy (e.g. on safety or resources). In standard RL, the agent is incentivized to explore any behavior as long as it maximizes rewards, but in the real world undesired behavior can damage either the system or the agent in a way that breaks the learning process itself. In this work, we model the problem of learning with constraints as a Constrained Markov Decision Process, and provide a new on-policy formulation for solving it. A key contribution of our approach is to translate cumulative cost constraints into state-based constraints. Through this, we define a safe policy improvement method which maximizes returns while ensuring that the constraints are satisfied at every step. We provide theoretical guarantees under which the agent converges while ensuring safety over the course of training. We also highlight computational advantages of this approach. The effectiveness of our approach is demonstrated on safe navigation tasks and in safety-constrained versions of MuJoCo environments, with deep neural networks. + +# 1 INTRODUCTION + +Reinforcement Learning (RL) provides a sound decision-theoretic framework to optimize the behavior of learning agents in an interactive setting (Sutton & Barto, 2018). Recently, the field of RL has found success in many high-dimensional domains, like video games, Go, robot locomotion and navigation. However, most of the success of RL algorithms has been limited to simulators, where the learning algorithm has the ability to reset the simulator. In the physical world, an agent will need to avoid harmful behavior (e.g. damaging the environment or the agent’s hardware) while learning to explore behaviors that maximize the reward. + +A few popular approaches for avoiding undesired behaviors for high-dimensional systems include reward-shaping (Moldovan & Abbeel, 2012), reachability-preserving algorithms (Mitchell, 2003; Eysenbach et al., 2017), state-level surrogate constraint satisfaction algorithms (Dalal et al., 2018), risk-sensitive algorithms (Tamar et al., 2013; Chow et al., 2015) and apprenticeship learning (Abbeel & Ng, 2004). There also exists model-based Bayesian approaches that are focused on imposing the constraints via the dynamics (such as classifying parts of state space as unsafe) and then using model predictive control to incorporate the constraints in the policy optimization and planning (Turchetta et al., 2016; Berkenkamp et al., 2017; Wachi et al., 2018; Koller et al., 2018). A natural way to model safety is via constraint satisfaction. A standard formulation for adding constraints to RL problems is the Constrained Markov Decision Process (CMDP) framework (Altman, 1999), wherein the environment is extended to also provide feedback on constraint costs. The agent must then attempt to maximize its expected return while also satisfying cumulative constraints. + +A few algorithms have been proposed to solve CMDPs for high-dimensional domains with continuous action spaces - however they come with their own caveats. Reward Constrained Policy Optimization (Tessler et al., 2018) and Primal Dual Policy Optimization (Chow et al., 2015) do not guarantee constraint satisfaction during the learning procedure, only on the final policy. Constrained Policy Optimization (Achiam et al., 2017) provides monotonic policy improvement but is computationally expensive due to requiring a backtracking line-search procedure and conjugate gradient algorithm for approximating the Fisher Information Matrix. Lyapunov-based Safe Policy Optimization (Chow et al., 2019) requires solving a Linear Program (LP) at every step of policy evaluation, although they show that there exists heuristics which can be substituted for the LP at the expense of theoretical guarantees. + +In this work, we propose an alternate formulation for solving CMDPs that transforms trajectory-level constraints into localized state-dependent constraints, through which a safe policy improvement step can be defined. In our approach, we define a notion of Backward Value Functions, which act as an estimator of the expected cost collected by the agent so far and can be learned via standard RL bootstrap techniques. We provide conditions under which this new formulation is able to solve CMDPs without violating the constraints during the learning process. Our formulation allows us to define state-level constraints without explicitly solving a LP or the Dual problem at every iteration. Our method is implemented as a reduction to any model-free on-policy bootstrap based RL algorithm, both for deterministic and stochastic policies, and discrete and continuous action spaces. We provide the empirical evidence of our approach with Deep RL methods on various safety benchmarks, including 2D navigation grid worlds (Leike et al., 2017; Chow et al., 2018), and MuJoCo tasks (Achiam et al., 2017; Chow et al., 2019). + +# 2 CONSTRAINED MARKOV DECISION PROCESSES + +We write ${ \mathcal { P } } ( Y )$ for the set of probability distributions on a space $Y$ . A Markov Decision Process (MDP) (Puterman, 2014) is a tuple $( \mathcal { X } , \mathcal { A } , \mathcal { P } , r , x _ { 0 } )$ , where $\mathcal { X }$ is a set of states, $\mathcal { A }$ is a set of actions, $r : \mathcal { X } \times \mathcal { A } [ 0 , R _ { M A X } ]$ is a reward function, $\mathcal { P } : \mathcal { X } \times \mathcal { A } \mathcal { P } ( \mathcal { X } )$ is a transition probability function, and $x _ { 0 }$ is a fixed starting state. For simplicity we assume a deterministic reward function and starting state, but our results generalize. + +A Constrained Markov Decision Process (CMDP) (Altman, 1999) is a MDP with additional constraints that restrict the set of permissible policies for the MDP. Formally, a CMDP is a tuple $( \mathcal { X } , \mathcal { A } , \mathcal { P } , r , x _ { 0 } , d , d _ { 0 } )$ , where $d : \mathcal { X } [ 0 , D _ { M A X } ]$ is the cost function1 and $\mathbf { \Phi } _ { M _ { 0 } } \in \mathbb { R } ^ { \geq 0 }$ is the maximum allowed cumulative cost. The set of feasible policies that satisfy the CMDP is the subset of stationary policies $\begin{array} { r } { \Pi _ { \mathcal { D } } : = \{ \pi : \mathcal { X } \mathcal { P } ( \mathcal { A } ) \mid \mathbb { E } [ \sum _ { t = 0 } ^ { T } d ( x _ { t } ) \mid x _ { 0 } , \pi ] \leq d _ { 0 } \} } \end{array}$ . We consider a finite time horizon $T$ after which the episode terminates. The expected sum of rewards following a policy $\pi$ from an initial state $x$ is given by the value function $\begin{array} { r } { V ^ { \pi } ( x ) = \mathbb { E } [ \sum _ { t = 0 } ^ { T } r ( x _ { t } , a _ { t } ) \mid \pi , x ] } \end{array}$ . Analogously, the expected sum of costs is given by the cost value function $V _ { \mathcal { D } } ^ { \pi } ( x ) = \mathbb { E } [ \sum _ { t = 0 } ^ { T } d ( x _ { t } ) \mid \pi , x ]$ . The RL problem in the CMDP is to find the feasible policy which maximizes expected returns from the initial state $x _ { 0 }$ , i.e. + +$$ +\pi ^ { * } = \arg \operatorname* { m a x } _ { \pi \in \Pi _ { \mathcal { D } } } V ^ { \pi } ( x _ { 0 } ) +$$ + +An important point to note about CMDPs is that, in the original formulation, the cost function depends on immediate states but the constraint is cumulative and thus depends on the entire trajectory. + +In the case of MDPs, where a model of the environment is not known or is not easily obtained, it is still possible for the agent to find the optimal policy using Temporal Difference (TD) methods (Sutton, 1988). Broadly, these methods update the estimates of the value functions via bootstraps of previous estimates on sampled transitions (we refer the reader to Sutton & Barto (2018) for more information). In the on-policy setting, we alternate between estimating the state-action value function $Q ^ { \pi }$ for a given $\pi$ and updating the policy to be greedy with respect to the value function. + +# 3 SAFE POLICY ITERATION VIA BACKWARD VALUE FUNCTIONS + +Our approach proposes to convert the trajectory-level constraints of the CMDP into single-step state-wise constraints in such a way that satisfying the state-wise formulation will entail satisfying the original trajectory-level problem. The advantages of this approach are twofold: i) working with single-step state-wise constraints allows us to obtain analytical solutions to the optimization problem, and ii) the state-wise constraints can be defined via value-function-like quantities and can thus be estimated with well-studied value-based methods. The state-wise constraints are defined via Backward Value Functions, in Section 3.2, and in Section 3.3 we provide a safe policy iteration procedure which satisfies said constraints (and thus the original problem). + +# 3.1 BACKWARD MARKOV CHAIN + +Unlike in traditional RL, in the CMDP setting the agent needs to take into account the constraints which it has accumulated so far in order to plan accordingly for the future. Intuitively, the accumulated cost so far can be estimated via the cost value function $V _ { \mathcal { D } }$ running “backward in time”. Before giving the details of our approach and formally introducing the Backward Value Functions, we review the main ideas, which are built upon the work of Morimura et al. (2010), who also considered time-reversed Markov chains but from the standpoint of estimating the gradient of the log stationary distribution; we extend these ideas to TD methods. + +Assumption 3.1 (Stationarity). The MDP is ergodic for any policy $\pi$ , i.e., the Markov chain characterized by the transition probability $\begin{array} { r } { \mathcal { P } ^ { \pi } ( x _ { t + 1 } \vert \bar { x } _ { t } ) = \sum _ { a _ { t } \in \mathcal { A } } \mathcal { P } ( \bar { x } _ { t + 1 } \vert x _ { t } , a _ { t } ) \pi ( a _ { t } \vert x _ { t } ) } \end{array}$ is irreducible and aperiodic. + +Let $\mathcal { M } ( \pi )$ denote the Markov chain characterized by transition probability $\mathcal { P } ^ { \pi } ( x _ { t + 1 } \vert x _ { t } )$ . The above assumption implies that there exists a unique stationary distribution $\eta ^ { \pi }$ associated with $\pi$ , such that it satisfies: $\begin{array} { r } { \bar { \eta } ^ { \pi } ( x _ { t + 1 } ) = \sum _ { x _ { t } \in \mathcal { X } } \mathcal { P } ^ { \pi } ( x _ { t + 1 } \vert x _ { t } ) \eta ^ { \pi } ( x _ { t } ) } \end{array}$ . We abuse the notation and denote $\mathcal { P } ^ { \pi } ( x _ { t + 1 } , a _ { t } | x _ { t } ) = \mathcal { P } ( x _ { t + 1 } | x _ { t } , a _ { t } ) \pi ( a _ { t } | \bar { x } _ { t } )$ . + +According to Bayes’ rule, the probability $q ( x _ { t - 1 } , a _ { t - 1 } | x _ { t } )$ of a previous state-action pair $( x _ { t - 1 } , a _ { t - 1 } )$ leading to the current state $x _ { t }$ is given by: + +$$ +q ( x _ { t - 1 } , a _ { t - 1 } | x _ { t } ) = \frac { \mathcal { P } ( x _ { t } | x _ { t - 1 } , a _ { t - 1 } ) P r ( x _ { t - 1 } , a _ { t - 1 } ) } { \sum _ { x _ { t - 1 } \in \mathcal { X } } \sum _ { a _ { t - 1 } \in \mathcal { A } } \mathcal { P } ( x _ { t } | x _ { t - 1 } , a _ { t - 1 } ) P r ( x _ { t - 1 } , a _ { t - 1 } ) } . +$$ + +From Assumption 3.1, we have that $\begin{array} { r l r } { P r ( x _ { t - 1 } , a _ { t - 1 } ) } & { { } = } & { \eta ^ { \pi } ( x _ { t - 1 } ) \pi ( a _ { t - 1 } | x _ { t - 1 } ) } \end{array}$ , and $\begin{array} { r l r } { \sum _ { x _ { t - 1 } \in \mathcal { X } } \sum _ { a _ { t - 1 } \in \mathcal { A } } \mathcal { P } ( x _ { t } | x _ { t - 1 } , a _ { t - 1 } ) P r ( x _ { t - 1 } , a _ { t - 1 } ) } & { = } & { \eta ^ { \pi } ( x _ { t } ) } \end{array}$ . We denote the posterior $q ( x _ { t - 1 } , a _ { t - 1 } | x _ { t } )$ as backward (or time-reversed) probability $\mathbf { } \pi ^ { \pi } ( x _ { t - 1 } , a _ { t - 1 } | x _ { t } )$ , and we have: + +$$ +\begin{array} { r l } & { \overleftarrow { \boldsymbol { \mathcal { P } } } ^ { \pi } ( x _ { t - 1 } , a _ { t - 1 } | x _ { t } ) = \frac { \mathcal { P } ( x _ { t } | x _ { t - 1 } , a _ { t - 1 } ) \eta ^ { \pi } ( x _ { t - 1 } ) \pi ( a _ { t - 1 } | x _ { t - 1 } ) } { \eta ^ { \pi } ( x _ { t } ) } } \\ & { \phantom { \quad \quad \ } = \frac { \mathcal { P } ^ { \pi } ( x _ { t } , a _ { t - 1 } | x _ { t - 1 } ) \eta ^ { \pi } ( x _ { t - 1 } ) } { \eta ^ { \pi } ( x _ { t } ) } . } \end{array} +$$ + +The forward Markov chain, characterized by the transition matrix $\mathscr { P } ^ { \pi } ( x _ { t + 1 } | x _ { t } )$ , runs forward in time, i.e., it gives the probability of the next state in which the agent will end up. Analogously, a backward Markov chain is denoted by the transition matrix $\begin{array} { r } { \mathbf { et { } { ' } { \mathcal { P } } } ^ { \pi } ( x _ { t - 1 } \vert x _ { t } ) = \sum _ { a _ { t - 1 } \in A } \mathbf { et { } { ' } { \mathcal { P } } ^ { \pi } } ( x _ { t - 1 } , a _ { t - 1 } \vert x _ { t } ) . } \end{array}$ , and describes the state and action the agent took to reach the current state. + +Definition 3.1 (Backward Markov Chain). A backward Markov chain associated with $\mathcal { M } ( \pi )$ is denoted by $\overleftarrow { B } ( \pi )$ and is characterized by the transition probability $\overleftarrow { \mathcal { P } } ^ { \pi } ( x _ { t - 1 } | x _ { t } )$ . + +# 3.2 BACKWARD VALUE FUNCTION + +We define the Backward Value Function (BVF) to be a value function running on the backward Markov chain $\overleftarrow { B } ( \pi )$ . A BVF is the expected sum of returns or costs collected by the agent so far. We are mainly interested in maintaining estimates of the cumulative cost incurred at a state in order to express the total constraint state-wise. + +We note that, since every Markov chain $\mathcal { M } ( \pi )$ is ergodic by Assumption 3.1, the corresponding backward Markov chain $B ( \pi )$ is also ergodic (Morimura et al., 2010, Prop. B.1). In particular, every policy $\pi$ can reach the initial state via some path in the transition graph of the backward Markov chain. Thus, the backwards Markov chain are also finite-horizon for some $T _ { B }$ , with $x _ { 0 }$ corresponding to the terminal state. We define a finite-horizon Backward Value Function for cost as: + +$$ +\overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x _ { t } ) = \mathbb { E } _ { \overleftarrow { \mathcal { B } } ( \pi ) } \left[ \sum _ { k = 0 } ^ { T _ { \mathcal { B } } } d ( x _ { t - k } ) | x _ { t } \right] . +$$ + +Proposition 3.1 (Sampling). Samples from the forward Markov chain $\mathcal { M } ( \pi )$ can be used directly to estimate the statistics of the backward Markov chain $\overleftarrow { B } ( \pi )$ (or the Backward Value Function). We + +have: + +$$ +\begin{array} { r l r } { { \mathbb { E } _ { \overleftarrow { \mathcal { B } } ( \pi ) } [ \sum _ { k = 0 } ^ { K } d ( x _ { t - k } ) | x _ { t } ] = \mathbb { E } _ { \mathcal { M } ( \pi ) } [ \sum _ { k = 0 } ^ { K } d ( x _ { t - k } ) | x _ { t } , \eta ^ { \pi } ( x _ { t - K } ) ] , } } \\ & { } & { = \mathbb { E } _ { \mathcal { M } ( \pi ) } [ \sum _ { k = 0 } ^ { K } d ( x _ { t + k } ) | x _ { t + K } , \eta ^ { \pi } ( x _ { t } ) ] , } \end{array} +$$ + +where EM(π) and E #»B(π) are expectations over the forward and backward chains respectively. The Equation (3) holds true even in the limit $K \infty$ . + +The proof is given in Appendix B.1. Using the above proposition, we get an interchangeability property that removes the need to sample from the backward chain. We can use the traditional RL setting and draw samples from the forward chain and still estimate the BVFs. Equation (2) can be written recursively as: + +$$ +\begin{array} { r } { \overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x _ { t } ) = \mathbb { E } _ { \overleftarrow { B } ( \pi ) } \left[ d ( x _ { t } ) + \overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x _ { t - 1 } ) \right] . } \end{array} +$$ + +In operator form, the above equation can also be written as: + +$$ +( \overleftarrow { \boldsymbol { T } } ^ { \pi } \overleftarrow { \boldsymbol { V } } _ { \mathcal { D } } ^ { \pi } ) ( \boldsymbol { x } _ { t } ) = \mathbb { E } _ { \boldsymbol { x } _ { t - 1 } \sim \overleftarrow { \boldsymbol { P } } ^ { \pi } } \left[ d ( \boldsymbol { x } _ { t } ) + \overleftarrow { \boldsymbol { V } } _ { \mathcal { D } } ^ { \pi } ( \boldsymbol { x } _ { t - 1 } ) \right] . +$$ + +Proposition 3.2 (Fixed point). For a policy $\pi$ , the associated Backward Value Function vector, $\overleftarrow { V } ^ { \pi }$ , satisfies $\begin{array} { r } { \operatorname* { l i m } _ { k \infty } ( \overleftarrow { T } ^ { \pi } ) ^ { k } \overleftarrow { V } = \overleftarrow { V } ^ { \pi } } \end{array}$ for every vector , and $\overleftarrow { V } ^ { \pi }$ is the unique solution of the equation $\overleftarrow { V } ^ { \pi } = \overleftarrow { T } ^ { \pi } \overleftarrow { V } ^ { \pi }$ . + +The proof is given in Appendix B.2. The above proposition allows us to soundly extend the RL methods based on Bellman operators for the estimation of BVFs. + +# 3.3 SAFE POLICY IMPROVEMENT VIA BVF-BASED CONSTRAINTS + +With the Backward Value Function framework, the trajectory-level optimization problem associated with a CMDP can be rewritten in state-wise form. Recall that a feasible policy must satisfy the constraint: + +$$ +\mathbb { E } _ { \mathcal { M } ( \pi ) } \left[ \sum _ { k = 0 } ^ { T } d ( x _ { k } ) \mid x _ { 0 } \right] \leq d _ { 0 } . +$$ + +Alternatively, for each timestep $t \in [ 0 , T ]$ of a trajectory: + +$$ +\mathbb { E } \left[ \sum _ { k = 0 } ^ { t } d ( x _ { k } ) \mid x _ { 0 } , \pi \right] + \mathbb { E } \left[ \sum _ { k = t } ^ { T } d ( x _ { k } ) \mid x _ { 0 } , \pi \right] - \mathbb { E } \left[ d ( x _ { t } ) \mid x _ { 0 } \right] \leq d _ { 0 } . +$$ + +Via the identities $\begin{array} { r } { \mathbb { E } [ \sum _ { k = t } ^ { T } d ( x _ { k } ) \mid x _ { 0 } , \pi ] \leq \mathbb { E } _ { x _ { t } \sim \delta _ { x _ { 0 } } ( P ^ { \pi } ) ^ { t } } [ V _ { D } ^ { \pi } ( x _ { t } ) ] } \end{array}$ and $\begin{array} { r } { \mathbb { E } [ \sum _ { k = 0 } ^ { t } d ( x _ { k } ) \mid x _ { 0 } , \pi ] \le } \end{array}$ $\mathbb { E } _ { \boldsymbol { x } _ { k } \sim \delta _ { \boldsymbol { x } _ { 0 } } ( \boldsymbol { P } ^ { \pi } ) ^ { t } } [ \overleftarrow { V } _ { \boldsymbol { D } } ^ { \pi } ( \boldsymbol { x } _ { t } ) ]$ (derived in Appendix $\mathrm { C } ) ^ { 2 }$ , we remark that the quantity on the LHS is less than the expectation over $k$ -step trajectories of $\overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x _ { t } ) + V _ { \mathcal { D } } ^ { \pi } ( x _ { t } ) - d ( x _ { t } )$ . In other words, for each $t \in [ 0 , T ]$ : + +$$ +\mathbb { E } _ { \mathcal { M } ( \pi ) } \left[ \sum _ { k = 0 } ^ { T } d ( x _ { k } ) \mid x _ { 0 } \right] \le \mathbb { E } _ { x _ { t } \sim \delta _ { x _ { 0 } } ( P ^ { \pi } ) ^ { t } } \left[ \overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x _ { t } ) + V _ { \mathcal { D } } ^ { \pi } ( x _ { t } ) - d ( x _ { t } ) \right] \le d _ { 0 } . +$$ + +These are the state-wise constraints that should hold at each step in a given trajectory - we refer to them as the value-based constraints. Satisfying the value-based constraints will automatically satisfy the given CMDP constraints. + +This formulation allows us to introduce a policy improvement step, which maintains a safe feasible policy at every iteration by using the previous estimates of the forward and backward value functions3. The policy improvement step is defined by a linear program, which performs a greedy update with respect to the current state-action value function subject to the value-based constraints: + +$$ +\begin{array} { r l } & { \pi _ { k + 1 } ( \cdot | x ) = \underset { \pi \in \Pi } { \arg \operatorname* { m a x } } \big \langle \pi ( \cdot | x ) , Q ^ { \pi _ { k } } ( x , \cdot ) \big \rangle , } \\ & { \quad s . t . \left. \pi ( \cdot | x ) , Q _ { \mathcal { D } } ^ { \pi _ { k } } ( x , \cdot ) \right. + \overleftarrow { V } _ { \mathcal { D } } ^ { \pi _ { k } } ( x ) - d ( x ) \leq d _ { 0 } , \quad \forall x \in \mathcal { X } . } \end{array} +$$ + +Our first result is that the policies obtained by the policy improvement step will satisfy the safety constraints. We write $\mathrm { T V } ( \cdot , \cdot )$ for the total variation metric between distributions. + +Theorem 3.1 (Consistent Feasibility). Assume that successive policies are updated sufficiently slowly, i.e. $\begin{array} { r } { \mathrm { T V } \big ( \pi _ { k + 1 } \big ( \cdot | x \big ) , \pi _ { k } \big ( \cdot | x \big ) \big ) \leq \frac { d _ { 0 } - V _ { \mathcal { D } } ^ { \pi _ { k } } ( x _ { 0 } ) } { 2 D _ { \mathrm { M A X } } T ^ { 2 } } } \end{array}$ .4 Then the policy iteration step given by (SPI) is consistently feasible, i.e. if $\pi _ { k }$ Mis feasible at $x _ { 0 }$ then so is $\pi _ { k + 1 }$ . + +It is also possible to consider larger neighbourhoods for updates of successive policies, but at the cost of everywhere-feasibility. For want of space, we present that result in Appendix D. + +Next we show that the policy iteration step given by (SPI) leads to monotonic improvement. + +Theorem 3.2 (Policy Improvement). Let $\pi _ { n }$ and $\pi _ { n + 1 }$ be successive policies generated by the policy iteration step of (SPI). Then $V ^ { \pi _ { n + 1 } } ( x ) \geq V ^ { \pi _ { n } } ( x ) \forall x \in \mathcal { X }$ . In particular, the sequence of value functions $\{ V ^ { \pi _ { n } } \} _ { n \geq 0 }$ given by (SPI) monotonically converges. + +Proofs for Theorems 3.1 and 3.2 are given in Appendix D. Finding the sub-optimality gap (if any) remains an interesting question left for future work. + +# 4 PRACTICAL IMPLEMENTATION CONSIDERATIONS + +# 4.1 DISCRETE ACTION SPACE + +In discrete action spaces, the problem in (SPI) can be solved exactly as a Linear Programming problem. It is possible to approximate its analytical solution by casting it into the corresponding entropy-regularized counterpart (Neu et al., 2017; Chow et al., 2018). The details of the closed form solution can be found in Appendix E. + +Furthermore, if we restrict the set of policies to be deterministic, then it is possible to have an in-graph solution as well. The procedure then closely resembles the Action Elimination Procedure (Puterman, 2014, Chapter 6), where non-optimal actions are identified as being those which violate the constraints. + +# 4.2 EXTENSION TO CONTINUOUS CONTROL + +For MDPs with only state-dependent costs, Dalal et al. (2018) proposed the use of safety layers, a constraint projection approach, that enables action correction at each step. At any given state, an unconstrained action is selected and is passed to the safety layer, which projects the action to the nearest action (in Euclidean norm) satisfying the necessary constraints. We extend this approach to stochastic policies to handle the corrections for the actions generated by stochastic policies. When the policy is parameterized with a Gaussian distribution, then the safety-layer can still be used by projecting both the mean and standard-deviation vector to the constraint-satisfying hyper-plane5. In most cases, the standard-deviation vector is kept fixed or independent of the state (Kostrikov, 2018; Dhariwal et al., 2017), which allows us to formulate the problem as solving the following $L 2$ -projection of the mean of the Gaussian in Euclidean space. For $\mu _ { \pi } ( . ; \theta )$ , at any given state $x \in \mathcal { X }$ , the safety layer solves the following projection problem: + +$$ +\begin{array} { l } { \displaystyle \arg \operatorname* { m i n } _ { \mu } [ \frac { 1 } { 2 } \| ( \mu - \mu _ { \pi } ( x ) \| ^ { 2 } ] , } \\ { \displaystyle \mathrm { s . t . } \quad Q _ { \mathcal { D } } ^ { \pi } ( x , \mu ) + \overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x ) - d ( x ) \leq d _ { 0 } . } \end{array} +$$ + +As shown in Dalal et al. (2018); Chow et al. (2019), if the constraints have linear nature then an analytical solution exists. In order to get a linearized version of the constraints (and simplify the projection), we can approximate the constraint with its first-order Taylor series at $\mu = \mu _ { \pi } ( x )$ : + +$$ +\begin{array} { r l } & { \underset { \mu } { \arg \operatorname* { m i n } } [ \frac { 1 } { 2 } \| ( \mu - \mu _ { \pi } ( x ) \| ^ { 2 } ] , } \\ & { \mathrm { s . t . } \quad \overset { } { V } _ { \mathcal { D } } ^ { \pi } ( x ) - d ( x ) + \underset { \mathrm { r e s . } \mu _ { \pi } ( x ) ) } { \underbrace { Q _ { \mathcal { D } } ^ { \pi } ( x , \mu _ { \pi } ( x ) ) + ( \mu - \mu _ { \pi } ( x ) ) ^ { T } ( \nabla Q _ { \mathcal { D } } ^ { \pi } ( x , \mu ) | _ { \mu = \mu _ { \pi } ( x ) } ) } } \leq d _ { 0 } . } \end{array} +$$ + +The above objective function is positive-definite and quadratic, and the constraints are linear. Though this problem can be solved by an in-graph QP solver, there exists an analytical solution (see Appendix G): + +Proposition 4.1. At a given state $x \in \mathcal { X }$ , the solution to the Eq. (5), $\mu ^ { * }$ is: + +where, + +$$ +\begin{array} { c } { { \mu ^ { * } = \mu _ { \pi } ( x ) - \lambda ^ { * } ( x ) \cdot g _ { \mu , D } ( x ) , } } \\ { { g _ { \mu , \mathcal { D } } ( x ) = \nabla Q _ { \mathcal { D } } ^ { \pi } ( x , \mu ) | _ { \mu = \mu _ { \pi } ( x ) } , } } \\ { { \lambda ^ { * } ( x ) = \left( \frac { - ( d _ { 0 } + d ( x ) - \overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x ) - Q _ { \mathcal { D } } ^ { \pi } ( x , \mu _ { \pi } ( x ) ) ) } { g _ { \mu , \mathcal { D } } ( x ) ^ { T } g _ { \mu , \mathcal { D } } ( x ) } \right) ^ { + } . } } \end{array} +$$ + +# 5 RELATED WORK + +Lagrangian-based methods: Initially introduced in Altman (1999), more scalable versions of the Lagrangian based methods have been proposed over the years (Moldovan & Abbeel, 2012; Tessler et al., 2018; Chow et al., 2015). The general form of the Lagrangian methods is to convert the problem to an unconstrained problem via Langrange multipliers. If the policy parameters are denoted by $\theta$ , then Lagrangian formulation becomes: $\begin{array} { r l } { \operatorname* { m i n } _ { \lambda \geq 0 } \operatorname* { m a x } _ { \theta } ( L ( \theta , \lambda ) } & { = } \end{array}$ $\begin{array} { r } { \operatorname* { m i n } _ { \lambda \geq 0 } \operatorname* { m a x } _ { \theta } \left[ V ^ { \pi _ { \theta } } ( x _ { 0 } ) \right. \stackrel { . } { - } \left. \lambda ( V _ { \mathcal { D } } ^ { \pi _ { \theta } } ( x _ { 0 } ) \right. \stackrel { . } { - } \left. \bar { d _ { 0 } } ) ) \right] } \end{array}$ , where $L$ is the Lagrangian and $\lambda$ is the Lagrange multiplier (penalty coefficient). The main problems of the Lagrangian methods are that the Lagrangian multiplier is either a hyper-parameter (without much intuition), or is solved on a lower time-scale. That makes the unconstrained RL problem a three time-scale 6 problem, which makes it very difficult to optimize in practice. Another problem is that during the optimization, this procedure can violate the constraints. Ideally, we want a method that can respect the constraint throughout the training and not just at the final optimal policy. + +Lyapunov-based methods: In control theory, the stability of the system under a fixed policy is computed using Lyapunov functions (Khalil, 1996). A Lyapunov function is a type of scalar potential function that keeps track of the energy that a system continually dissipates. Recently, Chow et al. (2018; 2019) provide a method of constructing the Lyapunov functions to guarantee global safety of a behavior policy using a set of local linear constraints. Their method requires the knowledge of $T V ( \pi , \pi ^ { * } )$ to guarantee the theoretical claims. They substitute the ideally required Lyapunov function with an approximate solution that requires solving a LP problem at every iteration. For the practical scalable versions, they use a heuristic, a constant Lyapunov function for all states that only depends on the initial state and the horizon. While our methods also constructs state-wise constraints, there are two notable differences: a) our assumption only rely on the current policy candidate and the baseline policy, instead of the baseline and the optimal policy, b) our method does not require solving an LP at every update step to construct the constraint and as such the only approximation error that is introduced comes from the function approximation. + +Conservative Policy Improvement: Constrained Policy Optimization (CPO) (Achiam et al., 2017) extends the trust-region policy optimization (Schulman et al., 2015) algorithm to satisfy constraints during training as well as after convergence. CPO is computationally expensive as it uses an approximation to the Fisher Information Matrix which requires many steps of conjugate gradient descent $\cdot n _ { c g }$ steps) followed by a backtracking line-search procedure ${ \bf \nabla } _ { n _ { l s } }$ steps) for each iteration, so it is more expensive by $\mathcal { O } ( n _ { c g } + n _ { l s } )$ per update. Furthermore, accurately estimating the curvature requires a large number of samples in each batch (Wu et al., 2017). + +# 6 EXPERIMENTS + +We empirically validate our approach on RL benchmarks to measure the performance of the agent with respect to the accumulated return and cost during training in the presence of neural-networks based function approximators. We compare our approach with the respective Unconstrained versions, and the Lyapunov-based approach (Chow et al., 2018; 2019) in each setting. Even though our formulation is based on the undiscounted case, we use discounting with $\gamma = 0 . 9 9$ for estimating the value functions in order to be consistent with the baselines. + +# 6.1 STOCHASTIC GRID WORLD + +Motivated by the safety in navigation tasks, we first consider a stochastic 2D grid world (Leike et al., 2017; Chow et al., 2018). The agent (green cell in Fig. 1a) starts in the bottom-right corner, the safe region, and the objective is to move to the goal on the other side of the grid (blue cell). The agent can only move in the adjoining cells in the cardinal directions. It gets a reward of $+ 1 0 0 0$ on reaching the goal, and a penalty of $- 1$ at every timestep. Thus, the task is to reach the goal in the shortest amount of time. There are a number of pits in the terrain (red cells) that represent the safety constraint and the agent gets a cost of 10 on passing through any pit cell. Occasionally, with probability $p = 0 . 0 5$ , a random action will be executed instead of the one selected by the agent. Thus, the task is to reach to the goal in the shortest amount of time, while passing through the red grids at most $d _ { 0 } / 1 0$ times. The size of the grid is $1 2 \times 1 2$ cells, and the pits are randomly generated for each grid with probability $\rho = 0 . 3$ . The agent starts at (12, 12) and the goal is selected uniformly on $( \alpha , 0 )$ , where $\alpha \sim U ( 0 , 1 2 )$ . The threshold $d _ { 0 } = 2 0$ implies the agent can pass at most two pits. The maximum horizon is 200 steps, after which the episode terminates. + +We use the action elimination procedure described in Sec 4.1 in combination with $n$ -step SARSA (Rummery & Niranjan, 1994; Peng & Williams, 1994) using neural networks and multiple synchronous agents as in Mnih et al. (2016). We use $\epsilon$ -greedy exploration. The results are shown in Fig. 1 (more experimental details can be found in Appendix H). We observe that the agent is able to respect the safety constraints more adequately than the Lyapunov-based method, albeit at the expense of some decrease in return, which is the expected trade-off for satisfying the constraints. + +# 6.2 MUJOCO BENCHMARKS + +Based on the safety experiments in Achiam et al. (2017); Chow et al. (2019), we design three simulated robot locomotion continuous control tasks using the MuJoCo simulator (Todorov et al., 2012) and OpenAI Gym (Brockman et al., 2016): (1) Point-Gather: A point-mass agent $( S \subseteq \mathbb { R } ^ { 9 } , A \subseteq \mathbb { R } ^ { 2 } )$ is rewarded for collecting the green apples and constrained to avoid the red bombs; (2) Safe-Cheetah: A bi-pedal agent $( S \subseteq \mathbb { R } ^ { 1 8 } , A \subseteq \bar { \mathbb { R } } ^ { \bar { 6 } } )$ is rewarded for running at high speed, but at the same time constrained by a speed limit; (3) Point-Circle: The point-mass agent $( S \subseteq \mathbb { R } ^ { 9 } , A \subseteq \mathbb { R } ^ { 2 } )$ is rewarded for running along the circumference of a circle in counter-clockwise direction, but is constrained to stay within a safe region smaller than the radius of the circle. + +We integrate our method on top of the A2C algorithms (Mnih et al., 2016) and PPO (Schulman et al., 2017), using the procedure described in Section 4.2. More details about the tasks and network architecture can be found in the Appendix I. Algorithmic details can be found in Appendix J. The results with A2C are shown in Fig. 2 and the results with PPO are shown in Fig. 3. We observe that our Safe method is able to respect the safety constraint throughout most of the learning, and with much greater degree of compliance than the Lyapunov-based method, especially when combined with A2C. The one case where the Safe method fails to respect the constraint is in Point-Circle with PPO (Fig. 3(c)). Upon further examination, we note that the training in this scenario has one of two outcomes: some runs end with the learner in an infeasible set of states from which it cannot recover; other runs end in a good policy that respects the constraint. We discuss solutions to overcome this in the final section. + +![](images/3b4052a22ce8846d401fa4615e7efc0de148e614012456de72475e384e75a14d.jpg) +Figure 1: (a) Example of a gridworld environment. (b,c) Performance over the training for Unconstrained (red), Lyapunov-based (green), and our method (blue) all trained with n-step SARSA on 2D GridWorld task over 20 random seeds. The $\mathbf { X }$ -axis is the number of episodes in thousands. The dotted black line in (c) denotes the constraint threshold, $d _ { 0 }$ . The bold line represents mean, and the shaded region denotes $80 \%$ confidence-intervals. + +# 7 DISCUSSION + +We present a method for solving constrained MDPs that respects trajectory-level constraints by converting them into state dependent value-based constraints, and show how the method can be used to handle safety limitations in both discrete and continuous spaces. The main advantage of our approach is that the optimization problem is more easily solved with value-based constraints, while providing similar guarantees and requiring less approximations. The empirical results presented show that our approach is able to solve the tasks with good performance while maintaining safety throughout training. It is important to note that there is a fundamental trade-off between exploration and safety. It is impossible to be $100 \%$ safe without some knowledge; in cases where that knowledge is not provided a priori, it must be acquired through exploration. We see this in some of our results (Gridworld, Point-Circle) where our safe policy goes above the constraint in the very early phases of training (all our experiments started from a random policy). We note that the other methods also suffer from this shortcoming. An open question is how to provide initial conditions or a priori knowledge, to avoid this burn-in phase. Another complementary strategy to explore is for cases where an agent is stuck in an unsafe or infeasible policy space, where a recovery method (trained by purely minimizing the constraints) could be useful to help the agent recover (Achiam et al., 2017; Chow et al., 2019). + +![](images/c1f70449eff4a9665f06b9ffe485a3c12e833d5172e744ca166dd7aed6222a77.jpg) +Figure 2: A2C Performance over the training for Unconstrained (red), Lyapunov-based (green), and our method (blue) all trained with A2C on MuJoCo tasks over 10 random seeds. The $\mathbf { X }$ -axis is the number of episodes in thousands. The dotted black line denotes $d _ { 0 }$ . The bold line represents the mean, and the shaded region denotes the $80 \%$ confidence-intervals. + +![](images/4338cd35459809c48e19e12d0c1097bf16b5d282705518666c09c5ef42cfe47e.jpg) +Figure 3: PPO Performance over the training for Unconstrained (red), Lyapunov-based (green), and our method (blue) all trained with PPO on MuJoCo tasks over 10 random seeds. The $\mathbf { X }$ -axis is the number of episodes in thousands, and y-axis denotes the undiscounted accumulated returns. The dotted black line denotes $d _ { 0 }$ . The bold line represents the mean, and the shaded region denotes the $80 \%$ confidence-intervals. + +# REFERENCES + +Pieter Abbeel and Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ . Apprenticeship learning via inverse reinforcement learning. In Proceedings of the twenty-first international conference on Machine learning, pp. 1. ACM, 2004. + +Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. arXiv preprint arXiv:1705.10528, 2017. + +Eitan Altman. Constrained Markov decision processes, volume 7. CRC Press, 1999. + +Felix Berkenkamp, Matteo Turchetta, Angela Schoellig, and Andreas Krause. Safe model-based reinforcement learning with stability guarantees. In Advances in Neural Information Processing Systems, pp. 908–919, 2017. + +Dimitri P Bertsekas, Dimitri P Bertsekas, Dimitri P Bertsekas, and Dimitri P Bertsekas. Dynamic programming and optimal control, volume 1. Athena scientific Belmont, MA, 1995. + +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. + +Yinlam Chow, Mohammad Ghavamzadeh, Lucas Janson, and Marco Pavone. Risk-constrained reinforcement learning with percentile risk criteria. arXiv preprint arXiv:1512.01629, 2015. + +Yinlam Chow, Ofir Nachum, Edgar Duenez-Guzman, and Mohammad Ghavamzadeh. A lyapunovbased approach to safe reinforcement learning. arXiv preprint arXiv:1805.07708, 2018. + +Yinlam Chow, Ofir Nachum, Aleksandra Faust, Mohammad Ghavamzadeh, and Edgar DuenezGuzman. Lyapunov-based safe policy optimization for continuous control. arXiv preprint arXiv:1901.10031, 2019. + +Gal Dalal, Krishnamurthy Dvijotham, Matej Vecerik, Todd Hester, Cosmin Paduraru, and Yuval Tassa. Safe exploration in continuous action spaces. arXiv preprint arXiv:1801.08757, 2018. + +Prafulla Dhariwal, Christopher Hesse, Oleg Klimov, Alex Nichol, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, Yuhuai Wu, and Peter Zhokhov. Openai baselines. https: //github.com/openai/baselines, 2017. + +Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continuous control. In International Conference on Machine Learning, pp. 1329–1338, 2016. + +Benjamin Eysenbach, Shixiang Gu, Julian Ibarz, and Sergey Levine. Leave no trace: Learning to reset for safe and autonomous reinforcement learning. arXiv preprint arXiv:1711.06782, 2017. + +Hassan K Khalil. Nonlinear systems. 1996. + +Torsten Koller, Felix Berkenkamp, Matteo Turchetta, and Andreas Krause. Learning-based model predictive control for safe exploration and reinforcement learning. arXiv preprint arXiv:1803.08287, 2018. + +Vijay R Konda and John N Tsitsiklis. Actor-critic algorithms. In Advances in neural information processing systems, pp. 1008–1014, 2000. + +Ilya Kostrikov. Pytorch implementations of reinforcement learning algorithms. https://github. com/ikostrikov/pytorch-a2c-ppo-acktr-gail, 2018. + +Jan Leike, Miljan Martic, Victoria Krakovna, Pedro A Ortega, Tom Everitt, Andrew Lefrancq, Laurent Orseau, and Shane Legg. Ai safety gridworlds. arXiv preprint arXiv:1711.09883, 2017. + +Ian Michael Mitchell. Application of level set methods to control and reachability problems in continuous and hybrid systems. 2003. + +Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pp. 1928–1937, 2016. + +Teodor Mihai Moldovan and Pieter Abbeel. Safe exploration in markov decision processes. arXiv preprint arXiv:1205.4810, 2012. + +Tetsuro Morimura, Eiji Uchibe, Junichiro Yoshimoto, Jan Peters, and Kenji Doya. Derivatives of logarithmic stationary distributions for policy gradient reinforcement learning. Neural Computation, 22(2):342–376, 2010. doi: 10.1162/neco.2009.12-08-922. URL https://doi.org/10. 1162/neco.2009.12-08-922. PMID: 19842990. + +Gergely Neu, Anders Jonsson, and Vicenç Gómez. A unified view of entropy-regularized markov decision processes. arXiv preprint arXiv:1705.07798, 2017. + +Jing Peng and Ronald J Williams. Incremental multi-step q-learning. In Machine Learning Proceedings 1994, pp. 226–232. Elsevier, 1994. + +Joelle Pineau. The machine learning reproducibility checklist. https://www.cs.mcgill.ca/ \~jpineau/ReproducibilityChecklist.pdf, 2018. + +Martin L Puterman. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons, 2014. + +Gavin A Rummery and Mahesan Niranjan. On-line Q-learning using connectionist systems, volume 37. University of Cambridge, Department of Engineering Cambridge, England, 1994. + +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. + +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. + +Richard S Sutton. Learning to predict by the methods of temporal differences. Machine learning, 3 (1):9–44, 1988. + +Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. + +Aviv Tamar, Dotan Di Castro, and Shie Mannor. Policy evaluation with variance related risk criteria in markov decision processes. arXiv preprint arXiv:1301.0104, 2013. + +Chen Tessler, Daniel J Mankowitz, and Shie Mannor. Reward constrained policy optimization. arXiv preprint arXiv:1805.11074, 2018. + +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. + +Matteo Turchetta, Felix Berkenkamp, and Andreas Krause. Safe exploration in finite markov decision processes with gaussian processes. In Advances in Neural Information Processing Systems, pp. 4312–4320, 2016. + +Akifumi Wachi, Yanan Sui, Yisong Yue, and Masahiro Ono. Safe exploration and optimization of constrained mdps using gaussian processes. In AAAI Conference on Artificial Intelligence (AAAI), 2018. + +Yuhuai Wu, Elman Mansimov, Roger B Grosse, Shun Liao, and Jimmy Ba. Scalable trust-region method for deep reinforcement learning using kronecker-factored approximation. In Advances in neural information processing systems, pp. 5279–5288, 2017. + +# A REPRODUCIBILITY CHECKLIST + +We follow the reproducibility checklist (Pineau, 2018) and point to relevant sections explaining them here. For all algorithms presented, check if you include: + +• A clear description of the algorithm. The algorithms are explained in Sec. J. Any additional details for Discrete methods are provided in Sec. 4.1, and for continuous Sec. 4.2. +• An analysis of the complexity (time, space, sample size) of the algorithm. The analytical solution in Eq. (5) consists of a few vector arithmetic and relu operator and as such has the same complexity as the baselines. For the discrete case, with deterministic policies the solution again can be implemented as part of the computation graph, consisting of basic vector arithmetic operations, and has very little additional overhead. For discrete actions with stochastic policies, one needs to sovle the LP problem in (SPI). In that case the complexity is same as the baseline safe-methods (Lyapunov), and is higher than the unconstrained versions. In terms of computation time (for Deep-RL experiments) the newly proposed algorithms are almost identical to the baselines due to its parallelizable nature. We do not make any claims about the sample complexity. +• A link to a downloadable source code, including all dependencies. The code will be made available after the acceptance of the paper. + +For any theoretical claim, check if you include: + +• A statement of the result. See the main paper for all the claims we make. Additional details are provided in the Appendix. +• A clear explanation of any assumptions. See the main paper for all the assumptions. +• A complete proof of the claim. See the main paper. The cross references to the proofs in the Appendix have been included in the main paper. + +For all figures and tables that present empirical results, check if you include: + +• A complete description of the data collection process, including sample size. For the base agent we standard benchmarks provided in OpenAI Gym (Brockman et al., 2016), and rllab (Duan et al., 2016). We use the code from Achiam et al. (2017) for building the Point-Circle and Point-Gather environments. + +• A link to downloadable version of the dataset or simulation environment. See: github.com/openai/gym for OpenAI Gym benchmarks, github.com/jachiam/cpo for rllab based Circle and Gather environments. + +• An explanation of how samples were allocated for training / validation / testing. We do not use a split as we run multiple runs over random seeds to examine the optimization performance. + +• An explanation of any data that were excluded. NA • The range of hyper-parameters considered, method to select the best hyper-parameter configuration, and specification of all hyper-parameters used to generate results. The default hyper-parameters for the MuJoCo baselines are taken from Kostrikov (2018). The ranges and parameters for Grid experiments are described in Sec. H, and for MuJoCo are described in Sec. I. + +• The exact number of evaluation runs. The number of evaluation runs is mentioned in the caption corresponding to each result. + +• A description of how experiments were run. See Experiments Sec. 6 in the main paper and in the Appendix Sec. H and Sec. I. + +• A clear definition of the specific measure or statistics used to report results. Undiscounted return and cost using the current policy over the horizon are plotted after every 1000 episodes are plotted. We use a linear-filter with 0.7 weight for smoothing. We use the smooting algorithm provided by TensorBoard (https://github.com/tensorflow/ tensorboard). + +• Clearly defined error bars. Standard error used in all cases. +• A description of results with central tendency (e.g. mean) and variation (e.g. stddev). The bold lines in the figure represent the mean, and the shaded region denotes the $8 0 \%$ confidence interval. +• A description of the computing infrastructure used. We distribute all runs across 10 CPU nodes (Intel(R) Xeon(R) CPU E5-2650 v4) and 1 GPU (GP 100) per run for experiments. + +# B BACKWARD VALUE FUNCTIONS + +We have the following result from Proposition 1 from Morimura et al. (2010). We give the proof too for the sake of completeness. + +Proposition B.1. Let the forward Markov chain $\mathcal { M } ( \pi )$ be irreducible and ergodic, i.e., has a stationary distribution. Then the associated backward Markov chain $\overleftarrow { B } ( \pi )$ is also ergodic and has the same unique stationary distribution as $\mathcal { M } ( \pi )$ : + +$$ +\eta ^ { \pi } ( x ) = \overleftarrow { \eta } ^ { \pi } ( x ) , +$$ + +$$ +( \forall x \in { \mathcal { X } } ) +$$ + +where $\eta ^ { \pi } ( x )$ and $\overleftarrow { \eta } ^ { \pi } ( x )$ are the stationary distributions of $\mathcal { M } ( \pi )$ and $\overleftarrow { B } ( \pi )$ . + +Proof. Multiply both sides of Eq. (1) by $\eta ^ { \pi } ( x _ { t } )$ and sum over all actions $a _ { t - 1 } \in { \mathcal { A } }$ we obtain detailed balance like equations (with respect to time): + +$$ +\begin{array} { r } { \overleftarrow { \mathcal { P } } ^ { \pi } ( x _ { t - 1 } | x _ { t } ) \eta ^ { \pi } ( x _ { t } ) = \mathcal { P } ^ { \pi } ( x _ { t } , a _ { t - 1 } | x _ { t - 1 } ) \eta ^ { \pi } ( x _ { t - 1 } ) . \qquad ( \forall x _ { t - 1 } \in \mathcal { X } , x _ { t } \in \mathcal { X } ) } \end{array} +$$ + +Sum over all possible $x _ { t }$ we have: + +$$ +\sum _ { x _ { t } \in \mathcal { X } } \overleftarrow { \mathcal { P } } ^ { \pi } ( x _ { t - 1 } | x _ { t } ) \eta ^ { \pi } ( x _ { t } ) = \eta ^ { \pi } ( x _ { t - 1 } ) . +$$ + +The above equation indicates that $\overleftarrow { B } ( \pi )$ has same stationary distribution as $\mathcal { M } ( \pi )$ . In the matrix form the above equation can be written as $\eta \overleftarrow { P } ^ { \pi } = \eta$ , that implies that $\eta$ is stationary distribution with $\scriptstyle \overleftarrow { P } ^ { \pi }$ transition matrix. + +# B.1 RELATION BETWEEN FORWARD AND BACKWARD MARKOV CHAINS AND BACKWARD VALUE FUNCTIONS + +Proof. We use the technique of Proposition 2 of Morimura et al. (2010) to prove this. Using the Markov property and then substituting Eq. (1) for each term we have: + +$$ +\begin{array} { r l } & { \overline { { \mathfrak { p } } } ^ { \pi } ( x _ { t - 1 } , a _ { t - 1 } , \dots , x _ { t - K } , a _ { t - K } | x _ { t } ) = \overline { { \mathcal { P } } } ^ { \pi } ( x _ { t - 1 } , a _ { t - 1 } | x _ { t } ) \dots \overleftarrow { \mathcal { P } } ^ { \pi } ( x _ { t - K } , a _ { t - K } | x _ { t - K + 1 } ) , } \\ & { \qquad = \frac { \mathcal { P } ^ { \pi } ( x _ { t } , a _ { t - 1 } | x _ { t - 1 } ) \dots \mathcal { P } ^ { \pi } ( x _ { t - K + 1 } , a _ { t - K } | x _ { t - K } ) \eta ^ { \pi } ( x _ { t - K } ) } { \eta ^ { \pi } ( x _ { t } ) } , } \\ & { \qquad \propto \mathcal { P } ^ { \pi } ( x _ { t } , a _ { t - 1 } | x _ { t - 1 } ) \dots \mathcal { P } ^ { \pi } ( x _ { t - K + 1 } , a _ { t - K } | x _ { t - K } ) \eta ^ { \pi } ( x _ { t - K } ) . } \end{array} +$$ + +This proves the proposition for finite $K$ . Using the Prop. B.1, $K \infty$ case is proven too: + +$$ +\begin{array} { l } { \displaystyle \underset { K \to \infty } { \operatorname* { l i m } } \mathbb { E } _ { \overleftarrow { \mathcal { B } } ( \pi ) } \left[ \displaystyle \sum _ { k = 0 } ^ { K } d ( x _ { t - k } ) | x _ { t } \right] = \displaystyle \operatorname* { l i m } _ { K \to \infty } \mathbb { E } _ { \mathcal { M } ( \pi ) } \left[ \displaystyle \sum _ { k = 0 } ^ { K } d ( x _ { t - k } ) | x _ { t } , \eta ^ { \pi } ( x _ { t - K } ) \right] , \medskip } \\ { \displaystyle = \displaystyle \sum _ { x \in \mathcal { X } } \sum _ { a \in \mathcal { A } } \pi ( a | x ) \eta ^ { \pi } ( x ) d ( x ) . } \end{array} +$$ + +# B.2 TD FOR BVF + +Proof. We use the same technique from Stochastic Shortest Path dynamic programming (Bertsekas et al., 1995, Vol 2, Proposition 1.1) to prove the above proposition. The general outline of the proof is given below, for more details we refer the reader to the textbook. + +We have, + +$$ +{ \mathrm { } } ^ { \pi } { } ^ { } { \mathrm { } } V = d + { \overleftarrow { P } } ^ { \pi } { \overleftarrow { V } } . +$$ + +(Eq. (4) in matrix notation) + +Using induction argument, we have for all $\mathbf { \overline { { V } } } \in \mathbb { R } ^ { n }$ and $k \geq 1$ , we have: + +$$ +\left( \overleftarrow { \boldsymbol { \mathcal { T } } } ^ { \pi } \right) ^ { k } \overleftarrow { \boldsymbol { V } } = \left( \overleftarrow { \boldsymbol { P } } ^ { \pi } \right) ^ { k } \overleftarrow { \boldsymbol { V } } + \sum _ { m = 0 } ^ { k - 1 } { \left( \overleftarrow { \boldsymbol { P } } ^ { \pi } \right) ^ { m } } d , +$$ + +Taking the limit, and using the result, $\begin{array} { r } { \operatorname* { l i m } _ { k \to \infty } \left( \overleftarrow { P } ^ { \pi } \right) ^ { k } \overleftarrow { V } = 0 } \end{array}$ , regarding proper policies from Bertsekas et al. (1995, Vol 2, Equation 1.2), we have: + +$$ +\operatorname* { l i m } _ { k \to \infty } \left( { \overleftarrow { \mathcal { T } } } ^ { \pi } \right) ^ { k } { \overleftarrow { V } } = \operatorname* { l i m } _ { k \to \infty } \sum _ { m = 0 } ^ { k - 1 } { \left( { \overleftarrow { P } } ^ { \pi } \right) } ^ { m } d = { \overleftarrow { V } } ^ { \pi } , +$$ + +Also we have by definition: + +$$ +\left( \overleftarrow { T } ^ { \pi } \right) ^ { k + 1 } \overleftarrow { V } = d + \overleftarrow { P } ^ { \pi } \left( \overleftarrow { T } ^ { \pi } \right) ^ { k } \overleftarrow { V } , +$$ + +and by taking the limit $k \to \infty$ , we have: + +$$ +\begin{array} { r } { \overleftarrow { V } ^ { \pi } = d + \overleftarrow { P } ^ { \pi } \overleftarrow { V } ^ { \pi } , } \end{array} +$$ + +which is equivalent to, + +$$ +\mathbf { \Sigma } ^ { \pi } = \mathbf { \Sigma } ^ { \pi } \mathbf { \Sigma } ^ { \pi } . +$$ + +To show uniqueness, note that if $\mathbf { \Sigma } _ { \overline { { V } } } ^ { } = \mathbf { \Sigma } ^ { \pi } \mathbf { \Sigma } _ { \overline { { V } } } ^ { }$ , then $\overleftarrow { V } = \left( \overleftarrow { \mathcal { T } } ^ { \pi } \right) ^ { k } \overleftarrow { V }$ for all $k$ and letting $k \to \infty$ we get $\overleftarrow { V } = \overleftarrow { V } ^ { \pi }$ . + +# C VALUE-BASED CONSTRAINT LEMMA + +Lemma C.1. $\begin{array} { r } { \mathbb { E } \left[ \sum _ { k = t } ^ { T } d ( x _ { k } ) \mid x _ { 0 } , \pi \right] \leq \mathbb { E } _ { x _ { t } \sim \delta _ { x _ { 0 } } ( P ^ { \pi } ) ^ { t } } \left[ V _ { D } ^ { \pi } ( x _ { t } ) \right] \mathrm { a n d } \mathbb { E } \left[ \sum _ { k = 0 } ^ { t } d ( x _ { k } ) \mid \operatorname { c o r s c o s } ( x _ { k } ) \mid \operatorname { c o r s c o s } ( x _ { k } ) \mid \operatorname { c o r s c o s } ( x _ { k } ) \right] } \end{array}$ $\begin{array} { r } { \mathbb { E } \left[ \sum _ { k = 0 } ^ { t } d ( x _ { k } ) \mid x _ { 0 } , \pi \right] \leq } \end{array}$ $\mathbb { E } _ { \boldsymbol { x } _ { k } \sim \delta _ { \boldsymbol { x } _ { 0 } } ( { P } ^ { \pi } ) ^ { t } } \left[ \overleftarrow { V } _ { \mathcal { D } } ^ { \bar { \pi } } ( \boldsymbol { x } _ { k } ) \right]$ + +Proof. Follows since adding more steps to the trajectory (from $T \mathrm { ~ - ~ } t$ steps to $T$ ) can only increase the expected total cost. $\begin{array} { r c l } { \mathbb { E } \left[ \sum _ { k = t } ^ { T } d ( x _ { k } ) \mid x _ { 0 } , \pi \right] } & { = } & { \delta _ { x _ { 0 } } ( P ^ { \pi } ) ^ { t } \left( \sum _ { k = t } ^ { T } ( P ^ { \pi } ) ^ { k } \right) d } \end{array} \leq$ $\begin{array} { r } { \delta _ { x _ { 0 } } ( P ^ { \pi } ) ^ { t } \left( \sum _ { k = t } ^ { T + t } ( P ^ { \pi } ) ^ { k } \right) d = \mathbb { E } _ { x _ { t } \sim \delta _ { x _ { 0 } } ( P ^ { \pi } ) ^ { t } } \left[ V _ { \mathcal { D } } ^ { \pi } ( x _ { t } ) \right] . } \end{array}$ . The backward case is analogous. □ + +# D PROPERTIES OF THE POLICY ITERATION (SPI) + +Theorem D.1. Let $\begin{array} { r } { \sigma ( x ) : = \mathrm { T V } ( \pi _ { k + 1 } ( \cdot | x ) , \pi _ { k } ( \cdot | x ) ) = ( 1 / 2 ) \sum _ { a } \left| \pi _ { k + 1 } ( a | x ) - \pi _ { k } ( a | x ) \right| } \end{array}$ denote the total variation between policies $\pi _ { k } ( \cdot | x )$ and $\pi _ { k + 1 } ( \cdot | x )$ . If the policies are updated sufficiently slowly and $\pi _ { k }$ is feasible, then so is $\pi _ { k + 1 }$ . More specifically: + +(I) If $\pi _ { k }$ is feasible at $x _ { 0 }$ and $\begin{array} { r } { \sigma ( x ) \leq \frac { d _ { 0 } - V _ { \mathcal { D } } ^ { \pi _ { k } } ( x _ { 0 } ) } { 2 T ^ { 2 } D _ { \mathrm { M A X } } } \forall x } \end{array}$ ) ∀x then πk+1 is feasible at x0. + +$\mathbf { \Pi } ^ { ( \mathbf { I I } ) }$ If $\pi _ { k }$ is feasible everywhere (i.e. $\begin{array} { r l r } { V _ { \mathcal { D } } ^ { \pi _ { k } } ( x ) } & { { } \le } & { d _ { 0 } \forall x ) } \end{array}$ and $\sigma ( x )$ ≤ $\frac { d _ { 0 } - V _ { \mathcal { D } } ^ { \pi _ { k } } \left( x \right) } { 2 T \operatorname* { m a x } _ { x ^ { \prime } } \left\{ d _ { 0 } - \overline { { V } } _ { \mathcal { D } } ^ { \pi _ { k } } \left( x ^ { \prime } \right) - d ( x ^ { \prime } ) \right\} } \forall x$ then $\pi _ { k + 1 }$ is feasible everywhere. + +We note that the second case allows the policies to be updated in a larger neighborhood but requires $\pi _ { k }$ to be feasible everywhere. By contrast the first item updates policies in a smaller neighbourhood but only requires feasibility at the starting state. + +Proof. Similar to the analysis in Chow et al. (2018). We aim to show that $V _ { \mathcal { D } } ^ { \pi _ { k + 1 } } ( x _ { 0 } ) \leq d _ { 0 }$ . For simplicity we consider $k = 0$ , and by induction the other cases will follow. We write $P _ { 0 } =$ $P ^ { \pi _ { 0 } } , P _ { 1 } = P ^ { \pi _ { 1 } }$ , $\Delta ( a | x ) = \pi _ { 1 } ( a | x ) - \pi _ { 0 } ( a | x )$ , and $\begin{array} { r } { P _ { \Delta } = \left[ \sum _ { a \in A } \Delta ( a | x ) P ( x ^ { \prime } | x , a ) \right] _ { \{ x ^ { \prime } , x \} } } \end{array}$ . Note that $( I - P _ { 0 } ) = ( I - P _ { 1 } + P _ { \Delta } )$ , and therefore $( I - P _ { 1 } + P _ { \Delta } ) ( I - P _ { 0 } ) ^ { - 1 } = I _ { | \mathcal { X } | \times | \mathcal { X } | }$ . Thus, we find + +$$ +( I - P _ { 0 } ) ^ { - 1 } = ( I - P _ { 1 } ) ^ { - 1 } ( I _ { | \mathcal { X } | \times | \mathcal { X } | } + P _ { \Delta } ( I - P _ { 0 } ) ^ { - 1 } ) . +$$ + +Multiplying both sides by the cost vector $d$ one has + +$$ +V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ) = \mathbb { E } \left[ \sum _ { t = 0 } ^ { T } d ( x _ { t } ) + \varepsilon ( x _ { t } ) \mid \pi _ { 1 } , x \right] , +$$ + +for each $x$ , where $\begin{array} { r } { \varepsilon ( x ) = \sum _ { a \in A } \Delta ( a | x ) \sum _ { x ^ { \prime } \in \mathcal { X } } P ( x ^ { \prime } | x , a ) V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ^ { \prime } ) } \end{array}$ . Splitting the expectation, we have + +$$ +V _ { \mathcal { D } } ^ { \pi _ { 1 } } ( x ) = V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ) - \mathbb { E } \left[ \sum _ { t = 0 } ^ { T } \varepsilon ( x _ { t } ) \mid \pi _ { 1 } , x \right] +$$ + +For case (I) we note that $V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ^ { \prime } ) \le D _ { \mathrm { M A X } } T$ and so $- 2 \sigma ( x _ { t } ) D _ { \mathrm { M A X } } T \le \varepsilon ( x _ { t } ) \forall x _ { t }$ . Using $\sigma ( x _ { t } ) \leq$ $( d _ { 0 } - V _ { \mathcal { D } } ^ { \pi _ { k } } ) / 2 D _ { \mathrm { M A X } } T ^ { 2 }$ gives $V _ { \mathcal { D } } ^ { \pi _ { 1 } } ( x _ { 0 } ) \leq V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x _ { 0 } ) - 2 D _ { \mathrm { M A X } } T ^ { 2 } ( d _ { 0 } - V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x _ { 0 } ) ) / ( 2 D _ { \mathrm { M A X } } T ^ { 2 } ) = d _ { 0 }$ , i.e. $\pi _ { 0 }$ is feasible at $x _ { 0 }$ . + +For case ${ \bf ( I I ) }$ we note that $V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ) \leq \operatorname* { m a x } _ { x ^ { \prime } } \{ d _ { 0 } - \overleftarrow { V } _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ^ { \prime } ) - d ( x ^ { \prime } ) \} = : \Theta$ since $\pi _ { 0 }$ is feasible at every $x$ . As before, we have $- 2 \sigma ( x _ { t } ) \Theta \le \varepsilon ( x _ { t } ) \ \forall x _ { t }$ and so $V _ { \mathcal { D } } ^ { \pi _ { 1 } } ( x ) \le V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ) - 2 \Theta T ( d _ { 0 } -$ $V _ { \mathcal { D } } ^ { \pi _ { 0 } } ( x ) ) / ( 2 \Theta T ) = d _ { 0 } \forall x$ , i.e. $\pi _ { 1 }$ is feasible everywhere. + +Theorem D.2. Let $\pi _ { n }$ and $\pi _ { n + 1 }$ be successive policies generated be the policy iteration algorithm of (SPI). Then $V ^ { \pi _ { n + 1 } } \geq V ^ { \pi _ { n } }$ . + +Proof. Note that $\pi _ { n + 1 }$ and $\pi _ { n }$ are both feasible solutions of the LP (SPI). Since $\pi _ { n + 1 }$ maximizes $V ^ { \pi }$ over all feasible solutions, the result follows. + +# E ANALYTICAL SOLUTION OF THE UPDATE - DISCRETE CASE + +We follow the same procedure as (Chow et al., 2018, Section E.1) to convert the problem to its Shannon entropy regularized version: + +$$ +\begin{array} { r l } { \underset { \pi \in \Delta } { \operatorname* { m a x } } } & { \pi ( . | x ) ^ { T } ( Q ( x , . ) + \tau \log \pi ( . | x ) ) , } \\ { \mathrm { s . t . } } & { \pi ( . | x ) ^ { T } Q _ { \mathcal { D } } ( x , . ) + \overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x ) - d ( x ) \leq d _ { 0 } , } \end{array} +$$ + +where $\tau > 0$ is a regularization constant. Consider the Lagrangian problem for optimization: + +$$ +\operatorname* { m a x } _ { \lambda \geq 0 } \operatorname* { m a x } _ { \pi \in \Delta } \Gamma _ { x } ( \pi , \lambda ) = \pi ( . | x ) ^ { T } ( Q ( x , . ) + \lambda Q _ { \mathcal { D } } ( x , . ) + \tau \log \pi ( . | x ) ) + \lambda ( d _ { 0 } + d ( x ) - \overleftarrow { V } ( x ) ) +$$ + +From entropy-regularized literature (Neu et al., 2017), the inner $\lambda$ -solution policy has the form: + +$$ +\pi _ { \Gamma , \lambda } ^ { * } ( . | x ) \propto \exp { \left( - \frac { Q ( x , . ) + \lambda Q _ { \mathcal { D } } ( x , . ) } { \tau } \right) } +$$ + +We now need to solve for the optimal lagrange multiplier $\lambda ^ { * }$ at $x$ . + +$$ +\operatorname* { m a x } _ { \lambda \geq 0 } - \tau \log - \mathrm { s u m - e x p } \left( - \frac { Q ( x , . ) + \lambda Q _ { \mathcal { D } } ( x , . ) } { \tau } \right) + \lambda ( d _ { 0 } + d ( x ) - \overleftarrow { V } _ { \mathcal { D } } ( x ) ) , +$$ + +where log-sum- $\begin{array} { r } { \exp ( y ) = \log \sum _ { a } e x p ( y _ { a } ) } \end{array}$ is a convex function in $y$ , and objective is a concave function of $\lambda$ . Using KKT conditions, the $\nabla _ { \lambda }$ gives the solution: + +$$ +\left( d _ { 0 } + d ( x ) - \overleftarrow { V } _ { \mathcal { D } } ( x ) \right) - \frac { \sum _ { a } Q _ { \mathcal { D } } ( x , a ) \exp ( \left( - \frac { Q ( x , a ) + \lambda Q _ { \mathcal { D } } ( x , a ) } { \tau } \right) ) } { \sum _ { a } \exp ( \left( - \frac { Q ( x , a ) + \lambda Q _ { \mathcal { D } } ( x , a ) } { \tau } \right) ) } = 0 +$$ + +Using parameterization of $z = \exp ( - \lambda )$ , the above condition can be written as polynomial equation in $z$ : + +$$ +\sum _ { a } \left( d _ { 0 } + d ( x ) - \overleftarrow { V } _ { \mathcal { D } } ( x ) - Q _ { \mathcal { D } } ( x , a ) \right) \cdot \left( \exp ( - \frac { Q ( x , a ) } { \tau } ) \right) z ^ { \frac { Q _ { \mathcal { D } } ( x , a ) } { \tau } } = 0 +$$ + +The roots to this polynomial will give $0 ~ \leq ~ z ^ { * } ( x ) ~ \leq ~ 1$ , using which one can find $\lambda ^ { * } ( x ) \ =$ $- \log ( z ^ { * } ( x ) )$ . The roots can be found using the Newton’s method. The final optimal policy of the entropy-regularized process is then: + +$$ +\pi _ { \Gamma } ^ { * } \propto \exp \left( - \frac { Q ( x , \cdot ) + \lambda ^ { * } Q _ { \mathcal { D } } ( x , \cdot ) } { \tau } \right) +$$ + +# F EXTENSION OF SAFETY LAYER TO STOCHASTIC POLICIES WITH GAUSSIAN PARAMTERIZATION + +Consider stochastic gaussian policies parameterized by mean $\mu ( x ; \theta )$ and standard-deviation $\sigma ( x ; \phi )$ , and the actions sampled have the form $\mu ( x ; \theta ) + \sigma ( x ; \phi ) \epsilon$ , where $\epsilon \sim \mathcal { N } ( 0 , I )$ is the noise. Here, $< \mu ( x ; \theta ) , \sigma ( x ; \phi ) >$ are both deterministic w.r.t. the parameters $\theta , \phi$ and $x$ , and as such both of them together can be treated in the same way as deterministic policy $( \pi ( x ) = < \mu ( x ) , \sigma ( x ) > )$ . The actual action sampled and executed in the environment is still stochastic, but we have moved the stochasticity fron the policy to the environment. This allows us to define and work with action-value functions $Q _ { \mathcal { D } } ( x , \mu _ { \pi } ( x ) , \sigma _ { \pi } ( x ) )$ . In this case, the corresponding projected actions have the form $\mu ^ { \prime } + \sigma ^ { \prime } \epsilon$ . The main objective of the safety layer (without the constraints) can be further simplified as: + +$$ +\begin{array} { r l } & { \quad \mathrm { c r r o n s i n } \ : \sum _ { k = 0 } ^ { \infty } \operatorname* { m i n } _ { \rho \to \infty } \rho _ { k \to \infty , \infty , 0 \leq n \leq n } \left. \frac { 1 } { 2 } \left\| \left( \rho ^ { \prime } \right. - \rho ( k _ { \star } ( \sigma ) ) - ( \rho _ { \star \star } ( \sigma ) ) \right. \sigma _ { \star } ( \sigma ) \mathrm { c l } \rho \right. \right\| ^ { 2 } } \\ & { \quad \times \quad \mathrm { c r o n s i n } \ : \sum _ { k = 0 } ^ { \infty } \operatorname* { s u p } _ { \rho \to \infty , 0 \leq n \leq t _ { \star } } \left. \frac { 1 } { 2 } \left\| \left( \rho ^ { \prime } - \rho _ { \star \star } ( \sigma ) \right) + ( ( \sigma ^ { \prime } - \sigma _ { \star } ( \sigma ) ) ) \zeta \right\| ^ { 2 } \right. } \\ & { \quad \times \quad \mathrm { c r o n s i n } \ : \frac { 1 } { 2 } \sum _ { k = 0 } ^ { \infty } \operatorname* { c r o n s i n } _ { \rho \to \infty , 0 \leq n \leq t _ { \star } } \left. \frac { 1 } { 2 } \left\| \left( \rho ^ { \prime } - \rho _ { \star \star } ( \sigma ) \right) \right\| ^ { 2 } + \left\| ( \sigma ^ { \prime } - \sigma _ { \star } ( \sigma ) ) \right\| \mathrm { c r o s i n } \ : \rho ^ { \prime } + \frac { 2 } { \lambda } \leq \rho ^ { \prime } - \rho _ { \star \star } ( \sigma ) \mathrm { c r o s i n } \ : \rho ^ { \prime } \right. \leq \sigma _ { \star } ^ { \prime } } \\ & { \quad \times \frac { \mathrm { c r o n s i n } } { \rho ^ { \prime } \rho ^ { \prime } \rho ^ { \prime } } \frac { 1 } { 2 } \left( \left\| \partial ^ { 2 } - \mu ( \sigma ) \right\| ^ { 2 } + \Xi _ { \infty < \infty , \infty , 0 \leq n } \left. \left. ( \sigma ^ { \prime } - \sigma _ { \star } ( \sigma ) ) \right. \right\| ^ { 2 } \right) } \\ & \quad \times \frac { \mathrm { c r o s i n } } { \rho ^ { \prime } \rho ^ { \prime } } \frac { 1 } { 2 } \left( \left\| \partial ^ { 2 } - \mu _ { \star } ( \sigma ) \right\| ^ { 2 } + \left\| ( \sigma ^ { \prime } - \sigma _ { \star } ( \sigma ) ) \right\| ^ { 2 } \end{array} +$$ + +As both $\mu _ { \pi } ( . ; \theta )$ and $\sigma _ { \pi } ( . ; \phi )$ are modelled by independent set of parameters (different neural networks, usually) we can solve each of the safety layer problem independently, w.r.t. only those parameters. + +# G ANALYTICAL SOLUTION IN SAFETY LAYER + +The proof is similar to the proof of the Proposition 1 of Dalal et al. (2018). We have the following optimization problem: + +$$ +\begin{array} { r l } & { \displaystyle \arg \operatorname* { m i n } _ { \mu } [ \frac { 1 } { 2 } \| ( \mu - \mu _ { \pi } ( x ) \| ^ { 2 } ] , } \\ & { \displaystyle s . \mathrm { ~ t ~ . ~ } \quad \mathbf { \Sigma } _ { V } ^ { \pi } ( x ) - d ( x ) + Q _ { D } ^ { \pi } ( x , \mu _ { \pi } ( x ) ) + ( \mu - \mu _ { \pi } ( x ) ) ^ { T } ( \nabla Q _ { D } ^ { \pi } ( x , \mu ) | _ { \mu = \mu _ { \pi } ( x ) } ) \leq d _ { 0 } } \end{array} +$$ + +As the objective function and constraints are convex, and the feasible solution, $\mu ^ { * } , \lambda ^ { * }$ , should satisfy the KKT conditions. We define $\epsilon ( x ) = ( d _ { 0 } + d ( x ) - \overleftarrow { V } _ { \mathcal { D } } ^ { \pi } ( x ) - Q _ { \mathcal { D } } ^ { \pi } ( x , \mu _ { \pi } ( \overleftarrow { \lambda } ) ) )$ , and $g _ { \mu , \mathcal { D } } ( x ) =$ $\nabla Q _ { \mathcal { D } } ^ { \pi } ( x , u ) | _ { u = \mu _ { \pi } ( x ) }$ . Thus, we can write the Lagrangian as: + +$$ +L ( \mu , \lambda ) = \frac { 1 } { 2 } \left\| ( \mu - \mu _ { \pi } ( x ) \| ^ { 2 } + \lambda ( ( \mu - \mu _ { \pi } ( x ) ) ^ { T } g _ { \mu , \mathcal { D } } ( x ) - \epsilon ( x ) ) \right. +$$ + +From the KKT conditions, we get: + +$$ +\begin{array} { r } { \nabla _ { \mu } L = \mu - \mu _ { \pi } ( x ) + \lambda g _ { \mu , \mathcal { D } } ( x ) = 0 } \\ { ( \mu - \mu _ { \pi } ( x ) ) ^ { T } g _ { \mu , \mathcal { D } } ( x ) - \epsilon ( x ) = 0 } \end{array} +$$ + +From Eq. (7), we have: + +$$ +\mu ^ { * } = \mu _ { \pi } ( x ) - \lambda ^ { * } ( x ) \cdot g _ { \mu , D } ( x ) +$$ + +Substituting Eq. (9) in Eq. (8), we get: + +$$ +\begin{array} { r } { - \lambda ^ { * } ( x ) \cdot g _ { \mu , D } ( x ) ^ { T } g _ { \mu , D } ( x ) - \epsilon ( x ) = 0 } \\ { \lambda ^ { * } = \frac { - \epsilon ( x ) } { g _ { \mu , D } ( x ) ^ { T } g _ { \mu , D } ( x ) } } \end{array} +$$ + +When the constraints are satisfied $( \epsilon ( x ) > 0 )$ , the $\lambda$ should be inactive, and hence we have $( ) ^ { + }$ operator, that is 0 for negative values. + +# H DETAILS OF GRID-WORLD EXPERIMENTS + +# H.1 ARCHITECTURE AND TRAINING DETAILS + +We use one-hot encoding of the agent’s location in the grid as the observation, i.e. $x$ is a binary vector of dimension $\mathbb { R } ^ { 1 2 \times 1 2 }$ . The agent is trained for $2 0 0 \mathrm { k }$ episodes, and the current policy’s performance is evaluated after every 1k episodes. + +The same three layer neural network with the architecture is used for state encoding for all the different the estimators. The feed-forward neural network has hidden layers of size 64, 64, 64, and relu activations. For the state-action value based estimators, the last layer is a linear layer with 4 outputs, for each action. For value function based estimators the last layer is linear layer with a single output. + +We use Adam Optimizer for training all the estimators. A learning rate of 1e-3 was selected for all the reward based estimators and a learning rate of 5e-4 was selected for all the cost based estimators. The same range of learning rate parameters for considered for all estimators i.e. {1e-5, 5e-5, 1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1}. + +We use $\mathbf { n }$ -step trajectory length in A2C with $n = 4$ , i.e., trajectories of length $n$ were collected and the estimators were updated to used via the td-errors based on that. We use the number of parallel agents 20 in all the experiments. The range of parameters considered was $n \in \{ 1 , 4 , 2 0 \}$ . The same value of $n$ was used for all the baselines. + +![](images/d4d99889d39bf9a1060e808ee6bfbf2853dc4aa096bb03498c9b4191d742b1e8.jpg) +Figure 4: MuJoCo Safety Environments + +# I DETAILS OF THE MUJOCO EXPERIMENTS + +# I.1 ENVIRONMENTS DESCRIPTION + +• Point-Gather: The environment (Fig.4c) is taken from Achiam et al. (2017), where the point mass agent gets a reward of $+ 1 0 . 0$ for collecting a green apple, and a cost of 1 for collecting a red bomb. Two apples and eight bombs are spawned randomly at the start of each episode. The constraints are defined over the nmber of bombs collected over the episode. Episode horizon is 15 and threshold $d _ { 0 } = 4$ . + +• Safe-Cheetah: This environment (Fig.4b) is taken from Chow et al. (2019). A bi-pedal agent (HalfCheetah-v0) is augmented with speed safety constraints. The agent gets the reward based on the speed with which it runs, and the constrain is define on the speed to be less than 1, i.e., it gets a constraint cost based on $\mathbb { 1 } [ | v | > 1 ]$ , where $v$ is the velocity at the state. The maximum length of the episode is 200 and the constraint threshold is $d 0 = 5 0$ . + +• Point-Circle: This environment (Fig.4a) is taken from Achiam et al. (2017). The pointmass agent is rewarded for running along the circumference of a circle of radius 15 in counter-clockwise direction, with the reward and cost function: + +$$ +\begin{array} { l } { \displaystyle { R ( s ) = \frac { v ^ { T } [ - y , x ] } { 1 + | \| [ x , y ] \| _ { 2 } - 1 5 | } , } } \\ { \displaystyle { C ( s ) = \mathbb { 1 } [ | x | > 2 . 5 ] , } } \end{array} +$$ + +where $x , y$ are coordinates in the plane and $v$ is the velocity. The length of the episode is 65 and the constraint threshold $d _ { 0 } = 1 0 . 0$ . + +# I.2 NETWORK ARCHITECTURE AND TRAINING DETAILS + +The architecture and the training procedure is based on the open-source implementations (Kostrikov, 2018). All the value based estimators use a network architecture of 2 hidden layers of size 200, 50 hidden units with tanh non-linearity, followed by a linear layer with single output. For the actor, we model mean using a network architecture of 2 hidden layers of size 100, 50 hidden units with tanh non-linearity, followed by a linear layer with dimensions of the action-space and tanh non-linearity. For the $Q ( x , \mu )$ we also a 2 layer neural network with 200, ( $5 0 +$ action-dimension) hidden units and tanh non-linearity. We concatenate the mean in the second layer, and add a linear layer with single output in the end. + +Entropy regularization with $\beta = 0 . 0 0 1$ was used for all the experiments and the baselines. The trajectory length for different environments. For PPO GAE with $\lambda = 0 . 9 5$ was used for every algorithm. 20 parallel actors were used for every algorithm for each experiment. We searched the trajectory length hyper-parameter in the range 5,20,100 for every environment. We used the trajectory length of 1000 over which the samples are collected for PPO, for all environments. For the A2C experiments, for SafeCheetah trajectory length of 5 is used and for the rest 20 is used. + +We use Adam Optimizer for training all the estimators. The learning rate of the critic is always 0.5 the learning rate of the actor. For the cost estimators, the same learning rate was used for forward and backward estimators. The same range of learning rate parameters for considered for all estimators i.e. {1e-5, 5e-5, 1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1}. + +# I.3 OTHER DETAILS + +As we mentioned in Sec. 7, due to exploration the agent can potentially end up being in an infeasible policy space. To prevent that from happening a recovery policy (or safe-guard policy) (Achiam et al., 2017; Chow et al., 2019) is used to recover back to the feasible policy space. We run the experiments with and without the use of recovery policies (in the same procedure as the baselines), and chose the run that performs the best. We noticed that, empirically, for our approach recovery policies are only required for Point-Circle environments, as the agent has much more probability of being stuck in the constraint space. + +In order to take error due to function approximation into account, Achiam et al. (2017) use costshaping to smooth out the sparse constraint, and Chow et al. (2019) use a relaxed threshold, i.e. $d _ { 0 } \cdot ( 1 ^ { - } \delta )$ , instead of $d _ { 0 }$ , where $\delta \in ( 0 , 1 )$ . We run experiments with $\delta = \{ 0 . 0 , 0 . 2 \}$ for each algorithms, and use the best among them. We found that empirically, only for Safe-Cheetah $\delta = 0 . 2$ works better compared to $\delta = 0 . 0$ . + +# J ALGORITHM DETAILS + +# J.1 N-STEP SYNCHRONOUS SARSA + +The algorithm for n-step Synchronous SARSA is similar to the n-step Asynchronous Q-learning of Mnih et al. (2016), except that it uses SARSA instead of Q-learning, is synchronous, and instead of greedy maximization step of $\epsilon$ -greedy we use (SPI). When working with discrete actions and deterministic policies, this can be solved as part of the computation-graph itself. The algorithm is presented in Alg. 1. + +# J.2 A2C + +In Actor Critic (Konda & Tsitsiklis, 2000) algorithms, the parameterized policy (actor) is denoted by $\pi ( a | x ; \theta )$ , and is updated to minimizing the following loss: + +$$ +L ( \theta ) = \mathbb { E } [ - \log \pi ( a _ { t } | x _ { t } ; \theta ) ( r _ { t } + \gamma V ^ { \pi } ( x _ { t + 1 } - V _ { x _ { t } } ) ) ] +$$ + +The algorithm for A2C with Safety Layer given by Eq. (5) is similar to the Synchronous version of Actor-Critic (Mnih et al., 2016), except that it has estimates for the costs and safety-layer. Note that due to the projection property of the safety layer, it is possible to sample directly from the projected mean. Also, as the projection is a result of vector products and max, it is differentiable and and computed in-graph (via relu). The algorithm is presented in Alg. 2. + +# J.3 PPO + +The PPO algorithm build on top of the Actor-Critic algorithm and is very similar to Algorithm 2. The main difference is how the PPO loss for the actor is defined as: + +$$ +L ^ { C L I P } ( \boldsymbol { \theta } ) = \mathbb { E } [ \operatorname* { m i n } ( \rho _ { t } ( \boldsymbol { \theta } ) A _ { t } , c l i p ( \rho _ { t } ( \boldsymbol { \theta } ) , 1 - \epsilon , 1 + \epsilon ) A _ { t } ) ] , +$$ + +where the likelihood ration is $\begin{array} { r } { \rho _ { t } ( \theta ) = \frac { \pi _ { \theta } \left( a _ { t } \vert x _ { t } \right) } { \pi _ { \theta _ { o l d } } \left( a _ { t } \vert x _ { t } \right) } } \end{array}$ πθ(at|xt)πθ (at|xt) , with πold being the policy parameters before the update, $\epsilon < 1$ is a hyper-parameters that controls the clipping and $A _ { t }$ is the generalized advantage estimator: + +$$ +A _ { t } ^ { G A E ( \lambda , \gamma ) } = \sum _ { k = 0 } ^ { T - 1 } ( \lambda \gamma ) ^ { k } \delta _ { t + k } ^ { V ^ { \pi } } , +$$ + +# Algorithm 1 Synchronous n-step SARSA + +Input: $\theta$ parameters for $Q ( x , . ; \theta ) , \theta _ { \mathcal { D } }$ parameters for $Q _ { \mathcal { D } } ( x , . ; \theta _ { \mathcal { D } } ) , \phi _ { \mathcal { D } }$ parameters for $ _ { } ( x ; \phi _ { \mathcal { D } } )$ $\pi _ { 0 }$ initial feasible policy. + +for episode $e \in { 1 , . . . , M }$ do + +Add the initial state to the trajectory buffer $\tau \{ x _ { 0 } \}$ +$t \gets 1$ +while $t < T$ do: $t _ { s t a r t } \gets t$ while $t < t + n$ or $t = = T$ do Select $a _ { t }$ using (SPI), execute $a _ { t }$ , observe $x _ { t + 1 }$ and reward $r _ { t }$ and cost $d _ { t }$ . Add experiences to a buffer, i.e., $\tau \gets ( a _ { t } , r _ { t } , d _ { t } , x _ { t + 1 } )$ . $t \gets t + 1$ + +# end while + +Calculate the next action for $x _ { t + 1 }$ using the current policy estimates, $a _ { t + 1 }$ Bootstrap the targets: + +$$ +\begin{array} { r l } & { R \gets \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t = = T } \\ { Q ( x _ { t + 1 } , a _ { t + 1 } ; \theta ) } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \\ & { R _ { \mathcal { D } } \gets \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t = = T } \\ { Q _ { \mathcal { D } } ( x _ { t + 1 } , a _ { t + 1 } ; \theta _ { \mathcal { D } } ) } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \\ & { \overleftarrow { R } _ { \mathcal { D } } \gets \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t = = 0 } \\ { \overleftarrow { V } ( x _ { t _ { s t a r t - 1 } ; \phi _ { \mathcal { D } } } ) } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \end{array} +$$ + +$\triangleright$ Calculate the targets for the transitions in buffer for $i \in \{ t - 1 , \ldots , t _ { s t a r t } \}$ do $R r _ { i } + \gamma R$ $R _ { \mathcal { D } } d _ { i } + \gamma R _ { \mathcal { D } }$ Accumulate the gradients wrt $\theta , \theta _ { \mathcal { D } }$ : + +$$ +\begin{array} { c } { { d \theta d \theta + \frac { \partial ( R - Q ( x _ { i } , a _ { i } ; \theta ) ) ^ { 2 } } { \partial \theta } } } \\ { { d \theta _ { \mathcal { D } } d \theta _ { \mathcal { D } } + \frac { \partial ( R _ { \mathcal { D } } - Q _ { \mathcal { D } } ( x _ { i } , a _ { i } ; \theta _ { \mathcal { D } } ) ) ^ { 2 } } { \partial \theta _ { \mathcal { D } } } } } \end{array} +$$ + +end for + +for $i \in \{ t _ { s t a r t } , . . . , t \}$ do $\mathbf { \overleftarrow { R } } _ { \mathcal { D } } \gets d _ { i } + \gamma \mathbf { \overleftarrow { R } } _ { \mathcal { D } }$ Accumulate the gradients wrt $\phi _ { \mathcal { D } }$ : + +$$ +d \phi _ { \mathcal { D } } \gets d \phi _ { \mathcal { D } } + \frac { \partial ( \overleftarrow { R } _ { \mathcal { D } } - \overleftarrow { V } _ { \mathcal { D } } ( x _ { i } ; \phi _ { \mathcal { D } } ) ) ^ { 2 } } { \partial \phi _ { \mathcal { D } } } +$$ + +# end for + +Do synchronous batch update with the accumulated gradients to update $\theta , \theta _ { \mathcal { D } } , \phi _ { \mathcal { D } }$ using $d \theta , d \theta _ { \mathcal { D } } , d \phi _ { \mathcal { D } }$ . + +# end while + +Empty the trajectory buffer, $\tau$ + +end for + +# Algorithm 2 Synchronous A2C with Safety Layer + +Input: $\theta$ parameters for $\pi ( x ; \theta )$ , $\phi$ the parameters for $V ( x ; \phi )$ , $\theta _ { \mathcal { D } }$ parameters for $Q _ { \mathcal { D } } ( x , \mu ; \theta _ { \mathcal { D } } )$ , +$\phi _ { \mathcal { D } }$ parameters for $ _ { \overline { { \cal V } } _ { \mathcal { D } } ( x ; \phi _ { \mathcal { D } } ) }$ ; +for episode $e \in { 1 , . . . , M }$ do Add the initial state to the trajectory buffer $\tau \{ x _ { 0 } \}$ $t \gets 1$ while $t < T$ do: $t _ { s t a r t } \gets t$ while $t < t + n$ or $t = = T$ do Select $a _ { t }$ using sampling from the projected mean $\mu _ { t }$ via the safety layer Eq.(5), execute +$a _ { t }$ , observe $x _ { t + 1 }$ and reward $r _ { t }$ and cost $d _ { t }$ . Add experiences to a buffer, i.e., $\tau \gets ( a _ { t } , \mu _ { t } , r _ { t } , d _ { t } , x _ { t + 1 } )$ . $t \gets t + 1$ + +# end while + +Calculate the next mean for xt+1 using the current policy estimates, µt+1 Bootstrap the targets: + +$$ +\begin{array} { r l } & { R \gets \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t = = T } \\ { V ( x _ { t + 1 } , a _ { t + 1 } ; \phi ) } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \\ & { R _ { \mathcal { D } } \gets \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t = = T } \\ { Q _ { \mathcal { D } } ( x _ { t + 1 } , \mu _ { t + 1 } ; \theta _ { \mathcal { D } } ) } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \\ & { \overleftarrow { R } _ { \mathcal { D } } \gets \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t = = 0 } \\ { \overleftarrow { V } ( x _ { t _ { s t a r t - 1 } ; \phi _ { \mathcal { D } } } ) } & { \mathrm { o t h e r w i s e } } \end{array} \right. } \end{array} +$$ + +$\triangleright$ Calculate the targets for the transitions in buffer + +for $i \in \{ t - 1 , \ldots , t _ { s t a r t } \}$ do $R \gets r _ { i } + \gamma R$ $R _ { \mathcal { D } } d _ { i } + \gamma R _ { \mathcal { D } }$ + +Accumulate the gradients w.r.t. $\theta , \phi , \theta _ { \mathcal { D } }$ : + +$$ +\begin{array} { r l } & { \quad d \theta d \theta + \nabla _ { \theta } \log \pi ( a _ { i } \mid x _ { i } ; \theta ) ( R - V ( x _ { i } ; \phi ) ) } \\ & { \quad d \phi d \phi + \frac { \partial ( R - V ( x _ { i } \phi ) ) ^ { 2 } } { \partial \phi } } \\ & { \quad d \theta _ { \mathcal { D } } d \theta _ { \mathcal { D } } + \frac { \partial ( R _ { \mathcal { D } } - Q _ { \mathcal { D } } ( x _ { i } , \mu _ { i } ; \theta _ { \mathcal { D } } ) ) ^ { 2 } } { \partial \theta _ { \mathcal { D } } } } \end{array} +$$ + +end for + +for $i \in \{ t _ { s t a r t } , . . . , t \}$ do $\mathbf { \overleftarrow { R } } _ { \mathcal { D } } \gets d _ { i } + \gamma \mathbf { \overleftarrow { R } } _ { \mathcal { D } }$ Accumulate the gradients wrt $\phi _ { \mathcal { D } }$ : + +$$ +d \phi _ { \mathcal { D } } \gets d \phi _ { \mathcal { D } } + \frac { \partial ( \overleftarrow { R } _ { \mathcal { D } } - \overleftarrow { V } _ { \mathcal { D } } ( x _ { i } ; \phi _ { \mathcal { D } } ) ) ^ { 2 } } { \partial \phi _ { \mathcal { D } } } +$$ + +# end for + +Do synchronous batch update with the accumulated gradients to update $\theta , \phi , \theta _ { \mathcal { D } } , \phi _ { \mathcal { D } }$ using $d \theta , d \phi , d \theta _ { \mathcal { D } } , d \phi _ { \mathcal { D } }$ . + +# end while + +Empty the trajectory buffer, $\tau$ + +# end for + +where $T$ is the maxmimum number of timestamps in an episode trajectory, and $\delta _ { j }$ denotes the TD error at $j$ . The value function is updated using the $\gamma \lambda$ -returns from the GAE: + +$$ +L ( \phi ) = \mathbb { E } [ ( V ^ { \pi } ( x ; \phi ) - ( V ^ { \pi } ( x ; \phi _ { o l d } ) + A _ { t } ) ) ^ { 2 } ] . +$$ + +Similar to the the forward value estimates the backward value estimates are defined in the similar sense. One way to think of it is to assume the trajectories are reversed and we are doing the regular GAE estimation for the value functions. + +The GAE updates for the regular value function can be seen in the $\lambda$ -operator form as: + +$$ +\begin{array} { r } { \mathcal { T } _ { \lambda } ^ { \pi } \boldsymbol { v } ^ { \pi } = ( I - \gamma \lambda P ^ { \pi } ) ^ { - 1 } ( \boldsymbol { r } ^ { \pi } + \gamma P ^ { \pi } \boldsymbol { v } ^ { \pi } - \boldsymbol { v } ^ { \pi } ) + \boldsymbol { v } ^ { \pi } . } \end{array} +$$ + +In similar spirit it can be shown that the $\lambda$ -operator for SARSA has the form: + +$$ +\begin{array} { r } { \mathcal { T } _ { \lambda } ^ { \pi } q ^ { \pi } = ( I - \lambda \gamma P ^ { \pi } ) ^ { - 1 } ( \mathcal { T } ^ { \pi } q ^ { \pi } - q ^ { \pi } ) + q ^ { \pi } , } \end{array} +$$ + +where $( T ^ { \pi } q ^ { \pi } - q ^ { \pi } )$ denotes the TD error. Thus, the GAE estimates can be applied for the Q-functions in the similar form, i.e. + +$$ +\begin{array} { r l r } { { B _ { t } ^ { G A E ( \lambda , \gamma ) } = \sum _ { k = 0 } ^ { T - 1 } ( \lambda \gamma ) ^ { k } \delta _ { t + k } ^ { Q _ { D } ^ { \pi } } , } } \\ & { } & { L ( \theta _ { \mathcal { D } } ) = \mathbb { E } [ ( Q _ { \mathcal { D } } ^ { \pi } ( x , a ; \theta _ { \mathcal { D } } ) - ( Q _ { \mathcal { D } } ^ { \theta _ { \mathcal { D } } } ( x , a ; \theta _ { \mathcal { D } _ { o l d } } ) + B _ { t } ) ) ^ { 2 } ] . } \end{array} +$$ \ No newline at end of file diff --git a/md/train/S1x1IkHtPr/S1x1IkHtPr.md b/md/train/S1x1IkHtPr/S1x1IkHtPr.md new file mode 100644 index 0000000000000000000000000000000000000000..370c11a8d2c6ccae83d8c909880104fbd4508a36 --- /dev/null +++ b/md/train/S1x1IkHtPr/S1x1IkHtPr.md @@ -0,0 +1,346 @@ +# A GENERATIVE MODEL FOR MOLECULAR DISTANCE GEOMETRY + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Computing equilibrium states for many-body systems, such as molecules, is a long-standing challenge. In the absence of methods for generating statistically independent samples, great computational effort is invested in simulating these systems using, for example, Markov chain Monte Carlo. We present a probabilistic model that generates such samples for molecules from their graph representations. Our model learns a low-dimensional manifold that preserves the geometry of local atomic neighborhoods through a principled learning representation that is based on Euclidean distance geometry. In a new benchmark for molecular conformation generation, we show experimentally that our generative model achieves state-ofthe-art accuracy. Finally, we show how to use our model as a proposal distribution in an importance sampling scheme to compute molecular properties. + +# 1 INTRODUCTION + +Over the last few years, many highly-effective deep learning methods generating small molecules with desired properties (e.g., novel drugs) have emerged (Gomez-Bombarelli et al., 2018; Segler ´ et al., 2018; Dai et al., 2018; Jin et al., 2018; Bradshaw et al., 2019a; Liu et al., 2018; You et al., 2018; Bradshaw et al., 2019b). These methods operate using graph representations of molecules in which nodes and edges represent atoms and bonds, respectively. A representation that is closer to the physical system is one in which a molecule is described by its geometry or conformation. A conformation $\mathbf { x }$ of a molecule is defined by a set of atoms $\{ ( \boldsymbol { \epsilon } _ { i } , \mathbf { r } _ { i } ) \bar \} _ { i = 1 } ^ { N _ { v } }$ , where $N _ { v }$ is the number of atoms in the molecule, $\epsilon _ { i } \in \{ \mathrm { H } , \mathrm { C } , \mathrm { O } , \dots \}$ is the chemical element of the atom $i$ , and $\mathbf { r } _ { i } \in \mathbb { R } ^ { 3 }$ is its position in Cartesian coordinates. Importantly, the relative positions of the atoms are restricted by the bonds in the molecule and the angles between them. Due to thermal fluctuations resulting in stretching of and rotations around bonds, there exist infinitely many conformations of a molecule. A molecule’s graph representation and a set of its conformations are shown in Fig. 1. Under a wide range of conditions, the probability $p ( \mathbf { x } )$ of a conformation $\mathbf { x }$ , is governed by the Boltzmann distribution and is proportional to $\exp \{ - E ( \mathbf { x } ) / k _ { B } T \}$ , where $E ( \mathbf { x } ) \in \mathbb { R }$ is the conformation’s energy, $k _ { B }$ is the Boltzmann constant, and $T$ is the temperature. + +To compute a molecular property for a molecule, one must sample from $p ( \mathbf { x } )$ . The main approach is to start with one conformation and make small changes to it over time, e.g., by using Markov chain Monte Carlo (MCMC) or molecular dynamics (MD). These methods can be used to accurately sample equilibrium states of molecules, but they become computationally expensive for larger ones (Shim & MacKerell, 2011; Ballard et al., 2015; De Vivo et al., 2016). Other heuristic approaches exist in which distances between atoms are set to fixed idealized values (Havel, 2002; Blaney & Dixon, 2007). Several methods based on statistical learning have also recently been developed to tackle the issue of conformation generation. However, they are mainly geared towards studying proteins and their folding dynamics (AlQuraishi, 2019). Some of these models are not targeting a distribution over conformations but the most stable folded configuration (Evans et al., 2018; Ingraham et al., 2019), while others are not transferable between different molecules (Lemke & Peter, 2019; Noe´ et al., 2019). + +This work includes the following key contributions: + +• We introduce a novel probabilistic model for learning conformational distributions of molecules with graph neural networks. + +![](images/434d845d7c8ccab7aba98bd6f5f40a3ddc2c0a355bf36f4ceacd18ef6cbb7a0b.jpg) +Figure 1: Standard graph representation of a molecule (left) with a set of possible conformations $\{ { \bf { x } } _ { i } \}$ (right). Hydrogen (H), carbon (C), and oxygen (O) atoms are colored white, gray, and red, respectively. Conformations feature the same atom types and bonds but the atoms are arranged differently in space. These differences arise from rotations around and stretching of bonds in the molecule. + +• We create a new, challenging benchmark for conformation generation, which is made publicly available. To the best of our knowledge, this is the first benchmark of this kind. +• By combining a conditional variational autoencoder (CVAE) with an Euclidean distance geometry (EDG) algorithm we present a state-of-the-art approach for generating one-shot samples of molecular conformations for unseen molecules that is independent of their size and shape. +• We develop a rigorous experimental approach for evaluating and comparing the accuracy of conformation generation methods based on the mean maximum deviation distance metric. +• We show how this generative model can be used as a proposal distribution in an importance sampling (IS) scheme to estimate molecular properties. + +# 2 METHOD + +Our goal is to build a statistical model that generates molecular conformations in a one-shot fashion from a molecule’s graph representation. First, we describe how a molecule’s conformation can be represented by a set of pairwise distances between atoms and why this presentation is advantageous over one in Cartesian coordinates (Section 2.1). Second, we present a generative model in Section 2.2 that will generate sets of atomic distances for a given molecular graph. Third, we explain in Section 2.3 how a set of predicted distances can be transformed into a molecular conformation and why this transformation is necessary. Finally, we detail in Section 2.4 how our generative model can be used as a proposal distribution in an IS scheme to estimate molecular properties. + +# 2.1 EXTENDED MOLECULAR GRAPHS AND DISTANCE GEOMETRY + +In this study, a molecule is represented by an undirected graph which is defined as a tuple $\mathcal { G } =$ $( V , E )$ . $V \stackrel { \cdot } { = } \{ v _ { i } \} _ { i = 1 } ^ { N _ { v } }$ is the set of nodes representing atoms, where each $v _ { i } \in \mathbb { R } ^ { F _ { v } }$ holds atomic attributes (e.g., the element type $\epsilon _ { i }$ ). $E = \{ ( e _ { k } , r _ { k } , s _ { k } ) \} _ { k = 1 } ^ { N _ { e } }$ is the set of edges, where each $e _ { k } \in \mathbb { R } ^ { F _ { e } }$ holds an edge’s attributes (e.g., the bond type), and $r _ { k }$ and $s _ { k }$ are the nodes an edge is connecting. Here, $E$ represents the molecular bonds (and the auxiliary edges which are explained below) in the molecule. + +We assume that, givof atomic distances r graph , where $\mathcal { G }$ ent one of its conformations is the Euclidean distance b $\mathbf { x }$ by a setween the $\mathbf { d } = \{ d _ { k } \} _ { k = 1 } ^ { N _ { e } }$ $d _ { k } = | \mathbf { r } _ { r _ { k } } - \mathbf { r } _ { s _ { k } } |$ +$r _ { k }$ $s _ { k }$ +$( E _ { \mathrm { b o n d } } )$ alone would not suffice to describe a conformation, we expand the traditional graph representation of a molecule by adding auxiliary edges. Auxiliary edges between atoms that are second neighbors in the original graph fix angles between atoms, and those between third neighbors fix dihedral angles (denoted $E _ { \mathrm { a n g l e } }$ and $E _ { \mathrm { d i h e d r a l } }$ , respectively). In this work, $E _ { \mathrm { a n g l e } }$ consists of edges between all second neighbors in the original graph. Edges between third neighbors are added according to a heuristic (see Appendix A.1). From now on we are always referring to this extended molecular graph when talking about molecular graphs. In Fig. 2, the process of extending the molecular graph and the extraction of $\mathbf { d }$ from $\mathbf { x }$ and $\mathcal { G }$ are illustrated. + +![](images/08c1b3e3b35a33713718a18e75ad2f38d7311ffb7d495eaa5cf2fd437d3fe2a8.jpg) +Figure 2: A) The structural formula of a molecule is converted to an extended molecular graph $\mathcal { G }$ consisting of nodes representing atoms (circles, e.g., $v _ { 1 }$ ) and edges representing molecular bonds (solid lines, e.g., $e _ { 1 } \in E _ { \mathrm { b o n d } } )$ ) and auxiliary edges (dotted lines, e.g., $e _ { 2 } \in E _ { \mathrm { a n g l e } }$ and $e _ { 3 } \in E _ { \mathrm { d i h e d r a l } } )$ . B) The distances $\mathbf { d }$ are extracted from a conformation $\mathbf { x }$ based on the edges $E$ . C) Graphical model of the variational autoencoder: generative model $p _ { \theta } ( \mathbf { d } | \mathbf { z } , \mathcal { G } ) p _ { \theta } ( \mathbf { z } | \mathcal { G } )$ (solid lines) and variational approximation $q _ { \phi } ( \mathbf { z } | \mathbf { d } , \mathcal { G } )$ (dashed lines). + +A key advantage of a representation in terms of distances is its invariance to rotation and translation; by contrast, Cartesian coordinates depend on the (arbitrary) choice of origin, for example. In addition, it reflects pair-wise physical interactions and their generally local nature. Auxiliary edges can be placed between higher-order neighbors depending on how far the physical interactions dominating the potential energy of the system reach. + +samples We have a set of $\{ \mathbf { x } _ { l , j } \} _ { j = 1 } ^ { S _ { l } }$ $N _ { \mathcal { G } }$ l=1from the ground-truth distribution resulting in molecular graphs $\{ \mathcal { G } _ { l } \} _ { l = 1 } ^ { N _ { g } }$ . Further, for each $S _ { l }$ $\mathcal { G } _ { l }$ , we have sets of distances $S _ { l }$ conformational $\{ \mathbf { d } _ { l , j } \} _ { j = 1 } ^ { S _ { l } }$ With this data, we will train a generative model which we detail in the following section. + +# 2.2 GENERATIVE MODEL + +We employ a CVAE (Kingma & Welling, 2014; Pagnoni et al., 2018) to model the distribution over distances d given a molecular graph $\mathcal { G }$ . A CVAE first encodes $\mathcal { G }$ together with d into a latent space $\mathbf { z } ~ \in ~ \mathbb { R } ^ { k N _ { v } }$ , where $k \in \mathbb { N } ^ { + }$ , with an encoder $q _ { \phi } ( \mathbf { z } | \mathbf { d } , \mathcal { G } )$ . Subsequently, the decoder $p _ { \boldsymbol { \theta } } ( \mathbf { d } | \mathbf { z } , \mathcal { G } )$ decodes $\mathbf { z }$ back into a set of distances. A graphical model is shown in Fig. 2 C). + +A conformation has, in general, $3 N _ { v } - 6$ spatial degrees of freedom (dofs): one dof per spacial dimension per atom minus three translational and three rotational dofs. Therefore, the latent space should be proportional to the number of atoms in the molecule. In addition, the latent space should be smaller than $3 N _ { v }$ as it is the role of the encoder to project the conformation into a lower-dimensional space. As a result, we set $k = 1$ to avoid overfitting. + +Here, $q _ { \phi } ( \mathbf { z } | \mathbf { d } , \mathcal { G } )$ and $p _ { \boldsymbol { \theta } } ( \mathbf { d } | \mathbf { z } , \mathcal { G } )$ are Gaussian distributions, the mean and variance of which are modeled by two artificial neural networks. At the center of this model are message-passing neural networks (MPNNs) (Gilmer et al., 2017) with multi-head attention (Velickovi ˇ c et al., 2018). In short, ´ an MPNN is a convolutional neural network that allows end-to-end learning of prediction pipelines whose inputs are graphs of arbitrary size and shape. In a convolution, neighboring nodes exchange so-called messages between neighbors to update their attributes. Edges update their attributes with the features of the nodes they are connecting. The MPNN is a well-studied technique that achieves state-of-the-art performance in representation learning for molecules (Kipf & Welling, 2017; Duvenaud et al., 2015; Kearnes et al., 2016; Schutt et al., 2017b; Gilmer et al., 2017; Kusner et al., 2017; ¨ Bradshaw et al., 2019a). + +In the following, we describe the details of the model.2 In Fig. 3, an illustration of the model is shown. In the encoder $q _ { \phi } ( \mathbf { z } | \mathbf { d } , \mathcal { G } )$ , each $d _ { k }$ is concatenated with the respective edge feature $e _ { k }$ to give $e _ { k } ^ { \prime } \in \mathbb { R } ^ { F _ { e } + 1 }$ . Then, each $v _ { i }$ and each $\boldsymbol { e } _ { k } ^ { \prime }$ are passed to $F _ { \mathrm { e n c , } v }$ and $F _ { \mathrm { e n c } , e }$ (two multilayer perceptrons, + +![](images/5f0738038473b071de697991b53166ab0b2ba48a790fd8a700a36244723f5ab6.jpg) +Figure 3: The molecular graph $\mathcal { G }$ together with the distances $\mathbf { d }$ are passed through the model consisting of an encoder $q _ { \phi } ( \mathbf { z } | \mathbf { d } , \mathcal { G } )$ and a decoder $p _ { \boldsymbol { \theta } } ( \mathbf { d } | \mathbf { z } , \mathcal { G } )$ . See the main text for details. + +MLPs), respectively, to give $\mathcal { G } _ { \mathrm { e n c } } ^ { ( 0 ) }$ , where $\mathcal { G } _ { \mathrm { e n c } } ^ { ( t ) } = ( \{ v _ { i , \mathrm { e n c } } ^ { ( t ) } \} _ { i = 1 } ^ { N _ { v } } , \{ ( e _ { k , \mathrm { e n c } } ^ { ( t ) } , r _ { k } , s _ { k } ) \} _ { k = 1 } ^ { N _ { e } } ) , v _ { i } ^ { ( }$ $v _ { i , \mathrm { e n c } } ^ { ( t ) } \in \mathbb { R } ^ { L _ { v } }$ and $e _ { k , \mathrm { e n c } } ^ { ( t ) } \in \mathbb { R } ^ { L _ { \mathrm { c } } }$ . Then, $T$ MPNNs of depth 1, $\{ \mathbf { M P } _ { \mathrm { e n c } } ^ { ( t ) } \} _ { t = 1 } ^ { T }$ , are consecutively applied to obtain $\mathcal { G } _ { \mathrm { e n c } } ^ { ( T ) }$ . Finally, the read-out function $R _ { \mathrm { e n c } }$ (an MLP) takes each $v _ { \mathrm { i , e n c } } ^ { ( T ) }$ to predict the mean $\mu _ { z _ { i } } \in \mathbb { R }$ and the variance $\sigma _ { z _ { i } } ^ { 2 } \in \mathbb { R }$ of the Gaussian distribution for $z _ { i }$ . The so-called reparametrization trick is employed to draw a sample for $z _ { i }$ . In summary, + +$$ +\begin{array} { r l } { v _ { i , \mathrm { e n c } } ^ { ( 0 ) } = F _ { \mathrm { e n c } , v } ( v _ { i } ) , } & { e _ { k , \mathrm { e n c } } ^ { ( 0 ) } = F _ { \mathrm { e n c } , e } ( e _ { i } ^ { \prime } ) , } \\ { \mathcal { G } _ { \mathrm { e n c } } ^ { ( 1 ) } = \mathsf { M P } _ { \mathrm { e n c } } ^ { ( 0 ) } ( \mathcal { G } _ { \mathrm { e n c } } ^ { ( 0 ) } ) , } & { \mathcal { G } _ { \mathrm { e n c } } ^ { ( t + 1 ) } = \mathsf { M P } _ { \mathrm { e n c } } ^ { ( t ) } ( \mathcal { G } _ { \mathrm { e n c } } ^ { ( t ) } ) , \quad \mathcal { G } _ { \mathrm { e n c } } ^ { ( T ) } = \mathsf { M P } _ { \mathrm { e n c } } ^ { ( T - 1 ) } ( \mathcal { G } _ { \mathrm { e n c } } ^ { ( T - 1 ) } ) , } \\ { \mu _ { z _ { i } } , \sigma _ { z _ { i } } ^ { 2 } = R _ { \mathrm { e n c } } ( v _ { i , \mathrm { e n c } } ^ { ( T ) } ) . } \end{array} +$$ + +decode. Each $p _ { \boldsymbol { \theta } } ( \mathbf { d } | \mathbf { z } , \mathcal { G } )$ ach are $z _ { i }$ is concassed to d wand respective node feature (two MLPs), respective $v _ { i }$ to give to give $v _ { i } ^ { \prime } \in$ +where $\mathbb { R } ^ { F _ { v } + 1 }$ $\mathcal { G } _ { \mathrm { d e c } } ^ { ( t ) } = ( \{ v _ { i , \mathrm { d e c } } ^ { ( t ) } \} _ { i = 1 } ^ { N _ { v } } , \{ ( e _ { k , \mathrm { d e c } } ^ { ( t ) } , r _ { k } , s _ { k } ) \} _ { k = 1 } ^ { N _ { e } } )$ $\boldsymbol { v } _ { i } ^ { \prime }$ $e _ { k }$ $F _ { \mathrm { d e c } , v }$ , $v _ { i , \mathrm { d e c } } ^ { ( t ) } \in \mathbb { R } ^ { L _ { v } }$ $F _ { \mathrm { d e c } , e }$ , and $e _ { k , \mathrm { d e c } } ^ { ( t ) } \in \mathbb { R } ^ { L _ { \mathrm { e } } }$ . Then, dec MPNNs +of depth 1, {MP(t)dec}Tt= , are consecutively applied to obtain $\mathcal { G } _ { \mathrm { d e c } } ^ { ( T ) }$ . Finally, the read-out function +(an MLP) takes ch $e _ { \mathbf { k } , \mathrm { d e c } } ^ { ( T ) }$ to predict the mean $\mu _ { d _ { k } } \in \mathbb { R }$ dec and the variance $\sigma _ { d _ { k } } ^ { 2 } \in \mathbb { R }$ decof the Gaussian $d _ { k }$ . In summary, + +$$ +\begin{array} { r l } & { v _ { i , \mathrm { d e c } } ^ { ( 0 ) } = F _ { \mathrm { d e c } , v } ( v _ { i } ^ { \prime } ) , \quad e _ { k , \mathrm { d e c } } ^ { ( 0 ) } = F _ { \mathrm { d e c } , e } ( e _ { i } ) , } \\ & { \mathcal { G } _ { \mathrm { d e c } } ^ { ( 1 ) } = \mathbf { M } \mathbf { P } _ { \mathrm { d e c } } ^ { ( 0 ) } ( \mathcal { G } _ { \mathrm { d e c } } ^ { ( 0 ) } ) , \quad \mathcal { G } _ { \mathrm { d e c } } ^ { ( t + 1 ) } = \mathbf { M } \mathbf { P } _ { \mathrm { d e c } } ^ { ( t ) } ( \mathcal { G } _ { \mathrm { d e c } } ^ { ( t ) } ) , \quad \mathcal { G } _ { \mathrm { d e c } } ^ { ( T ) } = \mathbf { M } \mathbf { P } _ { \mathrm { d e c } } ^ { ( T - 1 ) } ( \mathcal { G } _ { \mathrm { d e c } } ^ { ( T - 1 ) } ) , } \\ & { \qquad \mu _ { d _ { k } } , \sigma _ { d _ { k } } ^ { 2 } = R _ { \mathrm { d e c } } ( e _ { k , \mathrm { d e c } } ^ { ( T ) } ) . } \end{array} +$$ + +The sets of parameters in the encoder and decoder, $\phi$ and $\theta$ (i.e., parameters in $F _ { \mathrm { e n c } , v } , \ F _ { \mathrm { e n c } , e }$ , $\{ \mathbf { M P } _ { \mathrm { e n c } } ^ { ( t ) } \} _ { t = 1 } ^ { T }$ , $R _ { \mathrm { e n c } }$ , $F _ { \mathrm { d e c } , v }$ , $F _ { \mathrm { d e c } , e }$ , $\{ \mathbf { M P } _ { \mathrm { d e c } } ^ { ( t ) } \} _ { t = 1 } ^ { T } , R _ { \mathrm { d e c } } )$ , respectively, are optimized by maximizing the evidence lower bound (ELBO): + +$$ +L = \mathbb { E } _ { \mathbf { z } \sim q _ { \phi } ( \mathbf { z } | \mathbf { d } , \mathcal { G } ) } [ \log p _ { \theta } ( \mathbf { d } | \mathbf { z } , \mathcal { G } ) ] - D _ { \mathrm { K L } } [ q _ { \phi } ( \mathbf { z } | \mathbf { d } , \mathcal { G } ) | | p _ { \theta } ( \mathbf { z } | \mathcal { G } ) ] , +$$ + +where the prior $p _ { \boldsymbol { \theta } } ( \mathbf { z } | \mathcal { G } )$ consists of factorized Gaussians. The optimal values for the hyperparameters for the network dimensions, number of message passes, batch size, and learning rate of the Adam optimizer (Kingma & Ba, 2014) were tuned by maximizing the validation performance (ELBO) with a Bayesian optimizer and are reported in Appendix A.1.3. + +# 2.3 CONFORMATION GENERATION THROUGH EUCLIDEAN DISTANCE GEOMETRY + +To compute molecular properties, quantum-chemical methods need to be employed which require the input, i.e., the molecule, to be in Cartesian coordinates.3 Therefore, we use an EDG algorithm to translate the set of distances $\{ d _ { k } \} _ { k = 1 } ^ { N _ { e } }$ to a set of atomic coordinates $\{ \mathbf { r } _ { i } \} _ { i = 1 } ^ { N _ { v } }$ . 4 + +EDG is the mathematical basis for a geometric theory of molecular conformation. In the field of machine learning, Weinberger & Saul (2006) used it for learning image manifolds, Tenenbaum et al. (2000) for image understanding and handwriting recognition, Jain & Saul (2004) for speech and music, and Demaine et al. (2009) for music and musical rhythms. An EDG description of a molecular system consists of a list of lower and upper bounds on the distances between pairs of atoms $\{ ( d _ { k , \operatorname* { m i n } } , d _ { k , \operatorname* { m a x } } ) \} _ { k = 1 } ^ { N _ { e } }$ . Here, $p _ { \boldsymbol { \theta } } ( \mathbf { d } | \mathbf { z } , \mathcal { G } )$ is used to model these bounds, namely, we set the bounds to $\{ ( \mu _ { d _ { k } } - \sigma _ { d _ { k } } , \mu _ { d _ { k } } + \sigma _ { d _ { k } } ) \}$ , where $\mu _ { d _ { k } }$ and $\sigma _ { d _ { k } }$ are the mean and standard deviation for each distance $d _ { k }$ given by the CVAE. Then, an EDG algorithm determines a set of Cartesian coordinates $\{ \mathbf { r } _ { i } \} _ { i = 1 } ^ { N _ { v } }$ so that these bounds are fulfilled (see Appendix A.2 for details).5 Together with the corresponding chemical elements $\{ \epsilon _ { i } \} _ { i = 1 } ^ { N _ { v } }$ , we obtain a conformation $\mathbf { x }$ . + +# 2.4 CALCULATION OF MOLECULAR PROPERTIES + +We can get an MC estimate of the expectation $\mathbb { E } _ { \mathcal { G } } [ \mathcal { O } ]$ of a property $\mathcal { O }$ (e.g., the dipole moment) for a molecule represented by $\mathcal { G }$ by drawing conformational samples $\mathbf { x } _ { i } \sim p ( \mathbf { x } | \mathcal { G } )$ and computing $\mathcal { O } ( \mathbf { x } _ { i } ) \in \mathbb { R }$ with a quantum-chemical method (e.g., density functional theory). Since we cannot draw samples from $p ( \mathbf { x } | \mathcal { G } )$ directly, we employ an IS integration scheme (Bishop, 2009) with our CVAE as the proposal distribution. We assume that we can readily evaluate the unnormalized probability of a conformation $\tilde { p } ( \mathbf { x } | \mathcal { G } ) = \exp \{ - E ( \mathbf { x } ) / k _ { B } T \}$ , where $\mathbf { x }$ must be a conformation of the molecule and the energy $E ( \mathbf { x } )$ is determined with a quantum-chemical method. Since the EDG algorithm is mapping the distribution $p _ { \boldsymbol { \theta } } ( \mathbf { d } | \mathbf { z } , \mathcal { G } )$ to a point mass in $ { \mathbb { R } } ^ { 3 N _ { v } }$ , the MC estimate for the resulting distribution $p _ { \mathrm { p r o p } } ( \mathbf { x } | \mathcal { G } )$ is given by a mixture of delta functions, each of which is centered at the $\mathbf { x } _ { i }$ resulting from mapping $p _ { \boldsymbol { \theta } } ( \mathbf { d } | \mathbf { z } _ { i } , \mathcal { G } )$ to $\mathbb { R } ^ { 3 N _ { v } }$ , where $\mathbf { z } _ { i } \sim p _ { \theta } ( \mathbf { z } | \mathcal { G } )$ , that is, $\begin{array} { r } { p _ { \mathrm { p r o p } } ( \mathbf { x } | \mathcal { G } ) \approx \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \delta ( \mathbf { x } - \mathbf { x } _ { i } ) } \end{array}$ . The IS estimator for the expectation of $\mathcal { O }$ w. r. t. $\tilde { p } ( \mathbf { x } | \mathcal { G } )$ then reads + +$$ +\hat { \mathbb { E } } _ { \mathcal { G } } [ \mathcal { O } ] \overset { \mathrm { M C } } { \approx } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \mathcal { O } ( \mathbf { x } _ { i } ) \overset { \mathrm { I S } } { = } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \mathcal { O } ( \mathbf { x } _ { i } ^ { \prime } ) \frac { \tilde { p } ( \mathbf { x } _ { i } ^ { \prime } | \mathcal { G } ) } { p _ { \mathrm { p r o p } } ( \mathbf { x } _ { i } ^ { \prime } | \mathcal { G } ) } , +$$ + +where $\mathbf { x } _ { i } \sim \tilde { p } ( \mathbf { x } _ { i } | \mathcal { G } )$ and $\mathbf { x } _ { i } ^ { \prime } \sim p _ { \mathrm { p r o p } } ( \mathbf { x } _ { i } ^ { \prime } | \mathcal { G } )$ , so that the expectation of $\mathcal { O }$ w. r. t. the normalized version of $\tilde { p } ( { \bf x } )$ is then + +$$ +\mathbb { E } _ { \mathcal { G } } [ \mathcal { O } ] = \frac { \hat { \mathbb { E } } _ { \mathcal { G } } [ \mathcal { O } ] } { \hat { \mathbb { E } } _ { \mathcal { G } } [ 1 ] } \approx \frac { 1 } { Z } \sum _ { i = 1 } ^ { N } \mathcal { O } ( \mathbf { x } _ { i } ) \tilde { p } ( \mathbf { x } _ { i } ^ { \prime } | \mathcal { G } ) , +$$ + +where have a $\begin{array} { r } { Z \approx \sum _ { i = 1 } ^ { N } \tilde { p } ( \mathbf { x } _ { i } ^ { \prime } ) } \end{array}$ and ake s $N$ is the number of samples. When dividing two delta functions wee arbitrarily large finite value. + +# 3 RELATED WORKS + +The standard approach for generating molecular conformations is to start with one, and make small changes to it over time, e.g., by using MCMC or MD. These methods are considered the gold standard for sampling equilibrium states, but they are computationally expensive, especially if the molecule is large and the Hamiltonian is based on quantum-mechanical principles (Shim & MacKerell, 2011; Ballard et al., 2015; De Vivo et al., 2016). + +A much faster but more approximate approach for conformation generation is EDG (Havel, 2002; Blaney & Dixon, 2007; Lagorce et al., 2009; Riniker & Landrum, 2015). Lower and upper distance bounds for pairs of atoms in a molecule are fixed values based on ideal bond lengths, bond angles, and torsional angles. These values are often extracted from crystal structure databases (Allen, 2002). These methods aim to generate a low-energy conformation, not to generate unbiased samples from the underlying distribution at a certain temperature. + +There exist several machine learning approaches as well, however, they are mostly tailored towards studying protein dynamics. For example, Noe et al. (2019) trained Boltzmann generators on the ´ energy function of proteins to provide unbiased, one-shot samples from their equilibrium states. This is achieved by training an invertible neural network to learn a coordinate transformation from a system’s configurations to a latent space representation. Further, Lemke & Peter (2019) proposed a dimensionality reduction algorithm that is based on a neural network autoencoder in combination with a nonlinear distance metric to generate samples for protein structures. Both models learn protein-specific coordinate transformations that cannot be transferred to other molecules. + +AlQuraishi (2019) introduced an end-to-end differentiable recurrent geometric network for protein structure learning based on amino acid sequences. Also, Ingraham et al. (2019) proposed a neural energy simulator model for protein structure that makes use of protein sequence information. In contrast to amino acid sequences, molecular graphs are, in general, not linear but highly branched and often contain cycles. This makes them unsuitable for recurrent networks. + +Finally, Mansimov et al. (2019) presented a conditional deep generative graph neural network to generate molecular conformations given a molecular graph. Their goal is to predict the most likely conformation and not a distribution over conformations. Instead of encoding molecular environments in atomic distances, they work directly in Cartesian coordinates. As a result, the generated conformations showed significant structural differences compared to the ground-truth and required refinement through a force field, which is often employed in MD simulations. + +We argue that our model has several advantages over the approaches reviewed above: + +• It is a fast alternative to resource-intensive approaches based on MCMC or MD. +• Our principled representation based on pair-wise distances does not restrict our approach to any particular molecular structure. +• Since our model employs message-passing neural networks, it is transferable – it can extrapolate from only a few graphs to unseen ones. + +# 4 THE CONF17 BENCHMARK + +The CONF17 benchmark is the first benchmark for molecular conformation sampling.6 It is based on the ISO17 dataset (Schutt et al., 2017a) which consists of conformations of various molecules ¨ with the atomic composition $\mathrm { C _ { 7 } H _ { 1 0 } O _ { 2 } }$ drawn from the QM9 dataset (Ramakrishnan et al., 2014). These conformations were generated by ab initio molecular dynamics simulations at 500 Kelvin which generates trajectories of a single molecule covering a large variety of conformations. The CONF17 benchmark consists of 127 distinct molecular graphs each with 3380 conformations on average. We split this dataset into multiple training and test splits, each consisting of 107 and 20 graphs, respectively (see Appendix A.1 for more details).7 + +In Fig. 4, (A), the structural formulae of a random selection of molecules from this benchmark are shown. Most molecules feature highly-strained, complex 3D structures such as rings which are typical of drug-like molecules. It is thus the structural complexity of the molecules, not their number of degrees of freedom, that makes this benchmark challenging. In Fig. 4, (B), the frequency of distances (in $\mathring \mathrm { A }$ ) in the conformations are shown for each edge type. It can be seen that the marginal distributions of the edge distances are multimodal and highly context dependent. + +![](images/46a3aa64e022fdd01a26120b31e2968b1635e75bf7b4ed5e1fb0963f320d2e6f.jpg) +Figure 4: Overview of the CONF17 benchmark. (A) Structural formulae of a random selection of molecules. (B) Distribution of distances (in $\mathrm { \AA }$ ) grouped by edge (from left to right: $E _ { \mathrm { b o n d } }$ , $E _ { \mathrm { a n g l e } }$ , and $E _ { \mathrm { d i h e d r a l } } ,$ ) and vertex type (chemical element). + +# 5 EXPERIMENTS + +We assess the performance of our method, named Graph Distance Geometry (GRAPHDG), by comparing it with two state-of-the-art methods for molecular conformation generation: RDKIT (Riniker & Landrum, 2015), a classical EDG approach, and DL4CHEM (Mansimov et al., 2019), a machine learning approach. We trained GRAPHDG and DL4CHEM on three different training and test splits of the CONF17 benchmark using Adam (Kingma & Ba, 2014). We generated 3000 conformations with each method for molecular graphs in a test set. + +# 5.1 DISTRIBUTIONS OVER DISTANCES + +We assessed the accuracy of the distance distributions of RDKIT, DL4CHEM, and GRAPHDG by calculating the maximum mean discrepancy (MMD) (Gretton et al., 2012) to the ground-truth distribution. We compute the MMD using a Gaussian kernel, where we set the standard deviation to be the median distance between distances $\mathbf { d }$ in the aggregate sample. For this, we determined the distances in the conformations from the ground-truth and those generated by RDKIT and DL4CHEM. For each train-test split and each $\mathcal { G }$ in a test set, we compute the MMD of the joint distribution of distances between C and $\mathrm { o }$ atoms (H atoms are usually ignored), the MMDs of pair-wise distances $p ( d _ { i } , d _ { j } | \mathcal { G } )$ , and the MMDs between the marginals of individual distances $p ( d _ { i } | \mathcal { G } )$ . We aggregate the results of three train-test splits, and, finally, compute the median MMDs and average rankings. The results are summarized in Table 1. It can be seen that the samples from GRAPHDG are significantly closer to the ground-truth distribution than the other methods. RDKIT is slightly worse than GRAPHDG while DL4CHEM seems to struggle with the complexity of the molecules and the small number of graphs in the training set. + +In Fig. 5, we showcase the accuracy of our model by plotting the marginal distributions $p ( d _ { i } | \mathcal { G } )$ for distances between C and O atoms given a molecular graph from a test set. It can be seen that RDKIT consistently underestimates the marginal variances. This is because this method aims to predict the most stable conformation, i.e., the distribution’s mode. In contrast, DL4CHEM often fails to predict the correct mean. For this molecule, GRAPHDG is the most accurate, predicting the right mean and variance in most cases. Additional figures can be found in the Appendix A.4, where we also show plots for the marginal distributions $p ( d _ { i } , d _ { j } | \mathcal { G } )$ . + +Table 1: Assessment of the accuracy of the distributions over conformations generated by three models compared to the ground-truth. We compare the distributions with respect to the marginals $p ( d _ { k } | \mathcal { G } )$ , $p ( d _ { k } , d _ { l } | \mathcal { G } )$ , and the distribution over all edges between C and $\mathrm { o }$ atoms $p ( \{ d _ { k } \} | \mathcal { G } )$ . Two different metrics are used: median MMD between ground-truth conformations and generated ones, and mean ranking (1 to 3) based on the MMD. Reported are the results for molecular graphs in a test set from three train-test splits. Standard errors are given in brackets. + +
Median MMDMean Ranking
RDKITDL4CHEMGRAPHDGRDKITDL4CHEMGRAPHDG
p(dk|9)0.55 (0.01)1.11 (0.01)0.38 (0.02)1.71 (0.03)2.74 (0.02)1.51 (0.03)
p(dk,di/9)0.53 (0.01)1.09 ( (0.01)0.34 (0.01)1.66 (0.02)2.92 (0.01)1.43 ( (0.02)
p({d}9)0.60 (0.01)1.07 (0.03)0.44 (0.05)1.58 (0.05)2.90 (0.05)1.45 (0.02)
+ +![](images/73cb33f1644a53a40561269d68794ff6ada9b90a2cebb3bc0277b7aadea252d5.jpg) +Figure 5: Marginal distributions $p ( d _ { k } | \mathcal { G } )$ of ground-truth and predicted bond distances (in $\textrm { \AA }$ ) between C and O atoms given a molecular graph from the test set. The atoms connected by each edge $d _ { k }$ are indicated in each subplot $\left( \boldsymbol { s } _ { k } \mathrm { - } \boldsymbol { r } _ { k } \right)$ . In the 3D structure of the molecule, carbon and oxygen atoms are colored gray and red, respectively. $_ \mathrm { H }$ atoms are omitted for clarity. + +# 5.2 GENERATION OF CONFORMATIONS + +We passed the distances from our generative model to an EDG algorithm to obtain conformations. For $9 9 . 9 \%$ of the sets of distances, all triangle inequalities held. For $94 \%$ of the molecular graphs, the algorithm succeeded which is 8 pp higher than the success rate we observed for RDKIT. For each molecular graph in a test set, we generated 50 conformations with each method. This took DL4CHEM, RDKIT, and GRAPHDG on average around hundreds of milliseconds per molecule.8 In contrast, a single conformation in the ISO17 dataset takes around a minute to compute. In Fig. 6, an overlay of these conformations of six molecules generated by the different methods is shown. It can be seen that RDKIT’s conformations show too little variance, while DL4CHEM’s structures are mostly invalid, which is due in part to its failure to predict the correct interatomic angles. Our method slightly overestimates the structural variance (see, for example, Fig. 6, top row, second column), but produces conformations that are the closest to the ground-truth. + +# 5.3 CALCULATION OF MOLECULAR PROPERTIES + +We estimate expected molecular properties for molecular graphs from the test set with $N = 5 0$ conformational samples each. Due to their poor quality, we could not compute properties $\mathcal { O } ( \mathbf { x } )$ , including the energy $E ( \mathbf { x } )$ , for conformations generated with DL4CHEM, and thus, this method is excluded from this analysis. In Table 2, it can be seen that RDKIT and GRAPHDG perform + +![](images/6dbc1684f2efce71c7be4d5e7e63e8e2e0f0a2968f6b845c474caa529794805c.jpg) +Figure 6: Overlay of 50 conformations from the ground-truth and three models based on six random molecular graphs from the test set. C, O, and H atoms are colored gray, red, and white, respectively. + +Table 2: Median difference in average properties between ground-truth and RDKIT and GRAPHDG: total electronic energy $E _ { \mathrm { e l e c } }$ (in kJ/mol), the energy of the HOMO and the LUMO LUMO and LUMO, respectively (in eV), and the dipole moment $\mu$ (in debye). Reported are the results for molecular graphs from the test set, averaged over three train-test splits. Standard errors are given in brackets. + +
RDKITGRAPHDG
Eelec42.7 (4.3)58.0 (21.0)
€HOMO0.08 (0.04)0.10 (0.05)
ELUMO0.15 (0.03)0.09 (0.05)
0.29 (0.05)0.33 (0.09)
+ +similarly well (see Appendix A.2 for computational details). However, both methods are still highly inaccurate for $E _ { \mathrm { e l e c } }$ (in practice, an accuracy of less than $5 \ \mathrm { k J / m o l }$ is required). Close inspection of the conformations shows that, even though GRAPHDG predicts the most accurate distances overall, the variances of certain strongly constrained distances (e.g., triple bonds) are overestimated so that the energies of the conformations increase drastically. + +# 6 LIMITATIONS + +The first limitation of this work is that the CVAE can sample (with low probability) invalid sets of distances for which there exists no 3D structure. Second, the CONF17 benchmark covers only a small portion of chemical space. Finally, a large set of auxiliary edges would be required to capture long-range correlations (e.g., in proteins). Future work will address these points. + +# 7 CONCLUSIONS + +We presented GRAPHDG, a transferable, generative model that allows sampling from a distribution over molecular conformations. We developed a principled learning representation of conformations that is based on distances between atoms. Then, we proposed a challenging benchmark for comparing molecular conformation generators. With this benchmark, we show experimentally that conformations generated by GRAPHDG are closer to the ground-truth than those generated by other methods. Finally, we employ our model as a proposal distribution in an IS integration scheme to estimate molecular properties. While orbital energies and the dipole moments were predicted well, a larger and more diverse dataset will be necessary for meaningful estimates of electronic energies. Further, methods have to be devised to estimate how many conformations need to be generated to ensure all important conformations have been sampled. Finally, our model could be trained on conformational distributions at different temperatures in a transfer learning-type setting. + +# REFERENCES + +F. H. Allen. The Cambridge Structural Database: A quarter of a million crystal structures and rising. Acta Crystallogr., Sect. B: Struct. Sci, 58(3):380–388, 2002. doi: 10.1107/S0108768102003890. + +Mohammed AlQuraishi. End-to-End Differentiable Learning of Protein Structure. Cell Systems, 8 (4):292–301.e3, 2019. doi: 10.1016/j.cels.2019.03.006. + +Andrew J. Ballard, Stefano Martiniani, Jacob D. Stevenson, Sandeep Somani, and David J. Wales. Exploiting the potential energy landscape to sample free energy. WIREs Comput. Mol. Sci., 5(3): 273–289, 2015. doi: 10.1002/wcms.1217. + +Christopher M. Bishop. Pattern Recognition and Machine Learning. Information Science and Statistics. Springer, New York, 8 edition, 2009. ISBN 978-0-387-31073-2. + +Jeffrey M. Blaney and J. Scott Dixon. Distance Geometry in Molecular Modeling. In Reviews in Computational Chemistry, pp. 299–335. John Wiley & Sons, Ltd, 2007. ISBN 978-0-470-12582- 3. doi: 10.1002/9780470125823.ch6. + +John Bradshaw, Matt J. Kusner, Brooks Paige, Marwin H. S. Segler, and Jose Miguel Hern ´ andez- ´ Lobato. A generative model for electron paths. In International Conference on Learning Representations, 2019a. + +John Bradshaw, Brooks Paige, Matt J. Kusner, Marwin H. S. Segler, and Jose Miguel Hern ´ andez- ´ Lobato. A Model to Search for Synthesizable Molecules. arXiv:1906.05221, 2019b. + +Hanjun Dai, Yingtao Tian, Bo Dai, Steven Skiena, and Le Song. Syntax-directed variational autoencoder for structured data. In International Conference on Learning Representations, 2018. + +Marco De Vivo, Matteo Masetti, Giovanni Bottegoni, and Andrea Cavalli. Role of Molecular Dynamics and Related Methods in Drug Discovery. J. Med. Chem., 59(9):4035–4061, 2016. doi: 10.1021/acs.jmedchem.5b01684. + +Erik D. Demaine, Francisco Gomez-Martin, Henk Meijer, David Rappaport, Perouz Taslakian, Godfried T. Toussaint, Terry Winograd, and David R. Wood. The distance geometry of music. Computational Geometry, 42(5):429–454, 2009. doi: 10.1016/j.comgeo.2008.04.005. + +David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan Aspuru-Guzik, and Ryan P Adams. Convolutional Networks on Graphs for Learning Molecular Fingerprints. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2224–2232. Curran Associates, Inc., 2015. + +R. Evans, J. Jumper, J. Kirkpatrick, L. Sifre, T. F. G. Green, C. Qin, A. Zidek, A. Nelson, A. Bridgland, H. Penedones, S. Petersen, K. Simonyan, S. Crossan, D. T. Jones, D. Silver, K. Kavukcuoglu, D. Hassabis, and A. W. Senior. De novo structure prediction with deep-learning based scoring. In Thirteenth Critical Assessment of Techniques for Protein Structure Prediction, 2018. + +Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry. In Proceedings of the 34th International Conference on Machine Learning - Volume 70, ICML’17, pp. 1263–1272, 2017. + +Rafael Gomez-Bombarelli, Jennifer N. Wei, David Duvenaud, Jos ´ e Miguel Hern ´ andez-Lobato, ´ Benjam´ın Sanchez-Lengeling, Dennis Sheberla, Jorge Aguilera-Iparraguirre, Timothy D. Hirzel, ´ Ryan P. Adams, and Alan Aspuru-Guzik. Automatic Chemical Design Using a Data-Driven ´ Continuous Representation of Molecules. ACS Cent. Sci., 4(2):268–276, 2018. doi: 10.1021/ acscentsci.7b00572. + +Arthur Gretton, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Scholkopf, and Alexander Smola. ¨ A Kernel Two-Sample Test. J. Mach. Learn. Res., 13:723–773, 2012. + +Wolfgang Guba, Agnes Meyder, Matthias Rarey, and Jer´ ome Hert. Torsion Library Reloaded: ˆ A New Version of Expert-Derived SMARTS Rules for Assessing Conformations of Small Molecules. J. Chem. Inf. Model., 56(1):1–5, 2016. doi: 10.1021/acs.jcim.5b00522. + +Timothy F. Havel. Distance Geometry: Theory, Algorithms, and Chemical Applications. In Encyclopedia of Computational Chemistry. American Cancer Society, 2002. ISBN 978-0-470-84501-1. doi: 10.1002/0470845015.cda018. + +John Ingraham, Adam Riesselman, Chris Sander, and Debora Marks. Learning Protein Structure with a Differentiable Simulator. In International Conference on Learning Representations, 2019. + +V. Jain and L. K. Saul. Exploratory analysis and visualization of speech and music by locally linear embedding. In 2004 IEEE International Conference on Acoustics, Speech, and Signal Processing, volume 3, pp. iii–984, 2004. doi: 10.1109/ICASSP.2004.1326712. + +Jan Jensen. XYZ2Mol. https://github.com/jensengroup/xyz2mol, 2019. + +Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Junction tree variational autoencoder for molecular graph generation. 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. 2323–2332, Stockholm, Sweden, 2018. PMLR. + +Ilana Y. Kanal, John A. Keith, and Geoffrey R. Hutchison. A sobering assessment of small-molecule force field methods for low energy conformer predictions. Int. J. Quantum Chem., 118(5):e25512, 2018. doi: 10.1002/qua.25512. + +Steven Kearnes, Kevin McCloskey, Marc Berndl, Vijay Pande, and Patrick Riley. Molecular graph convolutions: Moving beyond fingerprints. J. Comput.-Aided Mol. Des., 30(8):595–608, 2016. doi: 10.1007/s10822-016-9938-8. + +Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. arXiv:1412.6980, 2014. + +Diederik P. Kingma and Max Welling. Auto-Encoding Variational Bayes. In International Conference on Learning Representations, 2014. + +Thomas N. Kipf and Max Welling. Semi-Supervised Classification with Graph Convolutional Networks. International Conference on Learning Representations, 2017. + +Matt J. Kusner, Brooks Paige, and Jose Miguel Hern ´ andez-Lobato. Grammar Variational Autoen- ´ coder. 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. 1945–1954, International Convention Centre, Sydney, Australia, 2017. PMLR. + +David Lagorce, Tania Pencheva, Bruno O. Villoutreix, and Maria A. Miteva. DG-AMMOS: A New tool to generate 3D conformation of small molecules using Distance Geometry and Automated Molecular Mechanics Optimization for in silico Screening. BMC Chem. Biol., 9:6, 2009. doi: 10.1186/1472-6769-9-6. + +Tobias Lemke and Christine Peter. EncoderMap: Dimensionality Reduction and Generation of Molecule Conformations. J. Chem. Theory Comput., 2019. doi: 10.1021/acs.jctc.8b00975. + +Qi Liu, Miltiadis Allamanis, Marc Brockschmidt, and Alexander Gaunt. Constrained Graph Variational Autoencoders for Molecule Design. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 7795–7804. Curran Associates, Inc., 2018. + +Elman Mansimov, Omar Mahmood, Seokho Kang, and Kyunghyun Cho. Molecular geometry prediction using a deep generative graph neural network. arXiv:1904.00314 [physics, stat], 2019. + +Frank Noe, Simon Olsson, Jonas K ´ ohler, and Hao Wu. Boltzmann generators: Sampling equilibrium ¨ states of many-body systems with deep learning. Science, 365(6457):eaaw1147, 2019. doi: 10.1126/science.aaw1147. + +Artidoro Pagnoni, Kevin Liu, and Shangyan Li. Conditional Variational Autoencoder for Neural Machine Translation. arXiv:1812.04405, 2018. + +John P. Perdew, Matthias Ernzerhof, and Kieron Burke. Rationale for mixing exact exchange with density functional approximations. J. Chem. Phys., 105(22):9982–9985, 1996. doi: 10.1063/1. 472933. + +Raghunathan Ramakrishnan, Pavlo O. Dral, Matthias Rupp, and O. Anatole von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Sci. Data, 1:140022, 2014. doi: 10.1038/sdata.2014.22. + +Sereina Riniker and Gregory A. Landrum. Better Informed Distance Geometry: Using What We Know To Improve Conformation Generation. J. Chem. Inf. Model., 55(12):2562–2574, 2015. doi: 10.1021/acs.jcim.5b00654. + +Kristof Schutt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre ¨ Tkatchenko, and Klaus-Robert Muller. SchNet: A continuous-filter convolutional neural net- ¨ work for modeling quantum interactions. 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. 991–1001. Curran Associates, Inc., 2017a. + +Kristof T. Schutt, Farhad Arbabzadah, Stefan Chmiela, Klaus R. M ¨ uller, and Alexandre Tkatchenko.¨ Quantum-chemical insights from deep tensor neural networks. Nat. Commun., 8:13890, 2017b. doi: 10.1038/ncomms13890. + +Marwin H. S. Segler, Thierry Kogej, Christian Tyrchan, and Mark P. Waller. Generating Focused Molecule Libraries for Drug Discovery with Recurrent Neural Networks. ACS Cent. Sci., 4(1): 120–131, 2018. doi: 10.1021/acscentsci.7b00512. + +Jihyun Shim and Alexander D. MacKerell, Jr. Computational ligand-based rational design: Role of conformational sampling and force fields in model development. Med. Chem. Commun., 2(5): 356–370, 2011. doi: 10.1039/C1MD00044F. + +Qiming Sun, Timothy C. Berkelbach, Nick S. Blunt, George H. Booth, Sheng Guo, Zhendong Li, Junzi Liu, James D. McClain, Elvira R. Sayfutyarova, Sandeep Sharma, Sebastian Wouters, and Garnet Kin-Lic Chan. PySCF: The Python-based simulations of chemistry framework. WIREs Comput. Mol. Sci., 8(1), 2018. doi: 10.1002/wcms.1340. + +Joshua B. Tenenbaum, Vin de Silva, and John C. Langford. A Global Geometric Framework for Nonlinear Dimensionality Reduction. Science, 290(5500):2319–2323, 2000. doi: 10.1126/science.290.5500.2319. + +Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph Attention Networks. In International Conference on Learning Representations, 2018. + +Florian Weigend. Accurate Coulomb-fitting basis sets for H to Rn. Phys. Chem. Chem. Phys., 8(9): 1057–1065, 2006. doi: 10.1039/B515623H. + +Florian Weigend and Reinhart Ahlrichs. Balanced basis sets of split valence, triple zeta valence and quadruple zeta valence quality for H to Rn: Design and assessment of accuracy. Phys. Chem. Chem. Phys., 7(18):3297–3305, 2005. doi: 10.1039/B508541A. + +Kilian Q. Weinberger and Lawrence K. Saul. Unsupervised Learning of Image Manifolds by Semidefinite Programming. Int. J. Comput. Vision, 70(1):77–90, 2006. doi: 10.1007/ s11263-005-4939-z. + +Jiaxuan You, Bowen Liu, Zhitao Ying, Vijay Pande, and Jure Leskovec. Graph Convolutional Policy Network for Goal-Directed Molecular Graph Generation. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 6410–6421. Curran Associates, Inc., 2018. + +# A APPENDIX + +# A.1 CONF17 BENCHMARK + +# A.1.1 DATA GENERATION + +The ISO17 dataset (Schutt et al., 2017a) was processed in the following way. First, conformations ¨ in which the molecular connectivity was modified (i.e., bonds were broken or new ones are formed) were discarded. For this, the tool XYZ2MOL (Jensen, 2019) was employed. Second, the molecular graphs were augmented by adding auxiliary edges for reasons described in Section 2.1. Auxiliary edges between all second neighbors were added. This can lead to a slight over-specification of the system’s geometry, however, this did not pose a problem in our experiments. In addition, auxiliary edges between third neighbors were added to fix dihedral angles. Since there are potentially many ways of specifying a dihedral angle in a molecular system, we resorted to the works of Riniker & Landrum (2015) and Guba et al. (2016) to decide where to place edges between third neighbors. + +# A.1.2 INPUT FEATURES + +Below we list the node and edges features in the CONF17 benchmark. + +Table 3: Node features. + +
FeatureData TypeDimension
atomic numberinteger1
chiral tagone-hot (R, S,and N/A)3
+ +Table 4: Edge features. + +
FeatureData TypeDimension
kindone-hot (indicating whether e is in Ebond,Eangle,or Edihedral)3
stereo chemistryone-hot (E,Z,Any,None, and N/A)5
typeinteger (single, double, triple or N/A)1
is aromaticbinary1
is conjugatedbinary1
is in ring of sizeone-hot (3,4,...,9) and N/A8
+ +# A.1.3 MODEL ARCHITECTURE + +The full model is available online https://figshare.com/s/1b42bf865bd78c457354. In following, the hyperparameters of our model are specified: + +Activations throughout this paper: ReLU; $L _ { v }$ , $L _ { e }$ : 10; $F _ { \mathrm { e n c } , v }$ : neural network with depth 2, width 20; $F _ { \mathrm { e n c } , e }$ : neural network with depth 3, width 60; $F _ { \mathrm { d e c } , v }$ , $F _ { \mathrm { d e c } , e }$ : neural networks with depth 2, width 70; {MP(t) }T , {MP(t) }T dec t=1: MPNN width depth 1 and three multi-head attention heads, T = 3, for node and edge updates neural networks with depth 2, and width 70 were used. $R _ { \mathrm { e n c } }$ , $R _ { \mathrm { d e c } }$ : neural networks with depth 2, width 70. Batch size: 16 (conformations); + +# A.2 COMPUTATIONAL DETAILS + +# A.2.1 QUANTUM-CHEMICAL CALCULATIONS + +All quantum-chemical calculations were carried out with the PySCF program package (version 1.5) (Sun et al., 2018) employing the exchange-correlation density functional PBE (Perdew et al., 1996), and the def2-SVP (Weigend & Ahlrichs, 2005; Weigend, 2006) basis set. + +Conformations generated by DL4CHEM did not succeed as some atoms were too close to each other. Self-consistent field algorithms in quantum-chemical software such as $\operatorname { P y } \operatorname { S C F }$ do not converge for such molecular structures. + +With quantum-chemical methods, we calculate several properties that concern the states of the electrons in the conformation. These are the total electronic energy $E _ { \mathrm { e l e c } }$ , the energy of the electron in the highest occupied molecular orbital (HOMO in eV) HOMO, the energy of the lowest unoccupied molecular orbital (LUMO in eV) LUMO, and the norm of the dipole moment $\mu$ (in debye). + +# A.2.2 EUCLIDEAN DISTANCE GEOMETRY + +We refer the reader to Havel (2002) for theory on EDG, algorithms, and chemical applications. In summary, the EDG procedure consists of the following three steps: + +1. Bound smoothing: extrapolating a complete set of lower and upper limits on all the distances from the sparse set of lower and upper bounds. +2. Embedding: choosing a random distance matrix from within these limits, and computing coordinates that are a certain best-fit to the distances. +3. Optimization: optimizing these coordinates versus an error function which measures the total violation of the distance (and chirality) constraints. + +We use the EDG implementation found in RDKIT (Riniker & Landrum, 2015) with default settings. + +A.3 GENERATION OF CONFORMATIONS + +![](images/27951cf926cc9a59c011227fdb3757047860bb4f10db180e980c1c7f56c2a9fb.jpg) +Figure 7: Overlay of 50 conformations from the ground-truth, RDKIT, DL4CHEM, and GRAPHDG based on two random molecular graphs from the test set. C, O, and H atoms are colored gray, red, and white, respectively. + +# A.4 DISTRIBUTIONS OVER DISTANCES + +Below, the marginal distributions of the distances for a variety of molecular graphs are shown. + +![](images/155b36793493760b7aa79975d8ddcff91c662022446556581190de48d5091e35.jpg) +Figure 8: Marginal distributions $p ( d _ { k } | \mathcal { G } )$ of ground-truth and predicted distances (in A) between C ˚ and O atoms given a molecular graph from the test set. The atoms connected by each edge $d _ { k }$ are indicated in each subplot $\left( \boldsymbol { s } _ { k } \mathrm { - } \boldsymbol { r } _ { k } \right)$ . In the 3D structure of the molecule, carbon and oxygen atoms are colored gray and red, respectively. $_ \mathrm { H }$ atoms are omitted for clarity. + +![](images/e220b95757969ae8413448670537336f0a0200b2d7857d8c548541c7e3c21327.jpg) +Figure 9: Marginal distributions $p ( d _ { i } , d _ { j } | \mathcal { G } )$ of ground-truth and predicted distances for a molecular graph from the test set (in $\mathring \mathrm { A }$ ). Here, $d _ { i }$ and $d _ { j }$ are restricted to edges representing bonds between C and O atoms. In the 3D structure of the molecule, carbon and oxygen atoms are colored gray and red, respectively. H atoms are omitted for clarity. + +![](images/990560565dbcd6a07e4996d7818003cb2c3bd83142a60411cb3f89d685007e5c.jpg) +Figure 10: See caption of Fig. 8 + +![](images/cf355a52b90102bd4be7140f2db8ba50e3779dbf93c62c9815ff4022643e40ce.jpg) +Figure 11: See caption of Fig. 9 + +![](images/b460530421a43a7fa1d828cbce0adb372e29c25c81e9fb137bd557fbbf59743a.jpg) +Figure 12: See caption of Fig. 8 + +![](images/3ab71d02171ec50c23dd6fda6644669702b4f5b23939b729a36135a2e37793fd.jpg) +Figure 13: See caption of Fig. 9 + +![](images/318714018966fa62ece638ab99060cdcf128629a839fab7764e5e8b5f7fa177e.jpg) +Figure 14: See caption of Fig. 8 + +![](images/046289cc08ff0e5a719e2e8d0afd1905fc1441824afab583ecca345ad569e0ab.jpg) +Figure 15: See caption of Fig. 9 \ No newline at end of file diff --git a/md/train/SJDJNzWAZ/SJDJNzWAZ.md b/md/train/SJDJNzWAZ/SJDJNzWAZ.md new file mode 100644 index 0000000000000000000000000000000000000000..735a985e020834844a682c5ab97afb1653ad1934 --- /dev/null +++ b/md/train/SJDJNzWAZ/SJDJNzWAZ.md @@ -0,0 +1,229 @@ +# TIME-DEPENDENT REPRESENTATION FOR NEURALEVENT SEQUENCE PREDICTION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Existing sequence prediction methods are mostly concerned with time-independent sequences, in which the actual time span between events is irrelevant and the distance between events is simply the difference between their order positions in the sequence. While this time-independent view of sequences is applicable for data such as natural languages, e.g., dealing with words in a sentence, it is inappropriate and inefficient for many real world events that are observed and collected at unequally spaced points of time as they naturally arise, e.g., when a person goes to a grocery store or makes a phone call. The time span between events can carry important information about the sequence dependence of human behaviors. In this work, we propose a set of methods for using time in sequence prediction. Because neural sequence models such as RNN are more amenable for handling token-like input, we propose two methods for time-dependent event representation, based on the intuition on how time is tokenized in everyday life and previous work on embedding contextualization. We also introduce two methods for using next event duration as regularization for training a sequence prediction model. We discuss these methods based on recurrent neural nets. We evaluate these methods as well as baseline models on five datasets that resemble a variety of sequence prediction tasks. The experiments revealed that the proposed methods offer accuracy gain over baseline models in a range of settings. + +# 1 INTRODUCTION + +Event sequence prediction is a task to predict the next event1 based on a sequence of previously occurred events. Event sequence prediction has a broad range of applications, e.g., next word prediction in language modeling (Józefowicz et al., 2016), next place prediction based on the previously visited places, or next app to launch given the usage history. Depending on how the temporal information is modeled, event sequence prediction often decomposes into the following two categories: discrete-time event sequence prediction and continuous-time event sequence prediction. + +Discrete-time event sequence prediction primarily deals with sequences that consist of a series of tokens (events) where each token can be indexed by its order position in the sequence. Thus such a sequence evolves synchronously in natural unit-time steps. These sequences are either inherently time-independent, e.g, each word in a sentence, or resulted from sampling a sequential behavior at an equally-spaced point in time, e.g., busy or not busy for an hourly traffic update. In a discrete-time event sequence, the distance between events is measured as the difference of their order positions. As a consequence, for discrete-time event sequence modeling, the primary goal is to predict what event will happen next. + +Continuous-time event sequence prediction mainly attends to the sequences where the events occur asynchronously. For example, the time interval between consecutive clinical visits of a patient may potentially vary largely. The duration between consecutive log-in events into an online service can change from time to time. Therefore, one primary goal of continuous-time event sequence prediction is to predict when the next event will happen in the near future. + +Although these two tasks focus on different aspects of a future event, how to learn a proper representation for the temporal information in the past is crucial to both of them. More specifically, even though for a few discrete-time event sequence prediction tasks (e.g., neural machine translation), they do not involve an explicit temporal information for each event (token), a proper representation of the position in the sequence is still of great importance, not to mention the more general cases where each event is particularly associated with a timestamp. For example, the next destination people want to go to often depends on what other places they have gone to and how long they have stayed in each place in the past. When the next clinical visit (Choi et al., 2016a) will occur for a patient depends on the time of the most recent visits and the respective duration between them. Therefore, the temporal information of events and the interval between them are crucial to the event sequence prediction in general. However, how to effectively use and represent time in sequence prediction still largely remains under explored. + +A natural and straightforward solution is to bring time as an additional input into an existing sequence model (e.g., recurrent neural networks). However, it is notoriously challenging for recurrent neural networks to directly handle continuous input that has a wide value range, as what is shown in our experiments. Alternatively, we are inspired by the fact that humans are very good at characterizing time span as high-level concepts. For example, we would say "watching TV for a little while" instead of using the exact minutes and seconds to describe the duration. We also notice that these high-level descriptions about time are event dependent. For example, watching movies for 30 minutes might feel much shorter than waiting in the line for the same amount of time. Thus, it is desirable to learn and incorporate these time-dependent event representations in general. Our paper offers the following contributions: + +• We propose two methods for time-dependent event representation in a neural sequence prediction model: time masking of event embedding and event-time joint embedding. We use the time span associated with an event to better characterize the event by manipulating its embedding to give a recurrent model additional resolving power for sequence prediction. We propose to use next event duration as a regularizer for training a recurrent sequence prediction model. Specifically, we define two flavors of duration-based regularization: one is based on the negative log likelihood of duration prediction error and the other measures the cross entropy loss of duration prediction in a projected categorical space. We evaluated these proposed methods as well as several baseline methods on five datasets (four are public). These datasets span a diverse range of sequence behaviors, including mobile app usage, song listening pattern, and medical history. The baseline methods include vanilla RNN models and those found in the recent literature. These experiments offer valuable findings about how these methods improve prediction accuracy in a variety of settings. + +# 2 BACKGROUND + +In recent years, recurrent neural networks (RNN) especially with Long-Short Term Memory (LSTM) (Hochreiter & Schmidhuber, 1997) have become popular in solving a variety of discretetime event sequence prediction problems, including neural machine translation (Bahdanau et al., 2014), image captioning $\mathrm { { X u } }$ et al., 2015) and speech recognition (Soltau et al., 2016). In a nutshell, given the sequence of previously occurred events, $\{ e _ { 1 } , e _ { 2 } , . . . , e _ { t } \}$ , the conditional probability $\bar { P ( e _ { t + 1 } | \{ e _ { 1 } , e _ { 2 } , . . . , \bar { e } _ { t } \} ) } = \bar { P ( e _ { t + 1 } | h _ { t } , \theta ) }$ of the next event $e _ { t + 1 }$ is estimated by using a recurrent neural network with parameters $\theta$ and the hidden state vector $\boldsymbol { \dot { h } _ { t } } = f ( h _ { t - 1 } , e _ { t } , \boldsymbol { \dot { \theta } } )$ which is assumed to encode the information of the past events. + +To feed an event into a recurrent neural network, the event, often described as a categorical variable, needs to be represented in a continuous vector space. A common way to achieve this is to use embedding (Bengio et al., 2003) $x _ { t } = 1 ( e _ { t } ) E ^ { x }$ where $1 ( e _ { t } )$ is a one-hot vector. For the $j$ th event in the vocabulary $V , e ^ { j }$ , its one-hot vector has 0s for all the entries except the $j$ th entry being 1. $E ^ { x } \in R ^ { | V | \times E }$ is the embedding matrix, where $| V |$ is the number of unique events (the vocabulary size) and $E$ is the embedding dimension. The use of embedding provides a dense representation for an event that improves learning (Turian et al., 2010). Through training, the embedding vector of an event encodes its meaning relative to other events. Events that are similar tend to have embedding vectors closer to each other in the embedding space than those that are not. + +On the other hand, temporal point processes are mathematical abstractions for the continuous-time event sequence prediction task by explicitly modeling the inter-event interval as a continuous random variable. Since the occurrence of an event may be triggered by what happened in the past, we can essentially specify different models for the timing of the next event given what we have already known so far. Very recently, (Du et al., 2016; Mei & Eisner, 2017; Xiao et al., 2017a;b) focus on expanding the flexibility of temporal point processes using recurrent neural networks where the prediction of the next event time is based on the current hidden state $h _ { t }$ of RNN. However, all of these work use the direct concatenation between the inter-event interval and the respective event embedding as the input to the recurrent layer where the representation of the temporal information is limited. + +Because it is not clear how to properly represent time as input, in this work, we intend to let the model learn a proper representation for encoding temporal information in a sequence, similar to learning embeddings for words. Rather than proposing a new model, our approach should be considered an "embedding" approach for time that can be used by general event sequence prediction models, including models proposed previously (Du et al., 2016; Mei & Eisner, 2017). + +# 3 TIME-DEPENDENT EVENT REPRESENTATION + +There are two notions about time spans in a sequential behavior: duration and intervals. Duration is how long an event lasts, e.g., listening to music for an half hour, and an interval is the time span between two adjacent events. To unify both types of time spans, we treat the idle period when no event is occurring (e.g., the person is not using any app for an app usage sequence) as a special event. Thus, duration becomes an inherent property of an event–the interval between two events is the duration of an idle event (see Figure 1). + +![](images/bc1cb1802cdcac8902024dc451410c54d52fa0363d3a559c90a0f401394d273f.jpg) +Figure 1: An interval is treated as the "duration" of an idle event. + +With this, $h _ { t } ~ = ~ f ( h _ { t - 1 } , e _ { t } , d _ { t } ; \theta )$ where $d _ { t }$ is the duration of event $e _ { t }$ . We here propose two methods to bring continuous time, $d _ { t }$ , into a neural sequence prediction model. Both achieve timedependent event representation by manipulating event embedding vectors using time. Our methods are schematically illustrated in Figure 2. + +# 3.1 CONTEXTUALIZING EVENT EMBEDDING WITH TIME MASK + +Recent work by (Choi et al., 2016b) revealed that in neural machine translation the embedding vector of a word encodes multiple meanings of the word. As a result, it requires a recurrent layer to sacrifice its capacity to disambiguate a word based on its context, instead of focusing on its main task for learning the higher-level compositional structure of a sentence. To address this problem, they used a mask computed based on all the words in a sentence to contextualize the embedding of a target word. + +Based on this recent work, we propose a method to learn a time mask to "contextualize" event embedding, by which we hope a time-dependent embedding would give the recurrent layer additional resolving power. Similar to the word mask proposed by Choi et al. (Choi et al., 2016b), we first compute a time context vector for duration, $c ^ { d }$ . + +$$ +c ^ { d } = \phi ( \log ( d _ { t } ) ; \theta ) +$$ + +$\phi$ is a nonlinear transformation of $d _ { t }$ and is implemented as a feedforward neural network parameterized by $\theta$ . $d _ { t }$ is log transformed before it is fed to $\phi$ to effectively cover the wide numerical range of duration values, e.g., it can range from seconds to hours for app usage events. + +![](images/f17fed137650b6a7f7b8f5a419248564953810c21ff6c7d3308c2f02c679d212.jpg) +Figure 2: A time-dependent RNN for event sequence prediction. $d _ { t }$ is used to generate time-dependent event embedding. Next event duration can be used as a regularizer, which can be applied to the recurrent layer and/or any post recurrent layer. + +We compute a time mask by linearly transforming $c ^ { d }$ with weights $W _ { d } \in \mathbb { R } ^ { C \times E }$ and bias $b _ { d } \in \mathbb { R } ^ { E }$ , which is followed by a sigmoid nonlinear activation, $\sigma$ , to generate a mask $m _ { d } \in \mathbb { R } ^ { E }$ and $\mathbb { R } ^ { E } \to [ 0 , 1 ]$ . $C$ is the size of the time context vector, and $E$ is the event embedding dimension. + +$$ +m _ { d } = \sigma ( c ^ { d } W _ { d } + b _ { d } ) +$$ + +We then apply the mask to an event embedding by performing an element-wise multiplication, $\odot$ , between the embedding vector and the mask. Finally, the product is fed to the recurrent layer. + +$$ +x _ { t } \gets x _ { t } \odot m _ { d } +$$ + +# 3.2 EVENT-TIME JOINT EMBEDDING + +Humans developed many ways to tokenize continuous time in everyday life. For example, we would say "talk to someone briefly" instead of using exact minutes and seconds to characterize the length of the conversation. Such a kind of tokenization is extensively used in natural languages. In addition, our perception about the duration also depends on the specific event that we are experiencing. Based on these intuitions, we propose a method to first encode the duration of an event using soft one-hot encoding and then use the encoding to form the joint embedding with the event. + +To do so, we first project the scalar duration value onto a vector space, where $W _ { d } \in \mathbb { R } ^ { 1 \times P }$ is the weight matrix, $b _ { d } \in \bar { \mathbb { R } ^ { P } }$ is the bias vector, and $P$ is the projection size. + +$$ +p ^ { d } = d _ { t } W _ { d } + b _ { d } +$$ + +We then compute the soft one-hot encoding, $s ^ { d }$ , of a duration value by applying a softmax function to the projection vector, $p ^ { d }$ . Softmax has been typically used in the output layer (Graves, 2012) and in + +the attention mechanisms (Bahdanau et al., 2014; $\mathrm { X u }$ et al., 2015) for selecting one out of many. The ith entry of the encoding vector is calculated as the following and $p _ { i } ^ { d }$ is the ith entry in $p ^ { d }$ . + +$$ +s _ { i } ^ { d } = \frac { \exp ( p _ { i } ^ { d } ) } { \sum _ { k = 1 } ^ { P } \exp ( p _ { k } ^ { d } ) } +$$ + +All the entries in the soft one-hot encoding are positive. Similar to a regular one-hot encoding, $\textstyle \sum _ { i = 1 } ^ { P } s _ { i } ^ { d } = 1$ . We then project the soft one-hot encoding onto a time embedding space, $g _ { d }$ . It has the same dimension as the event embedding. $E ^ { s } \in R ^ { P \times E }$ is the embedding matrix. + +$$ +g _ { d } = s ^ { d } E ^ { s } +$$ + +Embedding for a regular one-hot encoding essentially takes a single row of the embedding matrix that is corresponding to the non-zero entry as the embedding vector. In contrast, embedding for a soft one-hot encoding computes a weighted sum over all the rows in the embedding matrix. Finally, we form the joint embedding of an event and its duration by taking the mean of their embedding vectors, which is then fed to the recurrent layer. + +$$ +x _ { t } \gets \frac { x _ { t } + g _ { d } } { 2 } +$$ + +# 4 NEXT EVENT DURATION AS A REGULARIZER + +While our goal here is to predict next event, it can help learning by introducing an additional loss component based on the prediction of the next event duration (see Figure 2). The duration prediction of the next event at step $t$ , $d _ { t + 1 } ^ { \prime }$ , is computed from a linear transformation of the recurrent layer. A loss defined on the prediction error of $d _ { t + 1 } ^ { \prime }$ provides additional information during back propagation, acting like a regularizer. Optionally, one can use the concatenation of the recurrent layer output and a hidden layer on the path for event prediction to regularize more layers. We discuss two alternatives for the loss function over d0t+1. + +# 4.1 NEGATIVE LOG LIKELIHOOD OF TIME PREDICTION ERROR + +A common way for the loss over a continuous value is to use the squared error. Here, it is $( d _ { t + 1 } ^ { \prime } -$ $d _ { t + 1 } ) ^ { 2 }$ where $d _ { t + 1 }$ is the observed duration of the next event. However, such a loss needs to be at the same scale as that of of event prediction, which is typically a log likelihood of some form. Hinton and Van Camp (Hinton & van Camp, 1993) have shown that minimizing the squared error can be in fact formulated as maximizing the probability density of a zero-mean Gaussian distribution. Note that this does not require duration to obey a Gaussian distribution but rather the prediction error. We define our regularizer, $R _ { t } ^ { N }$ , as the negative log likelihood of duration prediction error at step $t$ . + +$$ +R _ { t } ^ { N } = \frac { ( d _ { t + 1 } ^ { \prime } - d _ { t + 1 } ) ^ { 2 } } { 2 \sigma _ { i } ^ { 2 } } +$$ + +The variance, $\sigma _ { i }$ , is seeded with an initial value (e.g., the variance of duration values in the training data) and updated iteratively during training based on the duration prediction error distribution of the learned model at each update $i$ . + +# 4.2 CROSS ENTROPY LOSS ON TIME PROJECTION + +In Section 3.2, we proposed to use softmax to project a continuous duration value onto a categorical space. Using the same technique, by projecting both $d _ { t + 1 } ^ { \prime }$ and $d _ { t + 1 }$ onto a categorical space, we can then compute a cross entropy loss based on the two projections as another regularizer $R _ { t } ^ { X }$ . + +$$ +R _ { t } ^ { X } = - \sum _ { k = 1 } ^ { P } P r o j _ { k } ( d _ { t + 1 } ) \log P r o j _ { k } ( d _ { t + 1 } ^ { \prime } ) +$$ + +P roj is the softmax projection process we defined in Equation 4 and 5, $P r o j _ { k }$ is the $k$ th entry in the projection vector. When event-time joint embedding and $R _ { t } ^ { X }$ are both used, the embedding and the regularizer can use the same projection function, i.e., sharing the same projection weights (Equation 4). + +# 5 EXPERIMENTS + +In this section, we evaluate the effectiveness of our proposed approaches on the following five real-world datasets across a diverse range of domains. + +• Electrical Medical Records. MIMIC II medical dataset is a collection of de-identified clinical visit records of Intensive Care Unit patients for seven years. The filtered dataset released by (Du et al., 2016) include 650 patients and 204 diseases. The goal is to predict which major disease will happen to a given patient. Stack Overflow Dataset. The Stack Overflow dataset includes two years of user awards on a question-answering website. The awarded badges are treated as the events. (Du et al., 2016) collected 6,000 users with a total of 480,000 events. The goal is to predict the next badge a user will receive. +• Financial Transaction Dataset. (Du et al., 2016) collected a long stream of high frequency transactions for a single stock from NYSE where the events correspond to the "buy" and "sell" actions. The task is to predict the next action a user might take. +• App Usage Dataset. Mobile users often use a large number of apps, ranging from tens to hundreds. It is time consuming to find a target app on mobile devices. One promising way to address this problem is to predict the next app a user will use based on their app usage history. Being able to predict next apps also allows the mobile platform to preload an app in memory to speed up its startup. We have collected 5,891 app usage sequences comprising of 2.8 million app usage events. The task is to predict the next app that will be used for a given user. Music Recommendation. The music dataset represents the longitudinal listening habits of 992 users (Last.FM, 2009; Celma, 2010) involving millions of listening events. The goal is to predict the next five unique songs that the user has not listened given the user’s listen history. + +# 5.1 DATA PREPARATION + +For the MIMIC II, Stack Overflow, and Financial data, we follow (Du et al., 2016) to pre-process the data and seek to predict every single held-out event from the history. We evaluate the prediction accuracy with the binary 0-1 loss. + +For the app usage data, to avoid users who participated in the data collection only briefly, we exclude sequences that have fewer than 50 app launches or if the time span of the sequence is shorter than a week. This resulted in 5,891 app usage sequences, one from each unique user. These sequences include 2,863,095 app usage events and the longest sequence spanned 551 days. We split the dataset on users into the training $( 8 0 \% )$ , validation $( 1 0 \% )$ and test $( 1 0 \% )$ such that each user is only in one of these partitions. Hence there is no intersection of users between training, validation and test sets. For an event that has fewer than 5 occurrences in the training dataset, we assign it the OOV id for out of vocabulary. In total, there are 7,327 events in the vocabulary, including 7,325 unique apps, the idle event and the OOV (out of vocabulary). In practice, predicting the next 5 apps is often desired so we use Precision $@ \mathrm { K }$ to evaluate the performance. + +For the music recommendation, each listen event has a timestamp. We removed sequences that are shorter than 50 and songs that have fewer than 50 listens. We thus generate a collection of examples where each example consists of a listen history and a set of 5 unique songs to recommend. To do so, we split each original listen sequence into segments. We first take the 40 events out in order from the beginning of the sequence as the listen history, and then take more events out from the beginning of the sequence until we find 5 unique songs that have not occurred in the listen history. We do so repeatedly to extract each example until we exhaust all the original sequences. This data processing resulted in 221,920 sequence examples with 71,619 unique songs (the vocabulary size). We then allocate these sequence examples for the training $( 8 0 \% )$ , validation $( 1 0 \% )$ and test $( 1 0 \% )$ . Because the original dataset does not have the duration information for each listen event, we did not inject the additional idle event in the sequence to differentiate duration versus intervals. Because in practice, the ranking order of the recommended music often matters, we further use $\mathbf { M A P @ K }$ and Prevision $@ \mathrm { K }$ to evaluate the performance. + +# 5.2 MODEL CONFIGURATIONS + +We compare with the following five models: NoTime in which a simple LSTM sequence model is used; TimeConcat in which we feed time (log transformed) directly into the recurrent layer along the event embedding; TimeMask (Section 3.1) and TimeJoint (Section 3.2) for generating time-dependent event embedding as input to the recurrent layer; and RMTPP for the model introduced previously by (Du et al., 2016). Moreover, we also include four regularized models based on $R _ { t } ^ { X }$ and $R _ { t } ^ { N }$ defined earlier. For TimeMask, the size of the time context vector is $C = 3 2$ , and we use ReLu for the activation function in $\phi$ in Equation 2. For TimeJoint, we chose the projection size, $P = 3 0$ (Equation 4). For the App Usage and Music Recommendation experiments, we use a two-layer hierarchical softmax (Morin & Bengio, 2005) for the output layer due to the large vocabulary size, while we use a full sofmax for the rest experiments. + +For the MIMIC II, Stack Overflow, and Financial data, we follow (Du et al., 2016) for RMTPP’s model parameters. For the app usage data, we determined the parameters of each model based on the training and the validation datasets on a distributed parallel tuning infrastructure. We used LSTM units (Hochreiter & Schmidhuber, 1997) for the recurrent layer, and Rectified Linear Units (ReLu) (Nair & Hinton, 2010) for the activation function in the nonlinear projection layer. The event embedding dimension, the number of LSTM units, and the nonlinear projection layer size are all set to 128. For the music recommendation data, we use a setting similar to the app prediction experiment where we chose the embedding size as 128 and LSTM size as 256. We did not use the nonlinear projection layer after the LSTM layer for this task because it does not seem to help. We implemented all the models in TensorFlow (TensorFlow, 2017). + +# 5.3 TRAINING AND TESTING + +For the experiments based on MIMIC II, Stack Overflow and Financial Transaction datasets, we use the same training and testing strategy of (Du et al., 2016). For App Usage and Music Recommendation tasks, we selected the model architecture and hyper parameters with early stopping based on the validation dataset of each task, and report the performance of each model based on the test dataset. + +For the App Usage experiment, we used truncated back-propagation through time with the number of unroll to be 30. We used an adaptive gradient descent optimizer (Zeiler, 2012), using a learning rate of 0.024 with a threshold for gradient clipping of 1.0, and a batch size of 32. We decided not to use dropout as it did not seem to improve accuracy on this task. + +For the Music Recommendation experiment, we used the full sequence back-propagation through time with $2 \%$ dropout ratio on the recurrent layer for better generalization. We used the Adam optimizer by (Kingma & Ba, 2014) for adaptive learning with a learning rate of 0.00005 and a gradient clipping threshold at 1.0. The mini-batch size is 256. + +We trained the models by minimizing the cross-entropy loss, plus the regularization loss if the duration regularizer is used, over all the sequences in the training dataset. The training for App Usage and Music Recommendation was conducted on a distributed learning infrastructure (Dean et al., 2012) with 50 GPU cores where updates are applied asynchronously across multiple replicas. + +# 5.4 EXPERIMENTAL RESULTS + +Effectiveness of Temporal Representation. Figure 3 presents the comparisons between all the models on three released public datasets. We can observe a consistent performance gain with using the proposed methods for time-dependent event embedding compared to the NoTime baseline and the simple TimeConcat approach. TimeJoint significantly outperformed all other methods on both the Stack Overflow and the Financial dataset, with $\mathrm { p { < } 0 . 0 5 }$ using Paired T-test. But none of the methods for using time is able to improve accuracy on the MIMIC II dataset. This indicates that using time might not always help. However, when it does, our methods such as TimeJoint enable more efficient representation of time than simply using the scalar value of time in RNN models. + +![](images/6650a85bb2ba38bc2cbaf563b3d23daa7e0a2f3301d3596cae0f583744b88311.jpg) +Figure 3: Prediction accuracy on (a) MIMIC II, (b) Stack Overflow, and (c) Financial Data. + +Table 1: Prediction accuracy on test dataset for next app prediction in percentages. + +
ModelPrecision@1Precision@5
NoTime30.2913.07
TimeConcat31.0312.98
RMTPP31.3112.9
TimeMask31.2913.13
31.313.15
TimeMask + RN31.4113.1
TimeJoint31.313.07
31.5313.09
TimeJoint + RN31.4513.13
+ +Table 2: Prediction accuracy on test dataset for music recommendation. The numbers are percentages. + +
ModelMAP5MAP10MAP20Precision@5Precision @10Precision @20
NoTime11.5913.1813.8313.828.755.25
TimeConcat11.4112.8513.5113.538.635.19
RMTPP11.5112.9313.5913.628.665.19
TimeMask11.7413.1813.8313.798.815.28
11.7113.1713.8213.818.765.25
11.6913.1613.813.818.765.30
TimeJoint11.8213.3714.0613.958.975.40
TimeJoint + Rx12.0213.5114.214.129.015.43
TimeJoint + RN11.913.4114.1114.058.985.40
+ +Our methods also outperformed RMTPP for event prediction. The performance gain of our models are more pronounced on the App Usage and Music Recommendation datasets as shown in Table 1 and 2. TimeJoint seems to outperform the rest on most measures and TimeMask also performs well compared to other previous methods. We also notice that using time directly without representing them appropriately in RNN, i.e., TimeConcat, can sometime hurt the performance. + +Effectiveness of Event Duration Regularization. We demonstrate the performance boosting gained from our proposed temporal regularization in Table 1 and 2, respectively. We can observe that our proposed regularizers can bring additional performance gain on many cases. In particular, the crossentropy regularizer, $R _ { t } ^ { X }$ , is able to give consistent performance gain with the temporal embedding approaches. + +Learned Time Representation. Our motivation in this work is to let the model learn a proper representation of time from data. We here briefly discuss what the TimeJoint approach learns about how to project a scalar value of time into a soft one-hot encoding 4. It seems that for small time periods, e.g., shorter than 20 seconds for the Next App prediction task, more dimensions are needed to express the differences of continuous time values. As the time period grows, we need less dimensions for representing time, e.g., two of the curves have converged to the same small values. + +![](images/e3e3d7d3ff891fef260b7abf1b92def2250e3264a32906aa8175bcea7b8dcc41.jpg) +Figure 4: The projection of time learned by TimeJoint with $P = 5$ . The $\mathrm { X }$ axis is in seconds and the Y axis is the projection of a time in each dimension defined in Equation 5. + +# 6 CONCLUSIONS + +We proposed a set of methods for leveraging the temporal information for event sequence prediction. Based on our intuition about how humans tokenize time spans as well as previous work on contextual representation of words, we proposed two methods for time-dependent event representation. They transform a regular event embedding with learned time masking and form time-event joint embedding based on learned soft one-hot encoding. We also introduced two methods for using next duration as a way of regularization for training a sequence prediction model. Experiments on a diverse range of real data demonstrate consistent performance gain by blending time into the event representation before it is fed to a recurrent neural network. + +# REFERENCES + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014. URL http://arxiv.org/abs/ 1409.0473. + +Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Janvin. A neural probabilistic language model. J. Mach. Learn. Res., 3:1137–1155, March 2003. ISSN 1532-4435. URL http://dl.acm.org/citation.cfm?id $\equiv$ 944919.944966. + +O. Celma. Music Recommendation and Discovery in the Long Tail. Springer, 2010. + +Edward Choi, Mohammad Taha Bahadori, Andy Schuetz, Walter F. Stewart, and Jimeng Sun. Doctor ai: Predicting clinical events via recurrent neural networks. In Proceedings of the 1st Machine Learning for Healthcare Conference, pp. 301–318, 2016a. + +Heeyoul Choi, Kyunghyun Cho, and Yoshua Bengio. Context-dependent word representation for neural machine translation. CoRR, abs/1607.00578, 2016b. URL http://arxiv.org/abs/ 1607.00578. + +Jeffrey Dean, Greg S. Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Quoc V. Le, Mark Z. Mao, Marc’Aurelio Ranzato, Andrew Senior, Paul Tucker, Ke Yang, and Andrew Y. Ng. Large scale distributed deep networks. In Proceedings of the 25th International Conference on Neural Information Processing Systems, NIPS’12, pp. 1223–1231, USA, 2012. Curran Associates Inc. URL http://dl.acm.org/citation.cfm?id=2999134.2999271. + +Nan Du, Hanjun Dai, Rakshit Trivedi, Utkarsh Upadhyay, Manuel Gomez-Rodriguez, and Le Song. Recurrent marked temporal point processes: Embedding event history to vector. In Proceedings of the 22Nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’16, pp. 1555–1564, New York, NY, USA, 2016. ACM. ISBN 978-1-4503-4232-2. doi: 10.1145/2939672.2939875. URL http://doi.acm.org/10.1145/2939672.2939875. + +Alex Graves. Supervised sequence labelling. In Supervised Sequence Labelling with Recurrent Neural Networks, pp. 5–13. Springer Berlin Heidelberg, 2012. + +Geoffrey E. Hinton and Drew van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the Sixth Annual Conference on Computational Learning Theory, COLT ’93, pp. 5–13, New York, NY, USA, 1993. ACM. ISBN 0-89791-611-5. doi: 10.1145/168304.168306. URL http://doi.acm.org/10.1145/168304.168306. + +Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Comput., 9(8):1735– 1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL http://dx. doi.org/10.1162/neco.1997.9.8.1735. + +Rafal Józefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. CoRR, abs/1602.02410, 2016. URL http://arxiv.org/abs/ 1602.02410. + +Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980. + +Last.FM. Music. https://www.last.fm/, 2009. + +Hongyuan Mei and Jason Eisner. The neural hawkes process: A neurally self-modulating multivariate point process. In NIPS, 2017. + +Frederic Morin and Yoshua Bengio. Hierarchical probabilistic neural network language model. In AISTATS’05, pp. 246–252, 2005. + +Vinod Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. In Johannes Fürnkranz and Thorsten Joachims (eds.), Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 807–814. Omnipress, 2010. URL http: //www.icml2010.org/papers/432.pdf. + +Hagen Soltau, Hank Liao, and Hasim Sak. Neural speech recognizer: Acoustic-to-word LSTM model for large vocabulary speech recognition. CoRR, abs/1610.09975, 2016. URL http: //arxiv.org/abs/1610.09975. + +TensorFlow. An open-source software library for Machine Intelligence. https://www. tensorflow.org/, 2017. + +Joseph Turian, Lev Ratinov, and Yoshua Bengio. Word representations: A simple and general method for semi-supervised learning. In Proceedings of the 48th Annual Meeting of the Association for Computational Linguistics, ACL ’10, pp. 384–394, Stroudsburg, PA, USA, 2010. Association for Computational Linguistics. URL http://dl.acm.org/citation.cfm?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 1858681. 1858721. + +Shuai Xiao, Junchi Yan, Stephen Chu, Xiaokang Yang, and Hongyuan Zha. Modeling the intensity function of point process via recurrent neural networks. In AAAI, 2017a. + +Shuai Xiao, Junchi Yan, Mehrdad Farajtabar, Le Song, Xiaokang Yang, and Hongyuan Zha. Joint modeling of event sequence and time series with attentional twin recurrent neural networks. 2017b. URL https://arxiv.org/abs/1703.08524. + +Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron C. Courville, Ruslan Salakhutdinov, Richard S. Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. CoRR, abs/1502.03044, 2015. URL http://arxiv.org/abs/1502. 03044. + +Matthew D. Zeiler. ADADELTA: an adaptive learning rate method. CoRR, abs/1212.5701, 2012. URL http://arxiv.org/abs/1212.5701. \ No newline at end of file diff --git a/md/train/SJTQLdqlg/SJTQLdqlg.md b/md/train/SJTQLdqlg/SJTQLdqlg.md new file mode 100644 index 0000000000000000000000000000000000000000..0dcf65fd4292fddb17d76f1e383c0788753ec93e --- /dev/null +++ b/md/train/SJTQLdqlg/SJTQLdqlg.md @@ -0,0 +1,246 @@ +# LEARNING TO REMEMBER RARE EVENTS + +Łukasz Kaiser∗ +Google Brain +lukaszkaiser@google.com +Ofir Nachum∗† +Google Brain +ofirnachum@google.com +Aurko Roy‡ +Georgia Tech +aurko@gatech.edu +Samy Bengio +Google Brain +bengio@google.com + +# ABSTRACT + +Despite recent advances, memory-augmented deep neural networks are still limited when it comes to life-long and one-shot learning, especially in remembering rare events. We present a large-scale life-long memory module for use in deep learning. The module exploits fast nearest-neighbor algorithms for efficiency and thus scales to large memory sizes. Except for the nearest-neighbor query, the module is fully differentiable and trained end-to-end with no extra supervision. It operates in a life-long manner, i.e., without the need to reset it during training. + +Our memory module can be easily added to any part of a supervised neural network. To show its versatility we add it to a number of networks, from simple convolutional ones tested on image classification to deep sequence-to-sequence and recurrent-convolutional models. In all cases, the enhanced network gains the ability to remember and do life-long one-shot learning. Our module remembers training examples shown many thousands of steps in the past and it can successfully generalize from them. We set new state-of-the-art for one-shot learning on the Omniglot dataset and demonstrate, for the first time, life-long one-shot learning in recurrent neural networks on a large-scale machine translation task. + +# 1 INTRODUCTION + +Machine learning systems have been successful in many domains, from computer vision (Krizhevsky et al., 2012) to speech recognition (Hinton et al., 2012) and machine translation (Sutskever et al., 2014; Bahdanau et al., 2014; Cho et al., 2014). Neural machine translation (NMT) is so successful that for some language pairs it approaches, on average, the quality of human translators (Wu et al., 2016). The words on average are crucial though. When a sentence resembles one from the abundant training data, the translation will be accurate. However, when encountering a rare word such as Dostoevsky (in German, Dostojewski), many models will fail. The correct German translation of Dostoevsky does not appear enough times in the training data for the model to sufficiently learn its translation. + +While more example sentences concerning the famous Russian author might eventually be added to the training data, there are many other rare words or rare events of other kinds. This illustrates a general problem with current deep learning models: it is necessary to extend the training data and re-train them to handle such rare or new events. Humans, on the other hand, learn in a life-long fashion, often from single examples. + +We present a life-long memory module that enables one-shot learning in a variety of neural networks. Our memory module consists of key-value pairs. Keys are activations of a chosen layer of a neural network, and values are the ground-truth targets for the given example. This way, as the network is trained, its memory increases and becomes more useful. Eventually it can give predictions that leverage on knowledge from past data with similar activations. Given a new example, the network writes it to memory and is able to use it afterwards, even if the example was presented just once. + +There are many advantages of having a long-term memory. One-shot learning is a desirable property in its own right, and some tasks, as we will show below, are simply not solvable without it. Even real-world tasks where we have large training sets, such as translation, can benefit from long-term memory. Finally, since the memory can be traced back to training examples, it might help explain the decisions that the model is making and thus improve understandability of the model. + +It is not immediately clear how to measure the performance of a life-long one-shot learning model, since most deep learning evaluations focus on the average performance and do not have a one-shot component. We therefore evaluate in a few ways, to show that our memory module indeed works: + +(1) We evaluate on the well-known one-shot learning task Omniglot, which is the only dataset with explicit one-shot learning evaluation. This dataset is small and does not benefit from life-long learning capability of our module, but we still exceed the best previous results and set new state-of-the-art. +(2) We devise a synthetic task that requires life-long one-shot learning. On this task, standard models fare poorly while our model can solve it well, demonstrating its strengths. +(3) Finally, we train an English-German translation model that has our life-long one-shot learning module. It retains very good performance on average and is also capable of one-shot learning. On the qualitative side, we find that it can translate rarely-occurring words like Dostoevsky. On the quantitative side, we see that the BLEU score for the generated translations can be significantly increased by showing it related translations before evaluating. + +# 2 MEMORY MODULE + +Our memory consists of a matrix $K$ of memory keys, a vector $V$ of memory values, and an additional vector $A$ that tracks the age of items stored in memory. Keys can be arbitrary vectors of size ${ \mathrm { k e y } } - s { \mathrm { i } } z { \mathrm { e } }$ , and we assume that the memory values are single integers representing a class or token ID. We define a memory of size memory-size as a triple: + +$$ +\mathcal { M } = ( K _ { \mathrm { m e m o r y - s i z e } \times \mathrm { k e y - s i z e } } , ~ V _ { \mathrm { m e m o r y - s i z e } } , ~ A _ { \mathrm { m e m o r y - s i z e } } ) . +$$ + +A memory query is a vector of size key-size which we assume to be normalized, i.e., $\| q \| = 1$ . Given a query $q$ , we define the nearest neighbor of $q$ in $\mathcal { M }$ as any of the keys that maximize the dot product with $q$ : + +$$ +\operatorname { N N } ( q , \mathcal { M } ) = \operatorname { a r g m a x } _ { i } q \cdot K [ i ] . +$$ + +Since the keys are normalized, the above notion corresponds to the nearest neighbor with respect to cosine similarity. We will also use the natural extension of it to $k$ nearest neighbors, which we denote $\mathrm { N N } _ { k } ( q , \mathcal { M } )$ . In our experiments we always used the set of $k = 2 5 6$ nearest neighbors. + +When given a query $q$ , the memory $\mathcal { M } = ( K , V , A )$ will compute $k$ nearest neighbors (sorted by decreasing cosine similarity): + +$$ +( n _ { 1 } , \dots , n _ { k } ) = \Nu \Nu _ { k } ( q , { \mathcal { M } } ) +$$ + +and return, as the main result, the value $V [ n _ { 1 } ]$ . Additionally, we will compute the cosine similarities $d _ { i } = \boldsymbol { q } \cdot \boldsymbol { K } [ n _ { i } ]$ and return softmax $( d _ { 1 } \cdot t , \ldots , d _ { k } \cdot t )$ . The parameter $t$ denotes the inverse of softmax temperature and we set it to $t = 4 0$ in our experiments. In models where the memory output is again embedded into a dense vector, we multiply the embedded output by the corresponding softmax component so as to provide a signal about confidence of the memory. + +The forward computation of the memory module is thus very simple, the only interesting part being how to compute nearest neighbors efficiently, which we discuss below. But we must also answer the question how the memory is trained. + +Memory Loss. Assume now that in addition to a query $q$ we are also given the correct desired (supervised) value $v$ . In the case of classification, this $v$ would be the class label. In a sequenceto-sequence task, $v$ would be the desired output token of the current time step. After computing the $k$ nearest neighbors $( n _ { 1 } , \ldots , n _ { k } )$ as above, let $p$ be the smallest index such that $V [ n _ { p } ] = { \bar { v } }$ and + +Case $1 \colon V [ n _ { 1 } ] = v ; \quad \operatorname { L o s s } = [ q \cdot k _ { b } - q \cdot k _ { 1 } + \alpha ] _ { + }$ Update: $\begin{array} { r l } { K [ n _ { 1 } ] \gets \frac { q + k _ { 1 } } { \| q + k _ { 1 } \| } } & { { } A [ n _ { 1 } ] \gets 0 } \end{array}$ + +${ \mathrm { C a s e ~ } } 2 \colon V [ n _ { 1 } ] \neq v ; \quad { \mathrm { L o s s } } = [ q \cdot k _ { 1 } - q \cdot k _ { p } + \alpha ] _ { + }$ Update: $K [ n ^ { \prime } ] \gets q$ $\mid q \quad V [ n ^ { \prime } ] v \quad A [ n ^ { \prime } ] 0$ + +![](images/9a0e9979f224838b6739ede56f86aa3a60d5f2bde94e10bf2bf90a017be31af0.jpg) +Figure 1: The operation of the memory module on a query $q$ with correct value $v$ ; see text for details. + +![](images/439659069ba27ddf6723d23d463db67cb813a1033d57af231b411cfaded4e734.jpg) + +$b$ the smallest index such that $V [ n _ { b } ] \ne v$ . We call $n _ { p }$ the positive neighbor and $n _ { b }$ the negative neighbor. When no positive neighbor is among the top- $k$ , we pick any vector from memory with value $v$ instead of $K [ n _ { p } ]$ . We define the memory loss as: + +$$ +\mathrm { l o s s } ( q , v , { \cal M } ) = \left[ q \cdot K [ n _ { b } ] - q \cdot K [ n _ { p } ] + \alpha \right] _ { + } . +$$ + +Recall that both $q$ and the keys in memory are normalized, so the products in the above loss term correspond to cosine similarities between $q$ , the positive key, and the negative key. Since cosine similarity is maximal for equal terms, we want to maximize the similarity to the positive key and minimize the similarity to the negative one. But once they are far enough apart (by the margin $\alpha$ , 0.1 in all our experiments), we do not propagate any loss. This definition and reasoning behind it are almost identical to the one in Schroff et al. (2015) and similar to many other distance metric learning works (Weinberger & Saul, 2009; Weston et al., 2011). + +Memory Update. In addition to computing the loss, we will also update the memory $\mathcal { M }$ to account for the fact that the newly presented query $q$ corresponds to $v$ . The update is done in a different way depending on whether the main value returned by the memory module already is the correct value $v$ or not. As before, let $n _ { 1 } = \mathrm { N N } ( q , { \mathcal { M } } )$ be the nearest neighbor to $q$ . + +If the memory already returns the correct value, i.e., if $V [ n _ { 1 } ] = v$ , then we only update the key for $n _ { 1 }$ by taking the average of the current key and $q$ and normalizing it: + +$$ +K [ n _ { 1 } ] \gets \frac { q + K [ n _ { 1 } ] } { \lVert q + K [ n _ { 1 } ] \rVert } . +$$ + +When doing this, we also re-set the age: $A [ n _ { 1 } ] 0$ . + +Otherwise, when $V [ n _ { 1 } ] \neq v$ , we find a new place in the memory and write the pair $( q , v )$ there. Which place should we choose? We find memory items with maximum age, and write to one of those (randomly chosen). More formally, we pick $n ^ { \prime } = \mathrm { a r g m a x } _ { i } A [ i ] + r _ { i }$ where $| r _ { i } | \ll | \mathcal { M } |$ is a random number that introduces some randomness in the choice so as to avoid race conditions in asynchronous multi-replica training. We then set: + +$$ +K [ n ^ { \prime } ] q , \quad V [ n ^ { \prime } ] v , \quad A [ n ^ { \prime } ] 0 . +$$ + +With every memory update we also increment the age of all non-updated indices by 1. The full operation of the memory module is depicted in Figure 1. + +Efficient nearest neighbor computation. The most expensive operation in our memory module is the computation of $k$ nearest neighbors. This can be done exactly or in an approximate way. + +In the exact mode, to calculate the nearest neighbors in $K$ to a mini-batch of queries $Q \ =$ $( q _ { 1 } , \dots , q _ { b } )$ , we perform a single matrix multiplication: $Q \times K ^ { T }$ . This multiplies the batch-size $\times \mathrm { \ k e y - s i z e }$ matrix $Q$ by the ${ \bf k e y - s i z e } \times { \bf m e m o r y - s i z e }$ matrix $K ^ { T }$ , and the result is the batch-size $\div \times \mathrm { ~ m } \in$ emory-size matrix of all distances, from which we can choose the top- $k$ . This procedure is linear in memory-size, so it can be expensive for very large memory sizes. But matrix multiplication is very heavily optimized, so in our experiments on GPUs we find that this operation is not a bottleneck for memory sizes up to half a million. + +![](images/b8f9c043a8b0838456ee094f0909ad7a399d67f149e328b2e34a7d07e1152410.jpg) +Figure 2: The GNMT model with added memory module. On each decoding step $t$ , the result of the attention $a _ { t }$ is used to query the memory. The resulting value is combined with the output of the final LSTM layer to produce the predicted logits $\hat { y } _ { t }$ . See text for further details. + +If the exact mode is too slow, the $k$ nearest neighbors can be computed approximately using locality sensitive hashing (LSH). LSH is a hashing scheme so that near neighbors get similar hashes (Indyk & Motwani, 1998; Andoni $\&$ Indyk, 2006). For cosine similarity, the computation of an LSH is very simple. We pick a number of random normalized hash vectors $h _ { 1 } , \ldots , h _ { l }$ . The hash of a query $q$ is a sequence of $l$ bits, $b _ { 1 } , \ldots , b _ { l }$ , such that $b _ { i } = 1$ if, and only if, $q \cdot h _ { i } > 0$ . It turns out that near neighbors will, with high probability, have a large number of identical bits in their hash. To compute the nearest neighbors it is therefore sufficient to only look into parts of the memory with similar hashes. This makes the nearest neighbor computation work in approximately constant time – we only need to multiply the query by the hash vectors, and then only use the nearest buckets. + +# 2.1 USING THE MEMORY MODULE + +The memory module presented above can be added to any classification network. There are two main choices: which layer to use to generate queries, and how to use the output of the module. + +In the simplest case, we use the final layer of a network as query and the output of the module is directly used for classification. This simplest case is similar to matching networks (Oriol Vinyals, 2016b) and our memory module yields good results already in this setting (see below). + +Instead of using the output of the module directly, it is possible to embed it again into a dense representation and mix it with other predictions made by the network. To study this setting, we add the memory module to sequence-to-sequence recurrent neural networks. As described in detail below, a query to memory is made in every step of the decoder network. Memory output is embedded again into a dense representation and combined with inputs from other layers of the network. + +Convolutional Network with Memory. To test our memory module in a simple setting, we first add it to a basic convolutional network network for image classification. Our network consists of two convolutional layers with ReLU non-linearity, followed by a max-pooling layer, another two convolutional-ReLU layers, another max-pooling, and two fully connected layers. All convolutions use $3 \times 3$ filters with 64 channels in the first pair, and 128 in the second. The fully connected layers have dimension 256 and dropout applied between them. The output of the final layer is used as query to our memory module and the nearest neighbor returned by the memory is used as the final network prediction. Even this basic architecture yields good results in one-shot learning, as discussed below. + +![](images/7d63c9c6459cd8c2b28898bc12351be72bca2ac04e812c6be2789ac05c86e989.jpg) +Figure 3: Extended Neural GPU with memory module. Memory query is read from the position one below the current output logit, and the embedded memory value is put at the same position of the output tape $p$ . The network learns to use these values to produce the output in the next step. + +Sequence-to-sequence with Memory. For large-scale experiments, we add the memory module into a large sequence-to-sequence model. Such sequence-to-sequence recurrent neural networks (RNNs) with long short-term memory (LSTM) cells (Hochreiter & Schmidhuber, 1997) have proven especially successful at natural language processing (NLP) tasks, including machine translation (Sutskever et al., 2014; Bahdanau et al., 2014; Cho et al., 2014). We add the memory module to the Google Neural Machine Translation (GNMT) model (Wu et al., 2016). This model consists of an encoder RNN, which creates a representation of the source language sentence, and a decoder RNN that outputs the target language sentence. We left the encoder RNN unmodified. In the decoder RNN, we use the vector retrieved by the attention mechanism as query to the memory module. In the GNMT model, the attention vector is used in all LSTM layers beyond the second one, so the computation of the other layers and the memory can happen in parallel. Before the final softmax layer, we combine the embedded memory output with the output of the final LSTM layer using an additional linear layer, as depicted in Figure 2. + +Extended Neural GPU with Memory. To test versatility of our memory module, we also add it to the Extended Neural GPU, a convolutional-recurrent model introduced by Kaiser & Bengio (2016). The Extended Neural GPU is a sequence-to-sequence model too, but its decoder is convolutional and the size of its state changes depending on the size of the input. Again, we leave the encoder part of the model intact, and extend the decoder part by a memory query. This time, we use the position one step ahead to query memory, and we put the embedded result to the output tape, as shown in Figure 3. Note that in this model the result of the memory will be processed by two recurrent-convolutional cells before the corresponding output is produced. The fact that this model still does one-shot learning confirms that the output of our memory module can be used deep inside a network, not just near the output layer. + +# 3 RELATED WORK + +Memory in Neural Networks. Augmenting neural networks with memory has been heavily studied recently. Many of these approaches design a memory component that is intended as a generalization of the memory in standard recurrent neural networks. In recurrent networks, the state passed from one time step to the next can be interpreted as the network’s memory representation of the current example. Moving away from this fixed-length vector representation of memory to a larger and more versatile form is at the core of these methods. + +Augmenting recurrent neural networks with attention (Bahdanau et al., 2014) can be interpreted as creating a large memory component that allows content-based addressing. More generally, Graves et al. (2014) augmented a recurrent neural network with a computing-inspired memory component that can be addressed via both content- and address-based queries. Sukhbaatar et al. (2015) present a similar augmentation and show the importance of allowing multiple reads and writes to memory between inputs. These approaches excel at tasks where it is necessary to store large parts of a sequential input in a representation that can later be precisely queried. Such tasks include algorithmic sequence manipulation tasks, natural language modelling, and question-answering tasks. + +The success of these approaches hinges on making the memory component fully differentiable and backpropagating signal through every access of memory. In this setting, computational requirements necessitate that the memory be small. Some attempts have been made at making hard access queries to memory (Zaremba & Sutskever, 2015; Xu et al., 2015), but it was usually challenging to match the soft version. Recently, more successful training for hard queries was reported (Gulc¸ehre et al. ¨ , 2016) that makes use of a curriculum strategy that mixes soft and hard queries at training time. Our approach applies hard access as well, but we encourage the model to make good queries via a special memory loss. + +Modifications to allow for large-scale memory in neural networks have been proposed. The original implementation of memory networks (Weston et al., 2014) and later work on scaling it (Bordes et al., 2015; Chandar et al., 2016) used memory with size in the millions. The cost of doing so is that the memory must be fixed prior to training. Moreover, since during the beginning of training the model is unlikely to query the memory correctly, strong supervision is used to encourage the model to query memory locations that are useful. These hints are either given as additional supervising information by the task or determined heuristically as in Hill et al. (2015). + +All the work discussed so far has either used a memory that is fixed before training or used a memory that is not persistent between different examples. For one-shot and lifelong learning, a memory must necessarily be both volatile during training and persistent between examples. To bridge this gap, Santoro et al. (2016) propose to partition training into distinct episodes consisting of a sequence of labelled examples $\bar { \{ ( x _ { i } , y _ { i } ) \} } _ { i = 1 } ^ { n }$ . A network augmented with a fully-differentiable memory is trained to predict $y _ { i }$ given the previous sequence $( x _ { 1 } , y _ { 1 } , \dotsc , x _ { i - 1 } )$ . This way, the model learns to store important examples with their corresponding labels in memory and later re-use this information to correctly classify new examples. This model successfully exhibits one-shot learning on Omniglot. + +However, this approach again requires fully-differentiable memory access and thus limits the size of the memory as well as the length of an episode. This restriction has recently been alleviated by Rae et al. (2016). Their model can utilize large memories, but unlike our work does not have an explicit cost to guide the formation of memory keys. + +For classification tasks like Omniglot, it is easy to construct short episodes so that they include a few examples from each of several classes. However, this becomes harder as the output becomes richer. For example, in the difficult sequence-to-sequence tasks which we consider, it is hard to determine which examples would be helpful for correctly predicting others a priori, and so constructing short episodes each containing examples that are similar and act as hints to each other is intractable. + +One-shot Learning. While the recent work of Santoro et al. (2016) succeeded in bridging the gap between memory-based models and one-shot learning, the field of one-shot learning has seen a variety of different approaches over time. + +Early work utilized Bayesian methods to model data generatively (Fei-Fei et al., 2006; Lake et al., 2011). The paper that introduced the Omniglot dataset (Lake et al., 2011) approached the task with a generative model for strokes. This way, given a single character image, the probability of a different image being of the same character may be approximated via standard techniques. One early neural network approach to one-shot learning was given by Siamese networks (Koch, 2015). When our approach is applied to the Omniglot image classification dataset, the resulting training algorithm is actually similar to that of Siamese networks. The only difference is in the loss function: Siamese networks utilize a cross-entropy loss whereas our method uses a margin triplet loss. + +A more sophisticated neural network approach is given by Vinyals et al. (2016). The strengths of this approach are (1) the model architecture utilizes recent advances in attention-augmented neural networks for set-to-set learning (Oriol Vinyals, 2016a), and (2) the training algorithm is designed to exactly match the testing phase (given $k$ distinct images and an additional image, the model must predict which of the $k$ images is of the same class as the additional image). This approach may also be considered as a generalization of previous work on metric learning. + +Table 1: Results on the Omniglot dataset. Although our model uses only a simple convolutional neural network, the addition of our memory module allows it to approach much more complex models on 1-shot and multi-shot learning tasks. + +
Model5-way 1-shot5-way 5-shot20-way 1-shot20-way 5-shot
Pixels Nearest Neighbor41.7%63.2%26.7%42.6%
MANN (no convolutions)82.8%94.9%11
Convolutional Siamese Net96.7%98.4%88.0%96.5%
Matching Network98.1%98.9%93.8%98.5%
ConvNet with Memory Module98.4%99.6%95.0%98.6%
+ +# 4 EXPERIMENTS + +We perform experiments using all three architectures described above. We experiment both on realworld data and on synthetic tasks that give us some insight into the performance and limitations of the memory module. In all our experiments we use the Adam optimizer (Kingma & Ba, 2014) and the parameters for the memory module remain unchanged $( k = 2 5 6 , \alpha = 0 . 1 )$ . Good performance with a single set of parameters shows the versatility of our memory module. The source code for the memory module, together with our settings for Omniglot, is available on github1. + +Omniglot. The Omniglot dataset (Lake et al., 2011) consists of 1623 characters from 50 different alphabets, each hand-drawn by 20 different people. The large number of classes (characters) with relatively few data per class (20), makes this an ideal data set for testing one-shot classification. In the $N$ -way Omniglot task setup we pick $N$ unseen character classes, independent of alphabet. We provide the model with one drawing of each character and measure its accuracy the $K$ -th time it sees the character class. Our setup is identical to Oriol Vinyals (2016b), so we also augmented the data set with random rotations by multiples of 90 degrees and use 1200 characters for training, and the remaining character classes for evaluation. We present the results from Oriol Vinyals (2016b) and ours in Table 1. Even with a simpler network without batch normalization, we get similar results. + +Synthetic task. To better understand the memory module operation and to test what it can remember, we devise a synthetic task and train the Extended Neural GPU with and without memory (we use a small Extended Neural GPU with 32 channels and memory of size half a million). + +To create training and test data for our synthetic task, we use symbols from the set $S \_ =$ $\{ 2 , \ldots , 1 6 0 0 0 \}$ and first fix a random function $f : S S$ . The function $f$ is chosen at random, but fixed and the same for all training and testing examples (we used 40K training examples). + +In our synthetic task, the input is a sequence consisting of As and Bs with one continuous substring of 7 digits from the set $0 , 1 , 2 , 3$ . The substring is interpreted as a number written in base-4, e.g., $1 9 8 2 = 1 3 2 3 3 2 _ { 4 }$ , so the string 132332 would be interpreted as 1982. The corresponding output is created by copying all As and Bs, but mapping the number through the random function $f$ . For instance, assuming ${ \bar { f } } ( 1 9 8 2 ) = 3 7 2 6$ , the output corresponding to 132332 would be 322032 as $3 7 2 6 = 3 2 2 0 3 2 _ { 4 }$ . Here is an example of an input-output pair: + +
InputA0132332BABAB
OutputA0322032BABAB
+ +This task clearly requires memory to store the fixed random function. Since there are 16K elements to learn, it is hard to memorize, and each single instance occurs quite rarely. The raw Extended Neural GPU (or any other sequence-to-sequence model) are limited by their size. With long training, the small model can memorize some of the sequences, but it is only a small fraction. + +Additionally, there is no direct indication in the data what part of the input should trigger the production of each output symbol. For example, to produce the first 3 output in the above example, the + +Table 2: Results on the synthetic task. We report the percentage of fully correct sequences from the test set, which contains 10000 random examples. See text for details. + +
ModelAccuracy
HammingNearestNeighborBaseline Sequence-to-Sequence with AttentionBaseline Extended Neural GPU0.1%0.9%12.2%
Sequence-to-Sequence with Attention and MemoryExtended Neural GPU with Memory Module35.2%71.3%
+ +Table 3: Results on the WMT En-De task. As described in the text, we split the test set in two (odd lines and even lines) to evaluate the model on one-shot learning. Given the even test set, the model can perform better on the odd test set. We also see a dramatic improvement when the model is provided with the whole test set, validating that the memory module is working as intended. + +
ModelFull TestOdd Test
GNMT23.2523.17
GNMT withMemoryModule23.2923.16
GNMTwithMemoryModule andEven Testcontext123.60
GNMT with Memory Module and Whole Test context31.11*1
+ +memory key needs to encode all base-4 symbols from the input. Not just one or two aligned symbols, but a number of them. Moreover, it should not encode more symbols or it will not generalize to the test set. Similarly, a basic nearest neighbor classifier fails on this task. We use sequences of length up to 40 during training, but there are only 7 relevant symbols. The simple nearest neighbor by Hamming distance will most probably select some sequence with similar prefix or suffix of As and Bs, and not the one with the corresponding base-4 part. We also trained a large sequence-tosequence model with attention on this task (a 2-layer LSTM model with 256 units in each layer). This model can memorize the whole training set, but it suffers from a similar problem as the Hamming nearest neighbor – it almost doesn’t generalize, its accuracy on the test set is only about $1 \%$ . The same model with a memory module generalizes much better, reaching over $3 0 \%$ accuracy. The Extended Neural GPU with our memory module yields even better results, see Table 2. + +Translation. To evaluate the memory module in a large-scale setting we use the GNMT model (Wu et al., 2016) extended with our memory module on the WMT14 English-to-German translation task. We evaluate the model both qualitatively and quantitatively. + +On the qualitative side, we note that our memory-augmented model can successfully translate rare words like Dostoevsky, unlike the baseline model which predicts an identity-mapped Dostoevsky for the German translation of Dostoevsky. + +On the quantitative side, we use the WMT test set. We find that in terms of BLEU score, an aggregate measure, the memory-augmented GNMT is on par with the baseline GNMT, see Table 3. + +To evaluate our memory-augmented model for one-shot capabilities we split the test set in two. We take the even lines of the test set (index starting at 0) as a context set and the odd lines of the test set as the one-shot evaluation set. While showing the context set to the model, no additional training occurs, only memory updates are allowed. So the weights of the model do not change, but the memory does. Since the sentences in the test set are highly-correlated to each other (they come from paragraphs with preserved order), we expect that if we allow a one-shot capable model to use the context set to update its memory and then evaluate it on the other half of the test set, its accuracy will increase. For our GNMT with memory model, we passed the context set through the memory update operations 3 times. As seen in Table 3, the context set indeed helps when evaluating on the odd lines, increasing the BLEU score by almost 0.5. As further indication that our memory module works properly, we also evaluate the model after showing the whole test set as a context set. Note that this is essentially an oracle: the memory module gets to see all the correct answers, we do this only to test and debug. As expected, this increases BLEU score dramatically, by over 8 points. + +# 5 DISCUSSION + +We presented a long-term memory module that can be used for life-long learning. It is versatile, so it can be added to different deep learning models and at different layers to give the networks one-shot learning capability. Several parts of the presented memory module could be tuned and studied in more detail. The update rule that averages the query with the correct key could be parametrized. Instead of returning only the single nearest neighbor we could also return a number of them to be processed by other layers of the network. We leave these questions for future research. + +The main issue we encountered, though, is that evaluating one-shot learning is difficult, as standard metrics do not focus on this scenario. In this work, we adapted the standard metrics to investigate our approach. For example, in the translation task we used half of the test set as context for the other half, and we still report the standard BLEU score. This allows us to show that our module works, but it is only a temporary solution. Better metrics are needed to accelerate progress of one-shot and life-long learning. Thus, we consider the present work as just a first step on the way to making deep models learn to remember rare events through their lifetime. + +# REFERENCES + +A. Andoni and P. Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. In 2006 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS’06), pp. 459–468, Oct 2006. doi: 10.1109/FOCS.2006.49. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014. URL http://arxiv.org/ abs/1409.0473. +Antoine Bordes, Nicolas Usunier, Sumit Chopra, and Jason Weston. Large-scale simple question answering with memory networks. CoRR, abs/1506.02075, 2015. URL http://arxiv.org/ abs/1506.02075. +Sarath Chandar, Sungjin Ahn, Hugo Larochelle, Pascal Vincent, Gerald Tesauro, and Yoshua Bengio. Hierarchical memory networks. arXiv preprint arXiv:1605.07427, 2016. +Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. CoRR, abs/1406.1078, 2014. URL http://arxiv.org/abs/1406. 1078. +Li Fei-Fei, Rob Fergus, and Pietro Perona. One-shot learning of object categories. IEEE Trans. Pattern Anal. Mach. Intell., 28(4):594–611, April 2006. ISSN 0162-8828. doi: 10.1109/TPAMI. 2006.79. URL http://dx.doi.org/10.1109/TPAMI.2006.79. +Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. CoRR, abs/1410.5401, 2014. URL http://arxiv.org/abs/1410.5401. +C¸ aglar Gulc¸ehre, Sarath Chandar, Kyunghyun Cho, and Yoshua Bengio. Dynamic neural turing ¨ machine with soft and hard addressing schemes. CoRR, abs/1607.00036, 2016. +Felix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. The goldilocks principle: Reading children’s books with explicit memory representations. CoRR, abs/1511.02301, 2015. +Geoffrey Hinton, Li Deng, Dong Yu, George Dahl, Abdelrahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara Sainath, and Brian Kingsbury. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, 2012. +Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997. +Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: towards removing the curse of dimensionality. In Proceedings of the thirtieth annual ACM symposium on Theory of computing, pp. 604–613. ACM, 1998. + +Łukasz Kaiser and Samy Bengio. Can active memory replace attention? In Advances in Neural Information Processing Systems, (NIPS), 2016. + +Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980. + +Gregory Koch. Siamese neural networks for one-shot image recognition. PhD thesis, University of Toronto, 2015. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton. Imagenet classification with deep convolutional neural network. In Advances in Neural Information Processing Systems, 2012. + +Brenden M Lake, Ruslan Salakhutdinov, Jason Gross, and Joshua B Tenenbaum. One shot learning of simple visual concepts. 2011. + +Manjunath Kudlur Oriol Vinyals, Samy Bengio. Order matters: Sequence to sequence for sets. In International Conference on Learning Representations (ICLR), 2016a. + +Timothy Lillicrap Koray Kavukcuoglu Daan Wierstra Oriol Vinyals, Charles Blundell. Matching networks for one shot learning. CoRR, abs/1606.04080, 2016b. + +Jack W Rae, Jonathan J Hunt, Tim Harley, Ivo Danihelka, Andrew Senior, Greg Wayne, Alex Graves, and Timothy P Lillicrap. Scaling memory-augmented neural networks with sparse reads and writes. In Advances in Neural Information Processing Systems, (NIPS), 2016. + +Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy P. Lillicrap. Oneshot learning with memory-augmented neural networks. CoRR, abs/1605.06065, 2016. + +Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In CVPR, pp. 815–823, 2015. + +Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. Weakly supervised memory networks. CoRR, abs/1503.08895, 2015. URL http://arxiv.org/abs/1503.08895. + +Ilya Sutskever, Oriol Vinyals, and Quoc VV Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems, pp. 3104–3112, 2014. + +Oriol Vinyals, Charles Blundell, Timothy P. Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. CoRR, abs/1606.04080, 2016. + +Kilian Q Weinberger and Lawrence K Saul. Distance metric learning for large margin nearest neighbor classification. Journal of Machine Learning Research, 10(Feb):207–244, 2009. + +Jason Weston, Samy Bengio, and Nicolas Usunier. Wsabie: Scaling up to large vocabulary image annotation. In Proceedings of the International Joint Conference on Artificial Intelligence, IJCAI, 2011. + +Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. CoRR, abs/1410.3916, 2014. URL http://arxiv.org/abs/1410.3916. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Łukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. CoRR, abs/1609.08144, 2016. URL http://arxiv.org/abs/1609.08144. + +Kelvin Xu, Jimmy Lei Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhutdinov, Richard S. Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, 2015. + +Wojciech Zaremba and Ilya Sutskever. Reinforcement learning neural turing machines. CoRR, abs/1505.00521, 2015. URL http://arxiv.org/abs/1505.00521. \ No newline at end of file diff --git a/md/train/SJZAb5cel/SJZAb5cel.md b/md/train/SJZAb5cel/SJZAb5cel.md new file mode 100644 index 0000000000000000000000000000000000000000..a367d8e7ed17c0e7b1fd9ff5f407205cfdb69ae3 --- /dev/null +++ b/md/train/SJZAb5cel/SJZAb5cel.md @@ -0,0 +1,463 @@ +# A JOINT MANY-TASK MODEL: GROWING A NEURAL NETWORK FOR MULTIPLE NLP TASKS + +Kazuma Hashimoto∗, Caiming Xiong†, Yoshimasa Tsuruoka & Richard Socher + +The University of Tokyo +{hassy, tsuruoka}@logos.t.u-tokyo.ac.jp +Salesforce Research +{cxiong, rsocher}@salesforce.com + +# ABSTRACT + +Transfer and multi-task learning have traditionally focused on either a single source-target pair or very few, similar tasks. Ideally, the linguistic levels of morphology, syntax and semantics would benefit each other by being trained in a single model. We introduce such a joint many-task model together with a strategy for successively growing its depth to solve increasingly complex tasks. All layers include shortcut connections to both word representations and lower-level task predictions. We use a simple regularization term to allow for optimizing all model weights to improve one task’s loss without exhibiting catastrophic interference of the other tasks. Our single end-to-end trainable model obtains state-of-the-art results on chunking, dependency parsing, semantic relatedness and textual entailment. It also performs competitively on POS tagging. Our dependency parsing layer relies only on a single feed-forward pass and does not require a beam search. + +# 1 INTRODUCTION + +The potential for leveraging multiple levels of representation has been demonstrated in a variety of ways in the field of Natural Language Processing (NLP). For example, Part-Of-Speech (POS) tags are used to train syntactic parsers. The parsers are used to improve higher-level tasks, such as natural language inference (Chen et al., 2016), relation classification (Socher et al., 2012), sentiment analysis (Socher et al., 2013; Tai et al., 2015), or machine translation (Eriguchi et al., 2016). However, higher level tasks are not usually able to improve lower level tasks, often because systems are pipelines and not trained end-to-end. + +In deep learning, unsupervised word vectors are useful representations and often used to initialize recurrent neural networks for subsequent tasks (Pennington et al., 2014). However, not being jointly trained, deep NLP models have yet shown benefits from predicting many $( > 4 )$ increasingly complex linguistic tasks each at a successively deeper layer. Instead, existing models are often designed to predict different tasks either entirely separately or at the same depth (Collobert et al., 2011), ignoring linguistic hierarchies. + +We introduce a Joint Many-Task (JMT) model, outlined in Fig. 1, which predicts increasingly complex NLP tasks at successively deeper layers. Unlike traditional NLP pipeline systems, our single JMT model can be trained end-to-end for POS tagging, chunking, dependency parsing, semantic relatedness, and textual entailment. We propose an adaptive training and regularization strategy to grow this model in its depth. With the help of this strategy we avoid catastrophic interference between tasks, and instead show that both lower and higher level tasks benefit from the joint training. Our model is influenced by the observation of Søgaard & Goldberg (2016) who showed that predicting two different tasks is more accurate when performed in different layers than in the same layer (Collobert et al., 2011). + +![](images/d1937bd15ed8c9e65e03c4518213132ee1ce985347b4ace3141e5ad96bfe05e0.jpg) +Figure 1: Overview of the joint many-task model predicting different linguistic outputs at successively deeper layers. + +# 2 THE JOINT MANY-TASK MODEL + +In this section, we assume that the model is trained and describe its inference procedure. We begin at the lowest level and work our way to higher layers and more complex tasks. + +# 2.1 WORD REPRESENTATIONS + +For each word $w _ { t }$ in the input sentence $\pmb { s }$ of length $L$ , we construct a representation by concatenating a word and a character embedding. + +Word embeddings: We use Skip-gram (Mikolov et al., 2013) to train a word embedding matrix, which will be shared across all of the tasks. The words which are not included in the vocabulary are mapped to a special UNK token. + +Character $n$ -gram embeddings: Character $n$ -gram embeddings are learned using the same skipgram objective function as the word vectors. We construct the vocabulary of the character $n$ -grams in the training data and assign an embedding for each character $n$ -gram. The final character embedding is the average of the unique character $n$ -gram embeddings of a word $w _ { t }$ .1 For example, the character $n$ -grams $( n = 1 , 2 , 3 )$ ) of the word “Cat” are $\{ \mathbf { C } _ { : }$ , a, t, #BEGIN#C, Ca, at, t#END#, #BEGIN#Ca, Cat, $\mathrm { a t \# E N D \# } \}$ , where “#BEGIN#” and “#END#” represent the beginning and the end of each word, respectively. The use of the character $n$ -gram embeddings efficiently provides morphological features and information about unknown words. The training procedure for the character $n$ -gram embeddings is described in Section 3.1, and for further details, please see Appendix A. Each word is subsequently represented as $x _ { t }$ , the concatenation of its corresponding word and character vectors. + +# 2.2 WORD-LEVEL TASK: POS TAGGING + +The first layer of the model is a bi-directional LSTM (Graves & Schmidhuber, 2005; Hochreiter & Schmidhuber, 1997) whose hidden states are used to predict POS tags. We use the following Long Short-Term Memory (LSTM) units for the forward direction: + +$$ +\begin{array} { r l r l } & { i _ { t } = \sigma \left( W _ { i } g _ { t } + b _ { i } \right) , } & { f _ { t } = \sigma \left( W _ { f } g _ { t } + b _ { f } \right) , } & { \quad o _ { t } = \sigma \left( W _ { o } g _ { t } + b _ { o } \right) , } \\ & { u _ { t } = \operatorname { t a n h } \left( W _ { u } g _ { t } + b _ { u } \right) , } & { c _ { t } = i _ { t } \odot u _ { t } + f _ { t } \odot c _ { t - 1 } , } & { \quad h _ { t } = o _ { t } \odot \operatorname { t a n h } \left( c _ { t } \right) , } \end{array} +$$ + +![](images/5b84c649e8997fb6b719fb3bab8fe765e967c612716f565a30e399763deaf261.jpg) +Figure 2: Overview of the POS tagging and chunking tasks in the first and second layers of the JMT model. + +where we define the input $g _ { t }$ as $g _ { t } = [ \overrightarrow { h } _ { t - 1 } ; x _ { t } ]$ , i.e. the concatenation of the previous hidden state and the word representation of $w _ { t }$ . The backward pass is expanded in the same way, but a different set of weights are used. + +For predicting the POS tag of $w _ { t }$ , we use the concatenation of the forward and backward states in a one-layer bi-LSTM layer corresponding to the $t { \cdot }$ -th word: $h _ { t } = [ \overrightarrow { h } _ { t } ; \overleftarrow { h } _ { t } ]$ . Then each $h _ { t }$ $( 1 \leq t \leq L )$ ) is fed into a standard softmax classifier with a single ReLU layer which outputs the probability vector $y ^ { ( 1 ) }$ for each of the POS tags. + +# 2.3 WORD-LEVEL TASK: CHUNKING + +Chunking is also a word-level classification task which assigns a chunking tag (B-NP, I-VP, etc.) for each word. The tag specifies the region of major phrases (or chunks) in the sentence. + +bi-LSTM layers, we use Eq. (1) with input state of the first (POS) layer. We define the $g _ { t } ^ { ( 2 ) } = [ h _ { t - 1 } ^ { ( 2 ) } ; h _ { t } ^ { \bar { ( 1 ) } } ; x _ { t } ; y _ { t } ^ { ( p o s ) } ]$ here as f $h _ { t } ^ { ( 1 ) }$ is the hiddens: $y _ { t } ^ { ( p o s ) }$ + +$$ +y _ { t } ^ { ( p o s ) } = \sum _ { j = 1 } ^ { C } p ( y _ { t } ^ { ( 1 ) } = j | h _ { t } ^ { ( 1 ) } ) \ell ( j ) , +$$ + +where $C$ is the number of the POS tags, $p ( y _ { t } ^ { ( 1 ) } = j | h _ { t } ^ { ( 1 ) } )$ is the probability value that the $j$ -th POS tag is assigned to $w _ { t }$ , and $\ell ( j )$ is the corresponding label embedding. The probability values are automatically predicted by the POS layer working like a built-in POS tagger, and thus no gold POS tags are needed. This output embedding can be regarded as a similar feature to the $K$ -best POS tag feature which has been shown to be effective in syntactic tasks (Andor et al., 2016; Alberti et al., 2015). For predicting the chunking tags, we employ the same strategy as POS tagging by using the concatenated bi-directional hidden states $h _ { t } ^ { ( 2 ) } = [ \breve { \vec { h } } _ { t } ^ { ( 2 ) } ; \breve { \vec { h } } _ { t } ^ { ( 2 ) } ]$ in the chunking layer. We also use a single ReLU hidden layer before the classifier. + +# 2.4 SYNTACTIC TASK: DEPENDENCY PARSING + +Dependency parsing identifies syntactic relationships (such as an adjective modifying a noun) between pairs of words in a sentence. We use the third bi-LSTM layer on top of the POS and chunking layers to classify relationships between all pairs of words. The input vector for the LSTM includes hidden states, word representations, and the label embeddings for the two previous tasks: $g _ { t } ^ { ( 3 ) } \ = \ [ h _ { t - 1 } ^ { ( 3 ) } ; h _ { t } ^ { ( 2 ) } ; x _ { t } ; ( y _ { t } ^ { ( p o s ) } \ ^ { \cdot } + y _ { t } ^ { ( c h k ) } ) ]$ y(chk)t )], where we computed the chunking vector in a similar fashion as the POS vector in Eq. (2). The POS and chunking tags are commonly used to improve dependency parsing (Attardi $\&$ DellOrletta, 2008). + +Like a sequential labeling task, we simply predict the parent node (head) for each word in the sentence. Then a dependency label is predicted for each of the child-parent node pairs. To predict the parent node of the $t$ -th word $w _ { t }$ , we define a matching function between $w _ { t }$ and the candidates of the parent node as $m \left( t , j \right) = h _ { t } ^ { \left( 3 \right) ^ { \mathrm { T } } } W _ { d } h _ { j } ^ { \left( 3 \right) }$ , where $W _ { d }$ is a parameter matrix. For the root, we define h(3)L+1 $h _ { L + 1 } ^ { ( 3 ) } = r$ as a parameterized vector. To compute the probability that $w _ { j }$ (or the root node) is the parent of $w _ { t }$ , the scores are normalized: + +![](images/017aa1d8517923abfcc03166b38d5325de982d2e585db41bfdc6851acfee4adc.jpg) +Figure 3: Overview of dependency parsing in the third layer of the JMT model. + +![](images/fb922e2d2edd26f61723e05a05327862c1f02fff65ac4e78691da8648f045330.jpg) +Figure 4: Overview of the semantic tasks in the top layers of the JMT model. + +$$ +p ( j | h _ { t } ^ { ( 3 ) } ) = \frac { \exp { \left( m \left( t , j \right) \right) } } { \sum _ { k = 1 , k \neq t } ^ { L + 1 } \exp { \left( m \left( t , k \right) \right) } } , +$$ + +where $L$ is the sentence length. + +Next, the dependency labels are predicted using $[ h _ { t } ^ { ( 3 ) } ; h _ { j } ^ { ( 3 ) } ]$ as input to a standard softmax classifier with a single ReLU layer. At test time, we greedily select the parent node and the dependency label for each word in the sentence.2 At training time, we use the gold child-parent pairs to train the label predictor. + +# 2.5 SEMANTIC TASK: SEMANTIC RELATEDNESS + +The next two tasks model the semantic relationships between two input sentences. The first task measures the semantic relatedness between two sentences. The output is a real-valued relatedness score for the input sentence pair. The second task is a textual entailment task, which requires one to determine whether a premise sentence entails a hypothesis sentence. There are typically three classes: entailment, contradiction, and neutral. + +The two semantic tasks are closely related to each other. If the semantic relatedness between two sentences is very low, they are unlikely to entail each other. Based on this intuition and to make use of the information from lower layers, we use the fourth and fifth bi-LSTM layer for the relatedness and entailment task, respectively. + +Now it is required to obtain the sentence-level representation rather than the word-level representation $h _ { t } ^ { ( 4 ) }$ used in the first three tasks. We compute the sentence-level representation $h _ { \mathbf { s } } ^ { ( 4 ) }$ as the element-wise maximum values across all of the word-level representations in the fourth layer: + +$$ +h _ { \mathbf { s } } ^ { ( 4 ) } = \operatorname* { m a x } \left( h _ { 1 } ^ { ( 4 ) } , h _ { 2 } ^ { ( 4 ) } , \dots , h _ { L } ^ { ( 4 ) } \right) . +$$ + +To model the semantic relatedness between $s$ and $s ^ { \prime }$ , we follow Tai et al. (2015). The feature vector for representing the semantic relatedness is computed as follows: + +$$ +d _ { 1 } ( s , s ^ { \prime } ) = \left[ \left| h _ { \mathbf { s } } ^ { ( 4 ) } - h _ { \mathbf { s } ^ { \prime } } ^ { ( 4 ) } \right| ; h _ { \mathbf { s } } ^ { ( 4 ) } \odot h _ { \mathbf { s } ^ { \prime } } ^ { ( 4 ) } \right] , +$$ + +where $\left| h _ { \mathbf { s } } ^ { ( 4 ) } - h _ { \mathbf { s } ^ { \prime } } ^ { ( 4 ) } \right|$ is the absolute values of the element-wise subtraction, and $h _ { \mathbf { s } } ^ { ( 4 ) } \odot h _ { \mathbf { s } ^ { \prime } } ^ { ( 4 ) }$ is the element-wise multiplication. Both of them can be regarded as two different similarity metrics of the two vectors. Then $d _ { 1 } ( s , s ^ { \prime } )$ is fed into a softmax classifier with a single Maxout hidden layer (Goodfellow et al., 2013) to output a relatedness score (from 1 to 5 in our case) for the sentence pair. + +# 2.6 SEMANTIC TASK: TEXTUAL ENTAILMENT + +For entailment classification between two sentences, we also use the max-pooling technique as in the semantic relatedness task. To classify the premise-hypothesis pair $( s , s ^ { \prime } )$ into one of the three classes, we compute the feature vector $d _ { 2 } ( s , s ^ { \prime } )$ as in Eq. (5) except that we do not use the absolute values of the element-wise subtraction, because we need to identify which is the premise (or hypothesis). Then $d _ { 2 } ( s , s ^ { \prime } )$ is fed into a standard softmax classifier. + +To make use of the output from the relatedness layer directly, we use the label embeddings for the relatedness task. More concretely, we compute the class label embeddings for the semantic relatedness task similar to Eq. (2). The final feature vectors that are concatenated and fed into the entailment classifier are the weighted relatedness label embedding and the feature vector $d _ { 2 } ( s , s ^ { \prime } )$ . 3 We use three Maxout hidden layers before the classifier. + +# 3 TRAINING THE JMT MODEL + +The model is trained jointly over all datasets. During each epoch, the optimization iterates over each full training dataset in the same order as the corresponding tasks described in the modeling section. + +# 3.1 PRE-TRAINING WORD REPRESENTATIONS + +We pre-train word embeddings using the Skip-gram model with negative sampling (Mikolov et al., 2013). We also pre-train the character $n$ -gram embeddings using Skip-gram. The only difference is that each input word embedding in the Skip-gram model is replaced with its corresponding average embedding of the character $n$ -gram embeddings described in Section 2.1. These embeddings are fine-tuned during the training of our JMT model. We denote the embedding parameters as $\theta _ { e }$ . + +# 3.2 TRAINING THE POS LAYER + +Let $\theta _ { \mathrm { P O S } } = ( W _ { \mathrm { P O S } } , b _ { \mathrm { P O S } } , \theta _ { e } )$ denote the set of model parameters associated with the POS layer, where $W _ { \mathrm { P O S } }$ is the set of the weight matrices in the first bi-LSTM and the classifier, and $b _ { \mathrm { P O S } }$ is the set of the bias vectors. The objective function to optimize $\theta _ { \mathrm { P O S } }$ is defined as follows: + +$$ +J _ { 1 } ( \theta _ { \mathrm { P O S } } ) = - \sum _ { s } \sum _ { t } \log p \left( y _ { t } ^ { ( 1 ) } = \alpha | h _ { t } ^ { ( 1 ) } \right) + \lambda \| W _ { \mathrm { P O S } } \| ^ { 2 } + \delta \| \theta _ { e } - \theta _ { e } ^ { \prime } \| ^ { 2 } , +$$ + +where $p ( y _ { t } ^ { ( 1 ) } = \alpha _ { w _ { t } } | h _ { t } ^ { ( 1 ) } )$ is the probability value that the correct label $\alpha$ is assigned to $w _ { t }$ in the sentence s, $\lambda \| W _ { \mathrm { P O S } } \| ^ { 2 }$ is the L2-norm regularization term, and $\lambda$ is a hyperparameter. + +We call the second regularization term $\delta \| \theta _ { e } - \theta _ { e } ^ { \prime } \| ^ { 2 }$ a successive regularization term. The successive regularization is based on the idea that we do not want the model to forget the information learned for the other tasks. In the case of POS tagging, the regularization is applied to $\theta _ { e }$ , and $\theta _ { e } ^ { \prime }$ is the embedding parameter after training the final task in the top-most layer at the previous training epoch. $\delta$ is a hyperparameter. + +# 3.3 TRAINING THE CHUNKING LAYER + +The objective function is defined as follows: + +$$ +J _ { 2 } ( \theta _ { \mathrm { c h k } } ) = - \sum _ { s } \sum _ { t } \log p ( y _ { t } ^ { ( 2 ) } = \alpha | h _ { t } ^ { ( 2 ) } ) d + \lambda \| W _ { \mathrm { c h k } } \| ^ { 2 } + \delta \| \theta _ { \mathrm { P O S } } - \theta _ { \mathrm { P O S } } ^ { \prime } \| ^ { 2 } , +$$ + +which is similar to that of POS tagging, and $\theta _ { \mathrm { c h k } }$ is $( W _ { \mathrm { c h k } } , b _ { \mathrm { c h k } } , E _ { \mathrm { P O S } } , \theta _ { e } )$ , where $W _ { \mathrm { c h k } }$ and $b _ { \mathrm { c h k } }$ are the weight and bias parameters including those in $\theta _ { \mathrm { P O S } }$ , and $E _ { \mathrm { P O S } }$ is the set of the POS label embeddings. $\theta _ { \mathrm { P O S } } ^ { \prime }$ is the one after training the POS layer at the current training epoch. + +# 3.4 TRAINING THE DEPENDENCY LAYER + +The objective function is defined as follows: + +$$ +J _ { 3 } ( \theta _ { \mathrm { d e p } } ) = - \sum _ { s } \sum _ { t } \log p ( \alpha | h _ { t } ^ { ( 3 ) } ) p ( \beta | h _ { t } ^ { ( 3 ) } , h _ { \alpha } ^ { ( 3 ) } ) + \lambda ( \| W _ { \mathrm { d e p } } \| ^ { 2 } + \| W _ { d } \| ^ { 2 } ) + \delta \| \theta _ { \mathrm { c h k } } - \theta _ { \mathrm { c h k } } ^ { \prime } \| ^ { 2 } , +$$ + +where $p ( \alpha | h _ { t } ^ { ( 3 ) } )$ is the probability value assigned to the correct parent node $\alpha$ for $w _ { t }$ , and $p ( \beta | h _ { t } ^ { ( 3 ) } , h _ { \alpha } ^ { ( 3 ) } )$ is the probability value assigned to the correct dependency label $\beta$ for the childparent pair $( w _ { t } , \alpha )$ . $\theta _ { \mathrm { d e p } }$ is defined as $( W _ { \mathrm { d e p } } , b _ { \mathrm { d e p } } , W _ { d } , r , E _ { \mathrm { P O S } } , E _ { \mathrm { c h k } } , \theta _ { e } )$ , where $W _ { \mathrm { d e p } }$ and $\boldsymbol { b } _ { \mathrm { d e p } }$ are the weight and bias parameters including those in $\theta _ { \mathrm { c h k } }$ , and $E _ { \mathrm { c h k } }$ is the set of the chunking label embeddings. + +# 3.5 TRAINING THE RELATEDNESS LAYER + +Following Tai et al. (2015), the objective function is defined as follows: + +$$ +J _ { 4 } ( \theta _ { \mathrm { r e l } } ) = \sum _ { ( s , s ^ { \prime } ) } \mathrm { K L } \left( \hat { p } ( s , s ^ { \prime } ) \Big | \Big | p ( h _ { s } ^ { ( 4 ) } , h _ { s ^ { \prime } } ^ { ( 4 ) } ) \right) + \lambda \| W _ { \mathrm { r e l } } \| ^ { 2 } + \delta \| \theta _ { \mathrm { d e p } } - \theta _ { \mathrm { d e p } } ^ { \prime } \| ^ { 2 } , +$$ + +where $\hat { p } ( s , s ^ { \prime } )$ is the gold distribution over the defined relatedness scores, $p ( h _ { s } ^ { ( 4 ) } , h _ { s ^ { \prime } } ^ { ( 4 ) } )$ is the predicted distribution given the the sentence representations, and $\begin{array} { r } { \mathrm { K L } \left( \hat { p } ( s , s ^ { \prime } ) \Big | \Big | p ( h _ { s } ^ { ( 4 ) } , h _ { s ^ { \prime } } ^ { ( 4 ) } ) \right) } \end{array}$ is the KL-divergence between the two distributions. $\theta _ { \mathrm { r e l } }$ is defined as $( W _ { \mathrm { r e l } } , b _ { \mathrm { r e l } } , E _ { \mathrm { P O S } } , E _ { \mathrm { c h k } } , \theta _ { e } )$ . + +# 3.6 TRAINING THE ENTAILMENT LAYER + +The objective function is defined as follows: + +$$ +J _ { 5 } ( \theta _ { \mathrm { e n t } } ) = - \sum _ { ( s , s ^ { \prime } ) } \log p ( y _ { ( s , s ^ { \prime } ) } ^ { ( 5 ) } = \alpha | h _ { s } ^ { ( 5 ) } , h _ { s ^ { \prime } } ^ { ( 5 ) } ) + \lambda \| W _ { \mathrm { e n t } } \| ^ { 2 } + \delta \| \theta _ { \mathrm { r e l } } - \theta _ { \mathrm { r e l } } ^ { \prime } \| ^ { 2 } , +$$ + +where $p ( y _ { ( s , s ^ { \prime } ) } ^ { ( 5 ) } = \alpha | h _ { s } ^ { ( 5 ) } , h _ { s ^ { \prime } } ^ { ( 5 ) } )$ is the probability value that the correct label $\alpha$ is assigned to the premise-hypothesis pair $( s , s ^ { \prime } )$ . $\theta _ { \mathrm { e n t } }$ is defined as $( W _ { \mathrm { e n t } } , b _ { \mathrm { e n t } } , E _ { \mathrm { P O S } } , E _ { \mathrm { c h k } } , E _ { \mathrm { r e l } } , \theta _ { e } )$ , where $E _ { \mathrm { r e l } }$ is the set of the relatedness label embeddings. + +# 4 RELATED WORK + +Many deep learning approaches have proven to be effective in a variety of NLP tasks and are becoming more and more complex. They are typically designed to handle single tasks, or some of them are designed as general-purpose models (Kumar et al., 2016; Sutskever et al., 2014) but applied to different tasks independently. + +For handling multiple NLP tasks, multi-task learning models with deep neural networks have been proposed (Collobert et al., 2011; Luong et al., 2016), and more recently Søgaard & Goldberg (2016) have suggested that using different layers for different tasks is more effective than using the same layer in jointly learning closely-related tasks, such as POS tagging and chunking. However, the number of tasks was limited or they have very similar task settings like word-level tagging, and it was not clear how lower-level tasks could be also improved by combining higher-level tasks. + +In the field of computer vision, some transfer and multi-task learning approaches have also been proposed (Li & Hoiem, 2016; Misra et al., 2016). For example, Misra et al. (2016) proposed a multi-task learning model to handle different tasks. However, they assume that each data sample has annotations for the different tasks, and do not explicitly consider task hierarchies. + +Recently, Rusu et al. (2016) have proposed a progressive neural network model to handle multiple reinforcement learning tasks, such as Atari games. Like our JMT model, their model is also successively trained according to different tasks using different layers called columns in their paper. In their model, once the first task is completed, the model parameters for the first task are fixed, and then the second task is handled by adding new model parameters. Therefore, accuracy of the previously trained tasks is never improved. In NLP tasks, multi-task learning has the potential to improve not only higher-level tasks, but also lower-level tasks. Rather than fixing the pre-trained model parameters, our successive regularization allows our model to continuously train the lower-level tasks without significant accuracy drops. + +# 5 EXPERIMENTAL SETTINGS + +# 5.1 DATASETS + +POS tagging: To train the POS tagging layer, we used the Wall Street Journal (WSJ) portion of Penn Treebank, and followed the standard split for the training (Section 0-18), development (Section 19- 21), and test (Section 22-24) sets. The evaluation metric is the word-level accuracy. + +Chunking: For chunking, we also used the WSJ corpus, and followed the standard split for the training (Section 15-18) and test (Section 20) sets as in the CoNLL 2000 shared task. We used Section 19 as the development set, following Søgaard & Goldberg (2016), and employed the IOBES tagging scheme. The evaluation metric is the F1 score defined in the shared task. + +Dependency parsing: We also used the WSJ corpus for dependency parsing, and followed the standard split for the training (Section 2-21), development (Section 22), and test (Section 23) sets. We converted the treebank data to Stanford style dependencies using the version 3.3.0 of the Stanford converter. The evaluation metrics are the Unlabeled Attachment Score (UAS) and the Labeled Attachment Score (LAS), and punctuations are excluded for the evaluation. + +Semantic relatedness: For the semantic relatedness task, we used the SICK dataset (Marelli et al., 2014), and followed the standard split for the training (SICK train.txt), development (SICK trial.txt), and test (SICK test annotated.txt) sets. The evaluation metric is the Mean Squared Error (MSE) between the gold and predicted scores. + +Textual entailment: For textual entailment, we also used the SICK dataset and exactly the same data split as the semantic relatedness dataset. The evaluation metric is the accuracy. + +# 5.2 TRAINING DETAILS + +Pre-training embeddings: We used the word2vec toolkit to pre-train the word embeddings. We created our training corpus by selecting lowercased English Wikipedia text and obtained 100- dimensional Skip-gram word embeddings trained with the context window size 1, the negative sampling method (15 negative samples), and the sub-sampling method ( $1 0 ^ { - 5 }$ of the sub-sampling coefficient).4 We also pre-trained the character $n$ -gram embeddings using the same parameter settings with the case-sensitive Wikipedia text. We trained the character $n$ -gram embeddings for $n = 1 , 2 , 3 , 4$ in the pre-training step. + +Embedding initialization: We used the pre-trained word embeddings to initialize the word embeddings, and the word vocabulary was built based on the training data of the five tasks. All words in the training data were included in the word vocabulary, and we employed the word-dropout method (Kiperwasser & Goldberg, 2016) to train the word embedding for the unknown words. We also built the character $n$ -gram vocabulary for $n = 2 , 3 , 4$ , following Wieting et al. (2016), and the character $n$ -gram embeddings were initialized with the pre-trained embeddings. All of the label embeddings were initialized with uniform random values in $[ - \sqrt { 6 / ( d i m + C ) } , \sqrt { 6 / ( d i m + C ) } ]$ , where $d i m = 1 0 0$ is the dimensionality of the label embeddings and $C$ is the number of labels. + +Weight initialization: The dimensionality of the hidden layers in the bi-LSTMs was set to 100. We initialized all of the softmax parameters and bias vectors, except for the forget biases in the LSTMs, with zeros, and the weight matrix $W _ { d }$ and the root node vector $r$ for dependency parsing were also initialized with zeros. All of the forget biases were initialized with ones. The other weight matrices were initialized with uniform random values in $[ - \sqrt { 6 / ( r o w + c o l ) }$ , $\sqrt { 6 / ( r o w + c o l ) } ]$ , where row and col are the number of rows and columns of the matrices, respectively. + +Optimization: At each epoch, we trained our model in the order of POS tagging, chunking, dependency parsing, semantic relatedness, and textual entailment. We used mini-batch stochastic gradient decent to train our model. The mini-batch size was set to 25 for POS tagging, chunking, and the SICK tasks, and 15 for dependency parsing. We used a gradient clipping strategy with growing clipping values for the different tasks; concretely, we employed the simple function: $\operatorname* { m i n } ( 3 . 0 , d e p t h )$ , where depth is the number of bi-LSTM layers involved in each task, and 3.0 is the maximum value. The learning rate at the $k$ -th epoch was set to $\frac { \varepsilon } { 1 . 0 + \rho ( k - 1 ) }$ , where $\varepsilon$ is the initial learning rate, and $\rho$ is the hyperparameter to decrease the learning rate. We set $\varepsilon$ to 1.0 and $\rho$ to 0.3. At each epoch, the same learning rate was shared across all of the tasks. + +Regularization: We set the regularization coefficient to $1 0 ^ { - 6 }$ for the LSTM weight matrices, $1 0 ^ { - 5 }$ for the weight matrices in the classifiers, and $1 0 ^ { - 3 }$ for the successive regularization term excluding the classifier parameters of the lower-level tasks, respectively. The successive regularization coefficient for the classifier parameters was set to $1 0 ^ { - 2 }$ . We also used dropout (Hinton et al., 2012). The dropout rate was set to 0.2 for the vertical connections in the multi-layer bi-LSTMs (Pham et al., 2014), the word representations and the label embeddings of the entailment layer, and the classifier of the POS tagging, chunking, dependency parsing, and entailment. A different dropout rate of 0.4 was used for the word representations and the label embeddings of the POS, chunking, and dependency layers, and the classifier of the relatedness layer. + +# 6 RESULTS AND DISCUSSION + +# 6.1 SUMMARY OF MULTI-TASK RESULTS + +Table 1 shows our results of the test sets on the five different tasks.5 The column “Single” shows the results of handling each task separately using single-layer bi-LSTMs, and the column $\mathrm { ^ { 6 6 } J M T _ { \mathrm { a l l } } }$ ” shows the results of our JMT model. The single task settings only use the annotations of their own tasks. For example, when treating dependency parsing as a single task, the POS and chunking tags are not used. We can see that all results of the five different tasks are improved in our JMT model, which shows that our JMT model can handle the five different tasks in a single model. Our JMT model allows us to access arbitrary information learned from the different tasks. If we want to use the model just as a POS tagger, we can use the output from the first bi-LSTM layer. The output can be the weighted POS label embeddings as well as the discrete POS tags. + +Table 1 also shows the results of three subsets of the different tasks. For example, in the case of “JMTABC”, only the first three layers of the bi-LSTMs are used to handle the three tasks. In the case of $\mathbf { \hat { \mu } } ^ { \mathrm { 6 6 } } \mathbf { J } \mathbf { M } \mathbf { T } _ { \mathrm { D E } } ,$ ”, only the top two layers are used just as a two-layer bi-LSTM by omitting all information from the first three layers. The results of the closely-related tasks show that our JMT model improves not only the high-level tasks, but also the low-level tasks. + +Table 1: Test set results for the five tasks. In the relatedness task, the lower scores are better. + +
SingleJMTallJMTABJMTABCJMTDE
APOS97.4597.5597.5297.54n/a
BChunking95.02(97.12)95.77(97.28)n/a
CDependency UAS93.3594.67n/a94.71n/a
DDependency LAS Relatedness91.42 0.24792.90 0.233n/a n/a92.92n/a
E81.886.2n/a0.238
Entailmentn/an/a86.8
+ +Table 2: POS tagging results. + +
MethodAcc.
JMTall97.55
Ling et al. (2015) Kumar et al. (2016) Ma & Hovy (2016) Sogaard (2011)97.78 97.56 97.55 97.50
+ +Table 3: Chunking results. + +
MethodF1
JMTAB95.77
Spgaard&Goldberg (2016) Suzuki & Isozaki (2008)95.56
Collobert et al. (2011)95.15 94.32
Kudo & Matsumoto (2001) Tsuruoka et al. (2011)93.91 93.81
+ +Table 4: Dependency results. + +
MethodUASLAS
JMTall Single94.67 93.3592.90 91.42
Andor et al. (2016) Alberti et al. (2015) Weiss et al. (2015) Dyer et al. (2015) Bohnet (2010)94.61 94.23 93.99 93.10 92.8892.79 92.36 92.05 90.90 90.71
+ +Table 5: Semantic relatedness results. + +
MethodMSE
JMTallJMTDE0.2330.238
Zhou et al. (2016)Tai et al. (2015)0.2430.253
+ +Table 6: Textual entailment results. + +
MethodAcc.
JMTall86.2
JMTDE86.8
Yin et al. (2016)86.2
Lai&Hockenmaier (2014)84.6
+ +# 6.2 COMPARISON WITH PUBLISHED RESULTS + +POS tagging: Table 2 shows the results of POS tagging, and our JMT model achieves the score close to the state-of-the-art results. The best result to date has been achieved by Ling et al. (2015), which uses character-based LSTMs. Incorporating the character-based encoders into our JMT model would be an interesting direction, but we have shown that the simple pre-trained character $n$ -gram embeddings lead to the promising result. + +Chunking: Table 3 shows the results of chunking, and our JMT model achieves the state-of-the-art result. Søgaard & Goldberg (2016) proposed to jointly learn POS tagging and chunking in different layers, but they only showed improvement for chunking. By contrast, our results show that the low-level tasks are also improved by the joint learning. + +Dependency parsing: Table 4 shows the results of dependency parsing by using only the WSJ corpus in terms of the dependency annotations, and our JMT model achieves the state-of-the-art result.6 It is notable that our simple greedy dependency parser outperforms the previous state-ofthe-art result which is based on beam search with global information. The result suggests that the bi-LSTMs efficiently capture global information necessary for dependency parsing. Moreover, our single task result already achieves high accuracy without the POS and chunking information. Further analysis on our dependency parser can be found in Appendix B. + +Semantic relatedness: Table 5 shows the results of the semantic relatedness task, and our JMT model achieves the state-of-the-art result. The result of “JMTDE” is already better than the previous state-of-the-art results. Both of Zhou et al. (2016) and Tai et al. (2015) explicitly used syntactic tree structures, and Zhou et al. (2016) relied on attention mechanisms. However, our method uses the simple max-pooling strategy, which suggests that it is worth investigating such simple methods before developing complex methods for simple tasks. Currently, our JMT model does not explicitly use the learned dependency structures, and thus the explicit use of the output from the dependency layer should be an interesting direction of future work. + +Textual entailment: Table 6 shows the results of textual entailment, and our JMT model achieves the state-of-the-art result.7 The previous state-of-the-art result in Yin et al. (2016) relied on attention mechanisms and dataset-specific data pre-processing and features. Again, our simple max-pooling strategy achieves the state-of-the-art result boosted by the joint training. These results show the importance of jointly handling related tasks. Error analysis can be found in Appendix C. + +# 6.3 ANALYSIS ON MULTI-TASK LEARNING ARCHITECTURES + +Here, we first investigate the effects of using deeper layers for the five different single tasks. We then show the effectiveness of our training strategy: the successive regularization, the shortcut connections of the word representations, the embeddings of the output labels, the character $n$ -gram embeddings, the use of the different layers for the different tasks, and the vertical connections of multi-layer bi-LSTMs. All of the results shown in this section are the development set results. + +- Depth: The single task settings shown in Table 1 are obtained by using single layer bi-LSTMs, but in our JMT model, the higher-level tasks use successively deeper layers. To investigate the gap between the different number of the layers for each task, we also show the results of using multi-layer bi-LSTMs for the single task settings, in the column of “Single+” in Table 7. More concretely, we use the same number of the layers with our JMT model; for example, three layers are used for dependency parsing, and five layers are used for textual entailment. As shown in these results, deeper layers do not always lead to better results, nd the joint learning is more important than making the models complex only for single tasks. + +Table 7: Effects of depth for the single task settings. + +
Single Single+
POS97.52
Chunking95.6596.08
Dependency UAS93.3893.88
Dependency LAS91.3791.83
Relatedness0.2390.665
Entailment83.866.4
+ +- Successive regularization: In Table 8, the column of “w/o SR” shows the results of omitting the successive regularization terms described in Section 3. We can see that the accuracy of chunking is improved by the successive regularization, while other results are not affected so much. The chunking dataset used here is relatively small compared with other low-level tasks, POS tagging and dependency parsing. Thus, these results suggest that the successive regularization is effective when dataset sizes are imbalanced. + +Table 8: Effectiveness of the Successive Regularization (SR). + +
JMTallw/o SR
POS97.8897.85
Chunking97.5997.13
Dependency UASDependency LAS94.5192.6094.4692.57
Relatedness0.2360.239
Entailment84.684.2
+ +- Shortcut connections: Our JMT model feeds the word representations into all of the bi-LSTM layers, which is called the shortcut connection. Table 9 shows the results of $\mathrm { ^ { 6 6 } J M T _ { \mathrm { 2 1 1 } } } ^ { \prime \mathrm { 3 } }$ with and without the shortcut connections. The results without the shortcut connections are shown in the column of “w/o SC”. These results clearly show that the importance of the shortcut connections in our JMT model, and in particular, the semantic tasks in the higher layers strongly rely on the shortcut connections. That is, simply stacking the LSTM layers is not sufficient to handle a variety of NLP tasks in a single model. In Appendix D, we show how the shared word representations change according to each task (or layer). + +Table 9: Effectiveness of the Shortcut Connections (SC). + +
JMTallw/o SC
POS97.8897.79
Chunking97.5997.08
Dependency UASDependency LAS94.5192.6094.5292.62
Relatedness0.2360.698
Entailment84.675.0
+ +- Output label embeddings: Table 10 shows the results without using the output labels of the POS, chunking, and relatedness layers, in the column of “w/o LE”. These results show that the explicit use of the output information from the classifiers of the lower layers is important in our JMT model. The results in the column of “w/o SC&LE” are the ones without both of the shortcut connections and the label embeddings. + +Table 10: Effectiveness of the Label Embeddings (LE). + +
JMTallW/o LEw/o SC&LE
POS97.8897.8597.87
Chunking97.5997.4097.33
Dependency UASDependency LAS94.5192.6094.0992.1494.0492.03
Relatedness0.2360.2610.765
Entailment84.681.671.2
+ +- Character $n$ -gram embeddings: Table 11 shows the results for the three single tasks, POS tagging, chunking, and dependency parsing, with and without the pre-trained character $n$ -gram embeddings. The column of “W&C” corresponds to using both of the word and character $n$ -gram embeddings, and that of “Only W” corresponds to using only the word embeddings. These results clearly show that jointly using the pre-trained word and character $n$ -gram embeddings is helpful in improving the results. + +Table 11: Effectiveness of the character $n$ -gram embeddings. + +
SingleW&COnlyW
POS97.5296.26
Chunking95.6594.92
Dependency UASDependency LAS93.3891.3792.9090.44
+ +The pre-training of the character $n$ -gram embeddings is also effective; for example, without the pre-training, the POS accuracy drops from $9 7 . 5 2 \%$ to $9 7 . 3 8 \%$ and the chunking accuracy drops from $9 5 . 6 5 \%$ to $9 5 . 1 4 \%$ , but they are still better than those of using word2vec embeddings alone. Further analysis can be found in Appendix A. + +- Different layers for different tasks: Table 12 shows the results for the three tasks of our “JMTABC” setting and that of not using the shortcut connections and the label embeddings as in Table 10. In addition, in the column of “All-3”, we show the results of using the highest (i.e., the third) layer for all of the three tasks without any shortcut connections and label embeddings, and thus the two settings “w/o SC&LE” and “All- $_ { 3 } { \vec { \mathbf { \sigma } } }$ require exactly the same number of the model parameters. The results show that using the same layers for the three different tasks hampers the effectiveness of our JMT model, and the design of the model is much more important than the number of the model parameters. + +Table 12: Effectiveness of using different layers for different tasks. + +
JMTABCw/o SC&LEAll-3
POS97.9097.8797.62
Chunking97.8097.4196.52
Dependency UAS94.5294.1393.59
Dependency LAS92.6192.1691.47
+ +- Vertical connections: Finally, we investigated our JMT results without using the vertical connections in the five-layer bi-LSTMs. More concretely, when constructing the input vectors $g _ { t }$ , we do not use the bi-LSTM hidden states of the previous layers. Table 13 shows the $\mathbf { J M T } _ { \mathrm { a l l } }$ results with and without the vertical connections. As shown in the column of “w/o VC”, we observed the competitive results. Therefore, in the target tasks used in our model, sharing the word representations and the output label embeddings is more effective than just stacking the bi-LSTM layers. + +Table 13: Effectiveness of the Vertical Connections (VC). + +
JMTallw/o VC
POS97.8897.82
Chunking97.5997.45
Dependency UASDependency LAS94.5192.6094.3892.48
Relatedness0.2360.241
Entailment84.684.8
+ +# 7 CONCLUSION + +We presented a joint many-task model to handle a variety of NLP tasks with growing depth of layers in a single end-to-end deep model. Our model is successively trained by considering linguistic hierarchies, directly connecting word representations to all layers, explicitly using predictions in lower tasks, and applying successive regularization. In our experiments on five different types of NLP tasks, our single model achieves the state-of-the-art results on chunking, dependency parsing, semantic relatedness, and textual entailment. + +# ACKNOWLEDGMENTS + +We thank the Salesforce Research team members for their fruitful comments and discussions. + +# REFERENCES + +Chris Alberti, David Weiss, Greg Coppola, and Slav Petrov. Improved Transition-Based Parsing and Tagging with Neural Networks. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1354–1359, 2015. + +Daniel Andor, Chris Alberti, David Weiss, Aliaksei Severyn, Alessandro Presta, Kuzman Ganchev, Slav Petrov, and Michael Collins. Globally Normalized Transition-Based Neural Networks. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2442–2452, 2016. + +Giuseppe Attardi and Felice DellOrletta. Chunking and Dependency Parsing. In Proceedings of LREC 2008 Workshop on Partial Parsing, 2008. + +Bernd Bohnet. Top Accuracy and Fast Dependency Parsing is not a Contradiction. In Proceedings of the 23rd International Conference on Computational Linguistics, pp. 89–97, 2010. + +Qian Chen, Xiaodan Zhu, Zhenhua Ling, Si Wei, and Hui Jiang. Enhancing and Combining Sequential and Tree LSTM for Natural Language Inference. CoRR, abs/1609.06038, 2016. + +Do Kook Choe and Eugene Charniak. Parsing as Language Modeling. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2331–2336, 2016. + +Ronan Collobert, Jason Weston, Leon Bottou, Michael Karlen nad Koray Kavukcuoglu, and Pavel Kuksa. Natural Language Processing (Almost) from Scratch. Journal of Machine Learning Research, 12:2493–2537, 2011. + +Chris Dyer, Miguel Ballesteros, Wang Ling, Austin Matthews, and Noah A. Smith. TransitionBased Dependency Parsing with Stack Long Short-Term Memory. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 334–343, 2015. + +Akiko Eriguchi, Kazuma Hashimoto, and Yoshimasa Tsuruoka. Tree-to-Sequence Attentional Neural Machine Translation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 823–833, 2016. + +Ian J. Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron Courville, and Yoshua Bengio. Maxout Networks. In Proceedings of The 30th International Conference on Machine Learning, pp. 1319– 1327, 2013. + +Alex Graves and Jurgen Schmidhuber. Framewise Phoneme Classification with Bidirectional LSTM and Other Neural Network Architectures. Neural Networks, 18(5):602–610, 2005. + +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. + +Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. Neural Computation, 9(8): 1735–1780, 1997. + +Eliyahu Kiperwasser and Yoav Goldberg. Easy-First Dependency Parsing with Hierarchical Tree LSTMs. Transactions of the Association for Computational Linguistics, 4:445–461, 2016. + +Taku Kudo and Yuji Matsumoto. Chunking with Support Vector Machines. In Proceedings of the Second Meeting of the North American Chapter of the Association for Computational Linguistics, 2001. + +Ankit Kumar, Ozan Irsoy, Peter Ondruska, Mohit Iyyer, James Bradbury, Ishaan Gulrajani, Victor Zhong, Romain Paulus, and Richard Socher. Ask Me Anything: Dynamic Memory Networks for Natural Language Processing. In Proceedings of The 33rd International Conference on Machine Learning, pp. 1378–1387, 2016. + +Alice Lai and Julia Hockenmaier. Illinois-LH: A Denotational and Distributional Approach to Semantics. In Proceedings of the 8th International Workshop on Semantic Evaluation (SemEval 2014), pp. 329–334, 2014. + +Zhizhong Li and Derek Hoiem. Learning without Forgetting. CoRR, abs/1606.09282, 2016. + +Wang Ling, Chris Dyer, Alan W Black, Isabel Trancoso, Ramon Fermandez, Silvio Amir, Luis Marujo, and Tiago Luis. Finding Function in Form: Compositional Character Models for Open Vocabulary Word Representation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1520–1530, 2015. + +Minh-Thang Luong, Ilya Sutskever, Quoc V. Le, Oriol Vinyals, and Lukasz Kaiser. Multi-task Sequence to Sequence Learning. In Proceedings of the 4th International Conference on Learning Representations, 2016. + +Xuezhe Ma and Eduard Hovy. End-to-end Sequence Labeling via Bi-directional LSTM-CNNsCRF. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1064–1074, 2016. + +Marco Marelli, Luisa Bentivogli, Marco Baroni, Raffaella Bernardi, Stefano Menini, and Roberto Zamparelli. SemEval-2014 Task 1: Evaluation of Compositional Distributional Semantic Models on Full Sentences through Semantic Relatedness and Textual Entailment. In Proceedings of the 8th International Workshop on Semantic Evaluation (SemEval 2014), pp. 1–8, 2014. + +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed Representations of Words and Phrases and their Compositionality. In Advances in Neural Information Processing Systems 26, pp. 3111–3119. 2013. + +Ishan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-stitch Networks for Multi-task Learning. CoRR, abs/1604.03539, 2016. + +Yasumasa Miyamoto and Kyunghyun Cho. Gated Word-Character Recurrent Language Model. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1992–1997, 2016. + +Masataka Ono, Makoto Miwa, and Yutaka Sasaki. Word Embedding-based Antonym Detection using Thesauri and Distributional Information. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 984–989, 2015. + +Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global Vectors for Word Representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, pp. 1532–1543, 2014. + +Vu Pham, Theodore Bluche, Christopher Kermorvant, and Jerome Louradour. Dropout improves Recurrent Neural Networks for Handwriting Recognition. CoRR, abs/1312.4569, 2014. + +Andrei A. Rusu, Neil C. Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive Neural Networks. CoRR, abs/1606.04671, 2016. + +Richard Socher, Brody Huval, Christopher D. Manning, and Andrew Y. Ng. Semantic Compositionality through Recursive Matrix-Vector Spaces. In Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, pp. 1201–1211, 2012. + +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. Recursive Deep Models for Semantic Compositionality Over a Sentiment Treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1631–1642, 2013. + +Anders Søgaard. Semi-supervised condensed nearest neighbor for part-of-speech tagging. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 48–52, 2011. + +Anders Søgaard and Yoav Goldberg. Deep multi-task learning with low level tasks supervised at lower layers. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 231–235, 2016. + +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to Sequence Learning with Neural Networks. In Advances in Neural Information Processing Systems 27, pp. 3104–3112. 2014. + +Jun Suzuki and Hideki Isozaki. Semi-Supervised Sequential Labeling and Segmentation Using Giga-Word Scale Unlabeled Data. In Proceedings of the 46th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 665–673, 2008. + +Kai Sheng Tai, Richard Socher, and Christopher D. Manning. Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 1556–1566, 2015. + +Kristina Toutanova, Dan Klein, Christopher D Manning, and Yoram Singer. Feature-Rich Partof-Speech Tagging with a Cyclic Dependency Network. In Proceedings of the 2003 Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics, pp. 173–180, 2003. + +Yoshimasa Tsuruoka, Yusuke Miyao, and Jun’ichi Kazama. Learning with Lookahead: Can HistoryBased Models Rival Globally Optimized Models? In Proceedings of the Fifteenth Conference on Computational Natural Language Learning, pp. 238–246, 2011. + +David Weiss, Chris Alberti, Michael Collins, and Slav Petrov. Structured Training for Neural Network Transition-Based Parsing. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 323–333, 2015. + +John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. CHARAGRAM: Embedding Words and Sentences via Character n-grams. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. to appear, 2016. + +Wenpeng Yin, Hinrich Schtze, Bing Xiang, and Bowen Zhou. ABCNN: Attention-Based Convolutional Neural Network for Modeling Sentence Pairs. Transactions of the Association for Computational Linguistics, 4:259–272, 2016. + +Yao Zhou, Cong Liu, and Yan Pan. Modelling Sentence Pairs with Tree-structured Attentive Encoder. In Proceedings of the 26th International Conference on Computational Linguistics, pp. to appear, 2016. + +# APPENDIX + +# A DETAILS OF CHARACTER $N$ -GRAM EMBEDDINGS + +Here we first describe the pre-training process of the character $n$ -gram embeddings in detail and then show further analysis on the results in Table 11. + +# A.1 PRE-TRAINING WITH SKIP-GRAM OBJECTIVE + +We pre-train the character $n$ -gram embeddings using the objective function of the Skip-gram model with negative sampling (Mikolov et al., 2013). We build the vocabulary of the character $n$ -grams based on the training corpus, the case-sensitive English Wikipedia text. This is because such casesensitive information is important in handling some types of words like named entities. Assuming that a word $w$ has its corresponding $K$ character $n$ -grams $\{ c n _ { 1 } , c n _ { 2 } , . . . , c n _ { K } \}$ , where any overlaps and unknown ones are removed. Then the word $w$ is represented with an embedding $v _ { c } ( w )$ computed as follows: + +$$ +v _ { c } ( w ) = \frac { 1 } { K } \sum _ { i = 1 } ^ { K } v ( c n _ { i } ) , +$$ + +where $v ( c n _ { i } )$ is the parameterized embedding of the character $n$ -gram $c n _ { i }$ , and the computation of $v _ { c } ( w )$ is exactly the same as the one used in our JMT model explained in Section 2.1. + +The remaining part of the pre-training process is the same as the original Skip-gram model. For each word-context pair $( w , \overline { { w } } )$ in the training corpus, $N$ negative context words are sampled, and the objective function is defined as follows: + +$$ +\sum _ { ( w , \overline { { w } } ) } \left( - \log \sigma ( v _ { c } ( w ) \cdot \widetilde { v } ( \overline { { w } } ) ) - \sum _ { i = 1 } ^ { N } \log \sigma ( - v _ { c } ( w ) \cdot \widetilde { v } ( \overline { { w } } _ { i } ) ) \right) , +$$ + +Table 14: POS tagging scores on the development set with and without the character $n$ -gram embeddings, focusing on accuracy for unknown words. The overall accuracy scores are taken from Table 11. There are 3,862 unknown words in the sentences of the development set. + +
Single (POS)Overall Acc.Acc.for unknown words
W&C97.5290.68 (3,502/3,862)
Only W96.2671.44 (2,759/3,862)
+ +
Single (Dependency)Overall scoresUAS LASScores for unknown wordsUAS LAS
W&C93.38 91.3792.21(900/976) 87.81(857/976)
Only W92.90 90.4491.39(892/976) 81.05 (791/976)
+ +Table 15: Dependency parsing scores on the development set with and without the character $n$ -gram embeddings, focusing on UAS and LAS for unknown words. The overall scores are taken from Table 11. There are 976 unknown words in the sentences of the development set. + +where $\sigma ( \cdot )$ is the logistic sigmoid function, $\tilde { v } ( \overline { { w } } )$ is the weight vector for the context word $\overline { { w } }$ , and $\overline { { w } } _ { i }$ is a negative sample. It should be noted that the weight vectors for the context words are parameterized for the words without any character information. + +# A.2 EFFECTIVENESS ON UNKNOWN WORDS + +One expectation from the use of the character $n$ -gram embeddings is to better handle unknown words. We verified this assumption in the single task setting for POS tagging, based on the results reported in Table 11. Table 14 shows that the joint use of the word and character $n$ -gram embeddings improves the score by about $19 \%$ in terms of the accuracy for unknown words. + +We also show the results of the single task setting for dependency parsing in Table 15. Again, we can see that using the character-level information is effective, and in particular, the improvement of the LAS score is large. These results suggest that it is better to use not only the word embeddings, but also the character $n$ -gram embeddings by default. Recently, the joint use of word and character information has proven to be effective in language modeling (Miyamoto & Cho, 2016), but just using the simple character $n$ -gram embeddings is fast and also effective. + +# B ANALYSIS ON DEPENDENCY PARSING + +Our dependency parser is based on the idea of predicting a head (or parent) for each word, and thus the parsing results do not always lead to correct trees. To inspect this aspect, we checked the parsing results on the development set (1,700 sentences), using the “JMTABC” setting. + +In the dependency annotations used in this work, each sentence has only one root node, and we have found 11 sentences with multiple root nodes and 11 sentences with no root nodes in our parsing results. We show two examples below: + +(a) Underneath the headline “ Diversification , ” it counsels , “ Based on the events of the past week , all investors need to know their portfolios are balanced to help protect them against the market ’s volatility . ” +(b) Mr. Eskandarian , who resigned his Della Femina post in September , becomes chairman and chief executive of Arnold . + +In the example (a), the two boldfaced words “counsels” and “need” are predicted as child nodes of the root node, and the underlined word “counsels” is the correct one based on the gold annotations. This example sentence (a) consists of multiple internal sentences, and our parser misunderstood that both of the two verbs are the heads of the sentence. + +In the example (b), none of the words is connected to the root node, and the correct child node of the root is the underlined word “chairman”. Without the internal phrase “who resigned... in September”, the example sentence (b) is very simple, but we have found that such a simplified sentence is still not parsed correctly. In many cases, verbs are linked to the root nodes, but sometimes other types of words like nouns can be the candidates. In our model, the single parameterized vector $r$ is used to represent the root node for each sentence. Therefore, the results of the examples (a) and (b) suggest that it would be needed to capture various types of root nodes, and using sentence-dependent root representations would lead to better results in future work. + +# C ANALYSIS ON SEMANTIC TASKS + +We inspected the development set results on the semantic tasks using the $\mathrm { ^ { 6 } I M T _ { a l l } }$ ” setting. In our model, the highest-level task is the textual entailment task. We show an example premise-hypothesis pair which is misclassified in our results: + +Premise: “A surfer is riding a big wave across dark green water”, and + +Hypothesis: “The surfer is riding a small wave”. + +The predicted label is entailment, but the gold label is contradiction. This example is very easy by focusing on the difference between the two words “big” and “small”. However, our model fails to correctly classify this example because there are few opportunities to learn the difference. Our model relies on the pre-trained word embeddings based on word co-occurrence statistics (Mikolov et al., 2013), and it is widely known that such co-occurrence-based embeddings can rarely discriminate between antonyms and synonyms (Ono et al., 2015). Moreover, the other four tasks in our JMT model do not explicitly provide the opportunities to learn such semantic aspects. Even in the training data of the textual entailment task, we can find only one example to learn the difference between the two words, which is not enough to obtain generalization capacities. Therefore, it is worth investigating the explicit use of external dictionaries or the use of pre-trained word embeddings learned with such dictionaries (Ono et al., 2015), to see whether our JMT model is further improved not only for the semantic tasks, but also for the low-level tasks. + +# D HOW DO SHARED EMBEDDINGS CHANGE + +In our JMT model, the word and character $n$ -gram embedding matrices are shared across all of the five different tasks. To better qualitatively explain the importance of the shortcut connections shown in Table 9, we inspected how the shared embeddings change when fed into the different biLSTM layers. More concretely, we checked closest neighbors in terms of the cosine similarity for the word representations before and after fed into the forward LSTM layers. In particular, we used the corresponding part of $W _ { u }$ in Eq. (1) to perform linear transformation of the input embeddings, because $u _ { t }$ directly affects the hidden states of the LSTMs. Thus, this is a context-independent analysis. + +Table 16 shows the examples of the word “standing”. The row of “Embedding” shows the cases of using the shared embeddings, and the others show the results of using the linear-transformed embeddings. In the column of “Only word”, the results of using only the word embeddings are shown. The closest neighbors in the case of “Embedding” capture the semantic similarity, but after fed into the POS layer, the semantic similarity is almost washed out. This is not surprising because it is sufficient to cluster the words of the same POS tags: here, NN, VBG, etc. In the chunking layer, the similarity in terms of verbs is captured, and this is because it is sufficient to identify the coarse chunking tags: here, VP. In the dependency layer, the closest neighbors are adverbs, gerunds of verbs, and nouns, and all of them can be child nodes of verbs in dependency trees. However, this information is not sufficient in further classifying the dependency labels. Then we can see that in the column of “Word and char”, jointly using the character $n$ -gram embeddings adds the morphological information, and as shown in Table 11, the LAS score is substantially improved. + +In the case of semantic tasks, the projected embeddings capture not only syntactic, but also semantic similarities. These results show that different tasks need different aspects of the word similarities, and our JMT model efficiently transforms the shared embeddings for the different tasks by the simple linear transformation. Therefore, without the shortcut connections, the information about the word representations are fed into the semantic tasks after transformed in the lower layers where the semantic similarities are not always important. Indeed, the results of the semantic tasks are very poor without the shortcut connections. + +
Word and charOnly word
Embeddingleaningkneelingsalutingclingingrailingstoodstandssitpillarcross-legged
POSwarningwaxingdunkingprovingtippingladderrc6280bethlewarningf-a-18
Chunkingapplaudingdisdainingpickinreadjustingreclaimingfightfavorpickrejoinanswer
Dependencyguaranteeingresting groundinghanginghuggingpatientlyhugginganxiouslyrestingdisappointment
Relatednessstoodstandsunchallengednotwithstanding judgingstoodunchallengedstandsbesideexists
Entailmentnudgingskirtingstraddlingcontestingfootingbesidestands pillarswungovation
+ +Table 16: Closest neighbors of the word “standing” in the embedding space and the projected space in each forward LSTM. \ No newline at end of file diff --git a/md/train/SJlbyCNtPr/SJlbyCNtPr.md b/md/train/SJlbyCNtPr/SJlbyCNtPr.md new file mode 100644 index 0000000000000000000000000000000000000000..e381601f6cd082ffab4ab0fc0fd1fa94c3e63639 --- /dev/null +++ b/md/train/SJlbyCNtPr/SJlbyCNtPr.md @@ -0,0 +1,466 @@ +# LONG-TERM PLANNING, SHORT-TERM ADJUSTMENTS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Deep reinforcement learning (RL) algorithms can learn complex policies to optimize agent operation over time. RL algorithms have shown promising results in solving complicated problems in recent years. However, their application on real-world physical systems remains limited. Despite the advancements in RL algorithms, the industries often prefer traditional control strategies. Traditional methods are simple, computationally efficient and easy to adjust. In this paper, we propose a new Q-learning algorithm for continuous action space, which can bridge the control and RL algorithms and bring us the best of both worlds. Our method can learn complex policies to achieve long-term goals and at the same time it can be easily adjusted to address short-term requirements without retraining. We achieve this by modeling both short-term and long-term prediction models. The short-term prediction model represents the estimation of the system dynamic while the long-term prediction model represents the Q-value. The case studies demonstrate that our proposed method can achieve short-term and long-term goals without complex reward functions. + +# 1 INTRODUCTION + +Optimal control methodologies use system dynamic equations to design actions that minimize desired cost functions. A cost function can be designed to track a trajectory, reach a goal, or avoid obstacles. It is also possible to design a cost function to achieve a combination of goals. Model Predictive Control (MPC) is a common optimal control technique and has been applied to many industrial applications such as pressure control and temperature control in chemical processes (Garcia et al., 1989). The traditional control solutions are not adequate to address the challenges raised with the evolution of industrial systems. Recently, deep reinforcement learning (RL) has shown promising results in solving complex problems. For example, it has generated superhuman performance in chess and shogi (Silver et al., 2017). The following advantages make deep RL a strong candidate to overcome traditional control limitations. First, deep RL has an advantage in solving complex problems, especially when the consequences of an action are not immediately obvious. Moreover, it can learn an optimal solution without requiring detailed knowledge of the systems or their engineering designs. Finally, deep RL is not limited to time-series sensors and can use new sensors such as vision for a better control. + +![](images/d8d7ec0ca6f01aca72174a2b6440f4435156b861402ed88aa90c5b5458ca8de5.jpg) +Figure 1: Crane system. The long-term goal is to move the payload to the target location, $( x _ { d } , y _ { d } )$ as soon as possible. The short-term goal is to have zero sway at the destination, $\omega _ { p } = 0$ . + +However, deep RL has not been applied to address industrial problems in a meaningful way. There are several key issues that limit the application of deep RL to real-world problems. Deep RL algorithms typically require many samples during training (sample complexity). Sample complexity leads to high computational costs. A high computational cost can be justified for industries as a onetime charge. However, oftentimes small changes in the system goal, such as changing the desired temperature in a chemical reactor, or a new constraint such as a maximum allowable temperature in the reactor, require retraining the model. Moreover, industrial systems often have several short-term and long-term objectives. For example, consider the crane system shown in Figure 1. The long-term goal is to convey the payload to the target location as soon as possible. However, when the payload gets close to the target, it must have minimum sway for the safety of the operators. Designing a reward function that can capture these short-term and long-term goals concurrently can be challenging or even infeasible. + +A class of short-term objectives related to safe exploration during RL training have been studied recently. Gu et al. (2017) presented an application of deep RL for robotic manipulation control. To ensure safe exploration, they set maximum limits for the joint positions, and joint velocities. Moreover, they set a sphere boundary for the end-effector position and when the boundaries were about to be violated, they used correction velocity to force the end-effector position back to the center of the sphere. Dalal et al. (2018) formulated the safe exploration as an optimization problem. They proposed to add a safety layer that modifies the action at each time step. Toward this end, they learn the constraint function using a linear model and use this model to find the minimal change to the action such that the safety constraints are met at each time step. To the best of our knowledge, there is no study addressing short-term objectives during application. + +In this paper, we present a Locally Linear Q-Learning (LLQL) algorithm for continuous action space. The LLQL includes a short-term prediction model, a long-term prediction model, and a controller. The short-term prediction model represents a locally linear model of the dynamic system, while the long-term prediction model represents the value function $^ +$ a locally linear advantage function. The controller uses the short-term prediction model and the long-term prediction model to generate actions that achieve short-term and long-term goals simultaneously. It adopts a policy that maximizes Q-value while achieving short-term goals. The LLQL algorithm has the following advantages: + +• It does not require designing sensitive reward functions for achieving short-term and longterm goals concurrently. +• It shows better performance in achieving short-term and long-term goals compared to the traditional reward modification methods. +• It is possible to modify the short-term goals without time-consuming retraining. + +The remainder of this paper is organized as follows. Section 2 represents the background in dynamic systems and RL. Section 3 represents the LLQL algorithm. Section 4 presents our methodology to achieve short-term and long-term goals using LLQL. Section 5 presents our experimental results. Section 6 presents the conclusions of the paper. Section A discusses the related work. Section B presents additional experiments for those interested. + +# 2 BACKGROUND AND DEFINITIONS + +In this section, we review the backgrounds in dynamic systems and reinforcement learning. + +# 2.1 DYNAMIC SYSTEMS + +A continuous-time dynamic system can be represented as: + +$$ +\frac { d x ( t ) } { d t } = f ( x ( t ) , u ( t ) , t ; p ) , +$$ + +where given the system parameters, $p , f$ maps the state variables, $x \in X$ , and actions, $u \in U$ , to the state derivative, $\frac { d \bar { x } } { d t }$ at time $t$ . In state space control, the goal is to design a control policy, $\pi _ { c o n t r o l } ( u ( t ) | x ( t ) )$ , that generates proper actions so as the state variables follow the given desired trajectory, $x _ { d } ( t )$ . It is challenging to design a control policy for a nonlinear complex system represented in equation (1). + +The control problem becomes much easier to address when this system is linear with respect to the input (Chen et al., 2003). We can present these systems as: + +$$ +\frac { d x ( t ) } { d t } = f ( x ( t ) ) + g ( x ( t ) ) u ( t ) . +$$ + +Since measurements are typically sampled in discrete times, we derive a discrete time version of linear system (2). Using a first-order approximation: + +$$ +\frac { d x ( t _ { k } ) } { d t } = \frac { x ( t _ { k + 1 } ) - x ( t _ { k } ) } { t _ { k + 1 } - t _ { k } } , +$$ + +where $t _ { k }$ represents time at sample point $k$ . In this paper, we assume the sampling rate is constant; $\Delta = t _ { k + 1 } - t _ { k }$ . Using (2) and (3), we have: + +$$ +x ( t _ { k + 1 } ) - x ( t _ { k } ) = \Delta ( f ( x ( t _ { k } ) ) + g ( x ( t _ { k } ) ) u ( t _ { k } ) ) . +$$ + +For brevity, we present $t _ { k }$ by $k$ , $f ( x ( t _ { k } ) )$ by $f ( x _ { k } )$ , and $g ( x ( t _ { k } ) )$ by $g ( x _ { k } )$ in the remainder of the paper. Therefore, we can represent a dynamic system as: + +$$ +x _ { k + 1 } = x _ { k } + \Delta ( f ( x _ { k } ) + g ( x _ { k } ) u _ { k } ) . +$$ + +# 2.2 REINFORCEMENT LEARNING + +The goal of RL is to learn a policy, $\pi _ { R L } ( u _ { k } | x _ { k } )$ , that generates a set of actions, $u \in U$ , that maximize the expected sum of rewards in the environment, $E _ { n }$ . Consider: + +$$ +R _ { k } = \sum _ { i = k } ^ { T } \gamma ^ { i - k } r ( x _ { i } , u _ { i } ) , +$$ + +where $\gamma < 1$ is the discount factor, $r$ is the reward function and $T$ represents the end time and can be set to $T = \infty$ . The goal is to learn $\pi _ { R L }$ for environment, $E _ { n }$ , such that: + +$$ +\operatorname* { m a x } ( R = \mathbb { E } _ { r _ { i \ge 1 } , x _ { i \ge 1 } \sim E _ { n } , u _ { i \ge 1 } \sim \pi _ { R L } } [ R _ { 1 } ] ) . +$$ + +Unlike control algorithms, model-free reinforcement learning algorithms assume the system dynamic is unknown. Q-function, $Q ^ { \pi } ( x _ { k } , u _ { k } )$ is defined as the expected return at state $x _ { k }$ when we take action $u _ { k }$ and adopt policy $\pi$ afterward: + +$$ +Q ^ { \pi } ( x _ { k } , u _ { k } ) = \mathbb { E } _ { r _ { i \geq k } , x _ { i \geq k } \sim E _ { n } , u _ { i \geq k } \sim \pi } [ R _ { k } | x _ { k } , u _ { k } ] ) . +$$ + +Q-learning algorithms (Watkins & Dayan, 1992) are among the most common model-free RL methods for discrete action space problems. These algorithms use the Bellman recursive equation to model Q-function: + +$$ +\begin{array} { r l } & { Q ^ { \mu } ( x _ { k } , u _ { k } ) = } \\ & { \mathbb { E } _ { r _ { i \geq k } , x _ { i > k } \sim E _ { n } } [ r ( x _ { k } , u _ { k } ) + \gamma Q ^ { \mu } ( x _ { k + 1 } , \mu ( x _ { k + 1 } ) ) ] ) , } \end{array} +$$ + +where $\mu$ represents a greedy deterministic policy that selects the action which maximizes $\mathrm { Q }$ -value at each step: + +$$ +\mu ( x _ { k } ) = \operatorname { a r g m a x } _ { u } Q ( x _ { k } , u _ { k } ) . +$$ + +Q-learning algorithms learn the parameters of the function approximator, $\theta ^ { Q }$ , by minimizing the Bellman error: + +$$ +\begin{array} { r l } & { \operatorname* { m i n } ( L ( \theta ^ { Q } ) = \mathbb { E } _ { r _ { k } , x _ { k } \sim E _ { n } , u _ { k } \sim \beta } [ ( Q ( x _ { k } , u _ { k } | \theta ^ { Q } ) - y _ { k } ) ^ { 2 } ] ) , } \\ & { y _ { k } = r ( x _ { k } , u _ { k } ) + \gamma Q ( x _ { k + 1 } , \mu ( x _ { k + 1 } ) ) , } \end{array} +$$ + +where $y _ { k }$ is the fixed target Q-function, and $\beta$ represents the exploration policy. + +For continuous action domain problems, it is not trivial to solve equation (10) at each time step. Finding an action to maximize $Q$ which can be a complex nonlinear function is computationally expensive or even infeasible. To address this problem, Lillicrap et al. (2015) proposed the Deep Deterministic Policy Gradient (DDPG) algorithm, which learns two networks simultaneously. The critic network learns Q-function by minimizing the Bellman error, and the actor network learns parameters of the policy to maximize the estimated value of Q-function. Gu et al. (2016) proposed + +Normalized Advantage Function (NAF) Q-learning which formulates the Q-function as the sum of the value function, $V ( x )$ , and the advantage function, $A ( x , u )$ . + +$$ +Q ( x , u | \theta ^ { Q } ) = V ( x | \theta ^ { V } ) + A ( x , u | \theta ^ { A } ) , +$$ + +where + +$$ +A ( x , u | \theta ^ { A } ) = - \frac { 1 } { 2 } ( u - \mu ( x | \theta ^ { u } ) ) ^ { T } P ( x | \theta ^ { P } ) ( u - \mu ( x | \theta ^ { u } ) ) . +$$ + +$P ( x | \theta ^ { P } ) = L ( x | \theta ^ { P } ) L ( x | \theta ^ { P } ) ^ { T }$ , where $L ( x | \theta ^ { P } )$ is a lower-triangular matrix. The value function is not a function of action, $u$ . Therefore, the action which maximizes advantage function, $A$ , maximizes the $Q$ function. $P ( x | \theta ^ { P } )$ is a positive-definite matrix, and therefore, the action that maximizes the advantage function and the $Q$ -function is given by $\mu ( x | \theta ^ { u } )$ . + +# 3 LOCALLY LINEAR Q-LEARNING + +![](images/3d9012b4ddb1293f6a6b14e4b1a4db6d747a351e53445aca05e8fc85ec665e7d.jpg) +Figure 2: Learning the LLQL Network Parameters. + +In this section, we propose the LLQL algorithm, which like (Lillicrap et al., 2015) and (Gu et al., 2016) can handle continuous action space. Our approach learns short-term and long-term prediction models. Using the long-term and short-term models, a controller generates actions that guide the system toward its short-term and long-term goals. Figure 2 shows our proposed structure to learn the parameters of the short-term and long-term prediction models. + +Short-term prediction: consider the nonlinear system presented in equation (5). In this work, we use deep neural networks to estimate system functions, $f ( x _ { k } )$ , and $g ( x _ { k } )$ at each operating point. Substituting the network estimations for these functions in equation (5), we can predict the next state as: + +$$ +\hat { x } _ { k + 1 } = x _ { k } + \Delta ( f ( x _ { k } | \theta ^ { f } ) + g ( x _ { k } | \theta ^ { g } ) u _ { k } ) , +$$ + +where $\hat { x } _ { k + 1 }$ represents our estimation of the next step, and $\theta ^ { f }$ and $\theta ^ { g }$ are the network parameters. $\Delta$ is a constant hyper parameter. In dynamic systems, the difference between two consecutive states, $x _ { k + 1 } - x _ { k }$ , is typically very small. Considering a small $\Delta$ leads to reasonable $f$ and $g$ values and, therefore, improves learning time and accuracy. + +We call this dynamic system model short-term prediction model. The controller uses this model to generate actions, which lead the system toward its short-term goals. Note that previous work have used the system short-term dynamic model for generating additional samples in imagination rollout (for example, see (Gu et al., 2016), and (Racaniere et al., 2017)). In this paper, we show that this \` model can also be used to design actions to achieve short-term goals. To learn the parameters of our short-term prediction model, $\theta ^ { f }$ and $\theta ^ { g }$ , we minimize the short-term loss function, $L _ { 1 }$ , as it is presented in Algorithm 1. + +Long-term prediction: Q-function represents the maximum cumulative reward that can be achieved from current state, $x _ { k }$ , taking an action $u _ { k }$ . Therefore, by learning Q-function, we learn the longterm prediction model for the system. Like NAF (Gu et al., 2016) (see equation (12)), we present + +Q-function as a sum of value function and advantage function. However, we present the advantage function, $A ( x , u | \theta ^ { A } )$ using a locally linear function of $x _ { k }$ and $u _ { k }$ as: + +$$ +\begin{array} { r } { Q ( x , u \vert \theta ^ { Q } ) = V ( x \vert \theta ^ { V } ) + A ( x , u \vert \theta ^ { A } ) , } \\ { A ( x , u \vert \theta ^ { A } ) = - \vert \vert ( h ( x _ { k } \vert \theta ^ { h } ) + d ( x _ { k } \vert \theta ^ { d } ) u _ { k } ) \vert \vert , } \end{array} +$$ + +where $h ( x _ { k } | \theta ^ { h } )$ and $d ( x _ { k } | \theta ^ { d } )$ networks model the locally linear advantage function. Note the NAF advantage function is a special case of the LLQL advantage function when $d ( x _ { k } | \theta ^ { d } ) = I$ , where $I$ represents the identity matrix. + +To maximize Q-function, we have to design $u _ { k }$ which minimizes $h ( x _ { k } | \theta ^ { h } ) + d ( x _ { k } | \theta ^ { d } ) u _ { k }$ . For simplicity, we present $h ( x _ { k } | \theta ^ { h } )$ , and $d ( x _ { k } | \bar { \theta } ^ { d } )$ with $h _ { k }$ and $d _ { k }$ respectively in the remainder of the paper. To maximize Q-function and achieve the long-term goal, we can use simple pseudo-inverse matrix multiplication and derive a solution with the least squares error as: + +$$ +u _ { k } = - ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } d _ { k } ^ { T } h _ { k } . +$$ + +When $| | d _ { k } | | = 0$ , it means the network predicts that our action has no impact on the advantage function. Therefore, we choose a random action. Random exploration is an important part of any deep RL algorithm. Therefore, in addition to this unlikely case, we add noise, $\mathcal { N } _ { k }$ , to the action, $u _ { k }$ , during the training. We reduce the amount of noise injected to the action as the algorithm converges. + +# Algorithm 1 Locally Linear Q-Learning Training + +1: Initialize Q network (equation (15)) with random weights. +2: Initialize target network, $Q ^ { ' }$ , parameters: ${ \theta ^ { Q } } ^ { ' } = \theta ^ { Q }$ . +3: Create the reply buffer $R = \emptyset$ . +4: for episode $= 1 { : } \mathbf { M }$ do +5: Initialize a random process $\mathcal { N }$ for action exploration. +6: Receive the initial observation, $x _ { 0 }$ . +7: for $\mathrm { k } = 1 { : } \mathrm { T }$ do +8: if $| | d _ { k } | | \neq 0$ then +9: Set $\ddot { u } _ { k } = - ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } ( d _ { k } ^ { T } ) h _ { k } + \mathcal { N } _ { k }$ +10: else +Set $u _ { k } = \mathcal { N } _ { k }$ +11: Execute $u _ { k }$ and observe $x _ { k + 1 }$ and $r _ { k }$ . +12: Store transition $\left( { { x } _ { k } } , { { u } _ { k } } , { { x } _ { k + 1 } } , { { r } _ { k } } \right)$ in $R$ . +13: for iteration $= 1 { : } I _ { s }$ do +14: Randomly select a mini-batch of $N _ { s }$ transition from $R$ . +15: Update $\theta ^ { f }$ and $\theta ^ { g }$ by minimizing the loss: $\begin{array} { r } { \begin{array} { r c l } { L _ { 1 } } & { = } & { \frac { 1 } { N _ { s } } \sum _ { i = 1 } ^ { N _ { s } } | | x _ { i + 1 } - x _ { i } - \Delta ( f ( x _ { i } | \theta ^ { f } ) \ + } \end{array} } \end{array}$ +$g ( x _ { i } | \theta ^ { g } ) u _ { i } ) | |$ . +16: for iteration $= 1 { : } I _ { l }$ do +17: Randomly select a mini-batch of $N _ { l }$ transition from $R$ . +18: Set $y _ { i } = r _ { i } + \gamma Q ^ { ' } ( x _ { i + 1 } | \theta ^ { Q ^ { ' } } )$ . +19: Update $\theta ^ { Q }$ by minimizing the loss: $\begin{array} { r } { L _ { 2 } = \frac { 1 } { N _ { l } } \sum _ { i = 1 } ^ { N _ { l } } | | y _ { i } - Q ( x _ { i } , u _ { i } | \theta ^ { Q } ) | | . } \end{array}$ +20: Update the target network: ${ \theta ^ { Q } } ^ { \prime } = \tau \theta ^ { Q } + ( 1 - \tau ) { \theta ^ { Q } } ^ { \prime }$ + +In the application, the controller solves $u _ { k }$ with additional constraints to achieve the desired shortterm trajectories. We will discuss our short-term adjustment algorithms in the next section. To learn Q-function, in addition to the state estimation error, we minimize the long-term loss function, $L _ { 2 }$ , as it is presented in Algorithm 1. Note that having the short-term model, it is straightforward to add imagination rollout to our algorithm to increase sample efficiency. However, improving sample efficiency in RL is not the focus of this work. + +# 4 CONTROL STRATEGY + +By separating action design from prediction models, LLQL gives us the freedom to design different control strategies for achieving short-term and long-term goals. Moreover, the linear structure of short-term and long-term models simplifies the control design. Consider the case where LLQL has learned a perfect long-term model for an environment using Algorithm 1. In this case, the optimum solution to achieve the long-term goal is given by equation (16). When we have one or more shortterm goals as well, we can formulate the control design as an optimization problem to satisfy both short-term and long-term goals as much as possible. + +In this paper, we consider two types of short-term goals: 1) desired trajectory, and 2) constraint. In the first scenario, the agent has a short-term desired trajectory. For example, a car may be required to travel with specific speed during certain periods. In the second scenario, the agent has some limitation for a specific period of time. For example, a car is required to keep its speed below certain thresholds at some periods during the trip. To address the first problem, we add an additional term to the cost function for the short-term goal and solve for the action. We deal with the second problem as a constraint optimization. + +# 4.1 SHORT-TERM TRAJECTORY + +Let $x _ { d }$ represent our desired short-term trajectory. We develop a control strategy to track $x _ { d }$ while pursuing the long-term goals. + +Using system dynamic functions $f _ { k }$ and $g _ { k }$ , we can define our control optimization problem as: + +$$ +\operatorname* { m i n } _ { \mathrm { f i n d } ~ u _ { k } } ( \gamma _ { 1 } ( h _ { k } + d _ { k } u _ { k } ) ^ { 2 } + \gamma _ { 2 } ( x _ { d ( k + 1 ) } - x _ { k } - \Delta ( f _ { k } + g _ { k } u _ { k } ) ) ^ { 2 } ) , +$$ + +where $x _ { d ( k + 1 ) }$ represents the desired trajectory at time $k + 1$ . $\gamma _ { 1 }$ and $\gamma _ { 2 }$ are positive coefficients and can be adjusted to give higher weights to the short-term or long-term goals. Note that in this work, we assume the short-term goals are temporary and when their time expires the system goes to the long-term optimum policy given by (16). For example, we may require a car to have a specific speed at some specific locations. + +We can apply a similar pseudo-inverse matrix multiplication, and derive a solution with the least squares error for (17) as: + +$$ +u _ { k } ^ { * } = \big ( \frac { \gamma _ { 1 } d _ { k } } { - \gamma _ { 2 } \Delta g _ { k } } \bigg ) ^ { T } \left[ \frac { \gamma _ { 1 } d _ { k } } { - \gamma _ { 2 } \Delta g _ { k } } \right] \big ) ^ { - 1 } \left[ \frac { \gamma _ { 1 } d _ { k } } - \gamma _ { 2 } \Delta g _ { k } \right] ^ { T } \left[ \gamma _ { 2 } \big ( - x _ { d ( k + 1 ) } + x _ { k } + \Delta f _ { k } \big ) \right] . +$$ + +# 4.2 SHORT-TERM CONSTRAINT + +The LLQL algorithm provides a framework to design the actions considering different constraints. For safe operation, the agent may have to avoid specific states for a period of time (for example, high speed or locations close to an obstacle). For simplicity, we assume at each moment we only have maximum one constraint on one state variable, $x ^ { i }$ . This is a reasonable assumption, because in physical systems the agent is close to one of the boundaries at any moment in time. When this is not the case, we can define new constraints as a combination of constraints. Consider $c _ { k } ^ { i }$ as the constraint on the state variable, $x ^ { i }$ , at time $k$ . We can define the constraint optimization problem for LLQL as: + +$$ +\operatorname* { m i n } _ { \mathrm { f i n d } u _ { k } } \frac { 1 } { 2 } ( h _ { k } + d _ { k } u _ { k } ) ^ { 2 } +$$ + +such that: + +$$ +x _ { k + 1 } ^ { i } \leq c _ { k + 1 } ^ { i } . +$$ + +$\textstyle { \frac { 1 } { 2 } }$ is a coefficient added to simplify the mathematical operation. Using our estimation of the next step, $x _ { k + 1 } ^ { i } = x _ { k } ^ { i } + \Delta ( f _ { k } ^ { i } + g _ { k } ^ { i } u _ { k } )$ , we can derive the optimum action which satisfies the constraint as: + +$$ +\begin{array} { r } { u _ { k } ^ { * } = - ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } d _ { k } ^ { T } ( h _ { k } + \lambda ^ { * } \alpha _ { 1 } ) , } \end{array} +$$ + +where $\alpha _ { 1 } = \Delta g _ { k } ^ { i } d _ { k } ^ { T } ( d _ { k } d _ { k } ^ { T } ) ^ { - 1 }$ , $\alpha _ { 2 } = \Delta g _ { k } ^ { i } ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } d _ { k } ^ { T }$ , and $\begin{array} { r } { \lambda ^ { * } = \frac { x _ { k } ^ { i } + \Delta f _ { k } ^ { i } - c _ { k + 1 } - \alpha _ { 2 } h _ { k } } { \alpha _ { 1 } \alpha _ { 2 } } } \end{array}$ . The derivation details for short-term constraints are presented in Section C. + +![](images/86d6485d67832d126767a437566c2ab87e56a57fd5c3845c67f33462516b865a.jpg) + +(a) Average and standard deviation of cumulative rewards during the learning process. LLQL and DDPG algorithms converge in less than 40 episodes. Modelbased reinforcement learning algorithm (MPC) cannot learn a policy that guides the car to the top. + +![](images/66b8c477162cac94a1d9cbf84541108f1a578717ac993403dcb64a0cd78745c8.jpg) + +(b) State variables and estimated state variables. Using LLQL model, the car reached the top in 78 steps. Using DDPG model, the car reached the top in 110 steps. The car never reached the top when we used the MPC model. The mean absolute error for LLQL position estimation is 0.00078, the mean absolute error for LLQL velocity estimation is 0.000084, the mean absolute error for MPC position estimation is 0.00039 and the mean absolute error for MPC velocity estimation is 0.00014. + +Figure 3: LLQL for MountainCarContinuous. The network’s parameters are presented in Section D. + +# 5 EXPERIMENTAL RESULTS + +In this section, we demonstrate the performance of LLQL using Mountain Car with Continuous Action (MountainCarContinuous) from OpenAI $\mathrm { G y m } ^ { 1 }$ . In Section B, we apply LLQL to control the crane system shown in Figure 1. + +# 5.1 MOUNTAINCARCONTINUOUS + +The MountainCarContinuous has two state variables: 1) car’s position $- 1 . 2 \leq x _ { k } \leq 0 . 5$ and 2) car’s velocity $- 0 . 0 7 \leq v _ { k } \leq 0 . 0 7$ . $u _ { k }$ is the continuous action at time $k$ . A negative action pushes the car to the left and a positive action pushes the car to the right. The experience stops after $1 , 0 0 0$ steps or when the car reaches the goal on top of the mountain, $x _ { k } = 0 . 5$ , whichever occurs first. In the beginning of each episode, the car is randomly positioned at $- 0 . 6 \leq x _ { 0 } \leq - 0 . 4$ . The reward for each episode is 100 for reaching the goal on top of the mountain minus the squared sum of actions from start to the goal. Figure 3a shows the cumulative rewards during the training for the LLQL, the DDPG, and a model-based reinforcement learning based on MPC presented by (Nagabandi et al., 2018). The details of the MPC based solution is presented in Section E. For each approach we performed the training 20 times, and selected the top 5 models with the maximum cumulative rewards to calculate mean and standard deviation of each episode in Figure 3a. + +The MPC based solution uses the learned short-term predictive model (system dynamic model) to generate a sequence of actions that maximize the reward over a finite horizon. Figure 3b shows that the short-term predictive model estimates future states with high precision. However, optimizing for a finite horizon is a disadvantage for the model-based solution in achieving long-term goals. Increasing the horizon may improve the long-term performance, but it also increases the computational costs in the application phase. In our experiments, the car never reached the top of the mountain using the model-based method. Figure 3b presents the first 110 steps of a sample experiment. Unlike the MPC based solution, the LLQL and the DDPG algorithms converged in less than 40 episodes (see Figure 3a) and reach the top of the mountain in all experiments (see Figure 3b). Note that it is possible to improve the LLQL convergence time by applying imagination rollout. In fact, our short-term prediction model can be used to generate imaginary scenarios. However, sample efficiency is beyond the focus of this work. Figure 3 shows by applying the long-term predictive model, the LLQL algorithm outperforms the model-based reinforcement algorithm in achieving the long-term goals. In the next two subsections, we will show the LLQL algorithm can outperform the DDPG algorithm in achieving the short-term goals by using the short-term predictive model. + +![](images/a012a445d477d0aa1d4d46e0cdd964cac0e6f5652ff1773cc864cf600e94b688.jpg) +Figure 4: MountainCarContinuous with short-term and long-term goals. $\gamma _ { 1 } = 1$ , $\gamma _ { 2 } = 2 0 0 0$ + +(a) With LLQL the car reached the top of the mountain (b) Comparing the actions in normal case versus in 82 steps with a short-term goal error of 0.00008. With with the short-term trajectory. The hybrid stratDDPG $^ +$ modified reward ( $3 ^ { r { \bar { d } } }$ reward in Table 1) the car egy (see equation (21)) leads to quick adjustment in reached the top in 138 steps with short-term goal error LLQL action and therefore, smaller short-term goal 0.0023. The MPC $^ +$ modified reward cannot guide the error compared to the DDPG $^ +$ reward modification car to the top. solution. + +# 5.2 SHORT-TERM TRAJECTORY + +Figure 3b shows that the policy presented in equation (16) can lead the car to the top of the mountain using the LLQL algorithm. We can see that the car’s velocity is above 0.025 (the red line) when it reaches the top. Now consider the case where we want the car to reach the top of the mountain with our desired velocity, $v _ { d } = 0 . 0 2 5$ . Using equation (18), we can design a control strategy to reach this goal without requiring retraining the LLQL model. We apply the following hybrid control strategy to reach the top of the mountain with our desired speed. + +$$ +u _ { k } = { \left\{ \begin{array} { l l } { { \mathrm { u s e ~ e q u a t i o n ~ } } ( 1 6 ) } & { { \mathrm { i f ~ } } x _ { k } < 0 } \\ { { \mathrm { u s e ~ e q u a t i o n ~ } } ( 1 8 ) , } & { { \mathrm { o t h e r w i s e . } } } \end{array} \right. } +$$ + +Figure 4a shows that the car can reach the top of the mountain with our desired velocity. When we did not impose our desired speed to the system, the car reached the top of the mountain in 78 steps (see Figure 3b). Demanding a lower speed, slowed down the car and increased the number of steps to 82 (see Figure 4a). Figure 4b shows the actions with and without the short-term trajectory. We can see that the action temporarily becomes negative to reduce the velocity to the desired level and then goes back to positive to push the car to the top of the mountain. + +To solve this problem in the traditional way, we had to modify the reward function to achieve both short-term and long-term goals. For comparison, we perform the following experience. We apply DDPG networks and MPC based networks with the modified reward functions shown in Table 1 to solve the MountainCarContinuous with the short-term and long-term goal problem. To achieve the short-term trajectory, we have considered different functions of the absolute error between the car’s velocity and the desired velocity, $\lvert v _ { d } - v _ { k } \rvert$ in the final stages as an additional penalty. We have tried various architectures and hyper parameters to design the DDPG network. The final parameters are presented in Section D. We train a model for each modified reward function up to 300 episodes and save the model with maximum cumulative reward for our experiment. We run each model 10 times and measure the average number of steps it takes to reach the top of the mountain, and the average error between the car’s final speed and the desired speed, $v _ { d } = 0 . 0 2 5$ . Table 1 shows that the MPC based solution cannot guide the car to the top. The DDPG with all the modified reward functions can achieve the long-term goal in all the experiences, reaching the top of the mountain in 10 out of 10 experiments. However, the DDPG based solutions do not perform very well with regard to the shortterm goal. On the other hand, LLQL does not require additional training or reward modification, achieves the long-term goal and has the least velocity error, $0 . 4 \%$ . + +# 5.3 SHORT-TERM CONSTRAINT + +Now consider the case where it is unsafe to drive the car above a specific speed, for example, we plan to keep the speed under $v _ { k } \le 0 . 0 3 5$ . We can use the following hybrid control strategy to achieve the + +Table 1: Short-term trajectory performance + +
RLMethodModified Reward functionAverage velocityerrorAveragenumber ofstepsLong-termgoalsuccess rate
DDPGrnew=rk-5000*Uk-Udif done0.0232109.110/10
DDPGTnew=rk-100*Uk-UdUk-Udifxk>0.450.0193183.610/10
DDPGTnew =rk-100*Uk-Udif xk >0.45Tnew = rk -5000*lUk-Udlif done0.0088173.810/10
DDPGrnew=Tk-25000*(Uk-vd)² ifdone0.0193103.310/10
MPCrnew=rk-5000*Uk-Udif done-10000/10
MPCrnew=Tk-100*Uk-Udif xk>0.45-10000/10
MPCrnew=rk-100*Uk1Udlif xk >0.45rnew=rk15000*Uk1Udif done-10000/10
MPCTnew=rk-25000*((Uk-Ud)2ifdone-10000/10
LLQL·0.000189.510/10
+ +![](images/8cc4c5102c69e1302947f0fcfdf7207e5299d1ea382f886f28dd44932f9b69f3.jpg) +(a) With LLQL the car reached the top in 105 steps without (b) Comparing the actions in the normal case verviolating the constraints. With DDPG $^ +$ modified reward sus with the short-term constraint. The hybrid $3 ^ { r d }$ reward in Table 2) the car reached the top in 199 steps strategy (see equation (22)) leads to sharp adjustand violated the constraints 13 timesteps. The MPC $^ +$ mod- ment in LLQL action when the car gets close to ified reward cannot guide the car to the top. the hazardous areas. + +Figure 5: State variables for MountainCarContinuous with long-term goal and short-term constraint. The horizontal red lines, $| v _ { k } | = 0 . 0 3 5$ , represent the boundaries. The car reaches the goal in 97 steps. + +long-term goal while keeping the speed safe: + +$$ +u _ { k } = \left\{ \begin{array} { l l } { \mathrm { u s e ~ e q u a t i o n ~ ( 1 6 ) ~ } } & { \mathrm { i f ~ } | v _ { k } | \leq 0 . 0 3 3 } \\ { \mathrm { u s e ~ e q u a t i o n ~ ( 2 0 ) , } } & { \mathrm { o t h e r w i s e . } } \end{array} \right. +$$ + +We selected the boundary slightly less than the hazardous threshold (0.033 instead of 0.035) to be safe. Figure 5a shows that with the LLQL policy the car reaches its goal while staying outside of hazardous areas. The MPC based solution keeps the car outside of hazardous areas but cannot deliver the long-term goal (reaching the top of the mountain). The $\mathrm { D D P G } +$ modified reward reaches the top but fails to deliver the short-term goal (keeping the car out of hazardous areas). Like the previous section, we apply DDPG network $^ +$ modified reward function and $ { \mathrm { { M P C } } } +$ modified reward function to compare LLQL with the traditional model-free and model-based reward engineering approaches. We select the model with maximum cumulative rewards during 300 episodes of training. Table 2 shows that unlike LLQL, the modified rewards fail to keep the car below the allowed speed while reaching the top of the mountain. The model-based reinforcement learning algorithm baseline presented in Section E uses the same short-term network as the LLQL network. Table 1 and Table 2 show that even though the short-term part of our solution is useful in achieving short-term goals, it is not enough to solve the entire problem and achieve the long-term goal. + +Table 2: Short-term constraint performance + +
RLMethodModified Reward functionAveragenumber ofsteps out ofboundaryAveragenumber ofstepsLong-termgoalsuccess rate
DDPGTnew=rk110if|Uk>0.03321.510010/10
DDPGrnew=rk1100(Uk10.033)ifuk>0.03325.2106.810/10
DDPGrnew=rk-(100(lUkl10.033))ifu> 0.03320.4147.510/10
DDPGTnew=-10if|Uk>0.03325.1104.110/10
MPCTnew=rk-10ifUk>0.033010000/10
MPCTnew = rk -100(luk10.033)ifuk>0.033010000/10
MPCTnew=rk-((100(luk|-0.033))² if|uk|>0.033010000/10
MPCrnew=-10ifU>0.033010000/10
LLQL·098.910/10
+ +(a) Number of steps to the top vs desired final velocity. $\gamma _ { 1 } = 1$ , $\gamma _ { 2 } = 2 0 0 0$ . + +![](images/11cda591824218ce75f454fd0a8572f7b74e95ef2721a5b87048ad5ec07ee841.jpg) +Figure 6: Long-term performance vs short-term goals. We run the model with each short-term goal 10 times and present the average and standard deviation of the long-term goal. + +![](images/abc497e26194fb96ad0cff443aee587dc7be57d6e4e9e742ab7c265fca58a5a4.jpg) +(b) Number of steps to the top vs velocity constraint. + +# 5.4 EFFECT OF SHORT-TERM GOALS ON LONG-TERM PERFORMANCE + +Using equations (18) or (20) for deriving a set of actions is equivalent to solving a sub-optimum solution for the long-term goal in order to satisfy the short-term desired trajectories or constraints. When the short-term goals are far from the global optimum solution, the long-term performance degrades. Figure 6a shows that lower desired velocities lead to longer traveling time for the MountainCar. Similarly, Figure 6b shows that further limiting the maximum velocity degrades the long-term performance. + +# 6 CONCLUSIONS + +In this work, we presented LLQL as a new model-based RL algorithm with the capability of achieving both short-term and long-term goals without requiring complex reward functions. By presenting the advantage function with a locally linear model and separating designing actions from the learning process, our method is capable of adopting control strategies to achieve different short-term goals without retraining the model. This can be very significant for industrial applications where the RL algorithms have not been used due to the necessity of different short-term adjustments. + +The LLQL algorithm deviates from the optimal policy temporarily to address local short-term goals (trajectories or constraints). The agent would return to the optimum policy if the deviation is small enough that the agent is still in the environment explored during the training. In the future work, we will investigate conditions where short-term goals are feasible and develop a more analytical approach to set the meta parameters for the controller to guarantee short-term and long-term goals. Moreover, we will model uncertainties in short-term prediction model and apply robust control theory to design robust control solutions. + +# REFERENCES + +Giorgio Bartolini, Alessandro Pisano, and Elio Usai. Second-order sliding-mode control of container cranes. Automatica, 38(10):1783–1790, 2002. + +F Boustany and Brigitte d’Andrea Novel. Adaptive control of an overhead crane using dynamic feedback linearization and estimation design. In Proceedings 1992 IEEE International Conference on Robotics and Automation, pp. 1963–1968. IEEE, 1992. + +Jacob Buckman, Danijar Hafner, George Tucker, Eugene Brevdo, and Honglak Lee. Sampleefficient reinforcement learning with stochastic ensemble value expansion. In Advances in Neural Information Processing Systems, pp. 8224–8234, 2018. + +Wen-Hua Chen, Donald J Ballance, and Peter J Gawthrop. Optimal control of nonlinear systems: a predictive control approach. Automatica, 39(4):633–641, 2003. + +Gal Dalal, Krishnamurthy Dvijotham, Matej Vecerik, Todd Hester, Cosmin Paduraru, and Yuval Tassa. Safe exploration in continuous action spaces. arXiv preprint arXiv:1801.08757, 2018. + +Vladimir Feinberg, Alvin Wan, Ion Stoica, Michael I Jordan, Joseph E Gonzalez, and Sergey Levine. Model-based value expansion for efficient model-free reinforcement learning. arXiv preprint arXiv:1803.00101, 2018. + +Carlos E Garcia, David M Prett, and Manfred Morari. Model predictive control: theory and practice– a survey. Automatica, 25(3):335–348, 1989. + +Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning, pp. 2829– 2838, 2016. + +Shixiang Gu, Ethan Holly, Timothy Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. In 2017 IEEE international conference on robotics and automation (ICRA), pp. 3389–3396. IEEE, 2017. + +David Ha and Jurgen Schmidhuber. World models. ¨ arXiv preprint arXiv:1803.10122, 2018. + +Harold W Kuhn and Albert W Tucker. Nonlinear programming. In Traces and emergence of nonlinear programming, pp. 247–258. Springer, 2014. + +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. + +Anusha Nagabandi, Gregory Kahn, Ronald S Fearing, and Sergey Levine. Neural network dynamics for model-based deep reinforcement learning with model-free fine-tuning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 7559–7566. IEEE, 2018. + +Sebastien Racani ´ ere, Th \` eophane Weber, David Reichert, Lars Buesing, Arthur Guez, ´ Danilo Jimenez Rezende, Adria Puigdomenech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, et al. Imagination-augmented agents for deep reinforcement learning. In Advances in neural information processing systems, pp. 5690–5701, 2017. + +David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. Mastering chess and shogi by self-play with a general reinforcement learning algorithm. arXiv preprint arXiv:1712.01815, 2017. + +Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279–292, 1992. + +# A RELATED WORK + +Our work can be categorized as a new model-based RL approach. Model-based RL algorithms use the environment model which represents the state transition function to plan ahead and select actions that lead to higher rewards. Several model-based algorithms assume the environment model is known. Among them, AlphaZero (Silver et al., 2017) is one of the most famous. AlphaZero uses the game’s rules (Chess, Shogi and Go) as the environment model to generate a series of selfplay simulated games. During the simulations, the actions for both players are selected using a Monte-Carlo Tree Search (MCTS) algorithm. The MCTS performs as a planning algorithm by generating candidate actions which are superior to the current policy. The neural network parameters are updated at the end of each game to minimize the game prediction error (loss, draw or win) and maximize the similarity of policy vector to the planning algorithm. AlphaZero is limited to the discrete action space problems. The environment model is typically unknown in real-world applications. Therefore, many model-based RL algorithms learn the state transition model from the data. NAF (Gu et al., 2016) learns a linear model for state transition at each operating point and uses this model to generate additional samples through imagination rollout. World Models (Ha & Schmidhuber, 2018) uses a Variational Auto Encoder (VAE) to map a state variable, $x \in X$ to a lower dimensional variable $z$ in a latent space $Z$ . It then uses a recurrent neural network (RNN) to learn the state transition model in the latent space. Finally, it applies a simple linear controller to $z$ and the hidden state in the RNN, $h$ , to control the system. + +Imagination-Augmented Agents (I2As) (Racaniere et al., 2017) introduces two paths: 1) model-free \` path and 2) imagination path. The imagination path learns a transition model and uses this model to generate imagination rollouts. These rollouts are aggregated with the samples in the model-free path. To generate actions in the imagination path, I2As uses the model-free path policy. Therefore, the rollouts in the imagination path improve as the I2As policy improves. Using the imagination rollouts, I2As converge faster than a model-free network with the same number of parameters. Nagabandi et al. (2018) showed that a two-step control policy based on 1) learning the dynamic model and 2) applying MPC to the learned model is significantly more sample efficient than model-free RL. However, this approach cannot achieve high rewards. To achieve higher rewards and preserve sample efficiency, they proposed a hybrid model-based and model-free (MBMF) algorithm which runs the model-based approach to achieve the initial result in a sample efficient way, it then trains a modelfree policy to mimic the learned model-based controller, and uses the resulting imitation policy as the initialization for the final model-free RL algorithm. + +Feinberg et al. (2018) proposed Model-based Value Expansion (MVE) algorithm, which limits the uncertainty in the model by only allowing imagination up to a fixed number of steps, H. MVE uses the learned system dynamic model to generate simulation data up to H steps into the future, and applies these sample points to estimate Q-function. Instead of saving simulated samples in an imagination buffer, MVE retrains the dynamic model and generates a new imagination rollout at each step. Buckman et al. (2018) expanded MVE algorithm by proposing Stochastic Ensemble Value Expansion (STEVE), to generate a solution more robust to model uncertainty. Dalal et al. (2018) proposed safe exploration by modeling constraints using a linear model and applied Lagrangian optimization to modify the action in order to guarantee safety. In this work, we also used Lagrangian optimization for short-term constraints. However, our approach is different in two ways: 1) our method does not modify the RL action to achieve the goals. Instead, it derives an action by considering both long-term goals and short-term constraints. This is possible because our algorithm uses a locally linear model to represent the advantage function. 2) Unlike safe exploration, the focus of this paper is in handling new constraints in the application phase without retraining the model. + +![](images/b82b396d59bfd31958a77114738f196a9d6d79f3fbff5dc83b2bf7604e331db8.jpg) +Figure 7: LLQL for the crane system. + +# B CRANE CONTROL SYSTEM + +Gantry cranes are widely used in industrial production lines and construction projects for transferring heavy and hazardous materials. The objective of the crane system is to convey the payload from the start position to the destination position as soon as possible while keeping the payload sway at the destination minimum. Higher traveling speed improves the efficiency and reduces costs. However, excessive movements at the destination wastes time and energy and can lead to accidents. To move the payload as fast as possible and stop the sway at the destination, skillful operators are required. Labor shortage in industries, and risk of human error, have motivated us to develop an automated solution for crane control. The crane dynamic system is highly nonlinear. Traditional nonlinear control techniques such as sliding control (Bartolini et al., 2002) and adaptive control (Boustany & d’Andrea Novel, 1992) have been applied to these systems. These methods require detailed mathematical model of the system and its environment, which can be complicated and expensive to derive. When a simulator is available for a crane system, RL algorithms can provide a compelling alternative to traditional control methodologies. This is the case in many industries, where for intellectual property concerns the companies are willing to provide simulators to the costumers but refuse to reveal mathematical models of their products. + +Our crane simulator provides us six state variables: 1) trolley location, $x _ { t r o l l e y } \ 2$ ) trolley velocity, $v _ { t r o l l e y }$ , 3) payload angle, $\phi _ { p a y l o a d }$ , 4) payload angular velocity, $\omega _ { p a y l o a d } , 5$ ) payload horizontal location, $x _ { p a y l o a d }$ , and 6) payload vertical location, $y _ { p a y l o a d }$ . The only action is the force applied to the trolley, $\boldsymbol { u } _ { t r o l l e y }$ . The overall goal is to reach the final destination $x _ { p d }$ and $y _ { p d }$ in the shortest time possible. We choose the following reward function to learn a policy to do so. + +$$ +r _ { k } = \left\{ \begin{array} { l l } { 5 0 0 } & { \mathrm { i f ~ } | x _ { p a y l o a d } ( k ) - x _ { p d } | < \epsilon \& | y _ { p a y l o a d } ( k ) - y _ { p d } | < \epsilon } \\ { - 1 } & { \mathrm { o t h e r w i s e , } } \end{array} \right. +$$ + +where $\epsilon$ is a small constant. Figure 7b shows that our learned policy pushes the trolley with maximum force, $u _ { t r o l l e y }$ is eqaual 1 for the entire episode, till the payload reaches the goal $x _ { p d } = 6 , y _ { p d } = 1 0$ . + +In additional to the long-term goal, our short-term goal is to minimize the object’s sway when it reaches to the final destination. Instead of designing complicated reward functions to achieve minimum travel time and minimum sway, we consider $\omega _ { p a y l o a d } = \mathrm { 0 }$ at the final destination as a short-term desired trajectory. We consider the following hybrid strategy to reach the final destination with close to zero sway. + +$$ +u _ { t r o l l e y } = \left\{ \begin{array} { l l } { \mathrm { u s e ~ e q u a t i o n ~ ( 1 6 ) } } & { \mathrm { i f ~ } x _ { p a y l o a d } < 5 . 5 } \\ { \mathrm { u s e ~ e q u a t i o n ~ ( 1 8 ) , } } & { \mathrm { o t h e r w i s e } } \end{array} \right. +$$ + +![](images/6f131f40bf814ed4a722ec5deb9e173903781eb361045bf867d8d6f6056476f8.jpg) +Figure 8 shows that our strategy can reach the destination with close to zero swing. +Figure 8: State variables for the crane system with required short-term trajectory, $\omega _ { p a y l o a d } = 0$ . The final error is 0.0001. The crane reaches the goal in 12.5s. $\gamma _ { 1 } = 1$ , $\gamma _ { 2 } = 1 0 0 0$ . + +# C DERIVATION DETAILS FOR SHORT-TERM CONSTRAINTS + +Consider equation (19). Substituting our estimation of the next step from equation (14) in (19), we have + +$$ +\operatorname* { m i n } _ { \mathrm { f i n d } u _ { k } } \frac { 1 } { 2 } ( h _ { k } + d _ { k } u _ { k } ) ^ { 2 } +$$ + +such that: + +$$ +x _ { k } ^ { i } + \Delta ( f _ { k } ^ { i } + g _ { k } ^ { i } u _ { k } ) \leq c _ { k + 1 } ^ { i } +$$ + +Using Lagrangian method at each time step $k$ , we have + +$$ +\begin{array} { l } { { { \displaystyle { \cal L } ( u _ { k } , \lambda ) = \frac { 1 } { 2 } ( h _ { k } + d _ { k } u _ { k } ) ^ { 2 } + } } } \\ { { \lambda ( x _ { k } ^ { i } + \Delta ( f _ { k } ^ { i } + g _ { k } ^ { i } u _ { k } ) - c _ { k + 1 } ^ { i } ) } } \end{array} +$$ + +Taking the gradient of $L$ with respect to $u _ { k }$ , we can write the Karush-Kuhn-Tucker (KKT) (Kuhn & Tucker, 2014) conditions for optimal solution of equation (25), $\{ u _ { k } ^ { * } , \lambda ^ { * } \}$ as: + +$$ +\begin{array} { l } { { ( h _ { k } + d _ { k } u _ { k } ^ { * } ) d _ { k } + \lambda ^ { * } \Delta g _ { k } ^ { i } = 0 } } \\ { { \lambda ^ { * } ( x _ { k } ^ { i } + \Delta ( f _ { k } ^ { i } + g _ { k } ^ { i } u _ { k } ^ { * } ) - c _ { k + 1 } ) = 0 } } \end{array} +$$ + +With this assumption, we can show + +$$ +\boldsymbol { u } _ { k } ^ { \ast } = - ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } d _ { k } ^ { T } ( h _ { k } + \lambda ^ { \ast } \Delta g _ { k } ^ { i } d _ { k } ^ { T } ( d _ { k } d _ { k } ^ { T } ) ^ { - 1 } ) +$$ + +Note that when there is no constraint: $\lambda ^ { * } = 0$ , we have $\boldsymbol { u } _ { k } ^ { * } = - ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } d _ { k } ^ { T } \boldsymbol { h } _ { k }$ . This is exactly the input we computed in equation (16). When $\lambda ^ { * } \neq 0$ , we have + +$$ +x _ { k } ^ { i } + \Delta ( f _ { k } ^ { i } + g _ { k } ^ { i } u _ { k } ^ { * } ) - c _ { k + 1 } = 0 +$$ + +We define $\alpha _ { 1 } = \Delta g _ { k } ^ { i } d _ { k } ^ { T } ( d _ { k } d _ { k } ^ { T } ) ^ { - 1 }$ , and $\alpha _ { 2 } = \Delta g _ { k } ^ { i } ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } d _ { k } ^ { T }$ . $\alpha _ { 1 }$ and $\alpha _ { 2 }$ are scalar. Substituting $u _ { k } ^ { * }$ from equation (28) in equation (29) we have + +$$ +x _ { k } ^ { i } + \Delta f _ { k } ^ { i } - \alpha _ { 2 } ( h _ { k } + \alpha _ { 1 } \lambda ^ { * } ) - c _ { k + 1 } = 0 +$$ + +Therefore, + +$$ +\begin{array} { r l } & { \lambda ^ { * } = \frac { x _ { k } ^ { i } + \Delta f _ { k } ^ { i } - c _ { k + 1 } - \alpha _ { 2 } h _ { k } } { \alpha _ { 1 } \alpha _ { 2 } } } \\ & { u _ { k } ^ { * } = - ( d _ { k } ^ { T } d _ { k } ) ^ { - 1 } d _ { k } ^ { T } ( h _ { k } + \lambda ^ { * } \alpha _ { 1 } ) . } \end{array} +$$ + +# D NETWORKS PARAMETERS + +We used the following network structures and parameters in the experimental studies. + +LLQL for MountainCarContinuous: $h , d , V$ , $f$ and $g$ networks each has two hidden layers with 200 neurons in each layer. All the activation functions are Rectified Linear Units (ReLUs). Each episode is maximum 1000 steps. The number of iterations for short-term and long-term prediction model: $I _ { s } = I _ { l } = 5$ . The learning rate for the long-term prediction model is 0.001. The batch size for this model is 10. The discount rate $\gamma = 0 . 9 9 9$ . The target model update rate, $\tau = 0 . 0 0 1$ . The learning rate for the short-term prediction model is 0.001 for the first 20000 steps and then reduces to 0.0001. $\Delta = 0 . 0 0 1$ . The batch size for this model is 100. + +LLQL for the crane system: $h , d , V$ , $f$ and $g$ networks each has two hidden layers with 200 neurons in each layer. All the activation functions are ReLUs. Each episode includes maximum 1000 actions. The number of iterations for short-term and long-term prediction model: $I _ { s } = I _ { l } = 5$ . The learning rate for the long-term prediction model is 0.001. The batch size for this model is 10. The discount rate $\gamma = 0 . 9 9 9$ . The target model update rate, $\tau = 0 . 0 0 1$ . The learning rate for the short-term prediction model is 0.01 for the first 20000 steps and then reduces to 0.001. $\Delta = 0 . 0 0 1$ . The batch size for this model is 200. + +DDPG networks with modified reward functions: The Q-network, and the deterministic policy network each has two hidden layers with 200 neurons. All the activation functions are ReLUs. The learning rate for the Q-network is 0.00001, and the learning rate for the deterministic policy network is 0.000001. The discount rate $\gamma = 0 . 9 9$ . The batch size is 8. The target model update rate for both networks is 0.1. + +In all the networks we shift and scale the state variables to zero mean and unit standard deviation for a better learning. For exploration, we add an additive normal noise to the action: + +$$ +u ( k ) = ( 1 - \alpha _ { N } ) u ( k ) ^ { * } + \alpha _ { N } { \mathcal { N } } , +$$ + +where $u ( k ) ^ { * }$ represents the optimum action generated by LLQL or DDPG, and $\mathcal { N } = U ( - 1 , 1 )$ is a continuous uniform random variable. We consider $\alpha _ { N } = 0 . 0 5$ in the beginning, and $\alpha _ { N } = . 9 9 \times \alpha _ { N }$ after each episode with positive cumulative rewards. + +# E MODEL-BASED REINFORCEMENT LEARNING + +Nagabandi et al. (2018) proposed a model-based RL based on MPC. Their approach uses the system dynamic model $^ +$ reward function to generate a sequence of actions that maximize the cumulative reward. To represent the effect of short-term and long-term predictive models in our algorithm, we present a modified version of (Nagabandi et al., 2018) algorithm using our short-term predictive model, $f$ and $g$ in equation (14). The model based RL uses the learned dynamic model, $f$ and $g$ networks, and generates a sequence of actions $U _ { k } ^ { H } = ( u _ { k } , . . . , u _ { k + H - 1 } )$ to maximize reward over a finite horizon, $H$ . + +$$ +\begin{array} { l } { { \displaystyle U _ { k } ^ { H } = \arg \operatorname* { m a x } \sum _ { i = k } ^ { k + H - 1 } r ( \hat { x } _ { i } , u _ { i } ) , } } \\ { { \mathrm { s u c h ~ t h a t : ~ } \hat { x } _ { k } = x _ { k } \mathrm { ~ a n d ~ } \hat { x } _ { i + 1 } = \hat { x } _ { i } + \Delta ( f ( \hat { x } _ { i } | \theta ^ { f } ) + g ( \hat { x } _ { i } | \theta ^ { g } ) u _ { i } ) } } \end{array} +$$ + +Solving equation (33) for the exact solution is computationally expensive. Therefore, Nagabandi et al. (2018) applied a simple random sampling method and select the candidate action sequence with the highest expected cumulative reward. In this work, we apply the same method to solve equation (33). We set $H = 2 5$ and select 10000 samples at each step. Following the MPC closedloop control framework, the algorithm only executes the first action in the sequence and calculate a new sequence in the next step. Algorithm 2 presents the model-based RL. + +# Algorithm 2 Model-based Reinforcement Learning (Nagabandi et al., 2018) + +1: Initialize $f$ ang $g$ networks (equation (14)) with random weights. +2: Create dataset of random trajectories $R _ { r a n d }$ . +3: Create the reply buffer $R _ { r l } = \emptyset$ . +4: for episode $= 1 { : } \mathbf { M }$ do +5: Randomly select a mini-batch of $N _ { s }$ transition from $R _ { r a n d }$ and $R _ { r l }$ . +6: Update $\theta ^ { f }$ and $\theta ^ { g }$ by minimizing the loss: $\begin{array} { r } { L _ { 1 } = \frac { 1 } { N _ { s } } \sum _ { i = 1 } ^ { N _ { s } } | | x _ { i + 1 } - x _ { i } - \Delta ( f ( x _ { i } | \theta ^ { f } ) + g ( x _ { i } | \theta ^ { g } ) u _ { i } ) | | . } \end{array}$ . +7: for $\mathrm { k } = 1 { : } \mathrm { T }$ do +8: Solve equation (33) for the optimum sequence $U _ { k } ^ { H }$ at state $x _ { k }$ . +9: Executes the first action in the sequence, $u _ { k }$ . +10: Store transition $\left( { { x } _ { k } } , { { u } _ { k } } , { { x } _ { k + 1 } } , { { r } _ { k } } \right)$ in $R _ { r l }$ . \ No newline at end of file diff --git a/md/train/SJx0q1rtvS/SJx0q1rtvS.md b/md/train/SJx0q1rtvS/SJx0q1rtvS.md new file mode 100644 index 0000000000000000000000000000000000000000..0ded5d9f93f040485640536c4daef84b1b6ed221 --- /dev/null +++ b/md/train/SJx0q1rtvS/SJx0q1rtvS.md @@ -0,0 +1,401 @@ +# ROBUST ANOMALY DETECTION AND BACKDOOR ATTACK DETECTION VIA DIFFERENTIAL PRIVACY + +Min Du, Ruoxi Jia, Dawn Song +University of California, Berkeley +{min.du,ruoxijia,dawnsong}@berkeley.edu + +# ABSTRACT + +Outlier detection and novelty detection are two important topics for anomaly detection. Suppose the majority of a dataset are drawn from a certain distribution, outlier detection and novelty detection both aim to detect data samples that do not fit the distribution. Outliers refer to data samples within this dataset, while novelties refer to new samples. In the meantime, backdoor poisoning attacks for machine learning models are achieved through injecting poisoning samples into the training dataset, which could be regarded as “outliers” that are intentionally added by attackers. Differential privacy has been proposed to avoid leaking any individual’s information, when aggregated analysis is performed on a given dataset. It is typically achieved by adding random noise, either directly to the input dataset, or to intermediate results of the aggregation mechanism. In this paper, we demonstrate that applying differential privacy can improve the utility of outlier detection and novelty detection, with an extension to detect poisoning samples in backdoor attacks. We first present a theoretical analysis on how differential privacy helps with the detection, and then conduct extensive experiments to validate the effectiveness of differential privacy in improving outlier detection, novelty detection, and backdoor attack detection. + +# 1 INTRODUCTION + +Given a dataset where most of the samples are from a certain distribution, outlier detection aims to detect the minorities in the dataset that are far from the distribution, while the goal of novelty detection is to detect newly observed data samples that do not fit the distribution. On the other hand, poisoning examples that are intentionally added by attackers to achieve backdoor attacks could be treated as one type of “outliers” in the training dataset. Using machine learning for outlier/novelty detection is typically to train a model that learns the distribution where the training data samples are drawn from, and the final trained model could give a high anomaly score for the outliers/novelties that deviate from the same distribution. In both cases, the machine learning model is not supposed to learn from the outliers in the training dataset. Unfortunately, deep learning models that contain millions of parameters tend to remember too much (Song et al. [2017]), and can easily overfit to rare training samples (Carlini et al. [2018]). + +Protecting data privacy has been a major concern in many applications, because sensitive data are being collected and analyzed. Differential privacy has been proposed to “hide” certain input data from the output; that is, by looking at the statistical results calculated from input data, one cannot tell whether the input data contain a certain record or not. The way of applying differential privacy is to add random noise to the input data or the data analysis procedure, such that the output difference caused by the input difference can be hidden by the noise. A known fact is that differential privacy implies stability (Kasiviswanathan et al. [2011]). Particularly, a differentially private learning algorithm is stable in the sense that the model learned by the algorithm is insensitive to the removal or replacement of an arbitrary point in the training dataset (Bousquet & Elisseeff [2002]). When the training dataset contains a handful of outliers, the output model of a stable learning algorithm should be close to the one trained on the clean portion of the training set. Intuitively, compared with the model trained on contaminated dataset, the one trained on clean data could be better at distinguishing outliers from normal data. Therefore, differential privacy can potentially be leveraged to improve the identification of outliers. This motivates us to apply differential privacy to anomaly detection and defense against backdoor attacks. + +Our contribution. First, we present a theoretical explanation on why differential privacy can help to detect outliers from a training and testing dataset, as well as an analysis on the relationship between the number of outliers to detect and the amount of random noise to apply. Second, to demonstrate the effectiveness, we apply differential privacy to an autoencoder network trained on a constructed MNIST dataset with injected outliers, for both outlier detection and novelty detection, to show how much the utility could be improved with different amount of outliers and noise. Third, we apply differential privacy to a real-world task - Hadoop file system log anomaly detection. System log anomaly detection is an important topic in computer security. Our proposed method greatly improves upon the state-of-the-art system in this field. The results indicate that differential privacy is able to eliminate almost all the false negatives, and achieve significantly improved overall utility, compared with the current state-of-the-art work DeepLog (Du et al. [2017]). Finally, via a proof-of-concept experiment using MNIST dataset with injected poisoning samples, we show that the idea of outlier detection could be extended to backdoor attack detection, and that differential privacy is able to further improve the performance. + +# 2 PRELIMINARY + +Given an input dataset and an aggregation mechanism, differential privacy (Dwork [2011]) aims to output the requested aggregation results, which are guaranteed not to reveal the participation of any individual data record. Formally, differential privacy is defined as below: + +Definition 1 (Differential privacy). A randomized mechanism $\mathcal { M }$ applied to data domain $\mathbb { D }$ is said to be $( \epsilon , \delta )$ -differentially private if for any adjacent datasets $d$ , $d ^ { \prime }$ in $\mathbb { D }$ , and any subset of outputs $S \subseteq R a n g e ( { \mathcal { M } } )$ , it holds that + +$$ +\mathrm { P r } [ \mathcal { M } ( d ) \in \mathcal { S } ] \leq e ^ { \epsilon } \mathrm { P r } [ \mathcal { M } ( d ^ { \prime } ) \in \mathcal { S } ] + \delta , +$$ + +where $\epsilon$ stands for the privacy bound, and $\delta$ stands for the probability to break this bound. + +The adjacent datasets $d , d ^ { \prime }$ could be understood as two databases, where only one record differs, i.e., $\| \ b { d } - \ b { d } ^ { \prime } \| _ { 1 } = 1$ . Differential privacy guarantees that the difference between $d$ and $d ^ { \prime }$ are not revealed through inspecting the outputs $\mathcal M ( d )$ and $\mathcal { M } ( d ^ { \prime } )$ . Clearly, the closer $\epsilon$ is to 0, the more indistinguishable $\mathcal M ( d )$ and ${ \mathcal { M } } ( d ^ { \prime } )$ are, and hence the stronger the privacy guarantee is. + +A common approach to enforcing differential privacy for a function $f : \mathbb { D } \to \mathbb { R }$ , is to add random Gaussian noise ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ to perturb the output in $\mathbb { R }$ . The intuition is that, for given adjacent datasets $d$ and $d ^ { \prime }$ , one cannot tell whether the difference between $f ( d )$ and $f ( d ^ { \prime } )$ is incurred by the single record that differs in $d$ and $d ^ { \prime }$ , or by the random noise being applied. The magnitude of Gaussian noise needs to be tailored to the maximum difference between $f ( d )$ and $f ( d ^ { \prime } )$ , which is formally defined as $\mathcal { L } _ { 2 }$ -sensitivity. + +Definition 2 ( $\mathcal { L } _ { 2 }$ -sensitivity). The $\mathcal { L } _ { 2 }$ -sensitivity for a function $f : \mathbb { D } \to \mathbb { R }$ is: + +$$ +\Delta = \operatorname* { m a x } _ { \begin{array} { c } { d , d ^ { \prime } \in \mathbb { D } } \\ { \| d - d ^ { \prime } \| _ { 1 } = 1 } \end{array} } \| f ( d ) - f ( d ^ { \prime } ) \| _ { 2 } +$$ + +The noise scale $\sigma$ to apply can be calculated as below (Dwork et al. [2014]). + +Theorem 1. To perturb a function with sensitivity $\Delta$ under $( \epsilon , \delta )$ - differential privacy, the minimum noise scale σ of Gaussian mechanism is given by: $\begin{array} { r } { \sigma = \frac { \Delta } { \epsilon } \cdot \sqrt { 2 \ln \frac { 1 . 2 5 } { \delta } } } \end{array}$ , where $\epsilon \in ( 0 , 1 )$ . + +Deep learning with differential privacy (Abadi et al. [2016]) The procedure of deep learning model training is to minimize the output of a loss function, through numerous stochastic gradient descent (SGD) steps. Abadi et al. [2016] proposed a differentially private SGD algorithm that works as follows. At each SGD step, a fixed number of randomly selected training samples are used as a mini batch. For each mini batch training, the following two operations are performed to enforce differential privacy: 1) clip the norm of the gradient for each example, with a clipping bound $C$ , to limit the sensitivity of gradient; 2) sum the clipped per-example gradients and add Gaussian noise ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ , before updating the model parameters. Abadi et al. [2016] further proposed a moment accounting mechanism which calculates the aggregate privacy bound when performing SGD for multiple steps. Differential privacy is immune to post-processing. Therefore, the output of the trained model for any queries enjoys the same privacy guarantee as the above SGD-based training process. + +# 3 THE CONNECTION BETWEEN DIFFERENTIAL PRIVACY AND OUTLIERDETECTION + +By definition, random noise added into model training for differential privacy hides the influence of a single record on the learned model. Intuitively, if applying differential privacy to the training process, the contribution of rare training examples will be hidden by random noise, resulting in a model that underfits the outliers. Such model will facilitate novelty and outlier detection because it will be less confident in predicting the atypical examples. In this section, we first present a theorem to precisely characterize the above intuition, and then analyze the relationship between the number of outliers in the training dataset and the amount of noise to apply. + +Notations Let $\mathcal { Z }$ be the sample space and $\mathcal { H }$ be the hypothesis space. The loss function $l : \mathcal { H } \times \mathcal { Z } $ $\mathbb { R }$ measures how well the hypothesis $h \in \mathcal H$ explains a data instance $z \in { \mathcal { Z } }$ . A learning algorithm $\mathcal { A } : \mathcal { Z } ^ { n } \to \mathcal { H }$ learns some hypothesis $\boldsymbol { \mathcal { A } } ( \boldsymbol { S } )$ given a set $S$ of $n$ samples. For instance, in supervised learning problems, ${ \mathcal { Z } } = { \mathcal { X } } \times { \mathcal { Y } }$ , where $\mathcal { X }$ is the feature space and $\mathcal { V }$ is the label space; $\mathcal { H }$ is a collection of models $h : \mathcal { X } \mathcal { Y }$ ; and $l ( h , z )$ measures how well $h$ predicts the feature-label relationship $z = ( x , y )$ . + +Let $S = \{ z _ { 1 } , \ldots , z _ { n } \}$ be a set of independent samples drawn from an unknown distribution $\mathcal { D }$ on $\mathcal { Z }$ For a given distribution $\mathcal { D }$ , an oracle hypothesis is the one that minimizes the expected loss: + +$$ +\begin{array} { r } { h ^ { * } = \arg \underset { h } { \operatorname* { m i n } } \mathbb { E } _ { z \sim \mathcal { D } } [ l ( h , z ) ] } \end{array} +$$ + +We define an outlier as a data instance that has significantly different loss from the population under the oracle hypothesis. + +Definition 3. We say $\tilde { z }$ is an outlier with regard to distribution $\mathcal { D }$ if + +$$ +l ( h ^ { * } , \tilde { z } ) - \mathbb { E } _ { z \sim \mathcal { D } } [ l ( h ^ { * } , z ) ] \ge T +$$ + +where $T$ is a constant that depends only on $\mathcal { D }$ . + +We will prove the usefulness of differential privacy to detect outliers for the classes of learning algorithms that produce hypotheses converging to the optimal hypothesis asymptotically pointwise. We define such learning algorithms to be uniformly asymptotic empirical risk minimization (UAERM). + +Definition 4. A (possibly randomized) learning algorithm $\mathcal { A }$ is UAERM with rate $\xi ( n , A )$ if for any distribution $\mathcal { D }$ defined on the domain $\mathcal { Z }$ , it holds that + +$$ +\begin{array} { r l r } { \forall z } & { { } } & { \left| \mathbb { E } _ { S \sim \mathcal { D } ^ { n } } \mathbb { E } _ { h \sim A ( S ) } l ( h , z ) - l ( h ^ { * } , z ) \right| \le \xi ( n , \mathcal { A } ) } \end{array} +$$ + +In the definition, we make it explicit that the rate $\xi ( n , A )$ depends on the learning algorithm $\mathcal { A }$ . For instance, if $\mathcal { A }$ is a differentially private learning algorithm, the rate will depend on the privacy parameters. In that case, with slight abuse of notation, we will denote the rate for a $( \epsilon , \delta )$ -differentially private learning algorithm trained on $n$ data instances by $\xi ( n , \epsilon , \delta )$ . + +Due to the nonconvexity of their loss functions, neural networks may not enjoy a useful, tight characterization of the learning rate. Thus, we will empirically verify that using noisy SGD to learn differentially private neural networks is UAERM. Moreover, as we will show in the experiment, $\xi ( n , \epsilon , \delta )$ grows as privacy parameters $\epsilon$ and $\delta$ become smaller. Intuitively, this is because larger noise is required to ensure stronger privacy guarantees, which, on the other hand, slows down the convergence of the learning algorithm. + +Without loss of generality, we assume that $0 \leq l ( h , z ) \leq 1$ . The following theorem exhibits how the prediction performance of differentially private models on normal data will differ from outliers and connects the difference to the privacy parameters of the learning algorithm and the amount of outliers in the training data. + +Theorem 2. Suppose that a learning algorithm $\mathcal { A }$ is $( \epsilon , \delta )$ -differentially private and UAERM with the rate $\xi ( n , \epsilon , \delta )$ . Let $S ^ { \prime } = S \cup U$ , where $S \sim \mathcal { D } ^ { n }$ and $U$ contains c arbitrary outliers. Then + +$$ +\begin{array} { r l } & { \mathbb { E } _ { h \sim \mathcal { A } ( S ^ { \prime } ) } l ( h , \tilde { z } ) - \mathbb { E } _ { h \sim A ( S ^ { \prime } ) } \mathbb { E } _ { z \sim \mathcal { D } } l ( h , z ) } \\ & { \qquad \geq T - 2 \bigg ( \xi ( n , \epsilon , \delta ) + \sqrt { \frac { n ( e ^ { \epsilon } - 1 + \delta ) ^ { 2 } } { 2 } \log { \frac { 2 } { \gamma } } } + e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \delta \bigg ) } \end{array} +$$ + +with probability at least $1 - \gamma$ . + +The two terms in the left-hand side of (4) represent the model’s prediction loss on outliers and normal test data drawn from $\mathcal { D }$ , respectively. Due to the stochasticity of differentially private learning algorithms, the difference is characterized by the expectation taken over the randomness of the learned models. The theorem establishes a lower bound on the prediction performance difference between normal and outlier data. A larger difference indicates that identifying outliers will be easier. + +The impact of privacy parameters on the lower bound manifests itself in two aspects. On one hand, stronger privacy guarantees (i.e., smaller $\epsilon$ and $\delta$ ) will require higher noise to be added into the training process, which increases the learning rate $\xi ( n , \epsilon , \delta )$ . On the other hand, increasing privacy level will improve the stability of the learning algorithm; the resulting models tend to ignore the outliers in the training set and become closer to the ones trained on completely clean data, thus making the outlier detection more effective. The second aspect is embodied by the fact that the terms except $\xi ( n , \epsilon , \delta )$ in the parenthesis of the lower bound grow with $\epsilon$ and $\delta$ . Therefore, the privacy parameters cannot be too large or too small in order to ensure optimal anomaly detection performance. + +Moreover, the relationship between the right-hand side of (4) and $c$ indicates that the anomaly detection problem will be more difficult with more outliers in the training set. Dissecting the righthand side of (4), we further observe that $c$ appears always in tandem with $\epsilon$ . This implies that for larger number of outliers in the training set (i.e., $c$ is larger), we will need to tune down $\epsilon$ and $\delta$ to maintain the same novelty detection performance. + +Last but not least, the definition of outliers in our paper is quite general—it does not make any assumptions about how the outliers are generated. Also, we do not make assumptions about whether these outliers are in training or test data. Therefore, our analysis can shed light on detecting various types of anomalies, including but not limited to outlier/novelty detection, backdoor detection, and noisy label detection. In the following experimental section, we will focus our evaluation on outlier/novelty detection and defense against backdoor attacks. + +# 4 EXPERIMENTS + +This section empirically evaluates the effectiveness of differential privacy in improving anomaly detection and backdoor attack detection. We call an outlier/novelty or a poisoning example as a positive, and other normal data samples as negatives. The metrics measured by each experiment include: false positive (FP), false negative (FN), Precision $=$ TP / $( \mathrm { T P + F P } )$ , Recall $=$ TP / $( \mathrm { T P + F N } )$ , Area under the receiver operating characteristic curve (AUROC) which is the area under the TPRFPR curve, Area under the Precision - Recall curve (AUPR) which summarizes the Precision - Recall curve, as well as F-measure $= 2 \times$ Precision $\times$ Recall / ( Precision $^ +$ Recall ). The detailed explanations of all these measures could be found in (Wikipedia [2019b;a]; scikit-learn [2017a;b]). + +# 4.1 OUTLIER DETECTION AND NOVELTY DETECTION WITH AUTOENCODERS + +Autoencoder is a type of neural network that has been widely used for outlier detection and novelty detection. It contains an encoder network which reduces the dimension of the input data, and a decoder network which aims to reconstruct the input. Hence, the learning goal of autoencoders is to minimize the reconstruction error, which is consequently the loss function. Because the dimensionality reduction brings information loss, and the learning goal encourages to preserve the information that is common to most training samples, outliers that contain rare information could be identified by measuring model loss. In this section, with a varying amount of outliers and noise scale, we show how differential privacy would improve the utility of anomaly detection with autoencoders. + +Datasets. We utilize MNIST dataset composed by handwritten digits 0-9, and notMNIST dataset (Kaggle [2017]), which contains letters A-J with different fonts. The original MNIST data contain 60, 000 training images, and 10, 000 test images, which we refer to as MNIST-train and MNIST-test respectively. The notMNIST data contain $1 0 , 0 0 0$ training images and 1, 000 test images, denoted as notMNIST-train and notMNIST-test. Based on these datasets, we intentionally construct training datasets with varying amount of injected outliers. Specifically, each training dataset is constructed with a particular outlier ratio $r _ { o }$ , such that the resulted dataset MNIST-OD-train $( r _ { o } )$ contains 60, 000 images in total, where a percentage of $1 - r _ { o }$ are from MNIST-train, and $r _ { o }$ are from notMNIST-train. For each training dataset MNIST-OD-train $( r _ { o } )$ , a set of autoencoder models are trained with varying noise scale $\sigma$ applied for differential privacy. For an autoencoder model trained on dataset MNISTOD-train $( r _ { o } )$ , outlier detection is thus to detect the $r _ { o } \times 6 0$ , 000 outliers from MNIST-OD-train $( r _ { o } )$ . For novelty detection, we further construct a test dataset MNIST-ND-test, which is composed by the entire MNIST-test dataset and notMNIST-test dataset, a total of 11, 000 images. The goal of novelty detection is to identify the 1, 000 notMNIST-test images as novelties. + +Evaluation metrics. To check whether a data sample is an outlier/novelty using autoencoders, the standard practice is to set a loss threshold based on training statistics, and any sample having a loss above this threshold is an outlier/novelty. To measure the performance under different thresholds, we use the AUPR score which is a threshold-independent metric. Compared with other metrics such as the AUROC score, the AUPR score is more informative when the positive/negative classes are highly unbalanced, e.g., for outlier detection where the ratio of outliers is extremely low. More experiment settings with both AUPR and AUROC metrics are in appendix which present similar observations. + +Set-up. For autoencoders, the encoder network contains 3 convolutional layers with max pooling, while the decoder network contains 3 corresponding upsampling layers. For differential privacy, we use a clipping bound $C = 1$ and $\delta = 1 0 ^ { - 5 }$ , and vary the noise scale $\sigma$ as in (Abadi et al. [2016]). All models are trained with a learning rate of 0.15, a mini-batch size of 200 and for a total of 60 epochs. + +![](images/48b1fe12b709bb92f2dfaf1409e45a322ade217154ea4d9c0f065b937769e29b.jpg) +Figure 1: The largest test sample loss between a differentially private model trained on a random subset of training data and the oracle hypothesis. + +Table 1: AUPR scores for outlier detection (OD) and novelty detection (ND). $\sigma = 0$ indicates applying clipping bound only. + +
noisescaleσ= outlier percentage in training data r。
0.1%0.5%5%10%
ODNDODNDODNDODND
N/A99.9299.7792.1298.8184.3388.1872.1668.14
099.8999.8398.399.6983.8687.9177.874.74
0.0110099.9794.9299.2390.7993.3485.4184.07
0.110099.8598.4499.6692.2394.2185.5683.98
110099.7898.2899.6794.9296.8781.8780.12
599.8799.4998.5199.5296.7898.0495.2595.41
1090.2497.7791.8898.296.698.297.0797.46
Below g value is too big such that the model does not converge well.
50 65.9492.1370.34 90.886.5891.5988.4990.27
+ +Validation of UAERM for Noisy SGD. To begin with, we first conduct experiments to empirically validate our assumption in Theorem 2. While a rigorous verification of the assumption is intractable as it requires the knowledge of underlying data distribution and computing expected loss over randomness of both data distribution and differentially private algorithms, our experiments provide a sanity check of the assumption by replacing the expectation by the empirical average of a large number of data samples. For this set of experiments, we only utilize MNIST data for training, while the test dataset contains all available MNIST and notMNIST test samples. The oracle hypothesis is trained on all available training data, while each differentially private model is trained with varying privacy level $\epsilon$ , and training data size. For a fixed training set and $\epsilon$ , we perform training for multiple times to accommodate the randomness of differentially private training. Further, we train on multiple randomly selected training sets of the same size. We measure the loss of each resulting model on the test set, and calculate the average testing loss across different runs of differentially private training and different randomly selected training sets of the same size. We then compute the largest difference between the averaged test loss and the test loss associated with the oracle hypothesis. The results are shown in Figure 1. Each data point in the figure is an average of 9 differentially private models trained on 3 randomly sampled subsets of the training data, and 3 random training processes for each sampled subset. As in Figure 1, the larger the training data size, and the larger $\epsilon$ is, the closer of the randomized model to the oracle hypothesis, validating our assumption in Theorem 2 that noisy SGD is UAERM. + +Detection results Table 1 shows the outlier detection (OD) results on dataset MNIST-OD-train, as well as the novelty detection (ND) results on dataset MNIST-ND-test. OD mimics the unsupervised anomaly detection case. ND mimics the case where the autoencoder model is supposed to be trained on normal data, to detect unforeseen anomalies, while the training dataset is noisy. The first row where $\sigma { = } \mathrm { N } / \mathrm { A }$ is for the baseline model without differential privacy applied. It performs well when $r _ { o } = 0 . 1 \%$ , but drops significantly when $r _ { o }$ reaches $0 . 5 \%$ . That’s because for a mini-batch size of 200 that we use, an outlier ratio of $0 . 5 \%$ in training data results in an average of one outlier in each mini-batch, which could be learned by the baseline model. Note that the clipping bound $C { = } 1$ also restricts the contribution of outliers in SGD steps. We conduct an ablation study which only clips the per-example gradients with $C$ without adding any noise in each gradient descent step. The results are shown as $\sigma = 0$ in Table 1. As an intermediate step to bound the sensitivity in differential privacy, clipping itself is able to slightly improve the anomaly detection results in most cases. Still, we show that increasing the noise scale could further improve the utility. We highlight one of the best results in each column, and find that the trend follows our analysis in Theorem 2. Specifically, the more outliers in the training dataset, the larger noise scale is needed for the best improvement. As explained for (4), our theory shows that the privacy parameters cannot be too large or too small to ensure optimal anomaly detection performance, which coincides with the experimental results in Table 1. Although it could be challenging to select the desired noise level for training, we note that as shown in Table 1, applying differential privacy effectively improves the anomaly detection performance in most cases, except when $\sigma$ is too big to ruin the model parameters completely (e.g., $\sigma { = } 5 0$ ) . Therefore, it is generally safe and almost always helpful to apply a small amount of differential privacy noise for anomaly detection. The noise scale could be increased further as long as the model converges. However, it should be noted that applying differential privacy makes the model training much slower than the baseline. In our experience utilizing NVIDIA Tesla V100 SXM2 GPU cards, the training time for each epoch could be up to 80 times longer. Finally, a training data portion as high as $1 0 \%$ might not be “outliers”, but could be part of the input pattern that should be learned by the model. We show in this case, a relatively large noise scale could effectively improve the anomaly detection results (e.g., $\sigma { = } 1 0$ ), but it’s up to the requirement of the application whether to apply this. + +# 4.2 HADOOP FILE SYSTEM LOG ANOMALY DETECTION WITH LSTM + +In this section, we use a real-world example for Hadoop file system log anomaly detection, to show how anomaly detection with differential privacy outperforms the current state-of-the-art results. + +Dataset The Hadoop file system (HDFS) log dataset (Wei Xu [2009]) is generated through running Hadoop map-reduce jobs for 48 hours on 203 Amazon EC2 nodes. This dataset contains over 11 million log entries, which could be further grouped into 575, 059 block sessions by the block identifier each log has. Each block is associated with a normal/abnormal label provided by domain experts. Over the past decade this log dataset has been extensively used for research in system log anomaly detection $\mathrm { { X u } }$ et al. [2009]; Lou et al. [2010]; Du et al. [2017]). The state-of-the-art results are achieved by DeepLog (Du et al. [2017]), which we use as the baseline model. As in DeepLog, our training dataset contains 4, 855 normal block sessions, while the test dataset includes 553, 366 normal sessions and 16, 838 abnormal sessions. + +Baseline model and metrics DeepLog utilizes LSTM neural networks to learn system log sequences. Note that system log messages are textual logs, e.g., “Transaction A finished on server B.”. Before applying LSTM, a log parsing step first maps each log message into its corresponding log printing statement in the source code, e.g., “print(’Transaction %s finished on server $\% s . ^ { \prime \prime } \% ( x , y ) ) ^ { \prime \prime }$ Since there are only a constant number (e.g., $N$ ) of log printing statements in the source code, each one could be mapped to a discrete value from a fixed vocabulary set (e.g., having size $N$ ). With that, a block session of log messages could be parsed to a sequence of discrete values, e.g. $^ { \prime } 2 2 \ 5 \ 5 \ 5$ $1 I 9 1 I 9 1 I 9 2 6 2 6 \bar { 2 } 6 ^ { \circ }$ . Leveraging the fact that hidden execution paths written in source code restrict the possibilities of how one system log follows another, DeepLog trains an LSTM model on normal discrete sequences, which learns to predict the next discrete value given its history. In detection, the LSTM model predicts a probability distribution on all possible values that may appear at a given time step. The real executed value is detected as abnormal if it’s unlikely to happen based on LSTM prediction. The criteria presented in DeepLog is to first sort the predicted values based on the assigned probabilities, e.g., for a prediction ${ ^ { 4 * } } \langle 5 \colon 0 . 2 , 9 \colon 0 . 0 8 , I I \colon 0 . 0 I , 2 6 \colon 0 . 7 , . . . { \not \ldots } { ^ { \mathstrut } } \rangle ^ { , }$ , the order would be 26, 5, 9, 11, .... The given value to detect is checked against the sorted top $k$ predictions, and is detected as abnormal if it’s not one of them. For anomaly detection metrics, we want to highlight that applying differential privacy significantly reduces false negatives, without introducing many false positives. Therefore, we’ll focus on the comparison over the number of false positives and false negatives, while also presenting measurements that indicate the overall detection performance. + +![](images/e468da023ccfc73268b604720a8e8cf2b201f4548786ac7d6e2d65e7c0d28002.jpg) +Figure 2: Improvements by differential privacy for DeepLog. + +Set up For the baseline model DeepLog, we train an LSTM model for 100 epochs, and use the final model as the anomaly detection model. The model related parameters are: 2 layers, 256 units per layer, 10 time steps, and a batch size of 256. We call the DeepLog model with differential privacy as $D e e p L o g + D P$ . For differential privacy, we use a clipping bound $C = 1$ , $\delta = 1 0 ^ { - 5 }$ , and vary the noise scale $\sigma$ . All other model related settings for DeepLog $\mathrm { \Phi + D P }$ are the same as DeepLog. + +Results Figure 2a shows the comparison of FP and FN under different thresholds $k$ , with the increase of noise scale $\sigma$ . For clarity, we only show the following two cases for baseline model DeepLog: $k = 1 0$ which has the maximum FP and the minimum FN , and $k = 1 8$ which has the minimum FP and the maximum FN . Note that y axis is plotted as log scale. It is clear that applying DP noise significantly reduces FN in all cases, from over a thousand in DeepLog, to hundreds or even zero in DeepLog+DP. Also, the larger noise being added, the more FN are reduced. Although more FP could be introduced in some cases, we note that in system anomaly detection, the merit of fewer false negatives in fact worth the cost of more false positives. Reported false positives could be further checked by system admin, and then fed into the model for incremental learning. However, a false negative may never be found out, until a more disastrous event occurs due to the un-discovery of it. + +The F-measure measurements are plotted in Figure 2b. For DeepLog model, F-measure ranges from $9 0 . 3 8 \%$ $k = 2 0$ ) to $9 3 . 8 1 \%$ $k = 1 0$ ). For DeepLog $+ \mathrm { D P } ,$ , the best F-measure scores include $9 6 . 2 9 \%$ $\sigma = 0 . 2 5$ , $k = 1 5$ ) and $9 6 . 2 8 \%$ , $\langle \sigma = 1$ , $k = 1 8$ ), which show clear improvements over DeepLog model. Note that the best FN and FP measurements reported in DeepLog (Du et al. [2017]) are 619 and 833 respectively, while DeepLog $\mathrm { \Omega , + D P }$ achieves $\mathrm { F N } { = } 3 8 3$ , $\mathrm { F P = } 7 6 2$ at the $\mathrm { F }$ -measure of $9 6 . 2 8 \%$ $\langle \sigma = 1$ , $k = 1 8$ ); and $\mathrm { F N } { = } 1 2 3$ , $\mathrm { F P = } 1 0 4 0$ at the $\mathrm { F }$ -measure of $9 6 . 2 9 \%$ $\sigma = 0 . 2 5$ , $k = 1 5$ ), showing its ability to significantly reduce false negatives without introducing many false positives. As shown in the figure, DeepLog performs better when $k$ is smaller, while DeepLog $+ \mathrm { D P }$ benefits from larger ks. This scenario could also be explained by the addition of differential privacy noise. Since the trained model does not overfit to outliers, it assigns to anomalies much lower probabilities, so that anomalies are ranked much lower than that in the DeepLog model. Meanwhile, normal execution logs are also possibly predicted with lower probabilities because of the uncertainty brought by the noise. As a result, the ideal threshold $k$ for DeepLog $+ \mathrm { D P }$ is higher than that of DeepLog. We also note that a large noise scale could hurt the overall performance, as shown by the downward trend when $\sigma$ increases from 1.75 to 2.0. + +# 4.3 BACKDOOR ATTACK DETECTION + +Since poisoning examples for backdoor attacks are essentially “outlier” training samples injected by attackers, this section conducts proof-of-concept experiments to examine whether measuring model loss as for outliers works to detect poisoning examples, and whether differential privacy is able to further improve the performance. This detection scenario is particularly useful for backdoor attacks injected in the crowdsourcing scenario, where the model trainer gathers training data from untrusted individuals. In this case, the model trainer does not have control over the data quality but does have control over the model training process. Our proposal of adding DP noise is useful for detecting backdoor attacks and training more robust models in such a scenario. + +Dataset and set up MNIST dataset as described in Section 4.1 is used in this set of experiments. We refer the original 60,000 training images as CLEAN-train and the 10,000 test images as CLEANtest. We construct the backdoor attacks as described in (Gu et al. [2017]), Section 3.1.2. Specifically, each poisoning example is generated by reversing 4 pixel values in the bottom right corner of a clean image having label $i$ , and assigning backdoor label $( i + 1 ) \% 1 0$ . From CLEAN-train, we randomly sample a poisoning ratio of $r _ { p }$ images to be poisoning examples, resulting in a poisoned training dataset POISONED-train $( r _ { p } )$ . To demonstrate the effectiveness of the poisoning attacks, we use the CLEAN-test dataset, as well as POISONED-test dataset which is constructed by poisoning all images in CLEAN-test. For image classification model, we use convolutional neural network (CNN) containing 2 convolutional layers with max pooling, and a softmax layer to output desired labels. The differentially private models are trained with the same configurations as in Section 4.1 unless otherwise noted. + +Metrics We first evaluate the effectiveness of the constructed backdoor attack. A successful backdoor attack should have high image classification accuracy on CLEAN-test, which we refer to as benign accuracy, as well as high accuracy on POISONED-test with poisoned labels, which indicates the success rate. To investigate whether measuring the classification model loss is able to detect poisoning examples, and whether differential privacy is able to improve the detection performance, we leverage metrics AUPR and AUROC as described at the beginning of Section 4. + +
noise scaledetection (AUPR/AUROC) and attack (benign accuracy/ success rate) performance
rp=0.5%rp=1% attackrp=5% detectionattack
σ=detectionattackdetection 27.02/95.2398.95 / 97.12
N/A73.01/99.2698.93 / 47.8514.85/78.8899.11/98.1
091.22/99.9297.66 / 0.2392.11/99.88 97.84 / 0.3595.33 /99.7997.46/ 0.3
0.00592.64 / 99.997.57 /0.1794.04/99.93 97.46/0.2894.76/99.7997.75/0.3
0.0192.24/99.9297.51/ 0.2594.03/99.9297.4/0.34 93.4/99.74 95.09/99.8397.55/0.31
0.0590.76/99.997.42/0.24 97.55 / 0.2595.11/99.94 94.85 / 99.9397.8 / 0.37 95.33 /99.8297.72/0.3 97.34/ 0.39
0.192.16 /99.9397.7 /0.28
+ +Table 2: Backdoor attack and detection results with varying poisoning ratio $r _ { p }$ (clipping bound $C = 1$ ). + +Results We first evaluate the backdoor attack effectiveness and the detection performance with varying poisoning ratio $r _ { p }$ , under different noise scale $\sigma$ , and fixed clipping bound $C = 1$ . The results are summarized in Table 2. $\sigma = \Nu / \mathrm { A }$ indicates classification models trained without differential privacy. Benign accuracy remains high on clean data. Backdoor success rate is only around half at a poisoning ratio of $0 . 5 \%$ , and shows successful $( 9 7 . 1 2 \%$ success rate) at a poisoning ratio of $1 \%$ . Detecting poisoning examples by measuring model loss shows some level of effectiveness when the poisoning ratio is low (e.g., $0 . 5 \%$ ). Furthermore, applying differential privacy to the model training process is able to significantly improve the detection performance. Similar as in Table 1, the higher the poisoning ratio, the larger the noise level (smaller $\dot { \epsilon }$ ) to achieve the best improvement. Another interesting observation is that, a differentially private model is naturally robust to backdoor attacks. As indicated in Table 2, differential privacy effectively limits the success of backdoor attacks, reducing the success rate below $0 . 5 \%$ in all cases. In comparison, the utility downgrade on benign accuracy is little. + +To further evaluate the applicability of using the same CNN model for both anomaly detection and image classification, seeking to co-optimize the performance of the model for both tasks, we collect measurements with varying clipping bound $C$ , and fixed noise scale $\sigma = 0 . 5$ , as a complement to Table 2. The results are summarized in Table 3. Note that a small $C$ may hurt model performance as more model parameters are clipped. When $C$ is greater than most parameter values, the effect of increasing $C$ is similar to that of increasing $\sigma$ (Abadi et al. [2016]). From Table 3, we can observe that the best model for anomaly detection could have a similar set of parameters with the best model for image classification. However, in general, as shown in Table 2, classification accuracy and robustness are often two conflicting desiderata; model trainers can tune the privacy parameter in order to meet the task-specific requirements for accuracy and robustness. + +
clippingdetection (AUPR /AUROC) and attack (benign accuracy / success rate) performance
bound C=rp=0.5% detectionrp=1% detectionattackrp=5% detectionattack
0.587.46/99.87attack 96.29/0.3190.78/99.8596.47/0.2695.62/99.7996.73/0.34
0.889.03/99.8597.13/0.3392.39/99.8997.11/ 0.3295.63 / 99.7997.4 /0.28
190/99.997.28/0.2293.46/99.9297.47 / 0.2595.37 /99.7997.34/ 0.3
290.85 / 99.8197.48/ 0.2493.49 / 99.9197.21/0.2693.26/99.7597.39/0.46
390.17/99.9397.29/0.388.05/99.8497.18/0.3389.51/99.5997.35/0.48
+ +Table 3: Backdoor attack and detection results with varying poisoning ratio $r _ { p }$ (noise scale $\sigma = 0 . 5$ ). + +# 5 RELATED WORK + +To the best of our knowledge, this paper is the first one that proposes to improve outlier/novelty detection with differential privacy, and further extends it to backdoor attack detection. Note that this is not the first work that combines outlier detection and differential privacy together. Okada et al. [2015] aim to preserve input data privacy while detecting outliers. The two tasks are contradicting in this case as the identification of outliers (part of input data) implies certain privacy leakage, so Okada et al. [2015] try to find a balance. In contrast, we focus on improving anomaly detection performance with differential privacy, which is only applied to the model training stage, but no privacy protection is provided for the input data in detection stage when the outliers are actually being detected. + +Outlier detection and novelty detection are closely related to each other and often addressed together (Hodge & Austin [2004]; scikit-learn [2017c]; Pedregosa et al. [2011]). Outlier detection is the process of identifying rare items in a dataset that significantly differ from the majority (Aggarwal & Yu [2001]), while novelty detection is to detect new observations that lie in the low density area of the existing dataset (Markou & Singh [2003a;b]). Previous work mostly achieves outlier detection using unsupervised learning methods (Zimek et al. [2012; 2014]; Campos et al. [2016]), while novelty detection typically assumes a normal dataset is available for training, and is realized by semi-supervised learning (Blanchard et al. [2010]; De Morsier et al. [2013]). In both cases, it involves summarizing a distribution that the majority of training data are drawn from. Traditional methods such as clustering (Duan et al. [2009]) and principal component analysis (PCA) (Xu et al. [2010]; Hoffmann [2007]) have been frequently used. In this paper, we leverage deep learning based detection methods including autoencoders (Gottschlich et al. [2017]) and LSTM (Du et al. [2017]) as the baselines, and further extend the idea of measuring model loss to backdoor attack detection. + +Proposed by Dwork [2008], differential privacy has been a powerful tool to protect input data privacy. Kasiviswanathan et al. [2011] show that differential privacy implies stability on the output statistical results. Further, Dwork et al. [2015] point out that the empirical average of the output of a differentially private algorithm on a random dataset is close to the true expectation with high probability. Differential privacy has been utilized to train machine learning models that are robust to adversarial examples (Phan et al. [2019]; Lecuyer et al. [2018]), and to bound the success of inference attacks (Yeom et al. [2018]). In this paper, we utilize the property of differential privacy to improve anomaly detection and privacy is ensured via the technique proposed in Abadi et al. [2016]. + +Lastly, we note that a recent paper by Bagdasaryan & Shmatikov [2019] showed that accuracy of differentially private models drops much more for the underrepresented classes and subgroups. Intrinsically, our paper exploited the same phenomenon to improve anomaly detection. Bagdasaryan & Shmatikov [2019] studied the phenomenon empirically, while our work provides a theoretical analysis, which, for the first time, precisely characterizes the dependence of the performance gap between the majority and the underrepresented group on the privacy parameters. Moreover, Bagdasaryan & Shmatikov [2019] mainly considered the implication of differential privacy to the fairness of machine learning models; by contrast, our paper focuses on anomaly detection and backdoor attacks and exhibits strong empirical evidence for the efficacy of differential privacy in these two application domains. + +# 6 CONCLUSION + +In this paper, inspired by the fact that differential privacy implies stability, we apply DP noise to improve the performance of outlier detection and novelty detection, with an extension to backdoor attack detection. We first provide the theoretical basis for the efficacy of differential privacy for identifying anomalies, connecting the hardness of the identification problem to privacy parameters. Our theoretical results are useful to explain various experimental findings, including how the anomaly detection performance varies with privacy parameters and the number of outliers in the training set. We perform extensive experiments to demonstrate the effectiveness of differential privacy for anomaly detection. To fully evaluate the effectiveness of DP in anomaly detection with different amount of outliers and noisee, we first construct a contaminated dataset based on MNIST and train autoencoder anomaly detection models with varying noise scale applied. We then evaluate the performance using a real-world task, Hadoop file system log anomaly detection, by applying DP noise to DeepLog, the current state-of-the-art detection model. The evaluation results show that DP noise is effective towards reducing the number of false negatives, and further improving the overall utility. Finally, we generalize the idea of measuring model loss for outlier detection to backdoor attack detection and further improve the performance via differential privacy. + +# REFERENCES + +Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, pp. 308–318. ACM, 2016. + +Charu C Aggarwal and Philip S Yu. Outlier detection for high dimensional data. In ACM Sigmod Record, pp. 37–46. ACM, 2001. + +Eugene Bagdasaryan and Vitaly Shmatikov. Differential privacy has disparate impact on model accuracy. arXiv preprint arXiv:1905.12101, 2019. + +Gilles Blanchard, Gyemin Lee, and Clayton Scott. Semi-supervised novelty detection. Journal of Machine Learning Research, 11(Nov):2973–3009, 2010. + +Olivier Bousquet and André Elisseeff. Stability and generalization. Journal of machine learning research, 2(Mar):499–526, 2002. + +Guilherme O Campos, Arthur Zimek, Jörg Sander, Ricardo JGB Campello, Barbora Micenková, Erich Schubert, Ira Assent, and Michael E Houle. On the evaluation of unsupervised outlier detection: measures, datasets, and an empirical study. Data Mining and Knowledge Discovery, 30 (4):891–927, 2016. + +Nicholas Carlini, Chang Liu, Jernej Kos, Úlfar Erlingsson, and Dawn Song. The secret sharer: Measuring unintended neural network memorization & extracting secrets. arXiv preprint arXiv:1802.08232, 2018. + +Frank De Morsier, Devis Tuia, Maurice Borgeaud, Volker Gass, and Jean-Philippe Thiran. Semisupervised novelty detection using svm entire solution path. IEEE Transactions on Geoscience and Remote Sensing, 51(4):1939–1950, 2013. + +Min Du, Feifei Li, Guineng Zheng, and Vivek Srikumar. Deeplog: Anomaly detection and diagnosis from system logs through deep learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pp. 1285–1298. ACM, 2017. + +Lian Duan, Lida Xu, Ying Liu, and Jun Lee. Cluster-based outlier detection. Annals of Operations Research, 168(1):151–168, 2009. + +Cynthia Dwork. Differential privacy: A survey of results. In Theory and Applications of Models of Computation—TAMC, volume 4978 of Lecture Notes in Computer Science. Springer Verlag, April 2008. + +Cynthia Dwork. Differential privacy. Encyclopedia of Cryptography and Security, pp. 338–340, 2011. + +Cynthia Dwork, Aaron Roth, et al. The algorithmic foundations of differential privacy. Foundations and Trends $\textsuperscript { \textregistered }$ in Theoretical Computer Science, 9(3–4):211–407, 2014. + +Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Leon Roth. Preserving statistical validity in adaptive data analysis. In Proceedings of the forty-seventh annual ACM symposium on Theory of computing, pp. 117–126. ACM, 2015. + +Justin Gottschlich, Abdullah Muzahid, et al. Autoperf: A generalized zero-positive learning system to detect software performance anomalies. arXiv preprint arXiv:1709.07536, 2017. + +Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. Badnets: Identifying vulnerabilities in the machine learning model supply chain. arXiv preprint arXiv:1708.06733, 2017. + +Victoria Hodge and Jim Austin. A survey of outlier detection methodologies. Artificial intelligence review, 22(2):85–126, 2004. + +Heiko Hoffmann. Kernel pca for novelty detection. Pattern recognition, 40(3):863–874, 2007. + +Kaggle. notmnist dataset used in udacity’s deep learning mooc, 2017. URL https://www. kaggle.com/lubaroli/notmnist. [Online; accessed 19-May-2019]. + +Shiva Prasad Kasiviswanathan, Homin K Lee, Kobbi Nissim, Sofya Raskhodnikova, and Adam Smith. What can we learn privately? SIAM Journal on Computing, 40(3):793–826, 2011. + +Mathias Lecuyer, Vaggelis Atlidakis, Roxana Geambasu, Daniel Hsu, and Suman Jana. Certified robustness to adversarial examples with differential privacy. arXiv preprint arXiv:1802.03471, 2018. + +Jian-Guang Lou, Qiang Fu, Shengqi Yang, Ye Xu, and Jiang Li. Mining invariants from console logs for system problem detection. In USENIX Annual Technical Conference, pp. 1–14, 2010. + +Markos Markou and Sameer Singh. Novelty detection: a review—part 1: statistical approaches. Signal processing, 83(12):2481–2497, 2003a. + +Markos Markou and Sameer Singh. Novelty detection: a review—part 2:: neural network based approaches. Signal processing, 83(12):2499–2521, 2003b. + +Rina Okada, Kazuto Fukuchi, and Jun Sakuma. Differentially private analysis of outliers. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 458–473. Springer, 2015. + +F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011. + +NhatHai Phan, Ruoming Jin, My T Thai, Han Hu, and Dejing Dou. Preserving differential privacy in adversarial learning with provable robustness. arXiv preprint arXiv:1903.09822, 2019. + +scikit-learn. sklearn.metrics.average_precision_score, 2017a. URL https://scikit-learn. org/stable/modules/generated/sklearn.metrics.average_precision_ score.html. [Online; accessed 19-May-2019]. + +scikit-learn. sklearn.metrics.roc_auc_score, 2017b. URL https://scikit-learn.org/ stable/modules/generated/sklearn.metrics.roc_auc_score.html. [Online; accessed 19-May-2019]. + +scikit-learn. Novelty and outlier detection, 2017c. URL https://scikit-learn.org/ stable/modules/outlier_detection.html. [Online; accessed 19-May-2019]. + +Congzheng Song, Thomas Ristenpart, and Vitaly Shmatikov. Machine learning models that remember too much. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pp. 587–601. ACM, 2017. + +Wei Xu. Hdfs log dataset, 2009. URL http://iiis.tsinghua.edu.cn/\~weixu/ sospdata.html. [Online; accessed 3-May-2019]. + +Wikipedia. Precision and recall — Wikipedia, the free encyclopedia, 2019a. URL https://en.wikipedia.org/w/index.php?title=Precision_and_recall& oldid $=$ 893227571. [Online; accessed 2-May-2019]. + +Wikipedia. Sensitivity and specificity — Wikipedia, the free encyclopedia, 2019b. URL https://en.wikipedia.org/w/index.php?title $=$ Sensitivity_and_ specificity&oldid=891047257. [Online; accessed 2-May-2019]. + +Huan Xu, Constantine Caramanis, and Sujay Sanghavi. Robust pca via outlier pursuit. In Advances in Neural Information Processing Systems, pp. 2496–2504, 2010. + +Wei Xu, Ling Huang, Armando Fox, David Patterson, and Michael I Jordan. Detecting large-scale system problems by mining console logs. In Proceedings of the ACM SIGOPS 22nd symposium on Operating systems principles, pp. 117–132. ACM, 2009. + +Samuel Yeom, Irene Giacomelli, Matt Fredrikson, and Somesh Jha. Privacy risk in machine learning: Analyzing the connection to overfitting. In 2018 IEEE 31st Computer Security Foundations Symposium (CSF), pp. 268–282. IEEE, 2018. + +Arthur Zimek, Erich Schubert, and Hans-Peter Kriegel. A survey on unsupervised outlier detection in high-dimensional numerical data. Statistical Analysis and Data Mining: The ASA Data Science Journal, 5(5):363–387, 2012. + +Arthur Zimek, Ricardo JGB Campello, and Jörg Sander. Ensembles for unsupervised outlier detection: challenges and research questions a position paper. Acm Sigkdd Explorations Newsletter, 15(1): 11–22, 2014. + +# A APPENDIX + +# A.1 PROOF OF THEOREM 2 + +The following result will be used for reasoning about the performance gap of the differentially private learned models between regular data points and outliers. + +Theorem 3 (McDiarmid, 1989). Let $S$ be a set of $n$ points and $S ^ { i }$ be the set with the ith element in $S$ replaced by $z _ { i } ^ { \prime }$ , let $F : \mathcal { Z } ^ { n } \to \mathbb { R }$ be any measurable function for which there exits constants $c _ { i }$ $( i = 1 , \ldots , n )$ ) such that + +$$ +\operatorname* { s u p } _ { S \in { \mathcal { Z } } ^ { n } , z _ { i } ^ { \prime } \in { \mathcal { Z } } } | F ( S ) - F ( S ^ { i } ) | \leq c _ { i } +$$ + +then + +$$ +P _ { S } [ F ( S ) - \mathbb { E } _ { S } [ F ( S ) ] \geq \epsilon ] \leq e ^ { - 2 \epsilon ^ { 2 } / \sum _ { i = 1 } ^ { n } c _ { i } ^ { 2 } } +$$ + +Moreover, we will need the following lemma on group differential privacy. + +Lemma 1. If $\mathcal { A }$ is $( \epsilon , \delta )$ -differentially private with respect to one change in the database, then $\mathcal { A }$ is $( c \epsilon , c e ^ { c \epsilon } \delta )$ -differentially private with respect to c changes in the database. + +Now, we are ready to present the proof of Theorem 2. + +Theorem 2. Suppose that a learning algorithm $\mathcal { A }$ is $( \epsilon , \delta )$ -differentially private and UAERM with the rate $\xi ( n , \epsilon , \delta )$ . Let $S ^ { \prime } = S \cup U$ , where $S \sim \mathcal { D } ^ { n }$ and $U$ contains c arbitrary outliers. Then + +$$ +\begin{array} { r l } & { \mathbb { E } _ { h \sim \mathcal { A } ( S ^ { \prime } ) } l ( h , \tilde { z } ) - \mathbb { E } _ { h \sim A ( S ^ { \prime } ) } \mathbb { E } _ { z \sim \mathcal { D } } l ( h , z ) } \\ & { \qquad \geq T - 2 \bigg ( \xi ( n , \epsilon , \delta ) + \sqrt { \frac { n ( e ^ { \epsilon } - 1 + \delta ) ^ { 2 } } { 2 } \log { \frac { 2 } { \gamma } } } + e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \delta \bigg ) } \end{array} +$$ + +with probability at least $1 - \gamma$ . + +Proof. Let the probability density/mass defined by $\boldsymbol { \mathcal { A } } ( \boldsymbol { S } ^ { \prime } )$ and $\boldsymbol { \mathcal { A } } ( \boldsymbol { S } )$ be $p ( h )$ and $p ^ { \prime } ( h )$ , respectively. Using Lemma 1, for any $z \in { \mathcal { Z } }$ we have + +$$ +\begin{array} { r l r } { { \mathbb { E } _ { h \sim A ( S ) } l ( h , z ) = \int _ { 0 } ^ { 1 } P _ { h \sim A ( S ) } [ l ( h , z ) > t ] d t } } \\ & { } & { \quad \le \int _ { 0 } ^ { 1 } \big ( e ^ { c \epsilon } P _ { h \sim A ( S ^ { \prime } ) } [ l ( h , z ) > t ] + c e ^ { c \epsilon } \delta ) d t } \\ & { } & { \quad = e ^ { c \epsilon } \mathbb { E } _ { h \sim A ( S ^ { \prime } ) } [ l ( h , z ) ] + c e ^ { c \epsilon } \delta } \end{array} +$$ + +It follows that + +$$ +\begin{array} { r l r } & { } & { \mathbb { E } _ { h \sim \mathcal { A } ( S ) } l ( h , z ) - \mathbb { E } _ { h \sim \mathcal { A } ( S ^ { \prime } ) } [ l ( h , z ) ] \le ( e ^ { c \epsilon } - 1 ) \mathbb { E } _ { h \sim \mathcal { A } ( S ^ { \prime } ) } [ l ( h , z ) ] + c e ^ { c \epsilon } \delta } \\ & { } & { \le e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \delta \quad \quad } \end{array} +$$ + +By symmetry, it also holds that + +$$ +\begin{array} { r l } & { \mathbb { E } _ { h \sim \mathcal { A } ( S ^ { \prime } ) } l ( h , z ) - \mathbb { E } _ { h \sim \mathcal { A } ( S ) } [ l ( h , z ) ] \le \big ( e ^ { c \epsilon } - 1 \big ) \mathbb { E } _ { h \sim \mathcal { A } ( S ) } [ l ( h , z ) ] + c e ^ { c \epsilon } \delta } \\ & { \qquad \le e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \delta } \end{array} +$$ + +Thus, we have the following bound: + +$$ +\begin{array} { r } { | \mathbb { E } _ { h \sim A ( S ) } l ( h , z ) - \mathbb { E } _ { h \sim A ( S ^ { \prime } ) } [ l ( h , z ) ] | \le e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \delta } \end{array} +$$ + +Moreover, let $S ^ { i }$ be the set with the $i$ th element in $S$ replaced by $z _ { i } ^ { \prime }$ . Then, by the same argument above, we have + +$$ +\begin{array} { r } { | \mathbb { E } _ { h \sim A ( S ) } l ( h , z ) - \mathbb { E } _ { h \sim A ( S ^ { i } ) } [ l ( h , z ) ] | \le e ^ { \epsilon } - 1 + \delta } \end{array} +$$ + +for all $i = 1 , \ldots , n$ . Then, using Theorem 3 that relates the first order differences of random functions to their variance, we obtain + +$$ +\begin{array} { r l } { P _ { S \sim \mathcal { D } } \big [ | \mathbb { E } _ { h \sim \mathcal { A } ( S ) } l ( h , z ) - \mathbb { E } _ { S } \mathbb { E } _ { h \sim \mathcal { A } ( S ) } l ( h , z ) | \ge \tau \big ] \le 2 e ^ { - \frac { 2 \tau ^ { 2 } } { n ( e ^ { \epsilon } - 1 + \delta ) ^ { 2 } } } } & { { } } \end{array} +$$ + +Hence, + +$$ +P _ { S \sim \mathcal { D } } [ \vert \mathbb { E } _ { h \sim \mathcal { A } ( S ) } l ( h , z ) - \mathbb { E } _ { S } \mathbb { E } _ { h \sim \mathcal { A } ( S ) } l ( h , z ) \vert \ge \sqrt { \frac { n ( e ^ { \epsilon } - 1 + \delta ) ^ { 2 } } { 2 } \log \frac { 2 } { \gamma } } ] \le \gamma +$$ + +Combining (14) with (17), we have + +$$ +\begin{array} { r l r } { { P _ { S \sim \mathcal { D } } [ \vert \mathbb { E } _ { h \sim A ( S ^ { \prime } ) } l ( h , z ) - \mathbb { E } _ { S } \mathbb { E } _ { h \sim A ( S ) } l ( h , z ) \vert \le \sqrt { \frac { n ( e ^ { \epsilon } - 1 + \delta ) ^ { 2 } } { 2 } \log { \frac { 2 } { \gamma } } } + e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \delta ] } } \\ & { } & { \ge 1 - \gamma ( 1 - \gamma ) , } \end{array} +$$ + +Since $\mathcal { A }$ is UAERM, the following inequality holds with probability at least $1 - \gamma$ : + +$$ +\vert \mathbb { E } _ { h \sim A ( S ^ { \prime } ) } l ( h , z ) - l ( h ^ { \ast } , z ) \vert \le \xi ( n , \epsilon , \delta ) + \sqrt { \frac { n ( e ^ { \epsilon } - 1 + \delta ) ^ { 2 } } { 2 } \log { \frac { 2 } { \gamma } } } + e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \delta +$$ + +for all $z \in { \mathcal { Z } }$ . + +For a given outlier $\tilde { z }$ , it satisfies $l ( h ^ { * } , \tilde { z } ) - \mathbb { E } _ { z \sim \mathcal { D } } [ l ( h ^ { * } , z ) ] \ge T$ by definition. Combining it with (19), we get + +$$ +\begin{array} { r l } & { \mathbb { E } _ { \boldsymbol { h } \sim \mathcal { A } ( S ^ { \prime } ) } l ( \boldsymbol { h } , \tilde { z } ) - \mathbb { E } _ { z \sim \mathcal { D } } \mathbb { E } _ { \boldsymbol { h } \sim \mathcal { A } ( S ^ { \prime } ) } l ( \boldsymbol { h } , z ) } \\ & { \qquad \ge T - 2 \bigg ( \xi ( \boldsymbol { n } , \boldsymbol { \epsilon } , \boldsymbol { \delta } ) + \sqrt { \frac { n ( e ^ { \epsilon } - 1 + \boldsymbol { \delta } ) ^ { 2 } } { 2 } \log { \frac { 2 } { \gamma } } } + e ^ { c \epsilon } - 1 + c e ^ { c \epsilon } \boldsymbol { \delta } \bigg ) } \end{array} +$$ + +# A.2 ADDITIONAL EXPERIMENT RESULTS + +We list additional experimental results in this section. With more parameters being tested and more metrics being collected, these extensive results further validate our observations presented in the main paper body: differential privacy could improve anomaly detection and backdoor attack detection; and the higher ratio of outliers in the training data, the more noise (smaller privacy bound $\epsilon$ ) is needed to achieve the best improvement. + +# A.2.1 AUTOENCODER ANOMALY DETECTION + +Besides the AUPR scores presented in Table 1 for outlier detection and novelty detection using autoencoders, we present additional results with more parameters being tested in Table 4. The observations are similar. As an intermediate step in differential privacy to bound the sensitivity, clipping itself without adding any noise is able to improve the performance of outlier detection and novelty detection. Adding various amounts of random Gaussian noise is able to further improve the utility, except when the amount of noise is too big (e.g., $\sigma = 5 0$ and 100) to ruin the model. We also indicate the privacy bound $\epsilon$ as accumulated by the moments accountant mechanism in (Abadi et al. [2016]). Interestingly, many $\epsilon$ values are too big to provide any meaningful privacy guarantee, but they are still able to improve the anomaly detection performance. + +Besides AUPR scores, we further present AUROC scores in Table 5 for the same set of experiments. Autoencoders, as validated by many previous works (Gottschlich et al. [2017]), present great effectiveness in detecting outliers and novelties, especially when the outlier ratio in training dataset is slow (e.g., below $1 \%$ ). Although not as obvious as AUPR scores, the improvements brought by differential privacy follow a similar trend, where the improvement is more significant with larger noise (smaller $\dot { \epsilon }$ ) being applied to models trained with more outliers. + +Table 4: AUPR scores for autoencoder outlier detection (OD) and novelty detection (ND). + +
noisescaleσ= outlier percentage in training data r。E
0.01%0.1%0.5%1%5%10%
ODNDODNDODNDODNDODNDODND
N/A10099.8499.9299.7792.1298.8192.1299.8184.3388.1872.1668.148
010099.8699.8999.8398.399.6995.298.6883.8687.9177.874.748
0.00110099.7010099.8698.3799.6494.3398.8184.3189.3486.5185.581.0 × 1010
0.00510099.8799.8299.7898.6999.795.6798.8791.0194.379.5577.043.9×108
0.0110099.8910099.9794.9299.2397.0899.3390.7993.3485.4184.079.8×107
0.0510099.8599.8999.7997.9799.5596.9499.3488.8492.5475.1872.092.8×106
0.110099.8810099.8598.4499.6693.1198.2192.2394.2185.5683.986.8×104
0.510099.8499.9599.8598.5999.6499.9599.8593.6995.885.6183.8622.23
110099.8110099.7898.2899.6795.899.094.9296.8781.8780.123.09
510099.4999.8799.4998.5199.5296.598.7896.7898.0495.2595.410.44
1097.6297.6190.2497.7791.8898.297.599.1296.698.297.0797.460.25
Beowgyalueistoobigsuchhatthemodedoesnotcorvergewellintraining.
5054.1990.4665.9492.1370.3490.878.3491.1986.5891.5988.4990.270.19
10056.0887.247.2270.5771.9590.84.2310.7380.5886.9489.2690.680.19
+ +Table 5: AUROC scores for autoencoder outlier detection (OD) and novelty detection (ND). + +
noisescale= outlier percentage in training data r。E
0.01%0.%0.5%1%5%10%
ODNDODNDODNDODNDODNDODND
N/A10099.9710099.9599.8199.7999.1799.0797.397.489.4689.28
010099.9710099.9799.9699.9399.799.7797.3697.5292.3992.358
0.00110099.9310099.9799.8999.8499.7999.8297.3797.6396.2696.721.0×1010
0.00510099.9610099.9599.9296.0999.8199.8398.7398.9193.6293.823.9×108
0.0110099.9710099.9799.899.8799.8999.998.3998.596.0296.49.8×107
0.0510099.9710099.9699.999.9399.8799.997.5597.8190.9190.872.8×106
0.110099.9710099.9799.8799.999.5899.7198.7798.8296.1696.466.8×104
0.510099.9610099.9799.999.9199.7799.8599.1399.2595.9696.2522.23
110099.9510099.9499.9199.9499.7499.8199.3199.4494.6694.953.09
510099.8110099.8599.9699.9399.5299.599.0799.3298.4998.740.44
101009999.8699.2599.1499.9399.6899.7998.7299.2998.999.270.25
Beowgvalueistoobicsuchtthatthemodeldoesnotconvergewellinttraining.
5099.9996.1194.896.4192.9696.1394.1596.297.035.9593.8395.610.19
10099.7394.782.6487.2993.5199.2231.7730.9194.4796.0894.6296.090.19
+ +# A.2.2 IMPROVEMENTS OVER DEEPLOG + +To compare the differentially private models with DeepLog, we utilize the same anomaly detection criteria, i.e., Top- $k$ based anomaly detection as what’s presented in (Du et al. [2017]). Nevertheless, as a direct extension of the idea in measuring model loss for anomaly detection, we also tested the classification probability as one type of threshold for anomaly detection. In particular, if an actual system log entry is predicted with a probability lower than some threshold $T _ { p }$ , we treat this log entry as a detected anomaly. While the baseline DeepLog results are not as good as the Top- $k$ based detection, we show that similarly, differential privacy is able to significantly reduce the number of false negatives, without introducing too many new false positives. + +Probability-based detection. As a preliminary result, we use probability-based anomaly detection to demonstrate the effectiveness of differential privacy noise in reducing FN . Table 6 shows FN and FP for DeepLog and DeepLog+DP with increasing noise levels, under different probability thresholds $T _ { p }$ . It is clear that differential privacy noise could effectively reduce FN , and the larger noise being added, the more false negatives are reduced. We also note that when $\sigma = 0 . 2 5$ , the privacy bound $\epsilon = 9 0 . 5 $ . It is often thought that a privacy bound $\epsilon > 2 0$ is completely useless in terms of protecting privacy. Here we indicate that a small amount of noise may be enough to reduce FN . Although more false positives are incurred because of differential privacy noise, the drop in TPR is negligible, considering the large volume of normal data. For example, when $T _ { p } = 2 \times 1 0 ^ { - 6 }$ and $\sigma = 1$ , the FN drop from 1261 to 183 indicates a TNR increase of $8 \%$ $( 9 1 . 7 \% \to 9 8 . 8 \% )$ , while the FP increase from 2291 to 3734 only shows a TPR decrease of $0 . 3 \%$ $( 9 9 . 5 9 \% \to 9 9 . 3 2 \% )$ . + +Table 6: Probability-based anomaly detection results. + +
Probabilitythreshold TpDeepLogFN /FPDeepLog+DP (FN /FP)
σ=0.25σ=1σ=1.5σ=2
10-5573/35967/142680/60591/82131/9187
2×10-61261/2291208/4756183/37341/57181/6317
10-61468/2068410/3759190/35522/40021/6093
+ +Table 7: AUROC score comparison and privacy bound $\epsilon$ . + +
DeepLogDeepLog+DP
σ=0.25σ=0.5σ=0.75o=1.0σ=1.25σ=1.5o=1.75σ=2.0
AUROC score0.99930.99970.99970.99970.99980.99930.99940.99890.9985
privacy bound e090.456.211.860.960.610.420.310.25
+ +AUROC score To evaluate the overall performance of DeepLog+DP compared with DeepLog under different thresholds, we further compute the AUROC score of DeepLog and DeepLog $+ \mathrm { D P }$ with different noise scale $\sigma$ . As shown in Table 7, DeepLog already achieves excellent AUROC score, considering the large amount of normal data and the significantly fewer anomalies. However, an adequate amount of differential privacy noise is still able to improve the performance. + +Privacy bound $\epsilon$ Table 7 also indicates the privacy bound $\epsilon$ . Note that $\epsilon < 1 0$ is often considered as usable and $\epsilon < 1$ is a tight bound that well protects privacy. Considering all the cases, $\sigma = 1$ gives the best anomaly detection utility as well as a tight privacy bound to protect training data privacy. + +# A.2.3 BACKDOOR ATTACK DETECTION + +In this section, we evaluate more parameters for the experiment set up described in Section 4.3 BACKDOOR ATTACK DETECTION, and measure benign accuracy, success rate, AUPR score and AUROC score as explained in Section 4.3 for each experiment setting. Similar as the observations in Section 4.3, a differentially private trained machine learning model is naturally more robust to backdoor attacks. The evidence is that the benign accuracy (Table 8) is affected little by differential privacy except when the noise scale is too big to ruin the model parameters, compared with the significant downgrade (e.g., $9 8 . 1 \%$ to $0 . 3 \%$ ) in backdoor success rate (Table 9). Also, as shown in Table 10 and Table 11, measuring model loss to detect poisoning examples could be useful when the poisoning ratio is low. Nevertheless, applying differential privacy is able to significantly improve the detection performance for a poisoning ratio as high as $4 5 \%$ . + +Table 8: Benign accuracy of models trained on datasets with different poisoning ratio $r _ { p }$ . The more noise being added, the more utility is affected. + +
noise scale0 poisoning ratio in training data rpE
0.0050.010.050.10.20.30.40.45
N/A98.9399.0398.9599.1198.9499.0699.0598.978
097.6697.2197.8497.4696.9796.3293.6192.48
0.00197.597.5297.7297.2997.4796.6994.1690.419.9×109
0.00597.5797.5597.4697.7597.3696.593.9691.253.9×108
0.0197.5197.6197.497.5597.2797.0794.7792.829.8×107
0.0597.4297.8797.897.7297.6996.3794.1993.282830766.11
0.197.5597.8497.797.3497.2996.9194.1191.3667915.88
0.597.5697.2997.2897.3797.1396.5595.1986.3722.23
196.9496.9596.9696.5396.2795.7891.6583.163.09
293.7693.3992.1693.2292.7792.487.6181.241.18
Below noise level0couldTbe too high.gh.
389.8589.591.1290.9289.3589.8185.4276.510.75
580.5179.5780.4980.2879.1977.9557.561.640.44
1017.3219.8220.3112.0711.3411.4311.1511.110.25
+ +Table 9: Backdoor attack success rate of models trained on datasets with different poisoning ratio $r _ { p }$ . The success rate is significantly reduced for models trained with differential privacy. + +
noise scale0poisoning ratio in training data rpE
0.0050.010.050.10.20.30.40.45
N/A47.8590.9697.1298.198.4698.9198.9298.798
00.230.290.350.30.470.7468.172.028
0.0010.210.220.250.370.420.8535.8319.019.9×109
0.0050.170.20.280.30.3535.5450.2883.943.9×108
0.010.250.240.340.310.420.5693.6415.259.8×107
0.050.240.250.370.30.3718.5582.154.532830766.11
0.10.250.180.280.390.470.7182.2359.5767915.88
0.50.260.230.290.350.370.811.6374.1522.23
10.280.30.450.50.631.0944.1267.443.09
20.740.681.071.11.42.675.9571.481.18
BeBelownoise levelcouldbetoolbetoohhigh.
30.961.221.11.592.692.666.0220.380.75
52.011.62.443.472.688.1513.7819.910.44
109.9310.310.039.089.689.3310.149.770.25
noise scale0 poisoning ratio in training data TpE
0.0050.010.050.10.20.30.40.45
N/A73.0127.0214.8517.6324.936.4242.1645.858
091.2292.1195.3395.4695.996.5562.5760.338
0.00191.5293.3694.6195.9896.9596.0578.5386.99.9×109
0.00592.6494.0494.7695.4596.9879.172.7352.073.9×108
0.0192.2494.0393.495.7696.6996.2247.0890.779.8×107
0.0590.7695.1195.0995.5496.3587.2849.8293.722830766.11
0.192.1694.8595.3395.2896.496.675165.967915.9
0.592.7693.494.594.9395.7495.8895.9654.9922.23
188.6790.3194.7794.4696.0394.6772.9956.353.09
265.0178.5180.7687.5488.7687.6386.7551.411.18
Belownoise level0couldetoohi
329.3151.3778.258179.8381.5684.4671.620.75
56.417.3958.6658.8861.869.1964.2761.580.44
100.8210.1210.8820.3230.8940.9245.170.25
+ +Table 10: AUPR scores for backdoor attack detection. Applying differential privacy significantly improves the results. + +Table 11: AUROC scores for backdoor attack detection. It shows that measuring model loss for poisoning samples detection could be effective when the poisoning ratio is low. Differential privacy improves the performance in all cases, except when the noise scale is too big to ruin the model parameters. + +
noise scale0 poisoning ratio in training data TpE
0.0050.010.050.10.20.30.40.45
N/A99.2695.2378.8867.7259.4760.955.3352.738
099.9299.8899.7999.7299.5199.3170.2462.888
0.00199.9199.8899.7999.7299.6299.2781.2788.19.9×109
0.00599.999.9399.7999.7599.6384.5175.1260.213.9×108
0.0199.9299.9299.7499.7499.6199.361.8393.789.8×107
0.0599.999.9499.8399.7399.5990.6758.0397.122830766.11
0.199.9399.9399.8299.6999.5599.3759.7165.5567915.88
0.599.9599.9299.7699.6899.599.2398.6858.4422.23
199.8699.8499.7699.6199.4398.8775.763.943.09
299.6499.6498.9798.8698.2197.1394.8257.811.18
Belownoise level0couldbetoohigh.
398.6898.9298.6898.1796.7395.9293.8681.220.75
595.7496.1396.3894.4292.2289.5277.7773.110.44
1056.7760.4961.253.1151.0551.3351.1950.350.25
\ No newline at end of file diff --git a/md/train/SJzSgnRcKX/SJzSgnRcKX.md b/md/train/SJzSgnRcKX/SJzSgnRcKX.md new file mode 100644 index 0000000000000000000000000000000000000000..5e6f193eeecfd6afa19829705f5fc9a708eace80 --- /dev/null +++ b/md/train/SJzSgnRcKX/SJzSgnRcKX.md @@ -0,0 +1,348 @@ +# WHAT DO YOU LEARN FROM CONTEXT? PROBING FOR SENTENCE STRUCTURE IN CONTEXTUALIZED WORD REPRESENTATIONS + +Ian Tenney,∗1 Patrick Xia,2 Berlin Chen,3 Alex Wang,4 Adam Poliak,2 +R. Thomas McCoy,2 Najoung Kim,2 Benjamin Van Durme,2 Samuel R. Bowman,4 +Dipanjan Das,1 and Ellie Pavlick1,5 +1Google AI Language, 2Johns Hopkins University, 3Swarthmore College, +4New York University, 5Brown University + +# ABSTRACT + +Contextualized representation models such as ELMo (Peters et al., 2018a) and BERT (Devlin et al., 2018) have recently achieved state-of-the-art results on a diverse array of downstream NLP tasks. Building on recent token-level probing work, we introduce a novel edge probing task design and construct a broad suite of sub-sentence tasks derived from the traditional structured NLP pipeline. We probe word-level contextual representations from four recent models and investigate how they encode sentence structure across a range of syntactic, semantic, local, and long-range phenomena. We find that existing models trained on language modeling and translation produce strong representations for syntactic phenomena, but only offer comparably small improvements on semantic tasks over a non-contextual baseline. + +# 1 INTRODUCTION1 + +Pretrained word embeddings (Mikolov et al., 2013; Pennington et al., 2014) are a staple tool for NLP. These models provide continuous representations for word types, typically learned from cooccurrence statistics on unlabeled data, and improve generalization of downstream models across many domains. Recently, a number of models have been proposed for contextualized word embeddings. Instead of using a single, fixed vector per word type, these models run a pretrained encoder network over the sentence to produce contextual embeddings of each token. The encoder, usually an LSTM (Hochreiter & Schmidhuber, 1997) or a Transformer (Vaswani et al., 2017), can be trained on objectives like machine translation (McCann et al., 2017) or language modeling (Peters et al., 2018a; Radford et al., 2018; Howard & Ruder, 2018; Devlin et al., 2018), for which large amounts of data are available. The activations of this network–a collection of one vector per token–fit the same interface as conventional word embeddings, and can be used as a drop-in replacement input to any model. Applied to popular models, this technique has yielded significant improvements to the state-of-the-art on several tasks, including constituency parsing (Kitaev & Klein, 2018), semantic role labeling (He et al., 2018; Strubell et al., 2018), and coreference (Lee et al., 2018), and has outperformed competing techniques (Kiros et al., 2015; Conneau et al., 2017) that produce fixed-length representations for entire sentences. + +Our goal in this work is to understand where these contextual representations improve over conventional word embeddings. Recent work has explored many token-level properties of these representations, such as their ability to capture part-of-speech tags (Blevins et al., 2018; Belinkov et al., 2017b; Shi et al., 2016), morphology (Belinkov et al., 2017a;b), or word-sense disambiguation (Peters et al., 2018a). Peters et al. (2018b) extends this to constituent phrases, and present a heuristic for unsupervised pronominal coreference. We expand on this even further and introduce a suite of edge probing tasks covering a broad range of syntactic, semantic, local, and long-range phenomena. In particular, we focus on asking what information is encoded at each position, and how well it encodes structural information about that word’s role in the sentence. Is this information primarily syntactic in nature, or do the representations also encode higher-level semantic relationships? Is this information local, or do the encoders also capture long-range structure? + +![](images/c0cd983f52ba2e3bc69ca6f26bfb54afb946834e3c20b9aa60eb08d004115520.jpg) +Figure 1: Probing model architecture (§ 3.1). All parameters inside the dashed line are fixed, while we train the span pooling and MLP classifiers to extract information from the contextual vectors. The example shown is for semantic role labeling, where $s ^ { ( 1 ) } = [ 1 , 2 )$ corresponds to the predicate (“eat”), while $s ^ { ( 2 ) } = [ 2 , 5 )$ is the argument (“strawberry ice cream”), and we predict label A1 as positive and others as negative. For entity and constituent labeling, only a single span is used. + +We approach these questions with a probing model (Figure 1) that sees only the contextual embeddings from a fixed, pretrained encoder. The model can access only embeddings within given spans, such as a predicate-argument pair, and must predict properties, such as semantic roles, which typically require whole-sentence context. We use data derived from traditional structured NLP tasks: tagging, parsing, semantic roles, and coreference. Common corpora such as OntoNotes (Weischedel et al., 2013) provide a wealth of annotations for well-studied concepts which are both linguistically motivated and known to be useful intermediates for high-level language understanding. We refer to our technique as “edge probing”, as we decompose each structured task into a set of graph edges $( \ S 2 )$ which we can predict independently using a common classifier architecture $( \ S 3 . 1 ) ^ { \overline { { 2 } } }$ . We probe four popular contextual representation models $( \ S 3 . 2 )$ : CoVe (McCann et al., 2017), ELMo (Peters et al., 2018a), OpenAI GPT (Radford et al., 2018), and BERT (Devlin et al., 2018). + +We focus on these models because their pretrained weights and code are available, since these are most likely to be used by researchers. We compare to word-level baselines to separate the contribution of context from lexical priors, and experiment with augmented baselines to better understand the role of pretraining and the ability of encoders to capture long-range dependencies. + +# 2 EDGE PROBING + +To carry out our experiments, we define a novel “edge probing” framework motivated by the need for a uniform set of metrics and architectures across tasks. Our framework is generic, and can be applied to any task that can be represented as a labeled graph anchored to spans in a sentence. + +Formulation. Formally, we represent a sentence as a list of tokens $T = [ t _ { 0 } , t _ { 1 } , \dots , t _ { n } ]$ , and a labeled edge as $\{ s ^ { ( 1 ) } , s ^ { ( 2 ) } , L \}$ . We treat $s ^ { ( 1 ) } = [ i ^ { ( 1 ) } , j ^ { ( 1 ) } )$ and, optionally, $s ^ { ( 2 ) } = [ i ^ { ( 2 ) } , j ^ { ( 2 ) } )$ as (end-exclusive) spans. For unary edges such as constituent labels, $s ^ { ( 2 ) }$ is omitted. We take $L$ to be a set of zero or more targets from a task-specific label set $\mathcal { L }$ . + +Table 1: Example sentence, spans, and target label for each task. $\mathrm { O } =$ OntoNotes, $\mathbf { W } =$ Winograd. + +
POS The important thing about Disney is that it is a global [brand]1. -→ NN (Noun)
Constit.The important thing about Disney is that it [is a global brand]1.-→VP (Verb Phrase)
Depend.[Atmosphere]1 is always [fun]2 →nsubj (nominal subject)
EntitiesThe important thing about [Disneyli is that it is a global brand. -→ Organization
SRL[The important thing about Disneyl2 [is]1 that it is a global brand. -→Argl (Agent)
SPR[It]1 [endorsed]2 the White House strategy...→ {awareness, existed_after,...}
Coref.oThe important thing about [Disneyli is that [it]2 is a global brand. -→ True
Coref.W[Charactersl2 entertain audiences because [theyli want people to be happy. -→ True Characters entertain [audiencesl2 because [theyli want people to be happy. -→ False
Rel.The [burst]1 has been caused by water hammer [pressure]2. → Cause-Effect(ez,e1)
+ +To cast all tasks into a common classification model, we focus on the labeling versions of each task. Spans (gold mentions, constituents, predicates, etc.) are given as inputs, and the model is trained to predict $L$ as a multi-label target. We note that this is only one component of the common pipelined (or end-to-end) approach to these tasks, and that in general our metrics are not comparable to models that jointly perform span identification and labeling. However, since our focus is on analysis rather than application, the labeling version is a better fit for our goals of isolating individual phenomena of interest, and giving a uniform metric – binary F1 score – across our probing suite. + +# 2.1 TASKS + +Our experiments focus on eight core NLP labeling tasks: part-of-speech, constituents, dependencies, named entities, semantic roles, coreference, semantic proto-roles, and relation classification. The tasks and their respective datasets are described below, and also detailed in Table 1 and Appendix B. + +Part-of-speech tagging (POS) is the syntactic task of assigning tags such as noun, verb, adjective, etc. to individual tokens. We let $s _ { 1 } = [ \dot { i } , i + 1 )$ be a single token, and seek to predict the POS tag. + +Constituent labeling is the more general task concerned with assigning a non-terminal label for a span of tokens within the phrase-structure parse of the sentence: e.g. is the span a noun phrase, a verb phrase, etc. We let $s _ { 1 } = [ i , j )$ be a known constituent, and seek to predict the constituent label. + +Dependency labeling is similar to constituent labeling, except that rather than aiming to position a span of tokens within the phrase structure, dependency labeling seeks to predict the functional relationships of one token relative to another: e.g. is in a modifier-head relationship, a subjectobject relationship, etc. We take $s _ { 1 } = [ i , i + 1 )$ to be a single token and $s _ { 2 } = [ j , j \in \bar { 1 } )$ to be its syntactic head, and seek to predict the dependency relation between tokens $i$ and $j$ . + +Named entity labeling is the task of predicting the category of an entity referred to by a given span, e.g. does the entity refer to a person, a location, an organization, etc. We let $s _ { 1 } = [ i , j )$ represent an entity span and seek to predict the entity type. + +Semantic role labeling (SRL) is the task of imposing predicate-argument structure onto a natural language sentence: e.g. given a sentence like “Mary pushed John”, SRL is concerned with identifying “Mary” as the pusher and “John” as the pushee. We let $s _ { 1 } = [ i _ { 1 } , j _ { 1 } )$ represent a known predicate and $s _ { 2 } = [ i _ { 2 } , j _ { 2 } )$ represent a known argument of that predicate, and seek to predict the role that the argument $s _ { 2 }$ fills–e.g. ARG0 (agent, the pusher) vs. ARG1 (patient, the pushee). + +Coreference is the task of determining whether two spans of tokens (“mentions”) refer to the same entity (or event): e.g. in a given context, do “Obama” and “the former president” refer to the same person, or do “New York City” and “there” refer to the same place. We let $s _ { 1 }$ and $s _ { 2 }$ represent known mentions, and seek to make a binary prediction of whether they co-refer. + +Semantic proto-role (SPR) labeling is the task of annotating fine-grained, non-exclusive semantic attributes, such as change of state or awareness, over predicate-argument pairs. E.g. + +given the sentence “Mary pushed John”, whereas SRL is concerned with identifying “Mary” as the pusher, SPR is concerned with identifying attributes such as awareness (whether the pusher is aware that they are doing the pushing). We let $s _ { 1 }$ represent a predicate span and $s _ { 2 }$ a known argument head, and perform a multi-label classification over potential attributes of the predicateargument relation. + +Relation Classification (Rel.) is the task of predicting the real-world relation that holds between two entities, typically given an inventory of symbolic relation types (often from an ontology or database schema). For example, given a sentence like “Mary is walking to work”, relation classification is concerned with linking “Mary” to “work” via the Entity-Destination relation. We let $s _ { 1 }$ and $s _ { 2 }$ represent known mentions, and seek to predict the relation type. + +# 2.2 DATASETS + +We use the annotations in the OntoNotes 5.0 corpus (Weischedel et al., 2013) for five of the above eight tasks: POS tags, constituents, named entities, semantic roles, and coreference. In all cases, we simply cast the original annotation into our edge probing format. For POS tagging, we simply extract these labels from the constituency parse data in OntoNotes. For coreference, since OntoNotes only provides annotations for positive examples (pairs of mentions that corefer) we generate negative examples by generating all pairs of mentions that are not explicitly marked as coreferent. + +The OntoNotes corpus does not contain annotations for dependencies, proto-roles, or semantic relations. Thus, for dependencies, we use the English Web Treebank portion of the Universal Dependencies 2.2 release (Silveira et al., 2014). For SPR, we use two datasets, one (SPR1; Teichert et al. (2017)) derived from Penn Treebank and one (SPR2; Rudinger et al. (2018)) derived from English Web Treebank. For relation classification, we use the SemEval 2010 Task 8 dataset (Hendrickx et al., 2009), which consists of sentences sampled from English web text, labeled with a set of 9 directional relation types. + +In addition to the OntoNotes coreference examples, we include an extra “challenge” coreference dataset based on the Winograd schema (Levesque et al., 2012). Winograd schema problems focus on cases of pronoun resolution which are syntactically ambiguous and thus are intended to require subtler semantic inference in order to resolve correctly (see example in Table 1). We use the version of the Definite Pronoun Resolution (DPR) dataset (Rahman & Ng, 2012) employed by White et al. (2017), which contains balanced positive and negative pairs. + +# 3 EXPERIMENTAL SET-UP + +# 3.1 PROBING MODEL + +Our probing architecture is illustrated in Figure 1. The model is designed to have limited expressive power on its own, as to focus on what information can be extracted from the contextual embeddings. We take a list of contextual vectors $[ e _ { 0 } , e _ { 1 } , \ldots , e _ { n } ]$ and integer spans $s ^ { ( 1 ) } = [ i ^ { ( 1 ) } , j ^ { ( 1 ) } )$ and (optionally) $s ^ { ( 2 ) } = [ i ^ { ( 2 ) } , j ^ { ( 2 ) } )$ as inputs, and use a projection layer followed by the self-attention pooling operator of Lee et al. (2017) to compute fixed-length span representations. Pooling is only within the bounds of a span, e.g. the vectors $[ e _ { i } , e _ { i + 1 } , \ldots , e _ { j - 1 } ]$ , which means that the only information our model can access about the rest of the sentence is that provided by the contextual embeddings. + +The span representations are concatenated and fed into a two-layer MLP followed by a sigmoid output layer. We train by minimizing binary cross-entropy against the target label set $\bar { L ^ { \mathrm { ~ \in ~ } } } \{ 0 , \bar { 1 } \} ^ { | \mathcal { L } | }$ . Our code is implemented in PyTorch (Paszke et al., 2017) using the AllenNLP (Gardner et al., 2018) toolkit. For further details on training, see Appendix C. + +# 3.2 SENTENCE REPRESENTATION MODELS + +We explore four recent contextual encoder models: CoVe, ELMo, OpenAI GPT, and BERT. Each model takes tokens $[ t _ { 0 } , t _ { 1 } , \ldots , t _ { n } ]$ as input and produces a list of contextual vectors $[ e _ { 0 } , e _ { 1 } , \ldots , e _ { n } ]$ . + +CoVe (McCann et al., 2017) uses the top-level activations of a two-layer biLSTM trained on EnglishGerman translation, concatenated with 300-dimensional GloVe vectors. The source data consists of + +7 million sentences from web crawl, news, and government proceedings (WMT 2017; Bojar et al. +(2017)). + +ELMo (Peters et al., 2018a) is a two-layer bidirectional LSTM language model, built over a contextindependent character CNN layer and trained on the Billion Word Benchmark dataset (Chelba et al., 2014), consisting primarily of newswire text. We follow standard usage and take a linear combination of the ELMo layers, using learned task-specific scalars (Equation 1 of Peters et al., 2018a). + +GPT (Radford et al., 2018) is a 12-layer Transformer (Vaswani et al., 2017) encoder trained as a left-to-right language model on the Toronto Books Corpus (Zhu et al., 2015). Departing from the original authors, we do not fine-tune the encoder3. + +BERT (Devlin et al., 2018) is a deep Transformer (Vaswani et al., 2017) encoder trained jointly as a masked language model and on next-sentence prediction, trained on the concatenation of the Toronto Books Corpus (Zhu et al., 2015) and English Wikipedia. As with GPT, we do not finetune the encoder weights. We probe the publicly released bert-base-uncased (12-layer) and bert-large-uncased (24-layer) models4. + +For BERT and GPT, we compare two methods for yielding contextual vectors for each token: cat where we concatenate the subword embeddings with the activations of the top layer, similar to CoVe, and mix where we take a linear combination of layer activations (including embeddings) using learned task-specific scalars (Equation 1 of Peters et al., 2018a), similar to ELMo. + +The resulting contextual vectors have dimension $d = 9 0 0$ for CoVe, $d = 1 0 2 4$ for ELMo, and $d = 1 5 3 6$ (cat) or $d = 7 6 8 ( \mathrm { m i x } )$ for GPT and BERT-base, and $d = 2 0 4 8$ (cat) or $d = 1 0 2 4$ (mix) for BERT-large5. The pretrained models expect different tokenizations and input processing. We use a heuristic alignment algorithm based on byte-level Levenshtein distance, explained in detail in Appendix E, in order to re-map spans from the source data to the tokenization expected by the above models. + +# 4 EXPERIMENTS + +Again, we want to answer: What do contextual representations encode that conventional word embeddings do not? Our experimental comparisons, described below, are intended to ablate various aspects of contextualized encoders in order to illuminate how the model captures different types of linguistic information. + +Lexical Baselines. In order to probe the effect of each contextual encoder, we train a version of our probing model directly on the most closely related context-independent word representations. This baseline measures the performance that can be achieved from lexical priors alone, without any access to surrounding words. For CoVe, we compare to the embedding layer of that model, which consists of 300-dimensional GloVe vectors trained on 840 billion tokens of CommonCrawl (web) text. For ELMo, we use the activations of the context-independent character-CNN layer (layer 0) from the full model. For GPT and for BERT, we use the learned subword embeddings from the full model. + +Randomized ELMo. Randomized neural networks have recently (Zhang & Bowman, 2018) shown surprisingly strong performance on many tasks, suggesting that architecture may play a significant role in learning useful feature functions. To help understand what is actually learned during the encoder pretraining, we compare with a version of the ELMo model in which all weights above the lexical layer (layer 0) are replaced with random orthonormal matrices6. + +Word-Level CNN. To what extent do contextual encoders capture long-range dependencies, versus simply modeling local context? We extend our lexical baseline by introducing a fixed-width convolutional layer on top of the word representations. As comparing to the lexical baseline factors out word-level priors, comparing to this CNN baseline factors out local relationships, such as the presence of nearby function words, and allows us to see the contribution of long-range context to encoder performance. To implement this, we replace the projection layer in our probing model with a fully-connected CNN that sees $\pm 1$ or $\pm 2$ tokens around the center word (i.e. kernel width 3 or 5). + +# 5 RESULTS + +Using the above experimental design, we return to the central questions originally posed. That is, what types of syntactic and semantic information does each model encode at each position? And is the information captured primarily local, or do contextualized embeddings encode information about long-range sentential structure? + +Comparison of representation models. We report F1 scores for ELMo, CoVe, GPT, and BERT in Table 2. We observe that ELMo and GPT (with mix features) have comparable performance, with ELMo slightly better on most tasks but the Transformer scoring higher on relation classification and OntoNotes coreference. Both models outperform CoVe by a significant margin (6.3 F1 points on average), meaning that the information in their word representations makes it easier to recover details of sentence structure. It is important to note that while ELMo, CoVe, and the GPT can be applied to the same problems, they differ in architecture, training objective, and both the quantity and genre of training data $( \ S \ 3 . 2 )$ . Furthermore, on all tasks except for Winograd coreference, the lexical representations used by the ELMo and GPT models outperform GloVe vectors (by 5.4 and 2.4 points on average, respectively). This is particularly pronounced on constituent and semantic role labeling, where the model may be benefiting from better handling of morphology by character-level or subword representations. + +We observe that using ELMo-style scalar mixing (mix) instead of concatenation improves performance significantly (1-3 F1 points on average) on both deep Transformer models (BERT and GPT). We attribute this to the most relevant information being contained in intermediate layers, which agrees with observations by Blevins et al. (2018), Peters et al. (2018a), and Devlin et al. (2018), and with the finding of Peters et al. (2018b) that top layers may be overly specialized to perform next-word prediction. + +When using scalar mixing $\left( \mathrm { m i x } \right)$ , we observe that the BERT-base model outperforms GPT, which has a similar 12-layer Transformer architecture, by approximately 2 F1 points on average. The 24- layer BERT-large model performs better still, besting BERT-base by 1.1 F1 points and ELMo by 2.7 F1 - a nearly $20 \%$ relative reduction in error on most tasks. + +We find that the improvements of the BERT models are not uniform across tasks. In particular, BERT-large improves on ELMo by $7 . 4 \ \mathrm { F 1 }$ points on OntoNotes coreference, more than a $40 \%$ reduction in error and nearly as high as the improvement of the ELMo encoder over its lexical baseline. We also see a large improvement (7.8 F1 points)7 on Winograd-style coreference from BERT-large in particular, suggesting that deeper unsupervised models may yield further improvement on difficult semantic tasks. + +Genre Effects. Our probing suite is drawn mostly from newswire and web text $( \ S \ 2 )$ . This is a good match for the Billion Word Benchmark (BWB) used to train the ELMo model, but a weaker match for the Books Corpus used to train the published GPT model. To control for this, we train a clone of the GPT model on the BWB, using the code and hyperparameters of Radford et al. (2018). We find that this model performs only slightly better $( + 0 . 1 5 \ \mathrm { F 1 }$ on average) on our probing suite than the Books Corpus-trained model, but still underperforms ELMo by nearly 1 F1 point. + +Encoding of syntactic vs. semantic information. By comparing to lexical baselines, we can measure how much the contextual information from a particular encoder improves performance on each task. Note that in all cases, the contextual representation is strictly more expressive, since it includes access to the lexical representations either by concatenation or by scalar mixing. + +Table 2: Comparison of representation models and their respective lexical baselines. Numbers reported are micro-averaged F1 score on respective test sets. Lex. denotes the lexical baseline $( \ S 4 )$ for each model, and bold denotes the best performance on each task. Lines in italics are subsets of the targets from a parent task; these are omitted in the macro average. SRL numbers consider core and non-core roles, but ignore references and continuations. Winograd (DPR) results are the average of five runs each using a random sample (without replacement) of $80 \%$ of the training data. $9 5 \%$ confidence intervals (normal approximation) are approximately $\pm 3$ ( $\pm 6$ with BERT-large) for Winograd, $\pm 1$ for SPR1 and SPR2, and $\pm 0 . 5$ or smaller for all other tasks. + +
CoVeELMoGPT
Lex.FullAbs.△Lex.FullAbs. △Lex.catmix
Part-of-Speech85.794.08.490.496.76.388.294.995.0
Constituents56.181.625.469.184.615.465.181.384.6
Dependencies75.083.68.680.493.913.677.792.194.1
Entities88.490.31.992.095.63.588.692.992.5
SRL (all)59.780.420.774.190.116.067.786.089.7
Core roles56.281.024.773.692.619.065.188.092.0
Non-core roles67.778.811.175.484.18.873.981.384.1
OntoNotes coref.72.979.26.375.384.08.771.883.686.3
SPR173.777.13.480.184.84.779.283.583.1
SPR276.680.23.682.183.11.082.283.883.5
Winograd coref.52.154.32.254.353.5-0.851.752.653.8
Rel. (SemEval)51.060.69.655.777.822.158.281.381.0
Macro Average69.178.19.075.484.49.173.083.284.4
BERT-baseBERT-large
Lex.F1 Score catmixAbs.△ ELMoLex.F1 ScoreAbs.△ (base)ELMo
Part-of-Speech96.70.0catmix0.20.2
Constituents88.4 68.497.086.72.188.1 69.096.5 80.196.9 87.00.42.5
Dependencies83.795.11.180.291.595.40.31.4
Entities80.1 90.993.096.20.691.896.50.30.9
SRL (all)75.496.191.31.276.596.2 88.292.31.02.2
Core roles74.989.493.61.076.389.994.61.02.0
Non-core roles76.491.485.91.876.984.186.91.0
OntoNotes coref.74.984.7 88.790.26.375.789.691.41.22.8 7.4
SPR179.21.385.185.8-0.3
SPR284.786.1 83.879.684.10.31.0 1.0
81.783.00.781.683.2
Winograd coref. Rel. (SemEval)54.3 57.453.6 78.354.9 82.01.4 4.253.0 56.253.8 77.661.4 82.46.5 0.57.8 4.6
Macro Average75.184.886.31.975.284.287.31.02.9
+ +We observe that ELMo, CoVe, and GPT all follow a similar trend across our suite (Table 2), showing the largest gains on tasks which are considered to be largely syntactic, such as dependency and constituent labeling, and smaller gains on tasks which are considered to require more semantic reasoning, such as SPR and Winograd. We observe small absolute improvements $+ 6 . 3$ and $+ 3 . 5$ for ELMo Full vs. Lex.) on part-of-speech tagging and entity labeling, but note that this is likely due to the strength of word-level priors on these tasks. Relative reduction in error is much higher $+ 6 6 \%$ for Part-of-Speech and $+ 4 4 \%$ for Entities), suggesting that ELMo does encode local type information. + +Semantic role labeling benefits greatly from contextual encoders overall, but this is predominantly due to better labeling of core roles $( + 1 9 . 0$ F1 for ELMo) which are known to be closely tied to syntax (e.g. Punyakanok et al. (2008); Gildea & Palmer (2002)). The lexical baseline performs similarly on core and non-core roles (74 and 75 F1 for ELMo), but the more semantically-oriented non-core role labels (such as purpose, cause, or negation) see only a smaller improvement from encoded context $( + 8 . 8$ F1 for ELMo). The semantic proto-role labeling task (SPR1, SPR2) looks at the same type of core predicate-argument pairs but tests for higher-level semantic properties (§ 2), which we find to be only weakly captured by the contextual encoder $+ 1 { - } 5 \operatorname { F } 1$ for ELMo). + +![](images/d01023222939b810884a08093025bf47d68a0d56f879e5ef179963ec3406bc0b.jpg) +Figure 2: Additional baselines for ELMo, evaluated on the test sets. $\mathrm { C N N } k$ adds a convolutional layer that sees $\pm k$ tokens to each side of the center word. Lexical is the lexical baseline, equivalent to $k = 0$ . Orthonormal is the full ELMo architecture with random orthonormal LSTM and projection weights, but using the pretrained lexical layer. Full (pretrained) is the full ELMo model. Colored bands are $9 5 \%$ confidence intervals (normal approximation). + +The SemEval relation classification task is designed to require semantic reasoning, but in this case we see a large improvement from contextual encoders, with ELMo improving by 22 F1 points on the lexical baseline $5 0 \%$ relative error reduction) and BERT-large improving by another 4.6 points. We attribute this partly to the poor performance (51-58 F1) of lexical priors on this task, and to the fact that many easy relations can be resolved simply by observing key words in the sentence (for example, “caused” suggests the presence of a Cause-Effect relation). To test this, we augment the lexical baseline with a bag-of-words feature, and find that for relation classification we capture more than $70 \%$ of the headroom from using the full ELMo model.8 + +Effects of architecture. Focusing on the ELMo model, we ask: how much of the model’s performance can be attributed to the architecture, rather than knowledge from pretraining? In Figure 2 we compare to an orthonormal encoder $( \ S 4 )$ which is structurally identical to ELMo but contains no information in the recurrent weights. It can be thought of as a randomized feature function over the sentence, and provides a baseline for how the architecture itself can encode useful contextual information. We find that the orthonormal encoder improves significantly on the lexical baseline, but that overall the learned weights account for over $70 \%$ of the improvements from full ELMo. + +Encoding non-local context. How much information is carried over long distances (several tokens or more) in the sentence? To estimate this, we extend our lexical baseline with a convolutional layer, which allows the probing classifier to use local context. In Figure 2 we find that adding a CNN of width 3 $\pm 1$ token) closes $72 \%$ (macro average over tasks) of the gap between the lexical baseline and full ELMo; this extends to $79 \%$ if we use a CNN of width 5 $\pm 2$ tokens). On nonterminal constituents, we find that the CNN $\pm 2$ model matches ELMo performance, suggesting that while the ELMo encoder propagates a large amount of information about constituents $_ { + 1 5 . 4 }$ F1 vs. Lex., Table 2), most of it is local in nature. We see a similar trend on the other syntactic tasks, with 80- $90 \%$ of ELMo performance on dependencies, part-of-speech, and SRL core roles captured by CNN $\pm 2$ . Conversely, on more semantic tasks, such as coreference, SRL non-core roles, and SPR, the gap between full ELMo and the CNN baselines is larger. This suggests that while ELMo does not encode these phenomena as efficiently, the improvements it does bring are largely due to long-range information. + +![](images/4d6bb67885b8554e9597786f718d8e832f6cb1658290088a08ca3a1ee9519365.jpg) +Figure 3: Dependency labeling F1 score as a function of separating distance between the two spans. Distance 0 denotes adjacent tokens. Colored bands are $9 5 \%$ confidence intervals (normal approximation). Bars on the bottom show the number of targets (in the development set) with that distance. Lex., CNN1, CNN2, Ortho, and Full are as in Figure 2. + +We can test this hypothesis by seeing how our probing model performs with distant spans. Figure 3 shows F1 score as a function of the distance (number of tokens) between a token and its head for the dependency labeling task. The CNN models and the orthonormal encoder perform best with nearby spans, but fall off rapidly as token distance increases. The full ELMo model holds up better, with performance dropping only 7 F1 points between $d = 0$ tokens and $d = 8$ , suggesting the pretrained encoder does encode useful long-distance dependencies. + +# 6 RELATED WORK + +Recent work has consistently demonstrated the strong empirical performance of contextualized word representations, including CoVe (McCann et al., 2017), ULMFit (Howard & Ruder, 2018), ELMo (Peters et al., 2018a; Lee et al., 2018; Strubell et al., 2018; Kitaev & Klein, 2018). In response to the impressive results on downstream tasks, a line of work has emerged with the goal of understanding and comparing such pretrained representations. SentEval (Conneau & Kiela, 2018) and GLUE (Wang et al., 2018) offer suites of application-oriented benchmark tasks, such as sentiment analysis or textual entailment, which combine many types of reasoning and provide valuable aggregate metrics which are indicative of practical performance. A parallel effort, to which this work contributes, seeks to understand what is driving (or hindering) performance gains by using “probing tasks,” i.e. tasks which attempt to isolate specific phenomena for the purpose of finer-grained analysis rather than application, as discussed below. + +Much work has focused on probing fixed-length sentence encoders, such as InferSent (Conneau et al., 2017), specifically their ability to capture surface properties of sentences such as length, word content, and word order (Adi et al., 2017), as well as a broader set of syntactic features, such as tree depth and tense (Conneau et al., 2018). Other related work uses perplexity scores to test whether language models learn to encode properties such as subject-verb agreement (Linzen et al., 2016; Gulordava et al., 2018; Marvin & Linzen, 2018; Kuncoro et al., 2018). + +Often, probing tasks take the form of “challenge sets”, or test sets which are generated using templates and/or perturbations of existing test sets in order to isolate particular linguistic phenomena, e.g. compositional reasoning (Dasgupta et al., 2018; Ettinger et al., 2018). This approach is exemplified by the recently-released Diverse Natural Language Collection (DNC) (Poliak et al., 2018b), which introduces a suite of 11 tasks targeting different semantic phenomena. In the DNC, these tasks are all recast into natural language inference (NLI) format (White et al., 2017), i.e. systems must understand the targeted semantic phenomenon in order to make correct inferences about entailment. Poliak et al. (2018a) used an earlier version of recast NLI to test NMT encoders’ ability to understand coreference, SPR, and paraphrastic inference. + +Challenge sets which operate on full sentence encodings introduce confounds into the analysis, since sentence representation models must pool word-level representations over the entire sequence. This makes it difficult to infer whether the relevant information is encoded within the span of interest or rather inferred from diffuse information elsewhere in the sentence. One strategy to control for this is the use of minimally-differing sentence pairs (Poliak et al., 2018b; Ettinger et al., 2018). An alternative approach, which we adopt in this paper, is to directly probe the token representations for word- and phrase-level properties. This approach has been used previously to show that the representations learned by neural machine translation systems encode token-level properties like part-of-speech, semantic tags, and morphology (Shi et al., 2016; Belinkov et al., 2017a;b), as well as pairwise dependency relations (Belinkov, 2018). Blevins et al. (2018) goes further to explore how part-of-speech and hierarchical constituent structure are encoded by different pretraining objectives and at different layers of the model. Peters et al. (2018b) presents similar results for ELMo and architectural variants. + +Compared to existing work, we extend sub-sentence probing to a broader range of syntactic and semantic tasks, including long-range and high-level relations such as predicate-argument structure. Our approach can incorporate existing annotated datasets without the need for templated data generation, and admits fine-grained analysis by label and by metadata such as span distance. We note that some of the tasks we explore overlap with those included in the DNC, in particular, named entities, SPR and Winograd. However, our focus on probing token-level representations directly, rather than pooling over the whole sentence, provides a complementary means for analyzing these representations and diagnosing the particular advantages of contextualized vs. conventional word embeddings. + +# 7 CONCLUSION + +We introduce a suite of “edge probing” tasks designed to probe the sub-sentential structure of contextualized word embeddings. These tasks are derived from core NLP tasks and encompass a range of syntactic and semantic phenomena. We use these tasks to explore how contextual embeddings improve on their lexical (context-independent) baselines. We focus on four recent models for contextualized word embeddings–CoVe, ELMo, OpenAI GPT, and BERT. + +Based on our analysis, we find evidence suggesting the following trends. First, in general, contextualized embeddings improve over their non-contextualized counterparts largely on syntactic tasks (e.g. constituent labeling) in comparison to semantic tasks (e.g. coreference), suggesting that these embeddings encode syntax more so than higher-level semantics. Second, the performance of ELMo cannot be fully explained by a model with access to local context, suggesting that the contextualized representations do encode distant linguistic information, which can help disambiguate longer-range dependency relations and higher-level syntactic structures. + +We release our data processing and model code, and hope that this can be a useful tool to facilitate understanding of, and improvements in, contextualized word embedding models. + +# ACKNOWLEDGMENTS + +This work was conducted in part at the 2018 Frederick Jelinek Memorial Summer Workshop on Speech and Language Technologies, and supported by Johns Hopkins University with unrestricted gifts from Amazon, Facebook, Google, Microsoft and Mitsubishi Electric Research Laboratories, as well as a team-specific donation of computing resources from Google. PX, AP, and BVD were supported by DARPA AIDA and LORELEI. Special thanks to Jacob Devlin for providing checkpoints of GPT model trained on the BWB corpus, and to the members of the Google AI Language team for many productive discussions. + +# REFERENCES + +Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. In Proceedings of ICLR, 2017. + +Yonatan Belinkov. On internal language representations in deep learning: An analysis of machine translation and speech recognition. PhD thesis, Massachusetts Institute of Technology, 2018. + +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. What do neural machine translation models learn about morphology? In Proceedings of EMNLP, 2017a. + +Yonatan Belinkov, Llu´ıs Marquez, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. \` Evaluating layers of representation in neural machine translation on part-of-speech and semantic tagging tasks. In Proceedings of IJCNLP, 2017b. + +Terra Blevins, Omer Levy, and Luke Zettlemoyer. Deep RNNs encode soft hierarchical syntax. In Proceedings of ACL, 2018. + +Ondˇrej Bojar, Christian Buck, Rajen Chatterjee, Christian Federmann, Yvette Graham, Barry Haddow, Matthias Huck, Antonio Jimeno Yepes, Philipp Koehn, and Julia Kreutzer (eds.). Proceedings of the Second Conference on Machine Translation. 2017. + +Ciprian Chelba, Tomas Mikolov, Mike Schuster, Qi Ge, Thorsten Brants, Phillipp Koehn, and Tony Robinson. One billion word benchmark for measuring progress in statistical language modeling. In Proceedings of Interspeech, 2014. + +Alexis Conneau and Douwe Kiela. SentEval: An evaluation toolkit for universal sentence representations. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation, 2018. + +Alexis Conneau, Douwe Kiela, Holger Schwenk, Lo¨ıc Barrault, and Antoine Bordes. Supervised learning of universal sentence representations from natural language inference data. In Proceedings of EMNLP, 2017. + +Alexis Conneau, German Kruszewski, Guillaume Lample, Lo ´ ¨ıc Barrault, and Marco Baroni. What you can cram into a single $\$ 8#$ vector: Probing sentence embeddings for linguistic properties. In Proceedings of ACL, 2018. + +Ishita Dasgupta, Demi Guo, Andreas Stuhlmuller, Samuel J Gershman, and Noah D Goodman. ¨ Evaluating compositionality in sentence embeddings. arXiv preprint 1802.04302, 2018. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint 1810.04805, 2018. + +Allyson Ettinger, Ahmed Elgohary, Colin Phillips, and Philip Resnik. Assessing composition in sentence vector representations. In Proceedings of COLING, 2018. + +Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson F Liu, Matthew Peters, Michael Schmitz, and Luke Zettlemoyer. AllenNLP: A deep semantic natural language processing platform. In Proceedings of Workshop for NLP Open Source Software (NLP-OSS), 2018. + +Daniel Gildea and Martha Palmer. The necessity of parsing for predicate argument recognition. In Proceedings of ACL, 2002. + +Kristina Gulordava, Piotr Bojanowski, Edouard Grave, Tal Linzen, and Marco Baroni. Colorless green recurrent networks dream hierarchically. In Proceedings of NAACL, 2018. + +Luheng He, Kenton Lee, Omer Levy, and Luke Zettlemoyer. Jointly predicting predicates and arguments in neural semantic role labeling. In Proceedings of ACL, 2018. + +Iris Hendrickx, Su Nam Kim, Zornitsa Kozareva, Preslav Nakov, Diarmuid O S ´ eaghdha, Sebas- ´ tian Pado, Marco Pennacchiotti, Lorenza Romano, and Stan Szpakowicz. SemEval-2010 task 8: ´ Multi-way classification of semantic relations between pairs of nominals. In Proceedings of the Workshop on Semantic Evaluations: Recent Achievements and Future Directions, 2009. + +Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 1997. + +Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In Proceedings of ACL, 2018. + +Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of ICLR, 2015. + +Ryan Kiros, Yukun Zhu, Ruslan R. Salakhutdinov, Richard Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In Proceedings of NIPS, 2015. + +Nikita Kitaev and Dan Klein. Constituency parsing with a self-attentive encoder. In Proceedings of ACL, July 2018. + +Adhiguna Kuncoro, Chris Dyer, John Hale, Dani Yogatama, Stephen Clark, and Phil Blunsom. LSTMs can learn syntax-sensitive dependencies well, but modeling structure makes them better. In Proceedings of ACL, 2018. + +Kenton Lee, Luheng He, Mike Lewis, and Luke Zettlemoyer. End-to-end neural coreference resolution. In Proceedings of EMNLP, 2017. + +Kenton Lee, Luheng He, and Luke Zettlemoyer. Higher-order coreference resolution with coarseto-fine inference. In Proceedings of NAACL, 2018. + +Hector J. Levesque, Ernest Davis, and Leora Morgenstern. The winograd schema challenge. In Proceedings of the Thirteenth International Conference on Principles of Knowledge Representation and Reasoning, 2012. + +Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. Assessing the ability of LSTMs to learn syntaxsensitive dependencies. Transactions of the ACL, 2016. + +Rebecca Marvin and Tal Linzen. Targeted syntactic evaluation of language models. In Proceedings of EMNLP, 2018. + +Bryan McCann, James Bradbury, Caiming Xiong, and Richard Socher. Learned in translation: Contextualized word vectors. In Proceedings of NIPS, 2017. + +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S. Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Proceedings of NIPS, 2013. + +Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In Proceedings of NIPS, 2017. + +Jeffrey Pennington, Richard Socher, and Christopher Manning. GloVe: Global vectors for word representation. In Proceedings of EMNLP, 2014. + +Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of NAACL, 2018a. + +Matthew Peters, Mark Neumann, Luke Zettlemoyer, and Wen-tau Yih. Dissecting contextual word embeddings: Architecture and representation. In Proceedings of EMNLP, 2018b. + +Adam Poliak, Yonatan Belinkov, James Glass, and Benjamin Van Durme. On the evaluation of semantic phenomena in neural machine translation using natural language inference. In Proceedings of NAACL, 2018a. + +Adam Poliak, Aparajita Haldar, Rachel Rudinger, J. Edward Hu, Ellie Pavlick, Aaron Steven White, and Benjamin Van Durme. Collecting diverse natural language inference problems for sentence representation evaluation. In Proceedings of EMNLP, 2018b. + +Vasin Punyakanok, Dan Roth, and Wen-tau Yih. The importance of syntactic parsing and inference in semantic role labeling. Computational Linguistics, 34(2):257–287, 2008. + +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. https://blog.openai.com/language-unsupervised, 2018. + +Altaf Rahman and Vincent Ng. Resolving complex cases of definite pronouns: The Winograd schema challenge. In Proceedings of EMNLP, 2012. + +Rachel Rudinger, Adam Teichert, Ryan Culkin, Sheng Zhang, and Benjamin Van Durme. Neural Davidsonian semantic proto-role labeling. In Proceedings of EMNLP, 2018. + +Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of ACL, 2016. + +Xing Shi, Inkit Padhi, and Kevin Knight. Does string-based neural MT learn source syntax? In Proceedings of EMNLP, 2016. + +Natalia Silveira, Timothy Dozat, Marie-Catherine de Marneffe, Samuel Bowman, Miriam Connor, John Bauer, and Christopher D. Manning. A gold standard dependency corpus for English. In Proceedings of the Ninth International Conference on Language Resources and Evaluation, 2014. + +Emma Strubell, Patrick Verga, Daniel Andor, David Weiss, and Andrew McCallum. Linguisticallyinformed self-attention for semantic role labeling. In Proceedings of EMNLP, 2018. + +Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In Proceedings of NIPS, 2014. + +Adam Teichert, Adam Poliak, Benjamin Van Durme, and Matthew Gormley. Semantic proto-role labeling. In Proceedings of AAAI, 2017. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of NIPS, 2017. + +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, 2018. + +Ralph Weischedel, Martha Palmer, Mitchell Marcus, Eduard Hovy, Sameer Pradhan, Lance Ramshaw, Nianwen Xue, Ann Taylor, Jeff Kaufman, Michelle Franchini, et al. OntoNotes release 5.0 LDC2013T19. Linguistic Data Consortium, Philadelphia, PA, 2013. + +Aaron Steven White, Pushpendre Rastogi, Kevin Duh, and Benjamin Van Durme. Inference is everything: Recasting semantic resources into a unified evaluation framework. In Proceedings of IJCNLP, 2017. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint 1609.08144, 2016. + +Kelly Zhang and Samuel Bowman. Language modeling teaches you more than translation does: Lessons learned through auxiliary syntactic task analysis. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, 2018. + +Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In Proceedings of ICCV, 2015. + +# A CHANGES FROM ORIGINAL VERSION + +This version of the paper has been updated to include probing results on the popular BERT (Devlin et al., 2018) model, which was released after our original submission. Aside from formatting and minor re-wording, the following changes have been made: + +• We include probing results on the BERT-base and BERT-large models (Devlin et al., 2018). +• We add one additional task to Table 2, relation classification on SemEval 2010 Task 8 (Hendrickx et al., 2009), in order to better explore how pre-trained encoders capture semantic information. +• We refer to the OpenAI Transformer LM (Radford et al., 2018) as “GPT” to better reflect common usage. +• We add experiments with ELMo-style scalar mixing (Section 3.2) on the OpenAI GPT model. This improves performance slightly, and changes our conclusion that ELMo was overall superior to GPT; the two are approximately equal on average, with slight differences on some tasks. +• To reduce noise, we report the average over five runs for experiments on Winograd coreference (DPR). + +# B DATASET STATISTICS + +Table 3: For each probing task, corpus summary statistics of the number of labels, examples, tokens and targets (split by train/dev/test). Examples generally refer to sentences. For semantic role labeling, they instead refer to the total number of frames. Targets refer to the total number of classification targets (edges or spans, as described in Table 1 and Section 2). For SemEval relation classification there is no standard development split, so we use a fixed subset of $15 \%$ of the training data and use the remaining $85 \%$ to train. + +
Task|L|ExamplesTokensTotal Targets
Part-of-Speech48116K/16K/12K2.2M/305K/230K2.1M/290K/212K
Constituents30116K/16K/12K2.2M/305K/230K1.9M/255K/191K
Dependencies4913K/2.0K/2.1K204K/25K/25K204K/25K/25K
Entities18116K/16K/12K2.2M/305K/230K128K/20K/13K
SRL (all)66253K/35K/24K6.6M/934K/640K599K/83K/56K
Core roles6253K/35K/24K6.6M/934K/640K411K/57K/38K
Non-core roles21253K/35K/24K6.6M/934K/640K170K/24K/16K
OntoNotes coref.2116K/16K/12K2.2M/305K/230K248K/43K/40K
SPR1183.8K/513/55181K/11K/12K7.6K/1.1k/1.1K
SPR2202.2K/291/27647K /4.9K /5.6K4.9K/630 / 582
Winograd coref.21.0K /2.0K/2.1K14K/8.0K/14K1.8K/949 /379
Rel. (SemEval)196.9K/1.1K/2.7K117K/20K/47K6.9K/1.1K/2.7K
+ +# C MODEL DETAILS + +Because the vectors have varying dimension across probed models, and to improve performance we first project the vectors down to 256 dimensions: + +$$ +e _ { i } ^ { ( k ) } = A ^ { ( k ) } e _ { i } + b ^ { ( k ) } +$$ + +We use separate projections $( k = 1 , 2$ ) so that the model can extract different information from $s ^ { ( 1 ) }$ (for example, a predicate) and $s ^ { ( 2 ) }$ (for example, an argument). We then apply a pooling operator over the representations within a span to yield a fixed-length representation: + +$$ +r ^ { ( k ) } ( s _ { k } ) = r ^ { ( k ) } ( i _ { k } , j _ { k } ) = \mathrm { P o o l } ( e _ { i _ { k } } ^ { ( k ) } , e _ { i _ { k } + 1 } ^ { ( k ) } , \dots , e _ { j _ { k } - 1 } ^ { ( k ) } ) +$$ + +We use the sellearns a weight ng operator from Lee et al. (2017) andfor each token, then represents the span $\mathrm { H e }$ et al. (2018). Thisa sum of the vectors $z _ { i } ^ { ( k ) } = W _ { a t t } ^ { ( k ) } e _ { i } ^ { ( k ) }$ +$e _ { i _ { k } } ^ { ( k ) } , e _ { i _ { k } + 1 } ^ { ( k ) } , \ldots , e _ { j _ { k } - 1 } ^ { ( k ) }$ weighted by $a _ { i } ^ { ( k ) } = \mathrm { s o f t m a x } ( \mathbf { z } ^ { ( k ) } ) _ { i }$ . + +Finally, the pooled span representations are fed into a two-layer MLP followed by a sigmoid output layer: + +$$ +\begin{array} { c } { { h = M L P ( [ r ^ { ( 1 ) } ( s ^ { ( 1 ) } ) , r ^ { ( 2 ) } ( s ^ { ( 2 ) } ) ] ) } } \\ { { P ( \mathrm { l a b e l } _ { \ell } = 1 ) = \sigma ( W h + b ) _ { \ell } \quad \mathrm { f o r } \quad \ell = 0 , \ldots , | { \mathcal L } | } } \end{array} +$$ + +We train by minimizing binary cross entropy against the set of true labels. While convention on many tasks (e.g. SRL) is to use a softmax loss, this enforces an exclusivity constraint. By using a per-label sigmoid our model can estimate each label independently, which allows us to stratify our analysis (see $\ S 5$ ) to individual labels or groups of labels within a task. + +With the exception of ELMo scalars, we hold the weights of the sentence encoder (§ 3.2) fixed while we train our probing classifier. We train using the Adam optimizer (Kingma $\&$ Ba, 2015) with a batch $\mathrm { s i z e ^ { 9 } }$ of 32, an initial learning rate of 1e-4, and gradient clipping with max $L _ { 2 }$ norm of 5.0. We evaluate on the validation set every 1000 steps (or every 100 for SPR1, SPR2, and Winograd), halve the learning rate if no improvement is seen in 5 validations, and stop training if no improvement is seen in 20 validations. + +# D CONTEXTUAL REPRESENTATION MODELS + +CoVe The CoVe model (McCann et al., 2017) is a two-layer biLSTM trained as the encoder side of a sequence-to-sequence(Sutskever et al., 2014) English-German machine translation model. We use the original authors’ implementation and the best released pre-trained model 10. This model is trained on the WMT2017 dataset Bojar et al. (2017) which contains approximately 7 million sentences of English text. Following McCann et al. (2017), we concatenate the activations of the top-layer forward and backward LSTMs ( $\mathit { d } = 3 0 0$ each) with the pre-trained GloVe (Pennington et al., 2014) embedding11 $\angle d = 3 0 0$ ) of each token, for a total representation dimension of $d = 9 0 0$ . + +ELMo The ELMo model (Peters et al., 2018a) is a two layer LSTM trained as the concatenation of a forward and a backward language model, and built over a context-independent character CNN layer. We use the original authors’ implementation as provided in the AllenNLP (Gardner et al., 2018) toolkit12 and the standard pre-trained model trained on the Billion Word Benchmark (BWB) (Chelba et al., 2014)We take the (fixed, contextual) representation of token $i$ to be the set of three vectors $h _ { 0 , i } , h _ { 1 , i }$ , and $h _ { 2 , i }$ containing the activations of each layer of the ELMo model. Following Equation 1 of Peters et al. (2018a), we learn task-specific scalar parameters and take a weighted sum: + +$$ +e _ { i } = \gamma \left( s _ { 0 } h _ { 0 , i } + s _ { 1 } h _ { 1 , i } + s _ { 2 } h _ { 2 , i } \right) \quad \mathrm { f o r } i = 0 , 1 , \ldots , n +$$ + +to give 1024-dimensional representations for each token. + +OpenAI GPT The GPT model (Radford et al., 2018) was recently shown to outperform ELMo on a number of downstream tasks, and as of submission holds the highest score on the GLUE benchmark (Wang et al., 2018). It consists of a 12-layer Transformer (Vaswani et al., 2017) model, trained as a left-to-right language model using masked attention. We use a PyTorch reimplementation of the model13, and the pre-trained weights14 trained on the Toronto Book Corpus (Zhu et al., 2015) Unlike Radford et al. (2018), we hold the Transformer weights fixed while training our probing model in order to better understand what information is available from the pre-training procedure alone. To facilitate more direct comparison with ELMo and CoVe we concatenate (cat) the activations of the final Transformer layer $\zeta d = 7 6 8 )$ with the context-independent subword embeddings $\zeta d = 7 6 8 )$ ) to give contextual vectors of $d = 1 5 3 6$ for each (sub)-token. We also experiment with ELMo-style scalar mixing $\left( \mathrm { m i x } \right)$ , which uses additional weight parameters for each layer (embeddings plus layers 1 − 12) learned for each probing task to give a contextual vector of $d = 7 6 8$ for each (sub)-token. + +BERT The BERT model of Devlin et al. (2018) has recently shown state-of-the-art performance on a broad set of NLP tasks, outperforming ELMo and the OpenAI Transformer LM. It consists of a stack of Transformer (Vaswani et al., 2017) layers trained jointly as a masked language model and on a next-sentence prediction task. We use a PyTorch reimplementation of the model via the pytorch pretrained bert package15, and the pre-trained bert-base-uncased (12- layer) and bert-large-uncased (24-layer) models trained on the concatenation of the Toronto Books Corpus (Zhu et al., 2015, 800M words of fiction books) and English Wikipedia (2.5B words). Unlike standard usage of the BERT model (Devlin et al., 2018), we hold the Transformer weights fixed while training our probing model. We produce cat and mix representations with dimensionality $d = 1 5 3 6$ and $d = 7 6 8$ , respectively for BERT-base and $d = 2 0 4 8$ and $d = 1 0 2 4$ for BERT-large. + +# E RETOKENIZATION + +The pre-trained encoder models expect a particular tokenization of the input string, which does not always match the original tokenization of each probing set. To correct this we retokenize the probing data to match the tokenization of each encoder, which for CoVe is Moses tokenization, and for GPT and BERT is a custom subword model (Sennrich et al., 2016; Wu et al., 2016). We then align the spans to the new tokenization using a heuristic projection based on byte-level Levenshtein distance. + +The source data for our probing tasks is annotated with respect to a particular tokenization, typically the conventions of the source treebanks (Penn Treebank, Universal Dependencies, and OntoNotes 5.0). This does not always align to the tokenization of the pre-trained representation models. Consider a dummy sentence: + +• Text: I don’t like pineapples. • Native: [I do n’t like pineapples .] • Moses: [I do n \'t like pineapples .] • Subword: [_i _do _n’t _like _pinea pples .] + +An annotation on the word ”pineapples” might be expressed as $s \ = \ [ 4 , 5 )$ in the original (”native”) tokenization, but the corresponding text is span $s _ { \mathrm { M o s e s } } = [ 5 , 6 )$ under Moses tokenization and $s _ { \mathrm { s u b w o r d } } = [ 5 , 7 )$ under the particular subword model above. + +We resolve this by aligning the source and target tokenization using Levenshtein distance. We take the source tokenization $\left[ s _ { 0 } , s _ { 1 } , \ldots , s _ { m } \right]$ as given, and treat the target tokenizer as a black-box function from a string $\tilde { S }$ to a list of tokens $[ t _ { 0 } , t _ { 1 } , \ldots , t _ { n } ]$ (note that in general, $n \ne m$ ). Let $\tilde { S }$ be the source string. We create a target string $\tilde { T }$ by joining $[ t _ { 0 } , t _ { 1 } , \ldots , t _ { n } ]$ with spaces, and then compute a byte-level Levenshtein alignment16 $\tilde { A } = \mathrm { A l i g n } ( \tilde { T } , \tilde { S } )$ . We then compute token-tobyte alignments $U = \mathrm { A l i g n } ( [ t _ { 0 } , t _ { 1 } , \dots , t _ { n } ] , \tilde { { \cal T } } )$ and $V = \mathrm { A l i g n } ( [ s _ { 0 } , s _ { 1 } , \ldots , s _ { m } ] , \tilde { S } )$ . Representing the alignments as boolean adjacency matricies, we can compose them to form a token-to-token alignment $\boldsymbol { A } = \boldsymbol { U } \tilde { \boldsymbol { A } } \boldsymbol { V } ^ { T }$ . + +We then represent each source span as a boolean vector with 1s inside the span and 0s outside, e.g. $[ 2 , 4 ) = [ 0 , 0 , 1 , 1 , 0 , 0 , . . . ] \in \{ 0 , 1 \} ^ { m }$ , and project through the alignment $A$ to the target side. We recover a target-side span from the minimum and maximum nonzero indices. \ No newline at end of file diff --git a/md/train/SkB-_mcel/SkB-_mcel.md b/md/train/SkB-_mcel/SkB-_mcel.md new file mode 100644 index 0000000000000000000000000000000000000000..7951a3a2710e60be968f1b9ba69c661c18f6a97b --- /dev/null +++ b/md/train/SkB-_mcel/SkB-_mcel.md @@ -0,0 +1,338 @@ +# CENTRAL MOMENT DISCREPANCY (CMD) FOR DOMAIN-INVARIANT REPRESENTATION LEARNING + +Werner Zellinger, Edwin Lughofer & Susanne Saminger-Platz∗ + +Department of Knowledge-Based Mathematical Systems +Johannes Kepler University Linz, Austria +{werner.zellinger, edwin.lughofer, susanne.saminger-platz}@jku.at + +Thomas Grubinger & Thomas Natschlager ¨ † + +Data Analysis Systems Software Competence Center Hagenberg, Austria {thomas.grubinger, thomas.natschlaeger}@scch.at + +# ABSTRACT + +The learning of domain-invariant representations in the context of domain adaptation with neural networks is considered. We propose a new regularization method that minimizes the domain-specific latent feature representations directly in the hidden activation space. Although some standard distribution matching approaches exist that can be interpreted as the matching of weighted sums of moments, e.g. Maximum Mean Discrepancy, an explicit order-wise matching of higher order moments has not been considered before. We propose to match the higher order central moments of probability distributions by means of order-wise moment differences. Our model does not require computationally expensive distance and kernel matrix computations. We utilize the equivalent representation of probability distributions by moment sequences to define a new distance function, called Central Moment Discrepancy (CMD). We prove that CMD is a metric on the set of probability distributions on a compact interval. We further prove that convergence of probability distributions on compact intervals w. r. t. the new metric implies convergence in distribution of the respective random variables. We test our approach on two different benchmark data sets for object recognition (Office) and sentiment analysis of product reviews (Amazon reviews). CMD achieves a new state-of-the-art performance on most domain adaptation tasks of Office and outperforms networks trained with Maximum Mean Discrepancy, Variational Fair Autoencoders and Domain Adversarial Neural Networks on Amazon reviews. In addition, a post-hoc parameter sensitivity analysis shows that the new approach is stable w. r. t. parameter changes in a certain interval. The source code of the experiments is publicly available1. + +# 1 INTRODUCTION + +The collection and preprocessing of large amounts of data for new domains is often time consuming and expensive. This in turn limits the application of state-of-the-art methods like deep neural network architectures, that require large amounts of data. However, often data from related domains can be used to improve the prediction model in the new domain. This paper addresses the particularly important and challenging domain-invariant representation learning task of unsupervised domain adaptation (Glorot et al., 2011; Li et al., 2014; Pan et al., 2011; Ganin et al., 2016). In unsupervised domain adaptation, the training data consists of labeled data from the source domain(s) and unlabeled data from the target domain. In practice, this setting is quite common, as in many applications the collection of input data is cheap, but the collection of labels is expensive. Typical examples include image analysis tasks and sentiment analysis, where labels have to be collected manually. + +Recent research shows that domain adaptation approaches work particularly well with (deep) neural networks, which produce outstanding results on some domain adaptation data sets (Ganin et al., 2016; Sun & Saenko, 2016; Li et al., 2016; Aljundi et al., 2015; Long et al., 2015; Li et al., 2015; Zhuang et al., 2015; Louizos et al., 2016). The most successful methods have in common that they encourage similarity between the latent network representations w. r. t. the different domains. This similarity is often enforced by minimizing a certain distance between the networks’ domainspecific hidden activations. Three outstanding approaches for the choice of the distance function are the Proxy $\mathcal { A }$ -distance (Ben-David et al., 2010), the Kullback-Leibler (KL) divergence Kullback & Leibler (1951), applied to the mean of the activations (Zhuang et al., 2015), and the Maximum Mean Discrepancy (Gretton et al., 2006, MMD). + +Two of them, the MMD and the KL-divergence approach, can be viewed as the matching of statistical moments. The KL-divergence approach is based on mean (first raw moment) matching. Using the Taylor expansion of the Gaussian kernel, most MMD-based approaches can be viewed as minimizing a certain distance between weighted sums of all raw moments (Li et al., 2015). + +The interpretation of the KL-divergence approaches and MMD-based approaches as moment matching procedures motivate us to match the higher order moments of the domain-specific activation distributions directly in the hidden activation space. The matching of the higher order moments is performed explicitly for each moment order and each hidden coordinate. Compared to KL-divergencebased approaches, which only match the first moment, our approach also matches higher order moments. In comparison to MMD-based approaches, our method explicitly matches the moments for each order, and it does not require any computationally expensive distance- and kernel matrix computations. + +The proposed distribution matching method induces a metric between probability distributions. This is possible since distributions on compact intervals have an equivalent representation by means of their moment sequences. We utilize central moments due to their translation invariance and natural geometric interpretation. We call the new metric Central Moment Discrepancy (CMD). + +The contributions of this paper are as follows: + +• We propose to match the domain-specific hidden representations by explicitly minimizing differences of higher order central moments for each moment order. We utilize the equivalent representation of probability distributions by moment sequences to define a new distance function, which we call Central Moment Discrepancy (CMD). Probability theoretic analysis is used to prove that CMD is a metric on the set of probability distributions on a compact interval. We additionally prove that convergence of probability distributions on compact intervals w. r. t. to the new metric implies convergence in distribution of the respective random variables. This means that minimizing the CMD metric between probability distributions leads to convergence of the cumulative distribution functions of the random variables. +• In contrast to MMD-based approaches our method does not require computationally expensive kernel matrix computations. We achieve a new state-of-the-art performance on most domain adaptation tasks of Office and outperform networks trained with MMD, variational fair autoencoders and domain adversarial neural networks on Amazon reviews. +• A parameter sensitivity analysis shows that CMD is insensitive to parameter changes within a certain interval. Consequently, no additional hyper-parameter search has to be performed. + +# 2 HIDDEN ACTIVATION MATCHING + +We consider the unsupervised domain adaptation setting (Glorot et al., 2011; Li et al., 2014; Pan et al., 2011; Ganin et al., 2016) with an input space $\mathcal { X }$ and a label space $\mathcal { V }$ . Two distributions over $\mathcal { X } \times \mathcal { V }$ are given: the labeled source domain $D _ { S }$ and the unlabeled target domain $D _ { T }$ . Two corresponding samples are given: the source sample $S = ( X _ { S } , Y _ { S } ) = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n } \stackrel { \mathrm { i . i . d . } } { \sim } ( D _ { S } ) ^ { n }$ and the target sample $T = X _ { T } = \{ x _ { i } \} _ { i = 1 } ^ { m } \stackrel { \mathrm { i . i . d . } } { \sim } ( D _ { T } ) ^ { m }$ . The goal of the unsupervised domain adaptation setting is to build a classifier $f : \mathcal { X } \mathcal { Y }$ with a low target risk $R _ { T } ( \bar { f } ) = \operatorname* { P r } _ { ( x , y ) \sim D _ { T } } ( f ( x ) \bar { \neq } y )$ , while no information about the labels in $D _ { T }$ is given. + +![](images/d949f49b236dc8cf762beb46551e710cdcadbc0def130f064a8a3079eb35f3e0.jpg) +Figure 1: Schematic sketch of a three layer neural network trained with backpropagation based on objective (2). $\nabla _ { \theta }$ refers to the gradient w. r. t. $\theta$ . + +We focus our studies on neural network classifiers $f _ { \theta } : \mathcal { X } \mathcal { Y }$ with parameters $\theta \in \Theta$ , the input space $\mathcal { X } ~ = ~ \mathbb { R } ^ { I }$ with input dimension $I$ , and the label space $\mathcal { Y } ~ = ~ [ 0 , 1 ] ^ { | C | }$ with the cardinality $| C |$ of the set of classes $C$ . We further assume a network output $f _ { \theta } ( x ) \in [ 0 , 1 ] ^ { | C | }$ of an example $x \in \mathbb { R } ^ { I }$ to be normalized by the softmax-function $\sigma : \mathbb { R } ^ { | C | } [ 0 , 1 ] ^ { | C | }$ with $\begin{array} { r } { \sigma ( \dot { z } ) _ { j } = \frac { e ^ { z _ { j } } } { \sum _ { k = 1 } ^ { | C | } e ^ { z _ { k } } } } \end{array}$ for $z = \{ z _ { 1 } , \ldots , z _ { | C | } \}$ . We focus on bounded activation functions $g _ { H } : \mathbb { R } \to [ a , b ] ^ { N }$ for the hidden layer $H$ with $N$ hidden nodes, e.g. the hyperbolic tangent or the sigmoid function. Unbounded activation functions, e.g. rectified linear units or exponential linear units, can be used if the output is clipped or normalized to be bounded. Using the loss function $l : \Theta \times \mathcal { X } \times \mathcal { Y } \mathbb { R }$ , e.g. cross-entropy $\begin{array} { r } { l } { ( \theta , x , y ) = - \sum _ { i \in C } y _ { i } \log ( f _ { \theta } ( x ) _ { i } ) } \end{array}$ , and the sample set $( X , Y ) \subset \mathbb { R } ^ { I } \times [ 0 , 1 ] ^ { | C | }$ , we define the objective function as + +$$ +\operatorname* { m i n } _ { \theta \in \Theta } \mathbf { E } ( l ( \theta , X , Y ) ) +$$ + +where $\mathbf { E }$ denotes the empirical expectation, i.e. ${ \bf E } ( l ( \theta , X , Y ) ) = { \textstyle { \frac { 1 } { | ( X , Y ) | } } } \sum _ { ( x , y ) \in ( X , Y ) } l ( \theta , x , y )$ . Let us denote the source hidden activations by $A _ { H } ( \theta , X _ { S } ) = g _ { H } ( \theta _ { H } ^ { T } A _ { H ^ { \prime } } ( \theta , X _ { S } ) ) \subset [ a , b ] ^ { N }$ and the target hidden activations by $A _ { H } ( \theta , X _ { T } ) = g _ { H } ( \theta _ { H } ^ { T } A _ { H ^ { \prime } } ( \theta , X _ { T } ) ) \subset [ a , b ] ^ { N }$ for the hidden layer $H$ with $N$ hidden nodes and parameter $\theta _ { H }$ , and the hidden layer $H ^ { \prime }$ before $H$ . + +One fundamental assumption of most unsupervised domain adaptation networks is that the source risk $R _ { S } ( f )$ is a good indicator for the target risk $R _ { T } ( f )$ , when the domain-specific latent space representations are similar (Ganin et al., 2016). This similarity can be enforced by matching the distributions of the hidden activations $A _ { H } ( \theta , X _ { S } )$ and $A _ { H } ( \theta , X _ { T } )$ of higher layers $H$ . Recent stateof-the-art approaches define a domain regularizer $d : ( [ a , b ] ^ { N } ) ^ { \acute { n } } \times ( [ \bar { a } , b ] ^ { N } ) ^ { \acute { m } } [ 0 , \infty )$ , which gives a measure for the domain discrepancy in the activation space $[ a , b ] ^ { N }$ . The domain regularizer is added to the objective by means of an additional weighting parameter $\lambda$ . + +$$ +\begin{array} { r l } { \underset { \theta \in \Theta } { \operatorname* { m i n } } } & { { } \mathbf { E } ( l ( \theta , X _ { S } , Y _ { S } ) ) + \lambda \cdot d ( A _ { H } ( \theta , X _ { S } ) , A _ { H } ( \theta , X _ { T } ) ) } \end{array} +$$ + +Fig. 1 shows a sketch of the described architecture and fig. 2 shows the hidden activations of a simple neural network optimized by eq. (1) (left) and eq. (2) (right). It can be seen that similar activation distributions are obtained when being optimized on the basis of the domain regularized objective. + +# 3 RELATED WORK + +Recently, several measures $d$ for objective (2) have been proposed. One approach is the Proxy $\mathcal { A }$ - distance, given by $\hat { d } _ { A } = 2 ( 1 - 2 \epsilon )$ , where $\epsilon$ is the generalization error on the problem of discriminating between source and target samples (Ben-David et al., 2010). Ganin et al. (2016) compute the value $\epsilon$ with a neural network classifier that is simultaneously trained with the original network by means of a gradient reversal layer. They call their approach domain-adversarial neural networks. Unfortunately, a new classifier has to be trained in this approach including the need of new parameters, additional computation times and validation procedures. + +![](images/8b400c4378773bbe409c62ea1b808deadde1a9b1e7c140f6e543b12d0797353f.jpg) +Figure 2: Hidden activation distributions for a simple one-layer classification network with sigmoid activation functions and five hidden nodes trained with the standard objective (1) (left) and objective (2) that includes the domain discrepancy minimization (right). The approach of this paper was used as domain regularizer. Dark gray: activations of the source domain, light gray: activations of the target domain. + +Another approach is to make use of the MMD (Gretton et al., 2006) as domain regularizer. + +where $\begin{array} { r } { \mathbf { E } ( K ( X , Y ) ) = \frac { 1 } { | X | \cdot | Y | } \sum _ { k \in K ( X , Y ) } k } \end{array}$ is the empirical expectation of the kernel products $k$ between all examples in $X$ and $Y$ stored by the kernel matrix $K ( X , Y )$ . A suitable choice of the kernel seems to be the Gaussian kernel $e ^ { - \beta \| x - y \| ^ { 2 } }$ (Louizos et al., 2016; Li et al., 2015; Tzeng et al., 2014). This approach has two major drawbacks: (a) the need of tuning an additional kernel parameter $\beta$ , and (b) the need of the kernel matrix computation $K ( X , Y )$ (computational complexity $\mathcal { O } ( n ^ { 2 } +$ $n m + m ^ { 2 } )$ ), which becomes inefficient (resource-intensive) in case of large data sets. Concerning (a), the tuning of $\beta$ is sophisticated since no target samples are available in the domain adaptation setting. Suitable tuning procedures are transfer learning specific cross-validation methods (Zhong et al., 2010). More general methods that don’t utilize source labels include heuristics that are based on kernel space properties (Sriperumbudur et al., 2009; Gretton et al., 2012), combinations of multiple kernels (Li et al., 2015), and kernel choices that maximize the MMD test power (Sutherland et al., 2016). The drawback (b) of the kernel matrix computation can be handled by approximating the MMD (Zhao & Meng, 2015), or by using linear time estimators (Gretton et al., 2012). In this work we focus on the quadratic-time MMD with the Gaussian kernel (Gretton et al., 2012; Tzeng et al., 2014) and transfer learning specific cross-validation for parameter tuning (Zhong et al., 2010; Ganin et al., 2016). + +The two approaches MMD and the Proxy $\mathcal { A }$ -distance have in common that they do not minimize the domain discrepancy explicitly in the hidden activation space. In contrast, the authors in Zhuang et al. (2015) do so by minimizing a modified version of the Kullback-Leibler divergence of the mean activations (MKL). That is, for samples $X , Y \subset \mathbb { R } ^ { N }$ , + +$$ +\operatorname { M K L } ( X , Y ) = \sum _ { i = 1 } ^ { N } \mathbf { E } ( X ) _ { i } \log { \frac { \mathbf { E } ( X ) _ { i } } { \mathbf { E } ( Y ) _ { i } } } + \mathbf { E } ( Y ) _ { i } \log { \frac { \mathbf { E } ( Y ) _ { i } } { \mathbf { E } ( X ) _ { i } } } +$$ + +with $\mathbf { E } ( X ) _ { i }$ being the $i ^ { \mathrm { { t h } } }$ coordinate of the empirical expectation $\begin{array} { r } { \mathbf { E } ( X ) = \frac { 1 } { | X | } \sum _ { x \in X } x } \end{array}$ . This approach is fast to compute and has an explicit interpretation in the activation space. Our empirical observations (section Experiments) show that minimizing the distance between only the first moment (mean) of the activation distributions can be improved by also minimizing the distance between higher order moments. + +As noted in the introduction, our approach is motivated by the fact that the MMD and the KLdivergence approach can be seen as the matching of statistical moments of the hidden activations $A _ { H } ( \bar { \theta } , X _ { S } )$ and $A _ { H } ( \theta , X _ { T } )$ . In particular, MMD-based approaches that use the Gaussian kernel are equivalent to minimizing a certain distance between weighted sums of all moments of the hidden activation distributions (Li et al., 2015). + +We propose to minimize differences of higher order central moments of the activations $A _ { H } ( \theta , X _ { S } )$ and $\bar { \bf A } _ { H } ^ { - } ( \theta , X _ { T } )$ . The difference minimization is performed explicitly for each moment order. Our approach utilizes the equivalent representation of probability distributions in terms of its moment series. We further utilize central moments due to their translation invariance and natural geometric interpretation. Our approach contrasts with other moment-based approaches, as they either match only the first moment (MKL) or they don’t explicitly match the moments for each order (MMD). As a result, our approach improves over MMD-based approaches in terms of computational complexity with $\mathcal { O } \left( N ( n \overline { { + } } m ) \right)$ for CMD and $\mathcal { O } \left( N ( n ^ { 2 } + n m + m ^ { 2 } ) \right)$ for MMD. In contrast to MKL-based approaches more accurate distribution matching characteristics are obtained. In addition, CMD achieves a new state-of-the-art performance on most domain adaptation tasks of Office and outperforms networks trained with MMD, variational fair autoencoders and domain adversarial neural networks on Amazon reviews. + +# 4 CENTRAL MOMENT DISCREPANCY (CMD) + +In this section we first propose a new distance function CMD on probability distributions on compact intervals. The definition is extended by two theorems that identify CMD as a metric and analyze a convergence property. The final domain regularizer is then defined as an empirical estimate of CMD. The proofs of the theorems are given in the appendix. + +Definition 1 (CMD metric). Let $X = ( X _ { 1 } , \ldots , X _ { n } ) $ and $Y = ( Y _ { 1 } , \ldots , Y _ { n } )$ be bounded random vectors independent and identically distributed from two probability distributions $p$ and $q$ on the compact interval $[ a , b ] ^ { N }$ . The central moment discrepancy metric (CMD) is defined by + +$$ +C M D ( p , q ) = \frac { 1 } { \left| b - a \right| } \left\| \mathbb { E } ( X ) - \mathbb { E } ( Y ) \right\| _ { 2 } + \sum _ { k = 2 } ^ { \infty } \frac { 1 } { \left| b - a \right| ^ { k } } \left\| c _ { k } ( X ) - c _ { k } ( Y ) \right\| _ { 2 } +$$ + +where $\mathbb { E } ( X )$ is the expectation of $X$ , and + +$$ +c _ { k } ( \boldsymbol { X } ) = \left( \mathbb { E } \Big ( \prod _ { i = 1 } ^ { N } \left( \boldsymbol { X } _ { i } - \mathbb { E } ( \boldsymbol { X } _ { i } ) \right) ^ { r _ { i } } \Big ) \right) _ { r _ { 1 } + \ldots + r _ { N } = k } +$$ + +is the central moment vector of order $k$ . + +The first order central moments are zero, the second order central moments are related to variance, and the third and fourth order central moments are related to the skewness and the kurtosis of probability distributions. It is easy to see that ${ \bf C M D } ( p , q ) \ge 0$ , $\mathrm { C M D } ( p , q ) = \mathrm { C M D } ( q , p )$ , $\mathrm { C M D } ( p , q ) \leq \mathrm { C M D } ( p , r ) + \mathrm { C M D } ( r , q )$ and $p = q \Rightarrow { \bf C M D } ( p , q ) = 0$ . The following theorem shows the remaining property for CMD to be a metric on the set of probability distributions on a compact interval. + +Theorem 1. Let $p$ and $q$ be two probability distributions on a compact interval and let CMD be defined as in (5), then + +$$ +C M D ( p , q ) = 0 \Rightarrow p = q +$$ + +Our approach is to minimize the discrepancy between the domain-specific hidden activation distributions by minimizing the CMD. Thus, in the optimization procedure, we increasingly expect to see the domain-specific cumulative distribution functions approach each other. This characteristic can be expressed by the concept of convergence in distribution and it is shown in the following theorem. + +Theorem 2. Let $p _ { n }$ and $p$ be probability distributions on a compact interval and let CMD be defined as in (5), then + +$$ +C M D ( p _ { n } , p ) \to 0 \Rightarrow p _ { n } \stackrel { d } { \to } p +$$ + +where $\xrightarrow { d }$ denotes convergence in distribution. + +We define the final central moment discrepancy regularizer as an empirical estimate of the CMD metric. Only the central moments that correspond to the marginal distributions are computed. The number of central moments is limited by a new parameter $K$ and the expectation is sampled by the empirical expectation. + +Definition 2 (CMD regularizer). Let $X$ and $Y$ be bounded random samples with respective probability distributions $p$ and $q$ on the interval $[ a , b ] ^ { N }$ . The central moment discrepancy regularizer $C M D _ { K }$ is defined as an empirical estimate of the CMD metric, by + +$$ +C M D _ { K } ( X , Y ) = { \frac { 1 } { | b - a | } } \| \mathbf { E } ( X ) - \mathbf { E } ( Y ) \| _ { 2 } + \sum _ { k = 2 } ^ { K } { \frac { 1 } { | b - a | ^ { k } } } \| C _ { k } ( X ) - C _ { k } ( Y ) \| _ { 2 } +$$ + +where $\begin{array} { r } { \mathbf { E } ( X ) = \frac { 1 } { | X | } \sum _ { x \in X } x } \end{array}$ is the empirical expectation vector computed on the sample $X$ and $C _ { k } ( X ) = \mathbf { E } ( ( x - \mathbf { E } ( X ) ) ^ { k } )$ is the vector of all $k ^ { t h }$ order sample central moments of the coordinates of $X$ . + +This definition includes three approximation steps: (a) the computation of only marginal central moments, (b) the bound on the order of central moment terms via parameter $K$ , and (c) the sampling of the probability distributions by the replacement of the expected value with the empirical expectation. + +Applying approximation (a) and assuming independent marginal distributions, a zero CMD distance value still implies equal joint distributions (thm. 1) but convergence in distribution (thm. 2) applies only to the marginals. In the case of dependent marginal distributions, zero CMD distance implies equal marginals and convergence in CMD implies convergence in distribution of the marginals. However, the matching properties for the joint distributions are not obtained with dependent marginals and approximation (a). The computational complexity is reduced to be linear w. r. t. the number of samples. + +Concerning (b), proposition 1 shows that the marginal distribution specific CMD terms have an upper bound that is strictly decreasing with increasing moment order. This bound is convergent to zero. That is, higher CMD terms can contribute less to the overall distance value. This observation is experimentally strengthened in subsection Parameter Sensitivity. + +Proposition 1. Let $X$ and $Y$ be bounded random vectors with respective probability distributions $p$ and $q$ on the compact interval $[ a , b ] ^ { N }$ . Then + +$$ +\frac { 1 } { | b - a | ^ { k } } \| c _ { k } ( X ) - c _ { k } ( Y ) \| _ { 2 } \leq 2 \sqrt { N } \left( \frac { 1 } { k + 1 } \left( \frac { k } { k + 1 } \right) ^ { k } + \frac { 1 } { 2 ^ { 1 + k } } \right) +$$ + +where $c _ { k } ( X ) \ : = \ : \mathbb { E } ( ( X - \mathbb { E } ( X ) ) ^ { k } )$ is the vector of all $k ^ { t h }$ order sample central moments of the marginal distributions of $p$ . + +Concerning approximation (c), the joint application of the weak law of large numbers (Billingsley, 2008) with the continuous mapping theorem (Billingsley, 2013) proves that this approximation creates a consistent estimate. + +We would like to underline that the training of neural networks with eq. (2) and the CMD regularizer in eq. (6) can be easily realized by gradient descent algorithms. The gradients of the CMD regularizer are simple aggregations of derivatives of the standard functions $g _ { H } , x ^ { k }$ and $\lVert . \rVert _ { 2 }$ . + +# 5 EXPERIMENTS + +Our experimental evaluations are based on two benchmark datasets for domain adaptation, Amazon reviews and Office, described in subsection Datasets. The experimental setup is discussed in subsection Experimental Setup and our classification accuracy results are discussed in subsection Results. Subsection Parameter Sensitivity analysis the accuracy sensitivity w. r. t. parameter changes of $K$ for CMD and $\beta$ for MMD. + +# 5.1 DATASETS + +Amazon reviews: For our first experiment we use the Amazon reviews data set with the same preprocessing as used by Chen et al. (2012); Ganin et al. (2016); Louizos et al. (2016). The data set contains product reviews of four different product categories: books, DVDs, kitchen appliances and electronics. Reviews are encoded in 5000 dimensional feature vectors of bag-of-words unigrams and bigrams with binary labels: 0 if the product is ranked by $1 - 3$ stars and 1 if the product is ranked by 4 or 5 stars. From the four categories we obtain twelve domain adaptation tasks (each category serves once as source category and once as target category). + +Office: The second experiment is based on the computer vision classification data set from Saenko et al. (2010) with images from three distinct domains: amazon (A), webcam (W) and dslr (D). This data set is a de facto standard for domain adaptation algorithms in computer vision. Amazon, the largest domain, is a composition of 2817 images and its corresponding 31 classes. Following previous works we assess the performance of our method across all six possible transfer tasks. + +# 5.2 EXPERIMENTAL SETUP + +# Amazon Reviews: + +For the Amazon reviews experiment, we use the same data splits as previous works for every task. Thus we have 2000 labeled source examples and 2000 unlabeled target examples for training, and between 3000 and 6000 examples for testing. + +We use a similar architecture as Ganin et al. (2016) with one dense hidden layer with 50 hidden nodes, sigmoid activation functions and softmax output function. Three neural networks are trained by means of eq. (2): (a) a base model without domain regularization $\lambda = 0$ ), (b) with the MMD as domain regularizer and (c) with CMD as domain regularizer. These models are additionally compared with the state-of-the-art models VFAE (Louizos et al., 2016) and DANN (Ganin et al., 2016). The models (a),(b) and (c) are trained with similar setup as in Louizos et al. (2016) and Ganin et al. (2016). + +For the CMD regularizer, the $\lambda$ parameter of eq. (2) is set to 1, i.e. the weighting parameter $\lambda$ is neglected. The parameter $K$ is heuristically set to five, as the first five moments capture rich geometric information about the shape of a distribution and $K = 5$ is small enough to be computationally efficient. However, the experiments in subsection Parameter Sensitivity show that similar results are obtained for $K \geq 3$ . + +For the MMD regularizer we use the Gaussian kernel with parameter $\beta$ . We performed a hyperparameter search for $\beta$ and $\lambda$ , which has to be performed in an unsupervised way (no labels in the target domain). We use a variant of the reverse cross-validation approach proposed by Zhong et al. (2010), in which we initialize the model weights of the reverse classifier by the weights of the first learned classifier (see Ganin et al. (2016) for details). Thereby, the parameter $\lambda$ is tuned on 10 values between 0.1 and 500 on a logarithmic scale. The parameter $\beta$ is tuned on 10 values between 0.01 and 10 on a logarithmic scale. Without this parameter search, no competitive prediction accuracy results could be obtained. + +Since we have to deal with sparse data, we rely on the Adagrad optimizer (Duchi et al., 2011). For all evaluations, the default parametrization is used as implemented in Keras (Chollet, 2015). All evaluations are repeated 10 times based on different shuffles of the data, and the mean accuracies and standard deviations are analyzed. + +Office: Since the office dataset is rather small with only 2817 images in its largest domain, we use the latent representations of the convolution neural network VGG16 of Simonyan & Zisserman (2014). In particular we train a classifier with one hidden layer, 256 hidden nodes and sigmoid activation function on top of the output of the first dense layer in the network. We again train one base model without domain regularization and a CMD regularized version with $K = 5$ and $\lambda = 1$ . + +We follow the standard training protocol for this data set and use all available source and target examples during training. Using this ”fully-transductive” protocol, we compare our method with other state-of-the-art approaches including DLID (Chopra et al., 2013), DDC (Tzeng et al., 2014), DAN (Long et al., 2015), Deep CORAL (Sun & Saenko, 2016), and DANN (Ganin et al., 2016), based on fine-tuning of the baseline model AlexNet (Krizhevsky et al., 2012). We further compare our method to LSSA (Aljundi et al., 2015), CORAL (Sun et al., 2016), and AdaBN (Li et al., 2016), based on the fine-tuning of InceptionBN (Ioffe & Szegedy, 2015). + +As an alternative to Adagrad for non-sparse data, we use the Adadelta optimizer from Zeiler (2012). Again, the default parametrization from Keras is used. We handle unbalances between source and target sample by randomly down-sampling (up-sampling) the source sample. In addition, we ensure a sub-sampled source batch that is balanced w. r. t. the class labels. + +Since all hyper-parameters are set a-priori, no hyper-parameter search has to be performed. + +All experiments are repeated 10 times with randomly shuffled data sets and random initializations. + +# 5.3 RESULTS + +Amazon Reviews: Table 1 shows the classification accuracies of four models: The Source Only model is the non domain regularized neural network trained with objective (1), and serves as a base model for the domain adaptation improvements. The models MMD and CMD are trained with the same architecture and objective (2) with $d$ as the domain regularizer MMD and CMD, respectively. VFAE refers to the Variational Fair Autoencoder of Louizos et al. (2016), including a slightly modified version of the MMD regularizer for faster computations, and DANN refers to the domainadversarial neural networks model of Ganin et al. (2016). The last two columns are taken directly from these publications. + +As one can observe in table 1, our accuracy of the CMD-based model is the highest in 9 out of 12 domain adaptation tasks, whereas on the remaining 3 it is the second best method. However, the difference in accuracy compared to the best method is smaller than the standard deviation over all data shuffles. + +Table 1: Prediction accuracy $\pm$ standard deviation on the Amazon reviews dataset. The last two columns are taken directly from Louizos et al. (2016) and Ganin et al. (2016). + +
Source->TargetSource OnlyMMDCMDVFAEDANN
books-→dvd.787 ± .004.796 ± .008.805 ± .007.799.784
books-→electronics.714± .009.758 ± .018.787 ± .007.792.733
books-→kitchen.745 ± .006.787 ± .019.813 ± .008.816.779
dvd->books.746 ± .019.780 ± .018.795 ± .005.755.723
dvd->electronics.724 ± .011.766 ± .025.797 ± .010.786.754
dvd->kitchen.765 ± .012.796 ± .019.830 ± .012.822.783
electronics-→books.711 ± .006.733 ± .017.744 ± .008.727.713
electronics-→dvd.719 ± .009.748 ± .013.763 ± .006.765.738
electronics-→kitchen.844 ± .005.857 ± .007.860 ± .004.850.854
kitchen-→books.699 ± .014.740 ± .017.756 ± .006.720.709
kitchen->dvd.734 ± .011.763 ± .011.775 ± .005.733.740
kitchen-→electronics.833 ± .004.844 ± .007.854 ± .003.838.843
average.752 ± .009.781 ± .015.798 ± .007.784.763
+ +Office: Table 2 shows the classification accuracy of different models trained on the Office dataset. Note that some of the methods (LSSA, CORAL and AdaBN) are evaluated based on the InceptionBN model, which shows higher accuracy than the base model (VGG16) of our method in most tasks. However, our method outperforms related state-of-the-art methods on all except two tasks, on which it performs similar. We improve the previous state-of-the-art method AdaBN (Li et al., 2016) by more than $3 . 2 \%$ in average accuracy. + +# 5.4 PARAMETER SENSITIVITY + +The first sensitivity experiment aims at providing evidence regarding the accuracy sensitivity of the CMD regularizer w. r. t. parameter changes of $K$ . That is, the contribution of higher terms in the CMD regularizer are analyzed. The claim is that the accuracy of CMD-based networks does not depend strongly on the choice of $K$ in a range around its default value 5. + +In fig. 3 on the upper left we analyze the classification accuracy of a CMD-based network trained on all tasks of the Amazon reviews experiment. We perform a grid search for the two regularization hyper-parameters $\lambda$ and $K$ . We empirically choose a representative stable region for each parameter, [0.3, 3] for $\lambda$ and $\{ 1 , . . . , 7 \}$ for $K$ . Since we want to analyze the sensitivity w. r. t. $K$ , we averaged over the $\lambda$ -dimension, resulting in one accuracy value per $K$ for each of the 12 tasks. Each accuracy is transformed into an accuracy ratio value by dividing it with the accuracy of $K = 5$ . Thus, for each $K$ and task we get one value representing the ratio between the obtained accuracy (for this $K$ and task) and the accuracy of $K = 5$ . The results are shown in fig. 3 (upper left). The accuracy ratios between $K = 5$ and $K \in \{ 3 , 4 , 6 , 7 \}$ are lower than $0 . 5 \%$ , which underpins the claim that the accuracy of CMD-based networks does not depend strongly on the choice of $K$ in a range around its default value 5. For $K = 1$ and $K = 2$ higher ratio values are obtained. In addition, for these two values many tasks show worse accuracy than obtained by $K \in \{ 3 , 4 , 5 , 6 , 7 \}$ . From this we additionally conclude that higher values of $K$ are preferable to $K = 1$ and $K = 2$ . + +Table 2: Prediction accuracy $\pm$ standard deviation on the Office dataset. The first 10 rows are taken directly from the papers of Ganin et al. (2016) and Li et al. (2016). The models DLID –DANN are based on the AlexNet model, LSSA –AdaBN are based on the InceptionBN model, and our method (CMD) is based on the VGG16 model. + +
MethodA→WD→WW→DA→DD→AW→Aaverage
AlexNet.616.954.990.638.511.498.701
DLID.519.782.899--
DDC.618.950.985.644.521.522.707
Deep CORAL.664.957.992.668.528.515.721
DAN.685.960.990.670.540.531.729
DANN.730.964.992----
InceptionBN.703.9431.00.705.601.579.755
LSSA.677.961.984.713.578.578.749
CORAL.709.957.998.719.590.602.763
AdaBN.742.957.998.731.598.574.767
VGG16.676 ± .006.961 ± .003.992 ± .002.739 ± .009.582 ± .005.578 ± .004.755
CMD.770± .006.963 ± .004.992 ± .002.796 ± .006.638 ± .007.633 ± .006.799
+ +The same experimental procedure is performed with MMD regularization wighted by $\lambda \in [ 5 , 4 5 ]$ and Gaussian kernel parameter $\beta \in [ 0 . 3 , 1 . 7 ]$ . We calculate the ratio values w. r. t. the accuracy of $\beta = 1 . 2$ , since this value of $\beta$ shows the highest mean accuracy of all tasks. Fig. 3 (upper right) shows the results. It can be seen that the accuracy of the MMD network is more sensitive to parameter changes than the CMD regularized version. Note that the problem of finding the best settings for the parameter $\beta$ of the Gaussian kernel is a well known problem (Hsu et al., 2003). + +The default number of hidden nodes in all our experiments is 256 because of the high classification accuracy of the networks without domain regularization (Source Only) on the source domains. The question arises if the accuracy of the CMD is lower for higher numbers of hidden nodes. That is, if the accuracy ratio between the accuracy, of the CMD regularized networks compared to the accuracy of the Source Only models, decreases with increasing hidden activation dimension. In order to answer this question we calculate these ratio values for each task of the Amazon reviews data set for different number of hidden nodes $( 1 2 8 , 2 5 6 , 3 8 4 , \dots , 1 6 6 4 )$ . For higher numbers of hidden nodes our Source Only models don’t converge with the optimization settings under consideration. For the parameters $\lambda$ and $K$ we use our default setting $\lambda = 1$ and $K = 5$ . Fig. 3 on the lower left shows the ratio values (vertical axis) for every number of hidden nodes (horizontal axis) and every task (colored lines). It can be seen that the accuracy improvement of the CMD domain regularizer varies between $4 \%$ and $6 \%$ . However, no accuracy ratio decrease can be observed. + +Please note that we use a default setting for $K$ and $\lambda$ . Thus, fig. 3 shows that our default setting $( \lambda = 1 , K = 5 )$ ) can be used independently of the number of hidden nodes. This is an additional result. + +The same procedure is performed with the MMD weighted by parameter $\lambda = 9$ and $\beta = 1 . 2$ as these values show the highest classification accuracy for 256 hidden nodes. Fig. 3 on the lower right shows that the accuracy improvement using the MMD decreases with increasing number of hidden nodes for this parameter setting. That is, for accurate performance of the MMD, additional parameter tuning procedures for $\lambda$ and $\beta$ need to be performed. Note that the problem of finding the best setting for the parameter $\beta$ of the Gaussian kernel is a well known problem (Hsu et al., 2003). + +# 6 CONCLUSION AND OUTLOOK + +In this paper we proposed the central moment discrepancy (CMD) for domain-invariant representation learning, a distance function between probability distributions. Similar to other state-of-the-art approaches (MMD, KL-divergence, Proxy $\mathcal { A }$ -distance), the CMD function can be used to minimize the domain discrepancy of latent feature representations. This is achieved by order-wise differences of central moments. By using probability theoretic analysis, we proved that CMD is a metric and that convergence in CMD implies convergence in distribution for probability distributions on compact intervals. Our method yields state-of-the-art performance on most tasks of the Office benchmark data set and outperforms Gaussian kernel based MMD, VFAE and DANN on most tasks of the Amazon reviews benchmark data set. These results are achieved with the default parameter setting of $K = 5$ . In addition, we experimentally underpinned the claim that the classification accuracy is not sensitive to the particular choice of $K$ for $K \geq 3$ . Therefore, no computationally expensive hyper-parameter selection is required. + +![](images/148b54999e298debe226db502ce3049a16ec505493a70cbdc28e5e3458045499.jpg) +Figure 3: Sensitivity of classification accuracy w. r. t. different parameters of CMD (left) and MMD (right) on the Amazon reviews dataset. The horizontal axes show parameter values and the vertical axes show accuracy ratio values. Each line represents accuracy ratio values for one specific task. The ratio values are computed w. r. t. the default accuracy for CMD (upper left), w. r. t. the best obtainable accuracy for MMD (upper right) and w. r. t. the non domain regularized network accuracies (lower left and lower right). + +In our experimental analysis we compared our approach to different other state-of-the-art distribution matching methods like the Maximum Mean Discrepancy (MMD) based on the Gaussian kernel using a quadratic time estimate. In the future we want to extend our experimental analysis to other MMD approaches including other kernels, parameter selection procedures and linear time estimators. In addition, we plan to use the CMD for training generative models and to further investigate the approximation quality of the proposed empirical estimate. + +# A THEOREM PROOFS + +Theorem 1. Let $p$ and $q$ be two probability distributions on a compact interval and let CMD be defined as in (5), then + +$$ +C M D ( p , q ) = 0 \Rightarrow p = q +$$ + +Proof. Let $X$ and $Y$ be two random vectors that have probability distributions $p$ and $q$ , respectively. Let ${ \hat { X } } = X - \mathbb { E } ( X )$ and $\hat { Y } = Y - \mathbb { E } ( Y )$ be the mean centered random variables. From $\mathbf { C M D } ( p , q ) = 0$ it follows that all moments of the bounded random variables $\hat { X }$ and $\hat { Y }$ are equal. Therefore, the joint moment generating functions of $\hat { X }$ and $\hat { Y }$ are equal. Using the property that $p$ and $q$ have compact support, we obtain the equality of the joint distribution functions of $\hat { X }$ and $\hat { Y }$ . Since $\mathbb { E } ( X ) = \mathbb { E } ( Y )$ , it follows that $X = Y$ . □ + +Theorem 2. Let $p _ { n }$ and $p$ be probability distributions on a compact interval and let CMD be defined as in (5), then + +$$ +C M D ( p _ { n } , p ) \to 0 \Rightarrow p _ { n } \stackrel { d } { \to } p +$$ + +where $\xrightarrow { d }$ denotes convergence in distribution. + +Proof. Let $X _ { n }$ and $X$ be random vectors that have probability distributions $p _ { n }$ and $p$ respectively. Let ${ \hat { X } } = X - \mathbb { E } ( X )$ and ${ \hat { X } } _ { n } \ = \ X _ { n } - \mathbb { E } ( X _ { n } )$ be the mean centered random variables. From $\mathrm { C M D } ( X _ { n } , X ) \to 0$ it follows that the moments of $\hat { X } _ { n }$ converge to the moments of $\hat { X }$ . Therefore, the joint moment generating functions of $\hat { X } _ { n }$ converge to the joint moment generating function of $\hat { X }$ , which implies convergence in distribution of the mean centered random variables. Using $\mathbb { E } ( X _ { n } ) \mathbb { E } ( X )$ we obtain $p _ { n } \stackrel { d } { \to } p$ . □ + +Proposition 1. Let $X$ and $Y$ be bounded random vectors with respective probability distributions $p$ and $q$ on the compact interval $[ a , b ] ^ { N }$ . Then + +$$ +\frac { 1 } { | b - a | ^ { k } } \| c _ { k } ( X ) - c _ { k } ( Y ) \| _ { 2 } \leq 2 \sqrt { N } \left( \frac { 1 } { k + 1 } \left( \frac { k } { k + 1 } \right) ^ { k } + \frac { 1 } { 2 ^ { 1 + k } } \right) +$$ + +where $c _ { k } ( X ) \ : = \ : \mathbb { E } ( ( X - \mathbb { E } ( X ) ) ^ { k } )$ is the vector of all $k ^ { t h }$ order sample central moments of the marginal distributions of $p$ . + +Proof. Let $\textstyle { \mathcal { X } } ( [ a , b ] )$ be the set of all random variables with values in $[ a , b ]$ . Then it follows that + +$$ +\begin{array} { r l } { \frac { 1 } { \left. \hat { b } - a \right. ^ { k } } \left. \epsilon _ { k } ( X ) - c _ { k } ( Y ) \right. _ { 2 } = \left. \frac { c _ { k } ( X ) } { \left. \hat { b } - a \right. ^ { k } } - \frac { c _ { k } ( Y ) } { \left. \hat { b } - a \right. ^ { k } } \right. _ { 2 } } & { } \\ { \leq \left. \frac { c _ { k } ( X ) } { \left. \hat { b } - a \right. ^ { k } } \right. _ { 2 } + \left. \frac { c _ { k } ( Y ) } { \left. \hat { b } - a \right. ^ { k } } \right. _ { 2 } } & { } \\ { = \left. \mathbb { E } \left( \left( \frac { X - \mathbb { E } ( X ) } { \left. b - a \right. } \right) ^ { k } \right) \right. _ { 2 } + \left. \mathbb { E } \left( \left( \frac { Y - \mathbb { E } ( Y ) } { \left. b - a \right. } \right) ^ { k } \right) \right. _ { 2 } } & { } \\ { \leq \left. \mathbb { E } \left( \left. \frac { X - \mathbb { E } ( X ) } { b - a } \right. ^ { k } \right) \right. _ { 2 } + \left. \mathbb { E } \left( \left. \frac { Y - \mathbb { E } ( Y ) } { b - a } \right. ^ { k } \right) \right. _ { 2 } } & { } \\ { \leq 2 \sqrt { N } \underset { X \in \mathcal { X } ( \{ a , b \} ) } { \overset { \mathrm { u p } } { \sum } } \mathbb { E } \left( \left. \frac { X - \mathbb { E } ( X ) } { b - a } \right. ^ { k } \right) } & { } \end{array} +$$ + +The latter term refers to the absolute central moment of order $k$ , for which the smallest upper bound is known (Egozcue et al., 2012): + +$$ +{ \frac { 1 } { | b - a | ^ { k } } } \left\| c _ { k } ( X ) - c _ { k } ( Y ) \right\| _ { 2 } \leq 2 { \sqrt { N } } \operatorname* { s u p } _ { x \in [ 0 , 1 ] } x ( 1 - x ) ^ { k } + ( 1 - x ) x ^ { k } +$$ + +Egozcue et al. (2012) also give a more explicit bound: + +$$ +\frac { 1 } { | b - a | ^ { k } } \left\| c _ { k } ( X ) - c _ { k } ( Y ) \right\| _ { 2 } \leq 2 \sqrt { N } \left( \frac { 1 } { k + 1 } \left( \frac { k } { k + 1 } \right) ^ { k } + \frac { 1 } { 2 ^ { 1 + k } } \right) +$$ + +# ACKNOWLEDGEMENTS + +The research reported in this paper has been supported by the Austrian Ministry for Transport, Innovation and Technology, the Federal Ministry of Science, Research and Economy, and the Province of Upper Austria in the frame of the COMET center SCCH. + +We would like to thank Bernhard Moser and Florian Sobieczky for fruitful discussions on metric spaces. + +# REFERENCES + +Rahaf Aljundi, Remi Emonet, Damien Muselet, and Marc Sebban. Landmarks-based kernelized ´ subspace alignment for unsupervised domain adaptation. In International Conference on Computer Vision and Pattern Recognition, pp. 56–63, 2015. + +Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010. + +Patrick Billingsley. Probability and measure. John Wiley & Sons, 2008. + +Patrick Billingsley. Convergence of probability measures. John Wiley & Sons, 2013. + +Minmin Chen, Zhixiang Xu, Kilian Weinberger, and Fei Sha. Marginalized denoising autoencoders for domain adaptation. International Conference on Machine Learning, pp. 767–774, 2012. + +Franc¸ois Chollet. Keras: Deep learning library for theano and tensorflow, 2015. + +Sumit Chopra, Suhrid Balakrishnan, and Raghuraman Gopalan. Dlid: Deep learning for domain adaptation by interpolating between domains. International Conference on Machine Learning Workshop on Challenges in Representation Learning, 2013. + +John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011. + +Martin Egozcue, Luis Fuentes Garc´ıa, Wing Keung Wong, and Ricardas Zitikis. The smallest upper bound for the pth absolute central moment of a class of random variables. The Mathematical Scientist, 2012. + +Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. Journal of Machine Learning Research, 17(Jan):1–35, 2016. + +Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Domain adaptation for large-scale sentiment classification: A deep learning approach. In International Conference on Machine Learning, pp. 513–520, 2011. + +Arthur Gretton, Karsten M Borgwardt, Malte Rasch, Bernhard Scholkopf, and Alex J Smola. A ker- ¨ nel method for the two-sample-problem. In Advances in neural information processing systems, pp. 513–520, 2006. + +Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Scholkopf, and Alexander Smola. ¨ A kernel two-sample test. Journal of Machine Learning Research, 13(Mar):723–773, 2012. + +Chih-Wei Hsu, Chih-Chung Chang, Chih-Jen Lin, et al. A practical guide to support vector classification. 2003. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448– 456, 2015. + +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. + +Solomon Kullback and Richard A Leibler. On information and sufficiency. Annals of Mathematical Statistics, 22(1):79–86, 1951. + +Yanghao Li, Naiyan Wang, Jianping Shi, Jiaying Liu, and Xiaodi Hou. Revisiting batch normalization for practical domain adaptation. arXiv preprint arXiv:1603.04779, 2016. + +Yujia Li, Kevin Swersky, and Richard Zemel. Unsupervised domain adaptation by domain invariant projection. In Neural Information Processing Systems Workshop on Transfer and Multitask Learning, 2014. + +Yujia Li, Kevin Swersky, and Richard Zemel. Generative moment matching networks. In International Conference on Machine Learning, pp. 1718–1727, 2015. + +Mingsheng Long, Yue Cao, Jianmin Wang, and Michael Jordan. Learning transferable features with deep adaptation networks. In International Conference on Machine Learning, pp. 97–105, 2015. + +Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard Zemel. The variational fair auto encoder. International Conference on Learning Representations, 2016. + +Sinno Jialin Pan, Ivor W Tsang, James T Kwok, and Qiang Yang. Domain adaptation via transfer component analysis. IEEE Transactions on Neural Networks, 22(2):199–210, 2011. + +Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In European Conference on Computer Vision, pp. 213–226. Springer, 2010. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations, 2014. + +Bharath K Sriperumbudur, Kenji Fukumizu, Arthur Gretton, Gert RG Lanckriet, and Bernhard Scholkopf. Kernel choice and classifiability for rkhs embeddings of probability distributions.¨ In Advances in neural information processing systems, pp. 1750–1758, 2009. + +Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. arXiv preprint arXiv:1607.01719, 2016. + +Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In AAAI Conference on Artificial Intelligence, 2016. + +Dougal J Sutherland, Hsiao-Yu Tung, Heiko Strathmann, Soumyajit De, Aaditya Ramdas, Alex Smola, and Arthur Gretton. Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488, 2016. + +Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014. + +Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012. + +Ji Zhao and Deyu Meng. Fastmmd: Ensemble of circular discrepancy for efficient two-sample test. Neural computation, 27(6):1345–1372, 2015. + +Erheng Zhong, Wei Fan, Qiang Yang, Olivier Verscheure, and Jiangtao Ren. Cross validation framework to choose amongst models and datasets for transfer learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 547–562. Springer, 2010. + +Fuzhen Zhuang, Xiaohu Cheng, Ping Luo, Sinno Jialin Pan, and Qing He. Supervised representation learning: Transfer learning with deep autoencoders. In International Joint Conference on Artificial Intelligence, 2015. \ No newline at end of file diff --git a/md/train/SkFAWax0-/SkFAWax0-.md b/md/train/SkFAWax0-/SkFAWax0-.md new file mode 100644 index 0000000000000000000000000000000000000000..6cadd9f1d736d1657c1b573ecac6cbce7afa4c48 --- /dev/null +++ b/md/train/SkFAWax0-/SkFAWax0-.md @@ -0,0 +1,300 @@ +# VOICELOOP: VOICE FITTING AND SYNTHESIS VIA A PHONOLOGICAL LOOP + +Yaniv Taigman, Lior Wolf, Adam Polyak and Eliya Nachmani + +Facebook AI Research {yaniv, wolf, adampolyak, eliyan} $@$ fb.com + +# ABSTRACT + +We present a new neural text to speech (TTS) method that is able to transform text to speech in voices that are sampled in the wild. Unlike other systems, our solution is able to deal with unconstrained voice samples and without requiring aligned phonemes or linguistic features. The network architecture is simpler than those in the existing literature and is based on a novel shifting buffer working memory. The same buffer is used for estimating the attention, computing the output audio, and for updating the buffer itself. The input sentence is encoded using a context-free lookup table that contains one entry per character or phoneme. The speakers are similarly represented by a short vector that can also be fitted to new identities, even with only a few samples. Variability in the generated speech is achieved by priming the buffer prior to generating the audio. Experimental results on several datasets demonstrate convincing capabilities, making TTS accessible to a wider range of applications. In order to promote reproducibility, we release our source code and models1. + +# 1 INTRODUCTION + +We study the task of mimicking a person’s voice based on samples that are captured in-the-wild. As far as we know, no other solution exists for this highly applicable learning problem. While the current systems are mostly based on carefully collected or curated audio samples, our method is able to employ the audio of public speeches (from youtube), despite a large amount of background noise and clapping and even with an inaccurate automatic transcript. Moreover, almost all in-the-wild videos contain multiple other speakers that become challenging voice sample outliers and, in some cases, the videos are shot with home equipment and are of reduced quality. + +Our method, called VoiceLoop, is inspired by a working-memory model known as the phonological loop (Baddeley, 1986). The loop holds verbal information for short periods of time. It comprises both a phonological store, where information is constantly being replaced, and a rehearsal process, which maintains longer-term representations in the phonological store. + +In our method, we construct a phonological store by employing a shifting buffer that is best seen as a matrix $S ~ \in \mathbb { R } ^ { d \times k }$ with columns $\bar { S } [ 1 ] \ldots S [ k ]$ . At every time point, all columns shift to the right $( S [ i + 1 ] = S [ i ]$ for $1 \leq i < k \}$ ), column $k$ is discarded, and a new representation vector $u$ is placed in the first position $( S [ 1 ] = u )$ ). $u$ is a function of four parameters, among which are the latest “spoken” output and the buffer $S$ itself. The buffer is, therefore, constantly refreshed with new information, similar to the phonological store, and the mechanism that creates the representations reuses the existing information in the buffer, thus creating long term dependencies. + +The two other input parameters of the network that computes the new representation $u$ are the identity of the speaker and the current attention-mediated context. The identity is captured by a learned embedding and is stored in a lookup table (for the individuals in the training set) or fitted (for new individuals). The usage of this embedding for the phonological store means that it influences the dynamic behavior of the store, the attention mechanism and the output process. Since the last process requires heavy personalization, it also receives the identity embedding directly. + +![](images/a0456ecc35aa3e52127fdd48e495db69d8c185454a419ec899a6e62f7b9bc2e2.jpg) +Figure 1: An overview of the VoiceLoop architecture. The reader combines the encoding of the sentence’s phonemes using the attention weights to create the current context. A new representation is created by a shallow network that receives the context, the speaker ID, the previous output, and the buffer. The new representation is inserted into the buffer and the earliest vector in the buffer is discarded. The output is obtained by another shallow network that receives the buffer and the speaker as inputs. Once trained, fitting a new voice is done by freezing the network, except for the speaker embedding. + +The input sentences in our system are represented as a list of phonemes. Each phoneme out of the 42 in the dictionary being employed, is encoded as a short vector. The encoding of an input sentence is the list of vectors which corresponds to its list of phonemes. The context, either through a Recurrent Neural Network (RNN) or triphones, is not used. + +At each time point, the encodings of the phonemes are weighted and then summed, using a vector of attention weights, to form the current context vector. As attention mechanism, we employ the Graves attention model (Graves, 2013), which ensures a monotonic increase in the position along the sequence of input phonemes. + +A few properties of our methods stand out in the landscape of neural text to speech work: (i) Instead of conventional RNNs, we propose to employ a memory buffer. (ii) The same memory is shared between all processes and is repeatedly used to make all inferences. (iii) We employ shallow fully-connected networks for all computations. (iv) The input encoding part of the “reader” mechanism is extremely simple. + +We hypothesize that these properties make our architecture more robust than existing methods and allow us to mimic speakers based on noisy and limited training data. Moreover, since the output is more directly linked to the inputs, we are able to fit new speakers using relatively short audio sequences coupled with automatically generated text. + +Finally, the output of our system is deterministic, given its input. However, multiple intonations are readily generated by employing priming, which involves initializing the buffer $S$ prior to the synthesis process. + +Experimentally, we evaluate our method in two ways. For TTS quality, we follow the standard Mean Opinion Score (MOS) experiment done by Arik et al. (2017a). For speaker identification, we train a multi-class network which achieves near-perfect performance on a real validation set, and test it against generated ones. + +# 2 PREVIOUS WORK + +Text to speech (TTS) methods can be mostly classified into four families: rule-based, concatenative, statistical-parametric (mostly HMM based), and neural. HMM-based methods (Zen et al., 2009) require careful collection of the samples, or as recently attempted by Baljekar & Black, filtering of noisy samples for in-the-wild application. Concatenative methods are somewhat less restrictive but still require tens of minutes of clean and well transcribed samples from the target voice. Emerging neural methods may hold the (currently unrealized) promise of allowing the imitation of new speakers, based on limited and unconstrained samples captured in the wild. + +Very recent neural TTS systems include the Deep Voice systems DV1 (Arik et al., 2017b) & DV2 (Arik et al., 2017a), WaveNet (Oord et al., 2016), Char2Wav (Sotelo et al., 2017), and Tacotron (Wang et al., 2017). The DV2 system is a well-engineered system, which includes specialized subsystems for segmenting phonemes, predicting phoneme duration, and predicting the fundamental frequency. Each subsystem includes stacked bidirectional recurrent networks, multilayer fully connected networks and many residual connections. This stands in stark contrast to our system, which employs a single shared memory, one output process, and shallow fully connected networks. + +DV2 is the only other current method that models multiple speakers in a single network. However, in contrast to our results, there are three critical differences: (a) There are no in-the-wild experiments; (b) no fitting to a new speaker that did not appear in the training set is shown possible; and (c) the authors employ a large private set and delegate the attention problem to sub-systems, including strong ground-truth alignment between phonemes, waveforms and linguistic features. The linguistic features, which comprise of phone duration, syllable stress, number of syllables in a word and position of the current syllable in a phrase, are also used during inference for generating the samples (used in the subjective Mean Opinion Score tasks as well). In contrast, our method learns “where to read” from the input. Note that (a) and (b) are crucial capabilities in making TTS accessible to a wide range of applications, in particular when casually and efficiently modeling non-professional speakers. The need for professionally collected datasets and the lack of post-training fitting could be inherent to the DV2 architecture, since it has a large number of speaker-dependent modules, whereas we fit a new speaker in a single place. + +The Tacotron system employs a multi-stage encoder-decoder architecture with multiple RNNs and a block called CBHG (Lee et al., 2016) components, with each CBHG containing multiple convolutional layers, a highway network (Srivastava et al., 2015), and a bidirectional GRU (Cho et al., 2014). The output is a synthesized spectrogram, from which the audio is reconstructed by the GriffinLim (Griffin & Lim, 1984) method. Trained on a large private training set recorded by a professional single speaker, the Tacotron system is able to read raw text (characters and not phonemes). While Tacotron was not trained for multiple speakers, Arik et al. (2017a) have done so and report a high level of sensitivity to the choice of parameters and a need to incorporate the input embedding in many network sites. The Char2Wav architecture employs RNNs for both the reader and the generator. As an attention mechanism, the Graves positional attention mechanism (Graves, 2013) is used. The same attention mechanism is used in our work. However, in our case, the parameters of the attention model are based on the shared memory store (the buffer). Similarly to our method, the network was also trained to predict vocoder features. In addition, for added quality, the vocoder was replaced by a SampleRNN network (Mehri et al., 2016). In contrast to the above mentioned systems, which employ RNNs, the WaveNet architecture is based on stacks of dilated convolutions, which are termed “causal” for not looking into the future. The output audio is generated sample by sample, which, at typical sampling rates of thousands of hertz, is too slow for current TTS applications. Wavenet has shown single-speaker TTS capabilities, but not multi-speaker. + +Waveforms Synthesis There is currently no TTS method which can synthesize waveforms from scratch. WaveNet, DV1, DV2, Char2wav and Tacotron were all conditioned on top of lower level generators. Wavenet was conditioned on F0 vocoder features, as well as linguistic features extracted from separately trained RNN-based text representations. SampleRNNs were employed on top of vocoders. Tacotron synthesized spectograms from mel-spectograms, approximating waveforms using Griffin-Lim. As observed by DV2, small errors in the spectrogram generation result in unnatural (metallic) noise in the reconstruction. Further audio processing can be used to alleviate them, but to a limited extent. Better results were achieved (Arik et al., 2017a) by replacing Griffin-Lim with a Wavenet-like net conditioned on the generated spectogram and speaker. + +Table 1: The components of the VoiceLoop model + +
SymbolDescriptionComputed as:
St ∈Rdxk 2aiaier ut∈Rd EeRdpxl zERds Kt,βt,Yt ∈RC Ht,O²,Y∈RC at∈Rl Ct ∈Rdpbuffer at time t new representation for the buffer embedding of the input sequence embedding of the current speaker attention model parameters attention GMM parameters attention vector at time t context vector at time tSt[1]= ut; St[i+1]= St-1[i] Nu([St-1,[ct +tanh(Fuz),Ot-1]l) E[i]=LUTp[si] LUTs[id] orSec. 3.2 Na(St-1) μt= μt-1+et,σ²=eβt,γt=sm(Yt) See Eq.3,4 Ct =Eαt
Ot ERd Nu :kd+dp+do→d Nrureees Na :kd →3c N:kd →do LUTp ∈Rdp×42 LUT∈RdsXN Fu:ds→dp F:ds→dooutput vector at time t buffer update network attention network output network embedding of each phoneme embedding of the speakers projection of the speaker for update projection of the speaker for outputN(St)+Foz
d sraaeieetr k d ds C S1...St,1≤s≤42 1 Ndimensionality of the buffer capacity of the buffer dim.of the input embedding LUT dim.of the vocoder feature vector dim. of the speaker embedding # GMM component (attention model) input sequence length of the input sequence number of speakers in the training setdp+do 20 256 63 dp 10
+ +Our system was designed with simplicity in mind in order to promote robustness and reproducibility. We focus on modeling the underlying generation process and do not integrate or condition explicitly for waveforms synthesis. Instead, we employ the WORLD (Morise et al., 2016) vocoder (D4C edition) for feature extraction and waveform synthesis. While this bounds the achievable quality, we also experimented with adding WaveNet and SampleRNN. However, the added performance did not seem to justify the extra effort, especially for in-the-wild voice training data, where we observed no improvement. + +Differentiable Memory The differentiable buffer architecture, in which a new representation is added at every step, and the last vector added is discarded in a FIFO manner, is novel as far as we know. There are multiple other network models in the literature that are augmented by an external memory structure, e.g., (Joulin & Mikolov, 2015; Sukhbaatar et al., 2015; Graves et al., 2014). However, to our knowledge, our work is one of very few applications of such memory networks outside in practice. + +Perhaps the closest model to our work is Stack RNN by Joulin & Mikolov (2015), in which the network is augmented with an infinite stack to which a state vector can be added (PUSH) or removed (POP) at every time step. Unlike our model, only the top of the stack is read each time. + +# 3 THE ARCHITECTURE + +The architecture of the VoiceLoop model is depicted in Fig. 1 and the components of the architecture are listed in Tab. 1. The forward pass of the network has four steps, which are run sequentially. Following a context-free encoding of the input sequence and an encoding of the speaker, the buffer at time t, $\mathbf { \bar { \mathbf { } } } { S _ { t } } \in \mathbb { R } ^ { d \times k }$ , plays a major role in all of the remaining steps and links between the other components of each step. It also carries the error signal from the output to the earlier steps. + +Step I: Encoding the speaker and the input sentence Every speaker is represented by a vector $z$ During training, the vectors of the training speakers are stored in a lookup table $L U T _ { s }$ which maps a running id number to a representation of dimensionality $d _ { s }$ . For new speakers, which are being fitted after the network was trained, the vector $z$ is computed by the straightforward optimization process described in Sec. 3.2. + +The input sentence is converted to a sequence of phonemes $s _ { 1 } , s _ { 2 } , \ldots , s _ { l }$ by employing the CMU pronouncing dictionary (Weide, 1998). The number of phonemes in this dictionary is 40, to which two items are added to indicate pauses of different lengths. Each $s _ { i }$ is then mapped separately to an encoding that is based on a trained lookup table $L U T _ { p }$ . This results in an encoding matrix $E$ of size $d _ { p } \times l$ , where $d _ { p }$ is the size of the encoding, and $l$ is the sequence length. + +Step II: Computing the context Similar to (Sotelo et al., 2017; Chorowski et al., 2015), we employ the Graves Gaussian Mixture Model (GMM)-based monotonic attention mechanism. At each output time point $t = 1 , 2 , \dots$ , the attention network $N _ { a }$ receives the buffer from the previous time step $S _ { t - 1 }$ as input and outputs the GMM priors $\gamma _ { t }$ , shifts $\kappa _ { t }$ , and log-variances $\beta _ { t }$ . For a GMM with $c$ components, each of these is a vector in $\mathbb { R } ^ { c }$ . $N _ { a }$ has one hidden layer, of dimensionality $\textstyle { \frac { d k } { 1 0 } }$ and a ReLU activation function for the hidden layer. + +The attention is then computed as follows: + +$$ +\gamma _ { t } ^ { \prime } [ i ] = \frac { e x p ( \gamma _ { t } [ i ] ) } { \sum _ { j } e x p ( \gamma _ { t } [ j ] ) } , i = 1 , 2 , \ldots , c +$$ + +i.e., the softmax function is applied to the priors. The means of the GMMs are increased: + +$$ +\mu _ { t } = \mu _ { t - 1 } + e x p ( \kappa _ { t } ) , +$$ + +and the variances are computed as $\sigma _ { t } ^ { 2 } = e x p ( \beta _ { t } )$ . For each GMM component $1 \leq i \leq c$ and each point along the input sequence $1 \le j \le l$ , we then compute: + +$$ +\phi [ i , j ] = \frac { \gamma _ { t } ^ { \prime } [ i ] } { \sqrt { 2 \pi \sigma _ { t } ^ { 2 } [ i ] } } e x p ( - \frac { ( j - \mu _ { t } [ i ] ) ^ { 2 } } { 2 \sigma _ { t } ^ { 2 } [ i ] } ) +$$ + +The attention weights $\alpha _ { t }$ are computed for each location in the sequence by summing along all $c$ components: + +$$ +\alpha _ { t } [ j ] = \sum _ { i = 1 } ^ { c } \phi [ i , j ] +$$ + +The context vector $c _ { t }$ is then computed as weighted sum of the columns of the input sequence embedding matrix $E$ as $c _ { t } = E \alpha _ { t }$ . The loss function of the entire model depends on the attention vector through this context vector. The GMM is differentiable with respect to mean, std and weight, and these are updated, during training, through backpropagation. + +Step III: Updating the buffer At each time step, a new representation vector $u$ of dimensionality $d$ is added to the buffer at the first location $S _ { t } [ 1 ]$ , the last column of the buffer from the previous time step $S _ { t - 1 } [ k ]$ is discarded, and the rest are copied $S _ { t } [ i + 1 ] = S _ { t - 1 } [ i ]$ for $i = 1 , \ldots , k - 1$ . + +In our implementation, the number of features in the buffer $d$ is the sum of the dimensionality of the embedding of the phonemes $d _ { p }$ and the output’s dimensionality $d _ { o }$ . This choice was made so that a direct comparison to a buffer that does not employ an update network can be performed. In this case, $u$ is simply the concatenation of the current context vector $c _ { t }$ and the output from the previous time step $o _ { t - 1 }$ . It soon became very clear that this loop-less buffer update leads to poor results, emphasizing the role of using information of the buffer $S$ itself in the update process. + +The vector $u$ is, therefore, computed using a shallow fully connected network $N _ { u }$ , with one hidden layer of a size that is the tenth of the input dimensionality and a ReLU activation function. + +The network receives as input the buffer $S _ { t - 1 }$ , the context vector $c _ { t }$ , and the previous output $o _ { t - 1 }$ The new vector $u$ is also made speaker dependent by adding a projection of the speaker embedding $z$ to the context vector. This projection is followed by a hyperbolic tangent activation function, in order to maintain scale. Therefore, + +$$ +C _ { t } = [ c _ { t } + t a n h ( F _ { u } z ) , o _ { t - 1 } ] +$$ + +![](images/f6ad362c76523e8b3b0cd6dd526216f23c413d9f98cb5391787d3aaaf06b2497.jpg) +Figure 2: Memory Location Significance. For each of the three networks $N _ { u }$ , $N _ { a }$ and $N _ { o }$ , we average the absolute values of the weights to the hidden layer across all hidden neurons and across the $d$ rows of the buffer. The result is a measure of the relative importance of each column of the buffer. Best viewed in color. + +$$ +u = N _ { u } ( [ S _ { t - 1 } , C _ { t } ] ) , +$$ + +where $[ a , b ]$ is the concatenation of the two column vectors $a$ and $b$ to one column vector, or the concatenation of two matrices $a$ and $b$ side by side. + +Another way in which we allow the speaker to influence the generated output is by initializing the buffer based on the speaker’s embedding. Specifically, in our implementation, the speaker embedding size $d _ { s }$ is the same as the phoneme embedding size $d _ { p }$ and we set the top part of the buffer $S _ { 0 }$ to be $z$ repeated $k$ times. The lower part of size $d _ { o } \times k$ is set to zero. + +Step IV: Generating the output The output is generated using a network $N _ { o }$ that is of the same architecture as $N _ { a }$ and $N _ { u }$ and a projection of the user by a learned matrix $F _ { o }$ : + +$$ +o _ { t } = N _ { o } ( S _ { t } + F _ { o } z ) +$$ + +Memory Location Significance In order to better understand the behavior of the buffer, we consider the relative role of each buffer location $1 , 2 , \ldots , k$ on the activations of $N _ { u } , N _ { a }$ , and $N _ { o }$ Specifically, we average the absolute values of the weights from the input (buffer elements) to the hidden layer. The averaging is performed across all $d$ features and ${ \frac { d k } { \frac { 1 0 } { \alpha } } }$ hidden units, and provides one value per each location. As can be seen in Fig 2, the weights of the latest elements are more prominent, especially, as expected, for the output network $N _ { o }$ . However, even the rightmost column has a relative contribution that is at least one third of the leftmost column. This supports the utility of our buffer architecture, in which all memory locations are equal inputs to the downstream fully connected networks. + +# 3.1 TRAINING + +In our current implementation, the output is a vector of vocoder features of dimensionality $d _ { o } = 6 3$ . Similar to (Sotelo et al., 2017), these features were computed using the Merlin toolkit (Wu et al., 2016). During training, the output at each time frame $t$ is compared to the vocoder features of the ground truth data $Y _ { t }$ using the MSE loss: $\frac { 1 } { d _ { o } } \Vert Y _ { t } - o _ { t } \Vert ^ { 2 }$ . This loss requires an exact temporal alignment of the input and the output sequence. However, human speech is not deterministic and one cannot expect a deterministic method to predict the ground truth. For example, even the same speaker cannot replicate her voice to completely remove the MSE loss since there is variability when repeating the same sentence. Teacher forcing solves this since it eliminates most of the drift and enforces a specific way of uttering the sentence. + +In conventional teacher forcing, during training, the input to the network $N _ { u }$ is $Y _ { t - 1 }$ and not $o _ { t - 1 }$ This holds the danger of teaching the network to predict only one time frame ahead, which would create a drift in the output when run on test data. We, therefore, employ a variant of the teacher-forcing technique, which uses the following input to $N _ { u }$ as the previous output + +$$ +\frac { o _ { t - 1 } + Y _ { t - 1 } } { 2 } + \eta , +$$ + +where $\eta$ is a random noise vector. When training starts, the predicted output $o _ { t - 1 }$ is by itself a source of noise. As training progresses, it becomes more similar to $Y _ { t - 1 }$ . However, the systematic difference between the two allows the network to better fit the situation that occurs at test time. + +During training, a forward pass on all of the output sequences is performed (without truncation), followed by a backward pass. + +Efficiency The full model contains 9.3 million parameters and runs near real-time on an Intel Xeon E5 single-core CPU and 5 times faster when on M40 NVIDIA GPU, including vocoder CPU decoding. This was benchmarked with our publicly available python PyTorch implementation. Therefore, even without special optimizations, engineering VoiceLoop to run on a mobile client is possible, similar to existing non-neural TTS client solutions (e.g. Android’s text-to-speech APK). + +# 3.2 FITTING A NEW PERSON + +Different people exhibit different patterns and present various mannerisms in their speech. Therefore, learning to fit these factors from a limited amount of speech is a challenging task. The goal of speaker mimicking TTS is to be able to mimic a new person based on a relatively short voice sample. Ideally, the new voice would be captured by the parameters of the speaker embedding $z$ , without the need to retrain the network. Naturally, enough variability in the population of the training speakers is needed in order to support this. To fit a new speaker, we are given voice samples and transcribed text. We then employ the training procedure, where the weights of all networks and projections $( N _ { a } , N _ { u } , N _ { o } , L U T _ { p } , F _ { u } , F _ { o } )$ are kept fixed and only vector $z$ is learned (using SGD) to form the embedding of the new speaker. + +The same training procedure as detailed in Sec. 3.1 is employed for fitting a new person, including the application of teacher-forcing. We find that the fitting process is very stable with regards to voice characteristics such as pitch. We also noticed that the accent in the new sample needs to be relatively close to the accents presented in the training samples. See Sec. 3.2 for fitting experiments. + +# 3.3 GENERATING VARIABILITY + +As mentioned, natural speech is not deterministic and each time a sentence is said, it is said in a different way. For simplicity, our method does not employ a random component, such as a variational autoencoder. However, we can generate different outputs by employing priming (Graves, 2013). In this technique, the initial buffer $S _ { 0 }$ is initialized based on an initial process in which another word or sentence is run through the system. One can expect that a sentence from the training set that is said in excitement, would paint the buffer differently than one that is flatter. Experimenting with this technique, demonstrates that we are indeed able to achieve the desired level of variability. However, the direct link between the nature of the priming sequence and the generated output is only anecdotal at this point. + +# 4 EXPERIMENTS + +We make use of multiple datasets. First, for comparing with existing single speaker techniques, we employ single speaker literature datasets. Second, we employ various subsets of the VCTK dataset (Veaux et al., 2017) for various multi-speaker training and/or fitting experiments. Third, we create a dataset that is composed from four to five public speeches of four public figures. The data was downloaded from youtube, where these speeches are publicly available and were automatically transcribed. Samples generated by our method are available on the project’s website https: //github.com/facebookresearch/loop. + +The MOS measure for the proposed method was computed using the crowdMOS toolkit by P. Ribeiro et al. (2011) and Amazon Mechanical Turk. All samples were presented at 16kHz and the raters were told that they are presented with the results of the different algorithms. At least 20 raters participated in each such experiment, with $9 5 \%$ confidence intervals. We restricted all experiments to North American raters. + +# 4.1 SINGLE SPEAKER EXPERIMENTS + +The single speaker experiments took place on the LJ (Ito, 2017a), the Nancy corpus from the 2011 Blizzard Challenge (King & Karaiskos, 2011), and the English audiobook data for the 2013 Blizzard Challenge (King & Karaiskos, 2013). Our method was compared to the ground truth as well as to Char2Wav and to Tacotron. The Char2Wav system was trained by us using the authors’ implementation available at https://github.com/sotelo/parrot. The training of the Char2Wav model, in each experiment, was optimized by measuring the loss on the validation set, over the following hyperparameters: initial learning rate of $\left[ 1 e - 2 , 1 e - 3 , 1 e - 4 \right]$ , source noise standard deviation $( [ 1 , 2 , 4 ] )$ , batch-size ([16, 32, 64]) and the length of each training sample $( [ 1 0 e 2 , 1 0 e 4 ] )$ . + +The Tacotron models were pretrained models available from the best public implementation we could find, which is by Ito (2017b). This re-implementation has models only for the LJ and the Nancy datasets. Note that Tacotron has raised a lot of attention and considerable effort was put by the community to replicate the paper’s results. However, there would very likely be a different choice of hyper-parameters between such re-implementations and the one of the authors. + +The MOS scores are shown in Tab. 2. These were computed using the “same_sentence” option of crowdMOS, following DV2 (personal communication). As can be seen, our single speaker results are better than those of the other two algorithms across datasets, but still somewhat lower than the ground truth results. + +It is interesting to note that on Blizzard 2011, our results are better than Tacotron (reimplementation) but not significantly better than Char2Wav, while on Blizzard 2013 it is significantly better than both. This can be attributed to the clean nature of Blizzard 2011, for which Char2Wav is robust enough, and demonstrates our method’s robustness to noise. + +Tab. 3 presents Mel Cepstral Distortion (MCD) scores. This is an automatic, albeit limited, method of testing compatibility between two audio sequences. Since the sequences are not aligned, we employ MCD DTW, which uses dynamic time warping (DTW) to align the sequences. As can be seen, in this metric too, our method outperforms the baseline methods. The single except is Tacotron’s lower distortion on the LJ dataset. However, as shown in Tab. 2, Tacotron is not competitive on this dataset. + +Table 2: Single Speaker MOS Scores (Mean ± SD) + +
MethodLJBlizzard 2011Blizzard 2013
Tacotron (re-impl)2.06 ± 1.022.15 ± 1.10N/A
Char2wav3.42 ± 1.143.33 ± 1.062.03 ± 1.16
VoiceLoop3.69 ± 1.043.38 ± 1.003.40 ± 1.03
Ground truth4.60 ± 0.714.56 ± 0.674.80 ± 0.50
+ +Table 3: Single Speaker MCD Scores (Mean ± SD; lower is better) + +
MethodLJBlizzard 2011Blizzard 2013
Tacotron (re-impl)12.82 ± 1.4114.60 ± 7.02N/A
Char2wav19.41 ± 5.1513.97 ± 4.9318.72 ± 6.41
VoiceLoop14.42 ± 1.398.86 ±1.228.67 ± 1.26
+ +# 4.2 MULTI-SPEAKER EXPERIMENTS + +Multi-speaker experiments were performed on the VCTK dataset (Veaux et al., 2017). The 109 speakers were divided into four different nested subsets: 22 North American speakers, both male and females; and 65, 85 and 101 random selection of speakers, where the remaining eight speakers were left out for validation. Each subset was shuffled into train and test sets. Different models were trained to each of the subsets. Qualitatively, the models provide distinguished voices, and as can be seen in Fig. 3, the generated voice samples display a different dynamic behavior for different speakers. + +![](images/9ec1c8ec5ba0ce9ff107e31130d9098f2d9274b357e12f53f06e3803b35e9cd8.jpg) +Figure 3: Top: The attention probabilities obtained when mimicking three different North American speakers from VCTK using the same sentence: “but there is no eye contact”. The $\mathbf { X } ^ { } -$ -axis is the time along the generated audio. The y-axis depicts the sequence of phonemes. Dots indicate the maximal response along time for each phoneme, illustrating learned phoneme duration differences between identities (not given during training). Bottom: The 4-th Mel-cepstrum for the three generated sentences (dashed) as well as the ground-truth (solid) of the leftmost speaker. Best viewed in zoom. + +Table 4: Multi-speaker MOS scores (Mean ± SE) + +
MethodVCTK22VCTK65VCTK85VCTK101
Char2wav2.84 ± 1.202.85 ± 1.192.76 ± 1.192.66 ± 1.16
VoiceLoop3.57 ± 1.083.40 ± 1.003.13 ± 1.173.33 ± 1.10
GT4.61 ± 0.754.59 ± 0.724.64 ± 0.644.63 ± 0.66
+ +In our experiments, we employ the author’s implementation of Char2Wav mentioned above as baseline. Note that while the Char2Wav paper did not present multi-speaker results, the open implementation is more general and includes this option. + +Sentences from the test set of VCTK are employed for testing. Following DV2 (private communication), the MOS results were computed using the “diff_sentences” option of the crowdMOS toolkit, and are depicted in Tab. 4. As can be seen, our multi-speaker method shows a considerable advantage over the Char2Wav system across all VCTK subsets, but is not as good as the ground truth. These results are consistent with the MCD scores as reported in Tab. 5. + +Speaker Identification The capability of the system to generate distinguished voices that match the original voices was tested, as was done in DV2, using a speaker classifier. We train a multi-class convolutional network on the ground-truth training set of multiple speakers, and test on the generated ones. The network gets as input an arbitrary size of vocoder samples, performs five convolutional layers of 3x3 filters over 32 batch-normalized channels, followed by max-pooling, average pooling over time, two fully-connected layers, and ending with a softmax of the number of classes tested. All intermediate layers were linearly rectified. + +The identification results are shown in Tab. 6. The VoiceLoop results are more accurate than the results on the VCTK test split, despite using the same text. This might indicate that the voices generated are more similar to the training voices than the natural variability that is present in the dataset. The Char2Wav results are considerably lower. + +Table 5: Multi-speaker MCD scores (Mean ± SE; lower is better) + +
MethodVCTK22VCTK65VCTK85VCTK101
Char2wav15.71 ± 1.8215.1 ± 1.4515.23 ± 1.4915.06 ± 1.32
VoiceLoop13.74 ± 0.9814.1 ± 0.9414.16 ± 0.8714.22 ± 0.88
+ +Table 6: Multi-Speaker Identification Top-1 Accuracy (%) + +
MethodVCTK85VCTK101
VCTK test split98.2597.16
Char2Wav on test split sentences75.7081.63
VoiceLoop on test split sentences10099.76
+ +# 4.3 NEW SPEAKER FITTING EXPERIMENTS + +Our system is the only published system that is capable of post-training fitting of new speakers. In order to experiment with this capability, we employ the VoiceLoop model trained on VCTK85 and experiment on the remaining 16 speakers one by one, where only the speaker embedding $z$ gets updated. While TTS systems typically require several hours of data to model a single speaker (Zen et al., 2009), our fitting set contains only 23.65 minutes per speaker on average. + +![](images/91ceb44e61dcff3043cbbf2aa4dd6e1394d679764444c8de47326ccc710dba71.jpg) +Figure 4: Fitting new speaker embeddings to an existing VoiceLoop model. The graph plots top1 identification accuracy with respect to a sample set length (in minutes) per speaker. Scores were averaged over 5 splits each. The “Full training” horizontal line is the top-1 accuracy for the corresponding speakers, when trained together with the model from scratch. The leftmost datapoint is for two sentences (about 10sec) per speaker. + +As described in 3.2, we randomly initialize a new embedding for every new speaker and update only its weights during back-propagation on the fitting data. The newly fitted speakers achieve ${ \bf 3 . 0 8 \pm }$ 0.95 MOS, suggesting that the generation mechanism has not deteriorated below a “fair” level by the new entries. + +Similar to the multi-speaker case, we train classifiers for the corresponding identities on ground-truth data, but test on the fitted ones, achieving $8 7 . 6 \%$ top-1 identification accuracy. Despite lower rates than those in Tab. 6, generations of fitted identities are still reasonably discriminative. We conjecture that training VoiceLoop on a larger set of speakers (e.g. LibriSpeech Panayotov et al. (2015)) will be able to represent unseen identities better. + +Fitting Data Size The performance of fitting a new identity clearly relies on the length of the sample that is available for that speaker. In order to understand the influence of the sample size, we repeated the above fitting process for the 16 speakers, but capped the available fitting data per speaker. Specifically, we experimented with a maximal amount of training data of 1, 5, 10, 15 and 20 minutes of voice for each speaker. Instead of cutting the last sentence in the middle, it was removed in case that the threshold was crossed. We repeated this fitting process 5 times, each time fitting a different set of samples at a particular limit. + +In Fig. 4 we report identification accuracies for each limit. Surprisingly, even with two sentences per speaker, totaling about 10 seconds in average, we can fit a new speaker into VoiceLoop such that the speaker is identifiable at $6 4 . 4 \%$ top-1 identification rate. + +# 4.4 IN THE WILD EXPERIMENTS + +To demonstrate the flexibility of our method, we downloaded several publicly available videos from youtube. We picked four different known speakers (see samples page), and for each we retrieved the top four to five results, provided that they are longer than 20 minutes. We extracted the audio and its associated (youtube’s) automatically transcribed text. The total amount of data is 6.2 hours, which we then segmented into 8000 segments. Each segment length is around three seconds, similar to the datasets used in the experiments above. Both the data and its corresponding text are noisy: some of the samples include panel discussions and others with questions from various reporters. Sometimes, microphone echo was observed, or relatively low quality audio originated from mobile video conference sessions. We then trained on this data a VoiceLoop model from scratch, using exactly the same training procedure used by the other experiments. This achieved MOS is ${ \bf 2 . 9 7 \bar { \pm } }$ 1.03, and top-1 accuracy of $9 5 . 8 1 \%$ . + +We also demonstrate priming (Sec. 3.3) on this dataset. Even for the same speaker, multiple intonations can be generated by initializing $S _ { 0 }$ in different ways. This capability is depicted in Fig. 5 and in the samples page. + +# 5 DISCUSSION + +Employing web-based in-the-wild training data means that the network is trained on mixed data that contains both speech and other sources. For example, our samples contain a considerable amount of clapping and laughs. Moreover, public speeches contain a larger than usual amount of dramatic prosody and methodological pauses (the same is also true with audiobooks). As our experiments show, our method is mostly robust to these, since it is able to model the voices despite of these difficulties and without replicating the background noises in the synthesized output. The baseline model of Char2Wav was not able to properly model the voices of the youtube dataset and presented clapping sounds in its output. + +The architectural simplicity of our system is likely to be the reason for its robustness. Another advantage that stems directly from it, is its computational efficiency. Based on a few shallow networks and on an iterative process that does not consider future samples, our method can generate voice on mobile devices in speeds far exceeding real-time. For comparison, deep voice (Arik et al., 2017b) is posed as a real time neural TTS system, and it achieves a rate of up to 2.7 times real-time on a Intel Xeon E5-2660 v3 Haswell CPU, running 6 concurrent threads (GPU does not provide speedup for the inference of the deep voice system). + +![](images/5d1173b5d35905582c3853492c246eded508e9ae4fac068b49997462f06f90db.jpg) +Figure 5: Same input, different intonations. A single in the wild speaker saying the sentence “priming is done like that ”, where each time $S _ { 0 }$ is initialized differently. (a) Without priming. (b) Priming with the word “I". (c) Priming with the word “had”. (d) Priming with the word “must”. (e) Priming with the word “bye”. The figure shows the raw waveform, spectrogram, and F0 estimation (include voicedness) in the first, second and third rows respectively. From the spectrogram plots we can observe different duration for some phonemes. The F0 estimation of (c) and (d) shows that the speaker talks in higher tone while in (b) and (e) we can observe lower tone of the speaker. This demonstrates how priming changes the intonations of the model outputs. + +The link we form to the model of Baddeley (1986) is by way of analogy and, to be clear, does not imply that we implement this model as is. Specifically, by phonological features, we mean a joint (mixed) representation, in memory, of sound based information and language based information, which is a unique characteristic of our model in comparison to previous work. The short term memory in Baddleley’s model is analog to our buffer and the analog to the rehearsal mechanism is the recursive way in which our buffer is updated. Namely, the new element in the buffer $( u )$ is calculated based on the entire buffer. As noted in Sec. 3, without this dependency on the buffer, our model becomes completely ineffective. + +While we employ the loop-updated buffer for the task of speech synthesis, the model is quite general. For example, we have employed the buffer for machine translation from English to French using a dot product based attention model (Bahdanau et al., 2014). The discrete nature of the output means that an output embedding had to be added, but the overall structure remained the same. The performance seemed at least similar to the baseline RNN attention model. However, no attempt has yet been made to achieve state of the art results on existing benchmarks. Surprisingly, relatively large buffer sizes (9) seem to produce better results, despite the input and the output being relatively short. Staying in the realm of voice, the buffer model can be readily used to form a transformation in the other direction (from speech to text), and applied to audio denoising. + +# 6 CONCLUSION + +We present a new memory architecture that serves as an effective working memory module. Building on this, we are able to present a neural TTS solution of an architecture that is less complex than those found in the recent literature. It also does not require any alignment between phonemes and acoustics or linguistic features as inputs. Using the new architecture, we are able to present, for the first time as far as we know, multi-speaker TTS that is based on unconstrained samples collected from public speeches. Our work also presents a unique ability to fit new speakers (post-training), which is demonstrated even for very limited sample size. + +# REFERENCES + +Sercan Arik, Gregory Diamos, Andrew Gibiansky, John Miller, Kainan Peng, Wei Ping, Jonathan Raiman, and Yanqi Zhou. Deep voice 2: Multi-speaker neural text-to-speech. In Neural Information Processing Systems (NIPS), 2017a. + +Sercan O Arik, Mike Chrzanowski, Adam Coates, Gregory Diamos, Andrew Gibiansky, Yongguo Kang, Xian Li, John Miller, Jonathan Raiman, Shubho Sengupta, et al. Deep voice: Real-time neural text-to-speech. In Proc. of the 34th International Conference on Machine Learning (ICML), 2017b. + +A.D. Baddeley. Working memory. London: Oxford University Press, 1986. + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. CoRR, abs/1409.0473, 2014. + +Pallavi Baljekar and Alan W Black. Utterance selection techniques for tts systems using found speech. In 9th ISCA Speech Synthesis Workshop, pp. 184–189. + +Kyunghyun Cho, Bart van Merrienboer, Çaglar Gülçehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. In Alessandro Moschitti, Bo Pang, and Walter Daelemans (eds.), EMNLP, pp. 1724–1734. ACL, 2014. ISBN 978-1-937284-96-1. URL http://dblp. uni-trier.de/db/conf/emnlp/emnlp2014.html#ChoMGBBSB14. + +Jan Chorowski, Dzmitry Bahdanau, Dmitriy Serdyuk, KyungHyun Cho, and Yoshua Bengio. Attention-based models for speech recognition. CoRR, abs/1506.07503, 2015. + +Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013. + +Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014. + +D. Griffin and Jae Lim. Signal estimation from modified short-time fourier transform. IEEE Transactions on Acoustics, Speech, and Signal Processing, 32(2):236–243, Apr 1984. + +Keith Ito. The lj speech dataset, 2017a. URL ttps://keithito.com/LJ-Speech-Dataset. + +Keith Ito. Tacotron speech synthesis implemented in tensorflow, with samples and a pre-trained model, 2017b. URL https://github.com/keithito/tacotron. + +Armand Joulin and Tomas Mikolov. Inferring algorithmic patterns with stack-augmented recurrent nets. In Neural Information Processing Systems (NIPS), 2015. + +Simon King and Vasilis Karaiskos. The blizzard challenge 2011. In Blizzard Challenge workshop, 2011. + +Simon King and Vasilis Karaiskos. The blizzard challenge 2013. In Blizzard Challenge workshop, 2013. + +Jason Lee, Kyunghyun Cho, and Thomas Hofmann. Fully character-level neural machine translation without explicit segmentation. arXiv preprint arXiv:1610.03017, 2016. + +Soroush Mehri, Kundan Kumar, Ishaan Gulrajani, Rithesh Kumar, Shubham Jain, Jose Sotelo, Aaron C. Courville, and Yoshua Bengio. Samplernn: An unconditional end-to-end neural audio generation model. arXiv preprint, arXiv: 1612.07837, 2016. + +Masanori Morise, Fumiya Yokomori, and Kenji Ozawa. World: A vocoder-based high-quality speech synthesis system for real-time applications. IEICE TRANSACTIONS on Information and Systems, 99(7):1877–1884, 2016. + +Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016. + +Flavio P. Ribeiro, Dinei Florencio, Cha Zhang, and Michael Seltzer. CROWDMOS: an approach for crowdsourcing mean opinion score studies. In ICASSP, IEEE International Conference on Acoustics, Speech and Signal Processing - Proceedings, pp. 2416–2419, 05 2011. + +Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an ASR corpus based on public domain audio books. In Proceedings of the International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2015. + +Jose Sotelo, Soroush Mehri, Kundan Kumar, Joao Felipe Santos, Kyle Kastner, Aaron Courville, and Yoshua Bengio. Char2wav: End-to-end speech synthesis. In ICLR workshop, 2017. + +Rupesh K Srivastava, Klaus Greff, and Jürgen Schmidhuber. Training very deep networks. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2377–2385. Curran Associates, Inc., 2015. URL http: //papers.nips.cc/paper/5850-training-very-deep-networks.pdf. + +Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. End-to-end memory networks. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Neural Information Processing Systems (NIPS). 2015. + +Christophe Veaux, Junichi Yamagishi, Kirsten MacDonald, et al. CSTR VCTK Corpus: English multi-speaker corpus for CSTR voice cloning toolkit, 2017. + +Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: A fully end-to-end text-to-speech synthesis model. arXiv preprint arXiv:1703.10135, 2017. + +Robert L Weide. The CMU pronouncing dictionary. URL: http://www. speech. cs. cmu. edu/cgibin/cmudict, 1998. + +Zhizheng Wu, Oliver Watts, and Simon King. Merlin: An Open Source Neural Network Speech Synthesis System, pp. 218–223. 9 2016. + +Heiga Zen, Keiichi Tokuda, and Alan W. Black. Statistical parametric speech synthesis. Speech Communication, 51(11):1039 – 1064, 2009. \ No newline at end of file diff --git a/md/train/SkgVRiC9Km/SkgVRiC9Km.md b/md/train/SkgVRiC9Km/SkgVRiC9Km.md new file mode 100644 index 0000000000000000000000000000000000000000..ca10be4c5cf17dba10c5dc89738300b75e64c9c1 --- /dev/null +++ b/md/train/SkgVRiC9Km/SkgVRiC9Km.md @@ -0,0 +1,276 @@ +# FORTIFIED NETWORKS: IMPROVING THE ROBUSTNESS OF DEEP NETWORKS BY MODELING THE MANIFOLD OF HIDDEN REPRESENTATIONS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +A known weakness of deep networks is a failure to perform well when evaluated on data which differ from the training distribution, even if these differences are very small, as is the case with adversarial examples. We propose Fortified Networks, a simple extension of existing networks, which “fortifies” the hidden layers in a deep network by identifying when the hidden states are off of the data manifold, and maps these hidden states back to parts of the data manifold where the network performs well. Our principal contribution is to show that fortifying these hidden states improves the robustness of deep networks and our experiments (i) demonstrate improved robustness to standard adversarial attacks in both black-box and white-box threat models; (ii) suggest that our improvements are not primarily due to the problem of deceptively good results due to degraded quality in the gradient signal (the gradient masking problem) and (iii) show the advantage of doing this fortification in the hidden layers instead of the input space. We demonstrate improvements in adversarial robustness on three datasets (MNIST, Fashion MNIST, CIFAR10), across several attack parameters, both white-box and black-box settings, and the most widely studied attacks (FGSM, PGD, Carlini-Wagner). We show that these improvements are achieved across a wide variety of hyperparameters. + +# 1 INTRODUCTION + +The success of deep neural networks across a variety of tasks has also driven applications in domains where reliability and security are critical, including self-driving cars (Bojarski et al., 2016), health care, face recognition (Sharif et al., 2017), and the detection of malware (LeCun et al., 2015). Security concerns arise when an agent using such a system could benefit from the system performing poorly. Reliability concerns come about when the distribution of input data seen during training can differ from the distribution on which the model is evaluated. + +Adversarial examples (Goodfellow et al., 2014) result from attacks on neural network models, applying small perturbations to the inputs that change the predicted class. Such perturbations can be small enough to be unnoticeable to the naked eye. It has been shown that gradient-based methods allow one to find modifications of the input that often change the predicted class (Szegedy et al., 2013; Goodfellow et al., 2014). More recent work demonstrated that it is possible to create modifications such that even when captured through a camera, they change the predicted class with high probability (Brown et al., 2017). + +Some of the most prominent classes of defenses against adversarial examples include feature squeezing (Xu et al., 2017), adapted encoding of the input (Jacob Buckman, 2018), and distillation-related approaches (Papernot et al., 2015). Existing defenses provide some robustness but most are not easy to deploy. In addition, many have been shown to be providing the illusion of defense by lowering the quality of the gradient signal, without actually providing improved robustness (Athalye et al., 2018). Still others require training a generative model directly in the visible space, which is still difficult today even on relatively simple datasets. + +Our work differs from the approaches using generative models in the input space in that we instead employ this robustification on the distribution of the learned hidden representations, which makes the identification of off-manifold examples easier. We do this by training denoising autoencoders on top of the hidden layers of the original network. We call this method Fortified Networks. + +![](images/844fbbbe266ff6c9d6c23ad5e71ba6c1afc1b4fd13f5b35b91b15ef6b2ecaf30.jpg) +Figure 1: An investigation showing why fortified networks improve robustness. The illustrations on the left show how the deeper layers of a network can have a simpler manifold and statistical structure as compared to in the visible space. The plot on the right shows direct experimental evidence for this hypothesis: we added fortified layers with different capacities to MLPs trained on MNIST, and display the value of the total reconstruction errors for adversarial examples divided by the total reconstruction errors for clean examples. A high value indicates success at detecting adversarial examples. Our results support the central motivation for fortified networks: that off-manifold points can much more easily be detected in the hidden space (as seen by the relatively constant ratio for the autoencoder in hidden space) and are much harder to detect in the input space (as seen by this ratio rapidly falling to zero as the input-space autoencoder’s capacity is reduced). + +We demonstrate that Fortified Networks (i) can be generically added into an existing network; (ii) robustify the network against adversarial attacks and (iii) provide a reliable signal of the existence of input data that do not lie on the manifold on which it the network trained. + +In the sections that follow, we discuss the intuition behind the fortification of hidden layers and lay out some of the method’s salient properties. Furthermore, we evaluate our proposed approach on MNIST, Fashion-MNIST, CIFAR10 datasets against whitebox and blackbox attacks. + +# 2 BACKGROUND + +The Empirical Risk Minimization Framework Let us consider a standard classification task with an underlying data distribution $\mathcal { D }$ over pairs of examples $x \in \mathbb { R } ^ { d }$ and corresponding labels $y \in [ k ]$ . We also assume that we are given a suitable loss function $L ( \theta , x , y )$ , for instance the cross-entropy loss. As usual, $\theta \in \mathbb { R } ^ { p }$ is the set of model parameters. Our goal then is to find model parameters $\theta$ that minimize the risk $\mathbb { E } _ { ( x , y ) \sim \mathcal { D } } [ L ( x , y , \theta ) ]$ . This expectation cannot be computed, therefore a common approach is to to minimize the empirical risk $1 / N \textstyle \sum _ { D } L ( x , y , \theta )$ taking into account only the examples in a given dataset $D$ . + +Adversarial Attacks and Robustness While the empirical risk minimization framework has been very successful and often leads to excellent generalization, it has the significant limitation that it doesn’t guarantee robustness, and more specifically performance on examples off the data manifold. Madry et al. (2017) proposed an optimization view of adversarial robustness, in which the adversarial robustness of a model is defined as a min-max problem, + +$$ +\operatorname* { m i n } _ { \theta } \rho ( \theta ) , \quad \mathrm { w h e r e } \quad \rho ( \theta ) = \mathbb { E } _ { ( x , y ) \sim \mathcal { D } } \left[ \operatorname* { m a x } _ { \delta \in S } L ( \theta , x + \delta , y ) \right] , +$$ + +where $s$ denotes the set of all points within a sphere of radius $\varepsilon$ , which is task-specific. Larger $\varepsilon$ values correspond to stronger attacks but which may be more visually apparent. + +Denoising Autoencoders Denoising autoencoders (DAEs) are neural networks which take a noisy version of an input (for example, an image) and are trained to predict the noiseless version of that input. This approach has been widely used for feature learning and generative modeling in deep learning (Bengio et al., 2013a). More formally, denoising autoencoders are trained to minimize a reconstruction error or negative log-likelihood of generating the clean input. For example, with + +![](images/6b79375722c90c05298de9a98347c4c53a77298068b61021a2025718890fa06c.jpg) +Figure 2: Diagram illustrating a one-layer fortified network. A network is evaluated with a data sample $x$ and its corresponding adversarial example $\widetilde { x }$ . Hidden units $h _ { k }$ and $\widetilde { h _ { k } }$ are corrupted with noise, encoded with the encoder enc., and decoded with the decoder dec. The autoencoder (denoted by the red color) is trained to reconstruct the hidden unit $h _ { k }$ that corresponds to the clean input. Dotted lines are two reconstruction costs: for a benign $( \mathcal { L } _ { r e c } )$ and adversarial examples $( \mathcal { L } _ { a d v } )$ . + +Gaussian log-likelihood of the clean input given the corrupted input, $r _ { \theta }$ the learned denoising function, $C$ a corruption function with Gaussian noise of variance $\sigma ^ { 2 }$ , the reconstruction loss is + +$$ +\widehat { \mathcal { L } } = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \left( \left| \left| r ( C _ { \sigma } ( x ^ { ( n ) } ) ) - x ^ { ( n ) } \right| \right| _ { 2 } ^ { 2 } \right) . +$$ + +Alain et al. (2012) demonstrated that with this loss function, an optimally trained denoising autoencoder’s reconstruction vector is proportional to the gradient of the log-density: + +$$ +{ \frac { r _ { \sigma } ( x ) - x } { \sigma ^ { 2 } } } \to { \frac { \partial \log p ( x ) } { \partial x } } \quad { \mathrm { a s } } \quad \sigma \to 0 . +$$ + +This theory establishes that the reconstruction vectors from a well-trained denoising autoencoder form a vector field which points in the direction of the data manifold. However, Alain et al. (2012) showed that this may not hold for points which are distant from the manifold, as these points are rarely sampled during training. In practice, denoising autoencoders are not just trained with tiny noise but also with large noises, which blurs the data distribution as seen by the learner but makes the network learn a useful vector field even far from the data. + +# 3 FORTIFIED NETWORKS + +We propose the use of DAEs inserted at crucial points between layers of the original neural network in order to denoise the transformed data points which may lie away from the original data manifold. Intuitively, the method aims to regularize the hidden representations by keeping the activations on the surface of the corresponding projected data manifold through the application of a DAE trained on the hidden representations (on the original clean data). We argue that applying the DAEs on the hidden layers—as opposed to the raw input signal—facilitates learning, while providing a stronger protection from adversarial attacks. As illustrated in Figure 1, we hypothesize that more abstract representations associated with deeper networks are easier to denoise because the transformed data manifolds are flatter. The flattening of data manifolds in the deeper layers of a neural network was first noted experimentally by Bengio et al. (2013b). We provide experimental support for these claims in Section 4. + +Layer fortification R Our method works by substituting a hidden layer $h _ { k }$ with a denoised version. We feed the signal $h _ { k }$ through the encoder network, $E _ { k }$ , and decoder network, $D _ { k }$ , of a DAE for layer $k$ , which yields the denoised version, $h _ { k } ^ { d e c o d e d }$ : + +$$ +h _ { k } ^ { d e c o d e d } = D _ { k } \big ( E _ { k } \big ( h _ { k } + n _ { k } \big ) \big ) , +$$ + +where $n _ { k }$ is white Gaussian noise of variance $\sigma ^ { 2 }$ and appropriate shape. We call the resulting layer, a fortified layer and the resulting network the fortified network corresponding to the original network. + +• Reconstruction loss. For a mini-batch of $N$ clean examples, $\boldsymbol { x } ^ { ( 1 ) } , \ldots , \boldsymbol { x } ^ { ( N ) }$ , each hidden layer h(1)k , . $h _ { k } ^ { ( 1 ) } , \ldots , h _ { k } ^ { ( N ) }$ is fed into a DAE loss, similar to equation 2: + +$$ +\mathcal { L } _ { r e c , k } = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \left. D _ { k } \left( E _ { k } \left( \boldsymbol { h } _ { k } ^ { ( n ) } + \boldsymbol { n } _ { k } \right) \right) - h _ { k } ^ { ( n ) } \right. _ { 2 } ^ { 2 } . +$$ + +• Adversarial loss. We use some adversarial training method to produce the perturbed version of the mini-batch, $\widetilde { \boldsymbol { x } } ^ { ( 1 ) } , \ldots , \widetilde { \boldsymbol { x } } ^ { ( N ) }$ , where $\widetilde { x } ^ { ( i ) }$ is a small perturbation of $x ^ { ( i ) }$ which is e e edesigned to make the network produce the wrong answer. The corresponding hidden layer $\widetilde { h } _ { k } ^ { ( 1 ) } , \dots , \widetilde { h } _ { k } ^ { ( N ) }$ (using the perturbed rather than original input) is fed into a similar DAE loss: + +$$ +\mathcal { L } _ { a d v , k } = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \left\| D _ { k } \left( E _ { k } \left( \widetilde { h } _ { k } ^ { ( n ) } + n _ { k } \right) \right) - h _ { k } ^ { ( n ) } \right\| _ { 2 } ^ { 2 } , +$$ + +where we note that the target reconstruction for denoising is the clean version of the hidden layer, without noise and without adversarial perturbation. + +For training purposes, we treat the DAEs as part of the fortified network, backpropagate through and train all weights jointly. Aside from the original classification loss, $\mathcal { L } _ { c }$ , we also include the classification loss from the adversarial objective, $\mathcal { \hat { L } } _ { c } ( \mathcal { \widetilde { Y } } )$ , and we introduce a dual objective for the DAEs. + +To build a fortified network, we can apply this fortification process to some or all the layers. The final objective used for training the fortified network includes the classification loss and all reconstruction and adversarial losses: + +$$ +\mathcal { L } = \mathcal { L } _ { c } ( y ) + \mathcal { L } _ { c } ( \widetilde { y } ) + \lambda _ { r e c } \sum _ { k } \mathcal { L } _ { r e c , k } + \lambda _ { a d v } \sum _ { k } \mathcal { L } _ { a d v , k } , +$$ + +where $\lambda _ { r e c } > 0$ and $\lambda _ { a d v } > 0$ tune the strength of the DAE terms. This kind of training process allows for the production of hidden representations robust to small perturbations, and in particular, to adversarial attacks. + +Off-manifold signaling The reconstruction losses act as a reliable signal for detecting off-manifold examples (cf. Section 4). This is a particularly useful property in practice: not only can we provide more robust classification results, we can also sense and suggest to the analyst or system when the original example is either adversarial or from a significantly different distribution. + +Motivation for when and where to use fortified layers We have discussed advantages to placing fortified layers in the hidden states instead of the input space (with further discussion in section 6,) but the question of where exactly fortified layers need to be placed remains unanswered. Is it just the final hidden layer? Is it every hidden layer? We outline two important considerations regarding this issue. First, in the higher-level hidden layers, it is much easier for the network to identify points which are off of the manifold or close to the margin. This is directly experimentally demonstrated in fig. 1. Secondly, the higher level hidden layers may already look like points that are not adversarial due to the effect of the adversarial perturbations in the earlier layers. While we are not aware of any formal study of this phenomenon, it is clearly possible (imagine for example a fortified layer on the output from the softmax, which could only identify unnatural combinations of class probabilities.) Given these opposing objectives, we argue for the inclusion of multiple fortified layers across the network. + +# 4 EXPERIMENTS + +# 4.1 ATTACKS + +We evaluated the performance of our model as a defense against adversarial attacks. We focused on two of the most popular and well-studied attacks. Firstly, we consider the Fast Gradient Sign + +Method (FGSM, Goodfellow et al., 2014) which is popular as it only requires a single step and can still be effective against many networks. Secondly, we consider the projected gradient descent attack (Kurakin et al., 2016) which is slower than FGSM as it requires many iterations, but has been shown to be a much stronger attack (Madry et al., 2017). + +Additionally, we consider both white-box attacks (where the attackers knows the model) and blackbox attacks (where they don’t, but they have access to the training set.) + +Fast Gradient Sign Method. The Fast Gradient Sign Method (FGSM) Goodfellow et al. (2014) is a simple one-step attack that produces $\ell _ { \infty }$ -bounded adversaries via the following gradient based perturbation. + +$$ +\widetilde { x } = x + \varepsilon \mathrm { s g n } ( \nabla _ { x } L ( \theta , x , y ) ) . +$$ + +Projected Gradient Descent. The projected gradient descent attack (Madry et al., 2017), sometimes referred to as $\mathrm { F G S M } ^ { k }$ , is a multi-step extension of the FGSM attack characterized as follows: + +$$ +\boldsymbol { x } ^ { t + 1 } = \Pi _ { x + S } \left( x ^ { t } + \alpha \operatorname { s g n } ( \nabla _ { x } L ( \theta , x , y ) ) \right) +$$ + +initialized with $x ^ { 0 }$ as the clean input $x$ and with the corrupted input $\widetilde { x }$ as the last step in the sequence. $\Pi$ erefers to the projection operator, which in this context means projecting the adversarial example back onto the region within an $\varepsilon$ radius of the original data point, after each step in the adversarial attack. + +Finally we considered the Carlini-Wagner L2 attack (Carlini & Wagner, 2016) which consists of joint optimization of loss maximization and minimizing the distance of the adversarial example to the original example. + +# 4.2 THE GRADIENT MASKING AND GRADIENT OBFUSCATION PROBLEM + +A significant challenge with evaluating defenses against adversarial attacks is that many attacks rely upon a network’s gradient. Methods which reduce the quality of this gradient, either by making it flatter or noisier can lead to methods which lower the effectiveness of gradient-based attacks, but which are not actually robust to adversarial examples (Athalye et al., 2017; Papernot et al., 2016c). This process, which has been referred to as gradient masking or gradient obfuscation, must be analyzed when studying the strength of an adversarial defense. + +One method for studying the extent to which an adversarial defense gives deceptively good results as a result of gradient masking relies on the observation that black-box attacks are a strict subset of white-box attacks, so white-box attacks should always be at least as strong as black-box attacks. If a method reports much better defense against white-box attacks, it suggests that the selected white-box attack is underpowered as a result of gradient masking. Another test for gradient masking is to run an iterative search, such as projected gradient descent (PGD) with an unlimited range for a large number of iterations. If such an attack is not completely successful, it indicates that the model’s gradients are not an effective method for searching for adversarial images, and that gradient masking is occurring. Still another test is to confirm that iterative attacks with small step sizes always outperform single-step attacks with larger step sizes (such as FGSM). If this is not the case, it may suggest that the iterative attack becomes stuck in regions where optimization using gradients is poor due to gradient masking. + +Additionally, (Athalye et al., 2018) discussed the Backward Pass Differentiable Approximation (BPDA) attack to cover cases where a defense employs a transformation which is clearly nondifferentiable or reduces the quality of the gradients. Because we pass gradients through the fortified layers in the normal training of our network, it is unlikely that the quality of these gradients is significantly deteriorated, and there isn’t a reason to expect that they would be because the fortified layers are relatively shallow and use normal activation functions (i.e. no non-differentiable functions.). Additionally we ran additional experiments using the identity function version of BPDA on Fashion MNIST FGSM $\varepsilon = 0 . 3$ ) with standard deviation across five trials. Our adversarial training baseline achieved an accuracy of $8 4 . 6 4 { \pm } 0 . 4 8 $ on this task, fortified networks with the normal attack achieved an accuracy of $8 9 . 5 0 { \pm } 0 . 4 5 $ , and fortified networks with the BPDA version of the attack (treating the autoencoder as an identity) achieved an accuracy of $8 9 . 8 8 { \pm } 0 . 3 0 $ , which corresponds to a weaker attack. + +# 5 RESULTS + +For details about the specifics of our model architectures and hyperparameters we refer readers to the Appendix. With all experiments, we use the same attacks (with identical parameters) at training and test time to generate adversarial examples. An important point to note here is that all of the autoencoders in our fortified layers used a single hidden layer with tied weights. + +Table 1: Results on white-box MNIST and CIFAR with FGSM . The ResNet model provided in (Papernot et al., 2016a) was used in the CIFAR FGSM experiments. +CIFAR-10 + +
JSSM 8 eBaseline Adv. Train Fortified Networks (ours)79.57 80.47
JSSMBaseline Adv. Train (ours)79.34
£00=3Fortified Networks (ours) Autoencoder (fortify input)79.77
Autoencoder in hidden space81.80
+ +MNIST + +
FESM£0=3Adv. Train (Madry) Adv. Train (ours) Adv. Train No-Rec (ours)95.60 96.36 96.47
Fortified Net, no Ladu (ours) Fortified Network (ours)*96.46 97.97
WAdv.Train Fortified Network46.16 60.58
0 = eBaseline Adv. Train Fortified Network (ours)96.98 98.09
+ +We also performed an analytical experiment on an RNN language model to study if fortified networks can detect when it’s being given outputs from its own model (sampling mode) when trained using ground truth input sequences. To this end we train a language model on the standard Text8 dataset, which is derived from Wikipedia articles. We trained a single-layer LSTM with 1000 units at the character-level, and included fortified layers between the hidden states and the output on each time step. + +With 50 sampling steps, the fortified layers had a reconstruction error on average $103 \%$ of the teacher forcing reconstruction error. With 180 sampling steps, this valued increased to $112 \%$ . With 300 sampling steps this increased even further to $134 \%$ . This is clear evidence that the outputs move off of the manifold with more sampling steps, and that this is effectively measured by fortified networks. + +Analysis of Hyperparameters We ran with many hyperparameters for the fortified layers to demonstrate the generality of the improvement given by fortified networks. We ran FGSM on FashionMNIST $\scriptstyle ( \varepsilon = 0 . 3 )$ while varying the amount of noise injected and the weighting on the reconstruction loss. We also varied the amount of noise and choice of losses in the ablation experiment in Table 7. We achieved consistent improvement across a variety of settings but found the largest improvement when using both the adversarial and clean reconstruction losses and a small amount of noise. + +Thus, we see that a consistent improvement is achieved when the weighting on the reconstruction part of the loss and the amount of noise injected are varied over several orders of magnitude. + +# 6 RELATED WORK + +Using Generative Models as a Defense. The observation that adversarial examples often consist of points off of the data manifold and that deep networks may not generalize well to these points motivated (Gu & Rigazio, 2014; Ilyas et al., 2017; Samangouei et al., 2018; Liao et al., 2017) to consider the use of the generative models as a defense against adversarial attacks. Ilyas et al. (2017); Gilmer et al. (2018) also showed the existence of adversarial examples which lie on the data manifold, and (Ilyas et al., 2017) showed that training against adversarial examples forced to lie on the manifold is an effective defense. Our method shares a closely related motivation to these prior works, with a key difference being that we propose to consider the manifold in the space of learned representations, + +Table 2: CIFAR-10 PGD Results with (non-resnet) CNNs. In these experiment we used a fortified block (single convolutional autoencoder) following each convolutional layer. Both experiments were run for 200 epochs and with all hyperparameters and architecture kept the same with the exception of the fortified layer being added. We considered different types of baselines: ‘Baseline - no new layers’ means we simply removed the fortified block. ‘Baseline - extra layers’ means that we added extra layers to match the capacity of the fortified layers, but only gave half of these extra layers activations as the fortified block has two layers but only one activation. ‘Baseline - extra activations’ means that we added an activation following each layer, giving more activations in total than the Fortified Network. + +
MethodAttack TypePGD StepsAttack EpsilonPGD Accuracy
Baseline - extra activationsNormal70.0338.1
Fortified NetsNormal70.0343.3
Baseline - no new layersNormal70.0333.0
Baseline - no new layersNormal500.0331.6
Baseline - no new layersNormal2000.0331.4
Baseline - extra layersNormal70.0334.2
Baseline - extra layersNormal500.0332.5
Baseline - extra layersNormal2000.0332.2
Fortified NetworksNormal70.0345.0
Fortified NetworksNormal500.0342.1
Fortified NetworksNormal2000.0341.5
Baseline - extra layersNormal1000.0335.3
Baseline - extra layersNormal1000.0424.8
Baseline - extra layersNormal1000.0614.3
Baseline - extra layersNormal1000.0812.0
Baseline - extra layersNormal1000.111.7
Baseline - extra layersNormal1000.210.2
Baseline - extra layersNormal1000.38.4
Fortified NetworksNormal1000.0339.2
Fortified NetworksNormal1000.0428.0
Fortified NetworksNormal1000.0615.6
Fortified NetworksNormal1000.0813.0
FortifiedNetworksNormal1000.112.9
FortifiedNetworksNormal1000.211.3
Fortified NetworksNormal1000.39.6
Baseline - extra layersNormal1000.0333.4
Fortified NetworksNormal1000.0340.1
Fortified NetworksNoiseless Attack1000.0338.2
Fortified NetworksBPDA, Skip-AE1000.0367.1
Fortified NetworksNormal70.0343.3
Baseline - extra layersNormal70.0338.1
Baseline - extra layersALP-Like70.0334.2
Fortified NetworksNormal1000.0339.20
Baseline - extra layersNormal1000.0335.3
Baseline - extra layersALP-Like1000.0332.2
+ +instead of considering the manifold directly in the visible space. One motivation for this is that the learned representations have a simpler statistical structure (Bengio et al., 2012), which makes the task of modeling this manifold and detecting unnatural points much simpler. Learning the distribution directly in the visible space is still very difficult (even state of the art models fall short of real data on metrics like Inception Score) and requires a high capacity model. Additionally, working in the space of learned representations allows for the use of a relatively simple generative model, in our case a small denoising autoencoder. + +Ilyas et al. (2017) proposed to work around these challenges from working in the visible space by using the Deep Image Prior instead of an actual generative model. While this has the advantage of being a model that doesn’t require a special training procedure (as deep image prior is a separate optimization process for each example) it may be limited in the types of adversarial attacks that it’s resistant to, and it would provide no defense against adversarial attacks which are in the range of a convolutional network, which have been shown to exist (Xiao et al., 2018). + +Table 3: CIFAR-10 PGD Results with ResNets. In this experiment we used a single fortified layer following the 2nd resblock, and the baseline consists of the same network but with the fortified layer removed. Both experiments were run for 200 epochs and with all hyperparameters and architecture kept the same with the exception of the fortified layer being added. +Table 4: Accuracies against white-box attacks on Fashion MNIST. For PGD we used $\varepsilon = 0 . 1$ and for FGSM we used $\varepsilon = 0 . 1$ and $\varepsilon = 0 . 3 ^ { 1 }$ . Compared with DefenseGAN (Samangouei et al., 2018). + +
ModelMethodPGD Accuracy (20 steps)Clean Test Accuracy
PreActResNet18Baseline37.8784.93
PreActResNet18Fortified Networks39.2084.84
WideResNet28-10Baseline43.2887.42
WideResNet28-10Fortified Networks44.0687.40
+ +Table 5: Left: Accuracies against blackbox MNIST attacks with adversarial training (FGSM). Reporting 50/50 results compared to previous works (Samangouei et al., 2018, PS). The test error on clean examples is in parenthesis. Right:We ran a fortified network on Fashion-MNIST using adversarial training with PGD for a variety of $\varepsilon$ values, each for 5 epochs. The motivation behind this experiment, suggested by Athalye et al. (2018) is confirming if unbounded $( \varepsilon = 1 )$ ) adversarial attacks are able to succeed. A defense which succeeds primarily by masking or obfuscating the gradients would fail to bring the accuracy to zero even with an unbounded attack. As can be seen, unbounded attacks against Fortified Networks succeed when given a sufficiently large $\varepsilon$ , which is evidence against gradient masking. + +
ModelFGSM(ε = 0.1)FGSM (ε= 0.3)PGD (ε = 0.1)
DefenseGANn/a89.60n/a
Baseline Adv. Train - Conv,ReLU86.1490.6677.49
Baseline Adv. Train - Conv,LReLU89.1088.877.90
Fortified Nets - Conv (ours)89.8691.3179.54
+ +
DefenseGAN fc->conv (PS) DefenseGAN conv-→conv (PS) Adv. Train fc->conv (PS) Adv. Train conv-→conv (PS)92.21 (n/a) 93.12 (n/a) 96.68 (n/a) 96.54 (n/a)
OurApproaches Baseline Adv.Train Fortified Net w/o Ladu, Lrec FortifiedNetwork93.83 (98.95) 96.98 (99.17) 97.82 (98.93)
+ +![](images/dddbc1f8dcfb9584c18a48cbc5183c3a7598d11dcb46af053bff3d18773996f6.jpg) +$\varepsilon$ for PGD search (1 means unbounded) + +Another key difference between our work and (Ilyas et al., 2017; Samangouei et al., 2018) is that both DefenseGAN and the Invert-and-Classify approach use an iterative search procedure at inference time to map observed data points onto nearby points on the range of the generator. On the other hand, our approach uses small denoising autoencoders that are used in the same way (i.e. a simple forward application) during both training and testing. The use of such an iterative procedure presents challenges for evaluation, as it is possible for gradients to vanish while doing backpropagation through such a procedure, which may lead to an overestimate in the strength of the defense due to the gradient masking problem (Papernot et al., 2016b; Athalye et al., 2018). One indicator of the gradient masking problem is black-box attacks outperforming white-box attacks, which is an indicator of + +Table 6: Hyperparameter combinations (Fashion-MNIST; FGSM; $\varepsilon = 0 . 3$ ) + +
Reconstruction Loss Weight Autoencoder Noise (N(0,σ))n/a n/a0.01 0.010.1 0.011.0 0.011.0 0.0011.0 0.011.0 0.1
Accuracy88.0089.7090.0191.0090.7891.0091.31
+ +Table 7: Fashion MNIST, PGD $\varepsilon = 0 . 1$ ), 40 attack iterations, 50 epochs; experiments based on a 2 hidden layer MLP with 512 units per layer and leaky relu activation. $\pm$ standard deviation reported over last 5 epochs. All setups improve over the baseline $( 7 2 . 3 6 \% )$ . + +
Autoencoder after layerNoiseLrecLadvTest acc. (%)
Input1st2nd
n/an/an/a72.36 ± 0.42
0.173.44 ± 0.46
0.1173.69 ± 0.58
0.073.39 ± 0.52
0.0173.12 ± 0.52
0.0173.46 ± 0.41
0.0173.64 ± 0.29
0.0173.46 ± 0.46
0.0173.78 ± 0.31
0.0173.36 ± 0.28
0.0173.27 ± 0.46
+ +under-powered attacks as black-box attacks are a strict subset of white-box attacks. This indicator of gradient obfuscation was present in the work of Samangouei et al. (2018) where black-box attacks were generally stronger against their defense, but with our method we observe very similar defense quality against black-box and white-box attacks. (Gu & Rigazio, 2014; Liao et al., 2017) both considered using an autoencoder as a pre-processing step in the input space. Interestingly (Liao et al., 2017) used a loss function defined in the space of the hidden states, but still used autoencoders directly in the input space. + +Adversarial Hidden State Matching. Erraqabi et al. (2018) demonstrate that adversarially matching the hidden layer activations of regular and adversarial examples improves robustness. This work shared the same motivation of using the hidden states to improve robustness, but differed in that they used an adversarial objective and worked in the original hidden states instead of using a generative model (in our case, the DAE in the fortified layers). We present direct experimental comparisons with their work in section 5. (Kannan et al., 2018) proposed a method which involves matching the logit (pre-softmax outputs) values for the original samples with the logit values resulting from adversarial examples. + +Denoising Feature Matching. Warde-Farley & Bengio (2016) proposed to train a denoising autoencoder in the hidden states of the discriminator in a generative adversarial network. The generator’s parameters are then trained to make the reconstruction error of this autoencoder small. This has the effect of encouraging the generator to produce points which are easy for the model to reconstruct, which will include true data points. Both this and Fortified Networks use a learned denoising autoencoder in the hidden states of a network. A major difference is that the denoising feature matching work focused on generative adversarial networks and tried to minimize reconstruction error through a learned generator network, whereas our approach targets the adversarial examples problem. Additionally, our objective encourages the output of the DAE to denoise adversarial examples so as to point back to the hidden state of the original example, which is different from the objective in the denoising feature matching work, which encouraged reconstruction error to be low on states from samples from the generator network. + +Adversarial Spheres. Gilmer et al. (2018) studied the existence of adversarial examples in the task of classifying between two hollow concentric shells. Intriguingly, they prove and construct adversarial examples which lie on the data manifold (although Ilyas et al. (2017) also looked for such examples experimentally using GANs.) The existence of such on-manifold adversarial examples demonstrates that a simplified version of our model trained with only $\mathcal { L } _ { r e c }$ could not protect against all adversarial examples. However, training with $\mathcal { L } _ { a d v }$ encourages the fortified layers to map back from points which are not only off of the manifold, but also to map back from points which are hard to classify, allowing Fortified Networks to also potentially help with on-manifold adversarial examples as well. + +# 7 CONCLUSION + +Protecting against adversarial examples could be of paramount importance in mission-critical applications. We have presented Fortified Networks, a simple method for the robustification of existing deep neural networks. Our method is practical, as fortifying an existing network entails introducing DAEs between the hidden layers of the network, which can be automated. Furthermore, the DAE reconstruction error at test time is a reliable signal of distribution shift, which can result in examples unlike those encountered during training. High error can signify either adversarial attacks or significant domain shift; both are important cases for the analyst or system to be aware of. Moreover, fortified networks are efficient: since not every layer needs to be fortified to achieve improvements, fortified networks are an efficient way to improve robustness to adversarial examples. For example, we have shown improvements on ResNets where only two fortified layers are added, and thus the change to the computational cost is very slight. Finally, fortified networks are effective, as they improve results on adversarial defense on three datasets (MNIST, Fashion MNIST, and CIFAR10), across a variety of attack parameters (including the most widely used $\varepsilon$ values), across three widely studied attacks (FGSM, PGD, Carlini-Wagner L2), and in both the black-box and white-box settings. + +REFERENCES +Guillaume Alain, Yoshua Bengio, and Salah Rifai. Regularized auto-encoders estimate local statistics. CoRR, abs/1211.4246, 2012. URL http://arxiv.org/abs/1211.4246. +A. Athalye, N. Carlini, and D. Wagner. Obfuscated Gradients Give a False Sense of Security: Circumventing Defenses to Adversarial Examples. ArXiv e-prints, February 2018. +Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. CoRR, abs/1707.07397, 2017. URL http://arxiv.org/abs/1707.07397. +Yoshua Bengio, Grégoire Mesnil, Yann Dauphin, and Salah Rifai. Better mixing via deep representations. CoRR, abs/1207.4404, 2012. URL http://arxiv.org/abs/1207.4404. +Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Trans. Pattern Analysis and Machine Intelligence (PAMI), 35(8):1798–1828, 2013a. +Yoshua Bengio, Grégoire Mesnil, Yann Dauphin, and Salah Rifai. Better mixing via deep representations. In ICML’2013, 2013b. +Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. arXiv preprint arXiv:1604.07316, 2016. +T. B. Brown, D. Mané, A. Roy, M. Abadi, and J. Gilmer. Adversarial Patch. ArXiv e-prints, December 2017. +Nicholas Carlini and David A. Wagner. Towards evaluating the robustness of neural networks. CoRR, abs/1608.04644, 2016. URL http://arxiv.org/abs/1608.04644. +Akram Erraqabi, Aristide Baratin, Yoshua Bengio, and Simon Lacoste-Julien. A3t: Adversarially augmented adversarial training. arXiv preprint arXiv:1801.04055, 2018. +J. Gilmer, L. Metz, F. Faghri, S. S. Schoenholz, M. Raghu, M. Wattenberg, and I. Goodfellow. Adversarial Spheres. ArXiv e-prints, January 2018. +I. J. Goodfellow, J. Shlens, and C. Szegedy. Explaining and Harnessing Adversarial Examples. ArXiv e-prints, December 2014. +Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. CoRR, abs/1412.5068, 2014. URL http://arxiv.org/abs/1412.5068. +A. Ilyas, A. Jalal, E. Asteri, C. Daskalakis, and A. G. Dimakis. The Robust Manifold Defense: Adversarial Training using Generative Models. ArXiv e-prints, December 2017. +Colin Raffel Ian Goodfellow Jacob Buckman, Aurko Roy. Thermometer encoding: One hot way to resist adversarial examples. International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ S18Su--CW. +Harini Kannan, Alexey Kurakin, and Ian J. Goodfellow. Adversarial logit pairing. CoRR, abs/1803.06373, 2018. URL http://arxiv.org/abs/1803.06373. +Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial machine learning at scale. CoRR, abs/1611.01236, 2016. URL http://arxiv.org/abs/1611.01236. +Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015. +F. Liao, M. Liang, Y. Dong, T. Pang, J. Zhu, and X. Hu. Defense against Adversarial Attacks Using High-Level Representation Guided Denoiser. ArXiv e-prints, December 2017. +A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu. Towards Deep Learning Models Resistant to Adversarial Attacks. ArXiv e-prints, June 2017. + +Nicolas Papernot, Patrick D. McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. CoRR, abs/1511.04508, 2015. URL http://arxiv.org/abs/1511.04508. + +Nicolas Papernot, Nicholas Carlini, Ian Goodfellow, Reuben Feinman, Fartash Faghri, Alexander Matyasko, Karen Hambardzumyan, Yi-Lin Juang, Alexey Kurakin, Ryan Sheatsley, et al. cleverhans v2. 0.0: an adversarial machine learning library. arXiv preprint arXiv:1610.00768, 2016a. + +Nicolas Papernot, Patrick D. McDaniel, Ian J. Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. CoRR, abs/1602.02697, 2016b. URL http://arxiv.org/abs/1602.02697. + +Nicolas Papernot, Patrick D. McDaniel, Arunesh Sinha, and Michael P. Wellman. Towards the science of security and privacy in machine learning. CoRR, abs/1611.03814, 2016c. URL http://arxiv.org/abs/1611.03814. + +Pouya Samangouei, Maya Kabkab, and Rama Chellappa. Defense-gan: Protecting classifiers against adversarial attacks using generative models. In International Conference on Learning Representations, volume 9, 2018. + +Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K Reiter. Adversarial generative nets: Neural network attacks on state-of-the-art face recognition. arXiv preprint arXiv:1801.00349, 2017. + +C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. ArXiv e-prints, December 2013. + +David Warde-Farley and Yoshua Bengio. Improving generative adversarial networks with denoising feature matching. 2016. + +Chaowei Xiao, Bo Li, Jun-Yan Zhu, Warren He, Mingyan Liu, and Dawn Song. Generating adversarial examples with adversarial networks. arXiv preprint arXiv:1801.02610, 2018. + +Weilin Xu, David Evans, and Yanjun Qi. Feature squeezing: Detecting adversarial examples in deep neural networks. CoRR, abs/1704.01155, 2017. URL http://arxiv.org/abs/1704. 01155. + +# A EXPERIMENTAL SETUP + +All attacks used in this work were carried out using the Cleverhans (Papernot et al., 2016a) library. + +# A.1 WHITE-BOX ATTACKS + +Our convolutional models (Conv, in the tables) have 2 strided convolutional layers with 64 and 128 filters followed by an unstrided conv layer with 128 filters. We use ReLU activations between layers then followed by a single fully connected layer. The convolutional and fully-connected DAEs have a single bottleneck layer with leaky ReLU activations with some ablations presented in the table below. + +With white-box PGD attacks, we used only convolutional DAEs at the first and last conv layers with Gaussian noise of $\sigma = 0 . 0 1$ whereas with FGSM attacks we used a DAE only at the last fully connected layer. The weight on the reconstruction error $\lambda _ { r e c }$ and adversarial cost $\lambda _ { a d v }$ were set to 0.01 in all white-box attack experiments. We used the Adam optimizer with a learning rate of 0.001 to train all models. + +The table below lists results a few ablations with different activation functions in the autoencoder + +Table 8: More detailed version of table 1, but with more detailed ablation experiments for our method included. Accuracies against white-box MNIST attacks with FGSM, where the model is a convolutional net. We used the standard FGSM attack parameters with an $\varepsilon$ of 0.3 and compare against published adversarial training defenses. We also performed ablations where we considered removing the reconstruction error on adversarial examples $\mathcal { L } _ { a d v }$ as well as switching the activation function in the fortified layers from leaky relu to tanh, which we found to slightly help in this case. + +
ModelFGSM
Adv. Train (Madry et al., 2017) Adv.Train (Jacob Buckman, 2018) Adv. Train (ours) Adv. Train No-Rec (ours)95.60 96.17 96.36 96.47
Quantized (Jacob Buckman, 2018) One-Hot (Jacob Buckman,2018) Thermometer (Jacob Buckman, 2018)96.29 96.22
Our Approaches95.84
Fortified Network - Conv, w/o Ladu,lrelu Fortified Network - Conv, lrelu Fortified Network - Conv, tanh96.46 97.69 97.97
+ +# A.2 BLACK-BOX ATTACKS + +Our black-box results are based on a fully-connected substitute model (input-200-200-output), which was subsequently used to attack a fortified convolutional network. The CNN was trained for 50 epochs using adversarial training, and the predictions of the trained CNN were used to train the substitute model. 6 iterations of Jacobian data augmentation were run during training of the substitute, with $\lambda = 0 . 1$ . The test set data holdout for the adversary was fixed to 150 examples. The learning rate was set to 0.003 and the Adam optimizer was used to train both models. + +# B GRADIENT OBFUSCATION + +Various validation experiments have been run to show that fortification layers do not merely operate by obfuscating gradients. All results reported in this section are based on ConvNets trained on the CIFAR-10 dataset and attacked with PGD. + +Table 9: PGD, attack run for 100 iterations + +
EpsilonBaseline (extra layers)Fortified Networks
0.0335.339.2
0.0424.828.0
0.0614.315.6
0.0812.013.0
0.111.712.9
0.210.211.3
0.38.49.6
+ +
StepsBaselineBaseline (extra layers)Fortified Networks
7 steps33.034.245.0
50 steps31.632.542.1
200 steps31.432.241.5
+ +Table 10: More attack steps to uncover gradient masking effects. + +Different epsilon values at attack time. We applied attacks of different $\varepsilon$ values to a network trained with $\varepsilon = 0 . 0 3$ . Results shown in tab. 9. + +More attack iterations. We ran attacks for more steps at test time, on a network trained on attacks of 7 steps. Results shown in tab. 10. \ No newline at end of file diff --git a/md/train/SklcyJBtvB/SklcyJBtvB.md b/md/train/SklcyJBtvB/SklcyJBtvB.md new file mode 100644 index 0000000000000000000000000000000000000000..519a7a9a29d8a4bcffdb2c6afbdb5cc3b9fb78fe --- /dev/null +++ b/md/train/SklcyJBtvB/SklcyJBtvB.md @@ -0,0 +1,406 @@ +# OFF-POLICY BANDITS WITH DEFICIENT SUPPORT + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Off-policy training of contextual-bandit policies is attractive in online systems (e.g. search, recommendation, ad placement), since it enables the reuse of large amounts of log data. State-of-the-art methods for off-policy learning, however, are based on inverse propensity score (IPS) weighting, which requires that the logging policy chooses all actions with non-zero probability for any context (i.e., full support). In real-world systems, this condition is often violated, and we show that existing off-policy learning methods based on IPS weighting can fail catastrophically. We therefore develop new off-policy contextual-bandit methods that can controllably and robustly learn even when the logging policy has deficient support. To this effect, we explore three approaches that provide various guarantees for safe learning despite the inherent limitations of support deficient data: restricting the action space, reward extrapolation, and restricting the policy space. We analyze the statistical and computational properties of these three approaches, and empirically evaluate their effectiveness in a series of experiments. We find that controlling the policy space is both computationally efficient and that it robustly leads to accurate policies. + +# 1 INTRODUCTION + +Many interactive systems (e.g., voice assistants, recommender systems, ad placement) can be modeled as contextual bandit problems (Langford & Zhang, 2008). In particular, each user request provides a context (e.g., user profile, query) for which the system selects an action (e.g., recommended product, presented ad) and receives a reward (e.g., purchase, click). Such contextual-bandit data is logged in large quantities as a by-product of normal system operation (Li et al., 2011; 2015; Joachims et al., 2017), making it an attractive and low-cost source of training data. With terabytes of such log data readily available in many online systems, a range of algorithms have been proposed for batch learning from such logged contextual-bandit feedback (Strehl et al., 2011; Dud´ık et al., 2011; Swaminathan & Joachims, 2015a; Thomas & Brunskill, 2016; Farajtabar et al., 2018; Su et al., 2019; London & Sandler, 2019). However, as we will argue below, these algorithms require an assumption about the log data that makes them unsuitable for many real-world applications. + +This assumption is typically referred to as the positivity or support assumption, and it is required by the Empirical Risk Minimization (ERM) objective that these algorithms optimize. Specifically, unlike in online learning for contextual bandits (Williams, 1992; Agarwal et al., 2014), batch learning from bandit feedback (BLBF) operates in the off-policy setting. During off-policy learning, the algorithm has to address the counterfactual question of how much reward each policy in the policy space would have received, if it had been used instead of the logging policy. To this effect, virtually all state-of-the-art off-policy learning methods for contextual-bandit problems rely on counterfactual estimators (Bottou et al., 2013; Dud´ık et al., 2011; Swaminathan & Joachims, 2015a; Thomas & Brunskill, 2016; Farajtabar et al., 2018; Su et al., 2019) that employ inverse propensity score (IPS) weighting to get an unbiased ERM objective. Unlike regression-based direct-modeling (DM) approaches that are often hampered by bias from model-misspecification, IPS allows a controllable bias-variance trade-off through clipping and other variance-regularization techniques (Strehl et al., 2011; Swaminathan & Joachims, 2015a; London & Sandler, 2019). + +Unfortunately, IPS and its variance-control mechanisms break down when the logging policy does not have full support – meaning that some actions have zero probability of being selected under the logging policy. In this case IPS can be highly biased. Full support is an unreasonable assumption in many real-world systems, especially when the action space is large and many actions have poor rewards. For example, in a recommender system with a large catalog (e.g. movies, music), it may be that less than $10 \%$ of the actions have support under the logging policy. We will show that existing learning algorithms can fail catastrophically on such support deficient data. + +In this paper, we develop new off-policy contextual-bandit algorithms that are specifically designed to deal with support deficient log data. Since support deficiency translates into blind spots where we do not have any knowledge about the rewards, accounting for these blind spots as part of learning is crucial for robust learning. We approach this problem from three perspectives. First, we explore restricting the action space to those actions that have support under the logging policy. Second, we explore imputation methods that extrapolate estimated rewards to those blind spots. And, third, we restrict the policy space to only those policies that have limited exposure to the blind spots. To make the latter approach computationally tractable, we define a new measure of Support Divergence between policies, show how it can be estimated efficiently without closed-form knowledge of the logging policy, and how it can be used as a constraint on the policy space. We analyze the statistical and computational properties of all three approaches and perform an extensive empirical evaluation. We find that restricting the policy space is particularly effective, since it is computationally efficient, empirically effective at learning good policies, and convenient to use in practice. + +# 2 RELATED WORK + +Most prior works on BLBF can be classified into two different approaches. The first – called Direct Model (DM) – is based on a reduction to supervised learning, where a regression estimate is trained to predict rewards (Beygelzimer & Langford, 2009). To derive a policy, the action with the highest predicted reward is chosen. A drawback of this simple approach is the bias that results from misspecification of the regression model. Since regression models are often substantially misspecified for real-world data, the DM approach often does not work well empirically. + +The second approach is based on policy learning via ERM with a counterfactual risk estimator. Inverse propensity score (IPS) weighting is one of the most popular estimators to be used as empirical risk. However, policy learning algorithms based on IPS and related estimators (Strehl et al., 2011; Swaminathan & Joachims, 2015a;b; Thomas & Brunskill, 2016; London & Sandler, 2019) require the assumption that the logging policy has full support for every policy in the policy space. One exception is the work of Liu et al. (2019). They relax the assumption to the existence of an optimal policy such that the logging policy covers the support of this optimal policy. However, this is an untestable assumption that does not provide guarantees for real-world applications. + +Our work proposes three approaches to addressing off-policy learning with support deficiency. First, our conservative extrapolation method is related to the method proposed by Liu et al. (2019). They focus on the correction of the state distribution by defining an augmented MDP, and pessimistic imputation is used to get an estimate for policy-gradient learning. Second, our method of restricting the policy space uses a surrogate for the support divergence of two policies that was previously used as control variate in the SNIPS estimator (Swaminathan & Joachims, 2015b). It also appeared in the Lagrangian formulation of the BanditNet objective (Joachims et al., 2018) and in the gradient update in REINFORCE algorithm (Williams, 1992). This connection gives interesting new insight that the baselines used in policy-gradient algorithms not only help to reduce variance in gradients (Greensmith et al., 2004), but that they also connect to the problem of support deficiency in the off-policy setting. + +# 3 OFF-POLICY LEARNING WITH DEFICIENT SUPPORT + +We start by formally defining the problem of learning a contextual-bandit policy in the BLBF setting. Input to the policy are contexts $x \in \mathcal { X }$ drawn i.i.d from a fixed but unknown distribution $P ( \mathcal X )$ . Given context $x$ , the system executes a possibly stochastic policy $\pi ( \mathcal { V } | x )$ that selects an action $y \in \mathcal { V }$ . For this context and action pair, the system observes a reward $r \in [ r _ { m i n } , r _ { m a x } ]$ from $P ( r | x , y )$ . Given a space of policies $\Pi$ , the reward of any policy $\pi \in \Pi$ is defined as + +$$ +R ( \pi ) = \underset { x } { \mathbb { E } } \underset { y \sim \pi ( y \mid x ) } { \mathbb { E } } \underset { r \sim P ( r \mid x , y ) } { \mathbb { E } } [ r ] . +$$ + +In the BLBF setting, the learning algorithm is given a dataset + +$$ +\mathcal { D } : = \{ x _ { i } , y _ { i } , r _ { i } , \pi _ { 0 } ( y _ { i } | x _ { i } ) \} _ { i = 1 } ^ { n } +$$ + +of past system interactions which consists of context-action-reward-propensity tuples. The propensity $\pi _ { 0 } ( y _ { i } | x _ { i } )$ is the probability of selecting action $y _ { i }$ for context $x _ { i }$ under the policy $\pi _ { 0 }$ that was used to log the data. We call $\pi _ { 0 }$ the logging policy, and we will discuss desired conditions on the stochasticity of $\pi _ { 0 }$ in the following. The goal of off-policy learning is to exploit the information in the logged data $\mathcal { D }$ to find a policy ${ \hat { \pi } } \in \Pi$ that has high reward $R ( { \hat { \pi } } )$ . + +Analogous to the ERM principle in supervised learning, off-policy learning algorithms typically optimize a counterfactual estimate $\hat { R } ( \pi )$ of $R ( \pi )$ as the training objective (Li et al., 2011; 2015; Bottou et al., 2013; Swaminathan & Joachims, 2015a). + +$$ +\hat { \pi } = \underset { \pi \in \Pi } { \arg \operatorname* { m a x } } [ \hat { R } ( \pi ) ] +$$ + +For conciseness, we ignore additional regularization terms in the objective (Swaminathan & Joachims, 2015a), since they are irrelevant to the main point of this paper. As counterfactual estimator $\hat { R } ( \pi )$ , most algorithms rely on some form of IPS weighting (Strehl et al., 2011; Dud´ık et al., 2011; Swaminathan & Joachims, 2015a;b; Wang et al., 2017; Su et al., 2019) to correct the distribution mismatch between the logging policy $\pi _ { 0 }$ and each target policy $\pi \in \Pi$ . + +$$ +\hat { R } _ { I P S } ( \pi ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \pi ( y _ { i } | x _ { i } ) } { \pi _ { 0 } ( y _ { i } | x _ { i } ) } r _ { i } . +$$ + +A crucial condition for the effectiveness of the IPS estimator (and similar estimators) is that the logging policy $\pi _ { 0 }$ assigns non-zero probability to all actions that have non-zero probability under the target policy $\pi$ we aim to evaluate. This condition is known as positivity or full support, and it is defined as follows. + +Definition 1 (Full support). The logging policy $\pi _ { 0 }$ is said to have full support for $\pi$ when $\pi _ { 0 } ( y | x ) >$ 0 for all actions $y \in \mathcal { V }$ and contexts $x \in \mathcal { X }$ for which $\pi ( y | x ) > 0$ . + +It is known that the IPS estimator is unbiased, $\mathbb { E } _ { \mathcal { D } } [ \hat { R } _ { I P S } ( \pi ) ] = R ( \pi )$ , if the logging policy $\pi _ { 0 }$ has full support for $\pi$ (Li et al., 2011). To ensure unbiased ERM, algorithms that use the IPS estimator require that the logging policy $\pi _ { 0 }$ has full support for all policies $\pi \in \Pi$ in the policy space. For sufficiently rich policy spaces, like deep-networks $f _ { w } ( x , y )$ with softmax outputs of the form + +$$ +\pi _ { w } ( y | x ) = \frac { e x p ( f _ { w } ( x , y ) ) } { \sum _ { y ^ { \prime } \in \mathcal { V } } e x p ( f _ { w } ( x , y ^ { \prime } ) ) } , +$$ + +this means that the logging policy $\pi _ { 0 }$ needs to assign non-zero probability to every action $y$ in every context $x$ . This is a strong condition that is not feasible in many real-world systems, especially if the action space is large and many actions have poor reward. + +If the support requirement is violated, ERM learning can fail catastrophically. We will show below that the underlying reason is bias, not excessive variance that could be remedied through clipping or variance regularization (Strehl et al., 2011; Swaminathan $\&$ Joachims, 2015a). To quantify how support deficient a logging policy is, we denote the set of unsupported actions for context $x$ under $\pi _ { 0 }$ as + +$$ +\mathcal { U } ( x , \pi _ { 0 } ) : = \{ y \in y | \pi _ { 0 } ( y | x ) = 0 \} . +$$ + +The bias of the IPS estimator is then characterized by the expected reward on the unsupported actions. + +Proposition 1. Given contexts $x \sim P ( \mathcal { X } )$ and logging policy $\pi _ { 0 } ( \mathcal { V } | x )$ , the bias of $\hat { R } _ { I P S }$ for target policy $\pi ( \mathcal { V } | x )$ is equal to the expected reward on the unsupported action sets, i.e., $b i a s ( \pi | \pi _ { 0 } ) =$ $\begin{array} { r } { \mathbb { E } _ { x } [ - \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \delta ( x , y ) ] } \end{array}$ . + +The proof is in Appendix A.1. From Proposition 1, it is clear that support deficient log data can drastically mislead ERM learning. To quantify the effect of support deficiency on ERM, we define the support divergence between a logging policy $\pi _ { 0 }$ and a target policy $\pi$ as follows. + +Definition 2 (Support Divergence). For contexts $x \sim P ( \mathcal { X } )$ and any corresponding pair of target policy $\pi$ and logging policy $\pi _ { 0 }$ , the Support Divergence is defined as + +$$ +\mathcal { D } _ { \mathcal { X } } \big ( \pi \big | \pi _ { 0 } \big ) : = \underset { x \sim P ( \mathcal { X } ) } { \mathbb { E } } \left[ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \right] . +$$ + +With this definition in hand, we can quantify the effect of support deficiency on ERM learning for a policy space $\Pi$ under logging policy $\pi _ { 0 }$ . + +Theorem 1. For any given hypothesis space $\Pi$ with logging policy $\pi _ { 0 } ~ \in ~ \Pi$ , there exists a reward distribution $\mathcal { P } _ { r }$ with support in $[ r _ { m i n } , r _ { m a x } ]$ such that in the limit of infinite training data, ERM using IPS over the logged data $\mathcal D \sim \dot { P } ( \mathcal X ) \times \pi _ { 0 } ( \cdot | \mathcal X ) \times \mathcal P _ { r }$ can select a policy $\begin{array} { r } { \hat { \pi } \in \arg \operatorname* { m a x } _ { \pi \in \Pi } \mathbb { E } _ { \mathcal { D } } [ \hat { R } _ { I P S } ( \pi ) ] } \end{array}$ that is at least $\begin{array} { r l } { { ( r _ { m a x } - r _ { m i n } ) \operatorname* { m a x } _ { \pi \in \Pi } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) } \quad } & { { } } \end{array}$ suboptimal. + +The proof is in Appendix A.2. To illustrate the theorem, consider a problem with rewards $r \in$ $[ - 1 , 0 ]$ . Furthermore, consider a policy space $\Pi$ that contains a good policy $\pi _ { g }$ with $R ( \pi _ { g } ) = - 0 . 1$ and a bad policy $\pi _ { b }$ with $R ( \pi _ { b } ) = - 0 . 7 .$ . If policy $\pi _ { b }$ has support divergence $\mathcal { D } _ { \mathcal { X } } ( \pi _ { b } \vert \pi _ { 0 } ) = 0 . 6$ or larger, then ERM may return the bad $\pi _ { b }$ instead of $\pi _ { g }$ even with infinite amounts of training data. + +Note that it is sufficient to merely have one policy in $\Pi$ that has large support deficiency to achieve this suboptimality. It is therefore crucial to control the support divergence $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } )$ uniformly over all $\pi \in \Pi$ , or to account for the suboptimality it can induce. To this effect, we explore three approaches in the following. + +# 3.1 SAFE LEARNING BY RESTRICTING THE ACTION SPACE + +The first and arguably most direct approach to reducing $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } )$ is to disallow any action that has zero support under the logging policy. For the remaining action set, the logging policy has full support by definition. This restriction of the action set can be achieved by transforming each policy $\pi \in \Pi$ into a new policy that sets the probability of the unsupported actions to zero. + +$$ +\pi ( y | x ) \longrightarrow \bar { \pi } ( y | x ) : = \frac { \pi ( y | x ) \mathbb { 1 } _ { \{ y \notin \mathcal { U } ( x , \pi _ { 0 } ) \} } } { 1 - \sum _ { y ^ { \prime } \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y ^ { \prime } | x ) } +$$ + +This results in a new policy space $\bar { \Pi }$ . All $\bar { \pi } \in \bar { \Pi }$ have support divergence of zero $\mathcal { D } _ { \mathcal { X } } ( \bar { \pi } | \pi _ { 0 } ) = 0$ and ERM via IPS is guaranteed to be unbiased. + +While this transformation of the policy space from $\Pi$ to $\bar { \Pi }$ is conceptually straightforward, it has two potential drawbacks. First, restricting the action space without any exceptions may overly constrain the policies in $\bar { \Pi }$ . In particular, if the optimal action $y ^ { * }$ for a specific context $x$ does not have support under the logging policy, no $\bar { \pi } \in \dot { \bar { \Pi } }$ can ever choose $y ^ { * }$ even if there are many observations of similar $y$ ’s on similar context $x ^ { \prime }$ . The second drawback is computational. For every context $x$ during training and testing, the system needs to evaluate the logging policy $\pi _ { 0 } ( y | x )$ to compute the transformation from $\pi$ to $\bar { \pi }$ . This can be prohibitively expensive especially at test time, where – after multiple rounds of off-policy learning with data from previously learned policies – we would need to evaluate the whole sequence of previous logging policies to execute the learned policy. + +# 3.2 SAFE LEARNING THROUGH REWARD EXTRAPOLATION + +As illustrated above, support deficiency is a problem of blind spots where we lack information about the rewards of some actions in some contexts. Instead of disallowing the unsupported actions like in the previous section, an alternative is to extrapolate the observed rewards to fill in the blind spots. To this effect, we propose the following augmented IPS estimator that imputes an extrapolated reward $\hat { \delta } ( x , y )$ for each unsupported action $y \in \mathcal { U } ( x , \pi _ { 0 } )$ . + +$$ +\hat { R } _ { I P S } ^ { \delta } ( \pi ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left[ \frac { \pi ( y _ { i } | x _ { i } ) } { \pi _ { 0 } ( y _ { i } | x _ { i } ) } r _ { i } + \sum _ { y \in \mathcal { U } ( x _ { i } , \pi _ { 0 } ) } \pi ( y | x _ { i } ) \hat { \delta } ( x _ { i } , y ) \right] +$$ + +In the following proposition, we characterize the bias of the augmented IPS estimator for any given reward extrapolation $\hat { \delta } ( x , y )$ . We denote the mean of the reward $r$ for context $x$ and action $y$ with $\delta ( x , y ) = \mathbb { E } _ { r \sim P ( r | x , y ) } [ r ]$ . Furthermore, $\Delta ( x , y ) : = \hat { \delta } ( x , y ) - \delta ( x , y )$ denotes the error of the reward extrapolation for each $x$ and $y$ . + +Proposition 2. Given contexts $x _ { 1 } , x _ { 2 } , \ldots , x _ { n }$ drawn i.i.d from the unknown distribution $P ( \mathcal X )$ , for action $y _ { i }$ drawn independently from logging policy $\pi _ { 0 }$ with probability $\pi _ { 0 } ( \mathcal { V } | x _ { i } )$ , the bias of the empirical risk defined in Equation (7) is $\begin{array} { r } { \mathbb E _ { x } [ \sum _ { y \in \mathcal U _ { x } ^ { \pi _ { 0 } } } \pi ( y | x ) \Delta ( x , y ) ] } \end{array}$ . + +In this way we can learn in the original action and policy space, but mitigate the effect of the support deficiency by explicitly incorporating the extrapolated reward $\hat { \delta } ( x , y )$ . We explore two choices for $\hat { \delta } ( x , y )$ in the following, which provide different types of guarantees. + +Conservative Extrapolation. To minimize the user impact of randomization in the logging policy, it is generally desirable to put zero probability on actions the are very likely to have low (or even catastrophic reward). This means that precisely those bad actions are likely to not be supported in the logging policy. A key danger of blind spots regarding those actions is that naive IPS training will inadvertently learn + +# Algorithm 1: Data Augmentation + +input: original logged dataset $\mathcal { D }$ , replaycount $k$ , +reward estimate $\hat { \delta } ( x , y )$ ; output: $\mathcal { D } ^ { \prime }$ ; +initialization: $\mathcal { D } ^ { \prime } = \varnothing$ ; +for $j = 1 , \dots , k$ do for $i = 1 , \ldots , n$ do Define $U _ { x _ { i } }$ to be the uniform distribution over $\mathcal { U } ( x _ { i } , \pi _ { 0 } )$ ; Draw $y \sim U _ { x _ { i } }$ ; $\begin{array} { r } { \mathcal { D } ^ { \prime } = \mathcal { D } ^ { \prime } \bigcup \{ x _ { i } , y , \hat { \delta } ( x _ { i } , y ) , \frac { 1 } { | \mathcal { U } ( x _ { i } , \pi _ { 0 } ) | } \} ; } \end{array}$ end +end + +a policy that selects those actions. This can be avoided by being maximally conservative about unsupported actions and imputing the lowest possible reward $\forall x , y \in \mathcal { U } ( x , \pi _ { 0 } ) : \hat { \delta } ( x , y ) = r _ { m i n }$ . Intuitively, by imposing the worst possible reward for the unsupported actions, the learning algorithm will aim to avoid these low-reward areas. However, unlike for the $\bar { \pi }$ policies resulting from the restricted action space, the learned policy is not strictly prohibited from choosing unsupported actions – it is merely made aware of the maximum loss that the action may incur. Note that for problems where $r _ { m i n } = 0$ , the naive IPS estimator is identical to conservative extrapolation since the second term in Equation (7) is zero. + +Regression Extrapolation. Instead of extrapolating with the worst-case reward, we may have additional prior knowledge in the form of a model-based estimate that reduces the bias. In particular, we explore using a regression estimate $\begin{array} { r } { \hat { \delta } = \arg \operatorname* { m i n } _ { \hat { \delta } ^ { \theta } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } ( \hat { \delta } ^ { \theta } ( x _ { i } , y _ { i } ) - r _ { i } ) ^ { 2 } } \end{array}$ that extrapolates from the observed data $\mathcal { D }$ . Typically, comes from a parameterized class of regression functions. Other regression objectives could also be used, such as weighted linear regression that itself uses importance sampling as weights (Farajtabar et al., 2018). But, fundamentally, all regression approaches assume that the regression model is not misspecified and that it can thus extrapolate well. Note that the IPS part of Equation (7) can be changed to any estimators (with action set restricted on $\boldsymbol { \mathcal { U } } ( \boldsymbol { x } , \pi _ { 0 } ) ^ { c }$ for all $x$ ), and it turns out that doubly robust (Dud´ık et al., 2011) and CAB (Su et al., 2019) are special extensions of regression extrapolation that substitute the IPS part with their corresponding estimator. + +Efficient Approximation. Evaluating the augmented IPS estimator from Equation (7) can be computationally expensive if the number of unsupported actions $\boldsymbol { \mathcal { U } } ( \boldsymbol { x } , \pi _ { 0 } )$ is large. To overcome this problem, we propose to use sampling to estimate the expected reward on the unsupported action, which can be thought of as augmenting the dataset $\mathcal { D }$ with additional observations where the logging policy has zero support. In particular, we propose the data-augmentation procedure detailed in Algorithm 1. With the additional bandit data $\mathcal { D } ^ { \prime } = \{ x _ { j } ^ { \prime } , y _ { j } ^ { \prime } , \hat { \delta } ( x _ { j } ^ { \prime } , y _ { j } ^ { \prime } ) , p _ { j } ^ { \prime } \} _ { j = 1 } ^ { m }$ from Algorithm 1, the new objective is + +$$ +\underset { \pi \in \Pi } { \arg \operatorname* { m i n } } \left\{ \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \pi ( y _ { i } | x _ { i } ) } { \pi _ { 0 } ( y _ { i } | x _ { i } ) } r _ { i } + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \frac { \pi ( y _ { j } ^ { \prime } | x _ { j } ^ { \prime } ) } { p _ { j } ^ { \prime } } \hat { \delta } ( x _ { j } ^ { \prime } , y _ { j } ^ { \prime } ) \right\} . +$$ + +In Appendix A.5, we show that the empirical risk in Equation (8) has the same expectation (over randomness in $\mathcal { D }$ and $\mathcal { D } ^ { \prime }$ ) as $\hat { R } _ { I P S } ^ { \delta } ( \mathcal { D } )$ and can thus serve as an approximation for Equation (7). + +# 3.3 SAFE LEARNING BY RESTRICTING THE POLICY SPACE + +As motivated by Theorem 1, the risk of learning from support deficient data scales with the maximum support divergence $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } )$ among the policies in the policy space $\Pi$ . Therefore, our third approach restricts the policy space to the subset $\Pi ^ { \kappa } \subset \Pi$ that contains the policies $\pi \in \Pi$ with an acceptably low support divergence $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } ) \le \kappa$ . + +$$ +\Pi ^ { \kappa } = \{ \pi | \pi \in \Pi \wedge { \mathscr { D } } \chi ( \pi | \pi _ { 0 } ) \leq \kappa \} +$$ + +The parameter $\kappa$ has an intuitive meaning. It specifies the maximum probability mass that a learned policy can place on unsupported actions. By limiting this to $\kappa$ , we limit the maximum bias of the ERM procedure according to Proposition 2 while not explicitly torquing the rewards like in conservative reward imputation. + +A key challenge, however, is implementing this restriction of the hypothesis space, such that the ERM learner $\hat { \pi } = \arg \operatorname* { m a x } _ { \pi \in \Pi ^ { \kappa } } [ \hat { R } _ { I P S } ( \pi ) ]$ only considers the subset $\Pi ^ { \kappa } \subset \Pi$ . In particular, we do not have access to the context distribution $P ( \mathcal X )$ for calculating $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } )$ , nor would it be possible to enumerate all $\pi \in \Pi$ to check the condition $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } ) ~ \le ~ \kappa$ , which itself requires a possibly infeasible iteration over all actions. The following theorem (with proof in Appendix A.3) gives us an efficient way of estimating and controlling $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } )$ without explicit knowledge of $P ( \mathcal X )$ or access to the logging policy $\pi _ { 0 }$ beyond the logged propensities. + +Theorem 2. For contexts $x _ { i }$ drawn i.i.d from $P ( \mathcal X )$ , action $y _ { i }$ drawn from logging policy $\pi _ { 0 }$ , we define SD(π|π0) = 1n Pni=1 π(yi|xi)π0(yi|xi) . For any policy $\pi$ it holds that + +$$ +\begin{array} { r } { \underset { x \sim P ( \mathcal { X } ) } { \mathbb { E } } \underset { y \sim \pi _ { 0 } ( \cdot | x ) } { \mathbb { E } } [ S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) ] + \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) = 1 } \end{array} +$$ + +Using this theorem, the following proposition (proof in Appendix A.4, empirically verified in Appendix B) gives us an efficient way of implementing the constraint $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } ) \le \kappa$ via $1 - S _ { D } ( \pi | \pi _ { 0 } )$ . + +Proposition 3. For any given $\kappa \in ( 0 , 1 )$ , $0 < \epsilon < \kappa / 2$ , let $p _ { m i n }$ denote the minimum propensity under supported set $p _ { m i n } ~ = ~ m a x _ { x , y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi _ { 0 } ( y | x )$ , then with probability larger than $1 - 2 \exp ( - 2 n \epsilon ^ { 2 } p _ { m i n } ^ { 2 } )$ , the constraint $1 - \kappa { + } \epsilon \le S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) \le 1 { - } \epsilon$ will ensure $0 \leq \mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } ) \leq \kappa$ . + +We can thus use $1 - S _ { D } ( \pi | \pi _ { 0 } )$ as a surrogate for $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } )$ in the training objective: + +$$ +\underset { \pi _ { w } \in \Pi } { \arg \operatorname* { m i n } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \pi _ { w } ( y _ { i } | x _ { i } ) } { \pi _ { 0 } ( y _ { i } | x _ { i } ) } r _ { i } . \mathrm { ~ s u b j e c t ~ t o ~ } 1 - \kappa + \epsilon \leq \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \pi _ { w } ( y _ { i } | x _ { i } ) } { \pi _ { 0 } ( y _ { i } | x _ { i } ) } \leq 1 - \epsilon +$$ + +Using Lagrange multipliers, an equivalent dual form of Equation (11) is: + +$$ +\operatorname* { m a x } _ { u _ { 1 } , u _ { 2 } \geq 0 } \operatorname* { m i n } _ { \pi _ { w } \in \Pi } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \pi _ { w } ( y _ { i } | x _ { i } ) } { \pi _ { 0 } ( y _ { i } | x _ { i } ) } ( r _ { i } + u _ { 1 } - u _ { 2 } ) - u _ { 1 } ( 1 - \epsilon ) + u _ { 2 } ( 1 - \kappa + \epsilon ) +$$ + +For each fixed $( u _ { 1 } , u _ { 2 } )$ pair, the inner minimization objective is ERM with IPS under a shift of the reward. Instead of maximizing over $( u _ { 1 } , u _ { 2 } )$ in the outer objective, we treat $( u _ { 1 } - u _ { 2 } )$ as a hyperparameter that we select on a validation set. We explore various estimators for this modelselection problem in Section 4. + +Note that, among the methods we proposed for dealing with support deficiency, this approach is the most efficient to implement, and it does not require access to the logging policy during training or testing. Furthermore, the form of the inner objective coincides with that of BanditNet (Joachims et al., 2018), which is known to work well for deep network training by controlling propensity overfitting (Swaminathan & Joachims, 2015a). + +# 4 EMPIRICAL EVALUATION + +We empirically evaluate the effectiveness and robustness of the three proposed approaches: restricting the action space, conservative and regression extrapolation, as well as restricting the policy space. The semi-synthetic experiments are based on two real-world datasets: one is the popular image classification dataset CIFAR10 (Krizhevsky et al.) and the other is the credit-card fraud dataset of Dal Pozzolo et al. (2015). We use the naive IPS estimator and the regression-based Direct Method (DM) as baselines. + +The experiments are set up as follows. We first create a train-validation-test split for both datasets. The training set is used to generate bandit datasets for learning, the validation set is used to generate bandit datasets for model selection, and the full-information test set serves as ground truth for evaluating the learned policies. To simulate bandit feedback for the CIFAR10 dataset, our experiment setup follows traditional supervised bandit conversion for multi-class classification datasets (Beygelzimer & Langford, 2009). To not only have bandit data with binary multi-class rewards, we choose a different methodology for the credit-card dataset by designating some features as corresponding to actions and rewards. More details are given in Appendix B. + +To get logging policies for generating bandit feedback, we start by training a softmax-policy as in Equation (4) on a subset of the full-information data. We then introduce a temperature parameter $\tau$ into the learned policy via $\tau f _ { w } ( x , y )$ to be able to control its stochasticity and support deficiency. In particular, we enforce zero support for some actions by clipping the propensities to 0 if they are below a threshold of $\epsilon = 0 . 0 1$ . The larger $\tau$ , the higher the support deficiency. Note that making the threshold at $\epsilon = 0 . 0 1$ allows us to control support while the variance of IPS stays bounded. This allows us to study support deficiency without having to worry about variance control. + +For both logging and target policies, we train softmax policies where $f _ { w } ( x , y )$ is a neural network. We use the ResNet20 architecture (He et al., 2016) for CIFAR10, and a fully-connected 2-layer network for the credit-card dataset. + +![](images/28a0537b9d42908064e6c5fb86cdcb47b4f7d8597ca2d9309b1cb944a9c7dace.jpg) +Figure 1: Learning results with varying support deficiency in the logging policy. + +How do the methods perform at different level of support deficiency? Results are shown in Figure 1. First, as expected, learning using naive IPS degrades on both datasets as we make the logging policy more peaked and the number of unsupported actions increases. Note that naive IPS coincides with Conservative Extrapolation, since both datasets are scaled to have a minimum reward of zero. In the rightmost column, however, we translated the rewards to $[ - 1 , 0 ]$ . This has a strong detrimental effect on naive IPS, as it is now overly optimistic about unsupported actions. Second, the approach of dealing with support deficiency by restricting the action space also performs poorly. The second row of plot sheds some light on this, as it shows the support divergence $\mathcal { D } _ { \mathcal { X } } ( \pi \vert \pi _ { 0 } )$ of the learned policy. It is zero for Action Restriction as expected, which means that bias is not the problem. Instead, as the number of unsupported actions increases, the best actions are more likely to be pruned and unavailable in the restricted policy space $\bar { \Pi }$ . Third, Regression Extrapolation performs better than Conservative Extrapolation on both datasets. In both cases, the DM model is quite good which also benefits Regression Extrapolation. However, on the credit-card dataset the regression seems better at ranking than at predicting the true reward, which explains why DM performs better than Regression Extrapolation. Fourth, the method that performs well most consistently is Policy Restriction. Unlike all the other IPS-based methods, it performs well even under the translated rewards in the third column of Figure 1. This is because the objective of Policy Restriction coincides with that of BanditNet (Joachims et al., 2018), which is known to remedy propensity overfitting due to the lack of equivariance of the IPS estimator (Swaminathan & Joachims, 2015b). + +How does the learning performance change with more training data? Results are shown in Figure 2. As the number of bandit examples increases, Policy Restriction, Regression Extrapolation and DM dominate over most of the range especially when the percentage of unsupported actions is large. Among the other methods, Action Restriction can take the least advantage of more data. This is plausible, since its maximum performance is limited by the available actions. For similar reasons, Conservative Extrapolation (and equivalently IPS) also flattens out, since it also tightly restricts the action space by imputing the minimum reward. + +![](images/aa8a5d1278cce3164dc98804179215126bb0ed224e646e59e7747093d8691b15.jpg) +Figure 2: Learning results with varying amounts of bandit data on CIFAR10 and credit-card dataset. + +
%Unsupp.OracleRegr.Extrap.DMCons.Extrap.SNIPS
450.8780.8780.8780.8780.876
600.8710.8710.8710.8710.871
700.8580.8580.8560.8580.858
770.8560.8540.8540.8560.856
800.8550.8550.8550.8380.849
+ +![](images/129795f238e4f9e260030195c39b917e0942e1c8abe6287722e9eee2e57b7f77.jpg) +Figure 3: Model selection performance on CIFAR10. + +How effective are the estimators for model selection? Most learning algorithms have hyperparameters, and we now evaluate how the estimators perform for this secondary learning problem. We specifically focus on the parameter $k : = u _ { 1 } - u _ { 2 }$ in Policy Restriction, since it controls how much the learned policies can step outside the region of support. The table on the left of Figure 3 shows the reward of the learned policy when performing model selection with the respective estimator. Oracle is the estimator that has access to the full-information validation set, and can thus be considered as a skyline. We also included the SNIPS estimator (Swaminathan & Joachims, 2015b), which imputes the average reward on the supported action for the unsupported actions (Gilotte et al., 2018). All estimators perform quite well for model selection on CIFAR, and the results are analogous for the credit-card data (see Appendix B.2). However, the plot to the right of Figure 3 reveals that SNIPS does not accurately reflect the shape of the Oracle curve. Both Regression Extrapolation and DM, however, are found to be sufficiently accurate for reliable model selection. + +# 5 DISCUSSION AND CONCLUSIONS + +We identified and analyzed how off-policy learning based on IPS weighting can suffer severely degraded learning performance when the logging policy is support deficient. To remedy this problem, we explored approaches that limit the impact of missing support through three different means: restricting the action space, reward extrapolation and restricting the policy space. We find that the most natural approach of restricting the action space is neither computationally efficient, nor does it learn accurate policies. Reward extrapolation through regression and restricting the policy space, however, both perform well and robustly even at high levels of support deficiency. Among those two methods, reward extrapolation has the potential drawback that we need to compute (and/or sample from) the complement of the logging policy, which can be computationally challenging. Furthermore, having to store all old logging policies is inconvenient in practice. This makes the approach of restricting the policy space particularly attractive, since it is computationally efficient and it does not require access to the logging policy beyond the logged propensity values. + +# REFERENCES + +Alekh Agarwal, Daniel Hsu, Satyen Kale, John Langford, Lihong Li, and Robert Schapire. Taming the monster: A fast and simple algorithm for contextual bandits. In International Conference on Machine Learning (ICML), 2014. + +Alina Beygelzimer and John Langford. The offset tree for learning with partial labels. In Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 129–138. ACM, 2009. + +Leon Bottou, Jonas Peters, Joaquin Qui ´ nonero-Candela, Denis X Charles, D Max Chickering, Elon ˜ Portugaly, Dipankar Ray, Patrice Simard, and Ed Snelson. Counterfactual reasoning and learning systems: The example of computational advertising. The Journal of Machine Learning Research, 14(1):3207–3260, 2013. + +Andrea Dal Pozzolo, Olivier Caelen, Reid A Johnson, and Gianluca Bontempi. Calibrating probability with undersampling for unbalanced classification. In 2015 IEEE Symposium Series on Computational Intelligence, pp. 159–166. IEEE, 2015. + +Miroslav Dud´ık, John Langford, and Lihong Li. Doubly robust policy evaluation and learning. In International Conference on Machine Learning (ICML), 2011. + +Mehrdad Farajtabar, Yinlam Chow, and Mohammad Ghavamzadeh. More robust doubly robust off-policy evaluation. In International Conference on Machine Learning, pp. 1446–1455, 2018. + +Alexandre Gilotte, Clement Calauz ´ enes, Thomas Nedelec, Alexandre Abraham, and Simon Doll \` e.´ Offline a/b testing for recommender systems. In Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining, pp. 198–206. ACM, 2018. + +Evan Greensmith, Peter L Bartlett, and Jonathan Baxter. Variance reduction techniques for gradient estimates in reinforcement learning. Journal of Machine Learning Research, 5(Nov):1471–1530, 2004. + +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. + +T. Joachims, A. Swaminathan, and T. Schnabel. Unbiased learning-to-rank with biased feedback. In ACM Conference on Web Search and Data Mining (WSDM), 2017. + +T. Joachims, A. Swaminathan, and M. de Rijke. Deep learning with logged bandit feedback. In International Conference on Learning Representations (ICLR), 2018. + +Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). URL http://www.cs.toronto.edu/˜kriz/cifar.html. + +John Langford and Tong Zhang. The epoch-greedy algorithm for multi-armed bandits with side information. In Advances in neural information processing systems, pp. 817–824, 2008. + +Lihong Li, Wei Chu, John Langford, and Xuanhui Wang. Unbiased offline evaluation of contextualbandit-based news article recommendation algorithms. In Proceedings of the fourth ACM international conference on Web search and data mining, pp. 297–306. ACM, 2011. + +Lihong Li, Shunbao Chen, Jim Kleban, and Ankur Gupta. Counterfactual estimation and optimization of click metrics in search engines: A case study. In Proceedings of the 24th International Conference on World Wide Web, pp. 929–934. ACM, 2015. + +Yao Liu, Adith Swaminathan, Alekh Agarwal, and Emma Brunskill. Off-policy policy gradient with state distribution correction. arXiv preprint arXiv:1904.08473, 2019. + +Ben London and Ted Sandler. Bayesian counterfactual risk minimization. In International Conference on Machine Learning, pp. 4125–4133, 2019. + +Alex Strehl, John Langford, Lihong Li, and Sham M Kakade. Learning from logged implicit exploration data. In Advances in Neural Information Processing Systems (NIPS), 2011. + +Yi Su, Lequn Wang, Michele Santacatterina, and Thorsten Joachims. Cab: Continuous adaptive blending for policy evaluation and learning. In International Conference on Machine Learning, pp. 6005–6014, 2019. + +A. Swaminathan and T. Joachims. Batch learning from logged bandit feedback through counterfactual risk minimization. Journal of Machine Learning Research (JMLR), 16:1731–1755, Sep 2015a. Special Issue in Memory of Alexey Chervonenkis. + +A. Swaminathan and T. Joachims. The self-normalized estimator for counterfactual learning. In Neural Information Processing Systems (NIPS), 2015b. + +Philip Thomas and Emma Brunskill. Data-efficient off-policy policy evaluation for reinforcement learning. In International Conference on Machine Learning (ICML), 2016. + +Yu-Xiang Wang, Alekh Agarwal, and Miroslav Dudik. Optimal and adaptive off-policy evaluation in contextual bandits. In International Conference on Machine Learning (ICML), 2017. + +Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992. + +# A APPENDIX: PROOFS + +In this appendix, we provide proofs of the main theorems and propositions. + +# A.1 PROOF OF PROPOSITION 1 + +Proposition 1. Given contexts $x \sim P ( \mathcal { X } )$ and logging policy $\pi _ { 0 } ( \mathcal { V } | x )$ , the bias of $\hat { R } _ { I P S }$ for target policy $\pi ( \mathcal { V } | x )$ is equal to the expected reward on the unsupported action sets, i.e., $b i a s ( \pi | \pi _ { 0 } ) =$ $\begin{array} { r } { \mathbb { E } _ { x } [ - \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \delta ( x , y ) ] } \end{array}$ . + +Proof. Recall $\delta ( x , y ) = \mathbb { E } _ { r } [ r ( x , y ) | x , y ]$ , and logged data $\mathcal { D } \sim \mathcal { P } _ { \mathcal { X } } \times \pi _ { 0 } ( \cdot | \mathcal { X } ) \times \mathcal { P } _ { r }$ . + +$$ +\begin{array} { l } { \displaystyle b i a s ( \pi | \pi _ { 0 } ) = \frac { \mathbb { E } [ \hat { R } _ { I P S } ( \pi ) ] - R ( \pi ) } { \mathcal { D } } } \\ { \displaystyle \quad = \frac { \mathbb { E } [ \sum _ { \scriptstyle x } } { y \in ( \mathcal { U } ( x , \pi _ { 0 } ) ) ^ { c } } \pi _ { 0 } ( y | x ) \frac { \pi ( y | x ) } { \pi _ { 0 } ( y | x ) } \delta ( x , y ) - \sum _ { y \in \mathcal { Y } } \pi ( y | x ) \delta ( x , y ) ] } \\ { \displaystyle \quad = \frac { \mathbb { E } [ - \sum _ { \scriptstyle x } } { x } - \pi ( y | x ) \delta ( x , y ) ] } \end{array} +$$ + +# A.2 PROOF OF THEOREM 1 + +Theorem 1. For any given hypothesis space $\Pi$ with logging policy $\pi _ { 0 } ~ \in ~ \Pi$ , there exists a reward distribution $\mathcal { P } _ { r }$ with support in $[ r _ { m i n } , r _ { m a x } ]$ such that in the limit of infinite training data, ERM using $I P S$ over the logged data $\mathcal D \sim \dot { P } ( \mathcal X ) \times \pi _ { 0 } ( \cdot | \mathcal X ) \times \mathcal P _ { r }$ can select a policy $\begin{array} { r } { \hat { \pi } \in \arg \operatorname* { m a x } _ { \pi \in \Pi } \mathbb { E } _ { \mathcal { D } } [ \hat { R } _ { I P S } ( \pi ) ] } \end{array}$ that is at least $\begin{array} { r l } { { ( r _ { m a x } - r _ { m i n } ) \operatorname* { m a x } _ { \pi \in \Pi } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) } \quad } & { { } } \end{array}$ suboptimal. + +Proof. For any given hypothesis space $\Pi$ and logging policy $\pi _ { 0 }$ , define a deterministic reward distribution $\mathcal { P } _ { r }$ as the following: for all context $x$ , $r ( x , y ) = \delta ( x , y ) = r _ { m i n }$ for $y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c }$ and $r ( x , y ) ~ = ~ \delta ( x , y ) ~ = ~ r _ { m a x }$ for $y \in \mathcal { U } ( x , \pi _ { 0 } )$ . Let $\tilde { \pi } \in \arg \operatorname* { m a x } _ { \pi \in \Pi } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } )$ and $\pi ^ { * } \in \arg \operatorname* { m a x } _ { \pi \in \Pi } R ( \pi )$ , then we have the following lower bound for $R ( \pi ^ { * } )$ : + +$$ +\begin{array} { r l } & { R ( \pi ^ { * } ) \geq R ( \tilde { \pi } ) } \\ & { \qquad = \underset { x } { \mathbb { E } } [ \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } r _ { m a x } + \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } r _ { m i n } ] } \\ & { \qquad = r _ { m a x } \operatorname* { m a x } _ { \pi \in \Pi } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) + r _ { m i n } \big ( 1 - \underset { \pi \in \Pi } { \operatorname* { m a x } } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) \big ) } \end{array} +$$ + +where the first inequality follows from the definition of $\pi ^ { * }$ , the first and second equality is based on the specific reward distribution $\mathcal { P } _ { r }$ and the definition of $\tilde { \pi }$ . + +In the following we will show that for any $\hat { \pi }$ learned by the expectation of ERM (or in the limit of infinite amount data), i.e., πˆ ∈ arg max $\mathbb { E } _ { \mathcal { D } } [ \hat { R } _ { I P S } ^ { \mathcal { D } } ( \pi ) ]$ , $\hat { \pi }$ have the same support as $\pi _ { 0 }$ . + +$$ +\mathbb { E } [ \hat { R } _ { I P S } ( \pi ) ] = \mathbb { E } [ \sum _ { x } \pi ( y | x ) r _ { m i n } ] = r _ { m i n } \mathbb { E } [ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi ( y | x ) ] \le r _ { m i n } +$$ + +for all $\pi \in \Pi$ , then it is easy to see $\pi _ { 0 } \in \Pi$ is one of the solution of ERM. Actually for any $\hat { \pi } \in$ arg max $\begin{array} { r } { \mathbb { E } _ { \mathcal { D } } [ \hat { R } _ { I P S } ^ { \mathcal { D } } ( \pi ) ] , \mathbb { E } _ { x } [ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi ( y | x ) ] = 1 } \end{array}$ and it gives us that any solution of the ERM has exactly the same support as $\pi _ { 0 }$ , then we have $R ( \hat { \pi } ) = r _ { m i n }$ for $\hat { \pi } \in \arg \operatorname* { m a x } \mathbb { E } _ { \mathcal { D } } [ \hat { R } _ { I P S } ^ { \mathcal { D } } ( \pi ) ]$ . + +Combining the lower bound for $R ( \pi ^ { * } )$ and $R ( \hat { \pi } ) = r _ { m i n }$ , we have + +$$ +\begin{array} { r l } & { R ( \pi ^ { * } ) - R ( \hat { \pi } ) \geq r _ { m a x } \displaystyle \operatorname* { m a x } _ { \pi \in \Pi } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) + r _ { m i n } ( 1 - \displaystyle \operatorname* { m a x } _ { \pi \in \Pi } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) ) - r _ { m i n } } \\ & { \quad \quad \quad \quad \quad = \left( r _ { m a x } - r _ { m i n } \right) \displaystyle \operatorname* { m a x } _ { \pi \in \Pi } \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) } \end{array} +$$ + +# A.3 PROOF OF THEOREM 2 + +Theorem 2. For contexts $x _ { i }$ drawn i.i.d from $P ( \mathcal X )$ , action $y _ { i }$ drawn from logging policy $\pi _ { 0 }$ , we define SD(π|π0) = 1n Pni=1 π(yi|xi)π0(yi|xi) . For any policy $\pi$ it holds that + +$$ +\begin{array} { r } { \underset { x \sim P ( \mathcal { X } ) } { \mathbb { E } } \underset { y \sim \pi _ { 0 } ( \cdot | x ) } { \mathbb { E } } [ S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) ] + \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) = 1 } \end{array} +$$ + +Proof. + +$$ +\begin{array} { r l } { \underset { x , y \sim \pi _ { 0 } } { \mathbb { E } } [ S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) ] + \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) = \underset { x } { \mathbb { E } } [ \ \underset { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } { \sum } \pi _ { 0 } ( y | x ) \frac { \pi ( y | x ) } { \pi _ { 0 } ( y | x ) } ] + \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) } & { } \\ { = \underset { x } { \mathbb { E } } [ \ \underset { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } { \sum } \pi ( y | x ) ] + \underset { x } { \mathbb { E } } [ \ \underset { y \in \mathcal { U } ( x , \pi _ { 0 } ) } { \sum } \pi ( y | x ) ] } & { } \\ { = \underset { x } { \mathbb { E } } [ \underset { y \in \mathcal { Y } } { \sum } \pi ( y | x ) ] = 1 } & { } \end{array} +$$ + +The first equality is based on definition of $S _ { D } ( \pi | \pi _ { 0 } )$ and the second equality is based on definition of support divergence. □ + +# A.4 PROOF OF PROPOSITION 3 + +Proposition 3. For any given $\kappa \in ( 0 , 1 )$ , $0 < \epsilon < \kappa / 2$ , let $p _ { m i n }$ denote the minimum propensity under supported set $p _ { m i n } ~ = ~ m a x _ { x , y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi _ { 0 } ( y | x )$ , then with probability larger than $1 - 2 \exp ( - 2 n \epsilon ^ { 2 } p _ { m i n } ^ { 2 } )$ , the constraint $1 - \kappa { + } \epsilon \le S _ { \mathscr { D } } ( \pi | \pi _ { 0 } ) \le 1 { - } \epsilon$ will ensure $0 \leq \mathcal { D } \boldsymbol { x } ( \pi | \pi _ { 0 } ) \leq \kappa$ . + +Proof. Recall SD(π|π0) = 1n Pni=1 π(yi|xi)π0(yi|xi) with $( x _ { i } , y _ { i } )$ draw i.i.d from $P ( \mathcal { X } ) \times \pi _ { 0 } ( \mathcal { Y } | \boldsymbol { x } )$ . From Appendix A.3, it is easy to see Ex,y∼π0(·|x)[ π(y|x)π0(y|x) ] $\begin{array} { r } { \mathbb { E } _ { x , y \sim \pi _ { 0 } ( \cdot | x ) } \big [ \frac { \pi ( y | x ) } { \pi _ { 0 } ( y | x ) } \big ] = 1 - \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) } \end{array}$ . Let $p _ { m i n }$ denote the smallest propensity under supported action set, $p _ { m i n } : = \mathrm { m i n } _ { x , y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi _ { 0 } ( y | x ) > 0$ , then the random variable $\frac { \pi ( y | x ) } { \pi _ { 0 } ( y | x ) }$ is strictly bounded between $[ 0 , \frac { 1 } { p _ { m i n } } ]$ . Applying Hoeffding’s bound gives: + +$$ +^ { \mathfrak { p } } ( { \mathcal { D } } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) < 1 - S _ { { \mathcal { D } } } ( \pi | \pi _ { 0 } ) - \epsilon ) = \mathbb { P } ( S _ { { \mathcal { D } } } ( \pi | \pi _ { 0 } ) - ( 1 - { \mathcal { D } } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) ) < - \epsilon ) \leq e x p ( - 2 n \epsilon ^ { 2 } p _ { m i n } ^ { 2 } ) +$$ + +Since $S _ { \mathcal { D } ( \pi | \pi _ { 0 } ) } \le 1 - \epsilon$ gives $1 - S _ { \mathcal { D } } ( \pi \vert \pi _ { 0 } ) - \epsilon \geq 0$ , then we have + +$$ +\mathbb { P } ( \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) < 0 ) \le e x p ( - 2 n \epsilon ^ { 2 } p _ { m i n } ^ { 2 } ) +$$ + +Similar for the other direction, Hoeffding’s bound gives: + +$$ +\mathbb { P } ( \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) > 1 - S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) + \epsilon ) = \mathbb { P } ( S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) - ( 1 - \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) ) > \epsilon ) \le e x p ( - 2 n \epsilon ^ { 2 } p _ { m i n } ^ { 2 } ) +$$ + +Since $S _ { \mathcal { D } ( \pi | \pi _ { 0 } ) } \geq 1 + \epsilon - \kappa$ gives $\begin{array} { r } { 1 - S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) + \epsilon \le \kappa } \end{array}$ , then we have + +$$ +\begin{array} { r } { \mathbb { P } ( \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) \ge \kappa ) \le e x p ( - 2 n \epsilon ^ { 2 } p _ { m i n } ^ { 2 } ) } \end{array} +$$ + +Combining the above, we have + +$$ +\begin{array} { r l } & { \mathbb { P } ( 0 \leq \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) \leq \kappa ) = 1 - \mathbb { P } ( \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) < 0 ) - \mathbb { P } ( \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } ) > \kappa ) } \\ & { \qquad \geq 1 - 2 e x p ( - 2 n \epsilon ^ { 2 } p _ { m i n } ^ { 2 } ) } \end{array} +$$ + +# A.5 PROOF FOR EFFICIENT APPROXIMATION + +Claim 1. The empirical risk defined by in Equation (8) has the same expectation (over randomness in $\mathcal { D }$ and sampling) as $\hat { R } _ { I P S } ^ { \delta } ( \mathcal { D } )$ . + +Proof. Taking the expectation of empirical risk defined in Equation (8): + +$$ +\begin{array} { l l } { { \displaystyle { \mathbb E } \big [ \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \pi \big ( y _ { i } | x _ { i } \big ) } { \pi _ { 0 } \big ( y _ { i } | x _ { i } \big ) } r _ { i } + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \frac { \pi \big ( y _ { j } | x _ { j } \big ) } { p _ { j } } \hat { \delta } ( x _ { j } , y _ { j } ) \big ] } } \\ { { \displaystyle { = \mathbb E } \big [ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi _ { 0 } ( y | x ) \frac { \pi \big ( y | x \big ) } { \pi _ { 0 } ( y | x ) } \delta ( x , y ) \big ] + \frac { { \mathbb E } } { x } \big [ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \frac { 1 } { | \mathcal { U } ( x , \pi _ { 0 } ) | } \frac { \pi \big ( y | x \big ) } { \textstyle | \mathcal { U } ( x , \pi _ { 0 } ) | } \hat { \delta } ( x , y ) \big ] } } \\ { { \displaystyle { = \mathbb E } \big [ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi ( y | x ) \delta ( x , y ) \big ] + \frac { { \mathbb E } } { x } \big [ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \hat { \delta } ( x , y ) \big ] } } \end{array} +$$ + +Now we will show it has the same expectation with $\hat { R } _ { I P S } ^ { \delta } ( \pi )$ + +$$ +\begin{array} { r l } & { \frac { \mathbb { E } } { D } \big [ \frac { \pi \big ( y _ { 1 } | x _ { i } \big ) } { \pi _ { 0 } ( y _ { i } | x _ { i } ) } r _ { i } + \displaystyle \sum _ { y \in \mathcal { U } ( x _ { \star } , \pi _ { 0 } ) } \pi ( y | x _ { i } ) \hat { \delta } ( x _ { i } , y ) \big ] } \\ & { = \frac { \mathbb { E } } { x } \big [ \underbrace { \mathbb { E } } _ { y \in \pi _ { 0 } } [ \frac { \pi } { \pi _ { 0 } ( y | x ) } \delta ( x , y ) ] + \displaystyle \sum _ { y ^ { \prime } \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y ^ { \prime } | x ) \hat { \delta } ( x , y ^ { \prime } ) \big ] } \\ & { = \frac { \mathbb { E } } { x } \big [ \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi _ { 0 } ( y | x ) \frac { \pi ( y | x ) } { \pi _ { 0 } ( y | x ) } \delta ( x , y ) + \displaystyle \sum _ { y ^ { \prime } \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y ^ { \prime } | x ) \hat { \delta } ( x , y ^ { \prime } ) \big ] } \\ & { = \frac { \mathbb { E } } { x } \big [ \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi ( y | x ) \delta ( x , y ) \big ] + \frac { \mathbb { E } } { x } \big [ \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \hat { \delta } ( x , y ) \big ] } \end{array} +$$ + +The proof is done by comparing Equation (23) and Equation (24). + +# A.6 PROOF OF PROPOSITION 2 + +Proposition 2. Given contexts $x _ { 1 } , x _ { 2 } , \ldots , x _ { n }$ drawn i.i.d from the unknown distribution $P ( \mathcal X )$ , for action $y _ { i }$ drawn independently from logging policy $\pi _ { 0 }$ with probability $\pi _ { 0 } ( \mathcal { V } | x _ { i } )$ , the bias of the empirical risk defined in Equation (7) is $\begin{array} { r } { \mathbb E _ { x } [ \sum _ { y \in \mathcal U _ { x } ^ { \pi _ { 0 } } } \pi ( y | x ) \Delta ( x , y ) ] } \end{array}$ . + +Proof. From Appendix A.5, we are given the expectation of $\hat { R } _ { I P S } ^ { \delta } ( \pi )$ , and the bias is: + +$$ +\begin{array} { l } { { b i a s ( \hat { R } _ { I P S } ^ { \delta } ( \pi ) ) = { \displaystyle \mathbb { E } } [ \hat { R } _ { I P S } ^ { \delta } ( \pi ) ] - R ( \pi ) } } \\ { ~ = { \displaystyle \frac { { \mathbb { E } } } { x } } \big [ \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi ( y | x ) \delta ( x , y ) + \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \hat { \delta } ( x , y ) \big ] - R ( \pi ) } \\ { ~ = { \displaystyle \mathbb { E } } \big [ \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) ( \hat { \delta } ( x , y ) - \delta ( x , y ) ) \big ] } \\ { ~ = { \displaystyle \mathbb { E } } \big [ \displaystyle \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \Delta ( x , y ) \big ] } \end{array} +$$ + +The second equality is from Appendix A.5, the second equality is based on $\begin{array} { r l } { R ( \pi ) } & { { } = } \end{array}$ $\begin{array} { r } { \mathbb { E } _ { x } \left[ \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) ^ { c } } \pi ( y | x ) \delta ( x , y ) + \sum _ { y \in \mathcal { U } ( x , \pi _ { 0 } ) } \pi ( y | x ) \delta ( x , y ) \right] } \end{array}$ , and the last one is based on the definition of $\Delta ( x , y ) : = \hat { \delta } ( x , y ) - \delta ( x , y )$ for all $x \in \mathcal { X } , y \in \mathcal { Y }$ . □ + +# B APPENDIX: EXPERIMENTS + +In this section, we provide the experiment details and additional results to help promote reproducibility of this work. + +# B.1 EXPERIMENT SETUP DETAILS + +Datasets and baseline. We follow a 75:10:15 train-validation-test split for credit card fraud detection dataset, while for CIFAR10 already coming with a train-test split, we keep $10 \%$ of the training set as validation set. Baseline estimators are IPS and DM, the hyperparameters (learning rate, L2 regularization) are optimized for all the methods based on the validation set. + +Bandit data generation. For CIFAR10, given supervised data $\{ x _ { i } , y _ { i } ^ { * } \} _ { i = 1 } ^ { n }$ where $x _ { i }$ denotes the 3072 features and $y _ { i } ^ { * }$ denotes the correct label of data (ranging from 0 to 9), under logging policy $\pi _ { 0 }$ , the logged bandit data is generated by drawing $y _ { i } \sim \pi _ { 0 } ( \mathcal { V } | x _ { i } )$ , then a deterministic reward is defined as $\mathbb { I } _ { \{ y _ { i } = y _ { i } ^ { * } \} }$ . For the credit card fraud detection dataset, we throw away the class label and only use the features for each sample to generate bandit data. To be specific, for each sample with a 28-dimensional feature vector, we define the first 20 features as the contextual information, and use the remaining 8 features as the underlying true reward for 8 different actions (with normalization). + +Logging policy. For CIFAR, we learn the softmax logging policy on 35K full-information data points as a multi-class classification problem with cross-entropy loss. Similar as the experiments on BanditNet (Joachims et al., 2018), we adopt the conventional ResNet20 architecture but restrict training after a mere two epochs to derive a relative stochastic policy, since it will be easier to add temperature later to control its stochasticity and support deficiency. Similarly, for the credit card fraud detection dataset, the softmax logging policy is learned on 8K full-information data points by treating it as a multi-class classification problem using cross-entropy loss and the label being the action with the highest reward on this specific context. For CIFAR, the logging policy we trained has a $5 7 . 4 3 \%$ accuracy on the test-set; whereas for the credit card fraud detection dataset, the logging policy has an expected true reward of 0.71. + +Reward estimator. For each experiment, we train a different regression function using the full bandit dataset. We use the same architecture as the one used for off-policy learning - where the final layer is the size of the actions, specifying the reward for each action given a particular context. The regression function is trained using the MSE objective. + +![](images/51d656734af5ca7eebec76bcca0d315e378aa7a4b913d38454b7164ec98ffb1b.jpg) +Figure 4: Behaviour of $S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) + \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } )$ + +# B.2 SUPPLEMENTARY RESULTS + +Reliability of approximating support divergence using control variate. In this experiment, we empirically verify the reliability of estimating support divergence using control variate. The target policy is the uniform policy while the logging policies are varying in their support deficiency. Results are averaged over 10 runs and is shown in Figure 4. We investigate the behaviour of $S _ { \mathcal { D } } ( \pi | \pi _ { 0 } ) + \mathcal { D } _ { \mathcal { X } } ( \pi | \pi _ { 0 } )$ under different number of training data and different support deficiency of the corresponding logging policy. As we can see, the sum converges to 1 as the training data increases. Meanwhile, the variance decreases as shown in the right figure. For different support deficiency curves, the curve converges in a similar fashion and we conjecture it is due to the effect of clipping the propensity at the same threshold $\epsilon = 0 . 0 1$ , which makes $p _ { m i n } = 0 . 0 1$ in the bound shown in Proposition 3. + +![](images/2678c7d2bb519d2032262fa6ef15c3ce8481c96bf236def1f54a54d5ca71d2c6.jpg) +Figure 5: Model selection result for credit card fraud detection + +![](images/217e996b67f6df7a1b4bf8f2cf57d77113d0632e263176148aa1a303192a33e2.jpg) + +Model selection comparison for the credit card dataset. The model selection comparison over the credit card fraud detection dataset is demonstrated in Figure 5. Similar as the trend in Figure 3, SNIPS and Conservative Extrapolation exhibit a large bias, also SNIPS even can not reflect the shape of the Oracle curve. DM and Regression Extrapolation closely track the Oracle line, and they have the best performance when used in model selection, as seen in the left table of Figure 5. \ No newline at end of file diff --git a/md/train/Skltqh4KvB/Skltqh4KvB.md b/md/train/Skltqh4KvB/Skltqh4KvB.md new file mode 100644 index 0000000000000000000000000000000000000000..aa0d23e9e7f36d596f2709912d7a352647946d7f --- /dev/null +++ b/md/train/Skltqh4KvB/Skltqh4KvB.md @@ -0,0 +1,216 @@ +# ARE THERE ANY ‘OBJECT DETECTORS’ IN THE HIDDEN LAYERS OF CNNS TRAINED TO IDENTIFY OBJECTS OR SCENES? + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Various methods of measuring unit selectivity have been developed with the aim of better understanding how neural networks work. But the different measures provide divergent estimates of selectivity, and this has led to different conclusions regarding the conditions in which selective object representations are learned and the functional relevance of these representations. In an attempt to better characterize object selectivity, we undertake a comparison of various selectivity measures on a large set of units in AlexNet, including localist selectivity (Bowers et al., 2014), precision (Zhou et al., 2015), class-conditional mean activity selectivity (CCMAS) (Morcos et al., 2018), network dissection (Zhou et al., 2018a), the human interpretation of activation maximization (AM) images, and standard signaldetection measures. We find that the different measures provide different estimates of object selectivity, with precision and CCMAS measures providing misleadingly high estimates. Indeed, the most selective units had a poor hit-rate or a high falsealarm rate (or both) in object classification, making them poor object detectors. We fail to find any units that are even remotely as selective as the ‘grandmother cell’ units reported in recurrent neural networks. In order to generalize these results, we compared selectivity measures on a few units in VGG-16 and GoogLeNet trained on the ImageNet or Places-365 datasets that have been described as ‘object detectors’. Again, we find poor hit-rates and high false-alarm rates for object classification. + +# 1 INTRODUCTION + +There have been recent attempts to understand how neural networks (NNs) work by analyzing hidden units one-at-a-time using various measures such as localist selectivity (Bowers et al., 2014), class-conditional mean activity selectivity (CCMAS) (Morcos et al., 2018), precision (Zhou et al., 2015), network dissection (Zhou et al., 2018a), and activation maximization (AM) (Erhan et al., 2009). These measures are all taken to provide evidence that some units respond highly selectively to categories of objects under some conditions. Not only are these findings surprising given the widespread assumption that NNs only learn highly distributed and entangled representations, they raise a host of questions, including the functional importance of these selective representations (Zhou et al., 2018b), the conditions in which they are learned (e.g., Morcos et al., 2018), and the relation between these representations and the selective neurons observed in cortex (Bowers, 2009). + +To answer these question, it is necessary to have a better understanding of what these metrics actually measure, and how they relate to one another. Accordingly, we directly compare these measures of selectivity on the same set of units as well as adopt standard signal-detection measures in an attempt to provide better measures of single-unit selectivity to object category. In addition, to provide a more intuitive assessment of selectivity, we report jitterplots for a few of the most selective units that visually display how the unit responds to the different image categories. We focus on AlexNet (Krizhevsky et al., 2012) trained on ImageNet (Deng et al., 2009) because many authors have studied the selectivity of single hidden units in this model using a range of quantitative (Zhou et al., 2018a; 2015) and qualitative (Nguyen et al., 2017; Yosinski et al., 2015; Simonyan et al., 2013) methods. But we also compare different selectivity measures on specific units in VGG-16 (Simonyan and Zisserman, 2014) and GoogLeNet (Szegedy et al., 2015) trained on the the ImageNet and Places-365 datasets that were characterized by Zhou et al. (2018a) as “object detectors” based on their Network Dissection method (Zhou et al., 2018a). Our main findings are: + +1. The precision and CCMAS measures are misleading with near-maximum selectivity scores associated with units that strongly respond to many different image categories. By contrast, the signal-detection measures more closely capture the level of selectivity displayed in the jitterplots (Sec. 3.1). +2. Units with interpretable AM images do not correspond to highly selective representations (Sec. 3.2). +3. The Network Dissection method also provides a misleading measure for “object detectors” (Sec. 3.3). + +In one line of research, Bowers et al. (2014; 2016) assessed the selectivity of single hidden units in recurrent neural networks (RNNs) designed to model human short-term memory. They reported many ‘localist’ or ‘grandmother cell’ units that were $100 \%$ selective for specific letters or words, where all members of the selective category were more active than and disjoint from all non-members, as can be shown in jitterplots (Berkeley et al., 1995) (see Fig. 1 for a unit selective to the letter ‘j’). The authors argued that the network learned these representations in order to co-activate multiple letters or words at the same time in short-term memory without producing ambiguous blends of overlapping distributed patterns (the so-called ‘superposition catastrophe’). Consistent with this hypothesis, localist units did not emerge when the model was trained on letters or words one-at-a-time (Bowers et al., 2014) (see Fig. 1 for an example of a non-selective unit). + +In parallel, researchers have reported selective units in the hidden layers of various CNNs trained to classify images into one of multiple categories (Zhou et al., 2015; Morcos et al., 2018; Zeiler and Fergus, 2014; Erhan et al., 2009), for a review see Bowers (2017). For example, Zhou et al. (2015) assessed the selectivity of units in the pool5 layer of two CNNs trained to classify images into 1000 objects and 205 scene categories, respectively. They reported many highly selective units that they characterized as ‘object detectors’ in both networks. Similarly, Morcos et al. (2018) reported that CNNs trained on CIFAR-10 and ImageNet learned many highly selective hidden units, with CCMAS scores approaching the maximum of 1.0. These later findings appear to be inconsistent with Bowers et al. (2016) who failed to observe selective representations in fully connected NNs trained on stimuli one-at-a-time (see Fig. 1), but the measures of selectivity that have been applied across studies are different, and accordingly, it is difficult to directly compare results. + +A better understanding of the relation between selectivity measures is vital given that different measures are frequently used to address similar issues. For example, both the human interpretability of generated images (Le, 2013) and localist selectivity (Bowers et al., 2014) have been used to make claims about ‘grandmother cells’, but it is not clear whether they provide similar insights into unit selectivity. Similarly, based on their precision metric, Zhou et al. (2015) claim that the object detectors learned in CNNs play an important role in identifying specific objects, whereas Morcos et al. (2018) challenge this conclusion based on their finding that units with high CCMAS measures were not especially important in the performance of their CNNs and concluded: “...it implies that methods for understanding neural networks based on analyzing highly selective single units, or finding optimal inputs for single units, such as activation maximization (Erhan et al., 2009) may be misleading". This makes a direct comparison between selectivity measures all the more important. + +In order to directly compare and have a better understanding of the different selectivity measures we assessed (1) localist, (2) precision, and (3) CCMAS selectivity of the conv5, fc6, and fc7 of AlexNet trained on ImageNet, and in addition, we employed a range of signal detection methods on these units, namely, (4) recall with $100 \%$ and $9 5 \%$ precision, (5) maximum informedness, (6) specificity at maximum informedness , and (7) recall (also called sensitivity) at maximum informedness, and false alarm rates at maximum informedness (described in Sec. 2). We also assessed the selectivity of a few units in VGG-16 and GoogLeNet models trained on the ImageNet and Places-365 dataset that were highly selective according to the Network Dissection method (Zhou et al., 2018a). We show that the precision and CCMAS measures often provide misleadingly high estimates of object selectivity compared to other measures, and we do not find any units that can be reasonably described as ‘object detectors’ given that the most selective units show a low hit-rate or a high false-alarm rate (or both) when classifying images. At best, the most selective units in CNNs are sensitive to some unknown feature that is weakly associated with the class in question. + +![](images/79eb40ad904e0968407b2502f5d29a63932ec8a65908516624ad8dd72655124e.jpg) +Figure 1: Examples of selectivity measures used. Top left: jitterplot of unit 113 in an RNN (under the superposition constraint) selective to the letter ‘j’ (Bowers et al., 2016). Top middle: jitterplot of a non-selective unit 160 found in an RNN trained on words one-at-a-time from (Bowers et al., 2016). Top right: Activation maximization image of unit conv59 AlexNet that resembles a lighthouse (Nguyen et al., 2016). Bottom: highest-activation images for a ‘lamp’ detector with $84 \%$ precision in the layer conv5 of AlexNet; from (Zhou et al., 2015). + +In addition to these quantitative measures and jitterplots we assessed selectivity with a common qualitative measure, namely, human interpretation of images generated by a state-of-the-art activation maximization (AM) method (Nguyen et al., 2017). AM images are generated to strongly activate individual units, and some of them are interpretable by humans (e.g., a generated image that looks like a lighthouse, see Fig. 1). For the first time, we systematically evaluated the interpretability of the AM images and compare these ratings with the selectivity measures for corresponding units. We show that the few hidden units with interpretable AM images are not highly selective. + +# 2 METHODS + +Network and Dataset All ${ \sim } 1 . 3 \mathbf { M }$ photos from the ImageNet ILSVRC 2012 dataset (Deng et al., 2009) were cropped to $2 7 7 \times 2 7 7$ pixels and classified by the pre-trained AlexNet CNN (Krizhevsky et al., 2012) shipped with Caffe (Jia et al., 2014), resulting in 721,536 correctly classified images. Once classified, the images are not re-cropped nor subject to any changes. We analyzed the fully connected (fc) layers: fc6 and fc7 (4096 units), and the top convolutional layer conv5 which has 256 filters. We only recorded the activations of correctly classified images. The activation files are stored in .h5 format and will be available at http://anonymizedForReview. We randomly selected 233 conv5, 2738 fc6, 2239 fc7 units for analysis. + +Localist selectivity Following Bowers et al. (2014), we define a unit to be localist for class $A$ if the set of activations for class $A$ was higher and disjoint with those of $\neg A$ . Localist selectivity is easily depicted with jitterplots (Berkeley et al., 1995) in which a scatter plot for each unit is generated (see Figs. 1 and 3). Each point in a plot corresponds to a unit’s activation in response to a single image, and only correctly classified images are plotted. The level of activation is coded along the $x$ -axis, and an arbitrary value is assigned to each point on the $y$ -axis. + +Precision Precision refers to the proportion of items above some threshold from a given class. The precision method of finding object detectors involves identifying a small subset of images that most strongly activate a unit and then identifying the critical part of these images that are responsible for driving the unit. Zhou et al. (2015) took the 60 images that activated a unit the most strongly and asked independent raters to interpret the critical image patches (e.g., if 50 of the 60 images were labeled as ‘lamp’, the unit would have a precision index of 50/60 or $83 \%$ ; see Fig. 1). Object detectors were defined as units with a precision score $> 7 5 \%$ : they reported multiple such detectors. Here, we approximate this approach by considering the 60 images that most strongly activate a given unit and assess the highest percentage of images from a given output class. + +CCMAS Morcos et al. (2018) introduced a selectivity index called the Class-conditional Mean Activation Selectivity (CCMAS). The CCMAS for class $A$ compares the mean activation of all images in class $A$ , $\mu _ { A }$ , with the mean activation of all images not in class $A$ , $\mu { \neg } A$ , and is given by: $\left( \mu _ { A } ^ { \setminus } - \mu _ { \neg A } \right) / \left( \mu _ { A } + \mu _ { \neg A } \right)$ . Here, we assessed class selectivity for the highest mean activation class. + +Activation Maximization We harnessed an activation maximization method called Plug & Play Generative Networks (Nguyen et al., 2017) in which an image generator network was used to generate images (AM images) that highly activate a unit in a target network. We used the public code released by Nguyen et al. (2017) and their default hyperparameters.1 We generated 100 separate images that maximally activated each unit in the conv5, fc6, and fc8 layers of AlexNet and asked participants to judge whether they could identify any repeating objects, animals, or places in images in a behavioral experiment (Sec. 3.2). Readers can test themselves at: https://research.sc/ participant/login/dynamic/63907FB2-3CB9-45A9-B4AC-EFFD4C4A95D5 + +Recall with perfect and $95 \%$ precision Recall with perfect and $9 5 \%$ precision are related to localist selectivity except that they provide a continuous rather than discrete measure. For recall with perfect precision we identified the image that activated a given unit the most and counted the number of images from the same class that were more active than all images from all other classes. We then divided this result by the total number of correctly identified images from this class. A recall with a perfect precision score of 1 is equivalent to a localist representation. Recall with a $9 5 \%$ precision allows $5 \%$ false alarms. + +Maximum informedness Maximum informedness identifies the class and threshold where the highest proportion of images above the threshold and the lowest proportion of images below the threshold are from that class (Powers, 2011). The informedness is computed for each class at each threshold, with the highest value selected. Informedness summarises the diagnostic performance of unit for a given class at a certain threshold based on the recall [True Positives / (True Positives $^ +$ False Negatives)] and specificity [True Negatives / (True Negatives $^ +$ False Positives)] in the formula [informedness $=$ recall $^ +$ specificity − 1] (Powers, 2011). + +Sensitivity or Recall at Maximum Informedness For the threshold and class selected by Maximum Informedness, recall (or hit-rate) is the proportion of items from the given class that are above the threshold. Also known as true postive rate. + +Specificity at Maximum Informedness For the threshold and class selected by Maximum Informedness, the proportion of items that are not from the given class that are below the threshold. Also known as true negative rate. + +False Alarm Rate at Maximum Informedness For the threshold and class selected by Maximum Informedness, the proportion of items that are not from the given class that are above the threshold. + +Network Dissection To assess the selectivity of a unit in the Network Dissection technique, Zhou et al. (2018a) compute the Intersection over Union (IoU) of an annotated input image $L _ { c }$ , for the set of all ‘concepts’ $c$ and a spatial activation map, $M _ { k }$ , of where a unit $k$ is. A unit $k$ is taken as a detector for concept $c$ if its $\mathrm { I o U } _ { k , c }$ exceeds a pre-defined threshold $T$ . See Zhou et al. (2018a) for more details. + +# 3 RESULTS + +# 3.1 COMPARISON OF SELECTIVITY MEASURES IN ALEXNET + +The results from the various of selectivity measures applied to the conv5, fc6, and fc7 layers of AlexNet are displayed in Fig. 2a–i. We did not plot the localist selectivity as there were no localist ‘grandmother units’. The first point to note is that multiple units in the fc6 and fc7 layers had near $100 \%$ precision scores and multiple units had CCMAS scores approaching 1. For example, in layer fc7, we found 14 units with a precision $> 0 . 9$ , and 1487 units with a $\mathrm { C C M A S } > 0 . 9$ . The second point is that other measures provided much reduced estimates of selectivity. For example, the unit with the highest recall with a perfect precision score was only .08 (unit 255 responding to images of Monarch butterflies), and the unit with the top maximum informedness score (unit 3290 also responding to images of Monarch butterflies with a score of 0.91) had a false alarm rate above its optimal threshold $> 9 9 \%$ (indeed the minimum false alarm rate was 0.96). + +To illustrate the contrasting measures of selectivity consider unit $\mathsf { f c 6 } _ { 1 1 9 9 }$ depicted in Fig. 3 that has a precision score of $98 \%$ and a CCMAS score of .92. By Zhou et al.’s criterion, this is a ‘Monarch Butterfly’ detector (its precision score $> 7 5 \%$ ). By contrast, the scatter plot and signal-detection scores show this is a mischaracterisation of this unit given that the false alarm rate at maximum informedness was greater than $9 9 \%$ and the modal response to Monarch butterflies was zero. + +![](images/f080f4e7d6eb4f52ab14011f1fc60eded3687247e4ebcd11ddb551530f0343ba.jpg) +Figure 2: Different selectivity measures across the conv5, fc6, and fc7 layers of AlexNet. Red-line: median of data, top and bottom of box edges is the $2 5 ^ { \mathrm { t h } }$ and $7 5 ^ { \mathrm { t h } }$ percentile, whiskers extend to extreme edges of distribution not considered outliers and red crosses are outliers. Green points and dashed lines are the means of the distributions with standard errors. The high levels of selectivity observed with the precision and CCMAS measures are in stark contrast with the low levels of selectivity observed with the recall with perfect precision and high false-alarm rates at maximum informedness. + +What level of selectivity is required before a unit can be considered an ‘object detector’ for a given category? In the end, this is a terminological point. On an extreme view, one might limit the term to the ‘grandmother units’ that categorize objects with perfect recall and specificity, or alternatively, it might seem reasonable to describe a unit as a detector for a specific object category if there is some threshold of activation that supports more hits than misses (the unit is strongly activated by the majority of images from a given category), and at the same time, supports more hits than false alarms (the unit is strongly activated by items from the given category more often than by items from other categories). Or perhaps a lower standard could be defended, but in our view, the term "object detector" suggests a higher level of selectivity than $8 \%$ recall at perfect precision. That said, our results show that some units respond strongly to some (unknown) features that are weakly correlated with an object category. For instance, unit $\mathsf { f c } 6 _ { 1 1 9 9 }$ is responding to features that occur more frequently in Monarch Butterflies than other categories. This can also be seen in a recent ablation study in which removing the most selective units tended to impair the CNN’s performance in identifying the corresponding object categories more than other categories (Zhou et al., 2018b). But again, the pattern of performance is not consistent with the units being labeled ‘object detectors’. + +![](images/304a6ae45b0d36961bc7a3ece31444019196ee73cb8388a7c33d438ebf85af5d.jpg) +Figure 3: Data for unit $\mathsf { f c } 6 _ { 1 1 9 9 }$ . Left: activation jitterplot, black diamonds: Monarch butterfly images; grey circles: all other classes; white dashed line: threshold for the butterfly class maximum informedness; blue solid line: threshold for top 60 activations. Middle: histogram of activations of Monarch butterflies; red dashed line: threshold for the butterfly class maximum informedness; black solid line: threshold for top 60 activations. Inset: zoomed-in histogram of all activations across all ImageNet classes of unit $\mathsf { f c 6 } _ { 1 1 9 9 }$ (N.B. this plot shows only the highest 121,586 activations; there are 596,734 activations at 0). There are Monarch butterfly images covering the whole range of values, with 72 images $5 . 8 \%$ of the total) having an activation of 0. Right: example ImageNet images with activations of 0 (top), the mean, $3 9 . 2 { \pm } 0 . 6 $ , (middle), and the maximum, 95, (bottom) of the range. Although the high precision score suggests that this unit is a butterfly detector this is misleading given there are butterfly images over the entire activation range (including 0). + +# 3.2 HUMAN INTERPRETATION OF ACTIVATION MAXIMIZATION IMAGES FOR ALEXNET UNITS + +Activation Maximization is one of the most commonly used interpretability methods for explaining what a single unit has learned in many artificial CNNs and even biological neural networks (see Nguyen et al. (2019) for a survey). Our behavioral experiment provides the first quantitative assessment of AM images and compares AM interpretability to other selectivity measures. + +Table 1: Human judgements of whether AM images look like familiar objects in layers conv5, fc6, and fc8 in AlexNet. + +
layer%‘yes’ responses% units ≥ 80% ‘yes’ response% overlap between humans and:
humansmost activeCCMAS
conv5(a) 21.7% (±1.1%)(b) 4.3% (± 1.3%)(c) 89.5% (±5.7%)object (d) 34.1% (±14.4%)class (e) 0%
fc621.0% (±0.4%)3.1% (± 0.4%)80.4% (±4.1%)23.3% (±5.9%)18.9% (±5.9%)
fc871.2% (±0.6%)59.3% (±1.6%)96.5% (±0.4%)95.4% (±0.6%)94.6% (±0.7%)
+ +We generated 100 AM images images for every unit in the layers conv5, fc6, and fc8 in AlexNet, as in Nguyen et al. (2017), and displayed them as $1 0 \times 1 0$ -image panels. A total of 3,299 image panels were used in the experiment (995 fc8, 256 conv5, and 2048 randomly selected fc6 image panels) and were divided into 64 counterbalanced lists for testing. To assess the interpretability for these units as object detectors, 333 paid volunteers were asked to look at image panels and asked if the images had an object / animal or place in common. If the answer was ‘yes’, they were asked to write down a generic name for that object (e.g. “fish” rather than “goldfish”). Analyses of common responses was done for any units where over $80 \%$ of humans agreed there was an object present. + +The results are summarized in Table 1. Not surprisingly, the AM images for output fc8 units are the most human-recognizable as objects across the AlexNet layers $( 7 1 . 2 \%$ ; Table 1a). In addition, when they were given a consistent interpretation, they almost always $( 9 5 . 4 \%$ ; Table 1d) match the corresponding ImageNet category. By contrast, less than $5 \%$ of units in conv5 or fc6 were associated with consistently interpretable images (Table 1b), and the interpretations only weakly matched the category associated with the highest-activation images or CCMAS selectivity (Table 1d–e). Apart from showing that there are few interpretable units in the hidden layers of AlexNet, our findings show that the interpretability of images does not imply a high level of selectivity given the signal-detection results (Fig. 2d–h). See Fig. 4 for an example of the types of images that participants rated as objects or non-objects. + +![](images/65641a224bfb7b02c868516d88e7aa46f99affaf3cbcdcc65915c0b9ce1c5028.jpg) +Figure 4: Example AM images that were either judged by all participants to contain objects (a–c) or to be uninterpretable as objects (d–f). The human label for unit $\mathsf { c o n v } 5 _ { 1 8 3 }$ (a) was ‘dogs’; the most active image was of a ‘flat-coated retriever’; CCMAS class was ‘monitor’. For $\mathsf { f c } 6 _ { 3 1 9 }$ (b), subjects reported ‘green peppers’ or ‘apples’ (all classified as the same broad class in our analysis); both the most active item and CCMAS class were ‘Granny Smith apples’. For $\mathsf { f c } 8 _ { 9 6 9 }$ (c), humans suggested ‘beverage’ or ‘drink’; both the most active item and CCMAS class were ‘eggnog’. + +# 3.3 COMPARING SELECTIVITY MEASURES IN OTHER CNNS + +![](images/79c3d69b92c6d6545b4a213df8d41637fad9929156d47df2115d5006595fe5f0.jpg) + +![](images/3d9bcbe0d7ce0618a23a8ab24517ac41f8869d7e9784c127c7321419e788621a.jpg) + +a. GoogLeNet on ImageNet inception4e494 precision: 0.0 CCMAS:0.52 + +![](images/8bae5fc8b73350af8466d9f1e3ed096fbd11ddafd16049b57ef8c5a154b9cc4f.jpg) +Figure 5: The units with with the highest Network Dissection scores for the category ‘bus’. The scatter plots, precision, and CCMAS scores all indicate a low selectivity for this category. blue squares: ‘school bus’; red pentagons: ‘trolleybus’; green stars: ‘minibus’; grey circles: other classes. + +b. GoogLeNet on Places-365 inception4e824 precision: 0.27 CCMAS: 0.55 + +c. VGG-16 on Places-365 +conv5_320 +precision: 0.53 +CCMAS: 0.82 + +$$ +\mu _ { A } = 7 2 . 5 0 \mu _ { - , A } = 2 2 . 8 1 \mu _ { A } = 4 0 . 9 9 \mu _ { - , A } = 1 1 . 7 8 \mu _ { A } = 1 5 7 . 6 \mu _ { - , A } = 1 5 . 2 8 +$$ + +Thus far we have assessed the selectivity of hidden units in AlexNet and shown that no units can reasonably be characterized as object detectors despite the high precision and CCMAS scores of some units. This raises the question as to whether more recent CNNs learn object detector units. In order to address this we display jitterplots for three units that have the highest IoU scores according to the Network Dissection for the category BUS in (a) GoogLeNet trained on ImageNet, (b) GoogLeNet trained on Places-365, and (c) VGG-16 trained on Places-365, respectively (Zhou et al., 2018a). Models trained on the Places-365 dataset learn to categorize images into scenes (e.g., bedrooms, kitchens, etc.) rather than into object categories, and nevertheless, Zhou et al. (2018a) reported more object detectors in the former models. We illustrate the selectivity of the BUS category because it is an output category in ImageNet so we can easily plot the jitterplots for these units. + +As was the case with AlexNet, the jitterplots show that the most selective units show some degree of selectivity, with the BUS images more active on average compared to non-Buses, and the percentage of nonzero activations for BUS higher than the non-BUS categories (see tables A3 - A5 in the appendix for summary of more units). But the units are no more selective than the units we observed in AlexNet. Indeed, the precision measure of selectivity for the first units is 0.0, with none of the units having a precision of .75 that was the criterion of object detectors by Zhou et al. (2015), and CCMAS scores for first two units were roughly similar to the mean CCMAS score for AlexNet units in conv 5 (and much lower than the mean in fc6 and fc7). The most selective VGG-16 unit trained on Places-365 has lower precision and CCMAS scores than the Monarch Butterfly unit depicted in Figure 3. So again, different measures of selectivity provide support different conclusions, and even the most selective units are far from the selective units observed in recurrent networks as reported in Figure 1a. See tables A3 - A5 in the appendix for more details about these three units. + +# 4 DISCUSSIONS AND CONCLUSIONS + +Our central finding is that different measures of single-unit selectivity for objects support very different conclusions when applied to the same units in AlexNet. In contrast with the precision (Zhou et al., 2015) and CCMAS (Morcos et al., 2018) measures that suggest some highly selective units for objects in layers conv5, fc6, and fc7, the recall with perfect precision and false alarm rates at maximum informedness show low levels of selectivity. Indeed, the most selective units have a poor hit-rate or a high false-alarm rate (or both) for identifying an object class. The same outcome was observed with units in VGG-16 and GoogLeNet trained on either ImageNet or the Places-365 dataset. + +Not only do the different measures provide very different assessments of selectivity, the precision, CCMAS, and Network Dissection measures provide highly misleading estimates of selectivity that have led to mistaken conclusions. For example, unit $\mathsf { f c } 6 _ { 1 1 9 9 }$ in AlexNet trained on ImageNet is considered an Monarch Butterfly detector according to Zhou et al. (2015) with a precision score of $98 \%$ (and a CCMAS score of .93). But the jitterplot in Fig. 3 and signal detection scores (e.g., high false alarm rate at maximum informedness) show this is a mischaracterisation of this unit. In the same way, the Network Dissection method identified many object detectors in VGG-16 and GoogLeNet CNNs, but the jitterplots in Fig. 5 (and precision scores) show that this conclusion is unjustified. For additional problems with the CCMAS score see Figure 5 in Appendix C. Similarly, the images generated by Activation Maximization also provided a misleading estimate of selectivity given that interpretable images were associated with very low selectivity scores. This has led to confusions that have delayed theoretical progress. For example, describing single units in CNNs as “object detectors” in response to high precision measures (Zhou et al.) suggests similar types of representations are learned in CNNs and RNNs. Indeed, we are not aware of anyone in the machine learning community who has even considered the hypothesis that selectivity is reduced in CNNs compared RNNs. Our findings highlight the contrasting results. + +What should be made of the finding that localist representations are sometimes learned in RNNs (units with perfect specificity and recall), but not in AlexNet and related CNNs? The failure to observe localist units in the hidden layers of these CNNs is consistent with Bowers et al. (2014)’s claim that these units emerge in order to support the co-activation of multiple items at the same time in short-term memory. That is, localist representations may be the solution to the superposition catastrophe, and these CNNs only have to identify one image at a time. The pressure to learn highly selective representations in response to the superposition constraint may help explain the reports of highly selective neurons in cortex given that the cortex needs to co-activate multiple items at the same time in order to support short-term memory (Bowers et al., 2016). + +Note, the RNNs that learned localist units were very small in scale compared to CNNs we have studied here, and accordingly, it is possible that the contrasting results reflect the size of the networks rather than the superposition catastrophe per se. Relevant to this issue a number of authors have reported the existence of selective units in larger RNNs with long-short term memory (LSTM) units (Karpathy et al., 2016; Radford et al., 2017; Lakretz et al., 2019; Na et al., 2019). Indeed, Lakretz et al. (2019) use the term ‘grandmother cell’ to describe the units they observed. It will be interesting to apply our measures of selectivity to these larger RNNs and see whether these units are indeed ‘grandmother units’. + +It should also be noted that there are recent reports of impressively selective representations in Generative Adversarial Networks (Bau et al., 2019) and Variational Autoencoders (Burgess et al., 2018) where the superposition catastrophe is not an issue. Again, it will be interesting to assess the selectivity of these units according to signal detection measures in order to see whether there are additional computational pressures to learn highly selective or even grandmother cells. We will be exploring these issues in future work. + +REFERENCES +D. Bau, J.-Y. Zhu, H. Strobelt, B. Zhou, J. B. Tenenbaum, W. T. Freeman, and A. Torralba. Visualizing and understanding generative adversarial networks. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Hyg_X2C5FX. +I. S. Berkeley, M. R. Dawson, D. A. Medler, D. P. Schopflocher, and L. Hornsby. Density plots of hidden value unit activations reveal interpretable bands. Connection Science, 7(2):167–187, 1995. +J. S. Bowers. On the biological plausibility of grandmother cells: implications for neural network theories in psychology and neuroscience. Psychological review, 116(1):220, 2009. +J. S. Bowers. Grandmother cells and localist representations: a review of current thinking. Language, Cognition, and Neuroscience, pages 257–273, 2017. +J. S. Bowers, I. I. Vankov, M. F. Damian, and C. J. Davis. Neural networks learn highly selective representations in order to overcome the superposition catastrophe. Psychological review, 121(2): 248–261, 2014. +J. S. Bowers, I. I. Vankov, M. F. Damian, and C. J. Davis. Why do some neurons in cortex respond to information in a selective manner? insights from artificial neural networks. Cognition, 148:47–63, 2016. +C. P. Burgess, I. Higgins, A. Pal, L. Matthey, N. Watters, G. Desjardins, and A. Lerchner. Understanding disentangling in $\beta$ -VAE. arXiv preprint arXiv:1804.03599, 2018. +J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pages 248–255. IEEE, 2009. +D. Erhan, Y. Bengio, A. Courville, and P. Vincent. Visualizing higher-layer features of a deep network. University of Montreal, 1341(3):1, 2009. +Y. Jia, E. Shelhamer, J. Donahue, S. Karayev, J. Long, R. Girshick, S. Guadarrama, and T. Darrell. Caffe: Convolutional architecture for fast feature embedding. arXiv preprint arXiv:1408.5093, 2014. +A. Karpathy, J. Johnson, and L. Fei-Fei. Visualizing and understanding recurrent networks. Workshop Track at International Conference on Learning Representations, 2016. +A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012. +Y. Lakretz, G. Kruszewski, T. Desbordes, D. Hupkes, S. Dehaene, and M. Baroni. The emergence of number and syntax units in lstm language models. arXiv preprint arXiv:1903.07435, 2019. +Q. V. Le. Building high-level features using large scale unsupervised learning. In 2013 IEEE international conference on acoustics, speech and signal processing, pages 8595–8598. IEEE, 2013. +A. S. Morcos, D. G. Barrett, N. C. Rabinowitz, and M. Botvinick. On the importance of single directions for generalization. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ r1iuQjxCZ. +S. Na, Y. J. Choe, D.-H. Lee, and G. Kim. Discovery of natural language concepts in individual units of cnns. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ S1EERs09YQ. +A. Nguyen, A. Dosovitskiy, J. Yosinski, T. Brox, and J. Clune. Synthesizing the preferred inputs for neurons in neural networks via deep generator networks. In Advances in Neural Information Processing Systems, pages 3387–3395, 2016. +A. Nguyen, J. Clune, Y. Bengio, A. Dosovitskiy, and J. Yosinski. Plug & play generative networks: Conditional iterative generation of images in latent space. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4467–4477, 2017. +A. Nguyen, J. Yosinski, and J. Clune. Understanding neural networks via feature visualization: A survey. arXiv preprint arXiv:1904.08939, 2019. +D. M. Powers. Evaluation: from precision, recall and f-measure to roc, informedness, markedness and correlation. 2011. +A. Radford, R. Jozefowicz, and I. Sutskever. Learning to generate reviews and discovering sentiment. arXiv preprint arXiv:1704.01444, 2017. +K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. +K. Simonyan, A. Vedaldi, and A. Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013. +C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015. +J. Yosinski, J. Clune, A. Nguyen, T. Fuchs, and H. Lipson. Understanding neural networks through deep visualization. arXiv preprint arXiv:1506.06579, 2015. +M. D. Zeiler and R. Fergus. Visualizing and understanding convolutional networks. In European conference on computer vision, pages 818–833. Springer, 2014. +B. Zhou, A. Khosla, A. Lapedriza, A. Oliva, and A. Torralba. Object detectors emerge in deep scene CNNs. In International Conference on Learning Representations, 2015. +B. Zhou, D. Bau, A. Oliva, and A. Torralba. Interpreting deep visual representations via network dissection. IEEE transactions on pattern analysis and machine intelligence, 2018a. +B. Zhou, Y. Sun, D. Bau, and A. Torralba. Revisiting the importance of individual units in CNNs via ablation. arXiv preprint arXiv:1806.02891, 2018b. + +# APPENDIX + +# A METHODOLOGICAL DETAILS FOR THE BEHAVIORAL EXPERIMENT + +One hundred generated images were made for every unit in layers conv5, fc6 and fc8 in AlexNet, as in Nguyen et al. (2017), and displayed as $1 0 \mathrm { x } 1 0$ image panels (figures A4 and Figures A2 and A3). A total of 3,299 image panels were used in the experiment (995 fc8, 256 conv5, and 2048 randomly selected fc6 image panels) and were divided into 64 counterbalanced lists of 51 or 52 (4 conv5, 15 or $1 6 \mathsf { f c } 8$ and 32 fc6). 51 of the lists were assigned to 5 participants and 13 lists were assigned to 6 participants. + +To test the interpretability of these units, paid volunteers were asked to look at image panels and asked if the images had an object / animal or place in common. If the answer was ‘yes’, they were asked to name that object simply (i.e. fish rather than goldfish). Analyses of common responses was carried out for any units where over $80 \%$ of humans agreed there was an object present, by reading the human responses and comparing them to both each other and to the output classes. Agreement was taken if the object was the same rough class. For example, ‘beer’, ‘glass’, and ‘drink’ were all considered to be in agreement in the general object of ‘drink’, and in agreement with both the classes of ‘wine glass’ and ‘beer’ as these classes were also general drink classes (this is an actual example, most responses were more obvious and required far less interpretation than that). Participants were given six practice trials, each with panels of 20 images before starting the main experiment. Practice trials included images that varied in their interpretability. + +![](images/1a017687051cbc18f9a0a5a59b15c224ba0a7883a3aa8fe5700a6c6bba0d47a1.jpg) +Figure A1: Example screen from the identification task shown to participants as part of the instructions. The images included on this practice trial are ImageNet2012 images, not AM images. + +Some examples of the $1 0 \mathrm { x } 1 0$ grids of activation maximisation images that were presented to participants are shown in Figures A2, A3 and A4. Figure A2 shows an example from conv5 that human participants agreed had no obvious object in common (although there are repeated shape motifs, the participants were specifically asked for objects, and not abstract concepts like shape or color. Figure A3 is also from the conv5 and was judged by participants as some images containing ‘dogs’. + +![](images/86890cf8b17928ab35c92142a67999a22d2b41dcd29aa3e79dc1617600be0818.jpg) +Figure A4 is the AM images for the supposed ‘butterfly detector’ unit example discussed in the paper. +Figure A2: Example activation maximisation images for unit conv5.65. These images were judged by humans to not contain any interpretable objects in common (although the reader may agree that there are some shape and colour similarities in the images). + +![](images/e3976498e1d5e03e9eda7017306d8b6048a0f3a2d4ccc174532d3143bb3d0631.jpg) +Figure A3: Example activation maximisation images for unit conv5.183. These images were judged by humans to contain some interpretable images, in this case, of the type ‘dogs’. + +![](images/53b865e27c047b3029870a705da9f697a5bdda0957ce95f1cc0927947dbd92ed.jpg) +Figure A4: Example activation maximisation images for unit fc6.1199. Whilst there are some butterfly wing shapes in these images, there are not obvious butterflies. N.B. the second highest activating class for this unit is ladybirds, and there are some orange round shapes that could conceivably be ladybug-alikes. + +# B FURTHER DATA ON THE SELECTIVITY MEASURES ACROSS ALEXNET + +Table A1 gives the highest values of CCMAS and precision for each layer in AlexNet. It is worth noting that the highest CCMAS score of all hidden units was .94 (fc7.31), which at first glance suggests that this unit is close to ‘perfect’ selectivity. However, this unit only has low a precision score of $11 \%$ . In other words, although the mean activation for the given class is very high relative to the mean of all other activations (high CCMAS), the proportion of items from that class in the 100 most active items is low (low precision). See appendix Sec. C for discussion of how this occurs and Fig. A5(a) for an illustrative example. + +Table A1: The units with the highest CCMAS and precision scores in AlexNet. Unit fc6.1199 was displayed in Fig. 3. + +
LAYER.UNIT CCMASPrecision
Top CCMAS units
output.322 0.991100%
fc7.31 0.9411%
fc6.582 0.931%
conv5.78 0.755%
Top precision units
output.0 0.99100%
fc7.255 0.9097%
fc6.1199 0.9295%
conv5.0 0.5577%
+ +Table A2 shows positive correlations between four of the selectivity measures used. There are moderate positive correlations between precision and CCMAS; and precision and Recall at $9 5 \%$ precision. The other correlations between selectivity measures have weak positive correlations. All four selectivity measures are negatively correlated with the number of classes present in the $1 0 0 \mathrm { m o s t }$ active items, that is, the more selective the unit, the fewer classes will be represented in the most active 100 items. + +Table A2: The correlations between the different measures. (All $p$ ’s $< . 0 0 1$ ) + +
CCMASrecalll0.95Max. Inf.No.classes in top100
precision0.380.300.15-0.68
CCMAS0.090.14-0.47
recall0.950.10-0.19
Max. Inf.-0.22
+ +# C FURTHER ISSUES WITH THE CCMAS MEASURE + +The CCMAS measure is based on comparing the mean activation of a category with the mean activation for all other items, and this is problematic for a few reasons. First, in many units a large proportion of images do not activate a unit at all. For instance, our butterfly ‘detector’ unit fc6.1199 has a high proportion of images with an activation of 0.0 (see figure 3). Indeed, the inset on the middle figure shows that the distribution can be better described by exponential-derived fits rather than a Gaussian. This means that the CCMAS selectivity is heavily influenced by the the proportion of images that have an activation value of zero (or close to zero). This can lead to very different estimates of selectivity for CCMAS and precision or localist selectivity, which are driven by the most highly activated items. In A5 we generate example data to highlight ways in which CCMAS score may be non-intuitive. In subplot (a) we demonstrate that a unit can have a CCMAS score of of 1.0 despite only a single item activating the unit. The point that we wish to emphasise is that a high CCMAS score does not necessarily imply selectivity for a given class, but might in fact relate to selectivity for a small subset of items from a given class, and this is especially true when a unit’s activation is sparse (many items do not activate the unit). However, the reverse can also be true. In subplot (c) we demonstrate that a unit can have a very low CCMAS score of .06 despite all of the most active items being from the same class. + +In addition, if the CCMAS provided a good measure of a unit’s class selectivity, then one should expect that a high measure of selectivity for one class would imply that the unit is not highly selective for other classes. However, the CCMAS score for the most selective category and the second most selective category (CCMAS2) were similar across the conv5, fc6 and fc7. layers, with the mean CCMAS scores .491, .844, and .848, and the CCMAS2 scores .464, .821, .831. For example, unit fc7.0 has a CCMAS of .813 for the class ‘maypole’, and a CCMAS2 score of .808 for ‘chainsaw’ (with neither of these categories corresponding ‘orangutan’ that had the highest precision of score of $14 \%$ ). + +![](images/77025fa9e4dcfbee2b67b179b8eba0ebd1ff4a2f835efa476052be3c934048af.jpg) +Figure A5: Example of where the CCMAS does not match intuitive understandings of selectivity. Generated example data: (a) If a unit is off to all but a single image from a large class of objects, the CCMAS for that class is 1 (maximum possible selectivity). (b) An archetypal ‘grandmother’ cell (GMC), where the unit is strongly activated to all members of one class and off to everything else. The CCMAS is the same for (b) as for (a) although the precision is vastly different. (c): If a unit has high activations for all classes, but one class (black squares) is 0.1 more than all others (coloured circles), the CCMAS is very low (0.06) despite being $\% 1 0 0$ precision. The generated examples are for 10 classes of 100 items + +# D TESTING UNITS IN OTHER MODELS + +To investigate units claimed by Zhou et al. (2018a) to be object detectors, we focus on units from a single layer that are reported to be ‘bus detectors’, that is, units with an $\mathrm { I o U } \geq . 0 4$ . We used the first 100 images per class from the ImageNet 2012 dataset as our test data. There are three classes of bus in this dataset: ‘n04146614 school bus’, ‘n04487081 trolleybus, trolley coach, trackless trolley’, ‘n03769881 minibus’, and this corresponded to 300 items out of 100000 images. Data for all bus unit detectors for VGG trained on places 365 are shown in table A3; for GoogLeNet trained on places 365 in table A4; and for GoogLeNet trained on ImageNet are shown in table A5. Note that for all units there are very few busses with activation at zero and that the mean activation for busses is higher than the mean activation for non-busses. However, all precision scores are all below .6, meaning that of the 100 items that most strongly activated the unit, at least 40 of them were not busses. Together these results suggests that whilst these units demonstrate some sensitivity to busses, they show poor specificity for busses (e.g., high false-alarm rate). + +
unitIoUno.ax>0 x∈Ano.ax>0 x∈-AμAμ-A precisionCCMAS
conv5_3191.1599.0%63.9%131.9 16.1.45.78
conv5_320.1599.0%49.1%157.615.2 .53.82
conv5_3333.0899.0%71.4%101.717.5 .24.71
conv5_3145.0797.3%61.7%75.512.5 .19.72
conv5_3113.0697.4%41.0%62.89.1 .12.75
conv5_3443.0495.3%38.2%59.38.1 .12.76
conv5_3131.0493.7%22.3%54.05.86 .08.80
+ +Table A3: Selectivity measures for VGG-16, trained on Places-365, top convolutional layer units identified by Zhou et al. (2018a) as object detectors. Standard errors not shown for space, but were below $\pm 5$ . The IoU is from Zhou et al. (2018a)’s network dissection method. no. $a _ { x } { > } 0$ and no. $a _ { x } { > } 0$ $x \in A$ refer to the proportion of activations that were greater than zero for busses and non-busses respectively. $\mu _ { A }$ and $\mu { \neg } A$ are the class means for busses and non busses respectively. + +
unitIoUcorrectno.ax>0 x∈Ano.ax>0 x∈-AμAμ-AprecisionCCMAS
incep4e824.17T100.091.441.011.8.27.55
incep4e745.13T98.374.834.811.4.06.51
incep4e791.11T98.371.432.75.3.41.72
incep4e194.11F100.085.326.68.8.02.51
incep4e82.11T100.097.326.710.9.14.42
incep4e736.11T100.078.838.79.9.05.59
incep4e663.10F96.038.033.43.7.15.80
incep4eg4.10T100.091.638.39.5.35.60
incep4e772.08F97.354.621.75.2.00.61
incep4e113.08F100.088.024.99.2.02.46
incep4e708.06F100.085.129.79.1.02.53
incep4eg01.06F100.064.535.26.4.14.69
incep4e199.06F99.792.221.57.7.09.47
incep4eg.05F99.783.518.57.3.01.43
incep4e121.05F100.090.417.98.9.01.34
incep4e622.05T96.065.027.56.4.20.62
incep4e97.04T99.386.421.19.3.04.39
+ +Table A4: Selectivity measures for GoogLeNet, trained on Places-365, layer inception4e units identified by Zhou et al. (2018a) as object detectors. Standard errors not shown for space, but were below $\pm 2$ . The IoU is from Zhou et al. (2018a)’s network dissection method. A units is marked as correct if there was a single bus in the 4 example pictures on the website (http://netdissect. csail.mit.edu/dissect/googlenet_places365/), and false if not. Where units are False, this might suggest that the units were responding to ’bus like’ features in none bus objects. no. $a _ { x } { > } 0$ and no $. a _ { x } { > } 0 \ x \in A$ refer to the proportion of activations that were greater than zero for busses and non-busses respectively. $\mu _ { A }$ and $\mu { \_ } A$ are the class means for busses and non busses respectively. + +Table A5: Selectivity measures for GoogLeNet, trained on ImageNet, layer inception4e units units identified by Zhou et al. (2018a) as object detectors. Standard errors not shown for space, but were below $\pm 2$ . A units is marked as correct if there was a single bus in the 4 example pictures on the website (http://netdissect.csail.mit.edu/dissect/googlenet_imagenet/), and false if not. This might suggest that the units were responding to ’bus like’ features in none bus objects. + +
unitIoUcorrectno.ax>0 x∈Ano.ax>0 x∈-AμAμ-AprecisionCCMAS
incep4e494.11F99.082.472.522.8.00.52
incep4e828.10T100.072.6109.417.6.45.72
incep4e569.10T99.785.974.920.0.05.58
incep4e384.10T100.071.667.018.5.00.57
incep4e455.09T99.789.669.114.3.3.66
incep4e579.09T100.097.091.526.0.23.56
incep4e331.08T98.075.551.011.8.12.62
incep4e582.08T100.083.4125.721.95.58.70
incep4e498.07T97.777.273.515.0.52.66
incep4e534.07F99.381.262.719..02.53
incep4e693.07T98.791.275.422.3.15.54
incep4e673.07T99.788.488.623.0.33.59
incep4e469.06T98.778.134.714.6.00.41
incep4e207.06T100.093.576.121.3.07.56
incep4e491.06F99.074.541.113.7.01.50
incep4e645.06T98.083.959.918.1.20.54
incep4e527.06F100.091.558.021.7.00.46
incep4e511.05F100.089.453.521.7.00.42
incep4e308.05F100.089.453.521.7.00.42
incep4e541.05F99.6788.744.913.7.00.53
incep4e367.05T97.380.337.715.4.02.42
incep4e665.05T100.082.45107.221.0.33.67
incep4e532.05T100.091.552.922.4.05.41
incep4e297.04T99.790.248.217.9.00.46
incep4e480.04T100.092.969.421.4.02.53
\ No newline at end of file diff --git a/md/train/Skq89Scxx/Skq89Scxx.md b/md/train/Skq89Scxx/Skq89Scxx.md new file mode 100644 index 0000000000000000000000000000000000000000..df359e3627fb8e871ca8d19c8fee1f36f1bf08d4 --- /dev/null +++ b/md/train/Skq89Scxx/Skq89Scxx.md @@ -0,0 +1,263 @@ +# SGDR: STOCHASTIC GRADIENT DESCENT WITH WARM RESTARTS + +Ilya Loshchilov & Frank Hutter + +University of Freiburg +Freiburg, Germany, +{ilya,fh}@cs.uni-freiburg.de + +# ABSTRACT + +Restart techniques are common in gradient-free optimization to deal with multimodal functions. Partial warm restarts are also gaining popularity in gradientbased optimization to improve the rate of convergence in accelerated gradient schemes to deal with ill-conditioned functions. In this paper, we propose a simple warm restart technique for stochastic gradient descent to improve its anytime performance when training deep neural networks. We empirically study its performance on the CIFAR-10 and CIFAR-100 datasets, where we demonstrate new state-of-the-art results at $3 . 1 4 \%$ and $1 6 . 2 1 \%$ , respectively. We also demonstrate its advantages on a dataset of EEG recordings and on a downsampled version of the ImageNet dataset. Our source code is available at +https://github.com/loshchil/SGDR + +# 1 INTRODUCTION + +Deep neural networks (DNNs) are currently the best-performing method for many classification problems, such as object recognition from images (Krizhevsky et al., 2012a; Donahue et al., 2014) or speech recognition from audio data (Deng et al., 2013). Their training on large datasets (where DNNs perform particularly well) is the main computational bottleneck: it often requires several days, even on high-performance GPUs, and any speedups would be of substantial value. + +The training of a DNN with $n$ free parameters can be formulated as the problem of minimizing a function $f : \mathbb { R } ^ { n } \to \mathbb { R }$ . The commonly used procedure to optimize $f$ is to iteratively adjust $\pmb { x } _ { t } \in \mathbb { R } ^ { n }$ (the parameter vector at time step $t$ ) using gradient information $\nabla f _ { t } ( { \pmb x } _ { t } )$ obtained on a relatively small $t$ -th batch of $b$ datapoints. The Stochastic Gradient Descent (SGD) procedure then becomes an extension of the Gradient Descent (GD) to stochastic optimization of $f$ as follows: + +$$ +\begin{array} { r } { \pmb { x } _ { t + 1 } = \pmb { x } _ { t } - \eta _ { t } \nabla f _ { t } ( \pmb { x } _ { t } ) , } \end{array} +$$ + +where $\eta _ { t }$ is a learning rate. One would like to consider second-order information + +$$ +\begin{array} { r } { { \pmb x } _ { t + 1 } = { \pmb x } _ { t } - \eta _ { t } { \pmb H } _ { t } ^ { - 1 } \nabla f _ { t } ( { \pmb x } _ { t } ) , } \end{array} +$$ + +but this is often infeasible since the computation and storage of the inverse Hessian $\pmb { H } _ { t } ^ { - 1 }$ is intractable for large $n$ . The usual way to deal with this problem by using limited-memory quasiNewton methods such as L-BFGS (Liu & Nocedal, 1989) is not currently in favor in deep learning, not the least due to (i) the stochasticity of $\nabla f _ { t } ( { \pmb x } _ { t } )$ , (ii) ill-conditioning of $f$ and (iii) the presence of saddle points as a result of the hierarchical geometric structure of the parameter space (Fukumizu & Amari, 2000). Despite some recent progress in understanding and addressing the latter problems (Bordes et al., 2009; Dauphin et al., 2014; Choromanska et al., 2014; Dauphin et al., 2015), state-ofthe-art optimization techniques attempt to approximate the inverse Hessian in a reduced way, e.g., by considering only its diagonal to achieve adaptive learning rates. AdaDelta (Zeiler, 2012) and Adam (Kingma & Ba, 2014) are notable examples of such methods. + +![](images/2fdd7dc39a0f5c385884a9c0807862b1960fa602d0f7be2bde9952c4d44d5f22.jpg) +Figure 1: Alternative schedule schemes of learning rate $\eta _ { t }$ over batch index $t$ : default schemes with $\eta _ { 0 } = 0 . 1$ (blue line) and $\eta _ { 0 } = 0 . 0 5$ (red line) as used by Zagoruyko & Komodakis (2016); warm restarts simulated every $T _ { 0 } = 5 0$ (green line), $T _ { 0 } = 1 0 0$ (black line) and $T _ { 0 } = 2 0 0$ (grey line) epochs with $\eta _ { t }$ decaying during $i$ -th run from $\eta _ { m a x } ^ { i } = 0 . 0 5$ to $\eta _ { m i n } ^ { i } = 0$ according to eq. (5); warm restarts starting from epoch $T _ { 0 } = 1$ (dark green line) and $T _ { 0 } = 1 0$ (magenta line) with doubling $( T _ { m u l t } = 2$ ) periods $T _ { i }$ at every new warm restart. + +Intriguingly enough, the current state-of-the-art results on CIFAR-10, CIFAR-100, SVHN, ImageNet, PASCAL VOC and MS COCO datasets were obtained by Residual Neural Networks (He et al., 2015; Huang et al., 2016c; He et al., 2016; Zagoruyko & Komodakis, 2016) trained without the use of advanced methods such as AdaDelta and Adam. Instead, they simply use SGD with momentum 1: + +$$ +\begin{array} { r } { \pmb { \nu } _ { t + 1 } = \mu _ { t } \pmb { \nu } _ { t } - \eta _ { t } \nabla f _ { t } ( \pmb { x } _ { t } ) , } \\ { \pmb { x } _ { t + 1 } = \pmb { x } _ { t } + \pmb { \nu } _ { t + 1 } , } \end{array} +$$ + +where $\nu _ { t }$ is a velocity vector initially set to $\pmb { \theta }$ , $\eta _ { t }$ is a decreasing learning rate and $\mu _ { t }$ is a momentum rate which defines the trade-off between the current and past observations of $\nabla f _ { t } ( { \pmb x } _ { t } )$ . The main difficulty in training a DNN is then associated with the scheduling of the learning rate and the amount of L2 weight decay regularization employed. A common learning rate schedule is to use a constant learning rate and divide it by a fixed constant in (approximately) regular intervals. The blue line in Figure 1 shows an example of such a schedule, as used by Zagoruyko & Komodakis (2016) to obtain the state-of-the-art results on CIFAR-10, CIFAR-100 and SVHN datasets. + +In this paper, we propose to periodically simulate warm restarts of SGD, where in each restart the learning rate is initialized to some value and is scheduled to decrease. Four different instantiations of this new learning rate schedule are visualized in Figure 1. Our empirical results suggest that SGD with warm restarts requires $2 \times$ to $4 \times$ fewer epochs than the currently-used learning rate schedule schemes to achieve comparable or even better results. Furthermore, combining the networks obtained right before restarts in an ensemble following the approach proposed by Huang et al. (2016a) improves our results further to $3 . 1 4 \%$ for CIFAR-10 and $1 6 . 2 1 \%$ for CIFAR-100. We also demonstrate its advantages on a dataset of EEG recordings and on a downsampled version of the ImageNet dataset. + +# 2 RELATED WORK + +# 2.1 RESTARTS IN GRADIENT-FREE OPTIMIZATION + +When optimizing multimodal functions one may want to find all global and local optima. The tractability of this task depends on the landscape of the function at hand and the budget of function evaluations. Gradient-free optimization approaches based on niching methods (Preuss, 2015) usually can deal with this task by covering the search space with dynamically allocated niches of local optimizers. However, these methods usually work only for relatively small search spaces, e.g., $n < 1 0$ , and do not scale up due to the curse of dimensionality (Preuss, 2010). Instead, the current state-of-the-art gradient-free optimizers employ various restart mechanisms (Hansen, 2009; Loshchilov et al., 2012). One way to deal with multimodal functions is to iteratively sample a large number $\lambda$ of candidate solutions, make a step towards better solutions and slowly shape the sampling distribution to maximize the likelihood of successful steps to appear again (Hansen & Kern, 2004). The larger the $\lambda$ , the more global search is performed requiring more function evaluations. In order to achieve good anytime performance, it is common to start with a small $\lambda$ and increase it (e.g., by doubling) after each restart. This approach works best on multimodal functions with a global funnel structure and also improves the results on ill-conditioned problems where numerical issues might lead to premature convergence when $\lambda$ is small (Hansen, 2009). + +# 2.2 RESTARTS IN GRADIENT-BASED OPTIMIZATION + +Gradient-based optimization algorithms such as BFGS can also perform restarts to deal with multimodal functions (Ros, 2009). In large-scale settings when the usual number of variables $n$ is on the order of $1 0 ^ { 3 } - 1 0 ^ { 9 }$ , the availability of gradient information provides a speedup of a factor of $n$ w.r.t. gradient-free approaches. Warm restarts are usually employed to improve the convergence rate rather than to deal with multimodality: often it is sufficient to approach any local optimum to a given precision and in many cases the problem at hand is unimodal. Fletcher & Reeves (1964) proposed to flesh the history of conjugate gradient method every $n$ or $( n + 1 )$ iterations. Powell (1977) proposed to check whether enough orthogonality between $\nabla f ( { \pmb x } _ { t - 1 } )$ and $\nabla f ( \pmb { x } _ { t } )$ has been lost to warrant another warm restart. Recently, O’Donoghue & Candes (2012) noted that the iterates of accelerated gradient schemes proposed by Nesterov (1983; 2013) exhibit a periodic behavior if momentum is overused. The period of the oscillations is proportional to the square root of the local condition number of the (smooth convex) objective function. The authors showed that fixed warm restarts of the algorithm with a period proportional to the conditional number achieves the optimal linear convergence rate of the original accelerated gradient scheme. Since the condition number is an unknown parameter and its value may vary during the search, they proposed two adaptive warm restart techniques (O’Donoghue & Candes, 2012): + +• The function scheme restarts whenever the objective function increases. + +• The gradient scheme restarts whenever the angle between the momentum term and the negative gradient is obtuse, i.e, when the momentum seems to be taking us in a bad direction, as measured by the negative gradient at that point. This scheme resembles the one of Powell (1977) for the conjugate gradient method. + +O’Donoghue & Candes (2012) showed (and it was confirmed in a set of follow-up works) that these simple schemes provide an acceleration on smooth functions and can be adjusted to accelerate stateof-the-art methods such as FISTA on nonsmooth functions. + +Smith (2015; 2016) recently introduced cyclical learning rates for deep learning, his approach is closely-related to our approach in its spirit and formulation but does not focus on restarts. + +Yang & Lin (2015) showed that Stochastic subGradient Descent with restarts can achieve a linear convergence rate for a class of non-smooth and non-strongly convex optimization problems where the epigraph of the objective function is a polyhedron. In contrast to our work, they never increase the learning rate to perform restarts but decrease it geometrically at each epoch. To perform restarts, they periodically reset the current solution to the averaged solution from the previous epoch. + +# 3 STOCHASTIC GRADIENT DESCENT WITH WARM RESTARTS (SGDR) + +The existing restart techniques can also be used for stochastic gradient descent if the stochasticity is taken into account. Since gradients and loss values can vary widely from one batch of the data to another, one should denoise the incoming information: by considering averaged gradients and losses, e.g., once per epoch, the above-mentioned restart techniques can be used again. + +In this work, we consider one of the simplest warm restart approaches. We simulate a new warmstarted run / restart of SGD once $T _ { i }$ epochs are performed, where $i$ is the index of the run. Importantly, the restarts are not performed from scratch but emulated by increasing the learning rate $\eta _ { t }$ while the old value of $\mathbf { \boldsymbol { x } } _ { t }$ is used as an initial solution. The amount of this increase controls to which extent the previously acquired information (e.g., momentum) is used. + +Within the $i$ -th run, we decay the learning rate with a cosine annealing for each batch as follows: + +$$ +\eta _ { t } = \eta _ { m i n } ^ { i } + \frac { 1 } { 2 } ( \eta _ { m a x } ^ { i } - \eta _ { m i n } ^ { i } ) ( 1 + \cos ( \frac { T _ { c u r } } { T _ { i } } \pi ) ) , +$$ + +where $\eta _ { m i n } ^ { i }$ and $\eta _ { m a x } ^ { i }$ are ranges for the learning rate, and $T _ { c u r }$ accounts for how many epochs have been performed since the last restart. Since $T _ { c u r }$ is updated at each batch iteration $t$ , it can take discredited values such as 0.1, 0.2, etc. Thus, $\eta _ { t } = \eta _ { m a x } ^ { i }$ when $t = 0$ and $T _ { c u r } = 0$ . Once $T _ { c u r } = T _ { i }$ , the cos function will output $- 1$ and thus $\eta _ { t } = \eta _ { m i n } ^ { i }$ . The decrease of the learning rate is shown in Figure 1 for fixed $T _ { i } = 5 0$ , $T _ { i } = 1 0 0$ and $T _ { i } ~ = ~ 2 0 0$ ; note that the logarithmic axis obfuscates the typical shape of the cosine function. + +In order to improve anytime performance, we suggest an option to start with an initially small $T _ { i }$ and increase it by a factor of $T _ { m u l t }$ at every restart (see, e.g., Figure 1 for $T _ { 0 } = 1 , T _ { m u l t } = 2$ and $T _ { 0 } = 1 0 , T _ { m u l t } = 2 )$ . It might be of great interest to decrease $\eta _ { m a x } ^ { i }$ and $\eta _ { m i n } ^ { i }$ at every new restart. However, for the sake of simplicity, here, we keep $\eta _ { m a x } ^ { i }$ and $\eta _ { m i n } ^ { i }$ the same for every $i$ to reduce the number of hyperparameters involved. + +Since our simulated warm restarts (the increase of the learning rate) often temporarily worsen performance, we do not always use the last $\mathbf { } _ { \pmb { x } _ { t } }$ as our recommendation for the best solution (also called the incumbent solution). While our recommendation during the first run (before the first restart) is indeed the last $\mathbf { } _ { \pmb { x } _ { t } }$ , our recommendation after this is a solution obtained at the end of the last performed run at ηt = ηimin. We emphasize that with the help of this strategy, our method does not require a separate validation data set to determine a recommendation. + +# 4 EXPERIMENTAL RESULTS + +# 4.1 EXPERIMENTAL SETTINGS + +We consider the problem of training Wide Residual Neural Networks (WRNs; see Zagoruyko & Komodakis (2016) for details) on the CIFAR-10 and CIFAR-100 datasets (Krizhevsky, 2009). We will use the abbreviation WRN-d- $k$ to denote a WRN with depth $d$ and width $k$ . Zagoruyko & Komodakis (2016) obtained the best results with a WRN-28-10 architecture, i.e., a Residual Neural Network with $d \ : = \ : 2 8$ layers and $k = 1 0$ times more filters per layer than used in the original Residual Neural Networks (He et al., 2015; 2016). + +The CIFAR-10 and CIFAR-100 datasets (Krizhevsky, 2009) consist of $3 2 \times 3 2$ color images drawn from 10 and 100 classes, respectively, split into 50,000 train and 10,000 test images. For image preprocessing Zagoruyko & Komodakis (2016) performed global contrast normalization and ZCA whitening. For data augmentation they performed horizontal flips and random crops from the image padded by 4 pixels on each side, filling missing pixels with reflections of the original image. + +For training, Zagoruyko & Komodakis (2016) used SGD with Nesterov’s momentum with initial learning rate set to $\eta _ { 0 } ~ = ~ 0 . 1$ , weight decay to 0.0005, dampening to 0, momentum to 0.9 and minibatch size to 128. The learning rate is dropped by a factor of 0.2 at 60, 120 and 160 epochs, with a total budget of 200 epochs. We reproduce the results of Zagoruyko & Komodakis (2016) with the same settings except that i) we subtract per-pixel mean only and do not use ZCA whitening; ii) we use SGD with momentum as described by eq. (3-4) and not Nesterov’s momentum. + +![](images/67fc79f25b3e3da44eb17b55361645c16f330c07cab651bdaa4489e1d819cf13.jpg) +Figure 2: Test errors on CIFAR-10 (left column) and CIFAR-100 (right column) datasets. Note that for SGDR we only plot the recommended solutions. The top and middle rows show the same results on WRN-28-10, with the middle row zooming into the good performance region of low test error. The bottom row shows performance with a wider network, WRN-28-20. + +The results of the default learning rate schedules of Zagoruyko & Komodakis (2016) with $\eta _ { 0 } = 0 . 1$ and $\eta _ { 0 } = 0 . 0 5$ are depicted by the blue and red lines, respectively. The schedules of $\eta _ { t }$ used in SGDR are shown with i) restarts every $T _ { 0 } = 5 0$ epochs (green line); ii) restarts every $T _ { 0 } = 1 0 0$ epochs (black line); iii) restarts every $T _ { 0 } = 2 0 0$ epochs (gray line); iv) restarts with doubling $T _ { m u l t } = 2 $ ) periods of restarts starting from the first epoch ( ${ { T } _ { 0 } } \ = \ 1$ , dark green line); and v) restarts with doubling $T _ { m u l t } = 2$ ) periods of restarts starting from the tenth epoch $T _ { 0 } = 1 0$ , magenta line). + +The schedule of $\eta _ { t }$ used by Zagoruyko & Komodakis (2016) is depicted by the blue line in Figure 1. The same schedule but with $\eta _ { 0 } = 0 . 0 5$ is depicted by the red line. The schedule of $\eta _ { t }$ used in SGDR is also shown in Figure 1, with two initial learning rates $T _ { 0 }$ and two restart doubling periods. + +Table 1: Test errors of different methods on CIFAR-10 and CIFAR-100 with moderate data augmentation (flip/translation). In the second column $k$ is a widening factor for WRNs. Note that the computational and memory resources used to train all WRN-28-10 are the same. In all other cases they are different, but WRNs are usually faster than original ResNets to achieve the same accuracy (e.g., up to a factor of 8 according to Zagoruyko & Komodakis (2016)). Bold text is used only to highlight better results and is not based on statistical tests (too few runs). + +
depth-k# params# runsCIFAR-10CIFAR-100
original-ResNet (He et al.,2015)1101.7Mmean of 56.4325.16
120210.2Mmean of 57.9327.82
stoc-depth (Huang et al., 2016c)11012021.7M10.2M1 run1 run5.2324.58n/a
024.91
pre-act-ResNet (He et al.,2016)11016410011.7Mmed. of56.37
1.7M10.2Mmed. of 5med. of 55.4624.3322.71
4.62
WRN (Zagoruyko & Komodakis, 2016) with dropout16-828-1028-1011.0M36.5M36.5M1 run1 run1 run4.8122.0720.5020.04
4.17n/a
WRN (ours)default with no = 0.136.5Mmed. of 54.2420.33
28-10
default with no = 0.0528-1036.5Mmed. of 54.1320.21
T = 50,Tmult =128-1036.5Mmed. of 54.1719.99
To = 100,Tmult =128-1036.5Mmed. of 54.0719.87
To = 200,Tmult = 128-1036.5Mmed. of 53.8619.98
To =1,Tmult = 2To =10,Tmult = 228-1036.5Mmed. of 54.0919.74
28-1036.5Mmed. of 54.0319.58
default with no = 0.128-20145.8Mmed. of 24.0819.53
default with no = 0.0528-20145.8Mmed. of 23.9619.67
To = 50,Tmult = 128-20145.8Mmed. of 24.0119.28
To = 100,Tmult = 128-20145.8Mmed. of 23.7719.24
To = 200,Tmult =1To =1,Tmult = 2To = 10,Tmult = 228-20145.8Mmed. of 23.6619.69
28-20145.8Mmed. of 23.9118.90
28-20145.8Mmed. of 23.7418.70
+ +# 4.2 SINGLE-MODEL RESULTS + +Table 1 shows that our experiments reproduce the results given by Zagoruyko & Komodakis (2016) for WRN-28-10 both on CIFAR-10 and CIFAR-100. These “default” experiments with $\eta _ { 0 } = 0 . 1$ and $\eta _ { 0 } = 0 . 0 5$ correspond to the blue and red lines in Figure 2. The results for $\eta _ { 0 } = 0 . 0 5$ show better performance, and therefore we use $\eta _ { 0 } = 0 . 0 5$ in our later experiments. + +SGDR with $T _ { 0 } = 5 0$ , $T _ { 0 } = 1 0 0$ and $T _ { 0 } = 2 0 0$ for $T _ { m u l t } = 1$ perform warm restarts every 50, 100 and 200 epochs, respectively. A single run of SGD with the schedule given by eq. (5) for $T _ { 0 } = 2 0 0$ shows the best results suggesting that the original schedule of WRNs might be suboptimal w.r.t. the test error in these settings. However, the same setting with $T _ { 0 } = 2 0 0$ leads to the worst anytime performance except for the very last epochs. + +SGDR with $T _ { 0 } = 1 \mathrm { , } T _ { m u l t } = 2$ and $T _ { 0 } = 1 0 , T _ { m u l t } = 2$ performs its first restart after 1 and 10 epochs, respectively. Then, it doubles the maximum number of epochs for every new restart. The main purpose of this doubling is to reach good test error as soon as possible, i.e., achieve good anytime performance. Figure 2 shows that this is achieved and test errors around $4 \%$ on CIFAR-10 and around $20 \%$ on CIFAR-100 can be obtained about 2-4 times faster than with the default schedule used by Zagoruyko & Komodakis (2016). + +![](images/9483ebc74be2a2955fa389608a8a576cae9c594a7486cafbf9d0969a764ed4dd.jpg) +Figure 3: Test errors of ensemble models built from $N$ runs of SGDR on WRN-28-10 with $M$ model snapshots per run made at epochs 150, 70 and 30 (right before warm restarts of SGDR as suggested by Huang et al. (2016a)). When $M { = } 1$ (respectively, $M { = } 2$ ), we aggregate probabilities of softmax layers of snapshot models at epoch index 150 (respectively, at epoch indexes 150 and 70). + +Table 2: Test errors of ensemble models on CIFAR-10 and CIFAR-100 datasets. + +
CIFAR-10CIFAR-100
N = 1 run of WRN-28-10 with M = 1 snapshot (median of 16 runs)4.0319.57
N = 1 run of WRN-28-10 with M = 3 snapshots per run3.5117.75
N = 3 runs of WRN-28-10 with M = 3 snapshots per run3.2516.64
N = 16 runs of WRN-28-10 with M= 3 snapshots per run3.1416.21
+ +Since SGDR achieves good performance faster, it may allow us to train larger networks. We therefore investigated whether results on CIFAR-10 and CIFAR-100 can be further improved by making WRNs two times wider, i.e., by training WRN-28-20 instead of WRN-28-10. Table 1 shows that the results indeed improved, by about $0 . 2 5 \%$ on CIFAR-10 and by about $0 . 5 \substack { - 1 . 0 \% }$ on CIFAR-100. While network architecture WRN-28-20 requires roughly three-four times more computation than WRN-28-10, the aggressive learning rate reduction of SGDR nevertheless allowed us to achieve a better error rate in the same time on WRN-28-20 as we spent on 200 epochs of training on WRN28-10. Specifically, Figure 2 (right middle and right bottom) show that after only 50 epochs, SGDR (even without restarts, using $T _ { 0 } = 5 0 , T _ { m u l t } = 1 )$ achieved an error rate below $19 \%$ (whereas none of the other learning methods performed better than $1 9 . 5 \%$ on WRN-28-10). We therefore have hope that – by enabling researchers to test new architectures faster – SGDR’s good anytime performance may also lead to improvements of the state of the art. + +In a final experiment for SGDR by itself, Figure 7 in the appendix compares SGDR and the default schedule with respect to training and test performance. As the figure shows, SGDR optimizes training loss faster than the standard default schedule until about epoch 120. After this, the default schedule overfits, as can be seen by an increase of the test error both on CIFAR-10 and CIFAR-100 (see, e.g., the right middle plot of Figure 7). In contrast, we only witnessed very mild overfitting for SGDR. + +# 4.3 ENSEMBLE RESULTS + +Our initial arXiv report on SGDR (Loshchilov & Hutter, 2016) inspired a follow-up study by Huang et al. (2016a) in which the authors suggest to take $M$ snapshots of the models obtained by SGDR (in their paper referred to as cyclical learning rate schedule and cosine annealing cycles) right before $M$ last restarts and to use those to build an ensemble, thereby obtaining ensembles “for free” (in contrast to having to perform multiple independent runs). The authors demonstrated new state-ofthe-art results on CIFAR datasets by making ensembles of DenseNet models (Huang et al., 2016b). Here, we investigate whether their conclusions hold for WRNs used in our study. We used WRN28-10 trained by SGDR with $T _ { 0 } = 1 0 , T _ { m u l t } = 2$ as our baseline model. + +Figure 3 and Table 2 aggregate the results of our study. The original test error of $4 . 0 3 \%$ on CIFAR-10 and $1 9 . 5 7 \%$ on CIFAR-100 (median of 16 runs) can be improved to $3 . 5 1 \%$ on CIFAR-10 and $1 7 . 7 5 \%$ on CIFAR-100 when $M = 3$ snapshots are taken at epochs 30, 70 and 150: when the learning rate of SGDR with $T _ { 0 } = 1 0 , T _ { m u l t } = 2$ is scheduled to achieve 0 (see Figure 1) and the models are used with uniform weights to build an ensemble. To achieve the same result, one would have to aggregate $N = 3$ models obtained at epoch 150 of $N = 3$ independent runs (see $N = 3 , M = 1$ in Figure 3). Thus, the aggregation from snapshots provides a 3-fold speedup in these settings because additional ( $M > 1$ -th) snapshots from a single SGDR run are computationally free. Interestingly, aggregation of models from independent runs (when $N > 1$ and $M = 1$ ) does not scale up as well as from $M > 1$ snapshots of independent runs when the same number of models is considered: the case of $N = 3$ and $M = 3$ provides better performance than the cases of $M = 1$ with $N = 1 8$ and $N = 2 1$ . Not only the number of snapshots $M$ per run but also their origin is crucial. Thus, naively building ensembles from models obtained at last epochs only (i.e., $M = 3$ snapshots at epochs 148, 149, 150) did not improve the results (i.e., the baseline of $M = 1$ snapshot at 150) thereby confirming the conclusion of Huang et al. (2016a) that snapshots of SGDR provide a useful diversity of predictions for ensembles. + +Three runs $N = 3$ ) of SGDR with $M = 3$ snapshots per run are sufficient to greatly improve the results to $3 . 2 5 \%$ on CIFAR-10 and $1 6 . 6 4 \%$ on CIFAR-100 outperforming the results of Huang et al. (2016a). By increasing $N$ to 16 one can achieve $3 . 1 4 \%$ on CIFAR-10 and $1 6 . 2 1 \%$ on CIFAR-100. We believe that these results could be further improved by considering better baseline models than WRN-28-10 (e.g., WRN-28-20). + +# 4.4 EXPERIMENTS ON A DATASET OF EEG RECORDINGS + +To demonstrate the generality of SGDR, we also considered a very different domain: a dataset of electroencephalographic (EEG) recordings of brain activity for classification of actual right and left hand and foot movements of 14 subjects with roughly 1000 trials per subject. The best classification results obtained with the original pipeline based on convolutional neural networks [R. Schirrmeister et al. Convolutional neural networks for EEG analysis: Design choices, training strategies, and feature visualization., under review at Neuroimage] were used as our reference. First, we compared the baseline learning rate schedule with different settings of the total number of epochs and initial learning rates (see Figure 4). When 30 epochs were considered, we dropped the learning rate by a factor of 10 at epoch indexes 10, 15 and 20. As expected, with more epochs used and a similar (budget proportional) schedule better results can be achieved. Alternatively, one can consider SGDR and get a similar final performance while having a better anytime performance without defining the total budget of epochs beforehand. + +Similarly to our results on the CIFAR datasets, our experiments with the EEG data confirm that snapshots are useful and the median reference error (about $9 \%$ ) can be improved i) by $1 { - } 2 \%$ when model snapshots of a single run are considered, and ii) by $2 { - } 3 \%$ when model snapshots from both hyperparameter settings are considered. The latter would correspond to $N = 2$ in Section (4.3). + +# 4.5 PRELIMINARY EXPERIMENTS ON A DOWNSAMPLED IMAGENET DATASET + +In order to additionally validate our SGDR on a larger dataset, we constructed a downsampled version of the ImageNet dataset [P. Chrabaszcz, I. Loshchilov and F. Hutter. A Downsampled Variant of ImageNet as an Alternative to the CIFAR datasets., in preparation]. In contrast to earlier attempts (Pouransari & Ghili, 2015), our downsampled ImageNet contains exactly the same images from 1000 classes as the original ImageNet but resized with box downsampling to $3 2 \times 3 2$ pixels. Thus, this dataset is substantially harder than the original ImageNet dataset because the average number of pixels per image is now two orders of magnitude smaller. The new dataset is also more difficult than the CIFAR datasets because more classes are used and the relevant objects to be classified often cover only a tiny subspace of the image and not most of the image as in the CIFAR datasets. + +![](images/5dfdedd88ded2a58cd5402059f23bdeb3b206e82cfb5df1c9c28a04b45a45e3e.jpg) +Figure 4: (Top) Improvements obtained by the baseline learning rate schedule and SGDR w.r.t. the best known reference classification error on a dataset of electroencephalographic (EEG) recordings of brain activity for classification of actual right and left hand and foot movements of 14 subjects with roughly 1000 trials per subject. Both considered approaches were tested with the initial learning rate $l r = 0 . 0 2 5$ (Top-Left) and $l r = 0 . 0 5$ (Top-Right). Note that the baseline approach is considered with different settings of the total number of epochs: 30, 60, . . ., 480. (Bottom) SGDR with $l r = 0 . 0 2 5$ and $l r = 0 . 0 5$ without and with $M$ model snapshots taken at the last $M = n r / 2$ restarts, where $n r$ is the total number of restarts. + +We benchmarked SGD with momentum with the default learning rate schedule, SGDR with $T _ { 0 } =$ $1 , T _ { m u l t } = 2$ and SGDR with $T _ { 0 } = 1 0 , T _ { m u l t } = 2$ on WRN-28-10, all trained with 4 settings of the initial learning rate $\eta _ { m a x } ^ { i }$ : 0.050, 0.025, 0.01 and 0.005. We used the same data augmentation procedure as for the CIFAR datasets. Similarly to the results on the CIFAR datasets, Figure 5 shows that SGDR demonstrates better anytime performance. SGDR with $T _ { 0 } = 1 0 , T _ { m u l t } \stackrel { = } { = } 2 , \eta _ { m a x } ^ { i } =$ 0.01 achieves top-1 error of $3 9 . 2 4 \%$ and top-5 error of $1 7 . 1 7 \%$ matching the original results by AlexNets $4 0 . 7 \%$ and $1 8 . 2 \%$ , respectively) obtained on the original ImageNet with full-size images of ca. 50 times more pixels per image (Krizhevsky et al., 2012b). Interestingly, when the dataset is permuted only within 10 subgroups each formed from 100 classes, SGDR also demonstrates better results (see Figure 8 in the Supplementary Material). An interpretation of this might be that while the initial learning rate seems to be very important, SGDR reduces the problem of improper selection of the latter by scanning / annealing from the initial learning rate to 0. + +Clearly, longer runs (more than 40 epochs considered in this preliminary experiment) and hyperparameter tuning of learning rates, regularization and other hyperparameters shall further improve the results. + +![](images/edcfbdc72ca22c95d6c0b06c3715ba2b80be5349cf0ca5ae5f976abadf982d72.jpg) +Figure 5: Top-1 and Top-5 test errors obtained by SGD with momentum with the default learning rate schedule, SGDR with $T _ { 0 } = 1 , T _ { m u l t } = 2$ and SGDR with $T _ { 0 } = 1 0$ , $T _ { m u l t } = 2$ on WRN-28-10 trained on a version of ImageNet, with all images from all 1000 classes downsampled to $3 2 \times 3 2$ pixels. The same baseline data augmentation as for the CIFAR datasets is used. Four settings of the initial learning rate are considered: 0.050, 0.025, 0.01 and 0.005. + +# 5 DISCUSSION + +Our results suggest that even without any restarts the proposed aggressive learning rate schedule given by eq. (5) is competitive w.r.t. the default schedule when training WRNs on the CIFAR10 (e.g., for $T _ { 0 } = 2 0 0 , T _ { m u l t } = 1 )$ and CIFAR-100 datasets. In practice, the proposed schedule requires only two hyper-parameters to be defined: the initial learning rate and the total number of epochs. + +We found that the anytime performance of SGDR remain similar when shorter epochs are considered (see section 8.1 in the Supplemenary Material). + +One should not suppose that the parameter values used in this study and many other works with (Residual) Neural Networks are selected to demonstrate the fastest decrease of the training error. Instead, the best validation or $/$ and test errors are in focus. Notably, the validation error is rarely used when training Residual Neural Networks because the recommendation is defined by the final solution (in our approach, the final solution of each run). One could use the validation error to determine the optimal initial learning rate and then run on the whole dataset; this could further improve results. + +The main purpose of our proposed warm restart scheme for SGD is to improve its anytime performance. While we mentioned that restarts can be useful to deal with multi-modal functions, we do not claim that we observe any effect related to multi-modality. + +As we noted earlier, one could decrease $\eta _ { m a x } ^ { i }$ and $\eta _ { m i n } ^ { i }$ at every new warm restart to control the amount of divergence. If new restarts are worse than the old ones w.r.t. validation error, then one might also consider going back to the last best solution and perform a new restart with adjusted hyperparameters. + +Our results reproduce the finding by Huang et al. (2016a) that intermediate models generated by SGDR can be used to build efficient ensembles at no cost. This finding makes SGDR especially attractive for scenarios when ensemble building is considered. + +# 6 CONCLUSION + +In this paper, we investigated a simple warm restart mechanism for SGD to accelerate the training of DNNs. Our SGDR simulates warm restarts by scheduling the learning rate to achieve competitive results on CIFAR-10 and CIFAR-100 roughly two to four times faster. We also achieved new stateof-the-art results with SGDR, mainly by using even wider WRNs and ensembles of snapshots from + +SGDR’s trajectory. Future empirical studies should also consider the SVHN, ImageNet and MS COCO datasets, for which Residual Neural Networks showed the best results so far. Our preliminary results on a dataset of EEG recordings suggest that SGDR delivers better and better results as we carry out more restarts and use more model snapshots. The results on our downsampled ImageNet dataset suggest that SGDR might also reduce the problem of learning rate selection because the annealing and restarts of SGDR scan / consider a range of learning rate values. Future work should consider warm restarts for other popular training algorithms such as AdaDelta (Zeiler, 2012) and Adam (Kingma & Ba, 2014). + +Alternative network structures should be also considered; e.g., soon after our initial arXiv report (Loshchilov & Hutter, 2016), Zhang et al. (2016); Huang et al. (2016b); Han et al. (2016) reported that WRNs models can be replaced by more memory-efficient models. Thus, it should be tested whether our results for individual models and ensembles can be further improved by using their networks instead of WRNs. Deep compression methods (Han et al., 2015) can be used to reduce the time and memory costs of DNNs and their ensembles. + +# 7 ACKNOWLEDGMENTS + +This work was supported by the German Research Foundation (DFG), under the BrainLinksBrainTools Cluster of Excellence (grant number EXC 1086). We thank Gao Huang, Kilian Quirin Weinberger, Jost Tobias Springenberg, Mark Schmidt and three anonymous reviewers for their helpful comments and suggestions. + +# REFERENCES + +Antoine Bordes, Leon Bottou, and Patrick Gallinari. Sgd-qn: Careful quasi-newton stochastic gra-´ dient descent. The Journal of Machine Learning Research, 10:1737–1754, 2009. + +Anna Choromanska, Mikael Henaff, Michael Mathieu, Gerard Ben Arous, and Yann LeCun. The ´ loss surface of multilayer networks. arXiv preprint arXiv:1412.0233, 2014. + +Yann N Dauphin, Razvan Pascanu, Caglar Gulcehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In Advances in Neural Information Processing Systems, pp. 2933–2941, 2014. + +Yann N Dauphin, Harm de Vries, Junyoung Chung, and Yoshua Bengio. Rmsprop and equilibrated adaptive learning rates for non-convex optimization. arXiv preprint arXiv:1502.04390, 2015. + +L. Deng, G. Hinton, and B. Kingsbury. New types of deep neural network learning for speech recognition and related applications: An overview. In Proc. of ICASSP’13, 2013. + +J. Donahue, Y. Jia, O. Vinyals, J. Hoffman, N. Zhang, E. Tzeng, and T. Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In Proc. of ICML’14, 2014. + +Reeves Fletcher and Colin M Reeves. Function minimization by conjugate gradients. The computer journal, 7(2):149–154, 1964. + +Kenji Fukumizu and Shun-ichi Amari. Local minima and plateaus in hierarchical structures of multilayer perceptrons. Neural Networks, 13(3):317–327, 2000. + +Dongyoon Han, Jiwhan Kim, and Junmo Kim. Deep pyramidal residual networks. arXiv preprint arXiv:1610.02915, 2016. + +Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015. + +Nikolaus Hansen. Benchmarking a BI-population CMA-ES on the BBOB-2009 function testbed. In Proceedings of the 11th Annual Conference Companion on Genetic and Evolutionary Computation Conference: Late Breaking Papers, pp. 2389–2396. ACM, 2009. + +Nikolaus Hansen and Stefan Kern. Evaluating the cma evolution strategy on multimodal test functions. In International Conference on Parallel Problem Solving from Nature, pp. 282–291. Springer, 2004. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. arXiv preprint arXiv:1603.05027, 2016. + +Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E. Hopcroft, and Kilian Q. Weinberger. Snapshot ensembles: Train 1, get m for free. ICLR 2017 submission, 2016a. + +Gao Huang, Zhuang Liu, and Kilian Q Weinberger. Densely connected convolutional networks. arXiv preprint arXiv:1608.06993, 2016b. + +Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Weinberger. Deep networks with stochastic depth. arXiv preprint arXiv:1603.09382, 2016c. + +Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. + +A. Krizhevsky, I. Sutskever, and G. Hinton. Imagenet classification with deep convolutional neural networks. In Proc. of NIPS’12, pp. 1097–1105, 2012a. + +Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009. + +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, 2012b. + +Dong C Liu and Jorge Nocedal. On the limited memory bfgs method for large scale optimization. Mathematical programming, 45(1-3):503–528, 1989. + +Ilya Loshchilov and Frank Hutter. SGDR: Stochastic Gradient Descent with Restarts. arXiv preprint arXiv:1608.03983, 2016. + +Ilya Loshchilov, Marc Schoenauer, and Michele Sebag. Alternative restart strategies for CMA-ES. In International Conference on Parallel Problem Solving from Nature, pp. 296–305. Springer, 2012. + +Yurii Nesterov. A method of solving a convex programming problem with convergence rate o (1/k2). In Soviet Mathematics Doklady, volume 27, pp. 372–376, 1983. + +Yurii Nesterov. Introductory lectures on convex optimization: A basic course, volume 87. Springer Science & Business Media, 2013. + +Brendan O’Donoghue and Emmanuel Candes. Adaptive restart for accelerated gradient schemes. arXiv preprint arXiv:1204.3982, 2012. + +Hadi Pouransari and Saman Ghili. Tiny imagenet visual recognition challenge. CS231 course at STANFORD, 2015. + +Michael James David Powell. Restart procedures for the conjugate gradient method. Mathematical programming, 12(1):241–254, 1977. + +Mike Preuss. Niching the CMA-ES via nearest-better clustering. In Proceedings of the 12th annual conference companion on Genetic and evolutionary computation, pp. 1711–1718. ACM, 2010. + +Mike Preuss. Niching methods and multimodal optimization performance. In Multimodal Optimization by Means of Evolutionary Algorithms, pp. 115–137. Springer, 2015. + +Raymond Ros. Benchmarking the bfgs algorithm on the bbob-2009 function testbed. In Proceedings of the 11th Annual Conference Companion on Genetic and Evolutionary Computation Conference: Late Breaking Papers, pp. 2409–2414. ACM, 2009. + +Leslie N Smith. No more pesky learning rate guessing games. arXiv preprint arXiv:1506.01186, 2015. +Leslie N Smith. Cyclical learning rates for training neural networks. arXiv preprint arXiv:1506.01186v3, 2016. +Tianbao Yang and Qihang Lin. Stochastic subgradient methods with linear convergence for polyhedral convex optimization. arXiv preprint arXiv:1510.01444, 2015. +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. +Matthew D Zeiler. Adadelta: An adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012. +K. Zhang, M. Sun, T. X. Han, X. Yuan, L. Guo, and T. Liu. Residual Networks of Residual Networks: Multilevel Residual Networks. ArXiv e-prints, August 2016. + +# 8 SUPPLEMENTARY MATERIAL + +![](images/2e914475e7ea34de85b07237a7c7c57ae81524b5e8a2ef32ab2cf99c2d03e7b8.jpg) +Figure 6: The median results of 5 runs for the best learning rate settings considered for WRN-28-1. + +8.1 50K VS 100K EXAMPLES PER EPOCH + +Our data augmentation procedure code is inherited from the Lasagne Recipe code for ResNets where flipped images are added to the training set. This doubles the number of training examples per epoch and thus might impact the results because hyperparameter values defined as a function of epoch index have a different meaning. While our experimental results given in Table 1 reproduced the results obtained by Zagoruyko & Komodakis (2016), here we test whether SGDR still makes sense for WRN-28-1 (i.e., ResNet with 28 layers) where one epoch corresponds to $5 0 \mathrm { k }$ training examples. We investigate different learning rate values for the default learning rate schedule (4 values out of [0.01, 0.025, 0.05, 0.1]) and SGDR (3 values out of [0.025, 0.05, 0.1]). In line with the results given in the main paper, Figure 6 suggests that SGDR is competitive in terms of anytime performance. + +![](images/2f7c89b5cef976568af3fa70f8131ab79330ccbf256f8dee4ff5b844ad58f173.jpg) +Figure 7: Training cross-entropy $^ +$ regularization loss (top row), test loss (middle row) and test error (bottom row) on CIFAR-10 (left column) and CIFAR-100 (right column). + +![](images/9d2d2cb02d1c568b6f7a9925194f61ec66a074860b937949ee3f6ce968211768.jpg) +Figure 8: Top-5 test errors obtained by SGD with momentum with the default learning rate schedule and SGDR with $T _ { 0 } = 1 \mathrm { , } T _ { m u l t } = 2$ on WRN-28-10 trained on a version of ImageNet, with all images from all 1000 classes downsampled to $3 2 \times 3 2$ pixels. The same baseline data augmentation as for the CIFAR datasets is used. Three settings of the initial learning rate are considered: 0.050, 0.015 and 0.005. In contrast to the experiments described in the main paper, here, the dataset is permuted only within 10 subgroups each formed from 100 classes which makes good generalization much harder to achieve for both algorithms. An interpretation of SGDR results given here might be that while the initial learning rate seems to be very important, SGDR reduces the problem of improper selection of the latter by scanning / annealing from the initial learning rate to 0. \ No newline at end of file diff --git a/md/train/SylVNerFvr/SylVNerFvr.md b/md/train/SylVNerFvr/SylVNerFvr.md new file mode 100644 index 0000000000000000000000000000000000000000..7bb381ae89a7f7ab9d262c52377a7632df793ca3 --- /dev/null +++ b/md/train/SylVNerFvr/SylVNerFvr.md @@ -0,0 +1,290 @@ +# PERMUTATION EQUIVARIANT MODELS FOR COMPOSITIONAL GENERALIZATION IN LANGUAGE + +Jonathan Gordon∗ University of Cambridge jg801@cam.ac.uk + +David Lopez-Paz, Marco Baroni, Diane Bouchacourt Facebook AI Research {dlp, mbaroni, dianeb}@fb.com + +# ABSTRACT + +Humans understand novel sentences by composing meanings and roles of core language components. In contrast, neural network models for natural language modeling fail when such compositional generalization is required. The main contribution of this paper is to hypothesize that language compositionality is a form of group-equivariance. Based on this hypothesis, we propose a set of tools for constructing equivariant sequence-to-sequence models. Throughout a variety of experiments on the SCAN tasks, we analyze the behavior of existing models under the lens of equivariance, and demonstrate that our equivariant architecture is able to achieve the type compositional generalization required in human language understanding. + +# 1 INTRODUCTION + +When using language, humans recombine known concepts to understand novel sentences. For instance, if one understands the meaning of “run”, “jump”, and “jump twice”, then one understands the meaning of “run twice”, even if such sentence was never heard before. This relies on the notion of language compositionality, which states that the meaning of a sentence (“jump twice”) is to be obtained by the meaning of its constituents (e.g. the verb “jump" and the quantifying adverb “twice") and the use of algebraic computation (a verb combined with a quantifying adverb $m$ results in doing that verb $m$ times) (Kratzer & Heim, 1998). + +In the realm of machines, deep learning has achieved unprecedented results in language modeling tasks (Bahdanau et al., 2015; Vaswani et al., 2017). However, these models are sample inefficient, and do not generalize to examples that require the use of language compositionality (Lake & Baroni, 2018; Loula et al., 2018; Dessì & Baroni, 2019). This result suggests that deep language models fail to leverage compositionality; a failure remaining to this day a roadblock towards true natural language understanding. + +Focusing on this issue, Lake & Baroni (2018) proposed the Simplified version of the CommAI Navigation (SCAN), a dataset to benchmark the compositional generalization capabilities of state-ofthe-art sequence-to-sequence (seq2seq) translation models (Sutskever et al., 2014; Bahdanau et al., 2015). In a nutshell, the SCAN dataset contains compositional navigation commands such as JUMP TWICE AFTER RUN LEFT, to be translated into the sequence of actions LTURN RUN JUMP JUMP. + +Using SCAN, Lake & Baroni (2018) demonstrated that seq2seq models fail spectacularly at tasks requiring the use of language compositionality. Following our introductory example, models trained on the three commands JUMP, RUN and JUMP TWICE fail to generalize to RUN TWICE. Most recently, Dessì & Baroni (2019) showed that architectures based on temporal convolutions meet the same fate. + +SCAN did not only reveal the lack of compositionality in language models, but it also became the blueprint to build novel language models able to handle language compositionality. On the one hand, Russin et al. (2019) proposed a seq2seq model where semantic and syntactic information are represented separately, in a hope that such disentanglement would elicit compositional rules. However, their model was not able to solve all of the compositional tasks comprising SCAN. On the other hand, Lake (2019) introduced a meta-learning approach with excellent performance in multiple + +SCAN tasks. However, their method requires substantial amounts of additional supervision, and a complex meta-learning procedure hand-engineered for each task. + +In this paper, we take a holistic look at the problem and connect language compositionality in SCAN to the disparate literature in models equivariant to certain group symmetries (Kondor, 2008; Cohen & Welling, 2016; Ravanbakhsh et al., 2017; Kondor & Trivedi, 2018). Interesting links have recently been proposed between group symmetries and the areas of causality (Arjovsky et al., 2019) and disentangled representation learning (Higgins et al., 2018), and this work proceeds in a similar fashion. In particular, the main contribution of this work is not to chase performance numbers, but to put forward the novel hypothesis that language compositionality can be understood as a form of group-equivariance (Section 3). To sustain our hypothesis, we provide tools to construct seq2seq models equivariant when the group symmetries are known (Section 4), and demonstrate that these models solve all SCAN tasks, except length generalization (Section 6).1 + +# 2 THE SCAN COMPOSITIONAL TASKS + +The purpose of the Simplified version of the CommAI Navigation (SCAN) tasks (Lake & Baroni, 2018) is to benchmark the abilities of machine translation models for compositional generalization. Following prior literature (Lake & Baroni, 2018; Baroni, 2019; Russin et al., 2019; Andreas, 2019), compositional generalization is understood as the ability to translate novel families of sentences, when this requires leveraging the compositional structure in language. + +The SCAN dataset contains compositional navigation commands in English (the input-language) paired with a desired action sequence (the output-language). For instance, the input-language sentence JUMP TWICE AND RUN LEFT is paired to the output-language actions sequence JUMP JUMP LTURN RUN. The rest of our exposition uses SMALL CAPS to denote examples in the input-language, and LARGE CAPS to denote examples in the output-language. Appendix A contains a full description of the grammar generating the SCAN language. + +To evaluate the compositional generalization abilities of sequence-to-sequence (seq2seq) machine translation models (Sutskever et al., 2014; Bahdanau et al., 2015), Lake & Baroni (2018) proposes four main tasks based on SCAN: + +1. Simple task: data pairs are randomly split into training and test sets. No compositional generalization is required. +2. Add jump task: the only command in the training set containing the verb JUMP is the command JUMP. All commands not containing JUMP are in the training set (for instance, RUN TWICE, and WALK RIGHT THRICE AND LOOK LEFT). The test set contains all commands containing JUMP (for instance, JUMP TWICE, and RUN LEFT AND JUMP RIGHT). To succeed in this task, models must learn that JUMP is a verb, and that any verb can be composed with an adverbial number to be repeated a number of times. +3. Around right task: the phrase AROUND RIGHT is held out from the training set; however, both AROUND and RIGHT are shown in all other contexts (for example, AROUND LEFT or OPPOSITE RIGHT). To succeed at this task, models must learn that both RIGHT and LEFT are directions, and can be combined with AROUND and OPPOSITE. +4. Length generalization task: the training set contains pairs such that the length of the action sequence in the output-language is shorter than 24 actions. The test set contains all pairs with action sequences of a length greater or equal than 24 actions. The type of compositional ability required to succeed at this task is more difficult to sketch out, as we discuss in Section +6.2. + +Lake & Baroni (2018) use these four tasks to demonstrate that state-of-the-art seq2seq translation models (Bahdanau et al., 2015) succeed at Simple task, but fail at the other three tasks requiring compositional generalization. Convolutional architectures (Dessì & Baroni, 2019) achieve only slightly better performance, and state-of-the-art methods specially developed to address SCAN tasks fall short from the best achievable performance (Russin et al., 2019), or call for substantial amounts of additional supervision (Lake, 2019). + +In the following, we take a holistic look at the language compositionality problems in SCAN, and highlight their connection to equivariant maps in group theory. + +# 3 SCAN COMPOSITIONALITY AS GROUP EQUIVARIANCE + +This section puts forward the hypothesis that: + +Models achieving the compositional generalization required in certain SCAN tasks are equivariant with respect to permutation group operations2 in the input and output languages. + +To unfold the meaning of our hypothesis, we must revisit some basic concepts in group theory. A discrete group $G$ is a set of elements $\{ g _ { 1 } , \dotsc , g _ { | G | } \}$ , equipped with a binary group operation “·” satisfying the four group axioms (closure, associativity, identity, and invertibility). The sequel focuses on permutation groups $G$ , whose elements are permutations of a set $\mathcal { X }$ , and whose binary group operation composes the permutations contained in $G$ . The set of all permutations of $\mathcal { X }$ is a group, but not all subsets of permutations of $\mathcal { X }$ satisfy the four group axioms, and therefore they do not form a group. For each element $g \in G$ , we define the group operation $T _ { g } : \mathcal { X } \mathcal { X }$ as the map applying the permutation $g$ to the element $x \in \mathcal { X }$ , to obtain $T _ { g } x$ . Armed with these definitions, we are ready to introduce the main object of study in this paper: equivariant maps. + +Definition 1 (Equivariant map). Let $\mathcal { X }$ and $\mathcal { V }$ be two sets. Let $G$ be a group whose group operation on $\mathcal { X }$ is denoted by $T _ { g } : \mathcal { X } \mathcal { X }$ , and whose group operation on $\mathcal { V }$ is denoted by $T _ { g } ^ { \prime } : \mathcal { V } \to \mathcal { V }$ . Then, $\Phi : \mathcal { X } \mathcal { Y }$ is an equivariant map if and only if $\Phi \left( T _ { g } x \right) = T _ { g } ^ { \prime } \Phi ( x )$ for all $x \in \mathcal { X }$ and $g \in G$ . + +The operation groups $( T _ { g } , T _ { g } ^ { \prime } )$ defined above operate on entire sequences, an enormous space when we consider those sequences to be language sentences. In the following two definitions, we relax group operations and equivariant maps to operate at a word level. + +Definition 2 (Local group operations). Let $\mathcal { X }$ be a set of sequences (or sentences), where each sequence $x \in \mathcal { X }$ contains elements $x _ { i } \in \mathcal V$ from a vocabulary set $\nu$ , for all $x _ { i } \in x$ . Let $G$ be a group with associated group operation $T _ { g } : \mathcal { X } \mathcal { X }$ . Then, we say that $T _ { g }$ is a local group operation if there exists a group operation $T _ { g _ { w } } : \mathcal { V } \stackrel { \cdot } { \times } \mathcal { V }$ such that $T _ { g } x = ( T _ { g _ { w } } x _ { 1 } , \ldots , T _ { g _ { w } } x _ { L _ { x } } )$ for all $x \in \mathcal { X }$ . + +When understanding sequences as language sentences, the group operation $T _ { g _ { w } }$ would be a permutation of the words from the language vocabulary. Such operation can be implemented in terms of a permutation matrix, a $| \nu | \times | \nu |$ matrix with zero/one entries where each row and each column sum to one. Finally, we leverage the definition of local group operations to define locally equivariant maps. + +Definition 3 (Locally equivariant map). Let $\mathcal { X }$ and $\mathcal { V }$ be two sets of sequences. Let $G$ be a group whose group operation on $\mathcal { X }$ is local in its vocabulary, denoted by $T _ { g } : \mathcal { X } \mathcal { X }$ , and whose group operation on $\mathcal { V }$ is local in its vocabulary and denoted by $T _ { g } ^ { \prime } : \mathcal { V } \times \overset { \cdot } { \mathcal { V } }$ . Then, we say that $\Phi : \mathcal { X } \mathcal { Y }$ is an equivariant map if and only if $\Phi ( T _ { g } x ) = T _ { g } ^ { \prime } \Phi ( x )$ for all $x \in \mathcal { X }$ and $g \in G$ . + +![](images/62214294913b795f13f25fa3b0bb3772768f35b141b293fc27293c3c40b75421.jpg) +Figure 1: (a) Commutative diagram for equivariance. (b) Local equivariance enables generalization to verb replacement in SCAN. (c) Local equivariance does not enable generalization to conjunction replacement in SCAN. + +Now, how do equivariances and local equivariances manifest themselves in the world of SCAN? To assist our examples, the commutative diagram in Figure 1a summarizes the group theory notations introduced so far. In Figure 1b and Figure 1c, we parallel these notations to two different examples of compositional skills required to solve SCAN: verb and conjunction replacement. In the SCAN domain, $\mathcal { X }$ is the set of sentences in the input-language, and $\mathcal { V }$ is the set of sentences in the outputlanguage. Furthermore, let $\Phi$ be a locally equivariant SCAN translation model, and let $G$ be a group with associated local group operations that permutes words in the input- and output- languages. + +On the one hand, we observe in Figure 1b that local equivariance enables compositional generalization in the case of verb replacement. This is because replacing one verb in the input-language can be implemented in terms of a local group operation. In turn, this input-verb replacement corresponds deterministically to a second local group operation that replaces the corresponding verb in the output-language. The same would apply to a SCAN task where we are interested in generalizing to the replacement of LEFT and RIGHT. As such, a translation model $\Phi$ with these compositional generalization capabilities must be locally equivariant. + +On the other hand, we observe in Figure 1c that local equivariance is insufficient to enable compositional generalization in the case of conjunction replacement. This is because no local group operation in the output-language would be able to implement the necessary changes induced by the replacement of AND by AFTER in the input-language. In such cases, we refer to the equivariance as global equivariance. In particular, we can see how blocks of multiple words in the output-language swap their relative location. Local equivariances are also insufficient to enable compositional generalization in the Length generalization SCAN task and we elaborate on this in Section 6.2. + +In the following section, we propose a set of tools to implement equivariant seq2seq translation models, and propose a particular architecture with which we conduct our experiments. + +# 4 IMPLEMENTING AN EQUIVARIANT SEQUENCE-TO-SEQUENCE MODEL + +We now implement our proposed equivariant seq2seq model, following the encoder-decoder architecture illustrated in Figure 2. Readers unfamiliar with group theory may parse Figure 2 by temporarily discarding the $^ { 6 6 } G - '$ ” prefixes, and realize that each depicted module is a well-known building block of recurrent neural network models. + +![](images/de7e289be9fe669ae8e8d3f107fe9665a01367089f8c4a00e8f1c4e9a5d75256.jpg) +Figure 2: Architecture of our fully-equivariant seq2seq model. Variables shaded in gray are mappings $G \to \mathbb { R } ^ { K }$ , implemented as $| G | \times K$ matrices. Encoder and decoder meet at $\tilde { h } _ { 0 } : = h _ { L _ { x } }$ . + +To make our model equivariant, we will make intense use of group convolutions. + +Definition 4 (Group convolution (Kondor & Trivedi, 2018)). Let $G$ be a discrete group. Let $f : G $ $\mathbb { R } ^ { K }$ be an input function. Let $\psi = \{ \psi ^ { i } : G \to \mathbb { R } ^ { K } \} _ { i = 1 } ^ { K ^ { \prime } }$ be a set of learnable filter functions. Then, each scalar real entry from the result of $G$ -convolving $f$ and $\psi$ is given by a $| G | \times K ^ { \prime }$ matrix with entries + +$$ +G \mathrm { - } \mathrm { C o n v } ( f ; \psi ) _ { g , i } = \sum _ { h \in \mathrm { d o m } ( f ) } \sum _ { k = 1 } ^ { K } f _ { k } ( h ) \psi _ { k } ^ { i } ( g ^ { - 1 } h ) , +$$ + +for all $g \in G$ and $i \in \{ 1 , \ldots , K ^ { \prime } \}$ . As shown by (Kondor $\&$ Trivedi, 2018), the $G$ -Conv layer is equivariant wrt the operations of $G$ . We apply this definition in two ways: (i) “convolving” words with learnable filters to generate equivariant embeddings. Later, when we introduce our notations, we discuss how words may be viewed as functions so as to fit the definition. And (ii) convolving two group representations, in which case $\operatorname { d o m } ( f ) = G$ . + +We note that there are several additional methods proposed in the literature for constructing permutation equivariant layers (e.g. , Zaheer et al., 2017; Ravanbakhsh et al., 2017). However, as demonstrated by Kondor & Trivedi (2018); Bloem-Reddy & Teh (2019), the above form is very general and subsumes most alternatives. Further, while layers based on weight-sharing may be more efficient than the general form of Definition 4, the parameter tying restricts the capacity of the layer. For example, the permutation equivariant layer of Zaheer et al. (2017) requires weight matrices that are restricted to a form $\lambda I + { \overset { \cdot } { \gamma } } ( \mathbf { 1 1 } ) ^ { T }$ , with learnable parameters $\lambda$ and $\gamma$ . This layer has fewer learnable parameters than the convolutional form of Definition 4. Thus, for reasons of generality and capacity, we employ the general and expressive convolutional form of Definition 4 for our permutation equivariant layers. + +Equivariant with respect what group? The previous $G$ -Conv layer requires choosing a discrete group $G$ . As hinted in Section 3, we will choose $G$ to contain $| G |$ permutations of language vocabularies, e.g. products of cyclic groups on sets of words. Note that for a vocabulary size of $| V |$ , the set of all permutations has a size of $n !$ . However, it suffices to consider subgroups containing permutations such that every word can be reached by composing elements of the subgroup. For example, while the group of permutations on the four verbs in SCAN consists of 24 elements, it will suffice to choose $G$ as the circular shift group on the four verbs, which is a subgroup of four elements. Following standard notation in group theory, we write $g \cdot h$ to denote the composition of two group elements $g , h \in G$ , and $g ^ { - 1 }$ to denote the inverse element of $g$ . + +As final preliminaries, denoting $[ V ] = \{ 1 , \dots , | V | \}$ , we represent a word $w$ in the input-language by the function $w : [ V ] \to \{ 0 , 1 \}$ , where $\begin{array} { r } { \sum _ { v \in [ V ] } w ( v ) = 1 } \end{array}$ , and similarly by using $\tilde { w } \in \tilde { V }$ for the output-language. These notations are functional representations of word one-hot encodings that will play well with our notations. Note that this representation is equivalent to one-hot vectors, and in what follows we use the shorthand $w$ for the one-hot vector representation of words. + +To avoid notational clutter, we use $g$ to denote the permutation-matrix-representation of the corresponding group element. Thus, the group operation on a word gw can be implemented as matrix multiplication between the permutation matrix $g$ and the one-hot vector $w$ . Note that this operation results in another one-hot vector, i.e. another word in the vocabulary. Similarly, the binary group operation can be written as matrix multiplication $g h$ between two group members $g , h \in G$ . Here too, multiplication of permutation matrices results in permutation matrix, so $g h \in G$ . + +We now describe each of the components in our $G$ -equivariant translation model, by following the transformation process of an input sequence $x = ( w _ { 1 } , \ldots , w _ { L _ { x } } )$ (in SCAN, a navigation command in English) into its output translation $y = ( \tilde { w } _ { 1 } , \dots , \tilde { w } _ { L _ { y } } )$ (in SCAN, a sequence of actions). + +# 4.1 G-EQUIVARIANT ENCODER + +Upon arrival, the input-language sentence $x = ( w _ { 1 } , \dots , w _ { L _ { x } } )$ is sent to a $G$ -equivariant encoder. The first step in the encoding process is to transform each input word $w _ { t }$ into a permutation equivariant embedding $e ( w _ { t } )$ . As mentioned before, each word $w _ { t }$ is represented by the one-hot vector $w _ { t } :$ $[ V ] \{ 0 , 1 \}$ . The corresponding embedding is obtained by applying a set of $K$ 1-dimensional learnable filter functions $\{ \bar { \psi } ^ { i } : [ V ] \stackrel { - } { \to } \mathbb { R } \} _ { i = 1 } ^ { K }$ in a group convolution (throughout the section, we use $K$ everywhere to ease notation). Using Definition 4, the embedding, which we call $G$ -Embed, is then represented as a matrix $\mathbb { R } ^ { | G | \times K }$ , where + +$$ +e ( w ) _ { g , i } = G \mathrm { - E m b e d } ( w ; \psi ) _ { g , i } = \psi ^ { i } ( g ^ { - 1 } w ) , +$$ + +for all $g \in G$ and $i = \{ 1 , \ldots , K \}$ . Note that since $w$ is a one-hot vector, $G$ -Embed is a particularly simple instantiation of Definition 4, as summation over $\operatorname { d o m } ( f )$ consists of only a single term. The corresponding embedding is a function $e ( w _ { t } ) : G \to \mathbb { R } ^ { K }$ , which can be represented as a $| G | \times K$ matrix, where each row corresponds to the embedding of the word $g w$ for a particular $g \in G$ . This layer can be implemented by defining $\psi$ with standard deep learning embedding modules.3 + +Importantly, we note that for this layer, both $\psi$ and $w$ are functions on $[ V ]$ . However, the resulting embedding $e ( w )$ is a function on the group $G$ . Therefore, in all subsequent computations we will require the learnable filters $\psi$ to also be functions on $G$ . + +We illustrate this layer with an example. Let $G$ be the cyclic group that permutes the words LEFT and RIGHT. We can think of $g _ { 1 }$ as the identity, and $g _ { 2 }$ as permuting the words LEFT and RIGHT (leaving all other words unchanged). In this case, embedding LEFT results in the $2 \times K$ matrix $[ \psi ( \mathrm { L E F T } ) ^ { T } , \psi ( \mathrm { R I G H T } ) ^ { T } ] ^ { T }$ , while embedding JUMP results in $\mathsf { \bar { \Psi } } ( \mathbf { J } \mathbf { U } \mathbf { M } \mathbf { P } ) ^ { T } , \psi ( \mathbf { J } \mathbf { U } \mathbf { M } \mathbf { P } ) ^ { T } ] ^ { T }$ , since both $g _ { 1 }$ and $g _ { 2 }$ act as the identity permutation for JUMP. + +Next, the word embedding $e ( w _ { t } )$ is sent to a permutation equivariant Recurrent Neural Network ( $G$ -RNN). The cells of a $G$ -RNN mimic those of a standard RNN, where linear transformations are replaced by $G$ -Convs (Definition 4). This cell receives two inputs (the word embedding $e ( w _ { t } )$ and the previous hidden state $h _ { t - 1 }$ ) and returns one output (the current hidden state $h _ { t }$ ), all three being functions $G \to \mathbb { R } ^ { K }$ , parametrized as $| G | \times K$ matrices. More specifically: + +$$ +h _ { t } = G \mathrm { - R N N } ( e ( w _ { t } ) , h _ { t - 1 } ) = \sigma ( G \mathrm { - C o n v } ( h _ { t - 1 } ; \psi _ { h } ) + G \mathrm { - C o n v } ( e ( w _ { t } ) ; \psi _ { e } ) ) , +$$ + +where $\psi _ { h } , \psi _ { e } \colon G \to \mathbb { R } ^ { K }$ are learnable filters (represented as $| G | \times K$ matrices), and $\sigma$ is a point-wise activation function. + +The cell $G$ -RNN is equivariant because the sum of two equivariant representations is equivariant (Cohen & Welling, 2016), and the pointwise transformation of an equivariant representation is also equivariant. To initialize the hidden state, we set $h _ { 0 } = \vec { 0 }$ . We note that our experiments use the equivariant analog of LSTM cells (Hochreiter & Schmidhuber, 1997), which we denote $G$ -LSTM, since these achieved the best performance. We include the architecture of $G$ -LSTM cells in Appendix B. + +This completes the description of our equivariant encoder, illustrated in Figure 2a. + +# 4.2 G-EQUIVARIANT DECODER + +Once the entire input-language sentence $x = ( w _ { 1 } , \ldots , w _ { L _ { x } } )$ has been encoded into the hidden representations $h = ( h _ { 1 } , \ldots , h _ { L _ { x } } )$ , we are ready to start the decoding process that will produce the output-language translation $y = ( \tilde { w } _ { 1 } , \dots , \tilde { w } _ { L _ { y } } )$ . + +As illustrated in Figure 2b, our equivariant decoder is also run by an equivariant recurrent cell $G$ -RNN. We denote the hidden states of the recurrent decoding process by $\tilde { h } _ { t }$ , where $\tilde { h } _ { 0 } = h _ { L _ { x } }$ . At time $t$ , the two inputs to the decoding $G$ -RNN cell are the previous hidden state $\tilde { h } _ { t - 1 }$ as well as an attention ${ { \bar { a } } _ { t } }$ over all the encoding hidden states $h$ . (Once again, all variables are mappings $G \to \mathbb { R } ^ { K }$ implemented as $| G | \times K$ matrices.) + +Attention mechanisms (Bahdanau et al., 2015; Vaswani et al., 2017) have emerged as a central tool in language modelling. Fortunately, attention mechanisms are typically implemented as linear combinations, and a linear combination of equivariant representations is itself an equivariant representation. We now leverage this fact to develop an equivariant attention mechanism. Given all the encoder hidden states $h$ , as well as the previous decoding hidden state $\tilde { h } _ { t - 1 }$ , we propose the equivariant analog of dot-product attention (Luong et al., 2015) as + +$$ +\begin{array} { r l } & { \bar { a _ { t } } = G \mathrm { - } \mathrm { A t t e n t i o n } ( \tilde { h } _ { t - 1 } , h ) = \displaystyle \sum _ { j = 1 } ^ { L _ { x } } \alpha _ { t , j } h _ { j } \mathrm { , ~ w h e r e ~ } } \\ & { \alpha _ { t , j } = \displaystyle \frac { \exp \beta _ { t , j } } { \sum _ { k = 1 } ^ { L _ { x } } \exp \beta _ { t , k } } \mathrm { , ~ a n d ~ } \beta _ { t , j } = \displaystyle \sum _ { g \in G } \tilde { h } _ { t - 1 } ( g ) ^ { \top } h _ { j } ( g ) . } \end{array} +$$ + +Following Figure 2b, the attention $\bar { a _ { t } }$ and a $G$ -embedding $e ( \tilde { w } _ { t - 1 } )$ for the previous output word are concatenated and sent to a $G$ -Convolution.4 The concatenation with $e ( \tilde { w } _ { t - 1 } )$ provides the decoder with information regarding the previously embedded word. In practice, during training we use teacher-forcing (Williams $\&$ Zipser, 1989) to provide the decoder with information about the correct output sequences. This process returns a final hidden representation $\phi : G \to \mathbb { R } ^ { K }$ . + +As a final step in the decoding process, we need to convert $\phi$ into a collection of logits over the output-language vocabulary. Then, sampling from the categorical distribution induced by these logits at time $t$ (or taking the maximimum) will produce the word $\tilde { w } _ { t }$ , to be appended in the output-language translation, $y$ . This final decoding module can be implemented as follows: + +$$ +G \mathrm { - D e c o d e } ( \phi ; \psi ) _ { \tilde { w } } = \sum _ { h \in G } \sum _ { k = 1 } ^ { K } \phi _ { k } ( h ) \psi _ { k } ( h ^ { - 1 } \tilde { w } ) , +$$ + +where $\psi = [ \tilde { V } ] \mathbb { R } ^ { k }$ are the learnable parameters of this layer (represented by a $| \tilde { V } | \times K$ matrix). + +Recall that $\phi ( h ) \in \mathbb { R } ^ { K }$ is the final-layer representation for the group element $h$ , and that $h ^ { - 1 } \tilde { w }$ is the inverse element of $h \in G$ applied to the output word $\tilde { w }$ (represented as a one-hot vector), which results in another word in the output language. Thus, $\psi$ is a learnable embedding of the output words into $\mathbb { R } ^ { K }$ . This layer is evaluated at every $\tilde { w }$ in the output vocabulary to produce a scalar. The resulting vector of logits represents a categorical distribution over the output vocabulary. While similar, this layer is not a group convolution (Definition 4). Rather, equivariance for this module is achieved via parameter-sharing (Ravanbakhsh et al., 2017). + +This completes the description of our equivariant decoder, illustrated in Figure 2b. Composing the equivariant encoder and decoder results in our complete sequence-2-sequence model. Importantly, since all operations in this model are equivariant, the complete model is itself also equivariant to the group $G$ (Kondor & Trivedi, 2018). In Section 6, we provide further implementation details for our model, and detail our empirical evaluation of its equivariant properties and their relation to the SCAN tasks described in Section 2. + +# 5 RELATED WORK + +In this section we review state-of-the-art methods to address SCAN compositional tasks. We focus on two recent models that we will compare to in our experiments. + +On the one hand, the syntactic attention model of Russin et al. (2019) builds on the idea that compositional generalization can be achieved by language models given the correct architectural organization. Borrowing inspiration from neuroscience, Russin et al. (2019) argue that compositionality might arise when using separate processing channels for semantic and syntactic information. In their model, the attention weights depend on a recurrent encoding of the input sequence, which they refer to as the syntactic representation. The attention weights are then applied to separate, context-independent embeddings of the words in the input sequence, which intend to model a semantic representation. We find (Russin et al., 2019) interesting from a group equivariance perspective, since one way to enforce equivariance is to use an invariant representation (about syntax) together with an additional representation (about semantics) that maintains the information about the original “sentence pose”. + +On the other hand, the meta-learning (Thrun & Pratt, 2012; Schmidhuber, 1987) approach of Lake (2019) is a model that learns to generalize. In particular, Lake (2019) designs one specific and complex meta-learning procedure for each SCAN task, where a distribution over tasks is provided to the learner (Finn et al., 2017; Gordon et al., 2018). For example, in the Add jump and Around right tasks, the meta-learning procedure of Lake (2019) samples permutations from the relevant groups (the permutation groups on the verbs and set of directions, respectively). This is interpreted as data-augmentation, a valid procedure for encouraging equivariance (Cohen & Welling, 2016; Andreas, 2019; Weiler et al., 2018). However, at test-time, Lake (2019) sets the context set to the correct mapping between the permuted commands and their corresponding actions. For example, in the Add jump task, the context set for meta-testing would consist of the following pairs: {(WALK, WALK), (RUN, RUN), (LOOK, LOOK), (JUMP, JUMP) }. This is equivalent to providing the model with one-to-one information regarding the correct command-to-action mapping for the permuted words. + +# 6 EXPERIMENTS + +We now evaluate the empirical performance of our equivariant seq2seq model (described in Section 4) on the four SCAN tasks (described in Section 2). We compare our equivariant seq2seq to regular seq2seq models (Lake & Baroni, 2018), convolutional models (Dessì & Baroni, 2019), the syntactic attention model of Russin et al. (2019), and the meta-learning approach of Lake (2019). The compared seq2seq models use bi-directional, single-layer LSTM cells with 64 hidden units. For the equivariant seq2seq models, we use the cyclic permutation group on the verbs for the Add jump task, and the cyclic permutation group on directions for the Around right task. For Length, we use the product of those groups. Our model knows that the same group operates on both the input- and output- languages. However, it does not receive information regarding the correspondence between commands and actions in the set of words being permuted in the input / output languages. This is in contrast to Lake (2019), where (as stated in Section 5), it is necessary to provide the model with explicit information regarding the correct command-to-action mapping at test-time. + +
ModelSimpleAdd JumpAround RightLength
seq2seq (Lake & Baroni, 2018)99.71.2NA13.8
CNN (Dessi & Baroni, 2019)100.069.2 ± 9.256.7±10.20.0
Syntactic Attention (Russin et al., 2019)100.091.0± 27.428.9±34.815.2 ± 0.7
Meta seq2seq (Lake, 2019)NA99.999.9*16.64
seq2seq (comparable architecture)100.00.0±0.00.02 ±2e-212.4 ± 2.3
Equivariant seq2seq (ours)100.099.1 ± 0.0492.0 ± 0.2415.9 ± 3.2
+ +Table 1: Test accuracies for four SCAN tasks, comparing our equivariant seq2seq to the state-of-the-art. + +Training procedures match those of Lake & Baroni (2018) where possible. We train models for $2 0 0 k$ iterations, where each iteration consists of a minibatch of size 1, using the Adam optimizer to perform parameter updates with default parameters (Kingma & Ba, 2015) with a learning rate of 1e-4. We use teacher-forcing (Williams & Zipser, 1989) with a ratio of 0.5, and early-stopping based on a validation set consisting on $1 0 \%$ of the training examples. As in previous works, we compute test accuracies by counting how many exact translations each model provides, across the test set associated to each task. + +# 6.1 RESULTS + +Table 1 summarizes the results of our experiments. First and as expected, all models achieve excellent performance on the Simple task, which does not require any form of compositional generalization. + +Second, our equivariant seq2seq model performs very well at the Add jump and Around right SCAN tasks, which are the two tasks satisfying our local equivariance assumption from Definition 3. Our equivariant seq2seq model significantly outperforms the regular seq2seq (Lake & Baroni, 2018) and convolutional (Dessì & Baroni, 2019) models, as well as the state-of-the-art methods of Russin et al. (2019) and Lake (2019). This result is an encouraging piece of evidence supporting our main hypothesis from Section 3. Next, let us compare the results of our equivariant seq2seq model with the previous state-of-the-art Russin et al. (2019); Lake (2019) in more detail. + +On the one hand, the syntactic attention model of Russin et al. (2019) achieves significant improvements over baselines methods at the Add jump SCAN task. However, it does not fare so well on the Around right task. Furthermore, its performance has high variance. Although we here report the numbers from Russin et al. (2019), we observed such high variance in our own implementation as well, where the model often achieved $0 \%$ test accuracy. We hypothesize that modeling the invariance of the syntactic attention directly would result in improved performance and stability. This can be achieved, for instance, by replacing all verbs in the syntactic module by a shared word. As expected, by explicitly exploiting equivariance, our model outperforms Russin et al. (2019) on the Add jump and Around right SCAN tasks, also being much more robust. + +On the other hand, the meta-learning model of Lake (2019) achieves excellent performance on the local equivariance tasks Add jump and Around right. This is additional evidence supporting the usefulness of local equivariance. In contrast to our model, Lake (2019) requires (i) a complicated model and training procedure tailored to each task, (ii) providing the model with the correct permutation of words, equivalent to telling the model the “true” mappings between the input and output words, and (iii) augmenting the set of words being permuted, to ensure enough diversity in the training distribution (for instance, adding additional directions beyond RIGHT and LEFT). + +As seen in Table 1, length generalization remains a tough challenge in SCAN. While generating long sequences is a known challenge in seq2seq models (Bahdanau et al., 2015), we believe that this is not the main issue with our equivariant seq2seq model, as it is able to produce long translations when these appear in the training set (as are the other models). Therefore, this is not a capacity problem, but one of not being able to express the Length generalization SCAN task in terms of local equivariances on both input- and output- languages. We hypothesize that this is the very reason why (Russin et al., 2019; Lake, 2019) also fail on this task. + +However, we suspect that some forms of local equivariance on the input language, but global equivariance on the output language, may help. For example, RUN TWICE, RUN THRICE and RUN AROUND LEFT TWICE are all input commands contained in the training set of the length task. A trained seq2seq model is able to execute them, but fails on the unseen test command RUN AROUND LEFT THRICE, suggesting that the network did not correctly understand the relationship between TWICE and THRICE. Using a network that is explicitly equivariant to the permutation of TWICE and THRICE should be able to generalize correctly on RUN AROUND LEFT THRICE. However, while the TWICE-THRICE permutation is a local group operation (Definition 2), the corresponding operation on the output language, which is to repeat the same action sequence multiple times, is a global group operation. Similarly, permuting AND and AFTER in the input sequence using a local group operation, while operating globally on the output language by permuting the order of the associated actions, should help succeed on the Length generalization SCAN task. How to formalize the aforementioned global operations on the output language and build the desired equivariant network remains a fascinating open research question that we leave for future work. + +# 7 DISCUSSION AND FUTURE WORK + +This work has introduced hypothesis linking between group equivariance and compositional generalization in language. Motivated by this hypothesis, we have proposed an equivariant seq2seq translation model, which achieves state-of-the-art performance on a variety of SCAN tasks. + +Our work has several points for improvement. Most importantly, our model requires knowing the permutation symmetries of interest, to be provided by some domain expert. While this is simple to do in the synthetic language of SCAN, it may prove more difficult in real-world tasks. We propose three directions to attack this problem. (i) Group words by their parts-of-speech (e.g., nouns, verbs, etc.), which can be done automatically by standard part-of-speech taggers (Màrquez & Rodríguez, 1998); (ii) Learn such groupings of words from corpora, for example using the recent work of Andreas (2019); (iii) Most appealingly, parameterize the symmetry group and learn operations end-to-end while enforcing the group structure. For permutation symmetries, the group elements can be parameterized by permutation matrices, and learned from data (Lyu et al., 2019). Our preliminary work in this direction hints that this is a fruitful avenue for future research. + +A further consideration to address is that of computational overhead. In particular, for the convolutional form we use in this work (Definition 4), computational complexity scales linearly with the size of the group, $\mathcal { O } ( | G | )$ . This arises from the need to sum over group elements when the representation is a function on $G$ , and may be prohibitive when considering large groups. One way of addressing this issue when large symmetry groups are of interest is to consider more efficient computational layers for permutation equivariance (e.g Zaheer et al., 2017; Ravanbakhsh et al., 2017). These methods incur less computational overhead at the cost of restricting the layer capacity. Another interesting option for future research is to consider sub-sampling group elements when performing the summation in Definition 4, which requires further consideration of the consequences of doing so. + +Another exciting direction for future research is to consider global equivariances. Many operations of interest, e.g. groups operating directly on parse trees, can only be expressed as global equivariances. Modeling these equivariances holds exciting possibilities for capturing non-trivial symmetries in language tasks, but also requires more sophisticated machinery than is proposed in this work. + +Finally, in further theoretical work, we would like to explore the relation between our equivariance framework and the idea of compositionality in formal semantics (Kratzer & Heim, 1998). On the one hand, the classic idea of compositionality as an isomorphism between syntax and semantics is intuitively related to the notion of group equivariance. On the other hand, as shown by the failures at the length generalization example, it is still unclear how to apply our ideas to more sophisticated forms of permutation, such as those involving grammatical phrases rather than words. This would also require to extend our approach to account for the context-sensitivity that pervades linguistic composition (c.f., the natural interpretation of “run” in “run the marathon” vs. ”run the code”). + +# ACKNOWLEDGMENTS + +We thank Emmanuel Dupoux and Clara Vania for helpful feedback and discussions. + +# REFERENCES + +Jacob Andreas. Good-enough compositional data augmentation, 2019. + +Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019. + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proceedings of ICLR Conference Track, San Diego, CA, 2015. Published online: http://www.iclr.cc/doku.php?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ iclr2015:main. + +Marco Baroni. Linguistic generalization and compositionality in modern artificial neural networks. arXiv preprint arXiv:1904.00157, 2019. + +Benjamin Bloem-Reddy and Yee Whye Teh. Probabilistic symmetry and invariant neural networks. arXiv preprint arXiv:1901.06082, 2019. + +Taco Cohen and Max Welling. Group equivariant convolutional networks. In International conference on machine learning, pp. 2990–2999, 2016. + +Roberto Dessì and Marco Baroni. CNNs found to jump around more skillfully than RNNs: Compositional generalization in seq2seq convolutional networks. arXiv preprint arXiv:1905.08527, 2019. + +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. + +Jonathan Gordon, John Bronskill, Matthias Bauer, Sebastian Nowozin, and Richard E Turner. Metalearning probabilistic inference for prediction. arXiv preprint arXiv:1805.09921, 2018. + +Irina Higgins, David Amos, David Pfau, Sebastien Racaniere, Loic Matthey, Danilo Rezende, and Alexander Lerchner. Towards a definition of disentangled representations. arXiv preprint arXiv:1812.02230, 2018. + +Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In In International Conference on Learning Representations (ICLR), 2015. + +Imre Risi Kondor. Group theoretical methods in machine learning. Columbia University, 2008. + +Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups. arXiv preprint arXiv:1802.03690, 2018. + +Angelika Kratzer and Irene Heim. Semantics in generative grammar, volume 1185. Blackwell Oxford, 1998. + +Brenden M Lake. Compositional generalization through meta sequence-to-sequence learning. arXiv preprint arXiv:1906.05381, 2019. + +Brenden M. Lake and Marco Baroni. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholm, Sweden, pp. 2879–2888, 2018. + +João Loula, Marco Baroni, and Brenden Lake. Rearranging the familiar: Testing compositional generalization in recurrent networks. pp. 108–114, 01 2018. doi: 10.18653/v1/W18-5413. + +Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attention-based neural machine translation. arXiv preprint arXiv:1508.04025, 2015. + +Jiancheng Lyu, Shuai Zhang, Yingyong Qi, and Jack Xin. AutoShuffleNet: Learning permutation matrices via an exact lipschitz continuous penalty in deep convolutional neural networks. arXiv preprint arXiv:1901.08624, 2019. + +Lluís Màrquez and Horacio Rodríguez. Part-of-speech tagging using decision trees. In European Conference on Machine Learning, pp. 25–36. Springer, 1998. + +Siamak Ravanbakhsh, Jeff Schneider, and Barnabas Poczos. Equivariance through parameter-sharing. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2892– 2901. JMLR. org, 2017. + +Jake Russin, Jason Jo, and Randall C O’Reilly. Compositional generalization in a deep seq2seq model by separating syntax and semantics. arXiv preprint arXiv:1904.09708, 2019. + +Jürgen Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to learn: the meta-meta-... hook. PhD thesis, Technische Universität München, 1987. + +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014. + +Sebastian Thrun and Lorien Pratt. Learning to learn. Springer Science & Business Media, 2012. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017. + +Maurice Weiler, Fred A Hamprecht, and Martin Storath. Learning steerable filters for rotation equivariant cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 849–858, 2018. + +Ronald J Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural computation, 1(2):270–280, 1989. + +Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan R Salakhutdinov, and Alexander J Smola. Deep sets. In Advances in Neural Information Processing Systems, pp. 3394–3404, 2017. + +# A DETAILS ON THE SCAN DATASET + +SCAN is composed from a non-recursive grammar, as shown in Figure 3. In particular, SCAN consists of all commands that can be generated from this grammar (20,910 command sequences), with their deterministic mapping into actions, as detailed by Figure 4 + +$$ +{ \begin{array} { r l r l } & { \mathbf { C } \to \mathbf { S } { \mathrm { ~ a n d ~ } } \mathbf { S } } & & { \mathbf { V } \to \mathbf { D } [ 1 ] { \mathrm { ~ o p p o s i t e ~ } } \mathbf { D } [ 2 ] } & { \mathbf { D } \to { \mathrm { t u r n ~ l e f t } } } \\ & { \mathbf { C } \to \mathbf { S } { \mathrm { ~ a f t e r ~ } } \mathbf { S } } & & { \mathbf { V } \to \mathbf { D } [ 1 ] { \mathrm { ~ a r o u n d ~ } } \mathbf { D } [ 2 ] } & { \mathbf { D } \to { \mathrm { t u r n ~ r i g h t } } } \\ & { \mathbf { C } \to \mathbf { S } } & & { \mathbf { V } \to \mathbf { D } } & & { \mathbf { U } \to \mathbf { w a l k } } \\ & { \mathbf { S } \to \mathbf { V } { \mathrm { ~ t w i c e } } } & & { \mathbf { V } \to \mathbf { U } } & { \mathbf { U } \to \mathrm { l o o k } } \\ & { \mathbf { S } \to \mathbf { V } { \mathrm { ~ t h r i c e } } } & & { \mathbf { D } \to \mathbf { U } \mathrm { l e f t } } & { \mathbf { U } \to \mathrm { r u n } } \\ & { \mathbf { S } \to \mathbf { V } } & & { \mathbf { D } \to \mathbf { U } { \mathrm { ~ r i g h t } } } & { \mathbf { U } \to \mathbf { j u m p } } \end{array} } +$$ + +Figure 3: The grammar used to generate commands in the SCAN domain. Indexing notation is used to allow infixing: read ${ \bf \widehat { \mathbf { } } } D [ i ]$ as “the $_ { i }$ -th element directly dominated by category $D '$ . Image borrowed from Lake & Baroni (2018). + +![](images/b2b3db604764fa21c60f32c6a50a99b4b1e8272cd16c2c2509857634fbf767cf.jpg) +Figure 4: The SCAN translation mapping. Double brackets denote the interpretation function translating SCAN’s command (input language) into the action (output) language (which are denoted by upper-case strings. Image borrowed from Lake & Baroni (2018). + +# B G-LSTM DETAILS + +We provide the equations for implementing our G-LSTM. Given $h _ { t - 1 } , c _ { t - 1 }$ (hidden state and cellstate, respectively), and $e ( w ) _ { t }$ (all of which are of the form $G \mapsto \mathbb { R } ^ { K }$ , we can describe the G-LSTM cell as follows: + +$$ +\begin{array} { r l r l } & { i _ { t } = \sigma \left( { \pmb x } _ { t } \ast \psi _ { i i } + s _ { t - 1 } \ast \psi _ { i h } \right) ; \quad \quad \quad } & & { f _ { t } = \sigma \left( { \pmb x } _ { t } \ast \psi _ { f i } + s _ { t - 1 } \ast \psi _ { f h } \right) } \\ & { g _ { t } = \operatorname { t a n h } \left( { \pmb x } _ { t } \ast \psi _ { g i } + s _ { t - 1 } \ast \psi _ { g h } \right) ; \quad \quad \quad } & & { o _ { t } = \sigma \left( { \pmb x } _ { t } \ast \psi _ { o i } + s _ { t - 1 } \ast \psi _ { o h } \right) } \\ & { c _ { t } = f _ { t } \circ { \pmb c } _ { t - 1 } + i _ { t } \circ g _ { t } ; \quad \quad \quad } & & { h _ { t } = o _ { t } \operatorname { c a n h } ( { \pmb c } _ { t } ) , } \end{array} +$$ + +where $\{ \psi _ { j k } : G \mapsto \mathbb { R } ^ { K } ; j \in \{ i , f , g , o \} ; k \in \{ i , h \} \}$ are the learnable filters of the cell. Here we have used the shorthand + +$$ +\pmb { f } \ast \pmb { \psi } : = \left[ \pmb { f } \ast \pmb { \psi } \right] ( \pmb { g } ) \quad \forall \pmb { g } \in G +$$ + +for two functions on the group. \ No newline at end of file diff --git a/md/train/SyxZOsA9tX/SyxZOsA9tX.md b/md/train/SyxZOsA9tX/SyxZOsA9tX.md new file mode 100644 index 0000000000000000000000000000000000000000..80d5af51e6bad4e61ef26641ceaceb72bb9bd136 --- /dev/null +++ b/md/train/SyxZOsA9tX/SyxZOsA9tX.md @@ -0,0 +1,424 @@ +# ACCELERATED VALUE ITERATION VIA ANDERSON MIXING + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Acceleration for reinforcement learning methods is an important and challenging theme. We introduce the Anderson acceleration technique into the value iteration, developing an accelerated value iteration algorithm that we call Anderson Accelerated Value Iteration (A2VI). We further apply our method to the Deep Q-learning algorithm, resulting in the Deep Anderson Accelerated Q-learning (DA2Q) algorithm. Our approach can be viewed as an approximation of the policy evaluation by interpolating on historical data. A2VI is more efficient than the modified policy iteration, which is a classical approximate method for policy evaluation. We give theoretical analysis of our algorithm and conduct experiments on both toy problems and Atari games. Both the theoretical and empirical results show the effectiveness of our algorithm. + +# 1 INTRODUCTION + +In reinforcement learning (Sutton & Barto, 1998), an agent seeks for the optimal policy in a specific sequential decision problem. Several algorithms have been proposed over the course of time, including the famous Q-learning (Watkins & Dayan, 1992), SARSA (Rummery & Niranjan, 1994; Sutton & Barto, 1998), and policy gradient methods (Sutton et al., 2000). In complicated decision problems where tabular representations are intractable, function approximations are usually used for estimating state-action values (Kaelbling et al., 1996; Sutton & Barto, 1998; Sutton et al., 2000). Inspired by the success of deep learning, Deep Q-Learning (DQN) (Mnih et al., 2013) and its variants (Bellemare et al., 2017; Schaul et al., 2015; Van Hasselt et al., 2016; Wang et al., 2015) utilize a deep neural network as the value approximator, which has successfully solved end-to-end decision problems such as Atari2000. + +The value iteration (VI) Bellman (1957) and policy iteration (PI) (Howard, 1964) are the most classical methods for value updating. The main difference between them is that PI evaluate the current policy accurately during the iteration while VI does not. Thanks to the accurate evaluation of the current policy, policy iteration uses significantly less policy improvement steps to converge to the optimal value. Although PI has a faster convergence rate than VI, most of the existing methods employ a rather slow value iteration procedure, because thoroughly evaluating a policy is costly or even intractable under complex environments. To retain the fast convergence property of policy iteration while reducing its computation overhead, researchers have proposed several modifications to the original policy iteration (Alla et al., 2015; Puterman, 1994). The modified policy iteration (MPI) method (Puterman, 1994) tries to deal with this problem by approximating the solution to policy evaluation via the truncated Neumann expansion of an inverse matrix. However, this approximation requires extra iterative steps, which is still computationally inefficient for complex decision problems where sampling is costly, compared with the value iteration procedure where the policy iteration step is skipped. + +Interpolation methods have been widely used in first order optimization problems (Bubeck et al., 2015; Scieur et al., 2016; 2017; Xie et al., 2018). These methods extract information from historical data and are proven to converge faster than vanilla gradient methods. However, the interpolation method is not widely applied in reinforcement learning. The most recent work related to interpolation is the averaged-DQN (Anschel et al., 2016), which calculates the average Q-value over the history and demonstrated that such an operation is effective for variance reduction. + +Acceleration in value iteration and policy iteration has attracted researchers’ great attention. Classical methods for accelerating value iteration include Gauss-Seidel value iteration (Puterman, 1994) and Jacobi value iteration (JAC) (Puterman, 1994). More recently, Alla et al. (2015) proposed an acceleration method that switches between a coarse-mesh value iteration and a fine-mesh policy iteration during different stages. Laurini et al. (2016) performed a Jacobi-like acceleration method on dynamic programming problems. In a recent work (Laurini et al., 2017), the value iteration procedure is accelerated by only updating a part of the values. None of the previous methods have proposed acceleration methods with an application of interpolation. + +In this paper, to solve the policy evaluation problem more efficiently, we propose an alternative algorithm based on multi-step interpolation. Explicitly, the solution to the policy evaluation problem is approximately represented by a weighted combination of historical values, whose weights are adaptively updated by an optimization procedure. To reduce the computational complexity, we resort to the Anderson mixing method (Anderson, 1965; Walker & Ni, 2011; Toth & Kelley, 2015) to do the approximation with only a short length of history. Our approach fits the gap between value iteration and policy iteration, ending in an updating rule without adding much extra computational complexity to the original value iteration procedure. We also extend this approach to deep reinforcement learning problems. + +The remainder of this paper is organized as follows. In Section 2, we introduce the foundations of reinforcement learning and present typical value updating algorithms. In Section 3, we derive the Anderson accelerated methods. In Section 4, we give a theoretical analysis of the convergence of our method. In Section 5, we test our method in different environments and empirically show the effectiveness of it. Finally, we conclude our work in Section 6. + +# 2 PRELIMINARIES + +In this paper we mainly consider a finite-state and finite-action scenario in reinforcement learning. In this case, an Markov Decision Process (MDP) system is defined by a 5-tuple $( S , { \mathcal { A } } , P , r , \gamma )$ , where $s$ is a finite state space, $\mathcal { A }$ is a finite action space, $P \in \mathbb { R } ^ { ( | S | \times | A | ) \times | S | }$ is the collection of state-to-state transition probabilities, $\pmb { r } \in \mathbb { R } ^ { | S | \times | \mathcal { A } | }$ is the reward matrix, $\gamma$ is the discount factor. A policy $\pi \in { \mathcal { A } } ^ { | s | }$ is a vector of actions at each state. The transition matrix $P _ { \pi } \in \mathbb { R } ^ { | S | \times | S | }$ and reward vector $\boldsymbol { r } _ { \pi } \in \mathbb { R } ^ { | \boldsymbol { S } | }$ under policy $\pi$ are defined as $P _ { \pi } ( i , j ) = P ( ( i , \pi ( i ) ) , j ) , r _ { \pi } ( i ) = r ( i , \pi ( i ) )$ . We further define the value $\pmb { v } ^ { \pi } \in \mathbb { R } ^ { | \mathcal { S } | }$ and the $\mathbf { Q }$ -value $\pmb { q } ^ { \pi } \in \mathbb { R } ^ { | S | \times | \mathcal { A } | }$ under a given MDP and policy, where each element of $\pmb { v } ^ { \pi }$ and $\pmb q ^ { \pi }$ is defined as + +$$ +\begin{array} { l } { { \pmb v } ^ { \pi } ( s ) = \mathbb { E } _ { s _ { 0 } = s , s _ { t + 1 } \sim P _ { \pi } ( s _ { t } , \ldots ) } \displaystyle \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } { \pmb r } _ { \pi } ( s _ { t } ) , } \\ { \pmb q ^ { \pi } ( s , a ) = { \pmb r } ( s , a ) + \mathbb { E } _ { s _ { 1 } \sim P ( ( s , a ) , \ldots ) , s _ { t + 1 } \sim P _ { \pi } ( s _ { t } , \ldots ) } \displaystyle \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } { \pmb r } _ { \pi } ( s _ { t } ) . } \end{array} +$$ + +We can verify that $\pmb q ^ { \pi } = \pmb r + \gamma P \pmb v ^ { \pi }$ . We define $\pmb { q } _ { \tilde { \pi } } ^ { \pi } \in \mathbb { R } ^ { | s | }$ by $\pmb { q } _ { \tilde { \pi } } ^ { \pi } ( i ) = \pmb { q } ^ { \pi } ( i , \tilde { \pi } ( i ) )$ , and say a vector to be the maximum among a set if each entry of it is bigger than that of the other vectors. The values satisfy the Bellman equation: + +$$ +\pmb { v } ^ { \pi } = \Gamma _ { \pi } \big ( \pmb { v } ^ { \pi } \big ) = \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { \pi } . +$$ + +The policy $\pi ^ { * } = \arg \operatorname* { m a x } _ { \pi } { \pmb q } ^ { \pi }$ is called the optimal policy, whose value or $\mathrm { Q }$ -value is denoted as $v ^ { * }$ or $\pmb q ^ { * }$ . Note that $v ^ { * }$ satisfies the Bellman optimality equation + +$$ +\pmb { v } ^ { * } = \Gamma ( \pmb { v } ^ { * } ) = \operatorname* { m a x } _ { \pi } ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { * } ) . +$$ + +Therefore, finding the optimal policy is equivalent to finding the fixed point of the operator $\Gamma ( v )$ . + +# 2.1 FIXED POINT ITERATION METHODS + +Value iteration (VI) is the most widely used and best-understood algorithm for solving Markov decision problems. It solves the fixed point problem by iterating the following steps repeatedly, + +$$ +\pmb { v } ^ { ( t + 1 ) } = \Gamma ( \pmb { v } ^ { ( t ) } ) = \operatorname* { m a x } _ { \pi } ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( t ) } ) . +$$ + +An alternative solution is policy iteration (PI), which maintains both the value ${ \pmb v } ^ { ( t ) }$ and the policy $\pi ^ { ( t ) }$ during each iteration. The procedure alternatively iterates the following two steps: + +• Policy evaluation: Find a ${ \pmb v } ^ { ( t ) }$ such that + +$$ +\pmb { v } ^ { ( t ) } = \Gamma _ { \pi ^ { ( t ) } } \big ( \pmb { v } ^ { ( t ) } \big ) = \pmb { r } _ { \pi ^ { ( t ) } } + \gamma P _ { \pi ^ { ( t ) } } \pmb { v } ^ { ( t ) } , +$$ + +which can be directly computed by + +$$ +{ \pmb v } ^ { ( t ) } = ( I - \gamma P _ { \pi ^ { ( t ) } } ) ^ { - 1 } { \pmb r } _ { \pi ^ { ( t ) } } . +$$ + +• Policy improvement: Improve the current policy by + +$$ +\pi ^ { ( t + 1 ) } = \underset { \pi } { \operatorname { a r g m a x } } ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( t ) } ) . +$$ + +Theoretical analysis has shown that VI enjoys a $\gamma$ -linear convergence rate (i.e., $\| \pmb { v } ^ { ( t ) } - \pmb { v } ^ { * } \| _ { \infty } \leq \gamma \| \pmb { v } ^ { ( t - 1 ) } -$ $v ^ { * } \| _ { \infty } )$ , while PI converges much faster with $\| \pmb { v } ^ { ( t ) } - \pmb { v } ^ { * } \| _ { \infty } \leq K \| \pmb { v } ^ { ( t - 1 ) } - \pmb { v } ^ { * } \| _ { \infty } ^ { 2 }$ (Puterman, 1994), where $K$ is some constant related with $\gamma$ and the given MDP. Both VI and PI are model-based, because the greedy policy cannot be determined when $\mathbfit { \Delta } \mathbf { r }$ and $P$ are unknown. The VI under $\pmb q$ -notation is well-known as Q-learning (Watkins & Dayan, 1992). We will analyze our method under $\textbf { { v } }$ -notation, but our analysis also works under the corresponding $\pmb q$ -notation. + +The main difference between VI and PI is whether the current policy is fully evaluated. Though PI converges faster than VI, this advantage diminishes under several settings. In reinforcement learning, we can only access an oracle that returns the reward and next state given the current state and selected action. Under such a setting, each value iteration step can be performed by estimating $\Gamma ( v )$ through sampling. But the policy evaluation step based on equation (2) becomes intractable because it is quite time-consuming to compute $( I - \gamma P _ { \pi ^ { ( t ) } } ) ^ { - \mathbf { \bar { 1 } } }$ . The modified policy iteration method (Puterman & Brumelle, 1978) partially solves the problem by setting ${ \pmb v } ^ { t } \approx ( \Gamma _ { \pi ^ { ( t ) } } ) ^ { m _ { t } } ( { \pmb v } ^ { ( t - 1 ) } )$ where $m _ { t }$ is a (possibly large) integer related to $t$ . However, this method requires to evaluate a series of values $( \Gamma _ { \pi ^ { ( t ) } } ) ^ { i } \big ( { \pmb v } ^ { ( t - 1 ) } \big )$ for $i = 1 , 2 , \dots , m _ { t }$ , which is computationally inefficient. + +# 3 ANDERSON ACCELERATED VALUE ITERATION + +Based on the observation that full policy evaluation accelerates convergence, we propose an approximate policy evaluation method. The method aims to approximately solve the policy evaluation problem, circumventing the matrix inversion and iterative procedures mentioned above. + +We first utilize the linearity of equation (1), defining $B _ { \pi } ( { \pmb v } ) \ = \ \Gamma _ { \pi } ( { \pmb v } ) - { \pmb v }$ and converting the problem into an equivalent form of solving the equation $B _ { \pi } ( \pmb { v } ) = \mathbf { 0 }$ . Suppose we have obtained a set of values $B _ { \pi } ( { \pmb v } ^ { 1 } ) , B _ { \pi } ( { \pmb v } ^ { 2 } ) , \ldots , B _ { \pi } ( { \pmb v } ^ { k } )$ with respect to $\pmb { v } ^ { 1 } , \pmb { v } ^ { 2 } , \ldots , \pmb { v } ^ { k }$ . Consider to find a set of weights ${ \pmb { \alpha } } = ( \alpha _ { 1 } , \alpha _ { 2 } , \ldots , \alpha _ { k } ) ^ { T }$ , subject to $\textstyle \sum _ { i = 1 } ^ { k } \alpha _ { i } = 1$ , which satisfies that + +$$ +\sum _ { i = 1 } ^ { k } \alpha _ { i } B _ { \pi } ( { \pmb v } ^ { i } ) = { \bf 0 } . +$$ + +Then the combination $\begin{array} { r } { \tilde { \pmb { v } } = \sum _ { i = 1 } ^ { k } \alpha _ { i } \pmb { v } ^ { i } } \end{array}$ will satisfy the following relationship: + +$$ +\begin{array} { l } { { \displaystyle B _ { \pi } ( { \tilde { \pmb v } } ) = { \pmb r } _ { \pi } + \gamma P _ { \pi } { \tilde { \pmb v } } - { \tilde { \pmb v } } = \sum _ { i = 1 } ^ { k } \alpha _ { i } ( { \pmb r } _ { \pi } + \gamma P _ { \pi } { \pmb v } ^ { i } - { \pmb v } ^ { i } ) } } \\ { { \displaystyle ~ = \sum _ { i = 1 } ^ { k } \alpha _ { i } B _ { \pi } ( { \pmb v } ^ { i } ) = { \bf 0 } } . } \end{array} +$$ + +This relation implies $\tilde { v }$ can be viewed as an approximate solution to equation (1) provided the sampling estimations are accurate enough. However, this step needs to keep track of the previous values and recompute $\Gamma _ { \pi }$ on all of them. To reduce the huge memory usage and computation, we choose $v ^ { i }$ from the recent history, i.e., $\pmb { v } ^ { i } = \pmb { v } ^ { ( t - i ) } , i = 1 , 2 , . . . , \bar { } { k }$ , and replace $B _ { \pi ^ { ( t ) } } ( \pmb { v } ^ { ( t - \bar { i } ) } )$ with the previously computed values $B _ { \pi ^ { ( t - i ) } } ( { \pmb v } ^ { ( t - i ) } )$ . This modification is based on the observation that the recent successive policies do not change sharply and therefore $B _ { \pi ^ { ( t - i ) } } ( \pmb { v } ^ { ( t - i ) } ) \approx B _ { \pi ^ { ( t ) } } ( \pmb { v } ^ { ( t - i ) } )$ . This modification approximately solves the policy evaluation problem without model estimation or extra function evaluations. + +Another critical issue is that we cannot guarantee the existence of $_ { \pmb { \alpha } }$ given that $k$ is small, because the dimension of $B _ { \pi } ( \pmb { v } )$ is usually much higher than $k$ . Inspired by the Anderson acceleration technique ega, $\&$ Rheinboldt, 1970; Walker & Ni, 2011), we instead look for a combination of $\{ B _ { \pi ^ { ( t - i ) } } ( { \pmb v } ^ { ( t - i ) } ) \} _ { i = 1 } ^ { k }$ + +$$ +\pmb { \alpha } ^ { ( t ) } = \underset { \pmb { \alpha } \in \Omega \cap \Lambda } { \mathrm { a r g m i n } } \| \boldsymbol { B } ^ { ( t ) } \pmb { \alpha } \| , +$$ + +where $B ^ { ( t ) } = \big ( B _ { \pi ^ { ( t - 1 ) } } \big ( \pmb { v } ^ { ( t - 1 ) } \big ) , B _ { \pi ^ { ( t - 2 ) } } \big ( \pmb { v } ^ { ( t - 2 ) } \big ) , \dots , B _ { \pi ^ { ( t - k ) } } \big ( \pmb { v } ^ { ( t - k ) } \big ) \big )$ , $\Omega = \{ \pmb { \alpha } | \mathbf { 1 } ^ { T } \pmb { \alpha } = 1 \}$ , $\Lambda$ is an extra constraint on the values attainable by $_ { \pmb { \alpha } }$ . Typically, $\Lambda$ can be chosen from the following forms: + +• Total space, $\Lambda _ { \mathrm { t o t } } = \mathbb { R } ^ { k }$ ; • Boxing constraint, $\Lambda _ { \mathrm { b o x } } = \{ { \pmb \alpha } | - m { \bf 1 } \le { \pmb \alpha } \le m { \bf 1 } \}$ ; • Convex combination constraint, $\Lambda _ { \mathrm { c v x } } = \{ \alpha | \mathbf { 0 } \leq \alpha \leq 1 \}$ ; • Extrapolation constraint, $\Lambda _ { \mathrm { e x p } } = \{ \alpha | \alpha _ { 1 } \geq 1 , \alpha _ { i } \leq 0 , i = 2 , 3 , \ldots , k \} .$ + +When the $\ell _ { 2 }$ norm is used and $\begin{array} { r c l } { \Lambda } & { = } & { \Lambda _ { \mathrm { t o t } } } \end{array}$ , the solution can be written explicitly as $\begin{array} { r l } { \alpha ^ { ( t ) } } & { { } = } \end{array}$ $[ ( B ^ { ( t ) } ) ^ { \top } B ^ { ( t ) } ] ^ { - 1 } { \bf 1 } / { \bf 1 } ^ { \top } [ ( B ^ { ( t ) } ) ^ { \top } B ^ { ( t ) } ] ^ { - 1 } { \bf 1 }$ , whose derivation is placed in the appendix. Note that if we simply set $\begin{array} { r } { \pmb { v } ^ { ( t ) } = \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } } \end{array}$ , the values will always locate in the subspace expanded by historical values $\pmb { v } ^ { ( t - 1 ) } , \pmb { v } ^ { ( t - 2 ) } , \pmb { \dots } , \pmb { v } ^ { ( t - k ) }$ . When the solution to equation (1) does not lie in such a subspace, there is no hope for convergence with application of such updating rule directly. To jump out of the subspace, we perform an extra value iteration step to this combination. Then we will get the updated value, + +$$ +\pmb { v } ^ { ( t ) } = \operatorname* { m a x } _ { \pi } \bigg ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \bigg [ \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } \bigg ] \bigg ) . +$$ + +Based on our previous discussion, we present the $k$ -step Anderson Accelerated Value Iteration (A2VI) in Algorithm 1. In the first $k$ steps, the value is updated according to the original VI. Otherwise, we perform an interpolation procedure, where the weights are attained from solving the problem (5). The original value iteration algorithm can be viewed as a special case of our algorithm with $k = 1$ . + +# Algorithm 1 Anderson Accelerated Value Iteration (A2VI) + +Input: ${ \pmb v } ^ { ( 0 ) } , P , { \pmb r } , \gamma , k , T$ +1: for $t = 1 , 2 , \dots , T$ do +2: $\begin{array} { r l } & { ~ B _ { \pi ^ { ( t - 1 ) } } \big ( \pmb { v } ^ { ( t - 1 ) } \big ) = \underset { \pi } { \operatorname* { m a x } } \big ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( t - 1 ) } \big ) - \pmb { v } ^ { ( t - 1 ) } } \\ & { ~ \mathbf { i f } t < k \mathbf { t h e n } } \\ & { ~ \pmb { v } ^ { ( t ) } = \underset { \pi } { \operatorname* { m a x } } \big ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( t - 1 ) } \big ) } \end{array}$ +3: +4: +5: 6: els $( \alpha _ { 1 } ^ { ( t ) } , \alpha _ { 2 } ^ { ( t ) } , \ldots , \alpha _ { k } ^ { ( t ) } )$ optimization problem (5) +$\begin{array} { r } { \pmb { v } ^ { ( t ) } = \underset { \pi } { \operatorname* { m a x } } \left( \pmb { r } _ { \pi } + \gamma P _ { \pi } \left[ \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } \right] \right) } \end{array}$ +8: end if +9: end for +10: $\begin{array} { r } { \pi ^ { ( T ) } = \mathrm { a r g m a x } _ { \pi } ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( T ) } ) } \end{array}$ +11: return v(T ), π(T ) + +Both Anderson Acceleration (AA) and A2VI have the same spirit of interpolating on historical data. However, A2VI does not straightforwardly apply AA to the Bellman optimality equation. Note that AA has the updating rule $\begin{array} { r } { \pmb { v } ^ { t } = \sum \alpha _ { i } B ( \mathbf { \bar { v } } ^ { t - i } ) } \end{array}$ , while A2VI exchange the order of the operator sum and $B ( \cdot )$ due to the motivation from equation (3). This exchange puts the nonsmooth operator max out of the affine combination, simplifying the theoretical analysis. + +We present a geometric explanation on the iterative steps of VI, PI, A2VI under 1-dimensional case in Figure 1. In value iteration, ${ \pmb v } ^ { ( t ) }$ is attained by making a vertical line at $( \pmb { v } ^ { ( t - 1 ) } , \mathbf { 0 } )$ , finding its intersection with the function line at $( \pmb { v } ^ { ( t - 1 ) } , \boldsymbol { B } ( \pmb { v } ^ { ( t - 1 ) } ) )$ , then drawing a line with slope $- 1$ through $( \pmb { v } ^ { ( t - 1 ) } , \boldsymbol { B } ( \pmb { v } ^ { ( t - 1 ) } ) )$ and finding its intersection with the horizon axis at $( \pmb { v } ^ { ( t ) } , \mathbf { 0 } )$ ; In policy iteration, ${ \pmb v } ^ { ( t ) }$ is attained by first getting $( \pmb { v } ^ { ( t - 1 ) } , \boldsymbol { B } ( \pmb { v } ^ { ( t - 1 ) } ) )$ in the same way as value iteration, then calculating the tangent line through $( \pmb { v } ^ { ( t - 1 ) } , \boldsymbol { B } ( \pmb { v } ^ { ( t - 1 ) } ) )$ and finding its intersection with the horizon axis. In Anderson accelerated value iteration, each step is first performed in a similar style to policy iteration except that the tangent line is replaced with a secant line. Then a value iteration step is performed to get ${ \pmb v } ^ { ( t ) }$ . + +From the figure, we can see that VI only utilizes the current value of the Bellman residual, while PI is similar to Newton’s method Puterman & Brumelle (1978), utilizing the gradient information to achieve a faster convergence rate. Our method serves as an intermediate between them, each step of which is composed of an ordinary value iteration step and a secant step. In specific, the replacement of the tangent line to a secant line can be viewed as a quasi-Newton’s method, which is shown computationally more efficient while keeping a fast convergence rate in several particular settings. Both PI and A2VI converge to the fixed point in a smaller number of steps than VI. Compared with PI, A2VI is more practical because it approximates the tangent line by a secant line, which circumvents the costly model estimation step. + +# 3.2 EXTENSION TO MODEL-FREE LEARNING ALGORITHM + +We can rewrite our algorithm under $\pmb q$ -notation, and get the Anderson Accelerated Q-Learning (A2Q) Algorithm shown in the appendix. Combined with the technique of deep learning, our method can be applied to end-to-end decision problems, resulting in the Deep Anderson Accelerated Q-Learning (DA2Q) Algorithm (Algorithm 2). + +![](images/3d826ac40fe3871114092087e3a974454909cd376bd18804a2efe437f1f2ec83.jpg) +Figure 1: Geometric interpolation of VI, PI and A2VI. + +# Algorithm 2 Deep Anderson Accelerated Q-learning (DA2Q) + +
Input:M,N,T,γ,b,B,ε,n,K,C1: Initialize replay memory D to capacity N,initialize Q-value function Q with random weights θ 2:0-k=0,α1=1,αk=0 fork=2,...,K
3:s=0 4: for episode =1,2,..., M do
5:Initialize s1 ~ p(s)
6:
for t=1,2,...,Tdo
7:With probability ε select a random action at,otherwise select at = arg maxa Q(st, a; 0)
8:Execute action at, observe reward rt and state St+1
9:Store transition (St,at,rt,St+1) in D
10:Sample a random minibatch of transitions {(sj,αj,rj,s')}=1 from D
11:forj=1,2,...,b do
rj for terminal state
12:K
yj= M xQ(s,(_)) rj+ymax for non-terminal state a
13:Ak=1 end for
14:L(θ)= 1b j=1(yj -Q(sj,aj;0))²
15:b j aL
16:0=θ-n
17:s=s+1
if s mod C= O then
18:Assign0-k =0-(k-1) fork=K,K-1,...,2.Assign0-1=0.
19:if s≥K(C-1) then
20:Sample a random minibatch of transitions {(sj,αj,Tj,s')}=1 from D
21:for j=1,2,...,B do
22:for k=1,2,...,K do
23:rj-Q(sj,aj;0-k) d
𝑟j + γ maxQ(s',α;0_k)- Q(sj,αj; 0-k)for non-terminal state
24:α
end for
25:end for
26:end if
27:(α1,2.,αk)= argmin(a2a)∑𝑗=1(∑=1kd)² s. ∑1a =1
28:
end if
29:
end for
30:
end for
+ +# 4 THEORETICAL ANALYSIS + +We first analyze of the local convergence of the A2VI algorithm under boxing constraint. Our result shows that in a small neighborhood of the optimal value, our algorithm enjoys an exponential convergence rate. + +Theorem 1. For any MDP with a unique optimal policy, there exists some $\delta > 0$ , such that for any initial value ${ \pmb v } ^ { ( 0 ) } \in U _ { \delta } ( { \pmb v } ^ { * } ) = \{ { \pmb v } | \| { \pmb v } - { \pmb v } ^ { * } \| _ { \infty } ^ { - } \leq \bar { \delta } \}$ , the A2VI algorithm under boxing constraint maintains the following properties: + +$$ +\begin{array} { r l } & { \| \Gamma ( \pmb { v } ^ { ( t ) } ) - \pmb { v } ^ { ( t ) } \| _ { \infty } \leq \gamma \| \Gamma ( \pmb { v } ^ { ( t - 1 ) } ) - \pmb { v } ^ { ( t - 1 ) } \| _ { \infty } , \forall t = 1 , 2 , . . . ; } \\ & { \| \pmb { v } ^ { ( t ) } - \pmb { v } ^ { * } \| _ { \infty } \leq \frac { \gamma ^ { t } } { 1 - \gamma } \| \Gamma ( \pmb { v } ^ { ( 0 ) } ) - \pmb { v } ^ { ( 0 ) } \| _ { \infty } , \forall t = 1 , 2 , . . . } \end{array} +$$ + +Generally, it is difficult to obtain the global convergence rate of A2VI, since the operation max is nonsmooth. To guarantee the convergence, we introduce a rejection step to the original algorithm. We say $\pmb { v }$ is monotonic improving if $\Gamma ( v ) \geq v$ , and denote the set of such values as $V _ { B }$ . We propose the A2VI algorithm with the rejection step, which only differs with Algorithm 1 at line 6. After calculating $\mathbf { \alpha } _ { \alpha } ( t )$ , we test whether the affine combination an ordinary $\scriptstyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { t - i }$ lies in tep. W $V _ { B }$ . If the answer is negative, the interpolation step will be replaced withut the pseudocode of A2VI with the rejection step in Appendix. With this modification, we can have the following convergence properties. + +Theorem 2. For the A2VI algorithm with the rejection step with $\Lambda = \Lambda _ { \mathrm { c v x } }$ , $i f v ^ { ( 0 ) } \in V _ { B }$ , then we have + +Theorem 3. For the A2VI algorithm with $\Lambda = \Lambda _ { \mathrm { e x p } }$ , $i f v ^ { 0 } \geq \mathbf { 0 }$ and ${ \pmb v } ^ { ( 0 ) } \in \ d V _ { B }$ , then we have + +(a) Monotone improving values, ${ \pmb v } ^ { ( t - 1 ) } \le { \pmb v } ^ { ( t ) } \le { \pmb v } ^ { * } , { \pmb v } ^ { ( t ) } \in V _ { B } , \forall t = 1 , 2 , . . .$ (b) $\gamma$ -linear convergence rate, $\begin{array} { r } { \| \pmb { v } ^ { * } - \pmb { v } ^ { ( t ) } \| _ { \infty } \leq \gamma \| \pmb { v } ^ { * } - \pmb { v } ^ { ( t - 1 ) } \| _ { \infty } } \end{array}$ . + +# 5 EXPERIMENTS + +To validate the effectiveness of our method, we conduct several experiments. + +# 5.1 EXPERIMENTS ON TOY MODELS + +We first test our method on three toy models. The first model is a randomly generated MDP with $\vert { \cal S } \vert = 1 0 0$ and $| { \cal A } | = 5 0$ . The transition probabilities of the MDP are generated from a uniform distribution on $[ 0 , 1 ]$ , and the rewards are generated from a standard normal distribution. The second model is the $N$ -Chain problem with $N = 1 0 0$ , where a reward of 0.1 is given at state 0 and a reward of 1 is given at state $N$ . At each state, the agent can either choose to move forward or backward, and will move to the selected direction with probability 0.9 and to the opposite direction with probability 0.1. The last model is a $2 0 \times 2 0$ Gridworld model, where a reward of 1 is given at state (20, 20). At each state, the agent can choose one of the 4 directions and will move to that direction with probability 0.7, or move to one of the other directions with probability 0.1 for each. We perform the standard value iteration, policy iteration and Anderson accelerated value iteration with/without the rejection step on these models. In our experiment, each policy iteration step is approximately solved by the modified policy iteration method with 100 inner iterations. To compare our method with the averaged updating scheme (Anschel et al., 2016), we further construct and compare our algorithm with the averaged value iteration. The value of $\lVert \boldsymbol { v } ^ { t } - \boldsymbol { v } ^ { * } \rVert$ w.r.t. step $t$ is shown in Figure 2, where the results are averaged from 30 independent experiments. + +From the results we can see that the policy iteration converges fastest for all of the three models, however, since each of its steps includes 100 inner iterations, the actual computation cost is very high. Among value iteration methods, the Anderson accelerated value iteration converges fastest. The acceleration effect is remarkable in randomly generated MDPs, but A2VI slows down at the first few steps in the latter two experiments. However, adding a rejection step solves the problem and attains a faster convergence rate. Another observation is that in the toy model case, the averaged value iteration cannot be used for acceleration. + +![](images/017e0eb5a1424b7b9e919b1e1dd435cf6a48f19d2d12ec966e5213abcc742ec6.jpg) +Figure 2: Experiment results on several toy models. + +5.2 EXPERIMENTS ON ATARI GAMES WITH DEEP LEARNING BASED TECHNIQUES + +To figure out the performance of our method on complex environments, we apply our method to Atari games from Gym (Brockman et al., 2016), which is a Python API to Arcade Learning Environment (Bellemare et al., 2013). We compare DA2Q with DQN (Mnih et al., 2013) and Averaged-DQN (Anschel et al., 2016). Details of the experiment settings are given in Appendix D. + +As Figure 3 points out, our algorithm DA2Q obtains a significant improvement over both the original DQN algorithm and the Averaged DQN algorithm. When compared with other interpolation method such as Averaged-DQN, the overall performance of our method also tends to be stabler, always being superior than other methods among all of the three environments, while the performance of Averaged-DQN varies a lot. + +![](images/4fe215b114bc3bb117d605d98e305992377703a24aeb1bd876d661d3dd8686b3.jpg) +Figure 3: Training Performance on Atari games, score is smoothed with 250 windows while the shaded area is the 0.25 standard deviation. + +Compared with DQN, the extra computational cost is actually low, since the $\alpha$ is updated only once every $C$ steps, which only involves an inversion on a very small-size matrix $( k \times k )$ . The $k$ target values are computed parallelly in the TensorFlow (Abadi et al., 2016), which cost the same time as in DQN. Moreover, the extra runtime can be ignored when compared with the costly back propagations and interaction with environments. + +# 6 CONCLUSION + +We have proposed the Anderson accelerated value iteration method, which is a novel acceleration approach for reinforcement learning. We have proved the convergence property of our method under certain conditions. Our algorithm empirically achieves a superior performance on toy models and several Atari games. Despite the success of our algorithm, several questions remain open. The convergence analysis for the general case is lacking, and we only provide convergence guarantees but do not give a theoretical analysis of the acceleration effect of A2VI, which we leave for future work. + +# REFERENCES + +Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: a system for large-scale machine learning. In OSDI, volume 16, pp. 265–283, 2016. +Alessandro Alla, Maurizio Falcone, and Dante Kalise. An efficient policy iteration algorithm for dynamic programming equations. SIAM Journal on Scientific Computing, 37(1):A181–A200, 2015. +Donald G Anderson. Iterative procedures for nonlinear integral equations. Journal of the ACM (JACM), 12 (4):547–560, 1965. +Oron Anschel, Nir Baram, and Nahum Shimkin. Averaged-dqn: Variance reduction and stabilization for deep reinforcement learning. arXiv preprint arXiv:1611.01929, 2016. +Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013. +Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. arXiv preprint arXiv:1707.06887, 2017. +Richard Bellman. A markovian decision process. Journal of Mathematics and Mechanics, pp. 679–684, 1957. +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. +Sébastien Bubeck et al. Convex optimization: Algorithms and complexity. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 8(3-4):231–357, 2015. +Ronald A Howard. Dynamic programming and markov processes. 1964. +Leslie Pack Kaelbling, Michael L Littman, and Andrew W Moore. Reinforcement learning: A survey. Journal of artificial intelligence research, 4:237–285, 1996. +Mattia Laurini, Piero Micelli, Luca Consolini, and Marco Locatelli. A jacobi-like acceleration for dynamic programming. In Decision and Control (CDC), 2016 IEEE 55th Conference on, pp. 7371–7376. IEEE, 2016. +Mattia Laurini, Luca Consolini, and Marco Locatelli. A consensus approach to dynamic programming. IFAC-PapersOnLine, 50(1):8435–8440, 2017. +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. +James M Ortega and Werner C Rheinboldt. Iterative solution of nonlinear equations in several variables, volume 30. Siam, 1970. +Martin L Puterman. Markov decision processes. j. Wiley and Sons, 1994. +Martin L Puterman and Shelby L Brumelle. The analytic theory of policy iteration. In Dynamic Programming and its applications, pp. 91–113. Elsevier, 1978. +Gavin A Rummery and Mahesan Niranjan. On-line Q-learning using connectionist systems, volume 37. University of Cambridge, Department of Engineering, 1994. +Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015. +Damien Scieur, Alexandre d’Aspremont, and Francis Bach. Regularized nonlinear acceleration. In Advances In Neural Information Processing Systems, pp. 712–720, 2016. +Damien Scieur, Francis Bach, and Alexandre d’Aspremont. Nonlinear acceleration of stochastic algorithms. In Advances in Neural Information Processing Systems, pp. 3982–3991, 2017. +Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998. +Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems, pp. 1057–1063, 2000. +Alex Toth and CT Kelley. Convergence analysis for anderson acceleration. SIAM Journal on Numerical Analysis, 53(2):805–819, 2015. +Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double q-learning. In AAAI, volume 16, pp. 2094–2100, 2016. +Homer F Walker and Peng Ni. Anderson acceleration for fixed-point iterations. SIAM Journal on Numerical Analysis, 49(4):1715–1735, 2011. +Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Van Hasselt, Marc Lanctot, and Nando De Freitas. Dueling network architectures for deep reinforcement learning. arXiv preprint arXiv:1511.06581, 2015. +Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279–292, 1992. +Guangzeng Xie, Yitan Wang, Shuchang Zhou, and Zhihua Zhang. Interpolatron: Interpolation or extrapolation schemes to accelerate optimization for deep neural networks. arXiv preprint arXiv:1805.06753, 2018. + +# A. A2Q + +Here is the pseudocode of A2Q, which is A2VI in $\pmb q$ -notation. + +# Algorithm 3 Anderson Accelerated Q-Learning (A2Q) + +Input: $\mathbf { \Psi } _ { q } { } ^ { 0 } , P , r , \gamma , k , T$ 1: for $t = 1 , 2 , \dots , T$ do 2: $B _ { \pi ^ { ( t - 1 ) } } ( { \pmb q } ^ { t - 1 } ) = \mathrm { v e c } ( { \pmb r } ) + \gamma P \mathrm { m a x } _ { \pi } { \pmb q } _ { \pi } ^ { t - 1 } - \mathrm { v e c } ( { \pmb q } ^ { t - 1 } )$ 3: if $t < k$ then 4: $\begin{array} { r } { \mathrm { v e c } ( \pmb q ^ { t } ) = \mathrm { v e c } ( \pmb r ) + \gamma P \mathrm { m a x } _ { \pi } \pmb q _ { \pi } ^ { t - 1 } } \end{array}$ 5: else 6: Calculate $\left( \alpha _ { 1 } , \alpha _ { 2 } , \ldots , \alpha _ { k } \right)$ by solving the optimization problem (5) 7: $\begin{array} { r } { \mathrm { v e c } ( { \pmb q } ^ { t } ) = \mathrm { v e c } ( { \pmb r } ) + \gamma P \mathrm { m a x } _ { \pi } \big ( \sum _ { i = 1 } ^ { k } \alpha _ { i } \pmb q _ { \pi } ^ { t - i } \big ) } \end{array}$ 8: end if +9: end for +10: πT = arg maxπ qTπ +11: return qT , πT + +# B. A2VI WITH THE REJECTION STEP + +Here is the pseudocode of A2VI with the rejection step, the only difference between this algorithm with algorithm 1 is before the interpolation step, we first check whether the affine combination is in $V _ { B }$ . If the answer is negative, then this interpolation step is replaced with an ordinary value iteration step. + +# Algorithm 4 Anderson Accelerated Value Iteration with the Rejection Step + +Input: ${ \pmb v } ^ { ( 0 ) } , P , { \pmb r } , \gamma , k , T$ +1: for $t = 1 , 2 , \cdots , T { \bf d }$ o +2: $B _ { \pi ^ { ( t - 1 ) } } ( \pmb { v } ^ { ( t - 1 ) } ) = \operatorname* { m a x } _ { \pi } \left( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( t - 1 ) } \right) - \pmb { v } ^ { ( t - 1 ) }$ +3: if $t < k$ then +4: ${ \pmb v } ^ { ( t ) } = \operatorname* { m a x } _ { \pi } ( { \pmb r } _ { \pi } + \gamma P _ { \pi } { \pmb v } ^ { ( t - 1 ) } )$ +5: else +6: Calculate $( \alpha _ { 1 } ^ { ( t ) } , \alpha _ { 2 } ^ { ( t ) } , \cdot \cdot \cdot , \alpha _ { k } ^ { ( t ) } )$ by solving the optimization problem (5) +7: 8: v˜ = Pki=1 α(t)i v (t−i) $\begin{array} { c } { { \pmb v = \sum _ { i = 1 } \alpha _ { i } \mathrm { ~ \pmb { \sigma } ~ } ^ { \ast } { \pmb v } ^ { \ast } } } \\ { { \bf i f \operatorname* { m a x } _ { \pi } ( \pmb r _ { \pi } + \gamma P _ { \pi } \tilde { \pmb v } ) \geq \tilde { v } \ t h e n } } \\ { { \pmb v } ^ { ( t ) } = \operatorname* { m a x } _ { \pi } ( { \pmb r _ { \pi } + \gamma P _ { \pi } \tilde { \pmb v } } ) } \end{array}$ +9: +10: else +11: $\mathbf { \tilde { \alpha } } _ { 1 } ^ { ( t ) } = 1 , \alpha _ { i } ^ { ( t ) } = 0$ for i 6= 1 +12: v(t) = max rπ + γPπv(t−1) +13: end if +14: end if +15: end for +16: $\pi ^ { ( T ) } = \mathrm { a r g m a x } _ { \pi } ( \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( T ) } )$ +17: return ${ \pmb v } ^ { ( T ) } , \pi ^ { ( T ) }$ + +C. PROOFS + +Lemma 1. For any MDP whose optimal policy is unique, there exists a $\delta > 0$ and a policy $\pi ^ { * }$ such that for any ${ \pmb v } \in U _ { \delta } ( { \pmb v } ^ { * } ) = \{ { \pmb v } | \| { \pmb v } - { \pmb v } ^ { * } \| _ { \infty } \leq \delta \}$ , + +$$ +\Gamma ( v ) = r _ { \pi ^ { * } } + \gamma P _ { \pi ^ { * } } v +$$ + +Proof Because the optimal policy is unique, for any nonoptimal policy $\pi$ , for any state $s$ such that $\pi ( s ) \neq$ $\pi ^ { * } ( s )$ we have that $[ \bar { \Gamma _ { \pi ^ { * } } } ( { \pmb v } ^ { * } ) \bar { \bf \bar { \Big ] } } _ { s } > [ \Gamma _ { \pi } ( { \pmb v } ^ { * } ) ] _ { s } , [ \cdot ] _ { s }$ means executing operations on state $s$ . Denote $A ( \pi ) =$ $\{ s | \dot { \pi } ( s ) \neq \pi ^ { * } ( s ) \}$ . + +Suppose the optimal policy is $\pi ^ { * }$ , then there exists $\varepsilon$ such that + +$$ +\operatorname* { m i n } _ { \pi \neq \pi ^ { * } } \operatorname* { m i n } _ { s \in A ( \pi ) } ~ [ \Gamma ( \pmb { v } ^ { * } ) - \Gamma _ { \pi } ( \pmb { v } ^ { * } ) ] _ { s } > \varepsilon > 0 , +$$ + +since the optimal policy is unique and the state space and the action space are finite. We choose $\begin{array} { r } { \delta = \frac { \varepsilon } { 3 \gamma } } \end{array}$ , then for any policy $\pi$ and any $\pmb { v } \in U _ { \delta } ( \pmb { v } ^ { * } )$ we have + +$$ +\| \Gamma _ { \pi } ( \pmb { v } ^ { * } ) - \Gamma _ { \pi } ( \pmb { v } ) \| _ { \infty } = \| \gamma P _ { \pi } ( \pmb { v } ^ { * } - \pmb { v } ) \| _ { \infty } \leq \gamma \| \pmb { v } ^ { * } - \pmb { v } \| _ { \infty } \leq \frac { \varepsilon } { 3 } +$$ + +Then for any policy $\pi$ , for any state $s \in A ( \pi )$ , we have that + +$$ +\begin{array} { r l } & { \bigl [ \Gamma _ { \pi ^ { * } } ( \pmb { v } ) - \Gamma _ { \pi } ( \pmb { v } ) \bigr ] _ { s } = \bigl [ \bigl ( \Gamma _ { \pi ^ { * } } ( \pmb { v } ) - \Gamma _ { \pi ^ { * } } ( \pmb { v } ^ { * } ) \bigr ) + \bigl ( \Gamma _ { \pi ^ { * } } ( \pmb { v } ^ { * } ) - \Gamma _ { \pi } ( \pmb { v } ^ { * } ) \bigr ) + \bigl ( \Gamma _ { \pi } ( \pmb { v } ^ { * } ) - \Gamma _ { \pi } ( \pmb { v } ) \bigr ) \bigr ] _ { s } } \\ & { \qquad \geq \varepsilon - \| \Gamma _ { \pi ^ { * } } ( \pmb { v } ) - \Gamma _ { \pi ^ { * } } ( \pmb { v } ^ { * } ) \| _ { \infty } - \| \Gamma _ { \pi } ( \pmb { v } ^ { * } ) - \Gamma _ { \pi } ( \pmb { v } ) \| _ { \infty } } \\ & { \qquad \geq \varepsilon - \frac { \varepsilon } { 3 } - \frac { \varepsilon } { 3 } } \\ & { \qquad = \frac { \varepsilon } { 3 } } \end{array} +$$ + +which means $\pi$ does not choose the optimal action in state $s$ . Therefore, if $\pi$ selects the optimal action in every state $s \in S$ , then we must have $\pi _ { s } = \pi _ { s } ^ { * } , \forall s \in \mathcal { S }$ , which implies $\pi ^ { * } \in \arg \operatorname* { m a x } _ { \pi } \Gamma _ { \pi } ( \pmb { v } )$ , i.e., $\Gamma ( v ) = r _ { \pi ^ { * } } + \gamma P _ { \pi ^ { * } } v$ . + +Lemma 2. For any given MDP with optimal value $v ^ { * }$ and any value $\textbf { { v } }$ , we always have + +$$ +( 1 - \gamma ) \| \pmb { v } - \pmb { v } ^ { * } \| _ { \infty } \leq \| \Gamma ( \pmb { v } ) - \pmb { v } \| _ { \infty } \leq ( 1 + \gamma ) \| \pmb { v } - \pmb { v } ^ { * } \| _ { \infty } . +$$ + +Proof + +$$ +\begin{array} { r l } { \| v - v ^ { * } \| _ { \infty } = } & { \| v - \Gamma ( v ) + \Gamma ( v ) - \Gamma ( v ^ { * } ) \| _ { \infty } } \\ & { \leq \| v - \Gamma ( v ) \| _ { \infty } + \| \Gamma ( v ) - \Gamma ( v ^ { * } ) \| _ { \infty } } \\ & { \leq \| v - \Gamma ( v ) \| _ { \infty } + \gamma \| v - v ^ { * } \| _ { \infty } } \\ { \Rightarrow ( 1 - \gamma ) \| _ { \infty } v - v ^ { * } \| _ { \infty } \leq \| \Gamma ( v ) - v \| _ { \infty } } \\ { \| v - v ^ { * } \| _ { \infty } = } & { \| v - \Gamma ( v ) + \Gamma ( v ) - \Gamma ( v ^ { * } ) \| _ { \infty } } \\ & { \geq \| v - \Gamma ( v ) \| _ { \infty } - \| \Gamma ( v ) - \Gamma ( v ^ { * } ) \| _ { \infty } } \\ { \geq \| v - \Gamma ( v ) \| _ { \infty } - \gamma \| v - v ^ { * } \| _ { \infty } } \\ { \Rightarrow ( 1 + \gamma ) \| v - v ^ { * } \| _ { \infty } \geq \| \Gamma ( v ) - v \| _ { \infty } } \end{array} +$$ + +Proof of Theorem 1 From lemma 1 we know there exists a policy $\pi$ and a $\tilde { \delta } > 0$ such that the optimal Bellman operator is a linear function on $U _ { \tilde { \delta } } ( \boldsymbol { v } ^ { * } )$ . We now set $\delta$ sufficiently small such that + +$$ +\frac { k m ( 1 + \gamma ) } { 1 - \gamma } \| \pmb { v } ^ { ( 0 ) } - \pmb { v } ^ { * } \| _ { \infty } < \frac { k m ( 1 + \gamma ) } { 1 - \gamma } \delta < \widetilde { \delta } . +$$ + +The result is trivial for the first $k - 1$ steps, which are performed exactly by standard value iteration. When $t > k$ , we prove the result by induction. Suppose the conclusion is correct for previous steps, then we have + +$$ +\begin{array} { r l } { \displaystyle \| \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } - v ^ { * } \| _ { \infty } \leq \displaystyle \sum _ { i = 1 } ^ { k } | \alpha _ { i } ^ { ( t ) } | \| v ^ { ( t - i ) } - v ^ { * } \| _ { \infty } \leq \displaystyle \sum _ { i = 1 } ^ { k } | \alpha _ { i } ^ { ( t ) } | \frac { 1 } { 1 - \gamma } \| B ( v ^ { ( t - i ) } ) \| _ { \infty } } & { } \\ { \leq \displaystyle \sum _ { i = 1 } ^ { k } | \alpha _ { i } ^ { ( t ) } | \frac { 1 } { 1 - \gamma } \| B ( v ^ { ( 0 ) } ) \| _ { \infty } \leq \frac { k m } { 1 - \gamma } \| B ( v ^ { ( 0 ) } ) \| _ { \infty } } & { } \\ { \leq \frac { k m ( 1 + \gamma ) } { 1 - \gamma } \| v ^ { ( 0 ) } - v ^ { * } \| _ { \infty } < \frac { k m ( 1 + \gamma ) } { 1 - \gamma } \delta < \widetilde { \delta } } & { } \end{array} +$$ + +It follows that + +$$ +\begin{array} { r l } & { \| { \pmb v } ^ { ( t ) } - { \pmb v } ^ { * } \| _ { \infty } = \| \Gamma ( \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } { \pmb v } ^ { t - i } ) - \Gamma ( { \pmb v } ^ { * } ) \| _ { \infty } \leq \gamma \| \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } { \pmb v } ^ { ( t - i ) } - { \pmb v } ^ { * } \| _ { \infty } } \\ & { \qquad \leq \| \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } { \pmb v } ^ { ( t - i ) } - { \pmb v } ^ { * } \| _ { \infty } < \widetilde { \delta } } \end{array} +$$ + +Therefore, $\textstyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } { \pmb v } ^ { ( t - i ) } \in U _ { \tilde { \delta } } ( { \pmb v } ^ { * } ) , { \pmb v } ^ { ( t ) } \in U _ { \tilde { \delta } } ( { \pmb v } ^ { * } )$ , which implies + +$$ +\Gamma ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } ) = r _ { \pi ^ { * } } + \gamma P _ { \pi ^ { * } } \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } , \Gamma ( v ^ { ( t ) } ) = r _ { \pi ^ { * } } + \gamma P _ { \pi ^ { * } } v ^ { ( t ) } . +$$ + +Then we can get + +$$ +\begin{array} { l } { { \displaystyle B ( v ^ { t } ) = r _ { \pi ^ { * } } + ( \gamma P _ { \pi ^ { * } } - I ) v ^ { ( t ) } } } \\ { { \displaystyle \quad = r _ { s ^ { * } } + ( \gamma P _ { \pi ^ { * } } - I ) ( r _ { s ^ { * } } + \gamma P _ { \pi ^ { * } } \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } ) } } \\ { ~ } \\ { { \displaystyle \quad = \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \left( r _ { \pi ^ { * } } + ( \gamma P _ { \pi ^ { * } } - I ) ( r _ { \pi ^ { * } } + \gamma P _ { \pi ^ { * } } \pi ^ { ( t - i ) } ) \right) } } \\ { { \displaystyle \quad = \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \gamma P _ { \pi ^ { * } } \left( r _ { \pi ^ { * } } + \gamma P _ { \pi ^ { * } } v ^ { ( t - i ) } - v ^ { ( t - i ) } \right) } } \\ { { \displaystyle \quad = \gamma P _ { \pi ^ { * } } \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } B ( v ^ { ( t - i ) } ) } } \end{array} +$$ + +Taking norm on both side of the equation and utilizing the definition of $\alpha _ { i } ^ { ( t ) } , i = 1 , 2 , \cdots , k$ , we get + +$$ +| \Gamma ( \pmb { v } ^ { ( t ) } ) - \pmb { v } ^ { ( t ) } \| _ { \infty } \leq \gamma \| P _ { \pi ^ { * } } \| _ { \infty } \| \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } B ( \pmb { v } ^ { ( t - i ) } ) \| _ { \infty } \leq \gamma \| B ( \pmb { v } ^ { ( t - 1 ) } ) \| _ { \infty } = \gamma \| \Gamma ( \pmb { v } ^ { ( t - 1 ) } ) - \pmb { v } ^ { ( t - 1 ) } \| _ { \infty } . +$$ + +Therefore, we justify property (i). Property (ii) then follows directly from Lemma 2. + +Lemma 3. For any MDP, suppose the values $\textbf { \em u }$ and $\textbf { { v } }$ satisfy $\textbf { \em u } \geq v$ , then + +$$ +\Gamma ( \boldsymbol { \mathbf { u } } ) \geq \Gamma ( \boldsymbol { \mathbf { v } } ) . +$$ + +Proof As stated in section 2, $\textbf { \em u } \geq \textbf { \em v }$ means that $\pmb { u } ( s ) \geq \pmb { v } ( s )$ for any state $s$ . Suppose $\tilde { \pi } = \arg \operatorname* { m a x } _ { \pi } \boldsymbol { r } _ { \pi } +$ $\gamma { P _ { \pi } } v$ , therefore for any $s$ we have that + +$$ +\Gamma ( \pmb { u } ) ( s ) \geq \Gamma _ { \widetilde { \pi } } ( \pmb { u } ) ( s ) \geq \Gamma _ { \widetilde { \pi } } ( \pmb { v } ) ( s ) = \Gamma ( \pmb { v } ) ( s ) . +$$ + +# Proof of Theorem 2 On the one hand, + +$$ +\begin{array} { r l } { \Gamma ( \mathbf { v } ^ { ( t ) } ) - \mathbf { v } ^ { ( t ) } = } & { \underset { \mathbf { n } = 1 } { \operatorname* { m a x } } ( r _ { \mathbf { x } } + \gamma P _ { \mathbf { x } } \mathbf { v } ^ { ( t ) } ) - \underset { \mathbf { n } = 1 } { \operatorname* { m a x } } ( r _ { \mathbf { x } } + \gamma P _ { \mathbf { x } } \mathbf { \Lambda } _ { \leq } ^ { k } \alpha _ { i } ^ { ( t ) } \mathbf { v } ^ { ( t - i \setminus j ) } ) } \\ & { \leq r _ { \mathbf { x } } ( \epsilon ) + \gamma P _ { \mathbf { x } ^ { ( t ) } } \mathbf { v } ^ { ( t ) } - r _ { \mathbf { x } ^ { ( t ) } } \lambda ^ { ( t ) } - \gamma P _ { \mathbf { x } ^ { ( t ) } } \underset { \mathbf { i = 1 } } { \overset { k } { \sum } } \alpha _ { i } ^ { ( t ) } \mathbf { v } ^ { ( t - i ) } } \\ & { = \gamma P _ { \mathbf { n } } ( \epsilon ) \underset { \mathbf { n } = 1 } { \operatorname* { m a x } } ( r _ { \mathbf { x } } + \gamma P _ { \mathbf { x } } \underset { \mathbf { i = 1 } } { \overset { k } { \sum } } \alpha _ { i } ^ { ( t ) } \mathbf { v } ^ { ( t - i ) } ) - \underset { \mathbf { n } = 1 } { \overset { k } { \sum } } \alpha _ { i } ^ { ( t ) } \mathbf { v } ^ { ( t - i ) } , } \\ & { \leq \gamma P _ { \mathbf { n } ^ { ( t ) } } \underset { \mathbf { n } = 1 } { \overset { k } { \sum } } \alpha _ { i } ^ { ( t ) } \underset { \mathbf { n } } { \operatorname* { m a x } } ( r _ { \mathbf { n } } + \gamma P _ { \mathbf { x } } \mathbf { v } ^ { ( t - i ) } ) - \mathbf { v } ^ { ( t - i ) } , } \\ & { = \gamma P _ { \mathbf { n } ^ { ( t ) } } \underset { \mathbf { n } = 1 } { \overset { k } { \sum } } \alpha _ { i } ^ { ( t ) } B ( \mathbf { v } ^ { ( t - i ) } ) } \end{array} +$$ + +On the other hand, we denote $\begin{array} { r } { \tilde { \pi } = \mathrm { a r g m a x } _ { \pi } ( { r } _ { \pi } + \gamma P _ { \pi } \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } { \pmb v } ^ { { ( t - i ) } } ) } \end{array}$ + +$$ +\begin{array} { r l } { v ^ { ( t ) } - \Gamma ( v ^ { ( t ) } ) = \displaystyle \operatorname* { m a x } _ { \pi } ( r _ { \pi } + \gamma P _ { \pi } \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } ) - \operatorname* { m a x } _ { \pi } ( r _ { \pi } + \gamma P _ { \pi } v ^ { ( t ) } ) } & { } \\ { \le r _ { \pi } + \gamma P _ { \pi } \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } - r _ { \pi } - \gamma P _ { \pi } v ^ { ( t ) } } & { } \\ { = \gamma P _ { \pi } \displaystyle ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } - \operatorname* { m a x } _ { \pi } ( r _ { \pi } + \gamma P _ { \pi } \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } ) ) } & { } \\ { = - \gamma P _ { \pi } B \displaystyle ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } ) } & { } \end{array} +$$ + +The above two results shows + +$$ +\gamma P _ { \tilde { \pi } } B ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } ) \le B ( \pmb { v } ^ { ( t ) } ) \le \gamma P _ { \pi ^ { ( t ) } } \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } B ( \pmb { v } ^ { ( t - i ) } ) . +$$ + +Now, consider the rejection step. First we show that if $v \in V _ { B }$ then $\Gamma ( \pmb { v } ) \in V _ { B }$ . If $v \in V _ { B }$ , then $\Gamma ( v ) \geq v$ . +With Lemma 3, we have that $\Gamma ( \Gamma ( \pmb { v } ) ) \geq \Gamma ( \pmb { v } )$ , i.e. $\Gamma ( \pmb { v } ) \in V _ { B }$ . + +Next we show that if $\pmb { v } ^ { ( i ) } \in V _ { B }$ for $i < t$ , then ${ \pmb v } ^ { ( t ) } \in V _ { B }$ . According to the rejection algorithm, we have $\begin{array} { r } { \pmb { v } ^ { ( t ) } = \Gamma ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } ) } \end{array}$ . If $\begin{array} { r } { \Gamma ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } ) \ge \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } } \end{array}$ α(t)i v(t−i), then Pki=1 α(t)i v(t−i) ∈ VB and v(t) ∈ VB . If Γ(Pki=1 α(t)i $\begin{array} { r } { \Gamma ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } ) < \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } \pmb { v } ^ { ( t - i ) } } \end{array}$ α(t)i v(t−i), then v(t) = Γ(v(t−1)) due to the rejection step. Since $\pmb { v } ^ { ( t - 1 ) } \in V _ { B }$ , we have that ${ \pmb v } ^ { ( t ) } \in V _ { B }$ 1 . Therefore, we also have that ${ \cal B } ( \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( k ) } v ^ { ( t - i ) } ) \geq 0$ α(k)i v(t−i)) ≥ 0. We have that + +$$ +\begin{array} { r l } { \| \Gamma ( \pmb { v } ^ { ( t ) } ) - \pmb { v } ^ { t } \| = \| B ( \pmb { v } ^ { ( t ) } ) \| \leq \gamma \| P _ { \pi ^ { ( t ) } } \| \| \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } B ( \pmb { v } ^ { ( t - i ) } ) \| } & { } \\ { \leq \gamma \| B ( \pmb { v } ^ { ( t - 1 ) } ) \| = \gamma \| \Gamma ( \pmb { v } ^ { ( t - 1 ) } ) - \pmb { v } ^ { ( t - 1 ) } \| } & { } \end{array} +$$ + +The second inequality is due to the definition of $\alpha _ { i } ^ { ( t ) }$ , $i = 1 , 2 , . . . , k$ + +Proof of Theorem 3 We prove the conclusion by induction. It is evident that the conclusion holds for the first $k - 1$ steps. Suppose the conclusion holds for the first $t - 1$ steps, then + +$$ +\begin{array} { r l } & { v ^ { ( t ) } = \displaystyle \operatorname* { m a x } _ { \pi } ( r _ { \pi } + \gamma P _ { \pi } \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } { \pmb v } ^ { ( t - i ) } ) } \\ & { \quad \ge r _ { \tilde { \pi } } + \gamma P _ { \tilde { \pi } } ( \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } { \pmb v } ^ { ( t - i ) } ) } \\ & { \quad \ge r _ { \tilde { \pi } } + \gamma P _ { \tilde { \pi } } { \pmb v } ^ { ( t - 1 ) } } \\ & { \quad \ge { \pmb v } ^ { ( t - 1 ) } , } \end{array} +$$ + +where $\begin{array} { r } { \tilde { \pi } = \arg \operatorname* { m a x } _ { \pi } \pmb { r } _ { \pi } + \gamma P _ { \pi } \pmb { v } ^ { ( t - 1 ) } } \end{array}$ . The second inequality comes from the extrapolation restriction. The Third inequality is due to that if $v \in V _ { B }$ then $\Gamma ( \pmb { v } ) \in \bar { V _ { B } }$ , which is shown in Theorem 2. + +As shown in Theorem 2, we have that ${ \pmb v } ^ { ( t ) } \in V _ { B }$ and ${ \textstyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } } { \pmb v } ^ { ( t - i ) } \in V _ { B }$ . Therefore, ${ \pmb v } ^ { ( t ) } \le { \pmb v } ^ { * }$ + +$$ +\begin{array} { r l } & { v ^ { * } - v ^ { ( t ) } = v ^ { * } - \displaystyle \operatorname* { m a x } _ { \pi } ( r _ { \pi } + \gamma P _ { \pi } \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } ) } \\ & { \qquad \le v ^ { * } - ( r _ { \pi ^ { * } } + \gamma P _ { \pi ^ { * } } \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } v ^ { ( t - i ) } ) } \\ & { \qquad = \gamma P _ { \pi ^ { * } } \displaystyle \sum _ { i = 1 } ^ { k } \alpha _ { i } ^ { ( t ) } ( v ^ { * } - v ^ { ( t - i ) } ) } \\ & { \qquad \le \gamma P _ { \pi ^ { * } } ( v ^ { * } - v ^ { ( t - 1 ) } ) } \end{array} +$$ + +Taking the infinite norm on both sides, we get + +$$ +\| \pmb { v } ^ { * } - \pmb { v } ^ { ( t ) } \| _ { \infty } \leq \gamma \| P _ { \pi ^ { * } } \| _ { \infty } \| \pmb { v } ^ { * } - \pmb { v } ^ { ( t - 1 ) } \| _ { \infty } \leq \gamma \| \pmb { v } ^ { * } - \pmb { v } ^ { ( t - 1 ) } \| _ { \infty } , +$$ + +which completes the proof. + +# D. EXPERIMENT DETAILS + +# D.1 MODEL ARCHITECTURE AND HYPER-PARAMETERS + +For our experiments, we used the DQN(Mnih et al., 2013) architecture, where the $\mathbf { Q }$ -value network is composed of 3 convolutional layers, 1 fully connected layer, and 1 output fully connected layer. Each layer except the final layer is followed with a rectified linear activation(ReLU). The first convolutional layer use 32 $8 \times 8$ filters with stride 4, the second has $6 4 4 \times 4$ filters with stride 2, and the third convolutional layer has 64 $3 \times 3$ filters with stride 1. The fully connected layer consists of 512 units and the final layer outputs a single value for each action. We used the Adam optimizer with learning rate 0.0001 and $\epsilon = 0 . 0 0 1 5$ . The discount was set to $\gamma = 0 . 9 9$ . Training is done over 20M or 40M frames. We updated the target networks every 10000 steps. The size of experience replay buffer is 100000 tuples, where $3 2 \mathrm { { m i n i } }$ batches were sampled every 4 steps to update the network. The exploration policy is $\varepsilon$ -greedy policy with fixed $\varepsilon = 0 . 0 1$ . + +# D.2 PREPROCESSING OF ENVIRONMENTS + +We preprocess the environment in the same way as the original DQN paper (Mnih et al., 2013) does. We utilize the action repeat technique, i.e., each action is repeated for the next four consecutive frames. The frames are firstly grey-scaled and then rescaled to the size of $8 4 \times 8 4$ pixels. Each state is represented by a concatenation of 4 consecutive frames. We fix all positive rewards to be 1 and all negative rewards to be -1, leaving 0 rewards unchanged. Transitions associated with the loss of a life are considered terminal. + +E. SOLVING (5) WHEN USING THE $\ell _ { 2 }$ NORM AND TOTAL SPACE CONSTRAINT + +Under the given setting, we may rewrite the original problem in the following form, + +$$ +\begin{array} { r l } & { \mathrm { m i n i m i z e } \ \pmb { \alpha } ^ { \top } ( \hat { B } ^ { ( t ) } ) ^ { \top } \hat { B } ^ { ( t ) } \pmb { \alpha } } \\ & { \mathrm { s u b j e c t } \ \mathrm { t o \ } \mathbf { 1 } ^ { \top } \pmb { \alpha } = 1 . } \end{array} +$$ + +This problem can be directly solved with an application of Lagrange multiplier method, namely, let $\lambda$ be the Lagrange multiplier, then we solve the problem + +$$ +\operatorname* { m a x } _ { \alpha } \alpha ^ { \top } ( \hat { B } ^ { ( t ) } ) ^ { \top } \hat { B } ^ { ( t ) } \alpha + \lambda ( \mathbf { 1 } ^ { \top } \alpha - 1 ) +$$ + +whose solution can be written explicitly as $\begin{array} { r } { \pmb { \alpha } = - \frac { \lambda } { 2 } [ ( \hat { B } ^ { ( t ) } ) ^ { \top } \hat { B } ^ { ( t ) } ] ^ { - 1 } \mathbf { 1 } } \end{array}$ . Combine this result with the constraint, we can get $- \textstyle { \frac { \lambda } { 2 } } = \frac { 1 } { \textstyle { \frac { 1 ^ { \top } [ ( \hat { B } ^ { ( t ) } ) ^ { \top } \hat { B } ^ { ( t ) } ] ^ { - 1 } { \bf 1 } } } }$ , which implies $\begin{array} { r } { \pmb { \alpha } = \frac { [ ( \hat { B } ^ { ( t ) } ) ^ { \top } \hat { B } ^ { ( t ) } ] ^ { - 1 } \mathbf { 1 } } { \mathbf { 1 } ^ { \top } [ ( \hat { B } ^ { ( t ) } ) ^ { \top } \hat { B } ^ { ( t ) } ] ^ { - 1 } \mathbf { 1 } } } \end{array}$ . \ No newline at end of file diff --git a/md/train/Syzn9i05Ym/Syzn9i05Ym.md b/md/train/Syzn9i05Ym/Syzn9i05Ym.md new file mode 100644 index 0000000000000000000000000000000000000000..0dab3d1c2a9bf0c338111e7304398c23efc7354a --- /dev/null +++ b/md/train/Syzn9i05Ym/Syzn9i05Ym.md @@ -0,0 +1,564 @@ +# LEARNING NEURAL RANDOM FIELDS WITH INCLUSIVE AUXILIARY GENERATORS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Neural random fields (NRFs), which are defined by using neural networks to implement potential functions in undirected models, provide an interesting family of model spaces for machine learning. In this paper we develop a new approach to learning NRFs with inclusive-divergence minimized auxiliary generator - the inclusive-NRF approach, for continuous data (e.g. images), with solid theoretical examination on exploiting gradient information in model sampling. We show that inclusive-NRFs can be flexibly used in unsupervised/supervised image generation and semi-supervised classification, and empirically to the best of our knowledge, represent the best-performed random fields in these tasks. Particularly, inclusiveNRFs achieve state-of-the-art sample generation quality on CIFAR-10 in both unsupervised and supervised settings. Semi-supervised inclusive-NRFs show strong classification results on par with state-of-the-art generative model based semi-supervised learning methods, and simultaneously achieve superior generation, on the widely benchmarked datasets - MNIST, SVHN and CIFAR-10. + +# 1 INTRODUCTION + +One of the core research problems in machine learning is learning with probabilistic models, which can be broadly classified into two classes - directed and undirected1 (Koller & Friedman, 2009). Significant progress has been made recently on learning with deep generative models (DGMs), which generally refer to models with multiple layers of stochastic or deterministic variables. There have emerged a bundle of deep directed generative models, such as variational AutoEncoders (VAEs) (Kingma & Welling, 2014), generative adversarial networks (GANs) (Goodfellow et al., 2014) and so on. In contrast, undirected generative models (also known as random fields (Koller & Friedman, 2009), energy-based models (LeCun et al., 2006)) received less attention with slow progress. This is presumably because fitting undirected models is more challenging than fitting directed models. In general, calculating the log-likelihood and its gradient is analytically intractable, because it involves the expectation with respect to (w.r.t.) the model distribution. + +In this paper, we aims to advance the learning of neural random fields (RFs) which use neural networks with multiple (deterministic) layers to define the potential function2 $u _ { \theta } ( x )$ over observation $x$ with parameter $\theta$ . The probability distribution $p _ { \theta } ( x ) \propto \exp ( u _ { \theta } ( x ) )$ is then defined by normalizing the exponentiated potential function. This type of RFs has been studied several times in different contexts, once called deep energy models (DEMs) (Ngiam et al., 2012; Kim & Bengio, 2016), descriptive models (Xie et al., 2016), generative ConvNet (Dai et al., 2014), neural random field language models (Wang & Ou, 2017). For convenience, we refer to such models as neural random fields (NRFs) in general. + +An important method of maximum likelihood (ML) learning of random fields is called stochastic maximum likelihood (SML) (Younes, 1989), which approximates the model expectations by Monte Carlo sampling for calculating the gradient. A recent progress in learning NRFs as studied in Kim & Bengio (2016); Xie et al. (2016); Wang & Ou (2017); Kuleshov & Ermon (2017) is to pair the target random field $p _ { \theta }$ with an auxiliary directed generative model (often called generator) $q _ { \phi } ( x )$ parameterized by $\phi$ , which approximates sampling from the target random field. Learning is performed by maximizing the log-likelihood of training data under $p _ { \theta }$ or some bound of the log-likelihood, and simultaneously minimizing some divergence between the target random field $p _ { \theta }$ and the auxiliary generator $q _ { \phi }$ . Different learning algorithms differ in the objective functions used in the joint training of $p _ { \theta }$ and $q _ { \phi }$ , and thus have different computational and statistical properties (partly illustrated in Figure 1). For example, minimizing the exclusive-divergence $K L [ q _ { \phi } | | p _ { \theta } ] \triangleq$ $\bar { \int { q _ { \phi } \log { \left( { q _ { \phi } } / { p _ { \theta } } \right) } } }$ w.r.t. $\phi$ , as employed in Kim & Bengio (2016), involves the intractable entropy term and tends to enforce the generator to seek modes, yielding missing modes. There are also other factors, e.g. modeling discrete or continuous data, different choices of the target RF and the generator, which lead to different algorithms. We leave detailed comparison and connection of our approach with existing studies to section 3 (related work). + +In this paper, we propose to use inclusive-divergence minimized auxiliary generators (section 2.1). And particularly for continuous data (e.g. images), we propose to use SGLD (stochastic gradient Langevin dynamics (Welling & Teh, 2011)) and SGHMC (stochastic gradient Hamiltonian Monte Carlo (Chen et al., 2014)) to exploit gradient information in model sampling with solid theoretical examination (section 2.2). The new approach, abbreviated as the inclusive-NRF approach, offers some advantages over previous methods. First, minimizing the inclusive-divergence $K L [ p _ { \theta } | | q _ { \phi } ] \triangleq$ $\int p _ { \theta } \log { ( p _ { \theta } / \bar { q } _ { \phi } ) }$ w.r.t. $\phi$ avoids the annoying entropy term and tends to drive the generator to cover modes of the target density $p _ { \theta }$ . The SGLD/SGHMC sampling further pushes the samples towards the modes of $p _ { \theta }$ . Presumably, this helps to produce Markov chains that mix fast between modes and facilitate model learning. Second, the new approach enables us to flexibly use NRFs in unsupervised/supervised image generation and semi-supervised classification (section 2.3), and empirically to the best of our knowledge, represents the best-performed random fields in these tasks. + +The main contributions of this paper can be summarized as follows: + +• We develop the inclusive-NRF approach, which learns NRFs with inclusive auxiliary generators and particularly for continuous data, exploits gradient information in model sampling with solid theoretical examination. • Inclusive-NRFs achieve state-of-the-art sample generation quality, measured by both Inception Score (IS) and Frechet Inception Distance (FID). On CIFAR-10, we obtain unsupervised IS 8.28 (FID 20.9) and supervised IS 9.06 (FID 18.1), both using unconditional generation. • Semi-supervised inclusive-NRFs show strong classification results on par with state-ofthe-art DGM-based semi-supervised learning (SSL) methods, and simultaneously achieve superior generation, on the widely benchmarked datasets - MNIST, SVHN and CIFAR-10. + +# 2 THE INCLUSIVE-NRF APPROACH + +Consider a random field for modeling observation $x$ with parameter $\theta$ : + +$$ +p _ { \theta } ( x ) = { \frac { 1 } { Z ( \theta ) } } \exp \left[ u _ { \theta } ( x ) \right] +$$ + +where $\begin{array} { r } { Z ( \theta ) = \int \exp ( u _ { \theta } ( x ) ) d x } \end{array}$ is the normalizing constant, $u _ { \theta } ( x )$ is the potential function3 which assigns a scalar value to each configuration of random variable $x$ . The general idea of neural random fields (NRFs) is to implement $u _ { \theta } ( \bar { x } ) : \mathbb { R } ^ { d _ { x } } \mathbb { R }$ , by a neural network, taking the multi-dimensional $x \in \mathbb { R } ^ { d _ { x } }$ as input and outputting the scalar $u _ { \theta } ( x ) \in \mathbb { R }$ . In this manner, we can take advantage of the representation power of neural networks for RF modeling. It is usually intractable to maximize the data log-likelihood $l o g p \hat { \theta } ( \tilde { x } )$ for observed $\tilde { x }$ , since the gradient involves expectation w.r.t. the model distribution, as shown below: + +$$ +\nabla _ { \boldsymbol { \theta } } \log { p _ { \boldsymbol { \theta } } ( \boldsymbol { \tilde { x } } ) } = \nabla _ { \boldsymbol { \theta } } u _ { \boldsymbol { \theta } } ( \boldsymbol { \tilde { x } } ) - E _ { p _ { \boldsymbol { \theta } } ( \boldsymbol { x } ) } \left[ \nabla _ { \boldsymbol { \theta } } u _ { \boldsymbol { \theta } } ( \boldsymbol { x } ) \right] +$$ + +# 2.1 INTRODUCING INCLUSIVE-DIVERGENCE MINIMIZED AUXILIARY GENERATORS + +In this paper, we further develop NRF learning with auxiliary generators. We are mainly concerned with modeling fixed-dimensional continuous observations $\bar { \boldsymbol { x } _ { \mathrm { ~ \in ~ } } } \mathbb { R } ^ { d _ { x } }$ (e.g. images), and choose a + +
Algorithm1Learning NRFs with inclusive auxiliary generators
repeat Sampling: Draw a minibatch M= {(xi,x𝑖,h𝑖),i=1,..: |M|} from p(x)pe(x)q(h|x) (see
Algorithm 2);
Updating: 1
Update θ by ascending: 1∑(a,x,h)~M[Vθuθ(x)- Vθuθ(x); M
Update Φ by ascending: ∑(x,x,h)~M V logq(x,h);
until convergence
+ +directed generative model, $q _ { \phi } ( x , h ) \triangleq q ( h ) q _ { \phi } ( x | h )$ , for the auxiliary generator, which specifically is defined as follows4: + +$$ +\begin{array} { l } { h \sim \mathcal { N } ( 0 , I _ { h } ) , } \\ { x = g _ { \phi } ( h ) + \epsilon , \epsilon \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I _ { \epsilon } ) , } \end{array} +$$ + +where $g _ { \phi } ( h ) : \mathbb { R } ^ { d _ { h } } \mathbb { R } ^ { d _ { x } }$ is implemented as a neural network with parameter $\phi$ , which maps the latent code $h$ to the observation space. $I _ { h }$ and $I _ { \epsilon }$ denote the identity matrices, with dimensionality implied by $h$ and $\epsilon$ respectively. Drawing samples from the generator $q _ { \phi } ( x , h )$ is simple as it is just ancestral sampling from a 2-variable directed graphical model. + +Suppose that data $\mathcal { D } = \{ \tilde { x } _ { 1 } , \cdots , \tilde { x } _ { n } \}$ , consisting of $n$ observations, are drawn from the true but unknown data distribution $p _ { 0 } ( \cdot )$ . 1n Pnk=1 δ(˜x − x˜k) denotes the empirical data distribution. Then we formulate the maximum likelihood learning of $p _ { \theta } ( x )$ with the inclusive-divergence minimized generator $q _ { \phi } ( x )$ as optimizing5 + +$$ +\{ \begin{array} { l l } { \underset { \theta } { \operatorname* { m i n } } K L [ \tilde { p } ( \tilde { x } ) | | p _ { \theta } ( \tilde { x } ) ] } \\ { \underset { \phi } { \operatorname* { m i n } } K L [ p _ { \theta } ( x ) | | q _ { \phi } ( x ) ] } \end{array} +$$ + +The first line of Eq. (4) is equivalent to maximum likelihood training of the target RF $p _ { \theta }$ under the empirical data $\tilde { p }$ , which requires sampling from $p _ { \theta }$ . Simultaneously, the second line optimizes the generator $q _ { \phi }$ to be close to $p _ { \theta }$ so that $q _ { \phi }$ becomes a good proposal for sampling from $p _ { \theta }$ . It can be easily seen that the gradients w.r.t. $\theta$ and $\phi$ (to be ascended) are defined as follows: + +$$ +\begin{array} { r } { \left\{ \begin{array} { l l } { \nabla _ { \theta } = E _ { \tilde { p } ( \tilde { x } ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( \tilde { x } ) \right] = E _ { \tilde { p } ( \tilde { x } ) } \left[ \nabla _ { \theta } u _ { \theta } ( \tilde { x } ) \right] - E _ { p _ { \theta } ( x ) } \left[ \nabla _ { \theta } u _ { \theta } ( x ) \right] , } \\ { \nabla _ { \phi } = E _ { p _ { \theta } ( x ) } \left[ \nabla _ { \phi } \log q _ { \phi } ( x ) \right] = E _ { p _ { \theta } ( x ) q _ { \phi } ( h \vert x ) } \left[ \nabla _ { \phi } \log q _ { \phi } ( x , h ) \right] . } \end{array} \right. } \end{array} +$$ + +Both lines of Eq. (5) hold, as proved in Proposition 1 in the Supplement. In practice, we calculate noisy gradient estimators, and apply minibatch based stochastic gradient descent (SGD) to solve the optimization problem Eq. (4), as shown in Algorithm 1. + +# 2.2 APPLYING SGLD/SGHMC FOR MODEL SAMPLING + +In Algorithm 1, we need to draw samples from $p _ { \theta } ( x ) q _ { \phi } ( h | x )$ given current $\theta$ and $\phi$ . For continuous observations, SGLD (stochastic gradient Langevin dynamics) (Welling & Teh, 2011) and SGHMC (Stochastic Gradient Hamiltonian Monte Carlo) (Chen et al., 2014) sampling provide mechanisms for exploiting (stochastic) gradients of the target density $p _ { \theta } ( x ) q _ { \phi } ( h | x )$ , enabling efficient exploration of the state space. We take the theoretical results about SGLD from Teh et al. (2016) and SGHMC from Chen et al. (2014), which are briefly summarized in Theorem 1 in the Supplement, and apply them in the sampling step in Algorithm 1. Denoting the target density as $p ( z ; \lambda )$ with given $\lambda$ , Theorem 1 shows that SGLD/SGHMC, by utilizing $\begin{array} { r } { \frac { \partial } { \partial z } \log p ( z ; \lambda ) } \end{array}$ , yields a non-homogeneous Markov chain $\{ z ^ { ( l ) } , l \ge 1 \}$ , which converges to the equilibrium distribution $p ( z ; \lambda )$ . + +By letting $z \triangleq ( x , h ) , p ( z ; \lambda ) \triangleq p _ { \boldsymbol { \theta } } ( x ) q _ { \boldsymbol { \phi } } ( h | x ) , \lambda \triangleq ( \boldsymbol { \theta } , \boldsymbol { \phi } ) ^ { T }$ in Theorem 1, we can perform the sampling step in Algorithm 1 by running $| { \mathcal { M } } |$ parallel chains, each chain being executed as shown + +# Algorithm 2 Sampling from $p _ { \theta } ( x ) q _ { \phi } ( h | x )$ + +1. Do ancestral sampling by the generator, namely first drawing $h ^ { \prime } \sim p ( h ^ { \prime } )$ , and then drawing $x ^ { \prime } \sim q _ { \phi } ( x ^ { \prime } | h ^ { \prime } )$ ; +2. Starting from $\left( x ^ { \prime } , h ^ { \prime } \right) = z ^ { ( 0 ) }$ , run finite steps of SGLD/SGHMC $( l = 1 , \cdots , L )$ to obtain $( x , h ) = z ^ { ( L ) }$ , which we call sample revision, according to Eq. (11)/(12). +Return $( x , h )$ . + +in Algorithm 2. In sample revision, the calculation of the gradient w.r.t. $h$ , $\begin{array} { r } { \frac { \partial } { \partial h } \log p ( z ; \lambda ) = } \end{array}$ $\begin{array} { r } { \frac { \partial } { \partial h } \log q _ { \phi } ( h | x ) = \frac { \partial } { \partial h } \log q _ { \phi } ( h , x ) } \end{array}$ , is straightforward. For the gradient w.r.t. $x$ ∂h , we have + +$$ +\frac { \partial } { \partial x } \log p ( z ; \lambda ) = \frac { \partial } { \partial x } \log p _ { \theta } ( x ) + \frac { \partial } { \partial x } \log q _ { \phi } ( h , x ) - \frac { \partial } { \partial x } \log q _ { \phi } ( x ) \approx \frac { \partial } { \partial x } \log p _ { \theta } ( x ) . +$$ + +The reason is that $\begin{array} { r } { \frac { \partial } { \partial x } \log q _ { \phi } ( x ) } \end{array}$ can be approximated by an unbiased estimate, as proved in Proposition 2 in the Supplement: + +$$ +\frac { \partial } { \partial x } \log q _ { \phi } ( x ) \approx \frac { \partial } { \partial x } \log q _ { \phi } ( h , x ) . +$$ + +Therefore, we can use can apply Theorem 1 i $\textstyle { \frac { \partial } { \partial x } } \log p _ { \theta } ( x ) ^ { 6 }$ as an unbiased estimate of the gradienent with tractable gradients w.r.t. both $\begin{array} { r } { \frac { \partial } { \partial x } \log p ( z ; \lambda ) } \end{array}$ , and we $x$ $h$ + +Remarks. Intuitively, the generator gives a proposal $( x ^ { \prime } , h ^ { \prime } )$ , and then the system follows the gradients of $p _ { \theta } ( x )$ and $q _ { \phi } ( h , x )$ (w.r.t. $x$ and $h$ respectively) to revise $( x ^ { \prime } , h ^ { \prime } )$ to $( x , h )$ . The gradient terms pull samples moving to low energy region of the random field and adjust the latent code of the generator, while the noise term brings randomness. In this manner, we obtain Markov chain samples from $p _ { \theta } ( x ) q _ { \phi } ( h | x )$ . Note that finite steps in sample revision will produce biased estimates of the gradients $\nabla _ { \theta }$ and $\nabla _ { \phi }$ in Eq. (5). We did not find this to pose problems to the SGD optimization in practice, as similarly found in Bornschein $\&$ Bengio (2015) and Kuleshov & Ermon (2017), which work with biased gradient estimators. + +# 2.3 SEMI-SUPERVISED LEARNING WITH INCLUSIVE NRFS + +In the following, we apply our inclusive-NRF approach in the SSL setting to show its flexibility. Note that different models are needed in unsupervised and semi-supervised learning, because SSL needs to additionally consider labels apart from observations. + +Model definition. In semi-supervised tasks, we consider the following RF for joint modeling of observation $x \in \mathbb { R } ^ { d _ { x } }$ and class label $y \in \{ 1 , \cdots , K \}$ : + +$$ +p _ { \theta } ( x , y ) = \frac { 1 } { Z ( \theta ) } \exp \left[ u _ { \theta } ( x , y ) \right] +$$ + +which is different from Eq.1 for unsupervised learning without labels. To implement the potential function $u _ { \boldsymbol { \theta } } ( \boldsymbol { x } , \boldsymbol { y } )$ , we consider a neural network $\Phi _ { \theta } ( x ) \backslash \mathbb { R } ^ { d _ { x } } \mathbb { R } ^ { K }$ , with $x$ as the input and the output size being equal to the number of class labels, $K$ . Then we define $u _ { \theta } ( x , y ) = o n e \bar { h } o t ( y ) ^ { T } \Phi _ { \theta } ( x )$ , where onehot $( y )$ represents the one-hot encoding vector for the label $y$ . In this manner, the conditional density $p _ { \theta } ( y | x )$ is the classifier, defined as follows: + +$$ +p _ { \theta } ( y | x ) = \frac { p _ { \theta } ( x , y ) } { p _ { \theta } ( x ) } = \frac { \exp \left[ u _ { \theta } ( x , y ) \right] } { \sum _ { y } \exp \left[ u _ { \theta } ( x , y ) \right] } +$$ + +which acts like multi-class logistic regression using $K$ logits calculated from $x$ by the neural network $\Phi _ { \theta } ( x )$ . And we do not need to calculate $Z ( \theta )$ for classification. The auxiliary generator is implemented the same as in Eq. 3, i.e. an unconditional generator. + +With the definition the joint density in Eq. 7, it can be shown that, with abuse of notation, the marginal density $\begin{array} { r } { p _ { \theta } ( x ) = \frac { 1 } { Z ( \theta ) } \exp \left[ u _ { \theta } ( x ) \right] } \end{array}$ where $\begin{array} { r } { u _ { \theta } ( x ) \triangleq l o g \sum _ { y } \exp { [ u _ { \theta } ( x , y ) ] } } \end{array}$ . + +Model learning. Suppose that among the data $\mathcal { D } = \{ \tilde { x } _ { 1 } , \cdot \cdot \cdot , \tilde { x } _ { n } \}$ , only a small subset of the observations, for example the first $m$ observations, have class labels, $m \ll n$ . Denote these labeled data as $\mathcal { L } = \{ ( \tilde { x } _ { 1 } , \tilde { y } _ { 1 } ) , \cdot \cdot \cdot , ( \tilde { x } _ { m } , \tilde { y } _ { m } ) \}$ . Then we can formulate the semi-supervised learning as jointly optimizing + +$$ +\left\{ \begin{array} { l l } { \displaystyle { \operatorname* { m i n } _ { \theta } K L \left[ \tilde { p } ( \tilde { x } ) | | p _ { \theta } ( \tilde { x } ) \right] - \alpha _ { d } \sum _ { ( \tilde { x } , \tilde { y } ) \sim \mathcal { L } } l o g p _ { \theta } ( \tilde { y } | \tilde { x } ) } } \\ { \displaystyle { \operatorname* { m i n } _ { \phi } K L \left[ p _ { \theta } ( x ) | | q _ { \phi } ( x ) \right] } } \end{array} \right. +$$ + +which are defined by hybrids of generative and discriminative criteria, similar to Zhu (2006); Larochelle et al. (2012); Kingma et al. (2014). The hyper-parameter $\alpha _ { d }$ controls the relative weight between generative and discriminative criteria. Similar to deriving Eq. (5), it can be easily seen that the gradients w.r.t. $\theta$ and $\phi$ (to be ascended) are defined as follows: + +$$ +\left\{ \begin{array} { l l } { \nabla _ { \theta } ^ { \mathrm { s e m i } } = E _ { \tilde { p } ( \tilde { x } ) } \left[ \nabla _ { \theta } l o g p _ { \theta } ( \tilde { x } ) \right] + \alpha _ { d } \displaystyle \sum _ { ( \tilde { x } , \tilde { y } ) \sim \mathcal { L } } \nabla _ { \theta } l o g p _ { \theta } ( \tilde { y } | \tilde { x } ) } \\ { \quad \quad \quad } \\ { \quad \quad \quad = E _ { \tilde { p } ( \tilde { x } ) } \left[ \nabla _ { \theta } u _ { \theta } ( \tilde { x } ) \right] - E _ { p _ { \theta } ( x ) } \left[ \nabla _ { \theta } u _ { \theta } ( x ) \right] + \alpha _ { d } \displaystyle \sum _ { ( \tilde { x } , \tilde { y } ) \sim \mathcal { L } } \nabla _ { \theta } l o g p _ { \theta } ( \tilde { y } | \tilde { x } ) } \\ { \quad \quad \quad } \\ { \nabla _ { \phi } ^ { \mathrm { s e m i } } = E _ { p _ { \theta } ( x ) } \left[ \nabla _ { \phi } l o g q _ { \phi } ( x ) \right] = E _ { p _ { \theta } ( x ) q _ { \phi } ( h | x ) } \left[ \nabla _ { \phi } l o g q _ { \phi } ( x , h ) \right] } \end{array} \right. +$$ + +In practice, we calculate noisy gradient estimators, and apply minibatch based stochastic gradient descent (SGD) to solve the optimization problem Eq. (9), as shown in Algorithm 3 in the Supplement. Apart from the basic losses as shown in Eq. (9), there are some regularization losses that are found to be helpful to guide SSL learning and are presented in the Supplement. To conclude, we show that the inclusive-NRF can be easily applied to SSL. To the best of our knowledge, there are no priori studies in applying random fields to SSL. The semi-supervised inclusive-NRF model defined above is novel itself for SSL. + +# 3 RELATED WORK + +Comparison and connection of our inclusive-NRF approach with existing studies are provided in the following from three perspectives. + +Learning NRFs with auxiliary generators. These studies are most relevant to this work, which aims to learn NRFs. The classic method for learning RFs is the SML method (Younes, 1989), which works with the single target model $p _ { \theta }$ . Compared to learning traditional RFs which mainly use linear potential functions, learning NRFs which use NN based nonlinear potential functions, is more challenging. A recent progress in learning NRFs as studied in $\mathrm { K i m } \ \&$ Bengio (2016); Xie et al. (2016); Wang & Ou (2017); Kuleshov & Ermon (2017) is to jointly train the target random field $p _ { \theta } ( x )$ and an auxiliary generator $q _ { \phi } ( x )$ . Different studies differ in the objective functions used in the joint training, and thus have different computational and statistical properties. + +• It is shown in Proposition 3 in the Supplement that learning in Kim & Bengio (2016) minimizes the exclusive-divergence $K \bar { L } [ q _ { \phi } | | p _ { \theta } ]$ w.r.t. $\phi$ , which involves the intractable entropy term and tends to enforce the generator to seek modes, yielding missing modes. We refer to this approach as exclusive-NRF. Learning in Wang & Ou (2017) and in this paper minimizes the inclusive-divergence $K L [ p _ { \theta } | | \bar { q } _ { \phi } ]$ w.r.t. $\phi$ . But noticeably, this paper presents our innovation in development of NRFs for continuous data, which is fundamentally different from Wang & Ou (2017) for discrete data. The target NRF model, the generator and the sampler are all different. Wang & Ou (2017) mainly studies random field language models, using LSTM generators (autoregressive with no latent variables) and employing Metropolis independence sampler (MIS) - applicable for discrete data (natural sentences). In this paper, we mainly develop random field models for continuous data (images), using latent-variable generators and utilizing SGLD/SGHMC (with solid theoretical examination) to exploit gradient information in the continuous space. +• In Xie et al. (2016), motivated by interweaving maximum likelihood training of the random field $p _ { \theta }$ and the latent-variable generator $q _ { \phi }$ , a joint training method is introduced. + +Operationally, in learning $\theta$ and $\phi$ , this method also uses Langevin sampling to generate samples. Two Langevin sampling steps are intuitively interleaved according to $\begin{array} { r } { \frac { \partial } { \partial x } \operatorname* { l o g } p _ { \theta } ( x ) \ } \end{array}$ and $\begin{array} { r } { \frac { \partial } { \partial h } \log q _ { \phi } ( h , x ) } \end{array}$ separately. This is different from our sampling step, which moves $( h , x )$ jointly, as theoretically justified in section 2.2. Let $r ( h , x )$ denote the distribution obtained by running the interleaved Langevin transitions starting from $( h , x ) \sim q _ { \phi } ( h , x )$ . Interpretation presented in Xie et al. (2016) relates their method to the following joint optimization problem: + +$$ +\left\{ \begin{array} { l l } { \underset { \theta } { \operatorname* { m i n } } \left\{ K L \left[ \tilde { p } ( \tilde { x } ) | | p _ { \theta } ( \tilde { x } ) \right] - K L \left[ r ( h , x ) | | p _ { \theta } ( x ) \right] \right\} } \\ { \underset { \phi } { \operatorname* { m i n } } K L \left[ r ( h , x ) | | q _ { \phi } ( h , x ) \right] } \end{array} \right. +$$ + +which is also different from ours as shown in Eq. (4). Thus, learning in Xie et al. (2016) does not aim to minimize the inclusive-divergence $K L [ p _ { \theta } | | q _ { \phi } ]$ w.r.t. $\phi$ . + +• Learning in Kuleshov & Ermon (2017) minimizes the $\chi ^ { 2 }$ -divergence $\chi ^ { 2 } [ q _ { \phi } | | p _ { \theta } ] \triangleq$ $\int { \frac { \left( p _ { \theta } - q _ { \phi } \right) ^ { 2 } } { q _ { \phi } } }$ w.r.t. $\phi$ , which also tends to drive the generator to cover modes. But this approach is severely limited by the high variance of the gradient estimator w.r.t. $\phi$ , and is only tested on the simpler MNIST and Omniglot. + +Additionally, different NRF studies also differ in models used in the joint training. For example, the target NRF used in this work is different from those in previous studies Kim & Bengio (2016); Wang & Ou (2017); Xie et al. (2016). The differences are: Kim & Bengio (2016) includes linear and squared terms in $u _ { \theta } ( x )$ , Wang & Ou (2017) defines over sequences, and Xie et al. (2016) defines in the form of exponential tilting of a reference distribution (Gaussian white noise). There exist different choices for the generator, such as GAN models in Kim & Bengio (2016), LSTMs in Wang & Ou (2017), or latent-variable models in both Xie et al. (2016) and this work. All are easy to do sampling. + +Moreover, all the previous NRF studies examine unsupervised learning, and none shows application or extension of their methods or models for semi-supervised learning. + +Monte Carlo sampling. One step in our inclusive-NRF approach is to apply SGLD/SGHMC to draw samples from the target density $p _ { \theta }$ , starting from the proposal sample from the generator. Theoretically, improvements in NRF sampling methods could be potentially integrated into NRF learning algorithms. For example, it is recently studied in Levy et al. (2018) to learn MCMC transition kernels, also parameterized by neural networks, to improve the HMC sampling from the given target distribution. Integration into learning NRFs is interesting but outside the scope of this paper. + +Comparison and connection with GANs. On the one hand, there are some efforts that aim to address the inability of GANs to provide sensible energy estimates for samples. The energy-based GANs (Zhao et al., 2017) proposes to view the discriminator as an energy function by designing an auto-encoder discriminator. The recent work in Dai et al. (2017a) connects Zhao et al. (2017) and Kim & Bengio (2016), and show another two approximations for the entropy term. However, it is known that as the generator converges to the true data distribution, the GAN discriminator converges to a degenerate uniform solution. This basically afflicts the GAN discriminator to provide density information, though there are some modifications. In contrast, our inclusive-NRFs, unlike GANs, naturally provide (unnormalized) density estimate. Moreover, none of the above energy-related GAN studies examine their methods or models for SSL, except in EBGAN which performs moderately. + +On the other hand, there are interesting connections between inclusive-NRFs and GANs, as elaborated in section 11 in the Supplement. When interpreting the potential function $u _ { \theta } ( x )$ as the critic in Wasserstein GANs, inclusive-NRFs seem to be similar to Wasserstein GANs. A difference is that in optimizing $\theta$ in inclusive-NRFs, the generated samples are further revised by taking finite-stepgradient of $u _ { \theta } ( x )$ w.r.t. $x$ . However, the critic in Wasserstein GANs can hardly be interpreted as an unnormalized log-density. Thus strictly speaking, inclusive-NRFs are not GAN-like. + +# 4 EXPERIMENTS + +We conduct a series of experiments to evaluate the performances of our approach (inclusive-NRFs) and various existing methods on synthetic and real-world datasets for both unsupervised and semisupervised learning tasks, with both visual and numerical evaluation. We refer to the Supplement for experimental details and additional results. + +![](images/5ecbedd308440dd389e2ff57d70a9f93f36c595291451de38c7ace0aeebe7f1b.jpg) +Figure 1: Comparison of different methods over GMM synthetic data. Stochastic generations from GAN with logD trick, WGAN-GP, Exclusive-NRF, Inclusive-NRF generation (i.e. sampling from the auxiliary generator) and Inclusive-NRF revision (i.e. after performing sample revision over samples from the auxiliary generator), are shown in (b)-(f) respectively. Inclusive-NRF generation and inclusive-NRF revision are two manners to generate samples, given a trained NRF. For both manners, the NRF model is trained with the sample revision step. Each generation contains 1,000 samples. The learned potentials $u _ { \theta } ( x )$ from exclusive and inclusive NRFs are shown in (g) and (h) respectively, where the red dots indicate the mean of each Gaussian component. Inclusive NRFs are clearly superior in learning data density and sample generation. + +# 4.1 GMM SYNTHETIC EXPERIMENT + +The synthetic data consist of 1,600 training examples generated from a 2D Gaussian mixture model (GMM) with 32 equally-weighted, low-variance $\mathit { \check { \sigma } } = 0 . 1$ ) Gaussian components, uniformly laid out on four concentric circles as in Figure 1(a). The data distribution exhibits many modes separated by large low-probability regions, which makes it suitable to examine how well different learning methods can deal with multiple modes. For comparison, we experiment with GAN with logD trick (Goodfellow et al., 2014) and WGAN-GP (Gulrajani et al., 2017) for directed generative model, exclusive-NRF (Kim & Bengio, 2016) and inclusive-NRF for undirected generative model. + +Figure 1 visually shows the generated samples from the trained models using different methods. Table 1 reports the “covered modes” and “realistic ratio” as numerical measures of how the multi-modal data are fitted, similarly as in Dumoulin et al. (2017). The main observations are as follows. (1) GAN suffers from mode missing, generating realistic but not diverse samples. WGAN-GP increases “covered modes” but decreases “realistic ratio”. Inclusive-NRF performs much better than both GAN and WGAN-GP in sample generation. (2) Inclusive-NRF outperforms exclusive-NRF in both sample generation and density estimation. (3) After revision, samples from inclusive-NRF become more like real samples, achieving the best in both “covered modes" and “realistic ratio” metrics. + +# 4.2 IMAGE GENERATION ON CIFAR-10 + +We examine both unsupervised and supervised learning over the widely used real-world dataset CIFAR-10 Krizhevsky (2009) for image generation. To evaluate generation quality quantitatively, we use inception score (IS) Salimans et al. (2016), and Frechet inception distance (FID) Heusel et al. (2017). Table 2 reports the inception score and FID for state of the art methods, for both unsupervised and supervised settings. The supervised learning of inclusive-NRF is conducted as a special case of semi-supervised learning over all labeled images $m = n$ ), which uses unconditional generation. We use ResNet in this experiment, see section 12.2 in the Supplement for experimental details. + +Table 1: Numerical evaluations over the GMM (32 components) synthetic data. The “covered modes” metric is defined as the number of covered modes by a set of generated samples. The “realistic ratio” metric is defined as the proportion of generated samples which are close to a mode. The measurement details are presented in section 12.1 in the Supplement. Mean and SD are from 10 independent runs. + +
Methodscovered modesrealistic ratio
GAN with logD trick22.25 ± 1.540.90 ± 0.01
WGAN-GP (Gulrajani et al.,2017)27.81 ± 1.400.74±0.04
Exclusive-NRF(Kim& Bengio,2016)28.14±0.680.73 ± 0.03
Inclusive-NRF generation29.52± 0.540.84± 0.01
Inclusive-NRF revision30.75 ± 0.430.97 ± 0.01
+ +Table 2: Inception score (IS) and FID on CIFAR-10 for unsupervised and supervised learning. + +
MethodsUnsupervisedSupervised
ISFIDISFID
DCGAN (Radford et al., 2015)6.16 ± 0.076.58
Improved-GAN (Salimans et al., 2016)8.09 ±0.07
WGAN-GP (Gulrajani et al., 2017)7.86 ± 0.078.42 ±0.10
SGAN (Huang et al., 2017)8.59 ± 0.12
DFM(Warde-Farley & Bengio,2017)7.72 ± 0.13
CT-GAN (Wei et al., 2018)8.12 ±0.128.81 ± 0.13
Fisher-GAN (Mroueh & Sercu,2017)7.90 ± 0.058.16 ± 0.12
BWGAN (Adler & Lunz, 2018)8.26 ± 0.07
SNGAN (Miyato et al., 2018)8.22 ± 0.0521.7 ± 0.21
Inclusive-NRF generation8.28 ± 0.0920.9 ±0.259.06 ± 0.1018.1 ± 0.23
+ +From the comparison results in Table 2, it can be seen that the proposed inclusive-NRF model achieves the best inception score over CIFAR-10, to the best of our knowledge, in both unsupervised and supervised settings. Some generated samples are shown in Figure 5(c)(d) for unsupervised and supervised settings respectively. We also show in the Supplement the capability of inclusive-NRFs in latent space interpolation (section 14) and conditional generation (section 15). + +# 4.3 SEMI-SUPERVISED LEARNING RESULTS + +For semi-supervised learning, we consider the three widely used benchmark datasets, namely MNIST (LeCun et al., 1998), SVHN (Netzer et al., 2011), and CIFAR-10 (Krizhevsky, 2009). As in previous work, we randomly sample 100, 1,000, and 4,000 labeled samples from MNIST, SVHN, and CIFAR10 respectively during training, and use the standard data split for testing. See section 12.3 in the Supplement for experimental details. We also provide a SSL toy experiment in section 13 in the Supplement to help understanding how semi-supervised inclusive-NRF works. + +It can be seen from Table 3 that semi-supervised inclusive-NRFs produce strong classification results on par with state-of-art DGM-based SSL methods. See Figure 5(a)(b) in the Supplement for generated samples. Bad-GANs achieve better classification results, but as indicated by the low inception score, their generation is much worse than semi-NRF-IAGs. In fact, among DGM-based SSL methods, inclusive-NRFs achieve the best performance in sample generation. This is in contrast to the conflict of good classification and good generation, as observed in GAN-based SSL (Salimans et al., 2016; Dai et al., 2017b). It is analyzed in Dai et al. (2017b) that good GAN-based SSL requires a bad generator7. This is embarrassing and in fact obviates the original idea of generative SSL - successful generative training, which indicates good generation, provides regularization for finding good classifiers (Zhu, 2006; Larochelle et al., 2012). In this sense, Bad-GANs could hardly be classified as a generative SSL method. + +Table 3: Comparison with state-of-the-art methods on three benchmark datasets. “CIFAR-10 IS” means the inception score for samples generated by SSL models trained on CIFAR-10. “†” is obtained by running the released code accompanied by the corresponding papers. “-” means the results are not reported in the original work and without released code. “/” means not applicable, e.g. the models cannot generate samples stochastically. “ $\ddag ^ { \prime \prime }$ uses image data augmentation which significantly helps classification performance. The upper/lower blocks show generative/discriminative SSL methods respectively. + +
Methodserror (%) MNISTerror (%) SVHNerror (%) CIFAR-10IS CIFAR-10
CatGAN (Springenberg,2016)1.91 ± 0.1019.58 ± 0.463.57± 0.13†
SDGM (Maaloe et al., 2016)1.32 ± 0.0716.61 ± 0.241
Ladder network (Rasmus et al.,2015)1.06 ± 0.3720.40 ± 0.47/
ADGM (Maaloe et al., 2016)0.96 ± 0.0222.861-
Improved-GAN (Salimans et al.,2016)0.93 ± 0.078.11 ±1.318.63 ± 2.323.87± 0.03
EBGAN (Zhao et al.,2017)1.04 ± 0.12-=-
ALI (Dumoulin et al., 2017)7.42 ± 0.6517.99 ± 1.62
Triple-GAN (Li et al., 2017)0.91 ± 0.585.77 ± 0.1716.99 ± 0.365.08 ±0.09
Triangle-GAN (Gan et al., 2017)-16.80 ±0.42=
BadGAN (Dai et al., 2017b)0.80 ± 0.104.25 ± 0.0314.41 ± 0.303.46 ± 0.11†
Sobolev-GAN (Mroueh et al., 2018)=15.77 ± 0.19
Semi-supervised inclusive-NRF0.97 ± 0.105.84 ±0.1515.12 ± 0.367.72 ± 0.09
Results below this line cannot be directly compared to those above.
VAT small (Miyato et al., 2017)1.366.8314.87/
II model‡ (Laine & Aila,2017)-4.82 ± 0.1712.36 ± 0.31
Temporal Ensembling‡ (Laine & Aila,2017)4.42 ± 0.1612.16 ± 0.31/
Mean Teacher‡ (Tarvainen& Valpola,2017)3.95 ±0.1912.31 ±0.28/
VAT+EntMin‡ (Miyato et al.,2017)3.8610.55/
CT-GAN‡ (Wei et al., 2018)0.89 ± 0.13-9.98 ± 0.21/
+ +Finally, note that some discriminative SSL methods, as listed in the lower block in Table 3 also produce superior performances, by utilizing data augmentation and consistency regularization. However, these methods are unable to generate (realistic) samples. It can be seen that discriminative SSL methods utilize different regularization from generative SSL methods and cannot be directly compared to generative SSL methods. Their combination, as an interesting future work, could yield further performance improvement. + +# 4.4 ABLATION STUDY + +We report the results of ablation study of our inclusive-NRF method on CIFAR-10 in Table 4. In this experiment, we use the standard CNN (Miyato et al., 2018) for unsupervised learning and the same networks as those used in Table 3 for semi-supervised learning. See section 12.4 in the Supplement for experimental details. We analyze the effects of different settings in model training, such as using SGLD or SGHMC and the revision step $L = 1 / 5 / 1 0$ used. For each training setting, we also compare the two manners to generate samples - whether applying sample revision or not in inference (generating samples) given a trained NRF, as previously illustrated in Figure 1 over synthetic GMM data. The main observations are as follows. + +First, given a trained NRF, after revision (i.e. following the gradient of the RF’s potential $u _ { \theta } ( x )$ w.r.t. $x$ ), the quality (IS) of samples is always improved, as shown by the consistent IS improvement from the second column (generation) to the third (revision). This is in accordance with the results in the GMM synthetic experiments. Moreover, noting that in revision, it is the the estimated density $p _ { \theta }$ that guides the samples towards low energy region of the random field. This demonstrates one benefit of random field modeling, which, unlike GANs, can learn density estimate about the data manifold. + +Second, a row-wise reading of Table 4 reveals that with more revision steps and using SGHMC in training, the SSL classification performance is improved. Utilizing SGHMC in inclusive-NRFs to exploit gradient information with momentum yields better performance than simple SGLD as used in Xie et al. (2016). It is also found that more revision steps in model training do not significantly improve unsupervised IS. So we can use $L = 1$ in unsupervised learning for generation, which can reduce the computational cost. + +Table 4: Ablation study of our inclusive-NRF method on CIFAR-10, regarding the effects of using SGLD or SGHMC in training and of applying sample revision in inference (generating samples). Mean and SD are from 5 independent runs for each training setting. In each training setting, for unsupervised learning, two manners to generate samples given a trained NRF are compared, as previously illustrated in Figure 1 over synthetic GMM data. We examine generated samples (i.e. directly from the generator) and revised samples (i.e. after sample revision) respectively, in term of inception scores (IS). For semi-supervised learning, we examine the classification error rates. + +
Training SettingUnsupervisedSemi-supervised error (%)
Generation ISRevision IS
SGLD L =17.47 ± 0.157.53 ± 0.1317.08 ± 0.39
SGLD L = 57.44± 0.167.49 ± 0.1216.15 ± 0.44
SGLD L = 107.43 ± 0.187.50 ± 0.1315.60 ± 0.31
SGHMC L = 107.46 ± 0.127.57 ± 0.1015.12 ± 0.36
+ +# 5 DISCUSSION AND CONCLUSION + +In this paper we develop the inclusive-NRF approach, which learns NRFs with inclusive auxiliary generators and particularly for continuous data, exploits gradient information in model sampling with solid theoretical examination. Extensive empirical evaluations show that inclusive-NRFs obtain state-of-the-art sample generation quality and achieve strong semi-supervised learning results on par with state-of-the-art DGMs. The superior performances presumably are attributed to the two distinctive features in inclusive-NRFs - introducing the inclusive-divergence minimized auxiliary generator and utilizing sample revision by SGLD/SGHMC. Intuitively, the revised samples from the RF will guide the training of the generator, and subsequently the generator will propose samples for the RF to sense the data manifold. This forms positive interactions between the random field and the generator, which enables successful joint training of both models. + +The new approach enables us to flexibly use NRFs in unsupervised, supervised and semi-supervised settings and successfully train them in a black-box manner. Interesting future work will consider inclusive-NRFs in more challenging tasks, e.g. unsupervised and semi-supervised learning with sequential data (e.g. speech, language, video, etc.). + +# REFERENCES + +Jonas Adler and Sebastian Lunz. Banach wasserstein gan. arXiv preprint arXiv:1806.06621, 2018. + +Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In ICML, 2017. + +Jörg Bornschein and Yoshua Bengio. Reweighted wake-sleep. In ICML, 2015. + +Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient hamiltonian monte carlo. In ICML, 2014. + +Jifeng Dai, Yang Lu, and Ying-Nian Wu. Generative modeling of convolutional neural networks. arXiv preprint arXiv:1412.6296, 2014. + +Zihang Dai, Amjad Almahairi, Philip Bachman, Eduard Hovy, and Aaron Courville. Calibrating energy-based generative adversarial networks. In ICLR, 2017a. + +Zihang Dai, Zhilin Yang, Fan Yang, William W Cohen, and Ruslan R Salakhutdinov. Good semi-supervised learning that requires a bad gan. In NIPS, 2017b. + +Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Olivier Mastropietro, Alex Lamb, Martin Arjovsky, and Aaron Courville. Adversarially learned inference. In ICLR, 2017. + +Zhe Gan, Liqun Chen, Weiyao Wang, Yuchen Pu, Yizhe Zhang, Hao Liu, Chunyuan Li, and Lawrence Carin. Triangle generative adversarial networks. In NIPS, 2017. + +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014. + +Ishaan Gulrajani, Faruk Ahmed, Martín Arjovsky, Vincent Dumoulin, and Aaron C. Courville. Improved training of wasserstein gans. In NIPS, 2017. + +Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In NIPS, 2017. + +Geoffrey E Hinton, Peter Dayan, Brendan J Frey, and Radford M Neal. The "wake-sleep" algorithm for unsupervised neural networks. Science, 268(5214):1158–1161, 1995. + +Xun Huang, Yixuan Li, Omid Poursaeed, John Hopcroft, and Serge Belongie. Stacked generative adversarial networks. In CVPR, 2017. + +Taesup Kim and Yoshua Bengio. Deep directed generative models with energy-based probability estimation. In ICLR Workshop, 2016. + +Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014. + +Diederik P. Kingma, Danilo Jimenez Rezende, Shakir Mohamed, and Max Welling. Semi-supervised learning with deep generative models. In NIPS, 2014. + +Daphne Koller and Nir Friedman. Probabilistic graphical models: principles and techniques. MIT press, 2009. + +Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. + +Volodymyr Kuleshov and Stefano Ermon. Neural variational inference and learning in undirected graphical models. In NIPS, 2017. + +Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In ICLR, 2017. + +Hugo Larochelle, Michael I Mandel, Razvan Pascanu, and Yoshua Bengio. Learning algorithms for the classification restricted boltzmann machine. Journal of Machine Learning Research, 13(1):643–669, 2012. + +Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. + +Yann LeCun, Sumit Chopra, Raia Hadsell, M Ranzato, and F Huang. A tutorial on energy-based learning. Predicting structured data, 2006. + +Daniel Levy, Matthew D. Hoffman, and Jascha Sohl-Dickstein. Generalizing hamiltonian monte carlo with neural networks. In ICLR, 2018. + +Chongxuan Li, Taufik Xu, Jun Zhu, and Bo Zhang. Triple generative adversarial nets. In NIPS, 2017. + +Xuanqing Liu and Cho-Jui Hsieh. From adversarial training to generative adversarial networks. arXiv preprint arXiv:1807.10454, 2018. + +Lars Maaloe, Casper Kaae Sonderby, Soren Kaae Sonderby, and Ole Winther. Auxiliary deep generative models. In ICML, 2016. + +Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. arXiv preprint arXiv:1704.03976, 2017. + +Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In ICLR, 2018. + +Youssef Mroueh and Tom Sercu. Fisher gan. In NIPS, 2017. + +Youssef Mroueh, Chun-Liang Li, Tom Sercu, Anant Raj, and Yu Cheng. Sobolev GAN. In ICLR, 2018. + +Radford M Neal. Mcmc using hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2011. + +Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, 2011. + +Jiquan Ngiam, Zhenghao Chen, Wei Koh Pang, and Andrew Y. Ng. Learning deep energy models. In ICML, 2012. + +Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015. + +Antti Rasmus, Harri Valpola, Mikko Honkala, Mathias Berglund, and Tapani Raiko. Semi-supervised learning with ladder networks. In NIPS, 2015. + +R. Salakhutdinov and G. Hinton. Deep boltzmann machines. Journal of Machine Learning Research, 5(2):1967 – 2006, 2009. + +Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, 2016. + +Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. In ICML, 2016. + +Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NIPS, 2017. + +Yee Whye Teh, Alexandre H. Thiery, and Sebastian Vollmer. Consistency and fluctuations for stochastic gradient langevin dynamics. Journal of Machine Learning Research, 17:1–33, 2016. + +Bin Wang and Zhijian Ou. Language modeling with neural trans-dimensional random fields. In IEEE Workshop on Automatic Speech Recognition and Understanding (ASRU), 2017. + +David Warde-Farley and Yoshua Bengio. Improving generative adversarial networks with denoising feature matching. In ICLR, 2017. + +Xiang Wei, Zixia Liu, Liqiang Wang, and Boqing Gong. Improving the improved training of wasserstein GANs. In ICLR, 2018. + +Max Welling and Yee Whye Teh. Bayesian learning via stochastic gradient langevin dynamics. In ICML, 2011. + +Jianwen Xie, Yang Lu, Song-Chun Zhu, and Ying Nian Wu. Cooperative training of descriptor and generator networks. arXiv preprint arXiv:1609.09408 [v3], 2016. + +Laurent Younes. Parametric inference for imperfectly observed gibbsian fields. Probability Theory and Related Fields, 82:625–645, 1989. + +Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial networks. In ICLR, 2017. + +Xiaojin Zhu. Semi-supervised learning literature survey. Technical report, University of Wisconsin-Madison, 2006. + +# Supplement for “Learning Neural Random Fields with Inclusive Auxiliary Generators” + +# 6 PROOF OF PROPOSITION 1 + +Proposition 1. Both lines of Eq.(5) for gradient calculations hold. + +Proof. The first line of Eq.(5) can be obtained by directly taking derivative of $K L [ \tilde { p } ( \tilde { x } ) | | p _ { \theta } ( \tilde { x } ) ]$ w.r.t. $\theta$ , as shown below, + +$$ +\frac { \partial } { \partial \theta } K L \left[ \tilde { p } ( \tilde { x } ) | | p _ { \theta } ( \tilde { x } ) \right] = \frac { \partial } { \partial \theta } \int \tilde { p } ( \tilde { x } ) \log \frac { \tilde { p } ( \tilde { x } ) } { p _ { \theta } ( \tilde { x } ) } d \tilde { x } = - \int \tilde { p } ( \tilde { x } ) \frac { \partial } { \partial \theta } \log p _ { \theta } ( \tilde { x } ) d \tilde { x } , +$$ + +and then applying the basic formula of Eq. (2). + +For the second line, by direct calculation, we first have + +$$ +\begin{array} { l } { E _ { q _ { \phi } ( h | x ) } \left[ \nabla _ { \phi } \log q _ { \phi } ( h | x ) \right] = \displaystyle \int q _ { \phi } ( h | x ) q _ { \phi } ( h | x ) ^ { - 1 } \nabla _ { \phi } q _ { \phi } ( h | x ) d h } \\ { \displaystyle \qquad = \int \nabla _ { \phi } q _ { \phi } ( h | x ) d h = \nabla _ { \phi } \int q _ { \phi } ( h | x ) d h = \nabla _ { \phi } 1 = 0 . } \end{array} +$$ + +Then combining $\begin{array} { r } { \frac { \partial } { \partial \phi } K L \left[ p _ { \theta } ( x ) | | q _ { \phi } ( x ) \right] = - E _ { p _ { \theta } ( x ) } \left[ \nabla _ { \phi } \log q _ { \phi } ( x ) \right] } \end{array}$ and + +$$ +\begin{array} { r l } & { \nabla _ { \phi } \log q _ { \phi } ( x ) = E _ { q _ { \phi } ( h \vert x ) } \left[ \nabla _ { \phi } \log q _ { \phi } ( x ) \right] = E _ { q _ { \phi } ( h \vert x ) } \left[ \nabla _ { \phi } \log q _ { \phi } ( x , h ) - \nabla _ { \phi } \log q _ { \phi } ( h \vert x ) \right] } \\ & { \qquad = E _ { q _ { \phi } ( h \vert x ) } \left[ \nabla _ { \phi } \log q _ { \phi } ( x , h ) \right] . } \end{array} +$$ + +will give the second line of Eq.(5). + +# 7 SGLD/SGHMC + +Theorem 1. Denote the target density as $p ( z ; \lambda )$ with given $\lambda .$ . Assume that one can compute a noisy, unbiased estimate which contains al $\Delta ( z , \xi ; \lambda )$ to the gradient mness involved $\begin{array} { r } { \frac { \partial } { \partial z } \log p ( z ; \lambda ) } \end{array}$ , where ng the e $\xi$ is an auxiliaryimate, namely $E \left[ \Delta ( z , \xi ; \lambda ) \right] =$ $\begin{array} { r } { \frac { \partial } { \partial z } \log p ( z ; \lambda ) } \end{array}$ . Assume the stability Assumptions $^ { 4 }$ in Teh et al. (2016) holds. + +For a sequence of asymptotically vanishing time-steps $\{ \delta \boldsymbol { { l } } , \boldsymbol { { l } } \ge 1 \}$ (satisfying $\textstyle \sum _ { l = 1 } ^ { \infty } \delta _ { l } = \infty$ and $\textstyle \sum _ { l = 1 } ^ { \infty } \delta _ { l } ^ { 2 } < \infty )$ , an i.i.d. sequence $\eta ^ { ( l ) }$ , and an independent and i.i.d. sequence $\xi _ { l }$ of auxiliary random variables, $l \geq 1$ , the SGLD iterates as follows, starting from $z ^ { ( 0 ) }$ : + +$$ +z ^ { ( l ) } = z ^ { ( l - 1 ) } + \frac { \delta _ { l } } { 2 } \Delta ( z ^ { ( l - 1 ) } , \xi _ { l } ; \lambda ) + \sqrt { \delta _ { l } } \eta ^ { ( l ) } , \eta ^ { ( l ) } \sim \mathcal { N } ( 0 , I ) , l = 1 , \cdots +$$ + +Starting from $z ^ { ( 0 ) }$ and $v ^ { ( 0 ) } = 0$ , the SGHMC iterates as follows: + +$$ +\left\{ \begin{array} { l l } { \displaystyle v ^ { ( l ) } = \beta v ^ { ( l - 1 ) } + \frac { \delta _ { l } } { 2 } \Delta ( z ^ { ( l - 1 ) } , \xi _ { l } ; \lambda ) + \sqrt { \delta _ { l } } \eta ^ { ( l ) } , \eta ^ { ( l ) } \sim \mathcal { N } ( 0 , I ) } \\ { z ^ { ( l ) } = z ^ { ( l - 1 ) } + v ^ { ( l ) } , l = 1 , \cdots } \end{array} \right. +$$ + +Then in both cases, the non-homogeneous Markov chain $\{ z ^ { ( l ) } , l \ge 1 \}$ converges to the equilibrium distribution $p ( z ; \lambda )$ . + +# 8 PROOF OF PROPOSITION 2 + +Proposition 2. Let $z \triangleq ( x , h ) , p ( z ; \lambda ) \triangleq p _ { \theta } ( x ) q _ { \phi } ( h | x ) , \lambda \triangleq ( \theta , \phi ) ^ { T }$ in Theorem 1. The initial value $( x ^ { ( 0 ) } , h ^ { ( 0 ) } )$ is obtained from ancestral sampling by the generator. The SGLD/SGHMC as shown in Eq. $( l I ) / ( l 2 )$ iteratively generates $( x ^ { ( m ) } , h ^ { ( m ) } )$ , $m = 1 , \cdots$ . Then, $\begin{array} { r } { \frac { \partial } { \partial x ^ { ( m ) } } \log q _ { \phi } ( h ^ { ( m ) } , x ^ { ( m ) } ) } \end{array}$ is an unbiased estimate of the gradient $\frac { \partial } { \partial x ^ { ( m ) } } \log q _ { \phi } \big ( x ^ { ( m ) } \big )$ , $m = 0 , 1 , \cdots$ . + +Proof. Note that Langevin dynamics and Hamiltonian dynamics are reversible Neal (2011). Thus the SGLD/SGHMC transitions Eq.(11)/(12) satisfy the detailed balance condition: + +π $\tau ( h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } ) K ( h ^ { ( m ) } , x ^ { ( m ) } | h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } ) = \pi ( h ^ { ( m ) } , x ^ { ( m ) } ) K ( h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } | h ^ { ( m ) } , x ^ { ( m ) } ) ,$ where $\pi ( \cdot )$ denotes the target density, and $K ( \cdot | \cdot )$ denotes the transition kernel. Also note that $\begin{array} { r } { E _ { h \sim q _ { \phi } ( h | x ) } \left[ \frac { \partial } { \partial x } \log q _ { \phi } ( h , x ) \right] = \frac { \partial } { \partial x } \log q _ { \phi } ( x ) } \end{array}$ . Thus if we show that $h ^ { ( m ) }$ is indeed drawn from $q _ { \phi } ( h ^ { ( m ) } | x ^ { ( m ) } )$ during sample revision, $m = 0 , 1 , \cdots$ , then the unbiasedness will hold. + +Denote by $\pi ^ { ( m ) } ( h ^ { ( m ) } , x ^ { ( m ) } )$ the state-occupation density at step $m$ . Then we need to show that $\pi ^ { ( m ) } ( h ^ { ( m ) } | x ^ { ( m ) } )$ actually follows $\pi ( h ^ { ( m ) } | x ^ { ( m ) } )$ , i.e. $q _ { \phi } ( h ^ { ( m ) } | x ^ { ( m ) } )$ , $m = 0 , 1 , \cdots$ . + +First, it is obvious that this holds for $( h ^ { ( 0 ) } , x ^ { ( 0 ) } )$ . Then, we proceed by mathematical induction. Suppose $\pi ^ { ( m - 1 ) } ( h ^ { ( m - 1 ) } | x ^ { ( m - 1 ) } ) = \pi \big ( h ^ { ( m - 1 ) } | x ^ { ( m - 1 ) } \big )$ . Then we have + +$$ +\begin{array} { r l } & { \quad \pi ^ { ( m - 1 ) } ( h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } ) K ( h ^ { ( m ) } , x ^ { ( m ) } | h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } ) } \\ & { = \pi ^ { ( m - 1 ) } ( h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } ) \frac { \pi ( h ^ { ( m ) } , x ^ { ( m ) } ) } { \pi \left( h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } \right) } K ( h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } | h ^ { ( m ) } , x ^ { ( m ) } ) . } \end{array} +$$ + +Integrating out $( h ^ { ( m - 1 ) } , x ^ { ( m - 1 ) } )$ from both sides of Eq.13, we obtain + +$$ +\begin{array} { l } { \pi ^ { ( m ) } ( h ^ { ( m ) } , x ^ { ( m ) } ) = \pi ( h ^ { ( m ) } , x ^ { ( m ) } ) \displaystyle \sum _ { x ^ { ( m - 1 ) } } \frac { \pi ^ { ( m - 1 ) } ( x ^ { ( m - 1 ) } ) } { \pi ( x ^ { ( m - 1 ) } ) } K ( x ^ { ( m - 1 ) } | h ^ { ( m ) } , x ^ { ( m ) } ) } \\ { = \pi ( h ^ { ( m ) } , x ^ { ( m ) } ) \displaystyle \sum _ { x ^ { ( m - 1 ) } } \frac { \pi ^ { ( m - 1 ) } ( x ^ { ( m - 1 ) } ) } { \pi ( x ^ { ( m - 1 ) } ) } K ( x ^ { ( m - 1 ) } | x ^ { ( m ) } ) } \end{array} +$$ + +where the second equality, i.e. $K ( x | h ^ { \prime } , x ^ { \prime } ) = K ( x | x ^ { \prime } )$ , holds because in the SGLD/SGHMC transitions Eq.(11)/(12), generating next step $x$ only depends on current $x ^ { \prime }$ and is independent of current $h ^ { \prime }$ . Then we have + +$$ +\pi ^ { ( m ) } ( h ^ { ( m ) } | x ^ { ( m ) } ) = \pi ( h ^ { ( m ) } | x ^ { ( m ) } ) \frac { \pi ( x ^ { ( m ) } ) } { \pi ^ { ( m ) } ( x ^ { ( m ) } ) } \sum _ { x ^ { ( m - 1 ) } } \frac { \pi ^ { ( m - 1 ) } ( x ^ { ( m - 1 ) } ) } { \pi ( x ^ { ( m - 1 ) } ) } K ( x ^ { ( m - 1 ) } | x ^ { ( m ) } ) +$$ + +where the second equality holds because we have + +$$ +\begin{array} { c } { { \displaystyle \frac { \pi ( x ^ { ( m ) } ) } { \pi ^ { ( m ) } ( x ^ { ( m ) } ) } \sum _ { x ^ { ( m - 1 ) } } \frac { \pi ^ { ( m - 1 ) } ( x ^ { ( m - 1 ) } ) } { \pi ( x ^ { ( m - 1 ) } ) } K ( x ^ { ( m - 1 ) } | x ^ { ( m ) } ) } } \\ { { = \displaystyle \frac { 1 } { \pi ^ { ( m ) } ( x ^ { ( m ) } ) } \sum _ { x ^ { ( m - 1 ) } } \pi ^ { ( m - 1 ) } ( x ^ { ( m - 1 ) } ) \frac { K ( x ^ { ( m - 1 ) } | x ^ { ( m ) } ) \pi ( x ^ { ( m ) } ) } { \pi ( x ^ { ( m - 1 ) } ) } } } \\ { { = 1 } } \end{array} +$$ + +Thereby, we show $h ^ { ( m ) } \sim \pi ( h ^ { ( m ) } | x ^ { ( m ) } )$ , i.e. $q _ { \phi } ( h ^ { ( m ) } | x ^ { ( m ) } )$ . This concludes the inductive step. + +# 9 SEMI-SUPERVISED LEARNING WITH INCLUSIVE-NRFS + +Apart from the basic losses, as shown in Eq.10, in applying inclusive-NRFs in SSL, there are some regularization losses that are helpful to guide the semi-supervised learning. + +Algorithm 3 Semi-supervised learning of inclusive-NRFs + +
repeat Sampling:
Draw a unsupervised minibatch U ~ p(x)pe(x)qp(h|x) and a supervised minibatch S ~ L; Updating:
Update θby ascending: ∑(x,x,h)~u[Vθuθ(x)-Vθue(x)]+ad∑(x,g)~s [Vθlogpe(i|x)]
-∑(x,x,h)~u [acVθH(pθ(y|z))+apVθ[uθ(x)]²];
Update by ascending:
∑(x,x,h)~u Vlogq(x,h); until convergence
+ +Confidence loss. Similar to Springenberg (2016); Li et al. (2017), we add the minimization of the conditional entropy of $p _ { \theta } ( y | \tilde { x } )$ averaged over training data to the loss w.r.t. $\theta$ (i.e. the first line in Eq.9) as follows: + +$$ +L _ { c } ( \theta ) = E _ { \tilde { p } ( \tilde { x } ) } \left[ H ( p _ { \theta } ( y | \tilde { x } ) ) \right] = - E _ { \tilde { p } ( \tilde { x } ) } \left[ \sum _ { y } p _ { \theta } ( y | \tilde { x } ) \log p _ { \theta } ( y | \tilde { x } ) \right] +$$ + +In this manner, we encourage the classifier $p _ { \theta } ( y | x )$ derived from the RF to make classifications confidently. In practice, we use stochastic gradients of $L _ { c } ( \theta )$ over minibatches in optimizing $\theta$ , as shown in Algorithm 3. + +Potential control loss. For random fields, the data log-likelihood $l o g p \theta ( \tilde { x } )$ is determined relatively by the potential value $u _ { \theta } ( \tilde { x } )$ . To avoid the potential values not to increase unreasonably, we could control the squared potential values, by minimizing: + +$$ +L _ { p } ( \theta ) = E _ { \tilde { p } ( \tilde { x } ) } \left[ u _ { \theta } ( \tilde { x } ) \right] ^ { 2 } +$$ + +In this manner, the potential values would be attracted to zeros. In practice, we use stochastic gradients of $L _ { p } ( \theta )$ over minibatches in optimizing $\theta$ , as shown in Algorithm 3. + +# 10 PROOF OF PROPOSITION 3 + +Proposition 3. For the $R F$ as defined in Eq. 1, we have the following evidence upper bound: + +$$ +\begin{array} { r l } & { l o g p _ { \theta } ( \tilde { x } ) = \mathcal { U } ( \tilde { x } ; \theta , \phi ) - K L ( q _ { \phi } ( x ) | | p _ { \theta } ( x ) ) \leq \mathcal { U } ( \tilde { x } ; \theta , \phi ) , } \\ & { \mathcal { U } ( \tilde { x } ; \theta , \phi ) \triangleq u _ { \theta } ( \tilde { x } ) - \left( E _ { q _ { \phi } ( x ) } \left[ u _ { \theta } ( x ) \right] + H \left[ q _ { \phi } ( x ) \right] \right) . } \end{array} +$$ + +Proof. Note that $\begin{array} { r } { l o g p _ { \theta } ( \tilde { x } ) = u _ { \theta } ( \tilde { x } ) - l o g Z ( \theta ) } \end{array}$ . And we have the following lower bound on $Z ( \theta )$ $\begin{array} { r } { l o g Z ( \theta ) = l o g \int \exp ( u _ { \theta } ( x ) ) d x = l o g \int q _ { \phi } ( x ) \frac { \exp ( u _ { \theta } ( x ) ) } { q _ { \phi } ( x ) } d x \geq \int q _ { \phi } ( x ) l o g \frac { \exp ( u _ { \theta } ( x ) ) } { q _ { \phi } ( x ) } d x . } \end{array}$ g exp(uθ(x)) dx. This can be also seen from: + +$$ +\begin{array} { l } { { \displaystyle \int q _ { \phi } ( x ) u _ { \theta } ( x ) d x = \int q _ { \phi } ( x ) l o g p _ { \theta } ( x ) d x + l o g Z ( \theta ) } } \\ { { \displaystyle = - K L ( q _ { \phi } ( x ) | | p _ { \theta } ( x ) ) + l o g Z ( \theta ) + \int q _ { \phi } ( x ) l o g q _ { \phi } ( x ) d x . } } \end{array} +$$ + +Furthermore, it can be seen that learning in Kim & Bengio (2016) amounts to optimizing the following evidence upper bound: + +$$ +\operatorname* { m a x } _ { \theta } \operatorname* { m i n } _ { \phi } \mathcal { U } ( \tilde { x } ; \theta , \phi ) , +$$ + +which is unfortunately not revealed in this manner in Kim & Bengio (2016). + +# 11 CONNECTION BETWEEN INCLUSIVE-NRFS AND GANS + +Note that for the generator as defined in Eq. 3, we have the following joint density + +$$ +l o g q _ { \phi } ( x , h ) = - \frac { 1 } { 2 \sigma ^ { 2 } } | | x - g _ { \phi } ( h ) | | ^ { 2 } + c o n s t a n t . +$$ + +The generator parameter $\phi$ is updated according to Eq. 5, which is rewritten as follows: + +$$ +{ { E } _ { p _ { \theta } ( x ) q _ { \phi } ( h | x ) } } \left[ \nabla _ { \phi } l o g q _ { \phi } ( x , h ) \right] = 0 +$$ + +Specifically, we draw $( h ^ { \prime } , x ^ { \prime } ) \sim q _ { \phi }$ and then perform one-step SGLD to obtain $( h , x )$ . To simply the analysis of the connection, suppose $h \approx h ^ { \prime }$ , $\bar { x } ^ { \prime } \approx g _ { \phi } ( h ^ { \prime } ) \approx \bar { g } _ { \phi } ( h )$ . Then we have + +$$ +\begin{array} { l } \displaystyle \begin{array} { l } { \displaystyle x = x ^ { \prime } + \frac { \delta _ { 1 } } { 2 } [ \frac { \partial } { \partial x } l o g p _ { \theta } ( x ) ] _ { x = x ^ { \prime } } + \sqrt { \delta _ { 1 } } \eta ^ { ( 1 ) } , \eta ^ { ( 1 ) } \sim \mathcal { N } ( 0 , I ) } \\ { \displaystyle x - g _ { \phi } ( h ) \approx \frac { \delta _ { 1 } } { 2 } [ \frac { \partial } { \partial x } l o g p _ { \theta } ( x ) ] _ { x = g _ { \phi } ( h ) } = \frac { \delta _ { 1 } } { 2 } [ \frac { \partial } { \partial x } u _ { \theta } ( x ) ] \bigg \vert _ { x = g _ { \phi } ( h ) } } \end{array} \end{array} +$$ + +The gradient in the updating step in Algorithm 1 becomes: + +$$ +\begin{array} { l } { \displaystyle \nabla _ { \phi } l o g q _ { \phi } ( x , h ) = \frac { 1 } { \sigma ^ { 2 } } \left[ \frac { \partial } { \partial \phi } g _ { \phi } ( h ) \right] \left[ x - g _ { \phi } ( h ) \right] } \\ { \displaystyle \approx \frac { 1 } { \sigma ^ { 2 } } \left[ \frac { \partial } { \partial \phi } g _ { \phi } ( h ) \right] \left. \frac { \delta _ { 1 } } { 2 } \left[ \frac { \partial } { \partial x } u _ { \theta } ( x ) \right] \right. _ { x = g _ { \phi } ( h ) } } \\ { \displaystyle = \frac { 1 } { \sigma ^ { 2 } } \frac { \delta _ { 1 } } { 2 } \left[ \frac { \partial } { \partial \phi } u _ { \theta } ( g _ { \phi } ( h ) ) \right] } \end{array} +$$ + +where $\begin{array} { r l r } { { \frac { \partial } { \partial \phi } g _ { \phi } ( h ) } } \end{array}$ is a matrix of size $d i m ( \phi ) \times d i m ( x )$ . Therefore, the inclusive-NRF Algorithm 1 can be viewed to perform the following steps: + +1. Draw an empirical example $\tilde { x } \sim p _ { 0 }$ . +2. Draw $h \sim p ( h )$ , $x ^ { \prime } = g _ { \phi } ( h )$ , and generate $x$ by one-step-gradient according to Eq. 14. +3. Update $\theta$ by ascending: $\nabla _ { \theta } u _ { \theta } ( \tilde { x } ) - \nabla _ { \theta } u _ { \theta } ( x )$ . +4. Update $\phi$ by descending: $\begin{array} { r l r } { \mathrm { - } \frac { \partial } { \partial \phi } u _ { \theta } ( g _ { \phi } ( h ) ) } \end{array}$ . + +Now suppose that we interpret the potential function $u _ { \theta } ( x )$ as the discriminator in GANs (or the critic in Wasserstein GANs), which assign high scalar scores to empirical samples $\tilde { x } \sim p _ { 0 }$ and low scalar scores to generated samples $x$ . Then, the inclusive-NRF training could be viewed as playing a two-player minimax game: + +$$ +\operatorname* { m i n } _ { \phi } \operatorname* { m a x } _ { \theta } E _ { \tilde { x } \sim p _ { 0 } } \left[ u _ { \theta } ( \tilde { x } ) \right] - E _ { h \sim p ( h ) } \left[ u _ { \theta } ( g _ { \phi } ( h ) ) \right] , +$$ + +except that in optimizing $\theta$ , the generated sample are further revised by taking one-step-gradient of $u _ { \theta } ( x )$ w.r.t. $x$ (as shown in the above Step 2). The discriminator $u _ { \theta }$ is trained to discriminate between empirical samples and generated samples, while the generator $q _ { \phi }$ is trained to fool the discriminator by assigning higher scores to generated samples. From the above analysis, we find some interesting connections between inclusive-NRFs and existing studies in GANs. + +• The optimization shown in Eq. 15 is in fact the same as that in Wasserstein GANs (Theorem 3 in Arjovsky et al. (2017)), except that in Wasserstein GANs, the critic $u _ { \theta } ( x )$ is constrained to be 1-Lipschitz continuous. So hopefully we can improve the inclusive-NRF training by constraining the discriminator $u _ { \theta } ( x )$ to be 1-Lipschitz continuous, e.g. by utilizing the recently developed technique of spectral normalization of weight matrices in the discriminator as in Miyato et al. (2018). + +• To optimize $\theta$ , the generated sample is obtained by taking one-step-gradient of $u _ { \theta } ( x )$ w.r.t. $x$ . The tiny perturbation guided by the gradient to increase the score for the generated sample in fact creates an adversarial example. A similar idea is presented in Liu & Hsieh (2018) that when feeding real samples to the discriminator, 5 steps of PGD (Projected Gradient Descent) attack is taken to decrease the score to create adversarial samples. It is shown in Liu & Hsieh (2018) that training the discriminator with adversarial examples significantly improves the GAN traning. Hopefully in training the discriminator in inclusive-NRFs, the adversarial attack could be increasing scores for generated samples, or decreasing scores for real samples, or a mixed one. • The above analysis assume the use of one-step SGLD. It can be seen that running finite steps of SGLD in sample revision in fact create adversarial samples to fool the discriminator. + +# 12 DETAILS OF EXPERIMENTS + +# 12.1 GMM SYNTHETIC EXPERIMENT + +In the GMM experiment, we use the following procedure to estimate the metrics “covered modes” and “realistic ratio” for each trained model. + +1. Stochastically generate 100 samples. +2. A mode is defined to be covered (not missed) if there exist generated samples located closely +to the mode (with squared distance $< 0 . 0 2 $ ), and those samples are said to be realistic. +3. Count how many modes are covered and calculate the proportion of realistic samples. +4. Repeat the above steps 100 times and perform averaging. + +For each method, we independently train 10 models and calculate the mean and standard deviation (SD) across the 10 independent runs. + +The network architectures and hyperparameters are the same for all methods, as listed in Table 5. We use SGLD Welling & Teh (2011) for inclusive-NRFs on this synthetic dataset, with empirical revision hyperparameters $\delta _ { l } = 0 . 0 1$ . + +# 12.2 IMAGE GENERATION ON CIFAR-10 + +Network architectures. For convenience, we refer to the two neural networks in implementing the potential $u _ { \theta }$ and the generator $q _ { \phi }$ in NRFs as the potential network and the generator network, respectively. For comparison of different methods, we use the same network architectures as in Table 4 in (Miyato et al., 2018) (ResNet using spectral normalization) for unsupervised learning of NRFs. For supervised learning, we use the semi-supervised inclusive-NRF Algorithm 3 over all labeled images. The difference in network architectures used for semi-supervised and unsupervised learning of inclusive-NRFs is that for SSL, the output layer of the potential network contains $K = 1 0$ scalar units, while a single scalar output unit is used for unsupervised learning. + +Hyperparameters. We use Adam optimizer with the hyperparameter $( \beta _ { 1 } ~ = ~ 0 , \beta _ { 2 } ~ = ~ 0 . 9$ and $\alpha = 0 . 0 0 0 3$ for random fields, $\alpha = 0 . 0 0 0 1$ for generators). For sample revision for inclusive-NRFs, we empirically choose SGLD with $L = 1$ $\langle \delta _ { l } = 0 . 0 0 3 )$ . More revision steps do not significantly improve unsupervised IS, as discussed in section 4.4 Note that we use the potential control loss in both unsupervised $\begin{array} { r } { \mathbf { \Phi } ( \alpha _ { p } = 0 . 1 ) } \end{array}$ ) and supervised $( \alpha _ { d } = 1 , \alpha _ { p } = 0 . 1 )$ settings, which is found beneficial for stable training. + +Evaluation. Figure 5(c)(d) show the generated samples from inclusive-NRFs for unsupervised and supervised settings respectively. We compute inception score (IS) and Frechet inception distance (FID) in the same way as in Miyato et al. (2018). We trained 10 models with different random seeds, and then generate 5000 images 10 times and compute the average inception score and the standard deviation. We compute FID between the true distribution and the generated distribution empirically over 10000 (test set) and 5000 samples. + +# 12.3 SEMI-SUPERVISED EXPERIMENT ON MNIST, SVHN AND CIFAR-10 + +The network architectures (taken from the released code from Salimans et al. (2016) and widely used in Li et al. (2017); Dai et al. (2017b)) and hyperparameters for semi-supervised inclusiveNRFs on MNIST, SVHN and CIFAR-10 are listed in Table 6, Table 7 and Table 8 respectively. We use SGHMC for semi-supervised inclusive-NRFs for all three datasets, with empirical revision hyperparameters $( \beta = 0 . 5 , \bar { \delta _ { l } } = 0 . 0 0 3 )$ for MNIST and CIFAR-10, and $( \beta = 0 . 5 \bar { , } \delta _ { l } = 0 . 0 1 )$ for SVHN. The confidence loss is employed for semi-supervised inclusive-NRFs on MNIST and SVHN, and the potential control loss is employed on CIFAR-10. + +Figure 5(a)(b) show the generated samples from semi-supervised inclusive-NRFs trained over SVHN and CIFAR-10 respectively. + +# 12.4 ABLATION STUDY OF INCLUSIVE-NRFS ON CIFAR-10 + +For unsupervised learning, we use the same networks as in Table 3 in Miyato et al. (2018) (standard CNN using spectral normalization). We use Adam optimizer with the hyperparameter $( \alpha = 0 . 0 0 0 2 , \beta _ { 1 } = 0 , \beta _ { 2 } = 0 . 9 )$ . For semi-supervised learning, the experimental setting is the same as in section 12.3 including the networks, number of labels, etc. For different revision steps, we use $\langle \delta _ { l } = 0 . 0 0 3 )$ for SGLD, and $( \beta = 0 . 5 , \delta _ { l } = 0 . 0 0 3 )$ for SGHMC. The potential control loss is employed in both unsupervised $\mathrm { \Delta } \alpha _ { p } = 0 . 1 )$ and semi-supervised $( \alpha _ { d } = 1 0 0 , \alpha _ { p } = 0 . 1 )$ learning. + +# 13 SSL TOY EXPERIMENT + +In Figure 2, we present the performance of semi-supervised inclusive-NRFs for SSL on a synthetic dataset, which emphasizes that inclusive-NRFs can provide (unnormalized) density estimates for $p _ { \theta } ( x )$ , $p _ { \theta } ( x , y = 1 )$ and $p _ { \theta } ( x , y = 2 )$ . In contrast, the use of GANs as general purpose probabilistic generative models has been limited by the difficulty in using them to provide density estimates or even unnormalized potential values for sample evaluation. + +The dataset is a 2D GMM with 16 Gaussian components, uniformly laid out on two concentric circles. The two circles represent two different classes, each class with 4 labeled data and 400 unlabeled data. The network architectures are the same as in Table 5, except that the neural network which implement the potential function $u _ { \boldsymbol { \theta } } ( \boldsymbol { x } , \boldsymbol { y } )$ for SSL now has two units in the output. + +![](images/1b15657e5f0222b34e4c135f5c523693a6b4ddd0194058b54335f5349276f8f0.jpg) +Figure 2: SSL toy experiment based on semi-supervised inclusive-NRFs. Each class has 4 labeled points, red dots for class 1 and blue for class 2. The learned potentials for $u _ { \theta } ( x )$ , $u _ { \theta } ( x , y = 1 )$ and $\overset { \cdot } { u } _ { \theta } ( x , y = 2 )$ are shown in (b)(c)(d) respectively. + +Figure 3 shows that the auxiliary generator smoothly outputs transitional samples as the latent code $h$ moves linearly in the latent space. The interpolated generation demonstrates that the model has indeed learned an abstract representation of the data. + +![](images/ec865b1908d6c1bac2116dc2ae82f1f353f69c500ab085e5d1549c7405bd788e.jpg) +Figure 3: Latent space interpolation with inclusive-NRFs on MNIST. The leftmost and rightmost columns are from stochastic generations $x _ { 1 }$ with latent code $h _ { 1 }$ and $x _ { 2 }$ with $h _ { 2 }$ . The columns in between correspond to the generations from the latent codes interpolated linearly from $h _ { 1 }$ to $h _ { 2 }$ . + +![](images/db3281866e1afab3ca5fc8ac7678f1db3fe0e8379adbf6b9074f4fe51f954daa.jpg) +Figure 4: Conditional generated samples from semi-supervised inclusive-NRFs trained on MNIST. Due to sample revision, the background pixels are not purely black. + +# 15 CLASS-CONDITIONAL GENERATION + +Figure 4 shows class-conditional generation results on MNIST with semi-supervised inclusive-NRFs. Notice that the generator does not explicitly include class labels, thus it is unable to perform classconditional generation directly. However, the random field has modeling of $p _ { \theta } ( x , y )$ , based on which we can perform class-conditional generation as follows: + +1. Generate a sample $x$ unconditionally, by ancestral sampling with the generator. +2. Predict the label $y$ for the sample $x$ by the random field; +3. Starting from $x$ , running SGLD/SGHMC revision with $p _ { \theta } ( x | y )$ as the target density by fixing $y$ . The resulting samples could be viewed as conditional generations, according to Theorem 1. + +![](images/c9ae503ee430f2a8db7bbe263985d614ab71b0461c2245c8d7db2c1f350c9c34.jpg) +Figure 5: Generated samples from semi-supervised inclusive-NRFs (i.e. trained for SSL) on SVHN and CIFAR-10 are shown in (a) and (b) respectively. Generated samples from unsupervised and supervised training of inclusive-NRFs on CIFAR-10 are shown in (c) and (d) respectively. + +Table 5: Network architectures and hyperparameters for the 2D GMM data. + +
Random FieldGenerator
Input 2-dim dataNoise h (2-dim)
MLP100 units,Leaky ReLUMLP 50 units,ReLU
MLP100 units,Leaky ReLUMLP 50 units,ReLU
MLP1 unit, LinearMLP 2 units,Linear
Batch size100
Number of iterations160,000
Leaky ReLU slope0.2
Learning rate0.001
OptimizerAdam (β1 = 0.5,β2 =0.9)
Sample revision stepsL=10
+ +Table 6: Network architectures and hyperparameters for semi-supervised inclusive-NRFs on MNIST + +
Random FieldGenerator
Input 28 × 28 Gray Image MLP 100O units,Leaky ReLU, Weight normNoise h (100-dim) MLP 50O units,Sotfplus,Batch norm
MLP 500 units,Leaky ReLU, Weight norm MLP 250 units,Leaky ReLU, Weight norm MLP 250 units,Leaky ReLU, Weight norm MLP 250 units,Leaky ReLU,Weight normMLP 50O units, Sotfplus,Batch norm MLP 784 units, Sigmoid
MLP 10 units,Linear,Weight norm Batch size100
Number of epochs200
Leaky ReLU slope0.2
Learning rate0.001
OptimizerAdam (β1 = 0.0,β2 = 0.9)
Sample revision stepsL= 20
α in SSLαd = 10,αc = 10,αp = 0
+ +Table 7: Network architectures and hyperparameters for semi-supervised inclusive-NRFs on SVHN + +
RandomFieldGenerator
Input 32 × 32 Colored ImageNoise h (100-dim)
3 × 3 conv. 64,Leaky ReLU, Weight norm 3 × 3 conv. 64, Leaky ReLU, Weight norm 3 × 3 conv. 64, Leaky ReLU, Weight normMLP 8192 units,ReLU, Batch norm Reshape 512 × 4×4 5 × 5 deconv. 256,ReLU, Stride=2
stride=2, dropout2d=0.5 3 × 3 conv. 128,Leaky ReLU, Weight norm 3 × 3 conv.128,Leaky ReLU,Weight norm 3 × 3 conv. 128,Leaky ReLU, Weight norm stride=2, dropout2d=0.5 3 × 3 conv. 128,Leaky ReLU,Weight norm 1 × 1 conv. 128,Leaky ReLU,Weight norm5 × 5 deconv. 128,ReLU, Stride=2 5 × 5 deconv. 3, Tanh, Stride=2
1 × 1 conv. 128,Leaky ReLU, Weight norm MLP 10 units,Linear,Weight norm
Batch size Number of epochs100
Leaky ReLU slope400
Learning rate Optimizer0.2 0.001
+ +Table 8: Network architectures and hyperparameters for semi-supervised inclusive-NRFs on CIFAR10 + +
Random FieldGenerator
Input 32 × 32 Colored ImageNoise h (100-dim)
3 × 3 conv. 128,Leaky ReLU, Weight normMLP 8192 units,ReLU, batch norm
3 × 3 conv. 128,Leaky ReLU, Weight normReshape 512 × 4× 4
3 × 3 conv. 128,Leaky ReLU, Weight norm stride=2, dropout2d=0.55 × 5 deconv. 256, ReLU, Stride=2 5 × 5 deconv. 128 ReLU, stride=2
3 × 3 conv. 256,Leaky ReLU, Weight norm 3 × 3 conv. 256,Leaky ReLU, Weight norm 3 × 3 conv. 256,Leaky ReLU, Weight norm5 × 5 deconv. 3, Tanh, Stride=2
stride=2, dropout2d=0.5 3 × 3 conv. 512,Leaky ReLU, Weight norm 1 × 1 conv. 256,Leaky ReLU, Weight norm
1 × 1 conv. 128,Leaky ReLU, Weight norm
MLP 10 units,Linear, Weight norm
Batch size100
Number of epochs600
Leaky ReLU slope0.2
Learning rate
0.001
OptimizerAdam (β1 = 0.0,β2 = 0.9)
Sample revision steps α in SSLL=10 αd = 100,αc = 0,αp = 0.1
\ No newline at end of file diff --git a/md/train/Uu1Nw-eeTxJ/Uu1Nw-eeTxJ.md b/md/train/Uu1Nw-eeTxJ/Uu1Nw-eeTxJ.md new file mode 100644 index 0000000000000000000000000000000000000000..8348ea24d4801cbb932c78b30d1f4e2179f7232b --- /dev/null +++ b/md/train/Uu1Nw-eeTxJ/Uu1Nw-eeTxJ.md @@ -0,0 +1,358 @@ +# ON LEARNING UNIVERSAL REPRESENTATIONS ACROSS LANGUAGES + +Xiangpeng Wei1,2∗, Rongxiang Weng3, Yue $\mathbf { H } \mathbf { u } ^ { 1 , 2 }$ , Luxi $\mathbf { X _ { i n g } } ^ { \mathbf { _ { j , 2 } } }$ , Heng $\mathbf { Y } \mathbf { u } ^ { 3 }$ , Weihua Luo3 + +1Institute of Information Engineering, Chinese Academy of Sciences, Beijing, China 2School of Cyber Security, University of Chinese Academy of Sciences, Beijing, China {weixiangpeng,huyue,xingluxi}@iie.ac.cn 3Machine Intelligence Technology Lab, Alibaba Group, Hangzhou, China {wengrx,yuheng.yh,weihua.luowh}@alibaba-inc.com + +# ABSTRACT + +Recent studies have demonstrated the overwhelming advantage of cross-lingual pre-trained models (PTMs), such as multilingual BERT and XLM, on crosslingual NLP tasks. However, existing approaches essentially capture the cooccurrence among tokens through involving the masked language model (MLM) objective with token-level cross entropy. In this work, we extend these approaches to learn sentence-level representations and show the effectiveness on crosslingual understanding and generation. Specifically, we propose a Hierarchical Contrastive Learning (HICTL) method to (1) learn universal representations for parallel sentences distributed in one or multiple languages and (2) distinguish the semantically-related words from a shared cross-lingual vocabulary for each sentence. We conduct evaluations on two challenging cross-lingual tasks, XTREME and machine translation. Experimental results show that the HICTL outperforms the state-of-the-art XLM-R by an absolute gain of $4 . 2 \%$ accuracy on the XTREME benchmark as well as achieves substantial improvements on both of the highresource and low-resource English $ \mathrm { X }$ translation tasks over strong baselines. + +# 1 INTRODUCTION + +Pre-trained models (PTMs) like ELMo (Peters et al., 2018), GPT (Radford et al., 2018) and BERT (Devlin et al., 2019) have shown remarkable success of effectively transferring knowledge learned from large-scale unlabeled data to downstream NLP tasks, such as text classification (Socher et al., 2013) and natural language inference (Bowman et al., 2015; Williams et al., 2018), with limited or no training data. To extend such pretraining-finetuning paradigm to multiple languages, some endeavors such as multilingual BERT (Devlin et al., 2019) and XLM (Conneau & Lample, 2019) have been made for learning cross-lingual representation. More recently, Conneau et al. (2020) present XLM-R to study the effects of training unsupervised cross-lingual representations at a huge scale and demonstrate promising progress on cross-lingual tasks. + +However, all of these studies only perform a masked language model (MLM) with token-level (i.e., subword) cross entropy, which limits PTMs to capture the co-occurrence among tokens and consequently fail to understand the whole sentence. It leads to two major shortcomings for current cross-lingual PTMs, i.e., the acquisition of sentence-level representations and semantic alignments among parallel sentences in different languages. Considering the former, Devlin et al. (2019) introduced the next sentence prediction (NSP) task to distinguish whether two input sentences are continuous segments from the training corpus. However, this simple binary classification task is not enough to model sentence-level representations (Joshi et al., 2020; Yang et al., 2019; Liu et al., 2019; Lan et al., 2020; Conneau et al., 2020). For the latter, (Huang et al., 2019) defined the cross-lingual paraphrase classification task, which concatenates two sentences from different languages as input and classifies whether they are with the same meaning. This task learns patterns of sentence-pairs well but fails to distinguish the exact meaning of each sentence. + +In response to these problems, we propose to strengthen PTMs through learning universal representations among semantically-equivalent sentences distributed in different languages. We introduce a novel Hierarchical Contrastive Learning (HICTL) framework to learn language invariant sentence representations via self-supervised non-parametric instance discrimination. Specifically, we use a BERT-style model to encode two sentences separately, and the representation of the first token (e.g., [CLS] in BERT) will be treated as the sentence representation. Then, we conduct instance-wise comparison at both sentence-level and word-level, which are complementary to each other. At the sentence level, we maximize the similarity between two parallel sentences while minimizing which among non-parallel ones. At the word-level, we maintain a bag-of-words for each sentence-pair, each word in which is considered as a positive sample while the rest words in vocabulary are negative ones. To reduce the space of negative samples, we conduct negative sampling for word-level contrastive learning. With the HICTL framework, the PTMs are encouraged to learn language-agnostic representation, thereby bridging the semantic discrepancy among cross-lingual sentences. + +The HICTL is conducted on the basis of XLM-R (Conneau et al., 2020) and experiments are performed on several challenging cross-lingual tasks: language understanding tasks (e.g., XNLI, XQuAD, and MLQA) in the XTREME (Hu et al., 2020) benchmark, and machine translation in the IWSLT and WMT benchmarks. Extensive empirical evidence demonstrates that our approach can achieve consistent improvements over baselines on various tasks of both cross-lingual language understanding and generation. In more detail, our HICTL obtains absolute gains of $4 . 2 \%$ (up to $6 . 0 \%$ on zero-shot sentence retrieval tasks, e.g. BUCC and Tatoeba) accuracy on XTREME over XLM-R. For machine translation, our HICTL achieves substantial improvements over baselines on both low-resource (IWSLT English $\cdot { } \mathrm { X }$ ) and high-resource (WMT English ${ } \mathrm { X }$ ) translation tasks. + +# 2 RELATED WORK + +Pre-trained Language Models. Recently, substantial work has shown that pre-trained models (PTMs) (Peters et al., 2018; Radford et al., 2018; Devlin et al., 2019) on the large corpus are beneficial for downstream NLP tasks. The application scheme is to fine-tune the pre-trained model using the limited labeled data of specific target tasks. For cross-lingual pre-training, both Devlin et al. (2019) and Conneau & Lample (2019) trained a transformer-based model on multilingual Wikipedia which covers various languages, while XLM-R (Conneau et al., 2020) studied the effects of training unsupervised cross-lingual representations on a very large scale. + +For sequence-to-sequence pre-training, UniLM (Dong et al., 2019) fine-tuned BERT with an ensemble of masks, which employs a shared Transformer network and utilizing specific self-attention mask to control what context the prediction conditions on. Song et al. (2019) extended BERT-style models by jointly training the encoder-decoder framework. XLNet (Yang et al., 2019) trained by predicting masked tokens auto-regressively in a permuted order, which allows predictions to condition on both left and right context. Raffel et al. (2019) unified every NLP problem as a text-to-text problem and pre-trained a denoising sequence-to-sequence model at scale. Concurrently, BART (Lewis et al., 2020) pre-trained a denoising sequence-to-sequence model, in which spans are masked from the input but the complete output is auto-regressively predicted. + +Previous works have explored using pre-trained models to improve text generation, such as pretraining both the encoder and decoder on several languages (Song et al., 2019; Conneau & Lample, 2019; Raffel et al., 2019) or using pre-trained models to initialize encoders (Edunov et al., 2019; Zhang et al., $2 0 1 9 \mathrm { a }$ ; Guo et al., 2020). Zhu et al. (2020) and Weng et al. (2020) proposed a BERTfused NMT model, in which the representations from BERT are treated as context and fed into all layers of both the encoder and decoder. Zhong et al. (2020) formulated the extractive summarization task as a semantic text matching problem and proposed a Siamese-BERT architecture to compute the similarity between the source document and the candidate summary, which leverages the pre-trained BERT in a Siamese network structure. Our approach also belongs to the contextual pre-training so it could be applied to various downstream NLU and NLG tasks. + +Contrastive Learning. Contrastive learning (CTL) (Saunshi et al., 2019) aims at maximizing the similarity between the encoded query $q$ and its matched key $k ^ { + }$ while keeping randomly sampled keys $\{ k _ { 0 } ^ { - } , k _ { 1 } ^ { - } , k _ { 2 } ^ { - } , \ldots \}$ faraway from it. With similarity measured by a score function $s ( q , k )$ , a form of a contrastive loss function, called InfoNCE (Oord et al., 2018), is considered in this paper: + +![](images/75c997a95b348d0d989069ce52c9f105c084b518de013b9509453a07c2ee7240.jpg) +Figure 1: Illustration of Hierarchical Contrastive Learning (HICTL). $n$ is the batch size, $m$ denotes the number of negative samples for word-level contrastive learning. $\boldsymbol { B }$ and $\nu$ indicates the bag-ofwords of the instance $\langle x _ { i } , y _ { i } \rangle$ and the overall vocabulary of all languages, respectively. + +$$ +\mathcal { L } _ { c t l } = - \log \frac { \exp ( s ( q , k ^ { + } ) ) } { \exp ( s ( q , k ^ { + } ) ) + \sum _ { i } \exp ( s ( q , k _ { i } ^ { - } ) ) } , +$$ + +where the score function $s ( q , k )$ is essentially implemented as the cosine similarity kqk·kkk . q and k are often encoded by a learnable neural encoder, such as BERT (Devlin et al., 2019) or ResNet (He et al., 2016). $k ^ { + }$ and $k ^ { - }$ are typically called positive and negative samples. In addition to the form illustrated in Eq. (1), contrastive losses can also be based on other forms, such as margin-based loses (Hadsell et al., 2006) and variants of NCE losses (Mnih & Kavukcuoglu, 2013). + +Contrastive learning is at the core of several recent work on unsupervised or self-supervised learning from computer vision (Wu et al., 2018; Oord et al., 2018; Ye et al., 2019; He et al., 2019; Chen et al., 2020; Tian et al., 2020) to natural language processing (Mikolov et al., 2013; Mnih & Kavukcuoglu, 2013; Devlin et al., 2019; Clark et al., 2020b; Feng et al., 2020; Chi et al., 2020). Kong et al. (2020) improved language representation learning by maximizing the mutual information between a masked sentence representation and local n-gram spans. Clark et al. (2020b) utilized a discriminator to predict whether a token is replaced by a generator given its surrounding context. Iter et al. (2020) proposed to pre-train language models with contrastive sentence objectives that predict the surrounding sentences given an anchor sentence. In this paper, we propose HICTL to encourage parallel cross-lingual sentences to have the identical semantic representation and distinguish whether a word is contained in them as well, which can naturally improve the capability of cross-lingual understanding and generation for PTMs. + +# 3 METHODOLOGY + +# 3.1 HIERARCHICAL CONTRASTIVE LEARNING + +We propose hierarchical contrastive learning (HICTL), a novel comparison learning framework that unifies cross-lingual sentences as well as related words. HICTL can learn from both non-parallel and parallel multilingual data, and the overall architecture of HICTL is illustrated in Figure 1. We represent a training batch of the original sentences as $\mathbf { x } = \{ x _ { 1 } , x _ { 2 } , . . . , x _ { n } \}$ and its aligned counterpart is denoted as $\mathbf { y } = \{ y _ { 1 } , y _ { 2 } , . . . , y _ { n } \}$ , where $n$ is the batch size. For each pair $\left. x _ { i } , y _ { i } \right.$ , $y _ { i }$ is either the translation in the other language of $x _ { i }$ when using parallel data or the perturbation through reordering tokens in $x _ { i }$ when only monolingual data is available. $\mathbf { x } ^ { \backslash i }$ is denoted as a modified version of $\mathbf { x }$ where the $i$ -th instance is removed. + +Sentence-Level CTL. As illustrated in Figure 1a, we apply the XLM-R as the encoder to represent sentences into hidden representations. The first token of every sequence is always a special token (e.g., [CLS]), and the final hidden state corresponding to this token is used as the aggregate sentence representation for pre-training, that is, $r _ { x } = f \circ g ( \mathcal { M } ( x ) )$ where $g ( \cdot )$ is the aggregate function and $f ( \cdot )$ is a linear projection, $\circ$ denotes the composition of operations. To obtain universal representation among semantically-equivalent sentences, we encourage $r _ { x _ { i } }$ (the query, denoted as $q$ ) to be as similar as possible to $r _ { y _ { i } }$ (the positive sample, denoted as $k ^ { + }$ ) but dissimilar to all other instances (i.e., $\mathbf { y } ^ { \backslash i } \cup \mathbf { x } ^ { \backslash i }$ , considered as a series of negative samples, denoted as $\{ k _ { 1 } ^ { - } , k _ { 2 } ^ { - } , . . . , k _ { 2 n - 2 } ^ { - } \} )$ in a training batch. Formally, the sentence-level contrastive loss for $x _ { i }$ is defined as + +![](images/a4a1556f7fa56184d62e608b55c1fc749577b336b14cf3ffe4bca58b826ca40c.jpg) +Figure 2: Illustration of constructing hard negative samples (HNS). A circle (the radius is $d ^ { + } = \parallel$ $k ^ { + } - q ~ \| _ { 2 } )$ in the embedding space represents a manifold near in which sentences are semantically equivalent. We can generate a coherent sample (i.e., $\hat { k } ^ { - }$ ) that interpolate between known pair $q$ and $k ^ { - }$ . The synthetic negative $\hat { k } ^ { - }$ can be controlled adaptively with proper difficulty during training. The curly brace in green indicates the walking range of hard negative samples, the closer to the circle the harder the sample is. + +$$ +\mathcal { L } _ { s c t l } ( x _ { i } ) = - \log \frac { \exp { \circ s ( q , k ^ { + } ) } } { \exp { \circ s ( q , k ^ { + } ) } + \sum _ { j = 1 } ^ { | \mathbf { y } ^ { \backslash i } \cup \mathbf { x } ^ { \backslash i } | } \exp { \circ s ( q , k _ { j } ^ { - } ) } } . +$$ + +Symmetrically, we also expect $r _ { y _ { i } }$ (the query, denoted as $\tilde { q }$ ) to be as similar as possible to $r _ { x _ { i } }$ (the positive sample, denoted as $\tilde { k } ^ { + }$ ) but dissimilar to all other instances in the same training batch, thus, + +$$ +\mathcal { L } _ { s c t l } ( y _ { i } ) = - \log \frac { \exp \circ s ( \tilde { q } , \tilde { k } ^ { + } ) } { \exp \circ s ( \tilde { q } , \tilde { k } ^ { + } ) + \sum _ { j = 1 } ^ { | \mathbf { y } ^ { \backslash i } \cup \mathbf { x } ^ { \backslash i } | } \exp \circ s ( \tilde { q } , \tilde { k } _ { j } ^ { - } ) } . +$$ + +The sentence-level contrastive loss over the training batch can be formulated as + +$$ +\mathcal { L } _ { S } = \frac { 1 } { 2 n } \sum _ { i = 1 } ^ { n } \big \{ \mathcal { L } _ { s c t l } ( x _ { i } ) + \mathcal { L } _ { s c t l } ( y _ { i } ) \big \} . +$$ + +For sentence-level contrastive learning, we treat other instances contained in the training batch as negative samples for the current instance. However, such randomly selected negative samples are often uninformative, which poses a challenge of distinguishing very similar but nonequivalent samples. To address this issue, we employ smoothed linear interpolation (Bowman et al., 2016; Zheng et al., 2019) between sentences in the embedding space to alleviate the lack of informative samples for pre-training, as shown in Figure 2. Given a training batch $\{ \langle x _ { i } , y _ { i } \rangle \} _ { i = 1 } ^ { n }$ , where $n$ is the batch size. In this context, having obtained the embeddings of a triplet, an anchor $q$ and a positive $k ^ { + }$ as well as a negative $k ^ { - }$ (supposing $q$ , $k ^ { + }$ and $k ^ { - }$ are representations of sentences $x _ { i } , y _ { i }$ and $y _ { i } ^ { - } \in \mathbf { x } ^ { \backslash i } \cup \mathbf { y } ^ { \backslash i }$ , respectively), we construct a harder negative sample $\hat { k } ^ { - }$ to replace $k _ { j } ^ { - }$ : + +$$ +\begin{array} { r } { \hat { k } ^ { - } = \left\{ \begin{array} { l l } { q + \lambda ( k ^ { - } - q ) , \lambda \in ( \frac { d ^ { + } } { d ^ { - } } , 1 ] \quad } & { i f \quad d ^ { - } > d ^ { + } ; } \\ { k ^ { - } \quad } & { i f \quad d ^ { - } \leq d ^ { + } . } \end{array} \right. } \end{array} +$$ + +where $d ^ { + } = \parallel { k ^ { + } } - { q } \parallel _ { 2 }$ and $d ^ { - } = \parallel \boldsymbol { k } ^ { - } - \boldsymbol { q } \parallel _ { 2 }$ . For the first condition, the hardness of $\hat { k } ^ { - }$ increases when $\lambda$ becomes smaller. To this end, we intuitively set $\boldsymbol { \lambda }$ as + +$$ +\lambda = \left( \frac { d ^ { + } } { d ^ { - } } \right) ^ { \zeta \cdot p _ { a v g } ^ { + } } , \quad \zeta \in ( 0 , 1 ) +$$ + +where p+avg $\begin{array} { r l r } { p _ { a v g } ^ { + } } & { { } = } & { \frac { 1 } { 1 0 0 } \sum _ { \jmath \in [ - 1 0 0 , - 1 ] } e ^ { - \mathcal { L } _ { S } ^ { ( \jmath ) } } } \end{array}$ is the average log-probability over the last 100 training batches and $\mathcal { L } _ { S }$ formulated in Eq. (4) is the sentence-level contrastive loss of one training batch. During pre-training, when the model tends to distinguish positive samples easily, which means negative samples are not informative already. At this time, $p _ { a v g } ^ { + } \uparrow$ and $\textstyle { \frac { d ^ { + } } { d ^ { - } } } \downarrow$ , which leads $\lambda \downarrow$ and harder negative samples are adaptively synthesized in the following training steps, vice versa. As hard negative samples usually result in significant changes of the model parameters, we introduce the slack coefficient $\zeta$ to prevent the model from being trained in the wrong direction, when it accidentally switch from random negative samples to very hard ones. In practice, we empirically set $\zeta = 0 . 9$ . + +Word-Level CTL. Intuitively, predicting the related words in other languages for each sentence can bridge the representations of words in different languages. As shown in Figure 1b, we concatenate the sentence pair $\left. x _ { i } , y _ { i } \right.$ as $x _ { i } \circ y _ { i }$ : [CLS] $x _ { i }$ [SEP] $y _ { i }$ [SEP] and the bag-of-words of which is denoted as $\boldsymbol { B }$ . For word-level contrastive learning, the final state of the first token is treated as the query $( \bar { q } )$ , each word $w _ { t } \in B$ is considered as the positive sample and all the other words $( \mathcal V \backslash B$ , i.e., the words in $\nu$ that are not in $\boldsymbol { B }$ where $\nu$ indicates the overall vocabulary of all languages) are negative samples. As the vocabulary usually with large space, we propose to only use a subset $\mathcal { S } \subset \bar { \mathcal { V } } \backslash B$ sampled according to the normalized similarities between $\bar { q }$ and the embeddings of the words. As a result, the subset $s$ naturally contains the hard negative samples which are beneficial for learning high-quality representations (Ye et al., 2019). Specifically, the word-level contrastive loss for $\left. x _ { i } , y _ { i } \right.$ is defined as + +$$ +\mathcal { L } _ { w c t l } ( x _ { i } , y _ { i } ) = - \frac { 1 } { | \mathcal { B } | } \sum _ { t = 1 } ^ { | \mathcal { B } | } \log \frac { \exp { \circ s ( \bar { q } , e ( w _ { t } ) ) } } { \exp { \circ s ( \bar { q } , e ( w _ { t } ) ) } + \sum _ { w _ { j } \in \mathcal { S } } \exp { \circ s ( \bar { q } , e ( w _ { j } ) ) } } . +$$ + +where $e ( \cdot )$ is the embedding lookup function and $| B |$ is the number of unique words in the concatenated sequence $x _ { i } \circ y _ { i }$ . The overall word-level contrastive loss can be formulated as: + +$$ +\mathcal { L } _ { W } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { w c t l } ( x _ { i } , y _ { i } ) . +$$ + +Multi-Task Pre-training. Both MLM and translation language model (TLM) are combined with HICTL by default, as the prior work (Conneau $\&$ Lample, 2019) has verified the effectiveness of them in XLM. In summary, the model can be optimized by minimizing the entire training loss: + +$$ +\mathcal { L } = \mathcal { L } _ { L M } + \mathcal { L } _ { S } + \mathcal { L } _ { W } , +$$ + +where $\mathcal { L } _ { L M }$ is implemented as either the TLM when using parallel data or the MLM when only monolingual data is available to recover the original words of masked positions given the contexts. + +# 3.2 CROSS-LINGUAL FINE-TUNING + +Language Understanding. The representations produced by HICTL can be used in several ways for language understanding tasks whether they involve single text or text pairs. Concretely, (i) the [CLS] representation of single-sentence in sentiment analysis or sentence pairs in paraphrasing and entailment is fed into an extra output-layer for classification. $( i i )$ The pre-trained encoder can be used to assign POS tags to each word or to locate and classify all the named entities in the sentence for structured prediction, as well as (iii) to extract answer spans for question answering. + +Language Generation. We also explore using HICTL to improve machine translation. In the previous work, Conneau & Lample (2019) has shown that the pre-trained encoders can provide a better initialization of both supervised and unsupervised NMT systems. Liu et al. (2020b) has shown that NMT models can be improved by incorporating pre-trained sequence-to-sequence models on various language pairs but highest-resource settings. As illustrated in Figure 3, we use the model pre-trained by HICTL as the encoder, and add a new set of decoder parameters that are learned from scratch. To prevent pre-trained weights from being washed out by supervised training, we train the encoder-decoder model in two steps. In the first step, we freeze the pre-trained encoder and only update the decoder. In the second step, we train all parameters for a relatively small number of iterations. In both cases, we compute the similarities between the [CLS] representation of the encoder and all target words in advance. Then we aggregate them with the logits before the softmax of each decoder step through an element-wise additive operation. The encoder-decoder model is optimized by maximizing the log-likelihood of bitext at both steps. + +![](images/d07d6a0671d2e0c808fccbac4ffc25a9a3f974ed1d25cb610832c4e8836683ec.jpg) +Figure 3: Fine-tuning on NMT task. + +Table 1: Overall results on XTREME benchmark. Results of mBERT (Devlin et al., 2019), XLM (Conneau & Lample, 2019) and XLM-R (Conneau et al., 2020) are from XTREME (Hu et al., 2020). Results of $\ddagger$ are from our in-house replication. HNS is short for “Hard Negative Samples”. + +
ModelPair sentenceStructured predictionQuestion answeringSentence retrievalAvg.
XNLIPAWS-XPOSNERXQuADMLQATyDiQA-GoldPBUCCTatoeba
MetricsAcc.Acc.F1F1F1/EMF1/EMF1 /EMF1Acc.
Cross-lingual zero-shot transfer(models are trained on English data)
mBERT65.481.970.362.264.5 /49.461.4 /44.259.7 /43.956.738.759.6
XLM69.180.970.161.259.8/44.348.5 /32.643.6/29.156.832.655.5
XLM-RBase76.2---=63.7 /46.3=1-1
HICTLBase77.384.571.464.173.5 / 58.765.8/47.661.9 /42.81
XLM-R79.286.473.865.476.6/60.871.6/53.265.1/45.066.057.368.2
HICTL81.087.574.866.277.9 / 61.772.8 /54.566.0/45.768.459.769.6
Translate-train-all(modelsaretrainedonEnglish trainingdataandits translated dataonthetarget language)
mBERT75.188.9-172.4 /58.367.6/49.864.2/49.31--
XLM-R82.990.174.666.880.4 / 65.672.4/54.766.2/48.267.959.170.6
HICTL84.592.276.868.482.8/67.374.4/57.169.7 / 52.571.863.173.2
+HNS84.792.877.269.082.9 / 67.474.8 /57.371.1/53.277.669.174.8
+ +# 4 EXPERIMENTS + +We consider two evaluation benchmarks: nine cross-lingual language understanding tasks in the XTREME benchmark and machine translation tasks (IWSLT’14 English German, IWSLT’14 English Spanish, WMT’16 Romanian English, IWSLT’17 English {French, Chinese} and WMT’14 English {German, French}). In this section, we describe the data and training details, and provide detailed evaluation results. + +# 4.1 DATA AND MODEL + +During pre-training, we follow Conneau et al. (2020) to build a Common-Crawl Corpus using the CCNet (Wenzek et al., 2019) tool1 for monolingual texts. Table 7 (see appendix A) reports the language codes and data size in our work. For parallel data, we use the same (English-to-X) MT dataset as (Conneau & Lample, 2019), which are collected from MultiUN (Eisele & Yu, 2010) for French, Spanish, Arabic and Chinese, the IIT Bombay corpus (Kunchukuttan et al., 2018a) for Hindi, the OpenSubtitles 2018 for Turkish, Vietnamese and Thai, the EUbookshop corpus for German, Greek and Bulgarian, Tanzil for both Urdu and Swahili, and GlobalVoices for Swahili. Table 8 (see appendix A) shows the statistics of the parallel data. + +We adopt the Transformer-Encoder (Vaswani et al., 2017) as the backbone with 12 layers and 768 hidden units for $\mathrm { H I C T L _ { B a s e } }$ , and 24 layers and 1024 hidden units for HICTL. We initialize the parameters of HICTL with XLM-R (Conneau et al., 2020). Hyperparameters for pre-training and fine-tuning are shown in Table 9 (see appendix B). We run the pre-training experiments on 8 V100 GPUs, batch size 1024. The number of negative samples $m { = } 5 1 2$ for word-level contrastive learning. + +# 4.2 EXPERIMENTAL EVALUATION + +Cross-lingual Language Understanding (XTREME) There are nine tasks in XTREME that can be grouped into four categories: (i) sentence classification consists of Cross-lingual Natural Language Inference (XNLI) (Conneau et al., 2018) and Cross-lingual Paraphrase Adversaries from + +Table 2: Comparison with existing methods on XTREME tasks. + +
ModelPair sentenceStructured predictionQuestion answering
XNLIPAWS-XPOSNERXQuADMLQATyDiQA-GoldP
MetricsAcc.Acc.F1F1F1/EMF1/EMF1/EM
Translate-train-all
FILTER83.991.476.267.782.4/ 68.076.2 /57.768.3/50.9
VECO83.091.175.165.779.9 /66.373.1/54.975.0 /58.9
HICTL84.792.877.269.082.9 / 67.474.8 /57.371.1/53.2
+ +Table 3: Ablation study on XTREME tasks. + +
ModelXNLI Acc.PAWS-X Acc.POS F1NER F1XQuAD F1/EMMLQA F1/EMTyDiQA-GoldP F1/EMBUCC F1Tatoeba Acc.Avg.
FULL MODEL84.792.877.269.082.9 /67.474.8 / 57.371.1/53.277.669.174.8
w/o Sentence-CTL82.990.575.967.882.3 /66.774.3 /56.569.7 /52.371.462.672.4
w/o Word-CTL84.392.176.368.482.5 /66.974.1/56.770.2/52.576.868.474.2
w/o MT data84.292.476.668.282.6/67.074.5/56.870.1/52.374.766.873.8
+ +Word Scrambling (PAWS-X) (Zhang et al., 2019b). (ii) Structured prediction includes POS tagging and NER. We use POS tagging data from the Universal Dependencies v2.5 (Nivre et al., 2018) treebanks. Each word is assigned one of 17 universal POS tags. For NER, we use the Wikiann dataset (Pan et al., 2017). (iii) Question answering includes three tasks: Cross-lingual Question Answering (XQuAD) (Artetxe et al., 2019), Multilingual Question Answering (MLQA) (Lewis et al., 2019), and the gold passage version of the Typologically Diverse Question Answering dataset (TyDiQA-GoldP) (Clark et al., 2020a). (iv) Sentence retrieval includes two tasks: BUCC (Zweigenbaum et al., 2017) and Tatoeba (Artetxe & Schwenk, 2019), which aims to extract parallel sentences between the English corpus and target languages. As XTREME provides no training data, thus we directly evaluate pre-trained models on test sets. + +Table 1 provides detailed results on four categories in XTREME. First, compared to the state of the art XLM-R baseline, HICTL further achieves significant gains of $1 . 4 3 \%$ and $2 . 8 0 \%$ on average on nine tasks with cross-lingual zero-shot transfer and translate-train-all settings, respectively. Second, mining hard negative samples via smoothed linear interpolation play an important role in contrastive learning, which significantly improves accuracy by 1.6 points on average. Third, HICTL with hardness aware augmentation delivers large improvements on zero-shot sentence retrieval tasks (scores 5.8 and 6.0 points higher on BUCC and Tatoeba, respectively). Following (Hu et al., 2020), we directly evaluate pre-trained models on test sets without any extra labeled data or fine-tuning techniques used in (Fang et al., 2020; Luo et al., 2020). These results demonstrate the capacity of HICTL on learning cross-lingual representations. We also compare our best model with two existing models: FILTER (Fang et al., 2020) and VECO (Luo et al., 2020). The results demonstrate that HICTL achieves the best performance on most tasks with less monolingual data. + +Ablation experiments are present at Table 3. Comparing the full model, we can draw several conclusions: (1) removing the sentence-level CTL objective hurts performance consistently and significantly, (2) the word-level CTL objective has least drop compared to others, and (3) the parallel (MT) data has a large impact on zero-shot multilingual sentence retrieval tasks. Moreover, Table 2 provides the comparisons between HICTL and existing methods. + +Machine Translation The main idea of HICTL is to summarize cross-lingual parallel sentences into a shared representation that we term as semantic embedding, using which semantically related words can be distinguished from others. Thus it is natural to apply this global embedding to text generation. We fine-tune the pre-trained HICTL with the base setting on machine translation tasks with both low-resource and high-resource settings. For the low-resource scenario, we choose IWSLT’14 English German $( \mathrm { E n } \mathrm { D e } ) ^ { 2 }$ , IWSLT’14 English Spanish ( $\mathrm { E n \to E s }$ ), WMT’16 + +Table 4: BLEU scores $[ \% ]$ on high-resource tasks. Results with $\dagger$ and $\ddagger$ are from VECO (Luo et al., 2020) and our in-house implementation, respectively. In our implementation, we use XLM-R and the best version of HiCTL (pre-traind with CCNet-100 and hard negative samples) to initialize the encoder, respectively. + +
ModelLayersWMT'14
EncoderDecoderEn→DeEn→Fr
Randomly Initialize
Transformer-Big (Vaswani et al., 2017)6628.441.0
Deep-Transformer (Liu et al., 2020a)601230.143.8
Deep MSC Model (Wei et al., 2020)18630.561
Pre-trained Models Initialize
CTNMT (Yang et al.,2020)18630.142.3
BERT-fused NMT (Zhu et al.,2020)18630.7543.78
mBART+ (Liu et al.,2020b)121230.043.2
VECO (Luo et al., 2020)24631.544.4
XLM-R‡24630.9143.27
HICTL24631.7443.95
+ +Table 5: BLEU scores $[ \% ]$ on low-resource tasks. Results with $^ \ddag$ are from our in-house implementation. We provide additional experimental results (to follow experiments in Zhu et al. (2020)) on IWSLT’14 English Spanish $( \mathrm { E n \to E s } )$ ) task. $\mathrm { H I C T L _ { B a s e } }$ represents the BASE sized model that is pre-trained on CCNet-100 with hard negative samples. + +
ModelIWSLT'14WMT'16 Ro→EnIwSLT'17
En→DeDe→EnEn→EsEn→FrEn→Zh
Transformer (Vaswani et al., 2017)‡28.6434.5139.333.5135.826.5
BERT-fused NMT (Zhu et al., 2020)30.4536.1141.439.1038.728.2
HICTLBase31.8837.9642.139.8840.229.9
+ +Romanian English $( \mathrm { R o } \to \mathrm { E n } )$ ), IWSLT’17 English French $( \mathrm { E n \to F r } )$ and English Chinese $( \mathrm { E n { \to } Z h } )$ ) translation3. There are 160k, 183k, 236k, $2 3 5 \mathrm { k }$ , 0.6M bilingual sentence pairs for $\mathrm { E n } { } \mathrm { D e }$ , E $\mathbf { n } { } \mathrm { E s }$ , En ${ } \mathrm { F r }$ , $\mathrm { E n } \to \mathrm { Z h }$ and $\mathrm { R o } { } \mathrm { E n }$ tasks. For the rich-resource scenario, we work on WMT’14 ${ \mathrm { E n } } { } \{ \mathrm { D e } , \mathrm { F r } \}$ , the corpus sizes are 4.5M and 36M respectively. We concatenate newstest 2012 and newstest 2013 as the validation set and use newstest 2014 as the test set. + +During fine-tuning, we use the pre-trained model to initialize the encoder and introduce a randomly initialized decoder. We develop a shallower decoder with 4 identical layers to reduce the computation overhead. At the first fine-tune step, we concatenate the datasets of all language pairs in either low-resource or high-resource settings to optimize the decoder only until convergence4. Then we tune the whole encoder-decoder model using a per-language corpus at the second step. The initial learning rate is 2e-5 and inverse sqrt learning rate (Vaswani et al., 2017) scheduler is also adopted. For WMT’14 En De, we use beam search with width 4 and length penalty 0.6 for inference. For other tasks, we use width 5 and a length penalty of 1.0. We use multi-bleu.perl to evaluate IWSLT’14 $\mathrm { E n } { } \mathrm { D e }$ and WMT tasks, but sacreBLEU for the remaining tasks, for fair comparison with previous work. + +Results on both high-resource and low-resource tasks are reported in Table 4 and Table 5, respectively. We implemented standard Transformer (apply the base and big setting for IWSLT and WMT tasks respectively) as baseline. The proposed HICTL can improve the BLEU scores of the eight tasks by 3.34, 2.95, 3.24, 3.45, 2.8, 6.37, 4.4, and 3.4. In addition, our approach also outperforms the BERT-fused model (Yang et al., 2020), a method treats BERT as an extra context and fuses the representations extracted from BERT with each encoder and decoder layer. Note we achieve new state-of-the-art results on IWSLT’1 $4 ~ \mathrm { E n } { } \mathrm { D e }$ , IWSLT’17 $\mathrm { E n } { } \{ \mathrm { F r } , \mathrm { Z h } \}$ translations. These improvements show that mapping different languages into a universal representation space is beneficial for both low-resource and high-resource translations. + +Table 6: BLEU scores $[ \% ]$ on Zero-shot MT via Language Transfer. We bold the highest transferring score for each language family. + +
TestLanguagesFine-tuning Languages
Cs-→EnHi→En
mBARTHiCTLmBARTHiCTL
Cs→En21.622.4
Ro→En19.519.0
It-→En16.718.6
Nl→En17.018.1
Hi→En23.525.2
Ne→En14.516.0
Si→En13.014.7
Gu→En0.00.1
+ +We also evaluate our model on tasks where no bi-text is available for the target language pair. Following mBART (Liu et al., 2020b), we adopt the setting of language transfer. That is, no bi-text for the target pair is available, but there is bi-text for translating from some other language into the target language. For explanation, supposing there is no parallel data for the target language pair Italian English $( \mathrm { I t } \to \mathrm { E n } )$ ), but we can transfer knowledge learned from Czech English $\mathrm { \ C s \to E n }$ , a high-resource language pair) to $\mathrm { I t } { } \mathrm { E n }$ . We consider $\mathrm { X } { \to } \mathrm { E n }$ translation, covering Indic languages (Ne, Hi, Si, Gu) and European languages (Ro, It, Cs, Nl). For European languages, we fine-tune on $\mathrm { C s } { } \mathrm { E n }$ translation, the parallel data is from WMT’19 that contains 11M sentence pairs. We test on {Cs, Ro, It, $\mathrm { N l } \} { } \mathrm { E n }$ , in which test sets are from previous WMT (Cs, Ro) or IWSLT (It, Nl) competitions. For Indic languages, we fine-tune on $\mathrm { H i } { \xrightarrow { } } \mathrm { E n }$ translation (1.56M sentence pairs are from IITB (Kunchukuttan et al., 2018b)), and test on $\{ \mathrm { R o , I t , C s , N l } \} \mathrm { \to { E n } }$ translations. + +Results are shown in Table 6. We can always obtain reasonable transferring scores at low-resource pairs over different fine-tuned models. However, our experience shows that the randomly initialized models without pre-training always achieve near 0 BLEU. The underlying scenario is that multilingual pre-training produces universal representations across languages so that once the model learns to translate one language, it learns to translate all languages with similar representations. Moreover, a failure happened in $\mathrm { G u } { } \mathrm { E n }$ translation, we conjecture that we only use 0.3GB monolingual data for pre-training, which is difficult to learn informative representations for Gujarati. + +# 5 CONCLUSION + +We have demonstrated that pre-trained language models (PTMs) trained to learn commonsense knowledge from large-scale unlabeled data highly benefit from hierarchical contrastive learning (HICTL), both in terms of cross-lingual understanding and generation. Learning universal representations at both word-level and sentence-level bridges the semantic discrepancy across languages. As a result, our HICTL sets a new level of performance among cross-lingual PTMs, improving on the state of the art by a large margin. + +# ACKNOWLEDGMENTS + +We would like to thank the anonymous reviewers for the helpful comments. We also thank Jing Yu for the instructive suggestions. This work is supported by the National Key R&D Program of China under Grant No.2017YFB0803301 and No. 2018YFB1403202. + +# REFERENCES + +Mikel Artetxe and Holger Schwenk. Massively multilingual sentence embeddings for zero-shot cross-lingual transfer and beyond. Transactions of the Association for Computational Linguistics, 7:597–610, 2019. + +Mikel Artetxe, Sebastian Ruder, and Dani Yogatama. On the cross-lingual transferability of monolingual representations. arXiv preprint arXiv:1910.11856, 2019. + +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 632–642, Lisbon, Portugal, September 2015. Association for Computational Linguistics. doi: 10.18653/v1/D15-1075. URL https://www.aclweb.org/anthology/D15-1075. + +Samuel R. Bowman, Luke Vilnis, Oriol Vinyals, Andrew M. Dai, Rafal Jozefowicz, and Samy ´ Bengio. Generating sentences from a continuous space. In Proceedings of the 20th SIGNLL Conference on Computational Natural Language Learning, CoNLL 2016, Berlin, Germany, August 11-12, 2016, pp. 10–21, 2016. URL https://doi.org/10.18653/v1/k16-1002. + +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In Proceedings of Machine Learning and Systems 2020, pp. 10719–10729, 2020. + +Zewen Chi, Li Dong, Furu Wei, Nan Yang, Saksham Singhal, Wenhui Wang, Xia song, Xian-Ling Mao, Heyan Huang, and Ming Zhou. Infoxlm: An information-theoretic framework for crosslingual language model pre-training. CoRR, abs/2007.07834, 2020. URL https://arxiv. org/abs/2007.07834. + +Jonathan H Clark, Eunsol Choi, Michael Collins, Dan Garrette, Tom Kwiatkowski, Vitaly Nikolaev, and Jennimaria Palomaki. Tydi qa: A benchmark for information-seeking question answering in typologically diverse languages. arXiv preprint arXiv:2003.05002, 2020a. + +Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. ELECTRA: pretraining text encoders as discriminators rather than generators. In 8th International Conference on Learning Representations, ICLR 2020. OpenReview.net, 2020b. + +Alexis Conneau and Guillaume Lample. Cross-lingual language model pretraining. In Proc. of NIPS 2019, pp. 7059–7069, 2019. URL http://papers.nips.cc/paper/ 8928-cross-lingual-language-model-pretraining.pdf. + +Alexis Conneau, Ruty Rinott, Guillaume Lample, Adina Williams, Samuel Bowman, Holger Schwenk, and Veselin Stoyanov. XNLI: Evaluating cross-lingual sentence representations. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2475–2485, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1269. URL https://www.aclweb.org/anthology/ D18-1269. + +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzman, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Un-´ supervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 8440–8451, Online, July 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ 2020.acl-main.747. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https: //www.aclweb.org/anthology/N19-1423. + +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. Unified language model pre-training for natural language understanding and generation. In Advances in Neural Information Processing Systems 32, NeurIPS 2019, pp. 13063–13075. Curran Associates, Inc., 2019. + +Sergey Edunov, Alexei Baevski, and Michael Auli. Pre-trained language model representations for language generation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4052–4059, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1409. URL https://www.aclweb.org/ anthology/N19-1409. + +Andreas Eisele and Chen Yu. Multiun: A multilingual corpus from united nation documents. In International Conference on Language Resources & Evaluation, 2010. + +Yuwei Fang, Shuohang Wang, Zhe Gan, Siqi Sun, and Jingjing Liu. FILTER: an enhanced fusion method for cross-lingual language understanding. CoRR, abs/2009.05166, 2020. URL https: //arxiv.org/abs/2009.05166. + +Fangxiaoyu Feng, Yinfei Yang, Daniel Cer, Naveen Arivazhagan, and Wei Wang. Languageagnostic BERT sentence embedding. CoRR, abs/2007.01852, 2020. URL https://arxiv. org/abs/2007.01852. + +Junliang Guo, Zhirui Zhang, Linli Xu, Hao-Ran Wei, Boxing Chen, and Enhong Chen. Incorporating bert into parallel sequence decoding with adapters. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 10843–10854. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/7a6a74cbe87bc60030a4bd041dd47b78-Paper.pdf. + +Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR 2006), pp. 1735–1742. IEEE Computer Society, 2006. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, pp. 770–778. IEEE Computer Society, 2016. + +Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. CoRR, abs/1911.05722, 2019. + +Junjie Hu, Sebastian Ruder, Aditya Siddhant, Graham Neubig, Orhan Firat, and Melvin Johnson. XTREME: A massively multilingual multi-task benchmark for evaluating cross-lingual generalization. CoRR, abs/2003.11080, 2020. URL https://arxiv.org/abs/2003.11080. + +Haoyang Huang, Yaobo Liang, Nan Duan, Ming Gong, Linjun Shou, Daxin Jiang, and Ming Zhou. Unicoder: A universal language encoder by pre-training with multiple cross-lingual tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 2485–2494, Hong Kong, China, November 2019. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D19-1252. + +Dan Iter, Kelvin Guu, Larry Lansing, and Dan Jurafsky. Pretraining with contrastive sentence objectives improves discourse performance of language models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 4859–4870, Online, 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ 2020.acl-main.439. + +Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S. Weld, Luke Zettlemoyer, and Omer Levy. Spanbert: Improving pre-training by representing and predicting spans. Trans. Assoc. Comput. Linguistics, 8:64–77, 2020. URL https://transacl.org/ojs/index.php/tacl/ article/view/1853. + +Lingpeng Kong, Cyprien de Masson d’Autume, Lei Yu, Wang Ling, Zihang Dai, and Dani Yogatama. A mutual information maximization perspective of language representation learning. In 8th International Conference on Learning Representations, ICLR 2020. OpenReview.net, 2020. + +Anoop Kunchukuttan, Pratik Mehta, and Pushpak Bhattacharyya. The IIT bombay english-hindi parallel corpus. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation, LREC 2018. European Language Resources Association (ELRA), 2018a. + +Anoop Kunchukuttan, Pratik Mehta, and Pushpak Bhattacharyya. The IIT Bombay English-Hindi parallel corpus. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), 2018b. URL https://www.aclweb.org/anthology/ L18-1548. + +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. ALBERT: A lite BERT for self-supervised learning of language representations. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ H1eA7AEtvS. + +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880. Association for Computational Linguistics, 2020. + +Patrick Lewis, Barlas Oguz, Ruty Rinott, Sebastian Riedel, and Holger Schwenk. Mlqa: Evaluating ˘ cross-lingual extractive question answering. arXiv preprint arXiv:1910.07475, 2019. + +Xiaodong Liu, Kevin Duh, Liyuan Liu, and Jianfeng Gao. Very deep transformers for neural machine translation. arXiv preprint arXiv:2008.07772, 2020a. + +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692, 2019. URL http://arxiv.org/abs/1907.11692. + +Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. Multilingual denoising pre-training for neural machine translation. CoRR, abs/2001.08210, 2020b. + +Fuli Luo, Wei Wang, Jiahao Liu, Yijia Liu, Bin Bi, Songfang Huang, Fei Huang, and Luo Si. VECO: variable encoder-decoder pre-training for cross-lingual understanding and generation. CoRR, abs/2010.16046, 2020. URL https://arxiv.org/abs/2010.16046. + +Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems 26, pp. 3111–3119, 2013. + +Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Advances in Neural Information Processing Systems 26, pp. 2265–2273, 2013. + +Joakim Nivre, Mitchell Abrams, Zeljko Agic, Lars Ahrenberg, Lene Antonsen, and et al. Universal Dependencies 2.2, 2018. URL https://hal.archives-ouvertes.fr/ hal-01930733. LINDAT/CLARIN digital library at the Institute of Formal and Applied Linguistics (UFAL), Faculty of Mathematics and Physics, Charles University. ´ + +Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predic- ¨ tive coding. CoRR, abs/1807.03748, 2018. URL http://arxiv.org/abs/1807.03748. + +Xiaoman Pan, Boliang Zhang, Jonathan May, Joel Nothman, Kevin Knight, and Heng Ji. Crosslingual name tagging and linking for 282 languages. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1946–1958, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1178. URL https://www.aclweb.org/anthology/P17-1178. + +Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 2227–2237, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1202. URL https://www.aclweb.org/anthology/N18-1202. + +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openaiassets/researchcovers/languageunsupervised/language understanding paper. pdf, 2018. + +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019. + +Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. In Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 5628–5637, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/ v97/saunshi19a.html. + +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pp. 1631–1642, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D13-1170. + +Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and Tie-Yan Liu. MASS: masked sequence to sequence pre-training for language generation. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, volume 97, pp. 5926–5936. PMLR, 2019. + +Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision - ECCV 2020 - 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XI, volume 12356 of Lecture Notes in Computer Science, pp. 776–794. Springer, 2020. doi: 10.1007/ 978-3-030-58621-8\ 45. URL https://doi.org/10.1007/978-3-030-58621-8_ 45. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems 30, NIPS 2017, pp. 5998–6008. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/7181-attention-is-all-you-need.pdf. + +Xiangpeng Wei, Heng Yu, Yue Hu, Yue Zhang, Rongxiang Weng, and Weihua Luo. Multiscale collaborative deep models for neural machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 414–426, Online, July 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ 2020.acl-main.40. + +Rongxiang Weng, Heng Yu, Shujian Huang, Shanbo Cheng, and Weihua Luo. Acquiring knowledge from pre-trained model to neural machine translation. In Proceedings of the AAAI Conference on Artificial Intelligence, pp. 9266–9273, 2020. + +Guillaume Wenzek, Marie-Anne Lachaux, Alexis Conneau, Vishrav Chaudhary, Francisco Guzman, Armand Joulin, and Edouard Grave. Ccnet: Extracting high quality monolingual datasets from web crawl data. arXiv preprint arXiv:1911.00359, 2019. + +Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 1112–1122, New Orleans, Louisiana, June 2018. Association + +for Computational Linguistics. doi: 10.18653/v1/N18-1101. URL https://www.aclweb. +org/anthology/N18-1101. + +Zhirong Wu, Yuanjun Xiong, Stella X. Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, pp. 3733–3742. IEEE Computer Society, 2018. + +Jiacheng Yang, Mingxuan Wang, Hao Zhou, Chengqi Zhao, Weinan Zhang, Yong Yu, and Lei Li. Towards making the most of BERT in neural machine translation. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, pp. 9378–9385. AAAI Press, 2020. URL https://aaai.org/ojs/index.php/AAAI/article/view/6479. + +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in Neural Information Processing Systems 32, NeurIPS 2019, pp. 5753–5763. Curran Associates, Inc., 2019. + +Mang Ye, Xu Zhang, Pong C. Yuen, and Shih-Fu Chang. Unsupervised embedding learning via invariant and spreading instance feature. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, pp. 6210–6219. Computer Vision Foundation / IEEE, 2019. + +Xingxing Zhang, Furu Wei, and Ming Zhou. HIBERT: Document level pre-training of hierarchical bidirectional transformers for document summarization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5059–5069, Florence, Italy, July 2019a. Association for Computational Linguistics. doi: 10.18653/v1/P19-1499. URL https://www.aclweb.org/anthology/P19-1499. + +Yuan Zhang, Jason Baldridge, and Luheng He. PAWS: Paraphrase adversaries from word scrambling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 1298–1308, Minneapolis, Minnesota, June 2019b. Association for Computational Linguistics. doi: 10.18653/v1/N19-1131. URL https://www.aclweb.org/anthology/ N19-1131. + +Han Zhao, Junjie Hu, and Andrej Risteski. On learning language-invariant representations for universal machine translation. In Hal Daume III and Aarti Singh (eds.), ´ Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 11352–11364. PMLR, 13–18 Jul 2020. URL http://proceedings.mlr. press/v119/zhao20b.html. + +Wenzhao Zheng, Zhaodong Chen, Jiwen Lu, and Zhou Jie. Hardness-aware deep metric learning. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 72–81, 2019. URL http://openaccess.thecvf.com/content_CVPR_2019/html/Zheng_ Hardness-Aware_Deep_Metric_Learning_CVPR_2019_paper.html. + +Ming Zhong, Pengfei Liu, Yiran Chen, Danqing Wang, Xipeng Qiu, and Xuanjing Huang. Extractive summarization as text matching. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6197–6208. Association for Computational Linguistics, 2020. URL https://www.aclweb.org/anthology/2020.acl-main.552. + +Jinhua Zhu, Yingce Xia, Lijun Wu, Di He, Tao Qin, Wengang Zhou, Houqiang Li, and Tie-Yan Liu. Incorporating BERT into neural machine translation. In 8th International Conference on Learning Representations, ICLR 2020. OpenReview.net, 2020. URL https://openreview. net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } = \underline { { \underline { { \mathbf { \delta \pi } } } } } .$ Hyl7ygStwB. + +Pierre Zweigenbaum, Serge Sharoff, and Reinhard Rapp. Overview of the second BUCC shared task: Spotting parallel sentences in comparable corpora. In Proceedings of the 10th Workshop on Building and Using Comparable Corpora, pp. 60–67, Vancouver, Canada, August 2017. Association for Computational Linguistics. doi: 10.18653/v1/W17-2512. URL https: //www.aclweb.org/anthology/W17-2512. + +Table 7: The statistics of CCNet corpus used for pretraining. + +
CodeSize (GB)CodeSize (GB)CodeSize (GB)CodeSize (GB)CodeSize (GB)
af1.3et6.1ja24.2mt0.2sq3.0
am0.7eu2.0jv0.2my0.9sr5.1
ar20.4fa21.6ka3.4ne2.6su0.1
as0.1fi19.2kk2.6nl15.8SV10.8
az3.6fr46.5km1.0no3.7SW1.6
be3.5fy0.2kn1.2om0.1ta8.2
bg22.6ga0.5ko17.2or0.6te2.6
bn7.9gd0.1ku0.4pa0.8th14.7
br0.1gl2.9ky1.2pl16.8tl0.8
bs0.1gu0.3la2.5ps0.7tr17.3
ca10.1ha0.3lo0.6pt15.9ug0.4
CS16.3he6.7lt7.2ro8.6uk9.1
cy0.8hi20.2lv6.4ru48.1ur5.0
da15.2hr5.4mg0.2sa0.3uz0.7
de46.3hu9.5mk1.9sd0.4vi44.6
el29.3hy5.5ml4.3si2.1xh0.1
en49.7id10.6mn1.7sk4.9yi0.3
eo0.9is1.3mr1.3sl2.8zh36.8
es44.6it19.8ms3.2S00.4--
+ +Table 8: Parallel data used for pre-training. + +
CodeSentence Pair (#millions)CodeSentence Pair (#millions)
en-ar9.8en-ru11.7
en-bg0.6en-sw0.2
en-de9.3en-th3.3
en-el4.0en-tr0.5
en-es11.4en-ur0.7
en-fr13.2en-vi3.5
en-hi1.6en-zh9.6
+ +# A PRE-TRAINING DATA + +During pre-training, we follow Conneau et al. (2020) to build a Common-Crawl Corpus using the CCNet (Wenzek et al., 2019) tool5 for monolingual texts. Table 7 reports the language codes and data size in our work. For parallel data, we use the same (English-to- $X$ ) MT dataset as (Conneau & Lample, 2019), which are collected from MultiUN (Eisele & Yu, 2010) for French, Spanish, Arabic and Chinese, the IIT Bombay corpus (Kunchukuttan et al., 2018a) for Hindi, the OpenSubtitles 2018 for Turkish, Vietnamese and Thai, the EUbookshop corpus for German, Greek and Bulgarian, Tanzil for both Urdu and Swahili, and GlobalVoices for Swahili. Table 8 shows the statistics of the parallel data. + +# B HYPERPARAMETERS FOR PRE-TRAINING AND FINE-TUNING + +As shown in Table 9, we present the hyperparameters for pre-training HICTL. We use the same vocabulary as well as the sentence-piece model with XLM-R (Conneau et al., 2020). During finetuning on XTREME, we search the learning rate over $\{ 5 \mathrm { e } { - } 6 , 1 \mathrm { e } { - } 5 , 1 . 5 \mathrm { e } { - } 5 , 2 \mathrm { e } { - } 5 , 2 . 5 \mathrm { e } { - } 5 , 3 \mathrm { e } { - } 5 \}$ and batch size over $\{ 1 6 , 3 2 \}$ for BASE-size models. And we select the best LARGE-size model by searching the learning rate over $\{ 3 \mathrm { e } { - } 6 , 5 \mathrm { e } { - } 6 , 1 \mathrm { e } { - } 5 \}$ as well as batch size over $\{ 3 2 , 6 4 \}$ . + +Table 9: Hyperparameters used for pre-training. + +
HyperparametersBASELARGE
Number of layers1224
Hidden size7681024
FFN inner hidden size30724096
Attention heads1216
Mask percent (monolingual/bilingual)15%/25%15%/25%
Adam ∈1e-61e-6
Adam β(0.9, 0.98)(0.9, 0.999)
Learning rate2.5e-41e-4
Learning rate schedulelinearlinear
Warmup steps10,00010,000
Attention dropout0.10.1
Dropout0.10.1
Max sequence length (monolingual/bilingual)256256
Batch size10241024
Training steps200k200k
+ +Table 10: Results on Cross-lingual Natural Language Inference (XNLI) for each language. We report the accuracy on each of the 15 XNLI languages and the average accuracy of our HICTL as well as five baselines: BiLSTM (Conneau et al., 2018), mBERT (Devlin et al., 2019), XLM (Conneau & Lample, 2019), Unicoder (Huang et al., 2019) and XLM-R (Conneau et al., 2020). Results of $\ddagger$ are from our in-house replication. + +
MODELenfresdeelbgrutrarvithzhhiswurAvg
Evaluation of cross-lingual sentence encoders (Cross-lingual transfer)
BiLSTM73.767.768.767.768.967.965.464.264.866.464.165.864.155.758.465.6
mBERT81.474.370.51-1-62.1-63.8--58.31
XLM85.078.778.977.876.677.475.372.573.176.173.276.569.668.467.375.1
Unicoder85.179.079.477.877.277.276.372.873.576.473.676.269.469.766.775.4
XLM-RBase85.879.780.778.777.579.678.174.273.876.574.676.772.466.568.376.2
HICTLBase86.380.581.379.578.980.679.075.474.877.475.777.673.169.969.777.3
Machine translateat training (Translate-train)
BiLSTM73.768.368.866.566.467.466.564.565.866.062.867.062.158.256.665.4
mBERT81.9177.875.9111170.71176.61161.61
XLM Unicoder85.080.280.880.378.179.378.174.776.576.675.578.672.370.963.276.7
85.180.081.179.977.780.277.975.376.776.475.279.471.871.864.576.9
HICTLBase85.781.382.180.281.481.080.579.777.478.277.580.275.473.572.979.1
Fine-tunemultilingualmodelonalltrainingsets (Translate-train-all)
XLM85.080.881.380.379.180.978.375.677.678.576.079.572.972.868.577.8
Unicoder85.681.182.380.979.581.479.776.878.277.977.180.573.473.869.678.5
XLM-RBase85.481.482.280.380.481.379.778.677.379.777.980.276.173.173.079.1
HICTLBase86.582.383.280.881.682.281.380.578.180.478.680.776.773.873.980.0
XLM-R89.185.186.685.785.385.983.583.283.183.781.583.781.678.078.183.6
XLM-R88.984.786.284.885.085.382.482.782.482.880.983.080.277.377.282.9
HICTL89.385.586.986.185.786.183.783.983.3 83.581.884.281.078.477.983.8
+ +# C RESULTS FOR EACH DATASET AND LANGUAGE + +Below, we provide detailed results for each dataset and language on XTREME, as shown in Table 10- 14. Results of XLM-R are from our implementation. + +# D VISUALIZATION OF SENTENCE EMBEDDINGS + +We collect 10 sets of samples from WMT’14-19, each of them contains 100 parallel sentences distributed in 5 languages. As the t-SNE visualization in Figure 4, a set of sentences under the same meaning are clustered more densely for HICTL than XLM-R, which reveals the strong capability + +Table 11: PAWS-X accuracy scores for each language. + +
Modelendeesfrjakozhavg
Translate-train-all
XLM-R95.792.292.792.584.785.987.190.1
HICTL,Wiki-15 + MT96.693.293.392.986.587.388.691.2
HICTL, CCNet-100 + MT96.993.894.494.388.088.289.492.2
+HARD NEGATIVE SAMPLES97.494.295.094.289.189.590.292.8
+ +Table 12: POS results (Accuracy) for each language. + +
Modelafarbgdeeleneseteufaffrhehihuidit
Translate-train-all
XLM-R90.667.489.189.986.896.389.687.174.070.886.087.768.677.482.872.691.1
HICTL,Wiki-15 + MT91.069.389.189.487.897.688.288.274.872.086.787.970.279.084.274.390.8
HICTL, CCNet-100 + MT91.870.290.790.889.098.389.790.176.273.088.590.270.780.086.474.592.0
+HARD NEGATIVE SAMPLES92.271.091.591.390.097.791.089.475.773.588.890.171.179.785.475.191.7
jakkkomrnlptrutatethttrurviyozhavg
Translate-train-all
XLM-R17.378.355.582.189.888.989.865.787.048.692.977.971.756.824.727.274.6
HICTL,Wiki-15 + MT28.479.254.280.790.988.490.567.389.148.792.277.672.058.827.227.175.5
HICTL,CCNet-100 + MT30.280.455.182.191.290.290.768.190.150.395.278.773.359.227.827.976.8
+HARD NEGATIVE SAMPLES31.980.957.083.591.791.091.269.590.850.394.879.473.459.528.628.777.2
+ +of HICTL on learning universal representations across different languages. Note that the t-SNE visualization of HICTL still demonstrates some noises, we attribute them to the lack of hard negative examples for sentence-level contrastive learning and leave this to future work for consideration. + +Table 13: NER results (F1) for each language. + +
Modelenaf arbgbndeeleseteufafifrhehihuiditja jv
Translate-train-all
XLM-R86.881.455.282.981.179.181.581.181.360.664.180.683.260.176.179.453.280.722.763.9
HICTL, Wiki-15 + T87.082.355.284.779.081.280.181.679.861.461.982.880.560.474.679.854.883.524.966.1
HICTL, CCNet-100 +MT88.680.955.485.681.882.082.580.881.262.564.281.283.060.377.384.455.883.726.065.0
+HARD NEGATIVE SAMPLES88.982.056.683.783.482.884.883.083.865.465.482.082.660.574.781.558.184.727.965.9
kakkkomlmrmsmynlptruswtatethtltrurviyozh
XLMR74.258.0 63.368.369.859.557.586.282.368.570.759.858.52.472.675.959.779.437.035.4
HICTL, Wiki-15 + MT75.056.762.269.468.857.955.687.984.271.974.461.659.22.274.279.558.183.035.233.0
HICTL, CCNet-100 + MT72.857.664.670.471.561.159.087.785.170.374.360.657.95.677.579.059.883.737.736.9
+HARD NEGATIVE SAMPLES76.860.965.071.472.559.056.385.984.571.475.662.958.83.977.780.459.183.637.737.2
+ +Table 14: Tatoeba results (Accuracy) for each language + +
Modelafarbgbndeeleseteufaffrhehihuiditja
Translate-train-all
XLM-R59.750.572.245.489.561.377.651.738.671.772.876.966.373.165.177.568.563.1
HICTL, Wiki-15 + MT61.551.476.147.992.163.480.555.937.874.676.778.068.474.568.880.470.263.9
HICTL, CCNet-100 + MT63.050.976.847.094.668.880.959.341.577.378.280.370.277.972.181.373.766.2
+HARD NEGATIVE SAMPLES68.957.783.255.498.274.588.562.447.780.282.985.579.185.076.890.380.872.7
jvkakkkomlmrmlptruswtatethttrurvizh
XLM-R15.853.351.263.166.259.081.084.476.919.828.337.828.936.768.926.677.969.8
HICTL,Wiki-15 + MT18.755.851.065.567.361.282.984.478.322.228.641.433.541.671.226.780.273.6
HICTL, CCNet-100 + MT19.657.354.668.071.862.088.188.977.726.132.939.532.943.271.227.879.974.7
+HARD NEGATIVE SAMPLES27.263.061.572.675.367.892.892.885.432.036.747.841.549.877.034.384.381.3
+ +![](images/ed8a6d67f3644e02a244e20676dae30223fee2351f4b4a456f36457157729ba6.jpg) +Figure 4: Visualizations (t-SNE projection) of sentence embeddings output by HICTL (left) and XLM-R (right). We collect 10 sets of samples from WMT’14-19, each of them contains 100 parallel sentences distributed in 5 languages (i.e., English, French, German, Russian, and Spanish). Each set is identified by a color and different languages marked by different shapes. We can see that a set of sentences under the same meaning are clustered more densely for HICTL than XLM-R, which reveals the strong capability of HICTL on learning universal representations across different languages. \ No newline at end of file diff --git a/md/train/WrotwUEJO59/WrotwUEJO59.md b/md/train/WrotwUEJO59/WrotwUEJO59.md new file mode 100644 index 0000000000000000000000000000000000000000..9a9b6b4804bda35ff8a4de451491b7724a5028d0 --- /dev/null +++ b/md/train/WrotwUEJO59/WrotwUEJO59.md @@ -0,0 +1,466 @@ +# Quantifying and Learning Linear Symmetry-Based Disentanglement + +Anonymous Author(s) +Affiliation +Address +email + +# Abstract + +1 The definition of Linear Symmetry-Based Disentanglement (LSBD) formalizes +2 the notion of linearly disentangled representations, but there is currently no metric +3 to quantify LSBD. Such a metric is crucial to evaluate LSBD methods and to +4 compare to previous understandings of disentanglement. We propose $\mathcal { D } _ { \mathrm { L S B D } }$ , a +5 mathematically sound metric to quantify LSBD, and provide a practical implemen +6 tation. Furthermore, from this metric we derive LSBD-VAE, a semi-supervised +7 method to learn LSBD representations. We demonstrate the utility of our metric +8 by showing that (1) common VAE-based disentanglement methods don’t learn +9 LSBD representations, (2) LSBD-VAE as well as other recent methods can learn +10 LSBD representations, needing only limited supervision on transformations, and +11 (3) various desirable properties expressed by existing disentanglement metrics are +12 also achieved by LSBD representations. + +# 13 1 Introduction + +14 Learning low-dimensional representations that disentangle the underlying factors of variation in data +15 is considered an important step towards interpretable machine learning with good generalization. To +16 address the fact that there is no consensus on what disentanglement entails and how to formalize it, +17 Higgins et al. (2018) propose a formal definition for Linear Symmetry-Based Disentanglement, or +18 LSBD, arguing that underlying real-world symmetries give exploitable structure to data. +19 However, there is currently no metric to quantify LSBD. Such a metric is crucial to properly evaluate +20 methods aiming to learn LSBD representations and to relate LSBD to previous definitions of disentan +21 glement. Although previous works have evaluated LSBD by measuring performance on downstream +22 tasks (Caselles-Dupré et al., 2019) or by measuring specific traits related to LSBD (Painter et al., +23 2020; Quessard et al., 2020), none of these evaluation methods directly quantify LSBD according to +24 its well-formalized definition. +25 We propose $\mathcal { D } _ { \mathrm { L S B D } }$ , a well-formalized and generally applicable metric that quantifies the level of +26 LSBD in learned data representations. We show an intuitive justification of this metric, as well +27 as its theoretical derivation. We also provide a practical implementation to compute $\mathcal { D } _ { \mathrm { L S B D } }$ for +28 common symmetry groups. Furthermore, we show that our metric formulation can be used to derive +29 a semi-supervised method to learn LSBD representations, which we call LSBD-VAE. To make +30 LSBD-VAE more widely applicable, we also demonstrate how to disentangle symmetric properties +31 from other non-symmetric properties, and how to quantify this disentanglement with $\mathcal { D } _ { \mathrm { L S B D } }$ . +32 We show the utility of $\mathcal { D } _ { \mathrm { L S B D } }$ by quantifying LSBD in a number of settings, for a variety of datasets +33 with underlying SO(2) symmetries and other non-symmetric properties. First, we evaluate common +34 VAE-based disentanglement methods and show that most don’t learn LSBD representations. Second, +35 we evaluate LSBD-VAE and other recent methods that specifically target LSBD, showing that they +36 can obtain much better $\mathcal { D } _ { \mathrm { L S B D } }$ scores while needing only limited supervision on transformations. +37 Third, we compare $\mathcal { D } _ { \mathrm { L S B D } }$ with existing disentanglement metrics, showing that various desirable +38 properties expressed with these metrics are also achieved by LSBD representations. + +# 39 2 Related Work + +40 Plenty of works have focused on learning and quantifying disentangled representations recently, but +41 research has shown that there is little consensus about the exact definition of disentanglement and +42 methods often do not achieve it as well as they proclaim (Locatello et al., 2019). To introduce some +43 much-needed formalization, Higgins et al. (2018) proposed to define disentanglement with respect +44 to symmetry transformations acting on the data. They used group theory to provide two formal +45 definitions, which we refer to as (Linear) Symmetry-Based Disentanglement, or (L)SBD. In this +46 paper we focus only on LSBD, not SBD. +47 Several methods have been proposed to learn LSBD representations (Caselles-Dupré et al., 2019; +48 Painter et al., 2020; Quessard et al., 2020). These methods also learn to represent the transformations +49 acting on the input data, assuming various levels of supervision on these transformations. Other +50 methods have previously focused on capturing transformations of the data outside the context of +51 disentanglement as well (Cohen and Welling, 2015; Sosnovik et al., 2019; Worrall et al., 2017). + +# 52 3 Linear Symmetry-Based Disentanglement + +53 Higgins et al. (2018) provide a formal definition of linear disentanglement that connects symmetry +54 transformations affecting the real world (from which data is observed) to the internal representations +55 of a model. The definition is grounded in concepts from group theory, we provide a more detailed +56 description of these concepts in the Supplementary Material. +57 The definition1 considers a group $G$ of symmetry transformations acting on the data space $X$ through +58 the group action $\cdot : G \times X \to X$ . In particular, $G$ can be decomposed as the direct product of $K$ +59 groups $G = G _ { 1 } \times \ldots \times G _ { K }$ . A model’s internal representation of data is modeled with the encoding +60 function $h : X \to Z$ that maps data to the embedding space $Z$ . The definition for Linearly Symmetry +61 Based Disentangled (LSBD) representations then formalizes the requirement that a model’s encoding +62 $h$ should reflect and disentangle the transformation properties of the data, and that the transformation +63 properties of the model’s encoding should be linear. The exact definition is as follows: +64 Definition: Linear Symmetry-Based Disentanglement (LSBD) A model’s encoding map $h :$ +65 $X Z$ , where $Z$ is a vector space, is LSBD with respect to the group decomposition $G =$ +66 $G _ { 1 } \times \ldots \times G _ { K }$ if + +1. there is a decomposition of the embedding space $Z = Z _ { 1 } \oplus . . . \oplus Z _ { K }$ into $K$ vector subspaces, +2. there are group representations for each subgroup in the corresponding vector subspace $\rho _ { k } : G _ { k } \stackrel { \textstyle \bar { \to } } { \to } \mathrm { G L } ( Z _ { k } ) , k \in \{ 1 , \dots , K \}$ +3. the group representation $\rho : G \to { \mathrm { G L } } ( Z )$ acts on $Z$ as $\rho ( g ) \cdot z = ( \rho _ { 1 } ( g _ { 1 } ) \cdot z _ { 1 } , \ldots , \rho _ { K } ( g _ { K } ) \cdot z _ { K } ) ,$ (1) for $g = ( g _ { 1 } , \dotsc , g _ { K } ) \in G$ and $z = ( z _ { 1 } , \dots , z _ { K } ) \in Z$ with $g _ { k } \in G _ { k }$ and $z _ { k } \in Z _ { k }$ . +4. the map $h$ is equivariant with respect to the actions of $G$ on $X$ and $Z$ , i.e. , for all $x \in X$ and $g \in G$ it holds that $h ( g \cdot x ) \stackrel { } { = } \rho ( g ) \cdot h ( x )$ . + +75 Furthermore, we say that a group representation $\rho$ is linearly disentangled with respect to the group +76 decomposition $G = G _ { 1 } \times \ldots \times G _ { K }$ if it satisfies criteria 1 to 3 from the LSBD definition above. + +# 78 4.1 Intuition: Measuring Equivariance with Dispersion + +79 To motivate our metric, let’s first assume a set +80 ting in which a suitable linearly disentangled +81 group representation $\rho$ is known. Let’s further +82 assume that the dataset of observations can be +83 84 exprepoint $x _ { 0 } \in X$ respe, i.e. $\{ x _ { n } \} _ { n = 1 } ^ { N } = { \bar { \{ g _ { n } \cdot x _ { 0 } \} } } _ { n = 1 } ^ { N }$ $G$ +85 Formally, this assumes that the action of $G$ on +86 $X$ is regular. In this case, we can use the inverse +87 group elements $g _ { n } ^ { - 1 }$ to transform each data point +88 toward the base point $x _ { 0 }$ , i.e. + +$$ +x _ { 0 } = g _ { 1 } ^ { - 1 } \cdot x _ { 1 } = \ldots = g _ { N } ^ { - 1 } \cdot x _ { N } . +$$ + +89 Since $\rho$ is linearly disentangled, we only need to +90 measure the equivariance of the encoding map +91 $h$ to quantify LSBD. Equivariance is achieved +92 when $h ( g \cdot x ) = \rho ( g ) \cdot h ( x )$ , for all $g \in G , x \in$ +93 $X$ . Given the dataset described above, we can +94 $\{ g _ { n } \} _ { n = 1 } ^ { N }$ s property for .2 In particular $x \in \{ x _ { n } \} _ { n = 1 } ^ { N }$ and n (2) $g \in$ +96 can see that we have equivariance if + +![](images/caa1181c8b0270db28d1a6afc76b50415256cdbf5ee7362a8dc3585ad944ee78.jpg) +Figure 1: A dataset of images from a rotating object expressed in terms of the group $G = \bar { \mathrm { S O } } ( 2 )$ acting on a base image $x _ { 0 }$ . It is possible to quantify the level of LSBD of an encoding map $h$ by measuring its equivariance with respect to a group representation $\rho$ . Since all data has been generated from $x _ { 0 }$ , equivariance can be measured as the dispersion of the points $\{ \rho ( g _ { n } ^ { - 1 } ) \cdot h ( x _ { n } ) \} _ { n = 1 } ^ { N }$ . + +$$ +h ( x _ { 0 } ) = \rho ( g _ { 1 } ^ { - 1 } ) \cdot h ( x _ { 1 } ) = \ldots = \rho ( g _ { N } ^ { - 1 } ) \cdot h ( x _ { N } ) . +$$ + +97 This not only characterizes perfect equivariance, but also allows for an efficient way to quantify how +98 close we are to true equivariance, by measuring the dispersion of the points $\{ \rho ( g _ { n } ^ { - 1 } ) \cdot \bar { h } ( x _ { n } ) \} _ { n = 1 } ^ { N }$ . 3 +99 Given a suitable norm $\| \cdot \| _ { Z }$ in $Z$ , we can thus quantify LSBD in this setting as + +$$ +\frac { 1 } { N } \sum _ { n = 1 } ^ { N } \left. \rho ( g _ { n } ^ { - 1 } ) \cdot h ( x _ { n } ) - \frac { 1 } { N } \sum _ { n ^ { \prime } = 1 } ^ { N } \rho ( g _ { n ^ { \prime } } ^ { - 1 } ) \cdot h ( x _ { n ^ { \prime } } ) \right. _ { Z } ^ { 2 } , +$$ + +i.e. we compute the mean of 100 $\{ \rho ( g _ { n } ^ { - 1 } ) \cdot h ( x _ { n } ) \} _ { n = 1 } ^ { N }$ and use the average squared distance to this mean for points in 101 $\{ \rho ( g _ { n } ^ { - 1 } ) \cdot h ( x _ { n } ) \} _ { n = 1 } ^ { N }$ as our LSBD metric, see Figure 1. + +02 However, this formulation requires knowing the right linearly disentangled group representation and 103 a suitable norm in $Z$ . Moreover, it implicitly assumes a uniform probability measure over the group elements 104 $\{ g _ { n } \} _ { n = 1 } ^ { N }$ . In the next section we formulate our metric for a more general setting. + +# 05 4.2 $\mathcal { D } _ { \mathrm { L S B D } }$ : A Metric for LSBD + +106 Generalizing the ideas from the previous section with concepts from measure theory, we propose a +107 metric to measure the level of LSBD of any encoding $h : X \to Z$ given a data probability measure $\mu$ +108 on $X$ , provided that $\mu$ can be written as the pushforward $G _ { X } ( \cdot , x _ { 0 } ) _ { \# } \nu$ of some probability measure +109 $\nu$ on $G$ by the function $G _ { X } ( \cdot , x _ { 0 } )$ for some base point $x _ { 0 }$ . More formally, + +$$ +\mu ( A ) = G _ { X } ( \cdot , x _ { 0 } ) _ { \# } \nu ( A ) = \nu \left( \left\{ g \in G \mid G _ { X } ( g , x _ { 0 } ) \in A \right\} \right) , +$$ + +10 for Borel subsets $A \subset X$ . Note that this is only possible if the action $G _ { X }$ is transitive. + +For example, the situation of a dataset with 111 $N$ datapoints $\{ x _ { n } \} _ { n = 1 } ^ { N } = \{ g _ { n } \cdot x _ { 0 } \} _ { n = 1 } ^ { N }$ corresponds to 112 the case in which $\nu$ and $\mu$ are empirical measures on the group $G$ and data space $X$ , respectively: + +$$ +\nu : = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \delta _ { g _ { i } } , \qquad \mu : = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \delta _ { x _ { i } } . +$$ + +2Note that $\{ g _ { n } \} _ { n = 1 } ^ { N }$ can be used to describe all known group transformations between elements in the dataset by means of composition and inverses, since $x _ { i } = g _ { i } \cdot ( g _ { j } ^ { - 1 } \cdot x _ { j } )$ . Thus it suffices to check equivariance for these $N$ group transformations. + +3Note that we do not actually need to know $x _ { 0 }$ nor $h ( x _ { 0 } )$ + +113 We define the metric $\mathcal { D } _ { \mathrm { L S B D } }$ for an encoding $h$ and a measure $\mu$ as + +$$ +\mathcal { D } _ { \mathrm { L S B D } } : = \operatorname* { i n f } _ { \rho \in \mathcal { P } ( G , Z ) } \int _ { G } \big \| \rho ( g ) ^ { - 1 } \cdot h ( g \cdot x _ { 0 } ) - M _ { \rho , h , x _ { 0 } } \big \| _ { \rho , h , \mu } ^ { 2 } d \nu ( g ) , +$$ + +114 where the norm $\| \cdot \| _ { \rho , h , \mu }$ is a Hilbert-space norm depending on the representation $\rho$ , the encoding map +115 $h : X \to Z$ , and the data measure $\mu$ . More details of this norm can be found in the Supplementary +116 Material. Moreover, ${ \mathcal { P } } ( G , Z )$ denotes the set of linearly disentangled representations of $G$ in $Z$ +117 Lower values of $\mathcal { D } _ { \mathrm { L S B D } }$ indicate better disentanglement, zero being optimal. + +# 118 4.3 Practical Computation of $\mathcal { D } _ { \mathrm { L S B D } }$ + +119 There are two main challenges for computing the metric of Equation (7). First, to calculate the +120 integrals in the formula, all possible datapoints that can be expressed as $g \cdot x _ { 0 }$ with $g \in G =$ +121 $G _ { 1 } \times \cdots \times G _ { K }$ must be available. Second, the infimum of the integrals over all possible linearly +122 disentangled representations must be estimated. This requires finding the possible invariant subspaces +123 $Z = Z _ { 1 } \oplus \cdots \oplus Z _ { K }$ induced by the encoding $h$ over which the group representations are disentangled. +124 We present a practical implementation of an upper bound to $\mathcal { D } _ { \mathrm { L S B D } }$ for an encoding function $h$ given +125 a dataset $\mathcal { X }$ generated by some known group transformations. In particular, this approximation of +126 $\mathcal { D } _ { \mathrm { L S B D } }$ is designed for a group decomposition $G = G _ { 1 } \times \cdot \cdot \cdot \times G _ { K }$ where each $G _ { k } \overset { \vartriangle } { = } \mathrm { S O } ( D _ { k } )$ with +127 $k \in \{ 1 , \ldots , K \}$ the group of rotations in $D _ { k }$ dimensions. This implementation approximates the +128 integrals of Equation (7) by using the empirical distribution of $\mathcal { X }$ . The invariant subspaces of $Z$ to the +129 subgroup actions are found by applying a suitable change of basis. In the new basis, the disentangled +130 group representations are expressed in a parametric form whose parameters are optimized to find the +131 tightest bound to $\mathcal { D } _ { \mathrm { L S B D } }$ . See Figure 2 for an intuitive description of the process. +132 Assume there is a dataset $\mathcal { X }$ that can be modeled in terms of the group decomposition $G = G _ { 1 } \times \cdot \cdot \cdot G _ { k }$ . +133 For each $G _ { k }$ subgroup there is a set of known group elements $\mathcal { G } _ { k } \subseteq G _ { k }$ uniformly sampled such +134 that the dataset is described in terms of all elements in $\mathcal { G } = \mathcal { G } _ { 1 } \times \cdots \times \mathcal { G } _ { K }$ and a base point $x _ { 0 }$ as +135 ${ \mathcal { X } } = \left\{ \left( g _ { 1 } , \dots , g _ { K } \right) \cdot x _ { 0 } { \big | } g _ { k } \in { \mathcal { G } } _ { k } , ~ k \in \left\{ 1 , \dots , K \right\} \right\}$ . +136 For each subgroup $G _ { k }$ we construct a set of encoded data $\mathcal { Z } _ { k } \subseteq Z$ whose variability should only de +137 pend on the action of $G _ { k }$ . The set $\mathcal { Z } _ { k }$ is given by $\mathcal { Z } _ { k } = \{ z _ { k } ( g _ { 1 } , \dotsc , g _ { K } ) | g _ { j } \in \mathcal { G } _ { j } \ , j \in \{ 1 , \dotsc , K \} \}$ , +138 in which + +$$ +z _ { k } ( g _ { 1 } , \dots , g _ { K } ) = h ( ( g _ { 1 } , \dots , g _ { K } ) \cdot x _ { 0 } ) - \frac { 1 } { | { \mathcal { G } } _ { k } | } \sum _ { g ^ { \prime } \in { \mathcal { G } } _ { k } } h ( ( g _ { 1 } , \dots , g _ { k - 1 } , g ^ { \prime } , g _ { k + 1 } , \dots , g _ { K } ) \cdot x _ { 0 } ) . +$$ + +139 Similar to (Cohen and Welling, 2014), we find a suitable change of basis that exposes the invariant +140 subspace $Z _ { k }$ corresponding to the $k$ -th subgroup $G _ { k }$ . The new basis is obtained from the eigenvectors +141 resulting from applying Principal Component Analysis (PCA) to $\mathcal { Z } _ { k }$ . Each element in $\mathcal { Z } _ { k }$ is projected +142 into the first $D _ { k }$ eigenvectors. The new set is denoted as $\mathcal { Z } _ { k } ^ { \prime } \subseteq \mathbb { R } ^ { D _ { k } }$ with elements $z _ { k } ^ { \prime } ( g _ { 1 } , \dotsc , g _ { K } ) \subseteq$ +143 $\mathbb { R } ^ { D _ { k } }$ that are the projected versions of $z _ { k } ( g _ { 1 } , \dots , g _ { K } )$ . +144 (Quessard et al., 2020) describes how one could parameterize the subgroup representations of $S O ( D _ { k } )$ +145 for arbitrary $D _ { k }$ but here we will focus on $\bar { G _ { k } } = S O ( 2 )$ . In this case, we can parameterize each +146 subgroup representation in terms of a single integer parameter $\omega \in \mathbb { Z }$ as $\rho _ { k , \omega } ( g _ { k } )$ corresponding +147 to a $2 \times 2$ rotation matrix whose angle of rotation is $\omega$ multiplied by the known angle associated +148 to the group element $g _ { k } \in G _ { k } = \bar { \mathrm { S O } ( 2 ) }$ . For this subgroup we can approximate the $M _ { \rho , h , x _ { 0 } }$ from +149 Equation (7) as $M _ { k , \omega }$ given by + +$$ +M _ { k , \omega } = \frac { 1 } { | \mathcal { G } | } \sum _ { ( g _ { 1 } , . . . , g _ { K } ) \in \mathcal { G } } \rho _ { k , \omega } ( g _ { k } ^ { - 1 } ) \cdot z ^ { \prime } ( g _ { 1 } , . . . , g _ { K } ) . +$$ + +150 Similar to Equation (7) we would like to find the optimal $\rho _ { k , \omega }$ that minimizes the integral over the +151 group representations. We can define a parameter search space $\Omega \subseteq \mathbb { Z }$ , e.g. $\Omega = [ - 1 0 , 1 0 ]$ for finding +152 the optimal $\omega \in \Omega$ that minimizes the dispersion, this is expressed in the following equation + +$$ +\mathcal { D } _ { \mathrm { L S B D } } ^ { ( k ) } = \operatorname* { m i n } _ { \omega \in \Omega } \frac { 1 } { | \mathcal { G } | } \sum _ { ( g _ { 1 } , . . . , g _ { K } ) \in \mathcal { G } } \Vert \rho _ { k , \omega } ( g _ { k } ^ { - 1 } ) \cdot z ^ { \prime } ( g _ { 1 } , . . . , g _ { K } ) - M _ { k , \omega } \Vert ^ { 2 } . +$$ + +![](images/9bc32e6cbe7e7f6d136371693d530b9f07c07b31d987bc47851fa12213f21503.jpg) +Figure 2: Consider a dataset modeled by a group decomposition $G = G _ { 1 } \times \cdot \cdot \cdot \times G _ { K }$ acting on $x _ { 0 }$ and is embedded in a latent space $Z$ via $h$ . In this example the subgroup $G _ { k } = \mathrm { S O } ( 2 )$ models the rotations of an airplane. Other subgroups $G _ { \neq k }$ could also be acting e.g. changes in airplane color. The first step to calculate the disentanglement of $G _ { k }$ is to construct a set of data embeddings $\mathcal { Z } _ { k } \subseteq Z$ whose variability is due to $G _ { k }$ . These embeddings are then projected into a 2-dimensional space through PCA. For these projected embeddings we can describe the group representations in a simple parametric form $\rho _ { k , w }$ . For a given $\rho _ { k , w }$ the equivariance of $G _ { k }$ is measured as the dispersion after applying the action of the inverse group representation $\rho _ { k , w } ^ { - 1 }$ . + +153 Each D(k)LSB measures the degree of equivariance of the projected embeddings for each $k$ -th subgroup +154 corresponding to the best fitting group representation. The upper bound to the metric is finally obtained +155 by averaging across all subgroups $\begin{array} { r } { \bar { \mathcal { D } } _ { \mathrm { L S B D } } \leq \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \bar { \mathcal { D } } _ { \mathrm { L S B D } } ^ { ( \bar { k } ) } } \end{array}$ . + +# 156 5 Learning LSBD Representations: LSBD-VAE + +157 In this section we present LSBD-VAE, a semi-supervised VAE-based method to learn LSBD repre +158 sentations. The main idea is to train an unsupervised Variational Autoencoder (VAE) (Kingma and +159 Welling, 2014; Rezende et al., 2014) with a suitable latent space topology, and use our metric as an +160 additional loss term for batches of transformation-labeled data. +161 Assumptions LSBD-VAE requires some knowledge about the group structure $G$ that is to be +162 disentangled. Concretely, the group and its decomposition $G = G _ { 1 } \times \ldots \times G _ { K }$ should be known, +163 as well as a suitable linearly disentangled group representation $\rho : G \to { \mathrm { G L } } ( Z )$ and a latent space +164 $Z = Z _ { 1 } \oplus . . . \oplus Z _ { K }$ . Moreover, we assume there exists an embedded submanifold $Z _ { G } \subseteq Z$ such +165 that the action of $G$ on $Z$ restricted to $Z _ { G }$ is regular, and $Z _ { G }$ is invariant under the action. Only $Z _ { G }$ +166 will then be used as the codomain for the encoding map, $h : X \to Z _ { G }$ . +167 We demonstrate the assumptions above for the common group structure $G = \mathrm { S O } ( 2 ) \times \mathrm { S O } ( 2 )$ . For +168 the group representation $\rho = \rho _ { 1 } \oplus \rho _ { 2 }$ , with $Z = \mathbb { R } ^ { 2 } \oplus \mathbb { R } ^ { 2 }$ , we can use rotation matrices in ${ \dot { \mathbb { R } } } ^ { 2 }$ for +169 $\rho _ { 1 }$ and $\rho _ { 2 }$ . We can then use 1-spheres $S ^ { 1 } = \{ z \in \mathbb { R } ^ { 2 } : \| z \| = 1 \}$ for the embedded submanifold: +170 $\dot { Z } _ { G } = \dot { S } ^ { 1 } \times S ^ { 1 }$ . In this case, the action of $G$ on $Z$ restricted to $Z _ { G }$ is indeed regular, and $Z _ { G }$ is +171 invariant under the action. +172 Unsupervised Learning on Latent Manifold To learn encodings only on the latent manifold +173 $Z _ { G }$ , we use a Diffusion Variational Autoencoder (∆VAE) (Perez Rey et al., 2020). $\Delta$ VAEs can +174 use any closed Riemannian manifold embedded in a Euclidean space as a latent space (or latent +175 manifold), provided that a certain projection function from the Euclidean embedding space into the +176 latent manifold is known and the scalar curvature of the manifold is available. The $\Delta$ VAE uses +177 a parametric family of posterior approximates obtained from a diffusion process over the latent +178 manifold. To estimate the intractable terms of the negative ELBO, the reparameterization trick is +179 implemented via a random walk. + +In the case of 180 $S ^ { 1 }$ as a latent (sub)manifold, we consider $\mathbb { R } ^ { 2 }$ as the Euclidean embedding space, and 181 the projection function4 $\Pi : \mathbb { R } ^ { 2 } S ^ { 1 }$ normalizes points in the embedding space: $\Pi ( z ) \overset { \cdot } { = } \dot { z } / | z |$ . The scalar curvature of182 $S ^ { 1 }$ is 0. + +183 Semi-Supervised Learning with Transformation Labels Caselles-Dupré et al. (2019) proved +184 that LSBD representations cannot be inferred from a training set of unlabeled observations, but that +185 access to the transformations between data points is needed. They therefore use a training set of +186 observation pairs with a given transformation between them. +7 However, we posit that only a limited amount of supervision is sufficient. Since obtaining supervision +88 on transformations is typically more expensive than obtaining unsupervised observations, it is +9 desirable to limit the amount of supervision needed. +90 Therefore, we augment the un +91 supervised $\Delta \mathrm { V A E }$ with a super +92 vised method that makes use of +93 transformation-labeled batches, i.e. +94 batches $\lbrace x _ { m } \rbrace _ { m = 1 } ^ { M }$ such that $\begin{array} { r l } { x _ { m } } & { { } = } \end{array}$ +95 $g _ { m } \cdot x _ { 1 }$ for $m = 2 , \ldots , M$ , where +96 the transformations $g _ { m }$ (and thus +97 their group representations $\rho ( g _ { m } ) ,$ ) are +98 known and are referred to as transfor +99 mation labels. The simplified version +00 of the metric from Equation (4) can +01 then be used for each batch as an ad +02 ditional loss term (with $x _ { 0 } = x _ { 1 }$ ), as +03 it is differentiable under the assump +04 tions described above (using the Eu +05 clidean norm). +206 We make a small adjustment to Equation (4) for the purpose of our method, since the mean computed +207 there does not typically lie on the latent manifold $Z _ { G }$ . Thus, we use the projection $\Pi$ from the $\Delta \mathrm { V A E }$ +208 to project the mean onto $Z _ { G }$ . Writing the encodings as $z _ { m } : = h ( x _ { m } )$ , the additional loss term for a +209 transformation-labeled batch $\{ x _ { m } \} _ { m = 1 } ^ { M }$ then becomes + +![](images/14b0ae6804074b71a10e2c75bb8cc480774c032b2b00c044a280d3a005805d38.jpg) +Figure 3: Overview of the supervised part of LSBD-VAE. + +$$ +\mathcal { L } _ { L S B D } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \left. \rho ( g _ { m } ^ { - 1 } ) \cdot z _ { m } - \Pi \left( \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \rho ( g _ { m } ^ { - 1 } ) \cdot z _ { m } \right) \right. ^ { 2 } , +$$ + +210 where $g _ { 1 } = e$ , the group identity. + +Moreover, instead of feeding the encodings $z _ { m }$ to the decoder, we use $\rho ( g _ { m } ) \cdot \overline { { z } }$ , where ${ \begin{array} { r l } { { \overline { { z } } } } & { = } \end{array} }$ $\begin{array} { r } { \Pi \left( \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \rho ( g _ { m } ^ { - 1 } ) \cdot z _ { m } \right) } \end{array}$ . This encourages the decoder to follow the required group structure. This only affects the reconstruction loss component of the $\Delta \mathrm { V A E }$ . + +214 Figure 3 illustrates the supervised part of our method for a transformation-labeled batch $\{ x _ { m } \} _ { m = 1 } ^ { M }$ +215 The loss function is the regular ELBO (but with adjusted decoder input as described above) as used +216 in $\Delta \mathrm { V A E }$ plus an additional term $\gamma \cdot \mathcal { L } _ { L S B D }$ , where $\gamma$ is a weight hyperparameter to control the +217 influence of the supervised loss component. By alternating unsupervised and supervised training +218 (using the same encoder and decoder), we have a method that makes use of both unlabeled and +219 transformation-labeled observations. + +# 220 6 Experimental Setup + +221 We evaluate the disentanglement of several models on three different image datasets (Square, Arrow, +222 and Airplane) with a known group decomposition $G = \mathrm { S O } ( 2 ) \times \mathrm { S O } ( 2 )$ describing the underlying +223 transformations. For each subgroup a fixed number of $| \mathcal { G } _ { k } | = 6 4$ with $k \in \{ 1 , 2 \}$ transformations is +224 selected. The datasets exemplify different group actions of SO(2): periodic translations, in-plane +225 rotations, out-of-plane rotations, and periodic hue-shifts. + +In real settings, not all variability in the data can be modelled by the actions of a group. Therefore, we also evaluate the same models on two datasets ModelNet40 (Wu et al., 2014) and COIL-100 (Nene et al., 1996) that consist of images from various objects (i.e. non-symmetric variation) under known out-of-plane rotations (SO(2) symmetries). In many settings it is easy to obtain labels for such rotations, e.g. when the camera or object angle is controlled by an agent. See Figure 4 for examples of the datasets. For more details, see the Supplementary Material. + +![](images/d352a0a16ca7390be9798d1dba330cfe8159e226e0308ecc0b255b93ae06802b.jpg) +Figure 4: Example images from each of the datasets used. Each row shows different examples from a single factor changing. + +232 For the Square, Arrow, and Airplane datasets we test LSBD-VAE with transformation-labeled batches +233 of size $M = 2$ . More specifically, for each experiment we randomly select $L$ disjoint pairs of data +234 points, and label the transformation between the data points in each pair. We vary the number of +235 labeled pairs $L$ from 0 (corresponding to a $\Delta { \mathrm { V A E } } )$ to $N / 2$ (in which case each data point is involved +236 in exactly one labeled pair). We set the weight $\gamma$ of the supervised loss component to $\gamma = 1 0 0$ +237 for all experiments. We choose $M = 2$ for our experiments since it is the most limited setting for +238 LSBD-VAE. Higher values of $M$ would provide stronger supervision, so successful results with +239 $M = 2$ imply that good results can also be achieved for higher values of $M$ (but not necessarily vice +240 versa). +241 For the COIL-100 and ModelNet40 datasets, we train LSBD-VAE on batches containing images of +242 one particular object from all different angles (72 and 64 for COIL-100 and ModelNet40, respectively). +243 Each batch is labelled with transformations $( g _ { 1 } , e ) , \ldots , ( g _ { M } , e )$ , where $g _ { m }$ represent rotations, and +244 the unit transformation $e$ indicates that the object is unchanged. To represent the rotations we use +245 a $S ^ { 1 }$ latent space as in $\Delta \mathrm { V A E }$ , whereas for the object identity we use a 5-dimensional Euclidean +246 space with standard Gaussian prior as in regular VAEs. LSBD is measured as the disentanglement of +247 rotations in the latent space. For these experiments we used $\gamma = 1$ . +248 We furthermore test a number of known disentanglement methods for comparison, including tra +249 ditional disentanglement methods as well as methods focusing on LSBD. In particular, we use +250 disentanglement_lib (Locatello et al., 2019) to train a regular VAE (Kingma and Welling, 2014; +251 Rezende et al., 2014), $\beta$ -VAE (Higgins et al., 2017), CC-VAE (Burgess et al., 2018), FactorVAE +252 (Kim and Mnih, 2018), and DIP-VAE-I/II (Kumar et al., 2018). Furthermore we evaluate the method +253 from Quessard et al. (2020) that focuses on LSBD. We also tested ForwardVAE (Caselles-Dupré +254 et al., 2019), but show only limited results since we were not able to reproduce any reasonable results +255 for our datasets. +256 We use encodings from all these methods to evaluate $\mathcal { D } _ { \mathrm { L S B D } }$ , as well as common traditional disentan +257 glement metrics from disentanglement_lib: Beta (Higgins et al., 2017), Factor (Kim and Mnih, +258 2018), SAP (Kumar et al., 2018), DCI Disentanglement (Eastwood and Williams, 2018), Mutual +259 Information Gap (MIG) (Chen et al., 2018), and Modularity (MOD) (Ridgeway and Mozer, 2018). +260 More information about the architecture, epochs and hyperparameters can be found in the Supplemen +261 tary Material. For the traditional disentanglement methods trained on Square, Arrow and Airplane +262 datasets the latent spaces have 4 dimensions, since these are the minimum number of dimensions +263 necessary to learn LSBD representations for an underlying $\mathrm { S O } ( 2 ) \times \mathrm { S O } ( 2 )$ symmetry group, see +264 (Higgins et al., 2018; Caselles-Dupré et al., 2019). For COIL-100 and ModelNet40 we use latent +265 spaces with 7 dimensions for a fair comparison with the LSBD-VAE method. + +# 266 7 Results: Evaluating LSBD with DLSBD + +267 We now highlight four key observations from our experimental results. In particular, we differentiate +268 between the methods (VAE, $\beta$ -VAE, CC-VAE, FACTOR, DIP-I, DIP-II) and metrics (BETA, +269 FACTOR, SAP, DCI, MIG, MOD) that approach disentanglement in the traditional sense, and +270 methods ( $\Delta$ VAE, QUESSARD, LSBD-VAE) and metric $\left( \mathcal { D } _ { \mathrm { L S B D } } \right)$ that focus specifically on LSBD. +271 The full quantitative results can be found in the Supplementary Material. + +Figure 5 summarizes the $\mathcal { D } _ { \mathrm { L S B D } }$ scores (lower is better) for all methods on all datasets. Bars show the mean scores over 10 runs for each method, the vertical lines represent standard deviations. LSBD-VAE/ $L$ indicates our method trained on $L$ labelled pairs (LSBD-VAE/0 corresponds to the unsupervised $\Delta$ VAE), LSBD-VAE/full indicates our method trained on batches containing a single object in all known transformations (for datasets with non-symmetric variation). Note that LSBDVAE obtained very good scores (nearly 0) on the Arrow and Pixel datasets, hence the missing bars. + +![](images/3652443315b176261f18f6cfab4007213976ddda2752c30b94584f7a268c25c9.jpg) +Figure 5: $\mathcal { D } _ { \mathrm { L S B D } }$ scores for all methods on all datasets + +280 None of the traditional disentanglement methods achieve good $\mathcal { D } _ { \mathrm { L S B D } }$ scores, even if they score well +281 on other traditional disentanglement metrics. This implies that LSBD isn’t achieved by traditional +282 methods. Moreover, from the full results in the Supplementary Material we see that the traditional +283 methods on these datasets do not achieve good scores on all traditional metrics. In particular, SAP, +284 DCI, and MIG scores are low. We believe this is a result of the cyclic nature of the symmetries +285 underlying our datasets, further emphasizing the need for disentanglement methods that can capture +286 such symmetries. + +The SAP and MIG scores measure to what extent generative factors are disentangled into a single latent dimension. However, since the factors in our dataset are inherently cyclic due to their symmetry structure, they cannot be properly represented in a single latent dimension, as shown by Perez Rey et al. (2020). Instead, at least two dimensions are needed to continuously represent each cyclic factor in our data. A similar conclusion was made by Caselles-Dupré et al. (2019) and Painter et al. (2020). + +DCI disentanglement measures whether a latent dimension captures at most one generative factor. This is accomplished by measuring the importance of each latent dimension in predicting the true generative factor using boosted trees. However, since the generative factors are cyclic, the performance of the boosted tree classifiers is far from optimal, thus providing more importance to several dimensions in predicting the generative factors and giving overall lower DCI scores. + +# 7.2 LSBD-VAE and other LSBD Methods Can Learn LSBD Representations with Limited Supervision on Transformations + +From Figure 5 we observe that methods focusing specifically on LSBD can score higher on $\mathcal { D } _ { \mathrm { L S B D } }$ , showing that they are indeed more suitable to learn LSBD representations. In particular, LSBD-VAE got very good $\mathcal { D } _ { \mathrm { L S B D } }$ scores for all datasets. Moreover, our experiments on the Arrow, Airplane, and Pixel datasets also show that only limited supervision suffices to obtain good $\mathcal { D } _ { \mathrm { L S B D } }$ scores with low variability. + +We only partially managed to reproduce the results from Quessard et al. (2020) on our datasets. Their method scored fairly well on the Airplane, ModelNet40, and COIL-100 datasets, but did not do well on the Square and Arrow dataset in our experiments. + +307 Furthermore, we tested ForwardVAE by Caselles-Dupré et al. (2019), but we did not manage +308 to produce any reasonable results on our datasets, trying both their original architecture and the +309 architecture we used for our other experiments. Therefore, we do not include scores for this method. +310 We did however manage to reproduce ForwardVAE’s results on the Flatland dataset, which was used +311 in their paper. For those experiments, we computed a mean $\mathcal { D } _ { \mathrm { L S B D } }$ score of 0.012 with standard +312 deviation 0.001 over 10 runs, indicating that ForwardVAE indeed learns LSBD representations for +313 Flatland. + +# 314 7.3 LSBD Representations Also Satisfy Previous Disentanglement Notions + +315 Our results also indicate that LSBD captures various desirable properties that are expressed by +316 traditional disentanglement metrics. In Figure 6 we compare $\mathcal { D } _ { \mathrm { L S B D } }$ scores with scores for previous +317 disentanglement metrics, for all our experiments. Note that for $\mathcal { D } _ { \mathrm { L S B D } }$ lower is better, whereas for +318 all other metrics higher is better. As we noted before, good scores on traditional disentanglement +319 metrics don’t necessarily imply good $\mathcal { D } _ { \mathrm { L S B D } }$ scores. Conversely however, methods that score well +320 on $\mathcal { D } _ { \mathrm { L S B D } }$ also score well on many traditional disentanglement metrics, often even outperforming +321 the traditional methods. In particular, from the full results (see Supplementary Material) we see +322 that LSBD-VAE matches or outperforms the traditional methods on the BETA, FACTOR and MOD +323 metrics, and achieves much better scores for the DCI metric where traditional methods scored poorly. +24 The MIG and SAP scores are still low for methods focusing on LSBD. This is expected however, as +25 explained earlier in Section 7.1. This was also observed by Painter et al. (2020) for different datasets. + +![](images/d5df3bb8eba3e5aecba8e8dda744d3ce8c49a6d3fbb4299d6bb7f05368fdda94.jpg) +Figure 6: Comparing $\mathcal { D } _ { \mathrm { L S B D } }$ to previous disentanglement metrics + +# 326 8 Conclusion + +27 We presented $\mathcal { D } _ { \mathrm { L S B D } }$ , a metric to quantify Linear Symmetry-Based Disentanglement (LSBD) as 8 defined by Higgins et al. (2018). We further used this metric formulation to motivate LSBD-VAE, a semi-supervised method to learn LSBD representations given some expert knowledge on the underlying group symmetries that are to be disentangled. + +We used $\mathcal { D } _ { \mathrm { L S B D } }$ to evaluate various disentanglement methods, both traditional methods and recent methods that specifically focus on LSBD, and showed that LSBD-VAE can learn LSBD representations where traditional methods fail to do so. We also compared $\mathcal { D } _ { \mathrm { L S B D } }$ to traditional disentanglement metrics, showing that LSBD captures many of the same desirable properties that are expressed by existing disentanglement methods. Conversely, we also showed that traditional disentanglement methods and metrics do not usually achieve or measure LSBD. + +337 Challenges that remain are expanding and testing LSBD-VAE and $\mathcal { D } _ { \mathrm { L S B D } }$ on different group struc +338 tures, towards more practical applications, as well as focusing on the utility of LSBD representations +339 for downstream tasks. +340 Broader Impact The work is fairly theoretical, and practical methods derived from this work have +341 no obvious negative societal impact. However, the ideas presented are relevant to representation +342 learning and could be, in particular, used in computer vision and agent control applications. + +343 References +344 Burgess, C. P., Higgins, I., Pal, A., Matthey, L., Watters, N., Desjardins, G., and Lerchner, A. (2018). Understanding disentangling in $\beta$ -VAE. arXiv preprint arXiv:1804.03599. Caselles-Dupré, H., Ortiz, M. G., and Filliat, D. (2019). Symmetry-based disentangled representation learning requires interaction with environments. In Advances in Neural Information Processing Systems, pages 4606–4615. Chen, T. Q., Li, X., Grosse, R. B., and Duvenaud, D. K. (2018). Isolating sources of disentanglement in variational autoencoders. In Advances in Neural Information Processing Systems, pages 2615– 2625. Cohen, T. and Welling, M. (2014). Learning the irreducible representations of commutative Lie groups. 31st International Conference on Machine Learning, pages 3757–3770. +354 Cohen, T. S. and Welling, M. (2015). Transformation properties of learned visual representations. In 3rd International Conference on Learning Representations. Eastwood, C. and Williams, C. K. (2018). A framework for the quantitative evaluation of disentangled representations. In International Conference on Learning Representations. +58 Higgins, I., Amos, D., Pfau, D., Racaniere, S., Matthey, L., Rezende, D., and Lerchner, A. (2018). Towards a definition of disentangled representations. arXiv preprint arXiv:1812.02230. +60 Higgins, I., Matthey, L., Pal, A., Burgess, C., Glorot, X., Botvinick, M., Mohamed, S., and Lerchner, A. (2017). $\beta$ -VAE: Learning basic visual concepts with a constrained variational framework. In International Conference on Learning Representations. +363 Kim, H. and Mnih, A. (2018). Disentangling by factorising. In International Conference on Machine Learning, pages 2649–2658. +65 Kingma, D. P. and Welling, M. (2014). Auto-Encoding Variational Bayes. In International Conference on Learning Representations. Kumar, A., Sattigeri, P., and Balakrishnan, A. (2018). Variational inference of disentangled latent concepts from unlabeled observations. In International Conference on Learning Representations. +369 Locatello, F., Bauer, S., Lucic, M., Gelly, S., Schölkopf, B., and Bachem, O. (2019). Challenging common assumptions in the unsupervised learning of disentangled representations. In International Conference on Machine Learning. +372 Nene, S. A., Nayar, S. K., Murase, H., et al. (1996). Columbia object image library (coil-20). +Painter, M., Prugel-Bennett, A., and Hare, J. (2020). Linear disentangled representations and unsupervised action estimation. Advances in Neural Information Processing Systems, 33. +375 Perez Rey, L. A., Menkovski, V., and Portegies, J. (2020). Diffusion variational autoencoders. In Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI-20, pages 2704–2710. +Quessard, R., Barrett, T. D., and Clements, W. R. (2020). Learning Group Structure and Disentangled Representations of Dynamical Environments. Advances in Neural Information Processing Systems, 33. Rezende, D. J., Mohamed, S., and Wierstra, D. (2014). Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of the 31st International Conference on International Conference on Machine Learning-Volume 32. Ridgeway, K. and Mozer, M. C. (2018). Learning deep disentangled embeddings with the f-statistic loss. In Advances in Neural Information Processing Systems, pages 185–194. +86 Sosnovik, I., Szmaja, M., and Smeulders, A. (2019). Scale-Equivariant Steerable Networks. International Conference on Learning Representations, pages 1–14. +Worrall, D. E., Garbin, S. J., Turmukhambetov, D., and Brostow, G. J. (2017). Harmonic networks: Deep translation and rotation equivariance. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5028–5037. +Wu, Z., Song, S., Khosla, A., Yu, F., Zhang, L., Tang, X., and Xiao, J. (2014). 3D ShapeNets: A Deep Representation for Volumetric Shapes. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 8 +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] +(b) Did you include complete proofs of all theoretical results? [N/A] The theoretical contributions are new definitions and methodology, these have been motivated but do not require proofs. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] In Supplementary Material +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] In paper or Supplementary Material +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Each experiment was run 10 times, we report means and standard deviation, and show error bars where needed. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] In Supplementary Material we described the hardware. Tracked time of training for experiments with LSBD-VAE and Quessard approach, also reported in the Supplementary Material. The times for training the traditional methods in disentanglement_lib were not measured. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [Yes] In Supplementary Material +(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Included code in the Supplementary Material +(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] No consent was needed. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] It clearly doesn’t. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/md/train/ZTFeSBIX9C/ZTFeSBIX9C.md b/md/train/ZTFeSBIX9C/ZTFeSBIX9C.md new file mode 100644 index 0000000000000000000000000000000000000000..8457789018d096454165cf97fdc5ba61eafb47cf --- /dev/null +++ b/md/train/ZTFeSBIX9C/ZTFeSBIX9C.md @@ -0,0 +1,352 @@ +# UNDERSTANDING AND IMPROVING LEXICAL CHOICE IN NON-AUTOREGRESSIVE TRANSLATION + +Liang Ding1∗, Longyue Wang2, Xuebo Liu3, Derek F. Wong3, Dacheng Tao1 & Zhaopeng $\mathbf { T } \mathbf { u } ^ { 2 }$ + +1The University of Sydney 2Tencent AI Lab 3University of Macau {ldin3097,dacheng.tao}@sydney.edu.au, nlp2ct.xuebo@gmail.com, {vinnylywang,zptu}@tencent.com, derekfw@um.edu.com + +# ABSTRACT + +Knowledge distillation (KD) is essential for training non-autoregressive translation (NAT) models by reducing the complexity of the raw data with an autoregressive teacher model. In this study, we empirically show that as a side effect of this training, the lexical choice errors on low-frequency words are propagated to the NAT model from the teacher model. To alleviate this problem, we propose to expose the raw data to NAT models to restore the useful information of low-frequency words, which are missed in the distilled data. To this end, we introduce an extra Kullback-Leibler divergence term derived by comparing the lexical choice of NAT model and that embedded in the raw data. Experimental results across language pairs and model architectures demonstrate the effectiveness and universality of the proposed approach. Extensive analyses confirm our claim that our approach improves performance by reducing the lexical choice errors on low-frequency words. Encouragingly, our approach pushes the SOTA NAT performance on the WMT14 English-German and WMT16 Romanian-English datasets up to 27.8 and 33.8 BLEU points, respectively. + +# 1 INTRODUCTION + +When translating a word, translation models need to spend a substantial amount of its capacity in disambiguating its sense in the source language and choose a lexeme in the target language which adequately express its meaning (Choi et al., 2017; Tamchyna, 2017). However, neural machine translation (NMT) has a severe problem on lexical choice, since it usually has mistranslation errors on low-frequency words (Koehn & Knowles, 2017; Nguyen & Chiang, 2018; Gu et al., 2020). + +In recent years, there has been a growing interest in non-autoregressive translation (NAT, Gu et al., 2018), which improves decoding efficiency by predicting all tokens independently and simultaneously. Well-performed NAT models are generally trained on synthetic data distilled by autoregressive translation (AT) teachers instead of the raw training data (Figure 1(a)) (Stern et al., 2019; Lee et al., 2018; Ghazvininejad et al., 2019; Gu et al., 2019; Hao et al., 2021). Recent studies have revealed that knowledge distillation (KD) reduces the modes (i.e. multiple lexical choices for a source word) in the raw data by re-weighting the training examples (Furlanello et al., 2018; Tang et al., + +
SRC RAW-TGT KD-TGT今天纽马基特的跑道湿软。 The going at Newmarket is soft... Today, Newmargot's runway is soft ...
SRC RAW-TGT KD-TGT纽马 基特赛马总是吸引. The Newmarket stakes is always ... The Newmarquette races always ...
SRC在纽马基特3时45分那场中,我..
RAW-TGT KD-TGTI've ...inthe3.45atNewmarket. I.. at 3:45 a.m. in Newmarquite.
+ +Table 1: All samples that contain the source word “纽 基 ” in raw and distilled training corpora, which 马 特are different in target sides (RAW-TGT vs. KD-TGT). + +2020), which lowers the intrinsic uncertainty (Ott et al., 2018) and learning difficulty for NAT (Zhou et al., 2020; Ren et al., 2020). However, the side effect of KD has not been fully studied. In this work, we investigate this problem from the perspective of lexical choice, which is at the core of machine translation. + +We argue that the lexical choice errors of AT teacher can be propagated to the NAT model via the distilled training data. To verify this hypothesis, we qualitatively compare raw and distilled training corpora. Table 1 lists all samples whose source sentences contain the place name “纽 基 ”. In the 马 特raw corpus (“RAW-TGT”), this low-frequency word totally occurs three times and corresponds to correct translation “Newmarket”. However, in the KD corpus (“KD-TGT”), the word is incorrectly translated into a person name “Newmargot” (Margot Robbie is an Australian actress) or organization name “Newmarquette” (Marquette is an university in Wisconsin) or even invalid one “Newmarquite”. + +Motivated by this finding, we explore NAT from the lexical choice perspective. We first validate our hypothesis by analyzing the lexical choice behaviors of NAT models (§3). Concretely, we propose a new metric AoLC (accuracy of lexical choice) to evaluate the lexical translation accuracy of a given NAT model. Experimental results across different language pairs show that NAT models trained on distilled data have higher accuracy of global lexical translation (AoLC↑), which results in better sequence generation. However, fine-grained analyses revealed that although KD improves the accuracy on high-frequency tokens, it meanwhile harms performance on low-frequency ones (Low freq. AoLC↓). And with the improvement of teacher models, this issue becomes more severe. We conclude that the lexical choice of the low-frequency tokens is a typical kind of lost information when using knowledge distillation from AT model. + +In order to rejuvenate this lost information in raw data, we propose to expose the raw data to the training of NAT models, which augments NAT models the ability to learn the lost knowledge by themselves. Specifically, we propose two bi-lingual lexical-level data-dependent priors (Word Alignment Distribution and Self-Distilled Distribution) extracted from raw data, which is integrated into NAT training via Kullback-Leibler divergence. Both approaches expose the lexical knowledge in the raw data to NAT, which makes it learn to restore the useful information of low-frequency words to accomplish the translation. + +We validated our approach on several datasets that widely used in previous studies (i.e. WMT14 En-De, WMT16 Ro-En, WMT17 Zh-En, and WAT17 Ja-En) and model architectures (i.e. MaskPredict (Ghazvininejad et al., 2019) and Levenshtein Transformer (Gu et al., 2019)). Experimental results show that the proposed method consistently improve translation performance over the standard NAT models across languages and advanced NAT architectures. The improvements come from the better lexical translation accuracy (low-frequency tokens in particular) of NAT models $\mathrm { ( A o L C \uparrow ) }$ ), which leads to less mis-translations and low-frequency words prediction errors. The main contributions of this work are: + +• Our study reveals the side effect of NAT models’ knowledge distillation on low-frequency lexicons, which makes the standard NAT training on the distilled data sub-optimal. +• We demonstrate the necessity of letting NAT models learn to distill lexical choices from the raw data by themselves. +• We propose an simple yet effective approach to accomplish this goal1, which are robustly applicable to several model architectures and language pairs. + +# 2 PRELIMINARIES + +# 2.1 NON-AUTOREGRESSIVE TRANSLATION + +The idea of NAT has been pioneered by Gu et al. (2018), which enables the inference process goes in parallel. Different from AT models that generate each target word conditioned on previously generated ones, NAT models break the autoregressive factorization and produce target words in parallel. Given a source sentence $\mathbf { x }$ , the probability of generating its target sentence y with length $T$ is calculated as: + +$$ +p ( \mathbf { y } | \mathbf { x } ) = p _ { L } ( T | \mathbf { x } ; \theta ) \prod _ { t = 1 } ^ { T } p ( \mathbf { y } _ { t } | \mathbf { x } ; \theta ) +$$ + +where $p _ { L } ( \cdot )$ is a separate conditional distribution to predict the length of target sequence. During training, the negative loglikelihood loss function of NAT is accordingly $\mathcal { L } _ { \mathrm { N A T } } ( \boldsymbol { \theta } ) = - \log p ( \mathbf { y } | \mathbf { x } )$ . To bridge the performance gap between NAT and AT models, a variety approaches have been proposed, such as multi-turn refinement mechanism (Lee et al., 2018; Ghazvininejad et al., 2019; Gu et al., 2019; Kasai et al., 2020), rescoring with AT models (Wei et al., 2019; Ma et al., 2019; Sun et al., 2019), adding auxiliary signals to improve model capacity (Wang et al., 2019; Ran et al., 2019; Guo et al., 2019; Ding et al., 2020), and advanced training objective (Wei et al., 2019; Shao et al., 2019; Ma et al., 2020). Our work is complementary to theirs: while they focus on improving NAT models trained on the distilled data, we refine the NAT models by exploiting the knowledge in the raw data. + +Sentence-Level Knowledge Distillation NAT models suffer from the multimodality problem, in which the conditional independence assumption prevents a model from properly capturing the highly multimodal distribution of target translations. For example, one English source sentence “Thank you.” can be accurately translated into German as any one of “Danke.”, “Danke schon.” or “Vielen Dank.”, all of which occur in the training data. ¨ + +To alleviate this problem, Gu et al. (2018) applied sequence-level KD (Kim & Rush, 2016) to construct a synthetic corpus, whose target sentences are generated by an AT model trained on the raw data, as shown in Figure 1(a). The NAT model is only trained on distilled data with lower modes, which makes it easily acquire more deterministic knowledge (e.g. one lexical choice for each source word). While separating KD and model training makes the pipeline simple and efficient, it has one potential threat: the re-weighted samples distilled with AT model may have lost some important information. Lee et al. (2020) show that distillation benefits the sequence generation but harms the density estimation. In this study, we exploit to bridge this gap by exposing the raw data to the training of NAT models, as shown in Figure 1(b). + +![](images/1b349c9d2c2f130186b4ff949bb980945ac1b95809cc11301fbd5fef10a0c345.jpg) +Figure 1: Comparison of existing two-step and our proposed NAT training scheme. + +# 2.2 EXPERIMENTAL SETUP + +Datasets Experiments were conducted on four widely-used translation datasets: WMT14 EnglishGerman (En-De, Vaswani et al. 2017), WMT16 Romanian-English (Ro-En, Gu et al. 2018), WMT17 Chinese-English (Zh-En, Hassan et al. 2018), and WAT17 Japanese-English (Ja-En, Morishita et al. 2017), which consist of 4.5M, 0.6M, 20M, and 2M sentence pairs, respectively. We use the same validation and test datasets with previous works for fair comparison. To avoid unknown words, we preprocessed data via BPE (Sennrich et al., 2016) with 32K merge operations. The $\mathrm { { G I Z A + + } }$ (Och & Ney, 2003) was employed to build word alignments for the training datasets. We evaluated the translation quality with BLEU (Papineni et al., 2002). + +NAT Models We validated our research hypotheses on two SOTA NAT models: + +• MaskPredict (MaskT, Ghazvininejad et al. 2019) that uses the conditional mask LM (Devlin et al., 2019) to iteratively generate the target sequence from the masked input. We followed its optimal settings to keep the iteration number be 10 and length beam be 5, respectively. • Levenshtein Transformer (LevT, Gu et al. 2019) that introduces three steps: deletion, placeholder prediction and token prediction. The decoding iterations in LevT adaptively depends on certain conditions. + +For regularization, we tune the dropout rate from [0.1, 0.2, 0.3] based on validation performance in each direction, and apply weight decay with 0.01 and label smoothing with $\epsilon = 0 . 1$ . We train batches of approximately 128K tokens using Adam (Kingma & Ba, 2015). The learning rate warms up to $5 \times \mathrm { 1 0 ^ { - 4 } }$ in the first 10K steps, and then decays with the inverse square-root schedule. We followed the common practices (Ghazvininejad et al., 2019; Kasai et al., 2020) to evaluate the translation performance on an ensemble of top 5 checkpoints to avoid stochasticity. + +Table 2: Results of different metrics on the MaskT model trained on different datasets. “KD (X)” denotes the distilled data produced by the AT model with X setting. “CoD” denotes the complexity of data metric proposed by Zhou et al. (2020), and “AoLC” is our proposed metric to evaluate the accuracy of lexical choice in NAT models. + +
DatasetEn-DeZh-EnJa-En
CoDAoLCBLEUCoDAoLCBLEUCoDAoLCBLEU
Raw3.5374.324.65.1168.522.63.9273.127.8
KD (BASE)1.8575.526.53.2371.823.62.8074.728.4
KD (BIG)1.7776.327.03.0172.724.22.4775.328.9
+ +AT Teachers We closely followed previous works on NAT to apply sequence-level knowledge distillation (Kim & Rush, 2016) to reduce the modes of the training data. More precisely, to assess the effectiveness of our method under different of AT teachers, we trained three kinds of Transformer (Vaswani et al., 2017) models, including Transformer-BASE, Transformer-BIG and Transformer-STRONG. The main results employ LARGE for all directions except Ro-En, which is distilled by BASE. The architectures of Transformer-BIG and Transformer-STRONG are unchanged, but STRONG utilizes a large batch (458K tokens) training strategy. + +# 3 UNDERSTANDING LEXICAL CHOICE IN NAT MODELS + +# 3.1 EVALUATING LEXICAL CHOICE OF NAT MODELS + +Recently, Zhou et al. (2020) argue that knowledge distillation is necessary for the uncertain nature of the machine translation task. Accordingly, they propose a metric to estimate the complexity of the data $( C o D )$ , which is driven from an external word alignment model. They reveal that the distilled data is indeed less complex, which facilitates easier training for the NAT model. Inspired by this, we propose a metric to measure the lexical level accuracy of model predictions. + +Accuracy of Lexical Choice (AoLC) evaluates the accuracy of target lexicon chosen by a trained NAT model $M$ for each source word. Specifically, the model $M$ takes a source word $f$ as the input, and produce a hypothesis candidate list with their corresponding word confidence: + +$$ +\mathbf { P } _ { f } ^ { M } = \{ P ^ { M } ( e _ { 1 } | f ) , \dots , P ^ { M } ( e _ { | \mathbf { V } _ { t r g } | } | f ) \} +$$ + +where $\mathbf { V } _ { t r g }$ is the target side vocabularies over whole corpus. The AoLC score is calculated by averaging the probability of the gold target word $e _ { f }$ of each source word $f$ : + +$$ +A o L C = \frac { \sum _ { f \in \mathbf { V } _ { s r c } ^ { t e s t } } P ^ { M } ( e _ { f } | f ) } { | \mathbf { V } _ { s r c } ^ { t e s t } | } +$$ + +where $\mathbf { V } _ { s r c } ^ { t e s t }$ is the set of source side tokens in test set. Each gold word $e _ { f }$ is chosen with the help of the word alignment model $P _ { f } ^ { A }$ . The chosen procedure is as follows: Step 1) collecting the references of the source sentences that contains source word $f$ , and generating the target side word bag $\mathbb { B } _ { f }$ with these references. Step 2) Descending $P _ { f } ^ { A }$ in terms of alignment probabilities and looking up the word that first appears in $\mathbb { B } _ { f }$ as the gold word until the $\mathbb { B } _ { f }$ is traversed. Step 3) If the gold word is still not found, let the word with the highest alignment probability in $P _ { f } ^ { A }$ as the gold word. Generally, higher accuracy of lexical translation represents more confident of the predictions. We discuss the reliability of word alignment-based AoLC in Appendix A.1. + +# 3.2 GLOBAL EFFECT OF KNOWLEDGE DISTILLATION ON LEXICAL CHOICE + +In this section, we analyze the lexical choice behaviors of NAT models with our proposed AoLC. In particular, We evaluated three MaskT models, which are respectively trained on the raw data, AT-BASE and AT-BIG distilled data. We compared the AoLC with other two metrics (i.e. BLEU and CoD) on three different datasets (i.e. En-De, Zh-En and Ja-En). As shown in Table 2, KD is able to improve translation quality of NAT models (BLEU: KD(BIG) ${ \mathrm { > K D } }$ (BASE) ${ \mathrm { > R a w } }$ ) by increasing the lexical choice accuracy of data (AoLC: KD(BIG) ${ \tt > K D }$ (BASE) ${ \mathrm { > R a w } }$ ). As expected, NAT models trained on more deterministic data $( \mathrm { C o D } \downarrow )$ have lower lexical choice errors (AoLC↑) globally, resulting in better model generation performance (BLEU↑). + +3.3 DISCREPANCY BETWEEN HIGH- AND LOW-FREQUENCY WORDS ON LEXICAL CHOICE + +To better understand more detailed lexical change within data caused by distillation, we break down the lexicons to three categories in terms of frequency. And we revisit it from two angles: training data and translated data. + +We first visualize the changing of training data when adopting KD in terms of words frequency density. + +As shown in Figure 2, we find that the kurtosis of KD data distribution is higher than that of raw, which becomes more significant when adopting stronger teacher. The side effect is obvious, that is, the original high- / low-frequency words become more / fewer, making the distribution of training data more imbalance and skewed, which is problematic in data mining field (Chawla et al., 2004). This discrepancy may erode the translation performance of low-frequency words and generalization performance on other domains. Here we focus on lowfrequency words, and generalization performance degradation will be exploited in future work. + +![](images/dddd69e87f1d60170cfd9055d32bec4a6f19d5103ff92dddcd1b1cb1bdd80da0.jpg) +Figure 2: Comparison of the token frequency density (w.r.t the sampled tokens’ probability distribution) between Raw, $K D$ (Base) and $K D$ (Big) WMT14 En-De training data.quencycy + +In order to understand the detailed change during inference, we then analyze the lexical accuracy with different frequencies in the test set. We make the comprehensive comparison cross languages based on our proposed AoLC. As shownFrFrequeFrequency in Figure 3, as the teacher model becomes better, i.e. $\mathrm { K D ( b a s e ) { \to } K D ( b i g }$ ), the lexical choice of high-High High MHigh Med. + +frequency words becomes significantly more accurate (AoLC ↑) while that of low-frequency words808080 becomes worse (AoLC ↓). Through fine-grained analysis, we uncover this interesting discrepancy606060 between high- and low- frequency words. The same phenomena (lexical choice errors on lowfrequency words propagated from teacher model) also can be found in general cases, e.g. distillation404040 when training smaller AT models. Details can be found in Appendix A.2. To keep the accuracy of202020 high-frequency words and compensate for the imbalanced low-frequency words caused by KD, we present a simple yet effective approach below. En- En-De En-De Zh + +![](images/a49ead06b91e281953bc62e41853c855b922f9199f5d849e84ef0616fd90c617.jpg) +Figure 3: Accuracy of lexical choice (AoLC) for source words of different frequency. + +# 4 IMPROVING LEXICAL CHOICE IN NAT MODELS + +# 4.1 METHODOLOGY + +Our goal is to augment NAT models to learn needed lexical choices from the raw data to achieve better performance. To this end, we introduce an extra bilingual data-dependent prior objective to augment the current NAT models to distill the required lexical choices from the raw data. Specifically, we use Kullback-Leibler divergence to guide the probability distribution of model predictions $P ^ { \bar { M } } ( e | { \bf f } )$ to match the prior probability distributions $Q ( \cdot )$ : + +$$ +\mathcal { L } _ { p r i o r } = - \sum _ { e \in { \bf e } } \mathrm { K L } \big ( Q ( e | { \bf f } ) \big | \big | P ^ { M } ( e | { \bf f } ) \big ) +$$ + +where f is the source sentence, and $\mathbf { e }$ is the target sentence. The bilingual prior distribution $Q ( \cdot )$ is derived from the raw data, which is independent of the model $M$ and will be described later. The final objective for training the NAT model becomes: + +$$ +\begin{array} { r } { \mathcal { L } = ( 1 - \lambda ) \mathcal { L } _ { N A T } + \lambda \mathcal { L } _ { p r i o r } } \end{array} +$$ + +in which the imitation rate $\lambda$ follows the logarithmic decay function: + +$$ +\lambda ( i ) = \left\{ \begin{array} { l l } { \frac { l o g ( \mathrm { I } / ( 2 ( i + 1 ) ) ) } { l o g ( \mathrm { I } / 2 ) } } & { i \leq \mathrm { I } / 2 } \\ { 0 } & { \mathrm { o t h e r s } } \end{array} \right. +$$ + +where $i$ is the current step, I is the total training step for distilled data. Accordingly, the NAT model is merely fed with the priori knowledge derived from the raw data at beginning. Along with training, the supervision signal of the prior information is getting weaker while that of the distilled data gradually prevails in the training objective. We run all models for 300K steps to ensure adequate training, thus the bilingual prior distributions will be exposed at the first 150K steps. + +Choices of Prior Distribution $Q ( \cdot )$ The goal of the prior objective is to guide the NAT models to learn to distill the lexical choices itself from the raw data. For each target word $e$ , we use the external word alignment to select the source word $f$ with the maximum alignment probability, and $Q ( \cdot )$ is rewritten as: + +$$ +Q ( e | \mathbf { f } ) = Q ( e | f ) +$$ + +Specifically, we use two types of bilingual prior distributions: + +• Word Alignment Distribution $( W A D )$ is the distribution derived from the external word alignment $\mathbf { P } _ { f } ^ { D } = \{ { \breve { P } } ^ { D } ( e _ { 1 } | f ) , \dots , P ^ { D } ( e _ { N } | f ) \}$ where $\{ e _ { 1 } , \dots , e _ { N } \}$ are the set of target words aligned to the source word in the training data. We follow Hinton et al. (2015) to use the softmax temperature mechanism to map $\mathbf { P } _ { f } ^ { D }$ over the whole target vocabulary: + +$$ +Q ( e | f ) = \hat { \mathbf { P } } _ { f } ^ { D } = \frac { e x p ( \mathbf { P } _ { f } ^ { D } / \tau ) } { \sum _ { V _ { t g t } } e x p ( \mathbf { P } _ { f } ^ { D } / \tau ) } +$$ + +We tune the temperature from [0.5, 1, 2, 5] on WMT14 En-De dataset and use $\tau = 2$ as the default setting for incorporating word alignment distribution in all datasets. + +• Self-Distilled Distribution $( S D D )$ is the probability distribution for the source word $f$ , which is produced by a same NAT model pre-trained on raw data. Specifically, the model $M$ takes a source word $f$ as input and produces a probability distribution over whole words in target vocabulary: + +$$ +\mathbf { P } _ { f } ^ { M } = \{ P ^ { M } ( e _ { 1 } | f ) , \dots , P ^ { M } ( e _ { | \mathbf { V } _ { t r g } | } | f ) \} +$$ + +This prior distribution signal can be characterized as self-distilled lexicon level “born-again networks” (Furlanello et al., 2018) or self-knowledge distillation (Liu et al., 2020), where the teacher and student have the same neural architecture and model size, and yet surprisingly the student is able to surpass the teacher’s accuracy. + +Table 3: Ablation Study on raw data priors across different language pairs using the MaskT Model. “WAD” denotes word alignment distribution, and “SDD” denotes self-distilled distribution. “AoLC / LFT” denotes the lexical translation accuracies for all tokens / low-frequency tokens, respectively. + +
ModelEn-DeZh-EnJa-En
AoLC /LFTBLEUAoLC /LFTBLEUAoLC /LFTBLEU
AT-TEACHER79.3 / 73.029.274.7 / 66.225.377.1/ 70.829.8
MaskT+KD76.3 / 68.427.072.7 / 61.524.275.3 / 66.928.9
+WAD77.5 / 71.927.473.4 / 64.524.876.3 / 69.029.4
+SDD77.7 /72.227.573.5 / 64.724.976.1 / 68.629.3
+Both78.1/ 72.427.874.0 / 65.025.276.6 / 69.129.6
+ +Table 4: Comparison with previous work on WMT14 En-De and WMT16 Ro-En datasets. “Iter.” column indicate the average number of refined iterations. “†” indicates statistically significant difference $( p < 0 . 0 5 )$ from baselines according to the statistical significance test (Collins et al., 2005). + +
Iter. SpeedEn-DeRo-En
AoLCBLEUAoLCBLEU
AT Models
Transformer-BASE (Ro-En Teacher)n/a1.0×27.334.1
Transformer-BIG (En-De Teacher)n/a0.8×29.2n/a
Existing NAT Models
NAT (Gu et al., 2018) Iterative NAT (Lee et al., 2018)1.02.4×19.2 21.6n/a31.4 30.2
DisCo (Kasai et al., 2020)10.0 4.82.0× 3.2×26.833.3
Mask-Predict (Ghazvininejad et al., 2019)10.01.5×n/a27.033.3
Levenshtein (Gu et al., 2019)2.53.5×27.333.3
Mask-PredictOur NAT Models76.327.079.233.3
+Raw Data Prior10.01.5×78.127.8t80.633.7
Levenshtein2.53.5×77.027.279.833.2
+RawData Prior77.827.8t80.933.8t
+ +# 4.2 EXPERIMENTAL RESULTS + +Ablation Study on Raw Data Prior Table 3 shows the results of our proposed two bilingual data dependent prior distributions across language pairs. The word alignment distribution (WAD) and self-distilled distribution (SDD) variants consistently improves performance over the vanilla two-step training scheme NAT model $\mathrm { ^ { * } N A T { + } K D ^ { \prime } }$ ) when used individually (averagely $+ 0 . 5$ BLEU point), and combining them $\hbar ^ { * } { + } \mathrm { B o t h } ^ { \prime \prime }$ ) by simply averaging the two distributions can achieve a further improvement (averagely $+ 0 . 9$ BLEU point). The improvements on translation performance are due to a increase of AoLC, especially for low-frequency tokens (averagely $+ 3 . 2$ ), which reconfirms our claim. Notably, averaging the two prior distributions could rectify each other, thus leading to a further increase. We explore the complementarity of two prior schemes in Section 4.3. In the following experiments, we use the combination of WAD and SDD as the default bilingual data dependent prior. + +Comparison with Previous Work Table 4 lists the results of previously competitive studies (Gu et al., 2018; Lee et al., 2018; Kasai et al., 2020; Ghazvininejad et al., 2019; Gu et al., 2019) on the widely-used WMT14 En-De and WMT16 Ro-En datasets. Clearly, our bilingual data-dependent prior significantly improves translation (BLEU↑) by substantially increasing the lexical choice accuracy (AoLC↑). It is worth noting that our approaches merely modify the training process, thus does not increase any latency (“Speed”), maintaining the intrinsic advantages of non-autoregressive generation. + +Table 7: Improvement of our approach over the MaskT $\mathrm { \Phi } _ { + \mathrm { K D } }$ model on AoLC. + +
FrequencyEn-DeZh-EnJa-En
High+1.3%+0.3%+1.3%
Medium+0.2%+0.1%+0.9%
Low+5.9%+5.8%+3.3%
All+2.4%+1.8%+1.7%
+ +Table 8: Ratio of low-frequency target words in the MaskT model generated translations. + +
ModelEn-DeZh-EnJa-En
NAT10.3%6.7%9.4%
+KD7.6%4.2%6.9%
+Ours9.8%6.1%8.5%
+ +Comparison with Data Manipulation Strategies Instead of using the proposed priors, we also investigate two effective data manipulation strategies, i.e. Data Mixing and Curriculum Learning, to force the NAT model learns from both the raw and distilled data. For data mixing, we design two settings: a) Mix: simply combine the raw and distilled data, and then shuffle the mixed dataset. b) Tagged Mix: Inspired by successes of tagged back-translation (Caswell et al., 2019; Marie et al., 2020), we add tags to distinguish between KD and Raw sentences in the mixed dataset. For decay curriculum schedule, the NAT models learn more from raw data at the beginning and then learn more from KD as the training goes on. The details of curriculum can be found in Appendix A.3. As seen in Table 5, data mixing and decay curriculum schedule improve performance on both AoLC and BLEU, which confirm the necessity of exposing raw data to NAT models during training. Besides, our approach still outperforms those effective strategies, demonstrating the superiority of our learning scheme. + +Table 5: Performance of several data manipulation strategies on En-De dataset. Baseline is the $\mathbf { M a s k T + K D }$ model and Ours is our proposed approach. + +
StrategiesAoLCBLEU
Baseline76.327.0
Mix76.627.2
Tagged Mix77.127.4
Decay Curriculum77.227.5
Ours78.127.8
+ +# 4.3 EXPERIMENTAL ANALYSIS + +In this section, we conducted extensive analyses on the lexical choice to better understand our approach. Unless otherwise stated, results are reported on the MaskPredict models in Table 3. + +
ModelBLEUAoLCError
MaskT22.668.5%34.3%
+KD24.272.7%30.1%
+RDP25.274.0%28.2%
+ +Our approach improves translation performance by reducing mis-translation errors. The lexical choice ability of NAT models correlates to mistranslation errors, in which wrong lexicons are chosen to translate source words. To better understand whether our method alleviates the mis-translation problem, we + +Table 6: Subjective evaluation of mistranslation errors on the Zh-En dataset. + +assessed system output by human judgments. In particular, we randomly selected 50 sentences from the Zh-En testset, and manually labelled the words with lexical choice error. We defined the lexical choice error rate as $E / N$ , where $E$ is the number of lexical choice errors and $N$ is the number of content words in source sentences, since such errors mainly occur in translating content words. As seen in Table 6, our approache consistently improves BLEU scores by reducing the lexical choice errors, which confirm our claim. Additionally, AoLC metric correlates well with both the automatic BLEU score and the subjective evaluation, demonstrating its reasonableness. + +Our approach significantly improves the accuracy of lexical choice for low-frequency source words. As aforementioned discrepancy between high- & low-frquency words in Section 3.3, we focus on revealing the fine-grained lexical choice accuracy w.r.t our proposed AoLC. In Table 7, the majority of improvements is from the low-frequency words, confirming our hypothesis. + +Our approach generates translations that contain more low-frequency words. Besides improving the lexical choice of low-frequency words, our method results in more low-frequency words being recalled in the translation. In Table 8, although KD improves the translation, it biases the NAT model towards generating high-frequency tokens (Low freq.↓) while our method can not only correct this bias (averagely $+ 3 2 \%$ relative change), but also enhance translation (BLEU↑ in Table 3). + +Our proposed two priors complement each other by facilitating different tokens. As aforementioned in Table 3, combining two individual schemes can further increase the NAT performance. To explain how they complement each other, especially for low-frequency tokens, we classify low-frequency tokens into two categories according to their linguistic roles: content words (e.g. noun, verb, and adjective) and function words (e.g. preposition, determiner, and punctuation). The results are listed in Table 9. We show that WAD facilitates more on the understanding and generation of content tokens, while SDD brings more gains for function (i.e. content + +
PriorAoLC on LFTRatio of LFT
ContentFunctionContentFunction
N/A67.7%70.1%5.3%2.4%
WAD71.6%72.9%5.9%2.5%
SDD71.4%74.3%5.6%3.4%
Both71.6%74.2%6.2%3.6%
+ +Table 9: AoLC and Ratio of different prior schemes on Low-Frequency Tokens (“LFT”). We list the performances on different linguistic roles, i.e. content words and function words. Note that Ratio of LFT means the ratio of low frequency tokens in generated translation. “N/A” means MaskT $\mathrm { + K D }$ baseline. + +free) tokens. We leave a more thorough exploration of this aspect for future work. + +Effect of Word Alignment Quality on Model Performance. Both the proposed AoLC and priors depend heavily on the quality of word alignment, we therefore design two weaker alignment scenarios to verify the robustness of our method. + +First, We adopt fast-align (Dyer et al., 2013), which is slightly weaker than $\mathrm { { G I Z A + + } }$ . Using fastalign, our methods can still achieve $+ 0 . 6$ and $+ 0 . 7$ improvements in terms of BLEU on En-De and Zh-En datasets, which are marginally lower than that using $\mathrm { { G I Z A + + } }$ (i.e. $+ 0 . 8$ and $+ 1 . 0$ BLEU). Encouragingly, we find that the improvements in translation accuracy on low-frequency words still hold $+ 5 . 5 \%$ and $+ 5 . 3 \%$ vs. $+ 5 . 9 \%$ and $+ 5 . 8 \%$ ), which demonstrates the robustness of our approach. + +In addition, we insert noises into the alignment distributions to deliberately reduce the alignment quality (Noise injection details can be found in Appendix A.4. The performances still significantly outperform the baseline, indicating that our method can tolerate alignment errors and maintain model performance to some extent. + +Effect of AT Teacher To further dissect the different effects when applying different AT teachers, we employ three teachers. Table 10 shows our method can enhance NAT models under variety of teacher-student scenarios, including base, big and strong teacher-guided models. Our approach obtains averagely $+ 0 . 7$ BLEU points, potentially complementary to the majority of existing work on improving knowledge distillation for NAT models. + +Table 10: Different teachers on the En-De dataset. + +
AT TeacherNAT Model
ModelBLEUVanilla+Prior △
Base27.326.527.2 +0.7
Big28.426.827.5 +0.7
Strong29.227.027.8 +0.8
+ +# 5 RELATED WORK + +Understanding Knowledge Distillation for NAT Knowledge distillation is a crucial early step in the training of most NAT models. Ren et al. (2020) reveal that the difficulty of NAT heavily depends on the strongness of dependency among target tokens, and knowledge distillation reduces the token dependency in target sequence and thus improves the accuracy of NAT models. In the pioneering work of NAT, Gu et al. (2018) claim that NAT suffers from the multi-modality problem (i.e. multiple lexical translations for a source word), and knowledge distillation can simplify the dataset, which is empirically validated by Zhou et al. (2020). We confirm and extend these results, showing that the AT-distilled dataset indeed leads to more deterministic predictions but propagates the low-frequency lexical choices errors. To this end, we enhance the NAT lexical predictions by making them learn to distill knowledge from the raw data. + +Lexical Choice Problem in NMT Models Benefiting from continuous representations abstracted from the training data, NMT models have advanced the state of the art in the machine translation community. However, recent studies have revealed that NMT models suffer from inadequate translation (Tu et al., 2016), in which mis-translation error caused by the lexical choice problem is one main reason. For AT models, Arthur et al. (2016) alleviate this issue by integrating a count-based lexicon, and Nguyen & Chiang (2018) propose an additional lexical model, which is jointly trained with the AT model. The lexical choice problem is more serious for NAT models, since 1) the lexical choice errors (low-resource words in particular) of AT distillation will propagate to NAT models; and 2) NAT lacks target-side dependencies thus misses necessary target-side context. In this work, we alleviate this problem by solving the first challenge. + +# 6 CONCLUSION + +In this study, we investigated effects of KD on lexical choice in NAT. We proposed a new metric to evaluate lexical translation accuracy of NAT models, and found that 1) KD improves global lexical predictions; and 2) KD benefits the accuracy of high-frequency words but harms the low-frequency ones. There exists a discrepancy between high- and low-frequency words after adopting KD. To bridge this discrepancy, we exposed the useful information in raw data to the training of NAT models. Experiments show that our approach consistently and significantly improves translation performance across language pairs and model architectures. Extensive analyses reveal that our method reduces mistranslation errors, improves the accuracy of lexical choices for low-frequency source words, recalling more low-frequency words in the translations as well, which confirms our claim. + +# 7 ACKNOWLEDGMENTS + +This work was supported by Australian Research Council Projects under grants FL-170100117, DP-180103424, and IC-190100031. Xuebo and Derek were supported in part by the Science and Technology Development Fund, Macau SAR (Grant No. 0101/2019/A2), and the Multi-year Research Grant from the University of Macau (Grant No. MYRG2020-00054-FST). We also thank the anonymous reviewers for their insightful comments. + +# REFERENCES + +Philip Arthur, Graham Neubig, and Satoshi Nakamura. Incorporating discrete translation lexicons into neural machine translation. In EMNLP, 2016. + +Isaac Caswell, Ciprian Chelba, and David Grangier. Tagged back-translation. WMT, 2019. + +Nitesh V. Chawla, Nathalie Japkowicz, and Aleksander Kotcz. Editorial: Special issue on learning from imbalanced data sets. SIGKDD Explor. Newsl., 2004. + +Heeyoul Choi, Kyunghyun Cho, and Yoshua Bengio. Context-dependent word representation for neural machine translation. Computer Speech & Language, 45:149–160, 2017. + +Michael Collins, Philipp Koehn, and Ivona Kucerov ˇ a. Clause restructuring for statistical machine ´ translation. In ACL, 2005. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019. + +Liang Ding, Longyue Wang, Di Wu, Dacheng Tao, and Zhaopeng Tu. Context-aware cross-attention for non-autoregressive translation. In COLING, 2020. + +Chris Dyer, Victor Chahuneau, and Noah A Smith. A simple, fast, and effective reparameterization of ibm model 2. In NAACL, 2013. + +Tommaso Furlanello, Zachary Lipton, Michael Tschannen, Laurent Itti, and Anima Anandkumar. Born again neural networks. In ICML, 2018. + +Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. Mask-predict: Parallel decoding of conditional masked language models. In EMNLP, 2019. + +Jiatao Gu, James Bradbury, Caiming Xiong, Victor OK Li, and Richard Socher. Non-autoregressive neural machine translation. In ICLR, 2018. + +Jiatao Gu, Changhan Wang, and Junbo Zhao. Levenshtein transformer. In NIPS, 2019. + +Shuhao Gu, Jinchao Zhang, Fandong Meng, Yang Feng, Wanying Xie, Jie Zhou, and Dong Yu. Token-level adaptive training for neural machine translation. In EMNLP, 2020. + +Junliang Guo, Xu Tan, Di He, Tao Qin, Linli Xu, and Tie-Yan Liu. Non-autoregressive neural machine translation with enhanced decoder input. In AAAI, 2019. + +Yongchang Hao, Shilin He, Wenxiang Jiao, Zhaopeng Tu, Lyu Michael, and Xing Wang. Multi-task learning with shared encoder for non-autoregressive machine translation. In NAACL, 2021. + +Hany Hassan, Anthony Aue, Chang Chen, Vishal Chowdhary, Jonathan Clark, Christian Federmann, Xuedong Huang, Marcin Junczys-Dowmunt, William Lewis, Mu Li, et al. Achieving human parity on automatic chinese to english news translation. In arXiv, 2018. + +Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning and Representation Learning Workshop, 2015. + +Jungo Kasai, James Cross, Marjan Ghazvininejad, and Jiatao Gu. Parallel machine translation with disentangled context transformer. In arXiv, 2020. + +Yoon Kim and Alexander M Rush. Sequence-level knowledge distillation. In EMNLP, 2016. + +Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. + +Philipp Koehn and Rebecca Knowles. Six challenges for neural machine translation. In WMT, 2017. + +Jason Lee, Elman Mansimov, and Kyunghyun Cho. Deterministic non-autoregressive neural sequence modeling by iterative refinement. In EMNLP, 2018. + +Jason Lee, Dustin Tran, Orhan Firat, and Kyunghyun Cho. On the discrepancy between density estimation and sequence generation. In ICML, 2020. + +Yang Liu, Sheng Shen, and Mirella Lapata. Noisy self-knowledge distillation for text summarization, 2020. + +Dabiao Ma, Zhiba Su, Wenxuan Wang, and Yu-Hao Lu. Fpets: Fully parallel end-to-end text-tospeech system. In AAAI, 2020. + +Xuezhe Ma, Chunting Zhou, Xian Li, Graham Neubig, and Eduard Hovy. Flowseq: Nonautoregressive conditional sequence generation with generative flow. In EMNLP, 2019. + +Benjamin Marie, Raphael Rubino, and Atsushi Fujita. Tagged back-translation revisited: Why does it really work? In ACL, 2020. + +Makoto Morishita, Jun Suzuki, and Masaaki Nagata. Ntt neural machine translation systems at wat 2017. In IJCNLP, 2017. + +Toan Nguyen and David Chiang. Improving lexical choice in neural machine translation. In NAACL, 2018. + +Franz Josef Och and Hermann Ney. A systematic comparison of various statistical alignment models. Computational Linguistics, 29(1), 2003. + +Myle Ott, Michael Auli, David Grangier, and Marc‘‘Aurelio Ranzato. Analyzing uncertainty in neural machine translation. In ICML, 2018. + +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In ACL, 2002. + +Qiu Ran, Yankai Lin, Peng Li, and Jie Zhou. Guiding non-autoregressive neural machine translation decoding with reordering information. In arXiv, 2019. + +Yi Ren, Jinglin Liu, Xu Tan, Zhou Zhao, Sheng Zhao, and Tie-Yan Liu. A study of non-autoregressive model for sequence generation. In ACL, 2020. + +Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In ACL, 2016. + +Chenze Shao, Jinchao Zhang, Yang Feng, Fandong Meng, and Jie Zhou. Minimizing the bag-ofngrams difference for non-autoregressive neural machine translation. In AAAI, 2019. + +Mitchell Stern, William Chan, Jamie Kiros, and Jakob Uszkoreit. Insertion transformer: Flexible sequence generation via insertion operations. In ICML, 2019. + +Zhiqing Sun, Zhuohan Li, Haoqing Wang, Di He, Zi Lin, and Zhihong Deng. Fast structured decoding for sequence models. In NIPS, 2019. + +Ales Tamchyna. Lexical and morphological choices in machine translation. 2017. ˇ + +Jiaxi Tang, Rakesh Shivanna, Zhe Zhao, Dong Lin, Anima Singh, Ed H. Chi, and Sagar Jain. Understanding and improving knowledge distillation, 2020. + +Zhaopeng Tu, Zhengdong Lu, Yang Liu, Xiaohua Liu, and Hang Li. Modeling coverage for neural machine translation. In ACL, 2016. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017. + +Yiren Wang, Fei Tian, Di He, Tao Qin, ChengXiang Zhai, and Tie-Yan Liu. Non-autoregressive machine translation with auxiliary regularization. In AAAI, 2019. + +Bingzhen Wei, Mingxuan Wang, Hao Zhou, Junyang Lin, and Xu Sun. Imitation learning for non-autoregressive neural machine translation. In ACL, 2019. + +Chunting Zhou, Graham Neubig, and Jiatao Gu. Understanding knowledge distillation in nonautoregressive machine translation. In ICLR, 2020. + +# A APPENDIX + +A.1 DISCUSSION ON THE RELIABILITY OF WORD ALIGNMENT-BASED AOLC + +We randomly select 20 sentence pairs from the Zh-En test set, which contains 576 source tokens. We use the trained word alignment model to produce alignments for the 20 sentence pairs, and then perform the gold word chosen procedure as described in Section 3.1. We manually evaluate these bilingual lexicons, and find that 551 out of 576 source words are aligned to reasonable equivalences (i.e. $96 \%$ accuracy). This demonstrates that it is reliable to calculate AoLC based on automatic word alignments. + +A.2 GENERAL CASES OF THE SIDE-EFFECT OF KNOWLEDGE DISTILLATION + +To verify the universality of our findings that lexical choice error will propagate from teacher model, we conduct the following experiments. + +In particular, we experiment AT-Base and AT-Small models on the En-De data, which are distilled by the AT-Strong model. Note that the AT-Small model consists of 256 model dimensions, 4 heads, 3 encoder and 3 decoder layers. As shown in Table 11, the same phenomena can be found in AT models when distillation is used. We leave a thorough exploration of this aspect for future work. + +
ModelBLEUAoLC on LFTRatio of LFT
AT-Base27.372.5%9.2%
+KD27.868.4%7.8%
AT-Small21.661.8%10.7%
+KD23.559.3%7.1%
+ +Table 11: Results of AT models on En-De when knowledge distillation is used. LFT denotes lowfrequency tokens and Ratio of LFT means the ratio of low-frequency tokens in generated translation. + +# A.3 DECAY CURRICULUM SETUP + +Specifically, the training process is divided into 5 phases, which differ at the constituent of training data. At Phase 1, all training examples are from the raw data; and at Phase 2, $7 5 \%$ of the training examples are from the raw data and the other $2 5 \%$ are from the distilled data (note that the two kinds of training examples should cover all source sentences). Similarly, the constituent ratios at the later phases are $( 5 0 \% , 5 0 \% )$ , $( 2 5 \% , 7 5 \% )$ , and $( 0 \% , 1 0 0 \% )$ . + +# A.4 NOISE INJECTION SETUP + +We swap the maximal probability tokens with other random tokens under the change ratio of $N \%$ . With $2 \%$ and $5 \%$ noises, our method respectively decreased by $- 0 . 1$ and -0.2 BLEU scores on En-De. The improvements in translation accuracy on low-frequency words are $+ 5 . 7 \%$ and $+ 5 . 3 \%$ , which is comparable to non-noisy one (i.e. $+ 5 . 9 \%$ ). \ No newline at end of file diff --git a/md/train/a7APmM4B9d/a7APmM4B9d.md b/md/train/a7APmM4B9d/a7APmM4B9d.md new file mode 100644 index 0000000000000000000000000000000000000000..04decd03a079e75398d19f7fffb1873f164e8b1c --- /dev/null +++ b/md/train/a7APmM4B9d/a7APmM4B9d.md @@ -0,0 +1,287 @@ +# Decision Transformer: Reinforcement Learning via Sequence Modeling + +Lili Chen∗,1, Kevin $\mathbf { L u } ^ { * , 1 }$ , Aravind Rajeswaran2, Kimin Lee1, Aditya Grover2,3, Michael Laskin1, Pieter Abbeel1, Aravind Srinivas†,4, Igor Mordatch†,5 + +∗equal contribution †equal advising + +1UC Berkeley 2Facebook AI Research 3UCLA 4OpenAI 5Google Brain + +{lilichen, kzl}@berkeley.edu + +# Abstract + +We introduce a framework that abstracts Reinforcement Learning (RL) as a sequence modeling problem. This allows us to draw upon the simplicity and scalability of the Transformer architecture, and associated advances in language modeling such as GPT- $\mathbf { X }$ and BERT. In particular, we present Decision Transformer, an architecture that casts the problem of RL as conditional sequence modeling. Unlike prior approaches to RL that fit value functions or compute policy gradients, Decision Transformer simply outputs the optimal actions by leveraging a causally masked Transformer. By conditioning an autoregressive model on the desired return (reward), past states, and actions, our Decision Transformer model can generate future actions that achieve the desired return. Despite its simplicity, Decision Transformer matches or exceeds the performance of state-of-the-art model-free offline RL baselines on Atari, OpenAI Gym, and Key-to-Door tasks. + +![](images/1a24cd0765714aa601fab185d61614e5c237741df36ea350b02c6e428b196d29.jpg) +Figure 1: Decision Transformer architecture1. States, actions, and returns are fed into modalityspecific linear embeddings and a positional episodic timestep encoding is added. Tokens are fed into a GPT architecture which predicts actions autoregressively using a causal self-attention mask. + +![](images/0797a951d243f2314131b11d4b2498080d4ff7e99afe42059cf1db90aad8dccc.jpg) +Figure 2: Illustrative example of finding shortest path for a fixed graph (left) posed as reinforcement learning. Training dataset consists of random walk trajectories and their per-node returns-to-go (middle). Conditioned on a starting state and generating largest possible return at each node, Decision Transformer sequences optimal paths. + +# 1 Introduction + +Recent work has shown transformers [1] can model large-scale distributions of semantic concepts, including capable zero-shot generalization in language [2] and impressive out-of-distribution image generation [3]. This stands in sharp contrast to much work in reinforcement learning (RL), which learns a single policy to model a particular narrow behavior distribution. Given the diversity of applications and impact of transformer models, we seek to examine their application to sequential decision making problems. In particular, instead of using transformers as an architectural choice for traditional RL algorithms [4, 5], we seek to study if trajectory modeling (analogous to language modeling) can serve as a replacement for conventional RL algorithms. + +We consider the following shift in paradigm: instead of training a policy through conventional RL algorithms like temporal difference (TD) learning [6], the dominant paradigm in RL, we will train transformer models on collected experience using a sequence modeling objective. This will allow us to bypass the need for bootstrapping to propagate returns – thereby avoiding one of the “deadly triad” [6] known to destabilize RL. It also avoids the need for discounting future rewards, as typically done in TD-learning, which can induce undesirable short-sighted behaviors. Additionally, we can make use of existing transformer frameworks widely used in language and vision that are easy to scale, utilizing a large body of work studying stable training of transformer models; this approach removes the need for specialized RL frameworks by appealing only to commonplace supervised learning systems. Given their demonstrated ability to model long sequences and wide data distributions, transformers also have other advantages. Transformers can perform credit assignment directly via self-attention, in contrast to Bellman backups which slowly propagate rewards and are prone to “distractor” signals [7]. This can enable transformers to still work effectively in the presence of sparse or distracting rewards. Furthermore, a transformer modeling approach can model a wide distribution of behaviors, enabling better generalization and transfer. While “upside-down” reinforcement learning (UDRL) [8, 9, 10] also uses a supervised loss conditioned on a target return, our work is motivated by sequence modeling rather than supervised learning and seeks to benefit from modeling long sequences of behaviors. See Section 6 for more discussions about related works. + +We explore our hypothesis by considering offline RL, where we will task agents with learning policies from suboptimal data – producing maximally effective behavior from fixed, limited experience. This task is traditionally challenging due to error propagation and value overestimation [11]. However, it is a natural task when training with a sequence modeling objective. By training an autoregressive model on sequences of states, actions, and returns, we reduce policy sampling to autoregressive generative modeling. We can specify the expertise of the policy – which “skill” to query – by manually setting the return tokens, acting as a prompt for generation. + +Illustrative example. To get an intuition for our proposal, consider the task of finding a shortest path on a directed graph posed as an RL problem. The reward is 0 when at the goal node and $- 1$ otherwise. We train a GPT [12] model to predict next token in a sequence of returns-to-go (sum of future rewards), states, and actions. Training only on random walk data – with no expert demonstrations – we can at test time generate optimal trajectories by adding a prior to generate highest possible returns (see more details and empirical results in the Appendix) and subsequently generate actions conditioned on that. Thus, by combining the tools of sequence modeling with hindsight return information, we achieve policy improvement without the need for dynamic programming. + +Motivated by this observation, we propose Decision Transformer, where we use the GPT architecture to autoregressively model trajectories (shown in Figure 1). We study whether sequence modeling can perform policy optimization by evaluating Decision Transformer on offline RL benchmarks in Atari [13], OpenAI Gym [14], and Key-to-Door [15] environments. We show that – without using dynamic programming – Decision Transformer performs comparably on these benchmarks to state-of-the-art model-free offline RL algorithms [16, 17]. Furthermore, in tasks where long-term credit assignment is required, Decision Transformer capably outperforms RL algorithms. With this work, we hope to bridge vast recent progress in transformer models with RL problems. + +# 2 Preliminaries + +# 2.1 Offline reinforcement learning + +We consider learning in a Markov decision process (MDP) described by the tuple $( \boldsymbol { S } , \mathcal { A } , \boldsymbol { P } , \mathcal { R } )$ . The MDP tuple consists of states $s \in S$ , actions $a \in { \mathcal { A } }$ , transition dynamics $P ( s ^ { \prime } | s , a )$ , and a reward function $r = \mathcal { R } ( s , a )$ . We use $s _ { t }$ , $a _ { t }$ , and $r _ { t } = \mathcal { R } ( s _ { t } , a _ { t } )$ to denote the state, action, and reward at timestep $t$ , respectively. The goal in reinforcement learning is to learn a policy which maximizes the expected return $\mathbb { E } \left[ \sum _ { t = 1 } ^ { T } r _ { t } \right]$ in an MDP. In offline reinforcement learning, instead of obtaining data via environment interactions, we only have access to some fixed limited dataset consisting of trajectories from the environment. This setting is harder as it removes the ability for agents to explore the environment and collect additional feedback. + +# 2.2 Transformers + +Transformers were proposed by Vaswani et al. [1] as an architecture to efficiently model sequences. They consist of stacked self-attention layers with residual connections. Each self-attention layer receives $n$ embeddings $\{ x _ { i } \} _ { i = 1 } ^ { n }$ corresponding to unique input tokens, and outputs $n$ embeddings $\{ z _ { i } \} _ { i = 1 } ^ { n }$ , preserving the input dimensions. The $i$ -th token is mapped via linear transformations to a key $k _ { i }$ , query $q _ { i }$ , and value $v _ { i }$ . The $i$ -th output of the self-attention layer is given by weighting the values $v _ { j }$ by the normalized dot product between the query $q _ { i }$ and other keys $k _ { j }$ : + +$$ +z _ { i } = \sum _ { j = 1 } ^ { n } \operatorname { s o f t m a x } ( \{ \langle q _ { i } , k _ { j ^ { \prime } } \rangle \} _ { j ^ { \prime } = 1 } ^ { n } ) _ { j } \cdot v _ { j } . +$$ + +This allows the layer to assign “credit” by implicitly forming state-return associations via similarity of the query and key vectors (maximizing the dot product). In this work, we use the GPT architecture [12], which modifies the transformer architecture with a causal self-attention mask to enable autoregressive generation, replacing the summation/softmax over the $n$ tokens with only the previous tokens in the sequence $( j \in \bar { [ 1 , i ] } )$ . We defer the other architecture details to the original papers. + +# 3 Method + +In this section, we present Decision Transformer, which models trajectories autoregressively with minimal modification to the transformer architecture, as summarized in Figure 1 and Algorithm 1. + +Trajectory representation. The key desiderata in our choice of trajectory representation are (a) it should enable transformers to learn meaningful patterns and (b) we should be able to conditionally generate actions at test time. It is nontrivial to model rewards since we would like the model to generate actions based on future desired returns, rather than past rewards. As a result, instead of modeling the rewards directly, we model the returns-to-go $\begin{array} { r } { \overline { { \boldsymbol { R } } } _ { t } = \sum _ { t ^ { \prime } = t } ^ { T } \boldsymbol { r } _ { t ^ { \prime } } } \end{array}$ . This leads to the following trajectory representation which is amenable to autoregressive training and generation: + +$$ +\tau = \left( \widehat { R } _ { 1 } , s _ { 1 } , a _ { 1 } , \widehat { R } _ { 2 } , s _ { 2 } , a _ { 2 } , \ldots , \widehat { R } _ { T } , s _ { T } , a _ { T } \right) . +$$ + +Architecture. We feed the last $K$ timesteps into Decision Transformer, for a total of $3 K$ tokens (one for each modality: return-to-go, state, or action). To obtain token embeddings, we learn a linear layer for each modality, which projects raw inputs to the embedding dimension, followed by layer normalization [18]. For environments with visual inputs, the state is fed into a convolutional encoder instead of a linear layer. Additionally, an embedding for each timestep is learned and added to each token – note this is different than the standard positional embedding used by transformers, as one timestep corresponds to three tokens. The tokens are then processed by a GPT [12] model, which predicts future action tokens via autoregressive modeling. + +Training. We sample minibatches of sequence length $K$ from the dataset. The prediction head corresponding to the input token $s _ { t }$ is trained to predict $a _ { t }$ – either with cross-entropy loss for discrete actions or mean-squared error for continuous actions – and the losses for each timestep are averaged. We did not find predicting the states or returns-to-go to be necessary for good performance, although it is possible (as shown in Section 5.3) and would be an interesting study for future work. + +Evaluation. During evaluation rollouts, we specify a target return based on our desired performance (e.g., specify maximum possible return to generate expert behavior) as well as the environment starting state, to initialize generation. After executing the generated action, we decrement the target return by the achieved reward and obtain the next state. We repeat this process of generating actions and applying them to obtain the next return-to-go and state until episode termination. + +# Algorithm 1 Decision Transformer Pseudocode (for continuous actions) + +# R, s, a, t: returns -to -go , states , actions , or timesteps +# K: context length ( length of each input to DecisionTransformer ) +# transformer : transformer with causal masking (GPT) +# embed_s , embed_a , embed_R : linear embedding layers +# embed_t : learned episode positional embedding +# pred_a : linear action prediction layer + +# # main model + +def DecisionTransformer (R , s , a , t ): + +# compute embeddings for tokens +pos_embedding $=$ embed_t ( t ) # per - timestep ( note : not per - token ) +s_embedding $=$ embed_s ( s ) $^ +$ pos_embedding +a_embedding $=$ embed_a ( a ) $^ +$ pos_embedding +R_embedding $=$ embed_R ( R ) $^ +$ pos_embedding + +# interleave tokens as (R_1 , s_1 , a_1 R_K , s_K ) input_embeds $=$ stack ( R_embedding , s_embedding , a_embedding ) + +# use transformer to get hidden states hidden_states $=$ transformer ( input_embeds $=$ input_embeds ) + +# select hidden states for action prediction tokens a_hidden $=$ unstack ( hidden_states ). actions + +# predict action return pred_a ( a_hidden ) + +# training loop + +for (R , s , a , t ) in dataloader : # dims : ( batch_size , K, dim ) a_preds $=$ DecisionTransformer (R , s , a , t ) loss $=$ mean (( a_preds - a ) $* * 2$ ) # L2 loss for continuous actions optimizer . zero_grad (); loss . backward (); optimizer . step () + +# evaluation loop + +target_return $\mathbf { \lambda } = \mathbf { \bar { \lambda } } 1$ # for instance , expert - level return R , s , a , t , done $=$ [ target_return ] , [ env . reset ()] , [] , [1] , False while not done : # autoregressive generation / sampling + +action $=$ DecisionTransformer (R , s , a , t )[ -1] # for cts actions new_s , r , done , _ $=$ env . step ( action ) + +# append new tokens to sequence R = R + [ R [ -1] - r] # decrement returns -to -go with reward s , a , t = s + [ new_s ] , a $^ +$ [ action ] , t + [ len ( R )] R , s , a , t $=$ R [ - K :] , ... # only keep context length of K + +![](images/6be7ce5512d46b7431e828fe71c83f457f669167743b6fc373ae4c4399521a50.jpg) +Figure 3: Results comparing Decision Transformer (ours) to TD learning (CQL) and behavior cloning across Atari, OpenAI Gym, and Minigrid. On a diverse set of tasks, Decision Transformer performs comparably or better than traditional approaches. + +# 4 Evaluations on offline RL benchmarks + +In this section, we investigate if Decision Transformer can perform well compared to standard TD and imitation learning approaches for offline RL. TD learning algorithms represent the conventional stateof-the-art, while imitation learning algorithms have similar formulations to Decision Transformer. The exact algorithms depend on the environment but our motivations are as follows: + +• TD learning: most of these methods use an action-space constraint or value pessimism, and will be the most faithful comparison to Decision Transformer, representing standard RL methods. A state-of-the-art model-free method is Conservative Q-Learning (CQL) [17] which serves as our primary comparison. In addition, we also compare against other prior model-free RL algorithms like BEAR [19] and BRAC [20]. • Imitation learning: this regime similarly uses supervised losses for training, rather than Bellman backups. We use behavior cloning here, and include a more detailed discussion in Section 5.1. + +We evaluate on both discrete (Atari [13]) and continuous (OpenAI Gym [14]) control tasks. The former requires long-term credit assignment, while the latter requires fine-grained continuous control, representing a diverse set of tasks. Our main results are summarized in Figure 3, where we show averaged expert normalized performance for each domain. + +# 4.1 Atari + +The Atari benchmark is challenging due to its high-dimensional visual inputs and difficulty of credit assignment arising from the delay between actions and resulting rewards. We evaluate our method on $1 \%$ of all samples in the DQN-replay dataset as per Agarwal et al. [16], representing 500 thousand of the 50 million transitions observed by an online DQN agent [21] during training; we report the mean and standard deviation of 3 seeds. We normalize scores based on a professional gamer, following the protocol of Hafner et al. [22], where 100 represents the professional gamer score and 0 represents a random policy. + +We compare to CQL [17], REM [16], and QR-DQN [23] on four Atari tasks (Breakout, Qbert, Pong, and Seaquest) that are evaluated in Agarwal et al. [16]. We use context lengths of $K = 3 0$ for Decision Transformer (except $K = 5 0$ for Pong); for results with different values of $K$ see the supplementary material. We also report the performance of behavior cloning (BC), which utilizes + +
GameDT (Ours)CQLQR-DQNREMBC
Breakout267.5 ± 97.5211.121.132.1138.9 ± 61.7
Qbert15.1 ± 11.4104.21.71.417.3 ± 14.7
Pong106.1 ±8.1111.920.039.185.2 ± 20.0
Seaquest2.4± 0.71.71.41.02.1± 0.3
+ +Table 1: Gamer-normalized scores for the $1 \%$ DQN-replay Atari dataset. We report the mean and variance across 3 seeds. Best mean scores are highlighted in bold. Decision Transformer (DT) performs comparably to CQL on 3 out of 4 games, and outperforms other baselines in most games. + +the same network architecture and hyperparameters as Decision Transformer but does not have return-to-go conditioning2. For CQL, REM, and QR-DQN baselines, we report numbers directly from the CQL paper. We show results in Table 1. Our method is competitive with CQL in 3 out of 4 games and outperforms or matches REM, QR-DQN, and BC on all 4 games. + +# 4.2 OpenAI Gym + +In this section, we consider the continuous control tasks from the D4RL benchmark [24]. We also consider a 2D reacher environment that is not part of the benchmark, and generate the datasets using a similar methodology to the D4RL benchmark. Reacher is a goal-conditioned task and has sparse rewards, so it represents a different setting than the standard locomotion environments (HalfCheetah, Hopper, and Walker). The different dataset settings are described below. + +1. Medium: 1 million timesteps generated by a “medium” policy that achieves approximately one-third the score of an expert policy. +2. Medium-Replay: the replay buffer of an agent trained to the performance of a medium policy (approximately $2 5 \mathrm { k } { - } 4 0 0 \mathrm { k }$ timesteps in our environments). +3. Medium-Expert: 1 million timesteps generated by the medium policy concatenated with 1 million timesteps generated by an expert policy. + +We compare to CQL [17], BEAR [19], BRAC [20], and AWR [25]. CQL represents the state-ofthe-art in model-free offline RL, an instantiation of TD learning with value pessimism. Score are normalized so that 100 represents an expert policy, as per Fu et al. [24]. CQL numbers are reported from the original paper; BC numbers are run by us; and the other methods are reported from the D4RL paper. Our results are shown in Table 2. Decision Transformer achieves the highest scores in a majority of the tasks and is competitive with the state of the art in the remaining tasks. + +
DatasetEnvironmentDT (Ours)CQLBEARBRAC-vAWRBC
Medium-ExpertHalfCheetah86.8 ± 1.362.453.441.952.759.9
Medium-ExpertHopper107.6 ± 1.8111.096.30.827.179.6
Medium-ExpertWalker108.1 ±0.298.740.181.653.836.6
Medium-ExpertReacher89.1 ±1.330.6--173.3
MediumHalfCheetah42.6 ± 0.144.441.746.337.443.1
MediumHopper67.6 ± 1.058.052.131.135.963.9
MediumWalker74.0 ± 1.479.259.181.117.477.3
MediumReacher51.2 ± 3.426.011148.9
Medium-ReplayHalfCheetah36.6 ± 0.846.238.647.740.34.3
Medium-ReplayHopper82.7 ± 7.048.633.70.628.427.6
Medium-ReplayWalker66.6 ± 3.026.719.20.915.536.9
Medium-ReplayReacher18.0 ± 2.419.01115.4
Average (Without Reacher)74.763.948.236.934.346.4
Average (All Settings)69.254.21-147.7
+ +Table 2: Results for D4RL datasets4. We report the mean and variance for three seeds. Decision Transformer (DT) outperforms conventional RL algorithms on almost all tasks. + +# 5 Discussion + +# 5.1 Does Decision Transformer perform behavior cloning on a subset of the data? + +In this section, we seek to gain insight into whether Decision Transformer can be thought of as performing imitation learning on a subset of the data with a certain return. To investigate this, we propose a new method, Percentile Behavior Cloning $( \% \mathrm { B C } )$ , where we run behavior cloning on only the top $X \%$ of timesteps in the dataset, ordered by episode returns. The percentile $X \%$ interpolates between standard BC $X = 1 0 0 \%$ ) that trains on the entire dataset and only cloning the best observed trajectory $( X 0 \%$ ), trading off between better generalization by training on more data with training a specialized model that focuses on a desirable subset of the data. + +
DatasetEnvironmentDT (Ours)10%BC25%BC40%BC100%BCCQL
MediumHalfCheetah42.6 ± 0.142.943.043.143.144.4
MediumHopper67.6 ± 1.065.965.265.363.958.0
MediumWalker74.0 ± 1.478.880.978.877.379.2
MediumReacher51.2 ± 3.451.048.958.258.426.0
Medium-ReplayHalfCheetah36.6 ± 0.840.840.941.14.346.2
Medium-ReplayHopper82.7 ± 7.070.658.631.027.648.6
Medium-ReplayWalker66.6 ± 3.070.467.867.236.926.7
Medium-ReplayReacher18.0 ± 2.433.116.210.75.419.0
Average56.156.752.749.439.543.5
+ +Table 3: Comparison between Decision Transformer (DT) and Percentile Behavior Cloning $( \% \mathrm { B C } )$ + +We show full results comparing $\% \mathrm { B C }$ to Decision Transformer and CQL in Table 3, sweeping over $X \in [ 1 0 \% , 2 5 \% , 4 0 \% , 1 \dot { 0 } \dot { 0 } \% ]$ . Note that while both $\% \mathrm { B C }$ and DT introduce hyperparameters, returns are human interpretable and it is relatively natural for humans to specify a desired return compared to choosing an optimal subset for cloning. When data is plentiful – as in the D4RL regime – we find $\% \mathrm { B C }$ can match or beat other offline RL methods. On most environments, Decision Transformer is competitive with the performance of the best $\% \mathrm { B C }$ , indicating it can hone in on a particular subset after training on the entire dataset distribution. + +In contrast, when we study low data regimes – such as Atari, where we use $1 \%$ of a replay buffer as the dataset – $\mathbf { \nabla } \cdot \% \mathbf { B } \mathbf { C }$ is weak (shown in Table 4). This suggests that in scenarios with relatively low amounts of data, Decision Transformer can outperform $\% \mathrm { B C }$ by using all trajectories in the dataset to improve generalization, even if those trajectories are dissimilar from the return conditioning target. Our results indicate that Decision Transformer can be more effective than simply performing imitation learning on a subset of the dataset. On the tasks we considered, Decision Transformer either outperforms or is competitive to $\% \mathrm { B C }$ , without the confound of having to select the optimal subset. + +
GameDT (Ours)10%BC25%BC40%BC100%BC
Breakout267.5 ± 97.528.5±8.273.5 ± 6.4108.2 ± 67.5138.9 ± 61.7
Qbert15.1 ± 11.46.6 ± 1.716.0 ± 13.811.8± 5.817.3 ± 14.7
Pong106.1 ±8.12.5± 0.213.3 ± 2.772.7 ± 13.385.2 ± 20.0
Seaquest2.4 ± 0.71.1 ± 0.21.1 ± 0.21.6 ± 0.42.1 ± 0.3
+ +Table 4: $\% \mathrm { B C }$ scores for Atari. We report the mean and variance across 3 seeds. Decision Transformer (DT) outperforms all versions of $\% \mathrm { B C }$ in most games. + +# 5.2 How well does Decision Transformer model the distribution of returns? + +We evaluate the ability of Decision Transformer to understand return-to-go tokens by varying the desired target return over a wide range – evaluating the multi-task distribution modeling capability of transformers. Figure 4 shows the average sampled return accumulated by the agent over the course of the evaluation episode for varying values of target return. On every task, the desired target returns and the true observed returns are highly correlated. On some tasks like Pong, HalfCheetah and Walker, Decision Transformer generates trajectories that almost perfectly match the desired returns (as indicated by the overlap with the oracle line). Furthermore, on some Atari tasks like Seaquest, we can prompt the Decision Transformer with higher returns than the maximum episode return available in the dataset, demonstrating that Decision Transformer is sometimes capable of extrapolation. + +# 5.3 Does Decision Transformer perform effective long-term credit assignment? + +To evaluate long-term credit assignment capabilities of our model, we consider a variant of the Key-to-Door environment proposed in Mesnard et al. [15]. This is a grid-based environment with a sequence of three phases: (1) in the first phase, the agent is placed in a room with a key; (2) then, the agent is placed in an empty room; (3) and finally, the agent is placed in a room with a door. The agent receives a binary reward when reaching the door in the third phase, but only if it picked up the key in the first phase. This problem is difficult for credit assignment because credit must be propagated from the beginning to the end of the episode, skipping over actions taken in the middle. + +![](images/c1156eaeb2971806e2c5eb8d09680aa47f4f5cf207c581cf8c22a3d777eebeb5.jpg) +Figure 4: Sampled (evaluation) returns accumulated by Decision Transformer when conditioned on the specified target (desired) returns. Top: Atari. Bottom: D4RL medium-replay datasets. + +We train on datasets of trajectories generated by applying random actions and report success rates in Table 5. Furthermore, for the Key-to-Door environment we use the entire episode length as the context, rather than having a fixed content window as in the other environments. Methods that use highsight return information: our Decision Transformer model and $\% \mathrm { B C }$ (trained only on successful episodes) are able to learn effective policies – producing near-optimal paths, despite only training on random walks. TD learning (CQL) cannot effectively propagate $\mathrm { Q }$ -values over the long horizons involved and gets poor performance. + +Table 5: Success rate for Key-to-Door environment. Methods using hindsight (Decision Transformer, $\% \mathbf { B } \mathbf { C } _ { \epsilon }$ ) can learn successful policies, while TD learning struggles to perform credit assignment. + +
DatasetDT (Ours)CQLBC%BCRandom
1K Random Trajectories71.8%13.1%1.4%69.9%3.1%
10K Random Trajectories94.6%13.3%1.6%95.1%3.1%
+ +# 5.4 Can transformers be accurate critics in sparse reward settings? + +In previous sections, we established that decision transformer can produce effective policies (actors). We now evaluate whether transformer models can also be effective critics. We modify Decision Transformer to output return tokens in addition to action tokens on the Key-to-Door environment. We find that the transformer continuously updates reward probability based on events during the episode, shown in Figure 5 (Left). Furthermore, we find the transformer attends to critical events in the episode (picking up the key or reaching the door), shown in Figure 5 (Right), indicating formation of state-reward associations as discussed in Raposo et al. [26] and enabling accurate value prediction. + +# 5.5 Does Decision Transformer perform well in sparse reward settings? + +A known weakness of TD learning algorithms is that they require densely populated rewards in order to perform well, which can be unrealistic and/or expensive. In contrast, Decision Transformer can improve robustness in these settings since it makes minimal assumptions on the density of the reward. To evaluate this, we consider a delayed return version of the D4RL benchmarks where the agent does not receive any rewards along the trajectory, and instead receives the cumulative reward of the trajectory in the final timestep. Our results for delayed returns are shown in Table 6. Delayed returns minimally affect Decision Transformer; and due to the nature of the training process, while imitation learning methods are reward agnostic. While TD learning collapses, Decision Transformer and $\% \mathrm { B C }$ still perform well, indicating that Decision Transformer can be more robust to delayed rewards. + +![](images/2cf047d6f6123e6feee315d97b0f7169c03581ba80dfd8637dd3453482f91ce9.jpg) +Figure 5: Left: Averages of running return probabilities predicted by the transformer model for three types of episode outcomes. Right: Transformer attention weights from all timesteps superimposed for a particular successful episode. The model attends to steps near pivotal events in the episode, such as picking up the key and reaching the door. + +
EnvironmentDelayed (Sparse)AgnosticOriginal (Dense)
DatasetDT (Ours)CQLBC%BCDT (Ours)CQL
Medium-ExpertHopper107.3 ± 3.59.059.9102.6107.6111.0
MediumHopper60.7± 4.55.263.965.967.658.0
Medium-ReplayHopper78.5 ± 3.72.027.670.682.748.6
+ +Table 6: Results for D4RL datasets with delayed (sparse) reward. Decision Transformer (DT) and imitation learning are minimally affected by the removal of dense rewards, while CQL fails. + +# 5.6 Additional Discussions + +For more discussions see the supplementary material. + +# 6 Related work + +Offline reinforcement learning. To mitigate the impact of distribution shift in offline RL, prior algorithms either (a) constrain the policy action space [27, 28, 29] or (b) incorporate value pessimism [27, 17], or (c) incorporate pessimism into learned dynamics models [30, 31]. Since we do not use Decision Transformers to explicitly learn the dynamics model, we primarily compare against model-free algorithms; adding a dynamics model tends to improve the performance of model-free algorithms. Another line of work explores learning wide behavior distribution from an offline dataset by learning a task-agnostic set of skills, either with likelihood-based approaches [32, 33, 34, 35] or by maximizing mutual information [36, 37, 38]. Our work is similar to the likelihood-based approaches, which do not use iterative Bellman updates – although we use a simpler sequence modeling objective instead of a variational method, and use rewards for conditional generation of behaviors. + +Supervised learning in reinforcement learning settings. Some prior methods for reinforcement learning bear more resemblance to static supervised learning, such as Q-learning [39, 40], which still uses iterative backups, or likelihood-based methods such as behavior cloning, which do not (discussed in previous section). Recent work [8, 9, 10] studies “upside-down” reinforcement learning (UDRL), which are similar to our method in seeking to model behaviors with a supervised loss conditioned on the target return. A key difference in our work is the shift of motivation to sequence modeling rather than supervised learning: while the practical methods differ primarily in the context length and architecture, sequence modeling enables behavior modeling even without access to the reward, in a similar style to language [12] or images [41], and is known to scale well [2]. The method proposed by Kumar et al. [9] is most similar to our method with $K = 1$ , which we find sequence modeling/long contexts to outperform (see supplementary material). Ghosh et al. [42] extends prior UDRL methods to use state goal conditioning, rather than rewards, and Paster et al. [43] further use an LSTM with state goal conditioning for goal-conditoned online RL settings. Concurrent to our work, Janner et al. [44] propose Trajectory Transformer, which is similar to Decision Transformer but additionally uses state and return prediction, as well as discretization, which incorporates model-based components. + +We believe that their experiments, in addition to our results, highlight the potential for sequence modeling to be a generally applicable idea for reinforcement learning. + +Credit assignment. Many works have studied better credit assignment via state-association, learning an architecture which decomposes the reward function such that certain “important” states comprise most of the credit [45, 46, 15]. They use the learned reward function to change the reward of an actorcritic algorithm to help propagate signal over long horizons. In particular, similar to our long-term setting, some works have specifically shown such state-associative architectures can perform better in delayed reward settings [47, 7, 48, 26]. In contrast, we allow these properties to naturally emerge in a transformer architecture, without having to explicitly learn a reward function or a critic. + +Conditional language generation. Various works have studied guided generation for images [49] and language [50, 51]. Several works [52, 53, 54, 55, 56, 57] have explored training or fine-tuning of models for controllable text generation. Class-conditional language models can also be used to learn disciminators to guide generation [58, 50, 59, 60]. However, these approaches mostly assume constant “classes”, while in reinforcement learning the reward signal is time-varying. Furthermore, it is more natural to prompt the model desired target return and continuously decrease it by the observed rewards over time, since the transformer model and environment jointly generate the trajectory. + +Attention and transformer models. Transformers [1] have been applied successfully to many tasks in natural language processing [61, 12] and computer vision [62, 63]. However, transformers are relatively unstudied in RL, mostly due to differing nature of the problem, such as higher variance in training. Zambaldi et al. [5] showed that augmenting transformers with relational reasoning improve performance in combinatorial environments and Ritter et al. [64] showed iterative selfattention allowed for RL agents to better utilize episodic memories. Parisotto et al. [4] discussed design decisions for more stable training of transformers in the high-variance RL setting. Unlike our work, these still use actor-critic algorithms for optimization, focusing on novelty in architecture. Additionally, in imitation learning, some works have studied transformers as a replacement for LSTMs: Dasari and Gupta [65] study one-shot imitation learning, and Abramson et al. [66] combine language and image modalities for text-conditioned behavior generation. + +# 7 Conclusion + +We proposed Decision Transformer, seeking to unify ideas in language modeling and RL. On standard offline RL benchmarks, we showed DT can match or outperform strong algorithms designed explicitly for offline RL with minimal modifications from standard language modeling architectures. + +Societal impact. For real-world applications, it is important to understand the types of errors transformers make in MDP settings and possible negative consequences. It will also be important to consider the datasets we train on, which can potentially add destructive biases, particularly as we consider studying augmenting RL agents with more data which may come from questionable sources. + +Limitations. We introduced our paradigm shift and showed its potential in our experiments, but there is significant room for more research in this direction. The current architecture requires considerations of context length and return-to-go hyperparameters, and we show results on standard RL benchmarks; future work could improve the architecture and demonstrate results in more complex environments and tasks. We used a simple supervised loss that was effective in our experiments, but applications to large-scale datasets could benefit from self-supervised pretraining tasks. In addition, one could consider more sophisticated embeddings for returns, states, and actions. While we do not directly evaluate scaling and generalization, we utilize a method known to scale generalize well in domains such as language and vision, and we are excited about larger RL systems built upon our framework. + +# 8 Acknowledgements + +This research was supported by Berkeley Deep Drive, Open Philanthropy, and the National Science Foundation under NSF:NRI #2024675. Part of this work was completed when Aravind Rajeswaran was a PhD student at the University of Washington, where he was supported by the J.P. Morgan PhD Fellowship in AI (2020-21). We also thank Luke Metz, Daniel Freeman, and anonymous reviewers for valuable feedback and discussions, as well as Justin Fu for assistance in setting up D4RL benchmarks, and Aviral Kumar for assistance with the CQL baselines and hyperparameters. + +References +[1] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017. +[2] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. +[3] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. arXiv preprint arXiv:2102.12092, 2021. +[4] Emilio Parisotto, Francis Song, Jack Rae, Razvan Pascanu, Caglar Gulcehre, Siddhant Jayakumar, Max Jaderberg, Raphael Lopez Kaufman, Aidan Clark, Seb Noury, et al. Stabilizing transformers for reinforcement learning. In International Conference on Machine Learning, 2020. +[5] Vinicius Zambaldi, David Raposo, Adam Santoro, Victor Bapst, Yujia Li, Igor Babuschkin, Karl Tuyls, David Reichert, Timothy Lillicrap, Edward Lockhart, et al. Deep reinforcement learning with relational inductive biases. In International Conference on Learning Representations, 2018. +[6] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT Press, 2018. +[7] Chia-Chun Hung, Timothy Lillicrap, Josh Abramson, Yan Wu, Mehdi Mirza, Federico Carnevale, Arun Ahuja, and Greg Wayne. Optimizing agent behavior over long time scales by transporting value. Nature communications, 10(1):1–12, 2019. +[8] Rupesh Kumar Srivastava, Pranav Shyam, Filipe Mutz, Wojciech Jaskowski, and Jürgen ´ Schmidhuber. Training agents using upside-down reinforcement learning. arXiv preprint arXiv:1912.02877, 2019. +[9] Aviral Kumar, Xue Bin Peng, and Sergey Levine. Reward-conditioned policies. arXiv preprint arXiv:1912.13465, 2019. +[10] Acting without rewards. 2019. URL https://ogma.ai/2019/08/ acting-without-rewards/. +[11] Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020. +[12] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018. +[13] Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013. +[14] Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. +[15] Thomas Mesnard, Théophane Weber, Fabio Viola, Shantanu Thakoor, Alaa Saade, Anna Harutyunyan, Will Dabney, Tom Stepleton, Nicolas Heess, Arthur Guez, et al. Counterfactual credit assignment in model-free reinforcement learning. arXiv preprint arXiv:2011.09464, 2020. +[16] Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. In International Conference on Machine Learning, 2020. +[17] Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. In Advances in Neural Information Processing Systems, 2020. +[18] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. +[19] Aviral Kumar, Justin Fu, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. arXiv preprint arXiv:1906.00949, 2019. +[20] Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019. +[21] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. nature, 518(7540):529–533, 2015. +[22] Danijar Hafner, Timothy Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. arXiv preprint arXiv:2010.02193, 2020. +[23] Will Dabney, Mark Rowland, Marc Bellemare, and Rémi Munos. Distributional reinforcement learning with quantile regression. In Conference on Artificial Intelligence, 2018. +[24] Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020. +[25] Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019. +[26] David Raposo, Sam Ritter, Adam Santoro, Greg Wayne, Theophane Weber, Matt Botvinick, Hado van Hasselt, and Francis Song. Synthetic returns for long-term credit assignment. arXiv preprint arXiv:2102.12425, 2021. +[27] Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, 2019. +[28] Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, 2019. +[29] Noah Y Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, and Martin Riedmiller. Keep doing what worked: Behavioral modelling priors for offline reinforcement learning. In International Conference on Learning Representations, 2020. +[30] Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. Morel: Model-based offline reinforcement learning. In Advances in Neural Information Processing Systems, 2020. +[31] Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. Mopo: Model-based offline policy optimization. In Advances in Neural Information Processing Systems, 2020. +[32] Anurag Ajay, Aviral Kumar, Pulkit Agrawal, Sergey Levine, and Ofir Nachum. Opal: Offline primitive discovery for accelerating offline reinforcement learning. arXiv preprint arXiv:2010.13611, 2020. +[33] Víctor Campos, Alexander Trott, Caiming Xiong, Richard Socher, Xavier Giro-i Nieto, and Jordi Torres. Explore, discover and learn: Unsupervised discovery of state-covering skills. In International Conference on Machine Learning, 2020. +[34] Karl Pertsch, Youngwoon Lee, and Joseph J Lim. Accelerating reinforcement learning with learned skill priors. arXiv preprint arXiv:2010.11944, 2020. +[35] Avi Singh, Huihan Liu, Gaoyue Zhou, Albert Yu, Nicholas Rhinehart, and Sergey Levine. Parrot: Data-driven behavioral priors for reinforcement learning. In International Conference on Learning Representations, 2021. +[36] Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. In International Conference on Learning Representations, 2019. +[37] Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Reset-free lifelong learning with skill-space planning. arXiv preprint arXiv:2012.03548, 2020. +[38] Archit Sharma, Shixiang Gu, Sergey Levine, Vikash Kumar, and Karol Hausman. Dynamicsaware unsupervised discovery of skills. In International Conference on Learning Representations, 2020. +[39] Christopher Watkins. Learning from delayed rewards. 01 1989. +[40] 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. +[41] Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In International Conference on Machine Learning, pages 1691–1703. PMLR, 2020. +[42] Dibya Ghosh, Abhishek Gupta, Justin Fu, Ashwin Reddy, Coline Devin, Benjamin Eysenbach, and Sergey Levine. Learning to reach goals without reinforcement learning. arXiv preprint arXiv:1912.06088, 2019. +[43] Keiran Paster, Sheila A McIlraith, and Jimmy Ba. Planning from pixels using inverse dynamics models. arXiv preprint arXiv:2012.02419, 2020. +[44] Michael Janner, Qiyang Li, and Sergey Levine. Reinforcement learning as one big sequence modeling problem. arXiv preprint arXiv:2106.02039, 2021. +[45] Johan Ferret, Raphaël Marinier, Matthieu Geist, and Olivier Pietquin. Self-attentional credit assignment for transfer in reinforcement learning. arXiv preprint arXiv:1907.08027, 2019. +[46] Anna Harutyunyan, Will Dabney, Thomas Mesnard, Mohammad Azar, Bilal Piot, Nicolas Heess, Hado van Hasselt, Greg Wayne, Satinder Singh, Doina Precup, et al. Hindsight credit assignment. arXiv preprint arXiv:1912.02503, 2019. +[47] Jose A Arjona-Medina, Michael Gillhofer, Michael Widrich, Thomas Unterthiner, Johannes Brandstetter, and Sepp Hochreiter. Rudder: Return decomposition for delayed rewards. arXiv preprint arXiv:1806.07857, 2018. +[48] Yang Liu, Yunan Luo, Yuanyi Zhong, Xi Chen, Qiang Liu, and Jian Peng. Sequence modeling of temporal credit assignment for episodic reinforcement learning. arXiv preprint arXiv:1905.13420, 2019. +[49] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Conference on Computer Vision and Pattern Recognition, 2019. +[50] Marjan Ghazvininejad, Xing Shi, Jay Priyadarshi, and Kevin Knight. Hafez: an interactive poetry generation system. In Proceedings of ACL, System Demonstrations, 2017. +[51] Lilian Weng. Controllable neural text generation. lilianweng.github.io/lillog, 2021. URL https://lilianweng.github.io/lil-log/2021/01/02/ controllable-neural-text-generation.html. +[52] Jessica Ficler and Yoav Goldberg. Controlling linguistic style aspects in neural language generation. arXiv preprint arXiv:1707.02633, 2017. +[53] Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P Xing. Toward controlled generation of text. In International Conference on Machine Learning, 2017. +[54] Nazneen Fatema Rajani, Bryan McCann, Caiming Xiong, and Richard Socher. Explain yourself! leveraging language models for commonsense reasoning. arXiv preprint arXiv:1906.02361, 2019. +[55] Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. Seqgan: Sequence generative adversarial nets with policy gradient. In AAAI conference on artificial intelligence, 2017. +[56] Daniel M Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv preprint arXiv:1909.08593, 2019. +[57] Nitish Shirish Keskar, Bryan McCann, Lav R Varshney, Caiming Xiong, and Richard Socher. Ctrl: A conditional transformer language model for controllable generation. arXiv preprint arXiv:1909.05858, 2019. +[58] Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. Plug and play language models: A simple approach to controlled text generation. arXiv preprint arXiv:1912.02164, 2019. +[59] Ari Holtzman, Jan Buys, Maxwell Forbes, Antoine Bosselut, David Golub, and Yejin Choi. Learning to write with cooperative discriminators. arXiv preprint arXiv:1805.06087, 2018. +[60] Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq Joty, Richard Socher, and Nazneen Fatema Rajani. Gedi: Generative discriminator guided sequence generation. arXiv preprint arXiv:2009.06367, 2020. +[61] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. +[62] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, 2020. +[63] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. +[64] Sam Ritter, Ryan Faulkner, Laurent Sartran, Adam Santoro, Matt Botvinick, and David Raposo. Rapid task-solving in novel environments. arXiv preprint arXiv:2006.03662, 2020. +[65] Sudeep Dasari and Abhinav Gupta. Transformers for one-shot visual imitation. arXiv preprint arXiv:2011.05970, 2020. +[66] Josh Abramson, Arun Ahuja, Iain Barr, Arthur Brussee, Federico Carnevale, Mary Cassin, Rachita Chhaparia, Stephen Clark, Bogdan Damoc, Andrew Dudzik, et al. Imitating interactive intelligence. arXiv preprint arXiv:2012.05672, 2020. \ No newline at end of file diff --git a/md/train/ajOrOhQOsYx/ajOrOhQOsYx.md b/md/train/ajOrOhQOsYx/ajOrOhQOsYx.md new file mode 100644 index 0000000000000000000000000000000000000000..ec124f89ffb5701e8bf1f54b2c2d8717e3bfc155 --- /dev/null +++ b/md/train/ajOrOhQOsYx/ajOrOhQOsYx.md @@ -0,0 +1,3585 @@ +# A WIGNER-ECKART THEOREM FOR GROUP EQUIVARIANT CONVOLUTION KERNELS + +Leon Lang∗ +AMLab, CSL +University of Amsterdam +l.lang@uva.nl + +Maurice Weiler AMLab, QUVA Lab University of Amsterdam m.weiler.ml@gmail.com + +# ABSTRACT + +Group equivariant convolutional networks (GCNNs) endow classical convolutional networks with additional symmetry priors, which can lead to a considerably improved performance. Recent advances in the theoretical description of GCNNs revealed that such models can generally be understood as performing convolutions with $G$ -steerable kernels, that is, kernels that satisfy an equivariance constraint themselves. While the $G$ -steerability constraint has been derived, it has to date only been solved for specific use cases – a general characterization of $G$ - steerable kernel spaces is still missing. This work provides such a characterization for the practically relevant case of $G$ being any compact group. Our investigation is motivated by a striking analogy between the constraints underlying steerable kernels on the one hand and spherical tensor operators from quantum mechanics on the other hand. By generalizing the famous Wigner-Eckart theorem for spherical tensor operators, we prove that steerable kernel spaces are fully understood and parameterized in terms of 1) generalized reduced matrix elements, 2) ClebschGordan coefficients, and 3) harmonic basis functions on homogeneous spaces. + +# 1 INTRODUCTION + +Undoubtedly, symmetries play a central role in the formulation of physical theories. Any imposed symmetry greatly reduces the set of admissible physical laws and dynamics. Specifically in quantum mechanics, the Hilbert space of a system is equipped with a group representation which specifies the transformation law of system states. Quantum mechanical operators, which map between different states, are required to respect these transformation laws. That is, any symmetry transformation of a state on which they act should lead to a corresponding transformation of the resulting state after their action. This requirement imposes a symmetry constraint on the operators themselves – only specific operators can map between a given pair of states. + +The situation in equivariant deep learning is remarkably similar to that in physics. Instead of a physical system, one considers in this case some learning task subject to symmetries. For instance, image segmentation is usually assumed to be translationally symmetric: a shift of the input image should lead to a corresponding shift of the predicted segmentation mask. Convolutional networks guarantee this property via their inherent translation equivariance. The role of the quantum states is in equivariant deep learning taken by the features in each layer, which are due to the enforced equivariance endowed with some transformation law. The analog of quantum mechanical operators, mapping between states, is the neural connectivity, mapping between features of consecutive layers. As in the case of operators, there is a symmetry (equivariance) constraint on the neural connectivity – only specific connectivity patterns guarantee a correct transformation law of the resulting features. + +In this work we are considering group equivariant convolutional networks (GCNNs), which are convolutional networks that are equivariant w.r.t. symmetries of the space on which the convolution is performed. Typical examples are isometry equivariant CNNs on Euclidean spaces (Weiler & Cesa, 2019) or spherical CNNs (Cohen et al., 2018). Many different formulations of GCNNs have been proposed, however, it has recently been shown that $H$ -equivariant GCNNs on homogeneous spaces + +$H / G$ can in a fairly general setting be understood as performing convolutions with $G$ -steerable kernels (Cohen et al., 2019b). Convolutional weight sharing hereby guarantees the equivariance under “translations” of the space while $G$ -steerability is a constraint on the convolution kernel that ensures its equivariance under the action of the stabilizer subgroup $G \ : < \ : H$ . Although the space of $G$ - steerable kernels has been characterized for specific choices of groups $G$ and feature transformation laws, i.e., group representations $\rho$ , see Section 5, no general solution was known so far. This work characterizes the solution space for arbitrary compact groups $G$ . + +Our solution is motivated by the close resemblance of the $G$ -steerability kernel constraint to the defining constraint of spherical tensor operators (or more general representation operators (Jeevanjee, 2011)) in quantum mechanics. The famous Wigner-Eckart theorem describes the general structure of these operators by Clebsch-Gordan coefficients, with the degrees of freedom given by reduced matrix elements. By generalizing this theorem, we find a general characterization and parameterization of $G$ -steerable kernel spaces. For specific examples, like $G = \mathrm { S O ( 3 ) }$ or compact subgroups of $G = \mathrm { O } ( 2 )$ , our kernel space solution specializes to earlier work, e.g., Worrall et al. (2016); Thomas et al. (2018); Weiler & Cesa (2019). Our main contributions are the following: + +• We present a generalized Wigner-Eckart theorem 4.1 for $G$ -steerable kernels. It describes the general structure of equivariant kernels in terms of 1) endomorphism bases, which generalize reduced matrix elements, 2) Clebsch-Gordan coefficients, and 3) harmonic basis functions on a suitable homogeneous space. In contrast to the usual formulation, we cover any compact group $G$ and both real and complex representations. • Corollary 4.2 explains how to parameterize $G$ -steerable kernels and thus GCNNs. • We apply the theorem exemplarily to solve for the kernel spaces for the symmetry groups SO(2) , $\mathbb { Z } / 2$ , SO(3) and O(3) , considering both real and complex representations. Thereby, we demonstrate that the endomorphism bases, Clebsch-Gordan coefficients, and harmonic basis functions can usually be determined for practically relevant symmetry groups. + +# 2 SYMMETRY-CONSTRAINED OPERATORS AND THEIR MATRIX ELEMENTS + +To motivate our generalized Wigner-Eckart theorem, we review quantum mechanical representation operators and $G$ -steerable kernels with an emphasis on the similarity of their underlying symmetry constraints. Due to their symmetries, the matrix elements of such operators and kernels are fully specified by a comparatively small number of reduced matrix elements or learnable parameters, respectively. This reduction is for representation operators described by the Wigner-Eckart theorem. For clarity, we discuss this theorem in its most popular form, i.e., for spherical tensor operators (SO(3)-representation operators transforming under irreducible representations). + +The Representation Operator Constraint Consider a quantum mechanical system with symmetry under the action of some group $G$ , for instance rotations. The action of this symmetry group on quantum states is modeled by some unitary $G$ -representation1 $U : G \to \operatorname { U } ( { \mathcal { H } } )$ on the Hilbert space $\mathcal { H }$ . More specifically, $G$ acts on kets according to $\left| \psi \right. \mapsto \left| \psi ^ { \prime } \right. : = U ( g ) \left| \psi \right.$ and on bras according to $\langle \psi | \mapsto \mathcal { \bar { \langle } } \psi ^ { \prime } | : = \bar { \langle } \psi | U ( g ) ^ { \dagger }$ , where $U ( g ) ^ { \dagger }$ is the adjoint of $U ( g )$ . Observables of the system correspond to self-adjoint operators $A = A ^ { \dagger }$ . The expectation value of such an observable in some quantum state $| \psi \rangle$ is given by $\langle \psi | A | \psi \rangle \in \mathbb { R }$ . + +The transformation behaviors of states and observables need to be consistent with each other. As an example, consider a system consisting of a single, free particle in $\mathbb { R } ^ { 3 }$ , which is (among other symmetries) symmetric under rotations $\bar { G } = \mathrm { S O } ( \bar { 3 } )$ . The momentum of the particle in the direction of the three frame axes is measured by the three momentum operators $( P _ { 1 } , P _ { 2 } , P _ { 3 } )$ . Since the momentum of a classical particle transforms geometrically like a vector, one needs to demand the same for the momentum observable expectation values. If we denote by $p _ { i } : = \langle \psi | P _ { i } | \psi \rangle$ the expected momentum in $i$ -direction, this means that the expected momentum of a rotated system is given by $\begin{array} { r } { p _ { i } ^ { \prime } = \sum _ { j } R _ { i j } p _ { j } = \sum _ { j } R _ { i j } \langle \psi | P _ { j } | \psi \rangle } \end{array}$ , where $\bar { R } \in \mathrm { S O } ( 3 )$ is an element of the rotation group. This result should agree with the expectation values for rotated system states, that is, $p _ { i } ^ { \prime } \stackrel { } { = } \langle \psi ^ { \prime } | P _ { i } | \psi ^ { \prime } \rangle = \langle \psi | U ( R ) ^ { \dagger } \bar { P } _ { i } U ( R ) | \psi \rangle$ . As this argument is independent from the particular choice of state $| \psi \rangle$ , and making use of the linearity of the operations, this implies a consistency constraint $\begin{array} { r } { \sum _ { j } R _ { i j } P _ { j } \ = \ U ( R ) ^ { \dagger } P _ { i } U ( R ) } \end{array}$ , which identifies the collection $( P _ { 1 } , P _ { 2 } , P _ { 3 } )$ as a vector operator. Other geometric quantities are required to satisfy similar constraints: For instance, energy is a scalar (i.e., invariant) quantity and the Hamilton operator $H$ is a scalar operator, satisfying $\overset { \vartriangle } { \boldsymbol { H } } = \boldsymbol { U } ( \boldsymbol { R } ) ^ { \dagger } \boldsymbol { H } \boldsymbol { U } ( \boldsymbol { R } )$ . Similarly, any matrix valued classical quantity corresponds to a rank $( 1 , 1 )$ Cartesian tensor operator $( M _ { i j } ) _ { i , j = 1 , 2 , 3 }$ subject to $\begin{array} { r } { \sum _ { k l } R _ { i k } \hat { M _ { k l } } ( \bar { R } ^ { - 1 } ) _ { l j } = \hat { U } ( R ) ^ { \dagger } M _ { i j } U ( R ) } \end{array}$ . The overarching framework to study such situations is the notion of a representation operator, which we define as a family of operators $( A _ { 1 } , \dotsc , A _ { N } )$ which are required to satisfy the constraint + +$$ +{ \sum } _ { j = 1 } ^ { N } { \pi } ( g ) _ { i j } A _ { j } \ = \ U ( g ) ^ { \dagger } A _ { i } U ( g ) \qquad \forall g \in G , +$$ + +where $\pi : G \to \mathrm { U } ( \mathbb { C } ^ { N } )$ is some unitary representation of the symmetry group under consideration. The examples above correspond to specific choices of representations, namely the trivial representation $\pi ( \bar { R } ) = 1$ for scalars, the “standard” representation $\pi ( R ) = R$ for vectors and the tensor product representation $\pi ( R ) = R \otimes ( R ^ { - 1 } ) ^ { \top }$ for matrices. Spherical tensor operators, discussed below, correspond to the irreps (irreducible representations) of SO(3). + +The Steerable Kernel Constraint Convolution kernels of group equivariant CNNs are required to satisfy a very similar constraint to that in Eq. (1). Before coming to such GCNNs, consider the case of conventional CNNs, processing image-like signals on a Euclidean space $\mathbb { R } ^ { d }$ . Such signals are formalized as $c$ -channel feature maps $\overline { { f } } : \mathbb { R } ^ { d } \ : \ : \mathbb { K } ^ { c }$ that assign a $c$ -dimensional feature vector $f ( x ) \in \mathbb { K } ^ { c }$ to each point $\boldsymbol { x } \in \mathbb { R } ^ { d }$ , where we allow for K being either of the real or complex numbers $\mathbb { R }$ or C. Each CNN layer maps its input feature map $f _ { \mathrm { i n } } : \mathbb { R } ^ { \tilde { d } } \to \mathbb { K } ^ { c _ { \mathrm { i n } } }$ via a convolution to an output feature map $f _ { \mathrm { o u t } } : = \dot { K } \star f _ { \mathrm { i n } } \dot { : } \mathbb { R } ^ { d } \dot { } \mathbb { K } ^ { c _ { \mathrm { o u t } } }$ . Since the convolution maps $c _ { \mathrm { i n } }$ input channels to $c _ { \mathrm { o u t } }$ output channels, the kernel $K : \mathbb { R } ^ { d } \mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ is matrix-valued. + +Conventional CNNs are translation equivariant, however it is often desirable that the convolution is equivariant w.r.t. a larger symmetry group, for instance the isometries $\operatorname { E } ( d )$ of $\mathbb { R } ^ { d }$ (Weiler & Cesa, 2019). For simplicity, we consider semidirect product groups of the form $( \ln ^ { d } , + ) \rtimes G$ , where $G \leq \mathrm { G L } ( d )$ is any compact group. Group elements $t g \in ( \mathbb { R } ^ { d } , + ) \rtimes G$ are uniquely split into a translation $t \in ( \mathbb { R } ^ { \dot { d } } , + )$ and an element $g \in G$ , stabilizing the origin. They act on $\mathbf { \bar { \mathbb { R } } } ^ { d }$ according to $x \mapsto ( t g ) \cdot x : = g x + t$ . The equivariance of a GCNN – which is the analog to the symmetry of a quantum mechanical system – requires the feature spaces to be endowed with a group action of the symmetry group. A natural choice is to model the feature spaces as spaces of feature fields, for instance scalar, vector or tensor fields (Cohen & Welling, 2016b). + +Such feature fields are defined as functions $f : \mathbb { R } ^ { d } V$ , where the difference to conventional feature maps is that the space $V \cong \mathbb { K } ^ { c }$ of feature vectors is equipped with a group representation $\rho : G \to { \mathrm { G L } } ( V )$ of the stabilizer $G$ . The full symmetry group acts on feature fields according to $f \mapsto ( t g ) \cdot \dot { f } : = \rho ( g ) \circ f \circ ( t g ) ^ { - 1 }$ , which is known as the induced representation of $\rho$ . As proven in (Weiler et al., 2018a), the most general linear and equivariant map from an input field $f _ { \mathrm { i n } } : \mathbb { R } ^ { d } \to V _ { \mathrm { i n } }$ to an output field $f _ { \mathrm { o u t } } : \bar { \mathbb { R } } ^ { d } \to V _ { \mathrm { o u t } }$ is a convolution with a $G$ -steerable kernel $K : \mathbb { R } ^ { d } \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \cong \mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ . Such kernels take values in the space of linear operators from $V _ { \mathrm { i n } }$ to $V _ { \mathrm { o u t } }$ and are required to satisfy the $G$ -steerability (equivariance) constraint + +$$ +K ( g x ) = \rho _ { \mathsf { o u t } } ( g ) \circ K ( x ) \circ \rho _ { \mathsf { i n } } ( g ) ^ { - 1 } \qquad \forall g \in G , x \in \mathbb { R } ^ { d } . +$$ + +One can easily check that a convolution with a $G$ -steerable kernel $K$ is indeed equivariant, i.e., satisfies $K \star ( { \dot { ( } } t g ) \cdot f ) = ( t g ) \cdot ( K \star f )$ for any $t g \in ( \mathbb { R } ^ { d } , + ) \rtimes G$ . This result was later generalized to feature fields on homogeneous spaces $H / G$ of unimodular locally compact groups $H$ (Cohen et al., 2019b) and on Riemannian manifolds with structure group $G$ (Cohen et al., 2019a). That the equivariance of the convolutional network requires $G$ -steerable kernels in any of these settings underlines the great practical relevance of our results. + +The two constraints, Eq. (1) and Eq. (2), are remarkably similar: the left-hand-sides are in both cases given by a $G$ -transformation of the operator or kernel itself while the right-hand-sides are given by pre- and postcomposition of the operator or kernel with unitary representations. More details on this comparison can be found in Appendix C.1.3. + +The Wigner-Eckart Theorem for Spherical Tensor Operators All information about a linear operator $A : { \mathcal { H } } \to { \mathcal { H } }$ is encoded by its matrix elements $A _ { \mu \nu } ~ : = ~ \langle \mu | A | \nu \rangle ~ \in ~ \mathbb { C }$ relative to a given basis, where $\vert \nu \rangle \in { \mathcal { H } }$ and $\langle \mu | \in { \mathcal { H } } ^ { * }$ denote basis elements of the Hilbert space and its dual. Similarly, all information about a convolution kernel $K$ is encoded by its matrix elements $K _ { \mu \nu } ( x ) : = \langle \mu | K ( x ) | \nu \rangle \in \mathbb { K }$ , where $| \nu \rangle \in V _ { \mathrm { i n } }$ and $\langle \mu \vert \in V _ { \mathrm { o u t } } ^ { * }$ are elements of chosen bases for the input representation and dual output representation. Considering general operators and kernels, i.e., ignoring the symmetry constraints in Eqs. (1) and (2), all matrix elements are independent degrees of freedom. In the case of convolution kernels, they correspond directly to the $c _ { \mathrm { o u t } } \cdot c _ { \mathrm { i n } }$ learnable parameters for every point of the kernel. However, if $A$ is a representation operator – or if $K$ is a $G$ -steerable kernel – the symmetry constraints couple the matrix elements to each other such that they can not be chosen freely anymore. For representation operators, this statement is made precise by the Wigner-Eckart theorem. + +The Wigner-Eckart theorem is best known in its classical form, which applies specifically to spherical tensor operators. These operators are the representation operators for the irreps of SO(3), i.e., the Wigner D-matrices $D _ { j } : \dot { \mathrm { S O } } ( 3 ) \mathrm { U } ( \mathbb { C } ^ { 2 j + \hat { 1 } } )$ . As such, spherical tensor operators of rank $j$ are defined as families $\pmb { T } _ { j } = ( T _ { j } ^ { - j } , \dots , T _ { j } ^ { j } ) ^ { \top }$ of $2 j + 1$ operators $T _ { j } ^ { m }$ that satisfy the constraint $\begin{array} { r } { \sum _ { n = - j } ^ { j } D _ { j } ^ { m n } ( g ) T _ { j } ^ { n } = U ( g ) ^ { \dagger } T _ { j } ^ { \phantom { \dagger } } U ( g ) } \end{array}$ for any $g \in \mathrm { S O } ( 3 )$ . + +In order to express the operators $T _ { j } ^ { m }$ in terms of matrix elements, we need to fix a basis of $\mathcal { H }$ . Due to the SO(3)-symmetry of $\mathbf { \delta } _ { T _ { j } }$ , a natural choice are the angular momentum eigenstates2 $| l n \rangle$ , where $l \in { \mathbb { N } } _ { \geq 0 }$ and $n = - l , \ldots , l$ . For fixed quantum numbers $j , l$ , and $J$ , there are $2 j + 1$ components $T _ { j } ^ { m }$ of $\mathbf { \delta } _ { T _ { j } }$ , $2 l + 1$ basis kets $| l n \rangle$ , and $2 J + 1$ basis bras $\langle J M \vert$ . This implies that there are $( 2 J + 1 ) ( 2 j + 1 ) ( 2 l + 1 )$ different matrix elements $\left. J M | T _ { j } ^ { m } | l n \right. \in \mathbb { C }$ for these quantum numbers. According to the Wigner-Eckart theorem, all of these matrix elements are fully specified by one single number (Jeevanjee, 2011): + +Theorem 2.1 (Wigner-Eckart theorem for Spherical Tensor Operators). Let $j , l , J \ \in \ \mathbb { N } _ { \ge 0 }$ and let $\mathbf { \delta } _ { T _ { j } }$ be a spherical tensor operator of rank $j$ . Then there is a unique complex number, the reduced matrix element $\lambda \in \mathbb { C }$ (often written $\langle J \| T _ { j } \| l \rangle \in \mathbb { C } )$ , that completely determines any of the $( 2 J + 1 ) ( 2 j + 1 ) ( 2 l + 1 )$ matrix elements $\langle J M | T _ { j } ^ { m } | l n \rangle$ by the relation + +$$ +\langle J M | T _ { j } ^ { m } | l n \rangle = \lambda \cdot \langle J M | j m ; l n \rangle . +$$ + +The coupling coefficients $\langle J M | j m ; l n \rangle$ , known as Clebsch-Gordan coefficients, are given by the projection of the tensor product basis $| j m ; l n \rangle : = | j m \rangle \otimes | l n \rangle$ on $\vert J M \rangle$ . They are purely algebraic and therefore independent of the spherical tensor operator $\mathbf { \delta } _ { T _ { j } }$ . + +This result generalizes to arbitrary representation operators of the form in Eq. (1) (Agrawala, 1980). The similarities between representation operators and $G$ -steerable kernels suggests that a similar statement might hold for the matrix elements of $G$ -steerable kernels as well. As proven below, this is indeed the case: our generalized Wigner-Eckart theorem separates their independent degrees of freedom from purely algebraic relations between mutually dependent matrix elements. It does therefore give an explicit parametrization of the space of $G$ -steerable kernels. + +# 3 BUILDING BLOCKS OF STEERABLE KERNELS + +This chapter gives a brief introduction to the mathematical concepts that are required to formulate our Wigner-Eckart theorem for $G$ -steerable kernels. The first two of the following paragraphs explain why it is w.l.o.g. possible to restrict attention to steerable kernels on homogeneous spaces and to irreducible representations. The following three paragraphs discuss the building blocks of steerable kernels, which are endomorphisms, harmonic basis functions described by the Peter-Weyl theorem, and tensor product representations and their Clebsch-Gordan decomposition. An illustration of the concepts introduced in this chapter is given in Appendix A. + +The Restriction to Homogeneous Spaces Convolution kernels are usually defined on a Euclidean space $\mathbb { R } ^ { d }$ , i.e., they are functions $\hat { K ^ { \mathbf { \alpha } } } \colon { \mathbb { R } ^ { d } } \to \operatorname { H o m } _ { { \mathbb { K } } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . The $G$ -steerability constraint in Eq. (2) relates kernel values $K ( x )$ at $x$ to kernel values $K ( g x )$ at all other points $g x$ on the orbit $G { \bar { x } } : = \{ g x \vert g \in G \}$ of $x$ . To solve the constraint, it is therefore w.l.o.g. sufficient to consider restrictions of kernels to the individual orbits, from which the full solution on $\mathbb { R } ^ { d }$ can be assembled (Weiler et al., 2018a). By construction, the orbits have the structure of a homogeneous space: + +Definition 3.1 (Homogeneous Space, Transitive Action). Let $\cdot : G { \times } X \to X$ be a continuous action of a compact group $G$ on a topological space $X$ . Then $X$ is called a homogeneous space w.r.t. $G$ if $\varnothing \neq X$ and if for all $x , y \in X$ there is a $g \in G$ such that $g x = y$ . The action is then called transitive. + +We will in the following w.l.o.g. consider steerable kernels $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ on such homogeneous spaces $X$ . + +Restriction to Irreducible Unitary Representations The theorems below apply specifically to unitary representations, that is, representations for which the automorphisms $\rho ( g )$ preserve distances (Knapp, 2002). As asserted by Theorem B.20, this is not really a restriction as every finite-dimensional linear representation can be considered as being unitary. Thus, we assume $\rho : G \to \operatorname { U } ( V )$ , where $\mathrm { U } ( V )$ is the unitary group, i.e., the group of distance-preserving linear functions on $V$ . In the case of $\mathbb { K } = \mathbb { R }$ we say orthogonal instead of unitary and write $\mathrm { O } ( V )$ . + +Additionally, prior research has shown that it is sufficient to solve the kernel constraint in Eq. (2) for irreducible (unitary) input- and output representations instead of arbitrary finite-dimensional representations (Weiler & Cesa, 2019). This is possible due to the linearity of the constraint and the fact that any finite-dimensional unitary representation decomposes by Proposition B.38 into an orthogonal direct sum of irreps. The solution for general representations can thus be recovered from the solutions for irreps. More details on these considerations can be found in Section D.1.3. + +If two unitary irreps are related by an isometric intertwiner, they are isomorphic; see Definition B.18. The set of isomorphism classes of unitary irreps of $G$ is denoted by $\widehat { G }$ . We assume that for each isomorphism class $j \in { \widehat { G } }$ we have picked a representative irrep $\rho _ { j } : G \to \operatorname { U } ( V _ { j } )$ . We denote by $d _ { j }$ the dimension of $V _ { j }$ , so that we have $V _ { j } \cong \mathbb { K } ^ { d _ { j } }$ . + +Overall, we can w.l.o.g. replace $\mathbb { R } ^ { d }$ with $X$ and $\rho _ { \mathrm { i n } }$ and $\rho _ { \mathrm { o u t } }$ by $\rho _ { l } : G \to { \mathrm { U } } ( V _ { l } )$ and $\rho _ { J } : G \to$ $\mathrm { U } ( V _ { J } )$ , where $X$ is a homogeneous space and $\rho _ { l }$ and $\rho _ { J }$ are (representatives of isomorphism classes of) irreducible unitary representations of $G$ . This leads to our working definition of steerable kernels, to which we restrict from now on: + +Definition 3.2 (Steerable Kernel on a Homogeneous Space w.r.t. Unitary Irreps). Let $X$ be a homogeneous space of $G$ and $\rho _ { l } : G \to \operatorname { U } ( V _ { l } )$ and $\rho _ { J } : G \to \operatorname { U } ( V _ { J } )$ be representatives of isomorphism classes of irreducible unitary representations of $G$ . A $G$ -steerable kernel (on a homogeneous space and w.r.t. unitary irreps) is any function $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ such that the following $G$ - steerability constraint holds: + +$$ +K ( g x ) = \rho _ { J } ( g ) \circ K ( x ) \circ \rho _ { l } ( g ) ^ { - 1 } \qquad \forall g \in G , x \in X . +$$ + +Endomorphisms An important concept, underlying the reduced matrix elements in the WignerEckart theorem for spherical tensor operators, is that of endomorphisms of linear representations. + +Definition 3.3 (Endomorphism of a of Linear Representation). Let $\rho : G \to { \mathrm { G L } } ( V )$ be a linear representation. An endomorphism of $\rho$ is a linear map $c : V V$ which satisfies $\dot { c } \circ \dot { \rho } ( g ) = \rho ( g ) \dot { \circ } c$ for all $g \in G$ . The space of all endomorphisms of $\rho$ is written $\operatorname { E n d } _ { G , \mathbb { K } } ( V )$ . + +Endomorphisms play a central role in our generalized Wigner-Eckart theorem for steerable kernels. To get an insight why this is the case, consider a given steerable kernel $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ . The post-composition $( c \circ K ) ( x ) : = c \circ ( K ( \bar { x } ) )$ of this kernel with any endomorphism $c \in$ $\operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ is obviously still steerable, i.e., satisfies Eq. (3). A basis of the space of steerable kernels is therefore partly explained by bases of the endomorphism spaces, and thus occurs in our general solution. In the following, we write $\{ c _ { r } \mid r = 1 , \ldots , E _ { J } \}$ for the basis of $\operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ , where $E _ { J } : = \dim ( \operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } ) )$ is the dimension of the endomorphism space.3 + +The Peter-Weyl Theorem and Harmonic Basis Functions A cornerstone in our proof of the Wigner-Eckart theorem for steerable kernels is Theorem C.7. It states that the space of steerable kernels, which are $G$ -equivariant maps $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ , is isomorphic to the space of linear $G$ -equivariant maps of the form $\widehat { K } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ . We are therefore interested in the representation theory of $L _ { \mathbb { K } } ^ { 2 } ( X )$ , which is described by the Peter-Weyl theorem.4 + +Theorem 3.4 (Peter-Weyl Theorem, Existence of Harmonic Basis Functions). Let $G$ be a compact group and $X$ a homogeneous space. Let $\widehat { G }$ be the set of isomorphism classes of irreducible representations. For $j \in { \widehat { G } }$ , let $\rho _ { j } : G \to \operatorname { U } ( V _ { j } )$ be a representative with dimension $d _ { j } = \dim ( V _ { j } )$ . Then there are multiplicities $m _ { j } \in \mathbb { N } _ { \geq 0 }$ with $\bar { m } _ { j } \leq d _ { j }$ , and for each $i = 1 , \ldots , m _ { j }$ there are harmonic basis functions $Y _ { j i } ^ { m } : X \mathbb { K }$ , $m = 1 , \ldots , d _ { j }$ , such that the following three properties hold: + +1. The $Y _ { j i } ^ { m }$ , for fixed $j$ and $i$ , are steerable (Freeman & Adelson, 1991; Hel-Or & Teo, 1998), i.e., transformation via $g \in G$ can be expressed by shifting basis coefficients with $\rho _ { j }$ : $\begin{array} { r } { Y _ { j i } ^ { m } ( g ^ { - 1 } x ) = \Big ( \sum _ { m ^ { \prime } = 1 } ^ { d _ { j } } \rho _ { j } ^ { m ^ { \prime } m } ( g ) Y _ { j i } ^ { m ^ { \prime } } \Big ) ( x ) . } \end{array}$ + +2. Any square-integrable function $f : X \to \mathbb { K }$ can be uniquely expanded in terms of harmonic basis functions, i.e., $\begin{array} { r } { \mathrm { \Delta } f \ = \ \sum _ { j \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { m = 1 } ^ { d _ { j } } \lambda _ { j i m } Y _ { j i } ^ { m } } \end{array}$ with coefficients $\lambda _ { j i m } \in \mathbb { K }$ . + +3. The $Y _ { j i } ^ { m }$ are an orthonormal system with respect to the scalar product given by integration: $\begin{array} { r } { \int _ { X } \overline { { Y _ { j i } ^ { m } ( x ) } } Y _ { j ^ { \prime } i ^ { \prime } } ^ { m ^ { \prime } } ( x ) d x = \delta _ { j j ^ { \prime } } \delta _ { i i ^ { \prime } } \delta _ { m m ^ { \prime } } . } \end{array}$ 5 + +Note the similarity of these properties to those encountered in usual Fourier analysis. Indeed, the Peter-Weyl theorem can be viewed as describing the harmonic analysis on arbitrary compact groups and their homogeneous spaces. + +Tensor Products and Clebsch-Gordan Coefficients The last ingredients that we need to discuss are tensor product representations and Clebsch-Gordan coefficients. They appear, roughly speaking, in the following way: the kernel $K$ can be thought of as being built from harmonic basis functions $Y _ { j i } ^ { m }$ whype transform according to the correspondacts on an input feature field of type g irrep , the c $\rho _ { j }$ . When a harmonic kernel componentbination will transform according to $\rho _ { j }$ $\rho _ { l }$ +their tensor product $\rho _ { j } \otimes \rho _ { l }$ . If the convolution should map to an output field of type $\rho _ { J }$ , not any harmonic component $Y _ { j i } ^ { m }$ is admissible, but only those for which $\rho _ { J }$ appears as a subrepresentation in the tensor product $\rho _ { j } \otimes \rho _ { l }$ . The Clebsch-Gordan coefficients encode whether $\rho _ { j } \otimes \rho _ { l }$ contains $\rho _ { J }$ , and, if it does, in which way and how often $\rho _ { J }$ is embedded in the tensor product. For more details on the definitions in this section see Appendix D.1. + +Definition 3.5 (Tensor product representation). Let $\rho : G \to \operatorname { U } ( V )$ and $\tilde { \rho } : G \to \mathrm { U } ( \tilde { V } )$ be unitary representations. Then their tensor product $\rho \otimes { \tilde { \rho } } : G \to \operatorname { U } ( V \otimes { \tilde { V } } )$ is defined by: $\left[ ( \boldsymbol { \rho } \otimes \tilde { \boldsymbol { \rho } } ) ( \boldsymbol { g } ) \right] ( \boldsymbol { v } \otimes \boldsymbol { \rho }$ $\tilde { v } ) \ = \ \left[ \rho ( g ) \right] ( v ) \otimes \left[ \tilde { \rho } ( g ) \right] ( \tilde { v } )$ . + +The tensor product $\rho _ { j } \otimes \rho _ { l }$ of two irreps is itself in general not irreducible anymore. However, as it is again a unitary representation, it splits by Proposition B.38 into a direct sum of irreducible unitary subrepresentations. Thus, there is an equivariant isomorphism + +$$ +\mathrm { C G } _ { j l } : V _ { j } \otimes V _ { l } \to \bigoplus _ { J \in \widehat { G } } \bigoplus _ { s = 1 } ^ { [ J ( j l ) ] } V _ { J } . +$$ + +The integer $\left[ J ( j l ) \right]$ is the multiplicity of $V _ { J }$ in $V _ { j } \otimes V _ { l }$ , which is zero for all but finitely many $J$ . + +The matrix elements of $\mathrm { C G } _ { j l }$ are denoted as Clebsch-Gordan coefficients: + +Definition 3.6 (Clebsch-Gordan Coefficients). Let $Y _ { j } ^ { m } \otimes Y _ { l } ^ { n }$ be the basis tensors in $V _ { j } \otimes V _ { l }$ and let the basis element $Y _ { J s } ^ { M }$ be the copy of $Y _ { J } ^ { M }$ with index $s$ in $\oplus _ { J \in { \widehat { G } } } \oplus _ { s = 1 } ^ { [ J ( j l ) ] } V _ { J }$ L[J(jl)]s=1 VJ . Then the ClebschGordan coefficients are the matrix elements of $\mathrm { C G } _ { j l }$ brelative to these bases, + +$$ + s , J M | j m ; l n : = Y _ { J s } ^ { M } | \mathrm { C G } _ { j l } | Y _ { j } ^ { m } \otimes Y _ { l } ^ { n } , +$$ + +i.e., the scalar product of $\underline { { \mathrm { C G } _ { j l } } } \left( Y _ { j } ^ { m } \otimes Y _ { l } ^ { n } \right)$ and $Y _ { J s } ^ { M }$ . + +4Usually, the Peter-Weyl theorem uses $G$ itself as the homogeneous space and is formulated for complex representations (Knapp, 2002). However, generalizations to arbitrary homogeneous spaces and real representations are possible, as we explain in Appendix B.2 + +5From a representation theoretic viewpoint, the functions $Y _ { j i } ^ { m }$ for fixed $j$ and $_ { i }$ span an irreducible subrepresentation $V _ { j i }$ of the unitary representation $\lambda : G \to \operatorname { U } ( L _ { \mathbb { K } } ^ { 2 } ( X ) )$ given by $\left[ \lambda ( g ) f \right] ( x ) : = f ( g ^ { - 1 } x ) . \ L _ { \mathbb { K } } ^ { 2 } ( X )$ then splits into an orthogonal direct sum $L _ { \mathbb { K } } ^ { 2 } ( X ) = { \widehat { \bigoplus } } _ { j \in { \widehat { G } } } \bigoplus _ { i = 1 } ^ { m _ { j } } V _ { j i }$ . This viewpoint is explained in the equivalent, more representation theoretic formulation of the Peter-Weyl theorem in Theorem B.22. + +# 4 A WIGNER-ECKART THEOREM FOR $G$ -STEERABLE KERNELS + +Now that we have discussed all of the required ingredients, we are ready for stating our main theorem. Intuitively, our Wigner-Eckart theorem identifies exactly those combinations of harmonics, Clebsch-Gordan coefficients and endomorphisms that, when being assembled together, yield a $G$ - steerable kernel $K : X \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ . The kernel will thereby comprise all those harmonics $Y _ { j i } ^ { m }$ for which the tensor product $V _ { j } \otimes V _ { l }$ contains $V _ { J }$ as a factor. The number of possible combinations depends therefore on the number of different isomorphism classes $j \in { \widehat { G } }$ for which $V _ { J }$ appears as a factor in the tensor product, the multiplicity $\left[ J ( j l ) \right]$ with which it occurs, and the multiplicities $m _ { j }$ of harmonics $Y _ { j i } ^ { m }$ in the Peter-Weyl decomposition that transform according to $\rho _ { j }$ . In addition, each individual combination can subsequently be composed with an endomorphism in $\operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ , which increases the number of combinations by a factor of $E _ { J } = \dim ( \operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } ) )$ to a total of $\begin{array} { r } { \Lambda _ { J l } : = E _ { J } \cdot \sum _ { j \in \widehat { G } } \left[ J ( j l ) \right] \cdot m _ { j } } \end{array}$ . This number is finite, as we explain in Remark D.18. + +How are such assembled steerable kernels parameterized? The learnable parameters correspond to the degrees of freedom in the individual components from which the kernel is built. While the Clebsch-Gordan coefficients and harmonic basis functions are fixed, the endomorphisms are elements of the $E _ { J }$ -dimensional vector spaces $\operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ . The degrees of freedom of a $G$ -steerable kernel are therefore identified with the choice of endomorphisms.6 This gives a total of $\Lambda _ { J l }$ parameters which take values in $\mathbb { K }$ . Note that the choice of endomorphisms corresponds directly to the choice of reduced matrix elements of spherical tensor operators. + +For a kernel $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ , we write $\langle J M | K ( x ) | l n \rangle$ for the matrix elements of $K ( x ) \in \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ with indices $n \leq d _ { l }$ and $M \leq d _ { J }$ , see also Definition D.9. Similarly, endomorphisms $c \in \operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ have matrix elements $\langle J M | c | J M ^ { \prime } \rangle$ with $M , M ^ { \prime } \ \leq \ d _ { J }$ . We furthermore write $\langle i , j m | x \rangle : = \overline { { Y _ { j i } ^ { m } ( x ) } }$ . Finally, we denote the space of $G$ -steerable kernels by ${ \mathrm { H o m } } _ { G } ( X , { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) )$ . + +Our main result is the following Wigner-Eckart theorem for $G \mathrm { \Omega }$ -steerable kernels. Other versions at different levels of abstraction can be found in Theorems D.13 and D.16. + +Theorem 4.1 (Wigner-Eckart Theorem for Steerable Kernels). There is a vector space isomorphism + +$$ +\mathrm { G K e r : } \bigoplus _ { \substack { j \in \widehat { G } } } \bigoplus _ { i = 1 } ^ { m _ { j } } \bigoplus _ { s = 1 } ^ { \lfloor J ( j l ) \rfloor } \mathrm { E n d } _ { G , \mathbb { K } } ( V _ { J } ) \ \ \mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) . +$$ + +A general steerable kernel $K = \mathrm { G K e r } ( ( c _ { j i s } ) _ { j i s } )$ with $c _ { j i s } \in \operatorname { E n d } _ { G , \operatorname { K } } ( V _ { J } )$ has matrix elements + +$$ +\underbrace { \langle J M | K ( x ) | l n \rangle } _ { \mathrm { k e m e l ~ m a t i x ~ e l e m e n t s } } = \sum _ { j \in \hat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { \left[ J ( j l ) \right] } \sum _ { m = 1 } ^ { d _ { j } } \sum _ { M ^ { \prime } = 1 } ^ { d _ { J } } \underbrace { \langle J M | c _ { j i s } | J M ^ { \prime } \rangle } _ { \mathrm { e n d o m o r p h i s m s } } \cdot \underbrace { \langle s , J M ^ { \prime } | j m ; l n \rangle } _ { \mathrm { C l e b s c h - G o r d a n } } \cdot \underbrace { \langle i , j m | x \rangle } _ { \mathrm { h a m m i c s } } . +$$ + +Proof. We shortly sketch a proof of this theorem. We use the notation $\mathrm { H o m } _ { G , \mathbb { K } }$ to denote linear equivariant maps. The space of steerable kernels can be progressively transformed as follows: + +$$ +\begin{array} { r l } & { \quad \mathrm { H o m } _ { G } \big ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \big ) \stackrel { ( 1 ) } { \cong } \mathrm { H o m } _ { G , \mathbb { K } } \big ( L _ { \mathbb { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \big ) } \\ & { \stackrel { \mathrm { \scriptsize 2 ) } } { \cong } \mathrm { H o m } _ { G , \mathbb { K } } \big ( \widehat { \bigoplus } _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } V _ { j i } , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \big ) \stackrel { ( 3 ) } { \cong } \bigoplus _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } \mathrm { H o m } _ { G , \mathbb { K } } \big ( V _ { j } , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \big ) } \\ & { \stackrel { \mathrm { \scriptsize 4 ) } } { \cong } \bigoplus _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } \mathrm { H o m } _ { G , \mathbb { K } } \big ( V _ { j } \otimes V _ { l } , V _ { J } \big ) \stackrel { ( 5 ) } { \cong } \bigoplus _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } \mathrm { H o m } _ { G , \mathbb { K } } \big ( \bigoplus _ { J ^ { \prime } \in \widehat { G } } \bigoplus _ { s = 1 } ^ { [ J ^ { \prime } ( j l ) ] } V _ { J ^ { \prime } } , V _ { J } \big ) } \\ & { \stackrel { \mathrm { \scriptsize 6 ) } } { \cong } \bigoplus _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } \bigoplus _ { s = 1 } ^ { [ J ( j l ) ] } \mathrm { H o m } _ { G , \mathbb { K } } ( V _ { J } , V _ { J } ) \stackrel { ( 7 ) } { \cong } \bigoplus _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } \bigoplus _ { s = 1 } ^ { [ J ( j l ) ] } \mathrm { E n d } _ { G , \mathbb { K } } ( V _ { J } ) } \end{array} +$$ + +In (1), we linearize the kernels such that they become representation operators, as detailed in Theorem C.7. Step (2) applies the representation-theoretic version of the Peter-Weyl Theorem B.22 to decompose $L _ { \mathbb { K } } ^ { 2 } { \bar { ( X ) } }$ in harmonic basis functions. Step (3) makes use of the well-known fact that linear maps can be described on each direct summand individually. Topological details are explained in Lemma D.20. In (4), we use the hom-tensor adjunction Proposition D.23. In (5), we use the Clebsch-Gordan decomposition Eq. (4), which provides us with Clebsch-Gordan coefficients. In (6), we use that nontrivial linear equivariant maps from $V _ { J ^ { \prime } }$ to $V _ { J }$ exist by Schur’s Lemma B.29 only for $J ^ { \prime } = J$ and, once again, that we can describe linear maps on each direct summand individually. Finally, in (7) we note that ${ \mathrm { H o m } } _ { G , { \mathbb K } } ( V _ { J } , V _ { J } ) = { \mathrm { E n d } } _ { G , { \mathbb K } } ( V _ { J } )$ is the space of endomorphisms. The formula of the matrix elements Eq. (6) is fully proven in Theorem D.13 by carefully tracing back all the isomorphisms above.7 + +Technically, step (1) is the main gap that we had to bridge: it establishes that non-linear kernels on $X$ can be seen as linear representation operators on $L _ { \mathbb { K } } ^ { 2 } ( X )$ . Steps (2) to (7) orient at the proof of the Wigner-Eckart theorem for representation operators by Agrawala (1980). However, it differs non-trivially from the reference by a) allowing the operator to be non-injective, b) topological considerations, since $L _ { \mathbb { K } } ^ { 2 } ( X )$ is not simply a direct sum of irreps but its topological closure, and c) the possibility to allow for real representations, which is why we end up with endomorphisms. □ + +We obtain the following corollary, which clarifies how steerable kernels can be parameterized: + +Corollary 4.2. The space ${ \mathrm { H o m } } _ { G } ( X , { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) )$ of steerable kernels is spanned by basis kernels $\{ K _ { j i s r } : X \to \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \mid j \in { \widehat { G } } , \ i \leq m _ { j } ,$ $s \leq [ J ( j l ) ]$ , $r \leq E _ { J } \}$ with matrix elements + +$$ +\langle J M | K _ { j i s r } ( x ) | l n \rangle = \sum _ { m = 1 } ^ { d _ { j } } \sum _ { M ^ { \prime } = 1 } ^ { d _ { J } } \langle J M | c _ { r } | J M ^ { \prime } \rangle \cdot \langle s , J M ^ { \prime } | j m ; l n \rangle \cdot \langle i , j m | x \rangle . +$$ + +$A$ matrix-expression of the basis kernels from Eq. (7) is given in Eq. (22). Here, $c _ { r }$ is one of the $E _ { J }$ basis endomorphisms of $\operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ . This means that a general steerable kernel $K : X $ HomK(Vl, VJ ) is of the form K = Pj∈G Pmji=1 P[J(jl)s=1 $\begin{array} { r } { K = \sum _ { j \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { [ J ( j l ) ] } \sum _ { r = 1 } ^ { E _ { J } } \lambda _ { j i s r } \cdot K _ { j i s r } } \end{array}$ ] PEJr=1 λjisr · Kjisr with a total of ΛJ l = $E _ { J } \cdot \textstyle \sum _ { j \in { \widehat { G } } } [ J ( j l ) ] \cdot m _ { j }$ learnable parameters $\lambda _ { j i s r } \in \mathbb { K } .$ . Overall, the kernel space can therefore be parameterized with an isomorphism $\overline { { \mathrm { G K e r } } } : \mathbb { K } ^ { \Lambda _ { J l } } \to \mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) .$ . + +Proof. We simply choose $K _ { j i s r } : = \mathrm { G K e r } ( ( c _ { j ^ { \prime } i ^ { \prime } s ^ { \prime } } ^ { j i s r } ) _ { j ^ { \prime } i ^ { \prime } s ^ { \prime } } )$ with $c _ { j ^ { \prime } i ^ { \prime } s ^ { \prime } } ^ { j i s r } = \delta _ { j ^ { \prime } j } \cdot \delta _ { i ^ { \prime } i } \cdot \delta _ { s ^ { \prime } s } \cdot c _ { r }$ . Clearly, the $c ^ { j i s r }$ are a basis of $\begin{array} { r l } { } & { \bigoplus _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } \bigoplus _ { s = 1 } ^ { [ J ( j l ) ] } \mathrm { E n d } _ { G , \mathbb { K } } ( V _ { J } ) } \end{array}$ L[J(jl)]s=1 EndG,K(VJ ), and since GKer is an isomorphism, the $K _ { j i s r }$ form a basis of steerable kernels. □ + +Remark 4.3. The matrix elements $\langle J M | c _ { j i s } | J M ^ { \prime } \rangle$ relate to the reduced matrix elements $\lambda \in \mathbb { C }$ of spherical tensor operators as follows: in the case of spherical tensor operators one deals with complex irreps, whose endomorphism spaces are according to Schur’s Lemma D.8 generated by the identity. Consequently, such endomorphisms $c$ have matrix-elements $\langle J M | c | J M ^ { \prime } \rangle = \lambda \delta _ { M M ^ { \prime } }$ for some scaling factor $\lambda \in \mathbb { C }$ . $\lambda$ is denoted as the reduced matrix element of the spherical tensor operator. The analog to $\lambda$ in our Wigner-Eckart theorem are the learnable parameters $\lambda _ { j i s r } \in \mathbb { K }$ . + +# 5 RELATED WORK + +Harmonic convolution kernels date back to at least the early ’80s (Hsu & Arsenault, 1982; Rosen & Shamir, 1988). The term steerable filter was coined in Freeman & Adelson (1991). Hel-Or & Teo (1998) generalized steerable filters to Lie groups. Reisert & Burkhardt (2007) proposed matrix valued steerable kernels between representation spaces, which are similar to our $G$ -steerable kernels. + +Steerable CNNs formulate GCNNs in the language of representation theory and feature fields. This design was proposed by Cohen & Welling (2016b), who specifically considered finite groups, for which the kernel constraint can be solved numerically. Weiler et al. (2018a) introduced the $G$ - steerability constraint in the form in Eq. (2) for $G = \mathrm { S O ( 3 ) }$ . The authors choose a slightly different approach to solve the constraint in which they decompose the space $\operatorname { H o m } _ { \mathbb { R } } ( V _ { l } , V _ { J } ) \stackrel { \sim } { = } V _ { l } ^ { * } \otimes V _ { J }$ instead of $V _ { j } \otimes V _ { l }$ via Clebsch-Gordan coefficients. An essentially equivalent design was simultaneously proposed by Thomas et al. (2018), who decomposed $V _ { j } \otimes V _ { l }$ as in the present work, see Appendix E.5. The case of complex valued irreps of $\mathrm { S O } ( 2 )$ was investigated by Worrall et al. (2016) and Wiersma et al. (2020); see Appendix E.1. Weiler & Cesa (2019) solve the constraint for any, not necessarily irreducible, representation of the groups O(2), SO(2), $\mathrm Ḋ \mathrm Ḋ \mathrm Ḋ \ Ḍ Ḍ _ { N }$ and $\mathrm { C } _ { N }$ . Their solution strategy is based on an expansion of the kernel in the Fourier basis of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ and solving for the Fourier coefficients satisfying the constraint. This is a special case of the strategy that we employ in the proof of our Wigner-Eckart theorem. de Haan et al. (2020) solve for SO(2)-steerable kernels by viewing them as invariants of the tensor product representation $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } ) ^ { * } \otimes V _ { l } ^ { * } \otimes V _ { J }$ . As they use real valued irreps, they can use that the duals are isomorphic to their original counterparts. Our Wigner-Eckart theorem unifies all of these results in one general framework. + +To which use cases does the proposed kernel space solution apply? As argued by Cohen et al. (2019b), any $H$ -equivariant convolutional network on a homogeneous space $H / G$ needs to satisfy a $G$ -steerability constraint — if $H$ is locally compact and unimodular. While these works proved the necessity of steerable kernels, they did not solve the constraint – a gap which is filled by our WignerEckart theorem for compact groups $G$ , see also Remark D.15. This framework includes in particular the popular group convolutions on flat spaces (Cohen & Welling, 2016a) and homogeneous spaces of compact groups (Kondor & Trivedi, 2018) and Lie groups (Bekkers, 2020), including for instance the sphere (Cohen et al., 2018). Specifically, if $\rho _ { \mathrm { i n } }$ and $\rho _ { \mathrm { o u t } }$ are chosen to be regular representations $L _ { \mathbb { K } } ^ { 2 } ( \dot { G } )$ , steerable convolutions are equivalent to group convolutions (Weiler & Cesa, 2019). + +A related line of work are Clebsch-Gordan Networks (Kondor et al., 2018; Kondor, 2018; Anderson et al., 2019; Bogatskiy et al., 2020). They apply bilinear equivariant nonlinearities which compute the tensor products of global irrep features. A subsequent Clebsch-Gordan decomposition disentangles the product features back into irrep features. Note that in this network design, the ClebschGordan coefficients are used in the nonlinear part, which differs from our use of these coefficients in the construction of steerable basis kernels, i.e. in the linear part of the network. + +# 6 EXAMPLE APPLICATIONS + +Cohen et al. (2019b) showed in a fairly general setting that every GCNN is based on $G$ -steerable kernels. In practice, a basis for the space of $G \mathrm { \Omega }$ -steerable kernels needs to be determined for parameterizing GCNNs. This work determines the general structure of these basis kernels for compact (point-)symmetry groups $G$ and their homogeneous spaces $X$ : Corollary 4.2 explains that one needs to determine 1) the irreps $\rho _ { l }$ of $G , 2$ ) harmonic basis functions $Y _ { i i } ^ { m }$ in $L _ { \mathbb { K } } ^ { 2 } ( { \dot { X } } )$ according to the Peter-Weyl Theorem 3.4, 3) the Clebsch-Gordan decomposition of $\dot { V } _ { j } \otimes V _ { l }$ , given by the ClebschGordan coefficients $\langle s , J M | j m ; l n \rangle$ , and 4) a basis of endomorphisms $c _ { r } \in \operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ for any $J \in { \widehat { G } }$ . Given these ingredients, they can in a fifth step be put together according to Eq. (7) to obtain a complete, $\Lambda _ { J l }$ -dimensional basis of $G$ -steerable kernels $K _ { j i s r } : X \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ . + +Appendix E demonstrates this for the examples of $G$ being SO(2), SO(3), O(3), and $\mathbb { Z } / 2$ , considering both real and complex irreps. In any of these cases, we derive the kernel bases following exactly the five steps outlined above. This procedure can easily be applied to further compact groups, for instance SU(2) or SU(3), which play an important role in physics applications of deep learning. + +# 7 CONCLUSIONS AND FUTURE WORK + +Prior work revealed that group equivariant convolutions generally rely on $G$ -steerable kernels. Our Wigner-Eckart theorem for $G$ -steerable kernels characterizes them for the practically relevant case of $G$ being any compact group. The degrees of freedom – or learnable parameters – correspond thereby precisely to the choice of endomorphisms. This mirrors the situation in quantum mechanics, where the degrees of freedom of spherical tensor operators are given by reduced matrix elements. + +It would be desirable to extend this result to non-compact groups, where the Peter-Weyl Theorem does not hold anymore. One alternative might be Pontryagin duality (Reiter, 1968), which describes the Fourier transform on locally compact abelian groups. Furthermore, for many non-compact, nonabelian groups, one can often find a direct integral decomposition of $L _ { \mathbb { C } } ^ { 2 } ( G )$ . This generalization of the Peter-Weyl theorem can be found in Segal (1950) and Mautner (1955). Such generalizations of our Wigner-Eckart Theorem might lead to a better theoretical understanding of several recent work (Worrall & Welling, 2019; Bekkers, 2020; Sosnovik et al., 2020; Shutty & Wierzynski, 2020). + +Finally, we hope that the analogies between steerable kernels and representation operators appearing in physics inspire further research in this fascinating crossdisciplinary domain. This could lead to applications of GCNNs for learning tasks with physical symmetries. + +# ACKNOWLEDGMENTS + +We thank Lucas Lang for discussions on the Wigner-Eckart Theorem and observables in physics and Patrick Forre for discussions on the link between steerable kernels and representation operators. ´ Additionally, we are greatful for discussions with Gabriele Cesa on the connection between real and complex representations of compact groups. Furthermore, we thank Stefan Dawydiak and Terrence Tao for online discussions on aspects surrounding a real version of the Peter-Weyl theorem. Finally, we thank Roberto Bondesan, Miranda Cheng, Tom Lieberum, and Rupert McCallum for feedback on different aspects of our work. + +# REFERENCES + +Vishnu Agrawala. Wigner-Eckart theorem for an arbitrary group or Lie algebra. Journal of Mathematical Physics, 21, July 1980. doi: 10.1063/1.524639. + +Brandon Anderson, Truong-Son Hy, and Risi Kondor. Cormorant: Covariant Molecular Neural Networks. In Conference on Neural Information Processing Systems (NeurIPS), 2019. + +A.V. Arkhangel’skii and M. Tkachenko. Topological Groups and Related Structures. Atlantis studies in mathematics. Atlantis Press, Jan 2008. + +Erik J. Bekkers. B-Spline CNNs on Lie groups. In International Conference on Learning Representations (ICLR), 2020. + +Alexander Bogatskiy, Brandon Anderson, Jan T. Offermann, Marwah Roussi, David W. Miller, and Risi Kondor. Lorentz Group Equivariant Neural Network for Particle Physics. In International Conference on Machine Learning (ICML), 2020. + +A. Bohm and M. Lowe. ¨ Quantum Mechanics: Foundations and Applications. Springer study edtion. Springer New York, 1993. + +N. Bourbaki. General Topology: Chapters 1-4. Elements of mathematics. Springer, 1998. + +T. Brocker and T. Dieck. ¨ Representations of Compact Lie Groups. Graduate Texts in Mathematics. Springer Berlin Heidelberg, 2003. + +Taco Cohen and Max Welling. Group Equivariant Convolutional Networks. In International Conference on Machine Learning (ICML), volume 48, pp. 2990–2999, New York, New York, USA, 20–22 Jun 2016a. PMLR. + +Taco Cohen, Maurice Weiler, Berkay Kicanaoglu, and Max Welling. Gauge Equivariant Convolutional Networks and the Icosahedral CNN. In International Conference on Machine Learning (ICML), volume 97, pp. 1321–1330, Long Beach, California, USA, 09–15 Jun 2019a. PMLR. + +Taco S. Cohen and Max Welling. Steerable CNNs. In International Conference on Learning Representations (ICLR), 2016b. + +Taco S. Cohen, Mario Geiger, Jonas Kohler, and Max Welling. Spherical CNNs. In ¨ International Conference on Learning Representations (ICLR), 2018. + +Taco S Cohen, Mario Geiger, and Maurice Weiler. A General Theory of Equivariant CNNs on Homogeneous Spaces. In Advances in Neural Information Processing Systems (NeuRIPS). 2019b. + +John Conway. A Course in Point Set Topology. Jan 2014. doi: 10.1007/978-3-319-02368-7. + +Stefan Dawydiak. Is there a Peter-Weyl-Theorem over the real numbers? Mathematics Stack Exchange, 2020. URL https://math.stackexchange.com/q/3595292. + +Pim de Haan, Maurice Weiler, Taco Cohen, and Max Welling. Gauge Equivariant Mesh CNNs: Anisotropic convolutions on geometric graphs. arXiv e-prints, art. arXiv:2006.00724, 2020. + +L. Debnath and P. Mikusinski. Introduction to Hilbert Spaces with Applications. Elsevier Science, 2005. + +William Freeman and Edward Adelson. The Design and Use of Steerable Filters. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 13:891–906, 10 1991. doi: 10.1109/34.9 3808. +J. Gallier and J. Quaintance. Differential Geometry and Lie Groups: A Second Course. Geometry and Computing. Springer International Publishing, 2020. +Y. Hel-Or and Patrick C. Teo. Canonical Decomposition of Steerable Functions. Journal of Mathematical Imaging and Vision, 9:83–95, 1998. +Roger A. Horn and Charles R. Johnson. Matrix Analysis. Cambridge University Press, USA, 2nd edition, 2012. +Yuan-Neng Hsu and H. Arsenault. Optical pattern recognition using circular harmonic expansion. Applied Optics, 21(22):4016–4019, 1982. +Nadir Jeevanjee. An introduction to tensors and group theory for physicists. Birkhauser, New York, ¨ NY, 2011. doi: 10.1007/978-0-8176-4715-5. +R.V. Kadison and J.R. Ringrose. Fundamentals of the Theory of Operator Algebras. Volume I. Fundamentals of the Theory of Operator Algebras. American Mathematical Society, 1997. +I. Kaplansky. Set Theory and Metric Spaces. AMS Chelsea Publishing Series. AMS Chelsea Publishing, 2001. +Anthony Knapp. Lie Groups Beyond an Introduction, Second edition, volume 140. Jan 2002. doi: 10.1007/978-1-4757-2453-0. +Risi Kondor. N-body Networks: a Covariant Hierarchical Neural Network Architecture for Learning Atomic Potentials. arXiv e-prints, art. arXiv:1803.01588, 2018. +Risi Kondor and Shubhendu Trivedi. On the Generalization of Equivariance and Convolution in Neural Networks to the Action of Compact Groups. In International Conference on Machine Learning (ICML), Feb 2018. +Risi Kondor, Zhen Lin, and Shubhendu Trivedi. Clebsch-Gordan Nets: a Fully Fourier Space Spherical Convolutional Neural Network. In Conference on Neural Information Processing Systems (NeurIPS), 2018. +E. Kowalski. An Introduction to the Representation Theory of Groups. Graduate Studies in Mathematics. American Mathematical Society, 2014. +S.M. Lane, S.J. Axler, Springer-Verlag (Nowy Jork)., F.W. Gehring, and P.R. Halmos. Categories for the Working Mathematician. Graduate Texts in Mathematics. Springer, 1998. +T.M. MacRobert. Spherical Harmonics: An Elementary Treatise on Harmonic Functions, with Applications. Methuen, 1947. +F. I. Mautner. Note on the Fourier inversion formula on groups. Transactions of the American Mathematical Society, 78:371–384, 1955. +L. Nachbin and L. Bechtolsheim. The Haar integral. University series in higher mathematics. Van Nostrand, 1965. +Marco Reisert and Hans Burkhardt. Learning Equivariant Functions with Matrix Valued Kernels. Journal of Machine Learning Research, 8:385–408, Mar 2007. +H. Reiter. Classical Harmonic Analysis and Locally Compact Groups. Oxford mathematical monographs. Clarendon P., 1968. +Joseph Rosen and Joseph Shamir. Circular harmonic phase filters for efficient rotation-invariant pattern recognition. Applied Optics, 27(14):2895–2899, 1988. +I. E. Segal. An Extension of Plancherel’s Formula to Separable Unimodular Groups. Annals of Mathematics, 52(2):272–292, 1950. + +Noah Shutty and Casimir Wierzynski. Learning Irreducible Representations of Noncommutative Lie Groups. arXiv e-prints, art. arXiv:2006.00724, June 2020. + +Ivan Sosnovik, Michał Szmaja, and Arnold Smeulders. Scale-Equivariant Steerable Networks. In International Conference on Learning Representations (ICLR), 2020. + +W.A. Sutherland. Introduction to Metric and Topological Spaces. Open university set book. Clarendon Press, 1975. + +T. Tao. An Introduction to Measure Theory. Graduate studies in mathematics. American Mathematical Society, 2013. + +Terrence Tao. The Peter-Weyl Theorem, and non-abelian Fourier analysis on compact groups, 2011. URL https://terrytao.wordpress.com/2011/01/23/the-peter-weyl-the orem-and-non-abelian-fourier-analysis-on-compact-groups/. + +Nathaniel Thomas, Tess Smidt, Steven M. Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor Field Networks: Rotation- and Translation-Equivariant Neural Networks for 3D Point Clouds. arXiv e-prints, art. arXiv/1802.08219, 2018. + +Maurice Weiler and Gabriele Cesa. General $E ( 2 )$ -Equivariant Steerable CNNs. In Conference on Neural Information Processing Systems (NeurIPS), 2019. + +Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco S Cohen. 3D Steerable CNNs: Learning Rotationally Equivariant Features in Volumetric Data. In Advances in Neural Information Processing Systems (NeuRIPS). 2018a. + +Maurice Weiler, Fred Hamprecht, and Martin Storath. Learning Steerable Filters for Rotation Equivariant CNNs. In Conference on Computer Vision and Pattern Recognition (CVPR), pp. 849–858, Jun 2018b. + +Ruben Wiersma, Elmar Eisemann, and Klaus Hildebrandt. CNNs on Surfaces using RotationEquivariant Features. Transactions on Graphics, 39(4), July 2020. doi: 10.1145/3386569.33 92437. + +E.P. Wigner. Gruppentheorie und ihre Anwendung auf die Quantenmechanik der Atomspektren. Die Wissenschaft. J.W. Edwards, 1944. + +Dana P. Williams. The Peter-Weyl Theorem for Compact Groups, 1991. URL https://math.d artmouth.edu/˜dana/bookspapers/pw.pdf. + +Daniel Worrall and Max Welling. Deep Scale-spaces: Equivariance Over Scale. In Conference on Neural Information Processing Systems (NeurIPS). 2019. + +Daniel E. Worrall, Stephan J. Garbin, Daniyar Turmukhambetov, and Gabriel J. Brostow. Harmonic Networks: Deep Translation and Rotation Equivariance. In Conference on Computer Vision and Pattern Recognition (CVPR), volume abs/1612.04642, 2016. + +# APPENDIX + +This appendix contains a detailed and rigorous treatment of the Wigner-Eckart theorem for steerable kernels, including background knowledge, proofs, and many example applications. + +In Chapter A, we shortly look at the simple example SO(2) for motivating the concepts and results in Section 3. + +Everything afterwards, starting with Chapter B, can be read independently of the main paper and is a self-contained treatment of our investigations. In Chapter B, we start with the foundations of the representation theory of compact groups. We formulate the Peter-Weyl Theorem B.22, which tells us how to decompose the space of square-integrable functions on a homogeneous space into irreducible representations, leading to harmonic basis functions. In the second half, we include a proof of the more algebraic parts of this theorem. We do this since the theorem is usually only proven for complex representations in the literature, but we need it for real representation as well. + +In Chapter C we investigate steerable kernels and show their similarities to representation operators from physics and representation theory. In Theorem C.7 we will then proof a precise isomorphism between steerable kernels and representation operators on the space of square-integrable functions on a homogeneous space. We call these kernel operators. + +In Chapter D we will then formulate and prove the Wigner-Eckart theorem for steerable kernels of general compact groups D.13. The proof makes in essential parts use of the Peter-Weyl Theorem and Theorem C.7, and additionally of Schur’s Lemma B.29, the hom-tensor adjunction Proposition D.23, and the Clebsch-Gordan decomposition of tensor products. + +In Chapter E, we then look at specific example applications of our theory. In these examples, we look at specific compact transformation groups $G$ , specific, relevant homogeneous spaces $X$ of the group and one of the fields $\mathbb { R }$ or C. For this combination we derive a basis for the space of steerable kernels between arbitrary irreducible input- and output representations of the group. Specifically, we look at harmonic networks (Worrall et al., 2016), SO(2)-equivariant networks for real representations (Weiler & Cesa, 2019), $\mathbb { Z } _ { 2 }$ -equivariant networks for real representations, SO(3)-equivariant networks for both real and complex representations (Weiler et al., 2018a; Thomas et al., 2018), and O(3)-equivariant networks for both real and complex representations. The investigation of $\mathbb { Z } _ { 2 }$ - equivariant CNNs will additionally show that our result is consistent with group convolutional CNNs for the regular representation (Cohen & Welling, 2016a). + +In Chapter F, we summarize some important notions and results from the theory of topological spaces, metric spaces, normed vector spaces, and (pre-)Hilbert spaces that we use throughout this appendix. + +Chapters B, C, and D contain the bulk of the theoretical work. We recommend the reader to first only read the first halves of these chapters, Sections B.1, C.1 and D.1, since they contain the formulation of the most important results and the main intuitions, whereas the second halves of these chapters, i.e., Sections B.2, C.2 and D.2, mainly contain detailed proofs that can be skipped when going over the material for the first time. + +# CONTENTS OF THE APPENDIX + +A Building Blocks of SO(2)-Steerable Kernels – Running Example for Section 3 1 9 +B Representation Theory of Compact Groups 22 +B.1 Foundations of Representation Theory and the Peter-Weyl Theorem 22 +B.2 A Proof of the Peter-Weyl Theorem 29 +C The Correspondence between Steerable Kernels and Representation Operators 4 0 +C.1 Fundamentals of the Correspondence . 40 +C.2 A Proof of the Correspondence between Steerable Kernels and Kernel Operators . 47 +D A Wigner-Eckart Theorem for Steerable Kernels of General Compact Groups 51 +D.1 A Wigner-Eckart Theorem for Steerable Kernels and their Kernel Bases 52 +D.2 Proof of the Wigner-Eckart Theorem for Kernel Operators 63 + +# E Example Applications 67 + +E.1 SO(2)-Steerable Kernels for Complex Representations – Harmonic Networks . . . 68 +E.2 SO(2)-Steerable Kernels for Real Representations . 70 +E.3 $\mathbb { Z } _ { 2 }$ -Steerable Kernels for Real Representations 75 +E.4 SO(3)-Steerable Kernels for Complex Representations. 79 +E.5 SO(3)-Steerable Kernels for Real Representations . . 81 +E.6 O(3)-Steerable Kernels for Complex Representations 86 +E.7 O(3)-Steerable Kernels for Real Representations 90 + +# F Mathematical Preliminaries 90 + +F.1 Topological Spaces, Normed Spaces, and Metric Spaces 90 +F.2 Limits of nets and approximated Dirac delta functions . 94 +F.3 Pre-Hilbert Spaces and Hilbert Spaces 95 + +LIST OF SYMBOLS + +GENERAL SET THEORY AND FUNCTIONS + +$A \cap B$ intersection of sets $A$ and $B$ $A \cup B$ union of sets $A$ and $B$ +$\cap _ { i \in I } A _ { i }$ intersection of sets $A _ { i }$ +Si∈I Ai union of sets $A _ { i }$ +$\textstyle { \bigsqcup } _ { i \in I } A _ { i }$ union of sets $A _ { i }$ which are disjoint from each other +$A \subseteq B$ $A$ is a subset of $B$ +$A \subsetneq B$ $A$ is a strict subset of $B$ $A \backslash B$ set of all elements in $A$ which are not in $B$ +$A \times B$ Cartesian product of sets or structures (e.g., groups) $A , B$ $\varnothing$ empty set +$X : = Y$ $X$ is defined as $Y$ $\sim$ often an equivalence relation $[ x ]$ equivalence class with respect to an equivalence relation $\mathbf { 1 } _ { A }$ indicator function of set $A$ $f \circ g$ composition of two composable functions $f$ and $g$ f − 1 either the inverse of function $f$ or the preimage function $f | _ { A }$ restriction of a function $f$ to a subset $A$ + +# NUMBERS AND COLLECTIONS OF NUMBERS + +N natural numbers including 0 +$\mathbb { Z }$ integers +$\mathbb { R }$ field of real numbers +$\mathbb { C }$ field of complex numbers +$\mathbb { H }$ skew-field of quaternions +$\mathbb { K }$ one of the two fields $\mathbb { R }$ and $\mathbb { C }$ +$\mathbb { K } ^ { n }$ $n$ -dimensional canonical vector space over K +$\textstyle { \overline { { x } } }$ complex conjugate of $x$ + +# GROUPS + +$G$ a compact topological group $1 , e$ neutral element of a group with multiplication as operation 0 neutral element of an additive group $G \rtimes H$ semidirect product of two groups $G$ and $H$ $\mathrm { C } _ { N }$ group of planar rotations of a regular $N$ -gon $\mathrm Ḋ \mathrm Ḋ \mathrm Ḋ \ Ḍ Ḍ _ { N }$ group of planar rotations and reflections of a regular $N$ -gon $\mathrm { S O } ( d )$ special orthogonal group in $d$ real dimensions $\mathrm { O } ( d )$ orthogonal group in $d$ real dimensions $\mathrm { O } ( V )$ orthogonal group of a real Hilbert space $V$ $\mathrm { S U } ( d )$ special unitary group in $d$ complex dimensions $\mathrm { U } ( d )$ unitary group in $d$ complex dimensions $\mathrm { U } ( V )$ unitary group of a complex Hilbert space $V$ $\operatorname { E } ( d )$ Euclidean motion group in $d$ dimensions + +# BASIC REPRESENTATION THEORY + +$\rho$ +$\rho ^ { v }$ +ρuv +$\rho ^ { \mathrm { i n } } , \rho ^ { \mathrm { o u t } }$ +$\rho _ { \mathrm { H o m } }$ +$\rho \otimes \rho ^ { \prime }$ +$\operatorname { I n d } _ { G } ^ { H } \rho$ +$\widehat { G }$ +$l$ +$\rho _ { l }$ +$V _ { l }$ +$v _ { l } ^ { i }$ or $Y _ { l } ^ { n }$ +a linear representation of a group +The function $G V$ , $g \mapsto \rho ( g ) ( v )$ +matrix coefficient of the unitary representation $\rho$ +representations of the in-field and out-field, respectively +Hom-representation on $\mathrm { H o m } _ { \mathrm { K } } ( V , V ^ { \prime } )$ of representations $\rho$ +and $\rho ^ { \prime }$ +tensor product representation on $V \otimes V ^ { \prime }$ of representations +$\rho$ and $\rho ^ { \prime }$ +induced representation on $H$ or a representation $\rho$ on $G$ +set of isomorphism classes of unitary representations on $G$ +an isomorphism class of unitary representations +a representative of isomorphism class $l$ +vector space on which $\rho _ { l }$ acts +fixed chosen orthonormal basis vector of $V _ { l }$ + +VECTOR SPACES AND HILBERT SPACES + +$\dim ( V )$ dimension of $\mathbb { K }$ -vectorspace $V$ +$V \perp W$ $V$ and $W$ are perpendicular +$V \cong W$ $V$ and $W$ are isomorphic with respect to their structures +$V \not \cong W$ $V$ and $W$ are not isomorphic with respect to their structures $\langle f \vert g \rangle$ bra-ket notation of a scalar product on a Hilbert space +$\langle y | f | x \rangle$ equivalent to $\langle y | f ( x ) \rangle$ for a function $f$ +$\operatorname { n u l l } ( f )$ null space of $f$ +$\operatorname { i m } ( f )$ image of $f$ $f ^ { * }$ adjoint of the operator $f$ $\operatorname { i d } _ { V }$ identity function on $V$ + +# (HILBERT) SPACE CONSTRUCTIONS FROM OTHER SPACES + +${ \mathrm { H o m } } _ { \mathrm { K } } ( V , W )$ space of K-linear functions from $V$ to $W$ $\operatorname { G L } ( V )$ space of invertible $\mathbb { K }$ -linear functions from $V$ to itself, sometimes written ${ \mathrm { G L } } ( V , \mathbb { K } )$ in the literature +${ \mathrm { H o m } } _ { G , \mathbb { K } } ( V , W )$ space of intertwiners from $V$ to $W$ +${ \mathrm { H o m } } _ { G } ( X , W )$ space of $G$ -equivariant continuous maps from $X$ to $W$ , for a homogeneous space $X$ $\operatorname { E n d } _ { G , \mathbb { K } } ( V )$ space of endomorphisms of $V$ , i.e., intertwiners from $V$ to $V$ + +V ⊗ W + +tensor product of two vector spaces over their common field. Also denotes the tensor product of pre-Hilbert spaces (orthogonal) direct sum of all $V _ { i }$ +topological closure of the (orthogonal) direct sum of all $V _ { i }$ vector subspace of a $\mathbb { K }$ -vector space spanned by $M$ +orthogonal complement of $V$ +eigenspace of $\varphi$ for eigenvalue $\lambda$ + +TOPOLOGICAL SPACES, METRIC SPACES, NORMED SPACES + +$\tau$ topology $U _ { x }$ open neighborhood of $x \in X$ $\mathcal { U } _ { x }$ set of all open neighborhoods of $x \in X$ +limU∈Ux limit over the directed set of open neighborhoods of $x$ +$\scriptstyle \operatorname* { l i m } _ { k \to \infty } x _ { k }$ limit of the sequence $( x _ { k } ) _ { k }$ $\overline { { A } }$ topological closure of $A \subseteq X$ $\lVert x \rVert$ norm of $x$ $| x |$ absolute value of $x$ $d ( { \dot { x } } , { \dot { x } } ^ { \prime } )$ distance of $x , x ^ { \prime }$ according to metric $d$ $\mathrm { B } _ { \epsilon } ( x )$ $\epsilon$ -ball around $x$ according to some metric $d$ + +HOMOGENEOUS SPACES AND THE PETER-WEYL THEOREM + +X a homogeneous space of $G$ $x ^ { * } \in X$ arbitrary point $S ^ { n }$ $n$ -dimensional sphere in $( n + 1 )$ -dimensional space $\mu$ a measure on a compact group $G$ or its Homogeneous Space $X$ RX integral on a space $X$ with respect to its measure L2K(X), L2K(G) Hilbert space of square-integrable functions on $X$ and $G$ with values in $\mathbb { K }$ λ unitary representation on $L _ { \mathbb { K } } ^ { 2 } ( X )$ or $L _ { \mathbb { K } } ^ { 2 } ( G )$ g(x) arbitrary lift of $x$ with respect to projection $\pi : G $ $X$ , $g \mapsto g x ^ { * }$ $\operatorname { a v } ( f )$ average of $f : G \to \mathbb { K }$ along cosets $\pi ^ { * }$ lift of functions $L _ { \mathbb { K } } ^ { 2 } ( X ) \to { \bar { L } } _ { \mathbb { K } } ^ { 2 } ( G )$ $\delta _ { x }$ Dirac delta function at point $x$ $\delta _ { U }$ approximated Dirac delta function for nonempty open set $U$ $\rho _ { l } ^ { i j }$ abbreviation for $\rho _ { l } ^ { v ^ { i } v ^ { j } }$ for orthonormal basis vectors $v ^ { i } , v ^ { j } \in$ $V _ { l }$ $\mathcal { E }$ linear span of all matrix coefficients of irreducible unitary representations $\mathcal { E } _ { l }$ linear span of all matrix coefficients of $\rho _ { l }$ $\mathcal { E } _ { l } ^ { j }$ linear span of all matrix coefficients $\rho _ { l } ^ { i j }$ with varying $i$ but fixed $j$ $n \llangle { \mathbf { \phi } } m _ { l }$ multiplicity of $l$ in orthogonal decomposition of $L _ { \mathbb { K } } ^ { 2 } ( G )$ and $L _ { \mathbb { K } } ^ { 2 } ( { \bar { X } } )$ , respectively $V _ { l i }$ copy of $V _ { l }$ appearing in the Peter-Weyl decomposition of $L _ { \mathbb { K } } ^ { 2 } { \bar { ( X ) } }$ pli canonical projection $p _ { l i } \colon L _ { \mathbb { K } } ^ { 2 } ( X ) \ \to \ V _ { l i }$ and $\begin{array} { r l } { p _ { l i } } & { { } : } \end{array}$ $\oplus _ { l ^ { \prime } i ^ { \prime } } V _ { l ^ { \prime } i ^ { \prime } } \to V _ { l i }$ $\sin _ { m } , \cos _ { m }$ the functions $x \mapsto \sin ( m x )$ and $x \mapsto \cos ( m x )$ $Y _ { l } ^ { n } , Y Y _ { l } ^ { n }$ complex- and real-valued version of a spherical harmonic $D _ { l } , \mathrm { \Delta } ^ { r } D _ { l }$ complex- and real-valued version of Wigner D-matrix + +$K$ kernel $K : X \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ +$K \star f$ convolution of kernel $K$ with input $f$ $\kappa$ kernel operator or (more generally) representation operator ${ \mathcal { K } } : T \to \operatorname { H o m } _ { \mathbb { K } } ( U , V )$ $\widehat { K }$ kernel operator ${ \widehat K } \ : \ L _ { \mathbb K } ^ { 2 } ( X ) \ \to \ \operatorname { H o m } _ { \mathbb K } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ corresponding to a kernel $K$ +$\kappa | _ { X }$ kernel $\mathcal { K } | _ { X } : X \to \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ corresponding to a kernel operator $\kappa$ $\tilde { \kappa }$ for a representation operator ${ \mathcal { K } } : T \to \operatorname { H o m } _ { \mathbb { K } } ( U , V )$ , this denotes the corresponding map ${ \tilde { \mathcal { K } } } : T \otimes U V$ under the hom-tensor adjunction + +# THE WIGNER-ECKART THEOREM + +input- and output representations on the spaces $V _ { l }$ and $V _ { J }$ fixed chosen orthonormal basis vectors of the abstract irreducible representations $V _ { j }$ , $V _ { l }$ , $V _ { J }$ +matrix element of $K ( x )$ for a kernel $K$ and $x \in X$ +dimension of $l ^ { \star }$ th irrep $V _ { l }$ as $\mathbb { K }$ -vector space +number of times $V _ { j }$ is in the Peter-Weyl decomposition of $L _ { \mathbb { K } } ^ { 2 } ( X )$ +number of times $V _ { J }$ is in the direct sum decomposition of $V _ { j } \otimes V _ { l }$ +endomorphisms, mostly on $V _ { J }$ . $c _ { j i s }$ are endomorphisms appearing in the Wigner-Eckart theorem for steerable kernels basis endomorphism of $\rho _ { J }$ , indexed with index set $r =$ $1 , \ldots , E _ { J }$ +matrix element at indices $M , M ^ { \prime }$ for endomorphism $c$ linear equivariant isometric embeddings $l _ { s } : V _ { J } \to V _ { j } \otimes V _ { l }$ and $l _ { j i s } : V _ { J } V _ { j i } \otimes V _ { l }$ +projection $p _ { j i s } : V _ { j i } \otimes V _ { l } V _ { J }$ corresponding to (i.e.: adjoint to) the embedding $l _ { j i s }$ +Clebsch-Gordan coefficient corresponding to $l _ { s }$ +3-dimensional matrix of Clebsch-Gordan coefficients +harmonic basis function, for example, spherical harmonic. Element of $V _ { j i } \subseteq L _ { \mathbb { K } } ^ { 2 } ( X )$ +shorthand notation for $\mathrm { l i m } _ { U \in \mathcal { U } _ { x } } \left. Y _ { j i } ^ { m } \middle | \delta _ { U } \right.$ . Equal to $\overline { { Y _ { j i } ^ { m } ( x ) } }$ row vector with entries $\langle i , j m \vert x \rangle$ +isomorphism between tuples of endomorphisms and kernel operators +isomorphism between tuples of endomorphisms and steerable kernels +basis kernel +learnable parameter + +$\begin{array} { r l r } & { } & { \rho _ { l } , \rho _ { J } } \\ & { } & { Y _ { j } ^ { m } , Y _ { l } ^ { n } , Y _ { J } ^ { M } } \\ & { } & \\ & { } & { \langle J M | K ( x ) | l n \rangle } \\ & { } & { d _ { l } } \\ & { } & { m _ { j } } \\ & { } & { \left[ J ( j l ) \right] } \\ & { } & \\ & { } & { c , c _ { j i s } } \end{array}$ $c _ { r }$ $\langle J M | c | J M ^ { \prime } \rangle$ pjis $\begin{array} { c } { { \langle s , J M | j m ; l n \rangle } } \\ { { \mathrm { C G } _ { J ( j l ) s } } } \\ { { Y _ { j i } ^ { m } } } \end{array}$ $\langle i , j m \vert x \rangle$ $\langle i , j | x \rangle$ Rep GKer $K _ { j i s r }$ $w _ { j i s r }$ + +# LIST OF THEOREMS + +B.22 Theorem (Peter-Weyl Theorem) 28 +B.27 Theorem (Density of Matrix Coefficients) 30 +C.7 Theorem (Kernel-Operator-Correspondence) . . . 46 +C.8 Theorem (Kernel-Operator-Correspondence, Restated) 47 +D.11 Theorem (Wigner-Eckart Theorem) 56 +D.13 Theorem (Wigner-Eckart Theorem for Steerable Kernels) . . 58 +D.16 Theorem (Steerable Kernel Bases) 61 +F.24 Theorem (Heine-Borel Theorem) . . . 93 + +# LIST OF DEFINITIONS + +B.1 Definition (Group, Abelian Group) . . 22 +B.2 Definition (Subgroup) . . 23 +B.3 Definition (Group Homomorphism) 23 +B.4 Definition (Topological Group, Compact Group) . . 23 +B.5 Definition (Group Action) 23 +B.6 Definition (Orbit) . 23 +B.7 Definition (Transitive Action, Homogeneous Space) . 23 +B.8 Definition (Stabilizer Subgroup) 24 +B.10 Definition (Linear Representation) 24 +B.11 Definition (Intertwiner) . 24 +B.12 Definition (Equivalent Representations) 24 +B.13 Definition (Invariant Subspace, Subrepresentation, Closed Subrepresentation) 25 +B.14 Definition (Irreducible Representation) . 25 +B.15 Definition (Unitary Group) 25 +B.16 Definition (Unitary Transformation) 25 +B.17 Definition (Unitary Representation) 25 +B.18 Definition (Isomorphism of Unitary Representations) 25 +B.24 Definition (Matrix Coefficients) 29 +C.1 Definition (Hom-Representation) . . 42 +C.3 Definition (Steerable Kernel) . . 43 +C.4 Definition (Representation Operator) . . 44 +C.6 Definition (Kernel Operator) 45 +D.1 Definition (Tensor Product) . . 52 +D.2 Definition (Tensor Product of pre-Hilbert spaces) 52 +D.3 Definition (Tensor Product Representation) 53 +D.6 Definition (Clebsch-Gordan Coefficients) 54 +D.7 Definition (Endomorphism) . . . 55 +D.9 Definition (Matrix Element) 55 +D.12 Definition (Reduced Matrix Element) 56 +E.11 Definition (Real, Complex, and Quaternionic Type Irreducible Representations) . . 83 +E.12 Definition (Restriction and Extension) . 84 +E.14 Definition (Real Type Complex Representation) 84 +E.21 Definition (Tensor Product Representation) 87 +F.1 Definition (Topological Space, Open Sets, Closed Sets) 90 +F.2 Definition (Open Neighborhood) 91 +F.3 Definition (Hausdorff Space) 91 +F.4 Definition (Subspace) . . 91 +F.5 Definition (Closure, Density) 91 +F.6 Definition (Continuous Function, Homeomorphism) . 91 +F.7 Definition (Open Cover, Compact Space) 91 +F.10 Definition (Product Topology) 91 +F.11 Definition (Quotient Map, Quotient Space) . 91 +F.13 Definition (Norm) . . . 92 +F.14 Definition (Metric) 92 +F.15 Definition (Convergent Sequence) 92 +F.16 Definition (Continuity in Metric Spaces) . 92 +F.17 Definition (Uniform Continuity) 92 +F.19 Definition (Cauchy Sequence) 93 +F.20 Definition (Complete Metric Space) 93 +F.21 Definition (Completion) . . 93 +F.23 Definition (Boundedness) . . 93 +F.26 Definition (Partially Ordered Set, Directed Set) 94 +F.28 Definition (Net) . 94 +F.29 Definition (Convergence of Nets) . . 94 +F.30 Definition (Approximated Dirac Delta) . . 94 +F.32 Definition (pre-Hilbert Space, Hilbert space) . 95 +F.35 Definition (Orthogonality) 95 +F.36 Definition (Orthogonal Complement) . 95 +F.39 Definition (Orthonormal System) . 96 +F.40 Definition (Orthonormal Basis) . 96 +F.42 Definition (Adjoint of an Operator) . . 96 + +# A BUILDING BLOCKS OF SO(2)-STEERABLE KERNELS – RUNNING EXAMPLE FOR SECTION 3 + +In this short chapter, we briefly explain the components of steerable kernels at the specific example of real valued irreps of the circle group SO(2). While this example is quite simple, it shows some non-trivial properties like 2-dimensional endomorphism spaces $\operatorname { E n d } _ { \operatorname { S O ( 2 ) } , \operatorname { R } } ( V _ { J } )$ for $J > 0$ and a Clebsch-Gordan decomposition in which the multiplicity $\left[ J ( j l ) \right]$ can differ from 0 or 1. To give a quick overview: Example A.1 considers the circle as an orbit and homogeneous space of SO(2) while Example A.2 introduces the real valued irreps. Their endomorphisms are stated in Example A.3. As discussed in Example A.4, the Peter-Weyl theorem corresponds here to the usual Fourier series on $S ^ { 1 }$ . The Clebsch-Gordan decomposition of tensor products of the irreps are discussed in Example A.5. With these ingredients, we are ready to instantiate the kernel spaces as described by our Wigner-Eckart Theorem 4.1 for steerable kernels, for which we refer, including proofs, to Section E.2. + +SO(2)-steerable kernels $K : \mathbb { R } ^ { 2 } \mathrm { H o m } _ { \mathrm { R } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \cong \mathbb { R } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ allow for rotation equivariant convolutions. For instance, a convolution with an SO(2)-steerable kernel on $\mathbb { R } ^ { 2 }$ is guaranteed to be $\mathrm { S E } ( 2 ) = ( \mathbb { R } ^ { 2 } , + ) \rtimes \mathrm { S O } ( 2 )$ equivariant while a convolution with an SO(2)-steerable kernel on $S ^ { 2 }$ will be $\mathrm { S O ( 3 ) }$ -equivariant. + +Homogeneous Spaces $\mathrm { S O } ( 2 )$ acts on the kernel’s domain $\mathbb { R } ^ { 2 }$ by rotating it. The orbits of the action are therefore given by 1) the origin $\{ 0 \}$ and 2) circles of arbitrary radius. We know that the kernel constraint can be solved on each orbit individually, and so we can restrict to looking at those. Since $\{ 0 \}$ is rather trivial, we specifically consider the circle $S ^ { 1 }$ as a more interesting homogeneous space. + +Example A.1. Consider the circle $S ^ { 1 }$ and the rotation group SO(2). For convenience, we reparameterize both: we view SO(2) as the group of angles $\phi \in \mathbb { R } / 2 \pi \mathbb { Z } \cong [ 0 , 2 \pi ] / \scriptscriptstyle \mathrm { 0 } . . 2 \pi$ and $S ^ { 1 }$ as the space $\mathbb { R } / 2 \pi \mathbb { Z }$ as well. Then the action of SO(2) on $S ^ { 1 }$ is given by $\phi \cdot x : = ( \phi + x )$ mod $2 \pi$ . It is easy to see that this action is transitive, which makes the circle a homogeneous space of SO(2). + +Irreducible Representations As it is sufficient to solve the kernel constraint for irreducible orthogonal input- and output representations, we now state a classification of those up to isomorphism. + +Example A.2. The irreducible orthogonal representations $\rho _ { l } : \mathrm { S O } ( 2 ) \to \mathrm { O } ( V _ { l } )$ of SO(2) are labeled by indices (“quantum numbers”) $l \in \mathbb { N } _ { \geq 0 }$ . For $l = 0$ , one has the trivial representation with $V _ { 0 } = \mathbb { R }$ and $\rho _ { 0 } ( \phi ) = \mathrm { \bar { i d } _ { R } }$ . For $l \geq 1$ , one has $\bar { V _ { l } = \mathbb { R } ^ { 2 } }$ and + +$$ +\rho _ { l } ( \phi ) = \binom { \cos ( l \phi ) } { \sin ( l \phi ) } - \frac { \sin ( l \phi ) } { \cos ( l \phi ) } \Biggr ) , +$$ + +i.e., rotation matrices of “frequency $l ^ { \dag }$ . The isomorphism classes of irreducible orthogonal representations are then given by $\widehat { \mathrm { S O } ( 2 ) } \cong \mathbb { N } _ { \ge 0 }$ . + +We are thus in the following considering SO(2)-steerable kernels of the form + +$$ +K : S ^ { 1 } \to \operatorname { H o m } _ { \mathbb { R } } ( V _ { l } , V _ { J } ) , +$$ + +where $l , J \geq 0$ + +Endomorphisms Remember that if $c : V _ { J } \to V _ { J }$ is an endomorphism, i.e., commutes with $\rho _ { J }$ , that $c \circ K$ is then steerable as well. Thus, we now look at a classification of the endomorphisms of the irreducible orthogonal representations: + +Example A.3. Let $G = \mathrm { S O ( 2 ) }$ with the irreducible representations $\rho _ { J }$ as in Example A.2. Clearly, the endomorphism space $\mathrm { E n d } _ { \mathrm { S O ( 2 ) , R } } ( V _ { 0 } )$ is 1-dimensional, i.e., $E _ { 0 } = 1$ . For all $J \geq 1$ , the endomorphism space is two-dimensional $E _ { J } = 2$ ) and given by combinations of scalings and rotations8 on $\bar { V } _ { J } = \mathbb { R } ^ { \bar { 2 } }$ . A basis of this space is given by the following two matrices: + +$$ +c _ { 1 } = \mathrm { i d } _ { \mathrm { R } ^ { 2 } } = \left( { \begin{array} { c c } { 1 } & { 0 } \\ { 0 } & { 1 } \end{array} } \right) , \quad c _ { 2 } = \left( { \begin{array} { c c } { 0 } & { - 1 } \\ { 1 } & { 0 } \end{array} } \right) , \quad \operatorname { s p a n } _ { \mathrm { R } } \{ c _ { 1 } , c _ { 2 } \} = \mathrm { E n d } _ { \mathrm { S O } ( 2 ) , \mathrm { K } } ( V _ { J } ) . +$$ + +That $c _ { 1 }$ is an endomorphism of $\rho _ { J }$ for $J \geq 1$ is immediately clear. That the same holds for $c _ { 2 }$ is checked by the following simple calculation: + +$$ +{ \begin{array} { r l } { c _ { 2 } \rho _ { J } ( \phi ) \ = \ { \binom { 0 } { 1 } } \ - 1 ( { \begin{array} { c c } { \cos ( J \phi ) } & { - \sin ( J \phi ) } \\ { \sin ( J \phi ) } & { \cos ( J \phi ) } \end{array} } ) \ = \ { \binom { - \sin ( J \phi ) } { \cos ( J \phi ) } } \ - \ \cos ( J \phi ) \ ) } \\ { = \ ( { \begin{array} { c c } { \cos ( J \phi ) } & { - \sin ( J \phi ) } \\ { \sin ( J \phi ) } & { \cos ( J \phi ) } \end{array} } ) \ { \binom { 0 } { 1 } } \ - 1 ) \ = \ \rho _ { J } ( \phi ) \ c _ { 2 } } \end{array} } +$$ + +The proof that there are no other endomorphisms is sketched in Proposition E.5. + +Peter-Weyl and Harmonic Basis Functions Another ingredient that we need to construct SO(2)- steerable kernels on $S ^ { 1 }$ is the decomposition of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ into its irreducible subrepresentations $V _ { j i }$ , which the Peter-Weyl theorems guarantees to exist. Less abstractly, we are interested in an orthonormal set of harmonic (steerable) basis functions on $S ^ { 1 }$ that span $\bar { L _ { \mathbb { R } } ^ { 2 } } ( S ^ { 1 } )$ – which corresponds to the usual Fourier series on $S ^ { 1 }$ . + +Example A.4. As in Example A.1, we assume $G = \mathrm { S O } ( 2 )$ and $X \ : = \ : S ^ { 1 }$ . A standard result in harmonic analysis says that square-integrable functions $f : S ^ { 1 } \to \mathbb { R }$ , i.e., $f \in L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ , can be uniquely written as an infinite sum of sine and cosine terms, + +$$ +f ( x ) = a _ { 0 } + \sum _ { j = 1 } ^ { \infty } a _ { j } \cos ( j x ) + b _ { j } \sin ( j x ) , +$$ + +where $a _ { 0 }$ and $a _ { j } , b _ { j } , j \geq 1$ are real-valued expansion coefficients. + +How does this result relate to the harmonic basis functions in the Peter-Weyl theorem 3.4? As stated above, we have isomorphism classes ${ \widehat { G } } = { \widehat { \mathrm { S O } ( 2 ) } } \cong \mathbb { N } _ { \geq 0 }$ of irreps with representatives $\rho _ { j }$ . A comparison of the Fourier series in Eq. (8) with property 2 in the Peter-Weyl theorem 3.4 suggests the following identification of harmonic basis functions $Y _ { j } ^ { m }$ and coefficients $\lambda _ { j m }$ , + +$$ +\begin{array} { r l } { Y _ { 0 } ^ { 1 } = \cos _ { 0 } = 1 , \quad } & { \lambda _ { 0 1 } = a _ { 0 } \quad \quad \mathrm { f o r } \quad \quad j = 0 } \\ { Y _ { j } ^ { 1 } = \cos _ { j } \quad \quad , \quad } & { \lambda _ { j 1 } = a _ { j } \quad \quad \mathrm { f o r } \quad \quad j \geq 1 } \\ { Y _ { j } ^ { 2 } = \sin _ { j } \quad \quad , \quad } & { \lambda _ { j 2 } = b _ { j } \quad \quad \mathrm { f o r } \quad \quad j \geq 1 , } \end{array} +$$ + +where we introduced the shorthand notations $\cos _ { j } ( x ) : = \cos ( j x )$ and $\sin _ { j } ( x ) : = \sin ( j x )$ . Note that we dropped the index $i = 1 , \dotsc , m _ { j }$ since $m _ { j } ~ = ~ 1$ for any $j \in \widehat { \mathrm { S O } ( 2 ) }$ . As expected, we have indices $m = 1$ for $j = 0$ with $d _ { j } \ \bar { = } \ \dim ( \bar { V _ { 0 } } ) = 1$ and indices $m = 1 , 2$ for $j \geq 1$ with $d _ { j } = \dim ( V _ { j } ) = 2$ . The orthogonality relations in property 3 of the Peter-Weyl theorem hold up to a simple normalization of these basis functions and are easily checked by explicitly computing the scalar products. Property 1, i.e., the SO(2)-steerability of the harmonic bases, is trivial for $j = 0$ . For $j \geq 1$ , the standard angle summation formulas for cosines and sines lead to the following expressions for harmonics that are translated by $\phi \in \mathrm { S O } ( 2 )$ : + +$$ +\begin{array} { r l } & { \cos _ { j } ( x - \phi ) = \cos _ { j } ( x ) \cos _ { j } ( - \phi ) - \sin _ { j } ( x ) \sin _ { j } ( - \phi ) = \left( \rho _ { j } ^ { 1 1 } ( \phi ) \cos _ { j } + \rho _ { j } ^ { 2 1 } ( \phi ) \sin _ { j } \right) ( x ) } \\ & { \sin _ { j } ( x - \phi ) = \cos _ { j } ( x ) \sin _ { j } ( - \phi ) + \sin _ { j } ( x ) \cos _ { j } ( - \phi ) = \left( \rho _ { j } ^ { 1 2 } ( \phi ) \cos _ { j } + \rho _ { j } ^ { 2 2 } ( \phi ) \sin _ { j } \right) ( x ) , } \end{array} +$$ + +which is just property 1 in the Peter-Weyl theorem. This is concisely summarized by + +$$ +\left( \cos _ { j } \atop \sin _ { j } \right) ( \phi ^ { - 1 } \cdot x ) = \left( \cos _ { j } \atop \sin _ { j } \right) ( x - \phi ) = \rho _ { j } ( \phi ) ^ { \top } \left( \cos _ { j } \atop \sin _ { j } \right) ( x ) , +$$ + +which shows that the basis functions $Y _ { j } ^ { 1 } = \cos _ { j }$ and $Y _ { j } ^ { 2 } = \sin _ { j }$ span an invariant subspace $V _ { j }$ of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ under rotations. From a more abstr splits into the orthogonal direct sum , the Peter-Weyl theorem just states that. $L _ { \mathbb { R } } ^ { 2 ^ { \circ } } ( S ^ { 1 } )$ $\bigoplus _ { j \in { \widehat { \mathrm { S O } ( 2 ) } } } V _ { j }$ + +Tensor Products and Clebsch-Gordan Coefficients Finally, we need to investigate the tensor products of irreducible representations and their decomposition via Clebsch-Gordan coefficients. They will be used to correctly assemble harmonic basis functions to steerable kernels. + +Example A.5. Remember the irreducible representations $\rho _ { l } : \mathrm { S O } ( 2 ) \to \mathrm { O } ( V _ { l } )$ given in Example A.2. As we prove in Proposition E.4, including a description of the Clebsch-Gordan coefficients, the tensor products decompose as follows: + +$$ +V _ { 0 } \otimes V _ { 0 } \cong V _ { 0 } , \quad V _ { j } \otimes V _ { 0 } \cong V _ { j } , \quad V _ { 0 } \otimes V _ { l } \cong V _ { l } , \quad V _ { j } \otimes V _ { l } \cong V _ { | j - l | } \oplus V _ { j + l } , +$$ + +where the last isomorphism only holds if $j , l \geq 1$ and $j \neq l$ . If $j , l \geq 1$ and $j = l$ , then we obtain + +$$ +V _ { l } \otimes V _ { l } \cong ( V _ { 0 } ) ^ { 2 } \oplus V _ { 2 l } , +$$ + +i.e., $V _ { 0 }$ here appears twice in the decomposition of a tensor product of irreducible representations. We therefore have multiplicities $\left[ J ( j l ) \right]$ which are 1 for [0(00 $) ] , [ j ( j 0 ) ] , [ l ( 0 l ) ] , \bar { [ } | j - l | ( j l ) ]$ , $[ j + l ( j l ) ]$ and $[ 2 l ( l l ) ]$ while $[ 0 ( l l ) ] = 2$ . Any other multiplicity is zero. + +Wigner-Eckart theorem for SO(2)-steerable kernels With these ingredients one can then determine all SO(2)-steerable kernels. This is explained in Proposition E.6. + +# B REPRESENTATION THEORY OF COMPACT GROUPS + +In this chapter, we outline the main ingredients of the representation theory of compact groups that we need for our applications to steerable CNNs. Usually, this theory is only developed for representations over the complex numbers. However, since we want to apply it also to steerable CNNs using real representations, we need to be a bit more careful. In particular, we need to make sure that the Peter-Weyl theorem is correctly stated and proven. + +The outline is as follows: In Section B.1, we start by stating all the important definitions and concepts from group theory and representation theory of (unitary) representations that are needed for formulating the Peter-Weyl theorem. After defining Haar measures both for compact groups and their homogeneous spaces and shortly discussing their square-integrable functions, we formulate the Peter-Weyl Theorem B.22. In Section B.2, then, we give a proof of this version of the Peter-Weyl theorem, carefully making sure to not use properties that are only true over C. In some essential steps, mainly the density of the matrix coefficients in the regular representation, we refer to the literature, since the proof clearly does not make use of C per se. While we initially only give the proof for the regular representation, i.e., the space of square-integrable functions on the group itself, we end this section with a discussion of general unitary representations and, in particular, the space of square-integrable functions for an arbitrary homogeneous space. + +In the whole chapter, let K be the field of real or complex numbers. + +B.1 FOUNDATIONS OF REPRESENTATION THEORY AND THE PETER-WEYL THEOREM + +B.1.1 PRELIMINARIES OF TOPOLOGICAL GROUPS AND THEIR ACTIONS + +In this section, we define preliminary concepts from topological groups and their actions. This material can, for example, be found in detail in Arkhangel’skii & Tkachenko (2008). For the topological concepts that we use, we refer to Chapter F.1. + +Definition B.1 (Group, Abelian Group). A group $G = ( G , \cdot , ( \cdot ) ^ { - 1 } , e )$ , most often simply written $G$ , consists of the following data: + +1. A set $G$ of group elements $g \in G$ + +2. A multiplication $\cdot : G \times G \to G , ( g , h ) \mapsto g \cdot h .$ + +3. An inversion $( \cdot ) ^ { - 1 } : G \to G , g \mapsto g ^ { - 1 }$ . + +4. A distinguished unit element $e \in G$ . It is also called neutral element. + +They are assumed to have the following properties for all $g , h , k \in G$ : + +1. The multiplication is associative: $g \cdot ( h \cdot k ) = ( g \cdot h ) \cdot k$ . + +2. The unit element is neutral with respect to multiplication: $e \cdot g = g = g \cdot e$ + +3. The inversion of an element multiplied with itself is the neutral element: $g \cdot g ^ { - 1 } = g ^ { - 1 } \cdot g =$ e. + +A group is called abelian if, additionally, the multiplication is commutative: $g \cdot h = h \cdot g$ for all $g , h \in G$ . If this is the case, a group is often written as $G = ( G , + , - ( \cdot ) , 0 )$ . + +If we consider several groups at once, say $G$ and $H$ , then we often do not distinguish their multiplication, inversion, and neutral elements in notation. It will be clear from the context which group the operation belongs to. + +Definition B.2 (Subgroup). Let $G$ be a group and $H \subseteq G$ a subset. $H$ is called a subgroup if: + +1. For all $h , h ^ { \prime } \in H$ we have $\boldsymbol { h } \cdot \boldsymbol { h } ^ { \prime } \in H$ . +2. For all $h \in H$ we have $h ^ { - 1 } \in H$ . +3. The neutral element $e \in G$ is in $H$ . + +Consequently, $H$ is also a group with the restrictions of the multiplication and inversion of $G$ to $H$ . + +Definition B.3 (Group Homomorphism). Let $G$ and $H$ be groups. A function $f : G \to H$ is called a group homomorphism if it respects the multiplication, inversion, and neutral element, i.e., for all $g , h \in G$ : + +1. $f ( g \cdot h ) = f ( g ) \cdot f ( h )$ . +2. $f ( g ^ { - 1 } ) = f ( g ) ^ { - 1 }$ . +3. $f ( e ) = e$ . + +The second and third properties automatically follow from the first and so do not need to be verified in order to prove that a certain function is a group homomorphism. + +Definition B.4 (Topological Group, Compact Group). Let $G$ be a group and $\tau$ be a topology of the underlying set of $G$ . Then $G = ( \bar { G } , \mathcal { T } )$ is called a topological group (Arkhangel’skii $\&$ Tkachenko, 2008) if both multiplication $G \times G \to G$ , $( x , y ) \mapsto x \cdot y$ and inversion $G G$ , $x \mapsto x ^ { - 1 }$ are continuous maps. Additionally, we always assume the topology to be Hausdorff. + +A topological group is called compact if the underlying topological space is compact. + +From now on, all groups considered are compact topological groups. Furthermore, whenever $G$ is a finite group, we assume that it is a topological group with the discrete topology, i.e., the topology with respect to which all subsets of $G$ are open. + +We will need the following definition in order to define homogeneous spaces: + +Definition B.5 (Group Action). Let $G$ be a compact group and $X$ a topological space. Then a group action of $G$ on $X$ is a continuous function $\cdot : G \times X \to X$ with the following properties: + +1. $( g \cdot h ) \cdot x = g \cdot ( h \cdot x )$ for all $g , h , \in G$ and $x \in X$ . +2. $e \cdot x = x$ for all $x \in X$ . + +We will often simply write $g x$ instead of $g \cdot x$ . Also, note that the multiplication within $G$ is denoted by the same symbol as the group action on the space $X$ . + +Definition B.6 (Orbit). Let $\cdot : G \times X \to X$ be a group action. Let $x \in X$ . Then it’s orbit, denoted $G \cdot x$ , is given by the set + +$$ +G \cdot x : = \{ g \cdot x \mid g \in G \} \subseteq X . +$$ + +Definition B.7 (Transitive Action, Homogeneous Space). Let $\cdot : G \times X \to X$ be a group action. This action is called transitive if for all $x , y \in X$ there exists $g \in G$ such that $g x = y$ . Equivalently, each orbit is equal to $X$ , that is: For all $x \in X$ we have $G \cdot x = X$ . + +$X$ is called a homogeneous space (with respect to the action) if the action is transitive, $X$ is Hausdorff and $X \neq \emptyset$ . + +The Hausdorff condition and non-emptiness in the definition of homogeneous spaces is needed for Lemma B.21, which is necessary to even define a normalized Haar measure on a homogeneous space. Some texts in the literature may define homogeneous spaces without these conditions. + +Definition B.8 (Stabilizer Subgroup). Let · : $G \times X \to X$ be a group action. Let $x \in X$ . The stabilizer subgroup $G _ { x }$ is the subgroup of $G$ given by + +$$ +G _ { x } : = \{ g \in G \mid g x = x \} \subseteq G . +$$ + +Example B.9. The multiplication of the group $G$ is a group action of $G$ on itself. $G$ is a homogeneous space with this action. Furthermore, for each $g \in G$ the stabilizers $G _ { g }$ are the trivial subgroup $e$ . + +In general, homogeneous spaces with the property that all stabilizers are trivial are called torsors or principal homogeneous spaces. Principal homogeneous spaces are topologically indistinguishable from the group itself. + +# B.1.2 LINEAR AND UNITARY REPRESENTATIONS + +In this section, we define many of the foundational concepts about linear and unitary representations (Knapp, 2002; Kowalski, 2014). + +Whenever we will consider linear or unitary representations of compact groups, we want those representations to be continuous. This requires that the vector spaces on which our groups act carry themselves a topology. Prototypical examples of such vector spaces are (pre-)Hilbert spaces. They are the main examples of vector spaces considered in this work. Foundational concepts about (pre)Hilbert spaces can be found in Chapter F.3. The most important difference between how we view pre-Hilbert spaces and how it can often be found in the literature is that in this work, scalar products are antilinear in the first component and linear in the second. This is the convention usually chosen in physics. + +For a vector space $V$ over $\mathbb { K }$ let $\operatorname { G L } ( V )$ be the group of invertible linear functions from $V$ to $V$ . Sometimes in the literature, this is also written ${ \mathrm { G L } } ( V , \mathbb { K } )$ . The multiplication is given by function composition and the neutral element by the identity function $\operatorname { i d } _ { V }$ on $V$ . + +Definition B.10 (Linear Representation). Let $G$ be a compact group and $V$ be a $\mathbb { K }$ -vector space carrying a topology, for example, a (pre)-Hilbert space. Then a linear representation of $G$ on $V$ is a group homomorphism $\rho : G \to { \mathrm { G L } } ( V )$ which is continuous in the following sense: for all $v \in V$ , the function + +$$ +\rho ^ { v } : G \to V , g \mapsto \rho ^ { v } ( g ) : = \rho ( g ) ( v ) +$$ + +is continuous. From the definition we obtain $\rho ( e ) = \mathrm { i d } _ { V }$ , $\rho ( g \cdot h ) = \rho ( g ) \circ \rho ( h )$ and $\rho ( g ^ { - 1 } ) =$ $\rho ( g ) ^ { - 1 }$ for all $g , h \in G$ . For simplicity, we also just say representation or $G$ -representation instead of linear representation. Instead of denoting the representation by $\rho$ , we often denote it by $V$ if the function $\rho$ is clear from the context. + +Note that in this definition, $V$ can be any abstract topological $\mathbb { K }$ -vector space with a topology and does not need to be a space $\mathbb { K } ^ { n }$ or something similar. Consequently, we usually do not view the functions $\rho ( g )$ as matrices, but as abstract linear automorphisms from $V$ to $V$ . + +Definition B.11 (Intertwiner). Let $\rho : G \to { \mathrm { G L } } ( V )$ and $\rho ^ { \prime } : G \to { \mathrm { G L } } ( V ^ { \prime } )$ be two representations over the same group $G$ . An intertwiner between them is a linear function $f : V \ { \stackrel { } { \to } } \ V ^ { \prime }$ that is additionally equivariant with respect to $\rho$ and $\rho ^ { \prime }$ and continuous. Equivariance means that for all $g \in G$ one has $f \circ \rho ( g ) = \rho ^ { \prime } ( g ) \circ f$ , which means the following diagram commutes: + +$$ +\begin{array} { c } { { V \xrightarrow { f } V ^ { \prime } } } \\ { { \rho ( g ) \downarrow } } \\ { { V \xrightarrow [ f ] { } \nu ^ { \prime } } } \end{array} \downarrow \rho ^ { \prime } ( g ) +$$ + +Definition B.12 (Equivalent Representations). Let $\rho : G \to { \mathrm { G L } } ( V )$ and $\rho ^ { \prime } : G \to { \mathrm { G L } } ( V ^ { \prime } )$ be two representations. They are called equivalent if there is an intertwiner $f : V \to V ^ { \prime }$ that has an inverse. That is, there exists an intertwiner ${ \tilde { f } } : V ^ { \prime } \to V$ such that $\tilde { f } \circ f = \operatorname { i d } _ { V }$ and $f \circ { \tilde { f } } = \operatorname { i d } _ { V ^ { \prime } }$ . + +In categorical terms, equivalent representations are isomorphic in the category of linear representations. The reason we do not call them isomorphic is that there is a stronger notion of isomorphism between representations which we will later use, namely isomorphisms of unitary representations. + +Definition B.13 (Invariant Subspace, Subrepresentation, Closed Subrepresentation). Let $\rho : G $ $\operatorname { G L } ( V )$ be a representation. An invariant subspace $W \subseteq V$ is a linear subspace of $V$ such that $\rho ( g ) ( w ) \in W$ for all $g \in G$ and $w \in W$ . Consequently, the restriction $\rho | _ { W } : G \to { \mathrm { G L } } ( W )$ , $g \mapsto \rho ( g ) | _ { W } : W \to W$ is a representation as well, called subrepresentation of $\rho$ . + +A subrepresentation is called closed if $W$ is closed in the topology of $V$ + +Definition B.14 (Irreducible Representation). A representation $\rho : G \to { \mathrm { G L } } ( V )$ is called irreducible if $V \neq 0$ and if the only closed subrepresentations of $V$ are 0 and $V$ itself. An irreducible representation is also shortly called irrep. + +Definition B.15 (Unitary Group). Let $V$ be a pre-Hilbert space. The unitary group $\mathrm { U } ( V )$ of $V$ is defined as the group of all linear invertible maps $f : V \to V$ that respect the inner product, i.e., $\langle f ( x ) | f ( y ) \rangle = \langle x | \bar { y } \rangle$ for all $x , y \in V$ . It is a group with respect to the usual composition and inversion of invertible linear maps. + +Note that if the field $\mathbb { K }$ is the real numbers, then what we call “unitary” is actually called orthogonal, and the group would be denoted $\mathrm { O } ( V )$ . However, the mathematical properties are essentially the same, and since the term “unitary” is more widely used (as normally, representations over the complex numbers are considered) we stick with “unitary”. + +More generally, we have the following: + +Definition B.16 (Unitary Transformation). Let $V , V ^ { \prime }$ be two pre-Hilbert spaces. A unitary transformation $f : V \to V ^ { \prime }$ is a bijective linear function such that ${ \bar { \langle f ( x ) | } } f ( y ) \rangle = \langle x | y \rangle$ for all $x , y \in V$ . These can be regarded as isomorphisms between pre-Hilbert spaces. + +Note that unitary transformations are in particular isometries, i.e., they keep the distances of vectors with respect to the metric defined by the scalar product. For the definition of this metric, see the discussion before and after Definition F.14. + +Definition B.17 (Unitary Representation). Let $V$ be a pre-Hilbert space and $G$ a group. Then a representation $\rho : G \to { \mathrm { G L } } ( V )$ is called a unitary representation if $\rho ( g ) \in \operatorname { U } ( V )$ for all $g \in G$ . We then write $\rho : G \to \operatorname { U } ( V )$ . + +In this whole chapter, the space $V$ of a unitary representation is supposed to be a Hilbert space, instead of just a pre-Hilbert space. Only in chapter $\mathrm { D }$ will we consider unitary representations on pre-Hilbert spaces. Note that all finite-dimensional pre-Hilbert spaces are already complete by Proposition F.47, so in these cases, there is no difference. The same proposition also shows that for finite-dimensional unitary representations, we can ignore the topological closedness condition in order to check whether it is irreducible. It will later turn out that all irreducible representations of a compact group are automatically finite-dimensional anyway, see Proposition B.31, so this further simplifies our considerations. + +As before with the unitary group, a unitary representation is actually called “orthogonal representation” when the field is the real numbers $\mathbb { R }$ . ${ \bar { \operatorname { U } } } ( V )$ is then replaced by $\mathrm { O } ( V )$ . We again stick with $\mathrm { U } ( V )$ whenever the field $\mathbb { K }$ is not specified. + +Definition B.18 (Isomorphism of Unitary Representations). Let $\rho : G \to \operatorname { U } ( V )$ , $\rho ^ { \prime } : G \to \operatorname { U } ( V ^ { \prime } )$ be unitary representations and $f : V \to { \bar { V } } ^ { \prime }$ an intertwiner. $f$ is called an isomorphism (of unitary representations) if, additionally, $f$ is a unitary transformation. The representations are then called isomorphic. For this, we write $\rho \cong \rho ^ { \prime }$ or $V \cong V ^ { \prime }$ depending on whether we want to emphasize the representations or the underlying vector spaces. + +We note the following, which we will frequently use: due to the unitarity of $\rho ( g )$ for a unitary representation $\rho$ , we have $\rho ( g ) ^ { * } = \rho ( g ) ^ { - 1 }$ , i.e., the adjoint is the inverse. Adjoints are defined in Definition F.42 and this statement is proven more generally in Proposition F.44. Overall, this means that $\langle \rho ( g ) ( v ) | w \rangle = \langle v | \rho ( g ) ^ { - 1 } ( w ) \rangle$ for all $v , w$ and $g$ . + +In the end, it will turn out that the Peter-Weyl theorem which we aim at is exclusively a statement about unitary representations. One may then wonder whether this is too restrictive. After all, the representations that we consider for steerable CNNs (with precise definitions given in Section C.1) are not necessarily unitary, and so it is not immediately obvious how the Peter-Weyl theorem will be able to help for those. However, as it turns out, all linear representations on finite-dimensional spaces can be considered as unitary, and so the theory applies. We will discuss this in Proposition B.20 once we understand Haar measures on compact groups. + +B.1.3 THE HAAR MEASURE, THE REGULAR REPRESENTATION AND THE PETER-WEYL THEOREM + +Now that we have introduced many notions in the representation theory of compact groups, we can formulate the most important result, the Peter-Weyl theorem that we will use throughout this work. In the next section, we will then go through a step-by-step proof of this theorem. The material in this section is based on Nachbin & Bechtolsheim (1965); Kowalski (2014) and Knapp (2002). We thank Stefan Dawydiak for a discussion about the Peter-Weyl theorem over the real numbers (Dawydiak, 2020). + +We assume that the reader knows what a measure is (Tao, 2013). Let $G$ be a compact group. A standard result is that there exists a measure $\mu$ on $G$ , called a Haar measure that, among other properties, fulfills the following: + +1. $\mu ( S )$ can be evaluated for all Borel sets $S \subseteq G$ . Here, the Borel sets form the smallest +so-called $\sigma$ -algebra that contains all the open sets. +2. In particular, we can evaluate $\mu ( S )$ for all open or closed sets $S \subseteq G$ . +3. The Haar measure is normalized: $\mu ( G ) = 1$ . +4. $\mu$ is left and right invariant: $\mu ( g S ) = \mu ( S ) = \mu ( S g )$ for all $g \in G$ and $S$ measurable. +5. $\mu$ is inversion invariant: $\mu ( S ^ { - 1 } ) = \mu ( S )$ for all $S$ measurable. + +These properties then translate into properties of the associated Haar integral: let $f : G \to \mathbb { K }$ be integrable with respect to $\mu$ , then we obtain: + +1. $\textstyle \int _ { G } 1 d g = 1$ for the constant function with value 1. +2. $\begin{array} { r } { \int _ { G } f ( h g ) d g = \int _ { G } f ( g ) d g = \int _ { G } f ( g h ) d g } \end{array}$ for all $h \in G$ . +3. $\textstyle \int _ { G } f ( g ^ { - 1 } ) d g = \int _ { G } f ( g ) d g$ . + +Example B.19 (Finite Groups). If $G$ is a finite group with $n$ elements, then the Haar measure is just the normalized counting measure which assigns $\textstyle \mu ( g ) = { \frac { 1 } { n } }$ for all $g \in G$ . Each function $f : G \to \mathbb { K }$ is then integrable, and its integral is just given by + +$$ +\int _ { G } f ( g ) d g = { \frac { 1 } { n } } \sum _ { g \in G } f ( g ) . +$$ + +In this special case, one can easily verify all properties of Haar measures and Haar integrals stated above. + +With this measure defined, we can already understand why all linear representations on finitedimensional spaces can be considered as unitary: + +Proposition B.20. Let $\rho : G \to { \mathrm { G L } } ( V )$ be a linear representation on a finite-dimensional space $V$ . Then there exists a scalar product $\langle \cdot | \cdot \rangle _ { \rho } : V \times V \to \mathbb { K }$ that makes $\left( V , \langle \cdot | \cdot \rangle \right)$ a Hilbert space and such that $\rho$ becomes a unitary representation with respect to this scalar product. + +Proof. Since $V$ is finite-dimensional, there is an isomorphism of vector spaces to some $\mathbb { K } ^ { n }$ . Consequently, there is some scalar product $\langle \cdot | \cdot \rangle : V \times V \to \mathbb { K }$ that makes $V$ a Hilbert space. However, this scalar product does not necessarily make $\rho$ a unitary representation. However, we can define $\langle \cdot | \cdot \rangle _ { \rho } : V \times V \to \mathbb { K }$ by + +$$ +\langle v | w \rangle _ { \rho } : = \int _ { G } \langle \rho ( g ) ( v ) | \rho ( g ) ( w ) \rangle d g . +$$ + +That this integral exists is due to the continuity of linear representations and since also the scalar product is continuous by Proposition F.38. It can easily be checked that this construction makes $V$ a + +Hilbert space. And due to the right invariance of the Haar measure, we can check that $\rho$ is a unitary representation with respect to this scalar product. Namely, for arbitrary $g ^ { \prime } \in G$ we have: + +$$ +\begin{array} { l } { { \displaystyle \left. \rho ( g ^ { \prime } ) ( v ) \big | \rho ( g ^ { \prime } ) ( w ) \right. _ { \rho } = \int _ { G } \left. \rho ( g ) \rho ( g ^ { \prime } ) v \big | \rho ( g ) \rho ( g ^ { \prime } ) w \right. d g } } \\ { { \displaystyle \qquad = \int _ { G } \left. \rho ( g g ^ { \prime } ) ( v ) \big | \rho ( g g ^ { \prime } ) ( w ) \right. d g } } \\ { { \displaystyle \qquad = \int _ { G } \left. \rho ( g ) ( v ) \big | \rho ( g ) ( w ) \right. d g } } \\ { { \displaystyle \qquad = \left. v \big | w \right. _ { \rho } } . } \end{array} +$$ + +Now, for a measure space $Y$ with corresponding measure $\mu$ , we can consider the space of squareintegrable functions on $Y$ with values in $\mathbb { K }$ , denoted $L _ { \mathbb { K } } ^ { 2 } ( Y )$ (the measure is omitted in the notation since there is usually no ambiguity). In these spaces, functions are identified if they coincide on a set with measure 0. $L _ { \mathrm { K } } ^ { 2 } ( Y )$ is clearly a vector space over $\mathbb { K }$ , but it turns out that it can even be considered to be a Hilbert space as follows: + +$$ +\langle f | g \rangle : = \int _ { Y } { \overline { { f ( y ) } } } g ( y ) d y . +$$ + +Here, the overline means complex conjugation. The Hilbert space properties are easily verified. + +In particular, one can consider the space $L _ { \mathbb { K } } ^ { 2 } ( G )$ of square-integrable functions on the group $G$ itself. Now the claim is that $L _ { \mathbb { K } } ^ { 2 } ( G )$ can actually be equipped with a prototypical structure as a unitary representation over $G$ which makes this space, in some sense, “universal among unitary representations”. This works with the following canonical representation, called the regular representation: + +$$ +\lambda : G \to \operatorname { U } ( L _ { \mathbb { K } } ^ { 2 } ( G ) ) , \left[ \lambda ( g ) ( f ) \right] ( g ^ { \prime } ) : = f ( g ^ { - 1 } g ^ { \prime } ) . +$$ + +continuity of this map is non-trivial and is, for example, shown in Knapp (2002). However, the more algebraic properties of being a unitary representation are easy to appreciate. First of all, we clearly see that $\lambda$ is a group homomorphism mapping each group element to a linear automorphism. And finally, the unitarity of this representation can be understood as a direct consequence of the properties of the Haar measure, where we notably make only use of the left-invariance: + +$$ +\begin{array} { l } { \displaystyle \langle \lambda ( g ) ( f ) | \lambda ( g ) ( h ) \rangle = \int _ { G } \overline { { \left[ \lambda ( g ) ( f ) \right] ( g ^ { \prime } ) } } \cdot \left[ \lambda ( g ) ( h ) \right] ( g ^ { \prime } ) d g ^ { \prime } } \\ { \displaystyle = \int _ { G } \overline { { f ( g ^ { - 1 } g ^ { \prime } ) } } \cdot h ( g ^ { - 1 } g ^ { \prime } ) d g ^ { \prime } } \\ { \displaystyle = \int _ { G } \overline { { f ( g ^ { \prime } ) } } h ( g ^ { \prime } ) d g ^ { \prime } } \\ { \displaystyle = \langle f | h \rangle . } \end{array} +$$ + +We saw in Example B.9 that $G$ is a homogeneous space with respect to the action on itself. We can now ask whether these constructions can also work if $X$ is an arbitrary homogeneous space of $G$ . This requires us to define a suitable measure on $X$ . This is indeed possible. For a fixed element $x ^ { * } \in X$ , denote the stabilizer subgroup by $H = G _ { x ^ { * } } \ \subseteq { \cal { G } }$ . Then the Hausdorff property of $X$ allows to write down a homeomorphism between $X$ and $G / H$ , which in turn will allow us to use a canonical measure on $G / H$ that we study below. We denote cosets $g H \in G / H$ by $[ g ]$ . + +Lemma B.21. Let $X$ be a homogeneous space of the compact group $G$ and $H$ the stabilizer subgroup of a fixed element $x ^ { * } \in X$ . Then the map + +$$ +\varphi : G / H \to X , [ g ] \mapsto g x ^ { * } +$$ + +is a homeomorphism. Furthermore, $H$ is topologically closed. + +Proof. Let ${ \tilde { \varphi } } : G \to X$ , $g \mapsto g x ^ { * }$ . This map is equal to the composition of the maps $G G \times X$ , $g \mapsto \left( g , x ^ { * } \right)$ and $G \times X \to X$ , $( g , x ) \mapsto g x$ . Both these are continuous, and thus $\tilde { \varphi }$ is continuous as well. Furthermore, note that if $g ^ { - 1 } g ^ { \prime } \in H$ , then there is $h \in H$ such that $g ^ { \prime } = g h$ , and thus + +$$ +\tilde { \varphi } ( g ^ { \prime } ) = \tilde { \varphi } ( g h ) = ( g h ) x ^ { * } = g ( h x ^ { * } ) = g x ^ { * } = \tilde { \varphi } ( g ) +$$ + +which means that by Proposition F.12, the map $\varphi : G / H \to X , [ g ] \mapsto g x ^ { * }$ is a well-defined continuous map. It is surjective since the action is transitive by definition of a homogeneous space. Furthermore, it is injective since if $g x ^ { * } = g ^ { \prime } x ^ { * }$ then $x ^ { * } = ( g ^ { - 1 } g ^ { \prime } ) x ^ { * }$ and thus $g ^ { - 1 } { \bar { g } } ^ { \prime } \in H$ , which means $[ g ] = [ g ^ { \prime } ]$ . + +Overall, $\varphi$ is a continuous bijective map from $G / H$ to $X$ . Furthermore, $G / H$ is compact since it is the continuous image of the compact group $G$ under the projection $G G / H$ , see Proposition F.8. Since $X$ is Hausdorff by definition of homogeneous spaces, $\varphi$ is a homeomorphism according to Proposition F.9. + +Now, since $X$ is Hausdorff and $\varphi$ is a homeomorphism, it follows that $G / H$ is Hausdorff as well. Then, necessarily, $H$ is a topologically closed subgroup of $G$ , see Bourbaki (1998), Chapter III, Section 2.5, Proposition 13. □ + +Every space $G / H$ where $H$ is topologically closed allows a measure $\mu$ with similar properties to those of $G$ (Nachbin $\&$ Bechtolsheim, 1965). Since the stabilizer $H$ is closed and $X \cong { \overline { { G } } } / H$ by Lemma B.21, we can do these constructions for $X$ as well, as we outline now. The only properties that we now miss are the right-invariance and inversion-invariance: We simply can’t ask for them since $G$ does not naturally act on $X$ from the right and since we cannot invert elements in $X$ . But left-invariance does hold and this means that + +$$ +\lambda : G \to L _ { \mathbb { K } } ^ { 2 } ( X ) , [ \lambda ( g ) ( f ) ] ( x ) : = f ( g ^ { - 1 } x ) +$$ + +makes $L _ { \mathbb { K } } ^ { 2 } ( X )$ a unitary representation over $G$ , as can be shown in the exact same way as for $L _ { \mathbb { K } } ^ { 2 } ( G )$ + +Let $\widehat { G }$ be the set of isomorphism classes of irreducible unitary representations over $G$ . Furthermore, let $\rho _ { l } : G \to V _ { l }$ be a fixed representative of such an isomorphism class $l \in \widehat { G }$ . We write isomorphism classes as $" l "$ (and later also $j$ and $J$ ) in order to bring to mind quantum numbers used in quantum mechanics. Recall from linear algebra that a countable sum of subspaces of a vector space is called direct if no nontrivial subspace of any of the considered spaces is contained in the sum of all the other considered spaces.9 Furthermore, recall that two subspaces $U , W \subseteq V$ of a Hilbert space $V$ are called perpendicular or orthogonal if $\langle u \vert w \rangle = 0$ for all $u \in U$ and $w \in W$ . We then write $U \perp W$ . We can now formulate the Peter-Weyl theorem. Intuitively, it says that $L _ { \mathbb { K } } ^ { 2 } ( X )$ splits into an orthogonal direct sum of the irreducible unitary representations, where each irreducible unitary representation appears maximally as often as its own dimension (and may not appear at all): + +Theorem B.22 (Peter-Weyl Theorem). Let $G$ be a compact group. Let $X$ be a homogeneous space. There are numbers $m _ { l } \in \mathbb { N } _ { \geq 0 }$ for all $l \in \widehat { G }$ and closed-invariant subspaces $V _ { l i } \subseteq L _ { \mathbb { K } } ^ { 2 } ( X )$ for all $l \in \widehat { G }$ and $i \in \{ 1 , \ldots , m _ { l } \}$ such that the following hold: + +1. $V _ { l i } \cong V _ { l }$ as unitary representations for all i and $l$ + +2. $m _ { l } \leq \dim ( V _ { l } ) < \infty$ for all $l$ . + +3. $V _ { l i } \perp V _ { l ^ { \prime } j }$ whenever ${ \mathit { l } } \neq { \mathit { l } } ^ { \prime }$ or $i \neq j$ + +4. $\textstyle \bigoplus _ { l \in { \widehat { G } } } \bigoplus _ { i = 1 } ^ { m _ { l } } V _ { l i }$ is topologically dense in $L _ { \mathbb { K } } ^ { 2 } ( X )$ , written $L _ { \mathbb { K } } ^ { 2 } ( X ) = { \widehat { \bigoplus } } _ { l \in { \widehat { G } } } \bigoplus _ { i = 1 } ^ { m _ { l } } V _ { l i }$ + +Now additionally consider $G$ as a homogeneous space of itself. Then the same holds for $L _ { \mathbb { K } } ^ { 2 } ( G )$ as well, with numbers $n _ { l } \le \dim ( V _ { l } ) < \infty$ . We additionally have the following: + +1. $m _ { l } \le n _ { l }$ . +2. If $\mathbb { K } = \mathbb { C } ,$ , then $n _ { l } = \dim ( V _ { l } )$ . + +Note that the representative $V _ { l }$ is not assumed to be embedded in $L _ { \mathbb { K } } ^ { 2 } ( X )$ . It is just isomorphic, as a unitary representation, to each of the $V _ { l i } \subseteq L _ { \mathbb { K } } ^ { 2 } ( X )$ . + +Example B.23. For $G = \mathrm { S O } ( 2 )$ and $\mathbb { K } = \mathbb { C }$ we have $L _ { \mathbb { C } } ^ { 2 } ( \mathrm { S O ( 2 ) } ) = \widehat { \oplus } _ { l \in \mathbb { Z } } V _ { l 1 }$ and all irreducible representations $V _ { l }$ are 1-dimensional. + +For $G = \mathrm { S O ( 2 ) }$ and $\mathbb { K } = \mathbb { R }$ , we obtain $L _ { \mathbb { R } } ^ { 2 } ( \mathrm { S O } ( 2 ) ) = \widehat { \bigoplus } _ { l \geq 0 } V _ { l 1 }$ , and all irreducible representations $V _ { l }$ with $l \geq 1$ are two-dimensional, whereas $V _ { 0 }$ is one-dimensional. Thus, here we see an example where the multiplicity of most irreducible representations in the regular representation is 1 and therefore smaller than their dimension, which cannot happen for representations over the complex numbers. + +Both of these results are standard results in harmonic analysis. These examples are discussed in more detail, especially with respect to their applications in deep learning, in Section E.1 and E.2. + +# B.2 A PROOF OF THE PETER-WEYL THEOREM + +This section presents a proof of the Peter-Weyl theorem, as formulated in Theorem B.22. We mostly skip the analytical parts of the proof,10 since they are well-presented in the literature and clearly work over both the real and complex numbers. However, the more algebraic parts of the proof usually make use of the property of the complex numbers to be algebraically closed, which does not hold for the real numbers. This is invoked usually both in the proof of a version of Schur’s lemma, as well as in proving Schur’s orthogonality. We therefore carefully adapt the proof of the Peter-Weyl theorem in the literature so that it also works over the real numbers, and formulate and prove versions of Schur’s Lemma B.29 and Schur’s orthogonality B.30 that work in general. + +This section can be skipped if the interest is mainly in the applications of the Peter-Weyl theorem. +In this case, the reader is advised to directly move on to Chapter C. + +We note the following convention that applies to this section: for all unitary representations $\rho : G $ $\mathrm { U } ( V )$ that we consider here, $V$ is a Hilbert space (instead of just a pre-Hilbert space). + +# B.2.1 DENSITY OF MATRIX COEFFICIENTS + +An important ingredient in the construction of the spaces $V _ { l i }$ that appear in the formulation of the Peter-Weyl Theorem B.22 are matrix coefficients, which together generate those spaces in case that one considers the regular representation on $L _ { \mathbb { K } } ^ { 2 } ( G )$ . + +Definition B.24 (Matrix Coefficients). Let $\rho : G \to \operatorname { U } ( V )$ be a unitary representation. A matrix coefficient is any function of the form + +$$ +\rho ^ { u v } : G \to \mathbb { K } , g \mapsto { \overline { { \langle u | \rho ( g ) ( v ) \rangle } } } +$$ + +for arbitrary $u , v \in V$ + +The term “matrix coefficient” comes from the analogy to matrix elements of linear maps between pre-Hilbert spaces of which orthonormal bases are fixed. Later, in Definition D.9 we will also define the notion of “matrix elements” separately. The term “matrix coefficient” only applies to unitary representations. + +Remark B.25. By definition of linear representations, the function $g \mapsto \rho ( g ) ( v )$ is continuous. Thus, since scalar products of Hilbert spaces are also continuous as functions on $V \times V$ , see Proposition F.38, every matrix coefficient $\rho ^ { u v } : G \to \mathbb { K }$ is continuous. As a continuous function on a compact space, it is of course also square-integrable, i.e., $\rho ^ { u v } \in L _ { \mathbb { K } } ^ { 2 } ( G )$ . The Peter-Weyl theorem basically asserts that these matrix coefficients can be considered as the building blocks of all square-integrable functions. + +Furthermore, one may wonder why there is a complex conjugation in the definition. The reason for this is that, otherwise, the isomorphism that we will construct in Proposition B.35 is not linear but conjugate linear. The reason why this can nevertheless be called a matrix coefficient is that this actually is the matrix coefficient (without complex conjugation) on a conjugate Hilbert space, as explained in the next Proposition, which we took from Williams (1991). + +Proposition B.26. Let $\rho : G \to \operatorname { U } ( V )$ be a unitary representation on a Hilbert space $V$ with scalar multiplication $\cdot _ { V }$ and scalar product $\langle \cdot | \cdot \rangle _ { V }$ . We have the following: + +1. ${ \tilde { V } } : = V$ (equality as abelian groups) with $\alpha \cdot _ { \tilde { V } } v : = \overline { { \alpha } } \cdot _ { V } \ i$ v and $\langle u | v \rangle _ { \tilde { V } } : = \overline { { \langle u | v \rangle } }$ is again $a$ Hilbert space, the so-called conjugate Hilbert space of $V$ . + +2. ${ \tilde { \rho } } : G \to \operatorname { U } ( { \tilde { V } } )$ with $\tilde { \rho } ( g ) : = \rho ( g )$ is again a unitary representation. + +3. For the matrix coefficients, we have $\tilde { \rho } ^ { u v } ( g ) = \overline { { \rho ^ { u v } ( g ) } }$ . + +Proof. All these assertions are easy to check. As a demonstration, we do 3: + +$$ +\widetilde { \rho } ^ { u v } ( g ) = \overline { { \langle u | \widetilde { \rho } ( g ) ( v ) \rangle } } _ { \widetilde { V } } = \overline { { \overline { { \langle u | \rho ( g ) ( v ) \rangle } } } } _ { V } = \overline { { \rho ^ { u v } ( g ) } } . +$$ + +That’s what we wanted to show. + +As a consequence of this proposition, the matrix coefficient $\rho ^ { u v } ( g )$ is equal to $\overline { { \tilde { \rho } ^ { u v } ( g ) } }$ , thus being a “matrix coefficient without complex conjugation above the scalar product” of the conjugate unitary representation. + +Theorem B.27 (Density of Matrix Coefficients). The linear span of the matrix-coefficients of finitedimensional, unitary, irreducible representations of $G$ are dense in $L _ { \mathbb { K } } ^ { 2 } ( G )$ for all compact groups $G$ . + +Proof. For $\mathbb { K } = \mathbb { C }$ , this is shown in Knapp (2002). The same proof, without adaptions, also works for $\mathbb { K } = \mathbb { R }$ . Note that the cited proof uses a definition of matrix coefficients without the complex conjugation. However, Proposition B.26 shows those span the same space, and thus we can apply it to our situation. □ + +# B.2.2 SCHUR’S LEMMA, SCHUR’S ORTHOGONALITY AND CONSEQUENCES + +In this section, we state and prove versions of Schur’s lemma and Schur’s Orthogonality (Knapp, 2002) that are valid for both $\mathbb { K } = \mathbb { R }$ and $\mathbb { K } = \mathbb { C }$ . + +Lemma B.28. Let $\rho : G \to \operatorname { U } ( V )$ and $\rho ^ { \prime } : G \to \operatorname { U } ( V ^ { \prime } )$ be unitary representations. Furthermore, let $f : V \to V ^ { \prime }$ be an intertwiner. Then the adjoint $f ^ { * } : V ^ { \prime } \to V$ is also an intertwiner. + +Proof. The adjoint $f ^ { * } : V ^ { \prime } \to V$ is the unique continuous linear function from $V ^ { \prime }$ to $V$ such that, for all $v \in V$ and $v ^ { \prime } \in V ^ { \prime }$ , we have + +$$ +\langle f ( v ) | v ^ { \prime } \rangle = \langle v | f ^ { * } ( v ^ { \prime } ) \rangle . +$$ + +This always exists according to Definition F.42. Note that with $f$ being an intertwiner and using the unitarity of the representations, we obtain for all $g \in G , v \in V$ and $v ^ { \prime } \in V ^ { \prime }$ : + +$$ +\begin{array} { r l } & { \langle v | \rho ( g ) f ^ { * } ( v ^ { \prime } ) \rangle = \langle \rho ( g ^ { - 1 } ) ( v ) | f ^ { * } ( v ^ { \prime } ) \rangle } \\ & { \qquad = \langle f \rho ( g ^ { - 1 } ) ( v ) | v ^ { \prime } \rangle } \\ & { \qquad = \langle \rho ^ { \prime } ( g ^ { - 1 } ) f ( v ) | v ^ { \prime } \rangle } \\ & { \qquad = \langle f ( v ) | \rho ^ { \prime } ( g ) ( v ^ { \prime } ) \rangle } \\ & { \qquad = \langle v | f ^ { * } \rho ^ { \prime } ( g ) ( v ^ { \prime } ) \rangle } \end{array} +$$ + +from which we deduce $\rho ( g ) f ^ { * } = f ^ { * } \rho ^ { \prime } ( g )$ from Proposition F.45 for all $g \in G$ , i.e., $f ^ { * }$ is an intertwiner. + +Lemma B.29 (Schur’s Lemma for unitary Representations). Assume $\rho : G \to \operatorname { U } ( V )$ and $\rho ^ { \prime } : \mathbf { \tau }$ $G \mathrm { U } ( V ^ { \prime } )$ are irreducible unitary representations with $V$ finite-dimensional. Also assume that $f : V \to V ^ { \prime }$ is an intertwiner. Then either $f ~ = ~ 0$ or there is $\mu \in \mathbb { R } _ { > 0 }$ such that $\mu f$ is an isomorphism. + +Proof. For this proof, we follow the exposition of Tao (2011). We thank Terrence Tao for confirming in the discussion below his blogpost that this lemma can also be proven over the real numbers. + +Let $f ^ { * } : V ^ { \prime } \to V$ be the adjoint of $f$ , which is also an intertwiner by Lemma B.28. Now, set $\varphi : = f ^ { * } \circ f : V \to V$ . As a composition of intertwiners, $\varphi$ is also an intertwiner. Furthermore, for arbitrary composable continuous linear functions between Hilbert spaces one always has $( g \circ$ $h ) ^ { * } = h ^ { * } \circ g ^ { * }$ and $\left( g ^ { * } \right) ^ { * } = g$ , which easily follows from the definition and uniqueness of adjoints. Consequently, we have + +$$ +\varphi ^ { \ast } = ( f ^ { \ast } \circ f ) ^ { \ast } = f ^ { \ast } \circ ( f ^ { \ast } ) ^ { \ast } = f ^ { \ast } \circ f = \varphi , +$$ + +and so $\varphi$ is self-adjoint. Thus, $\langle \varphi ( v ) | w \rangle = \langle v | \varphi ( w ) \rangle$ for all $v , w \in V$ , from which we conclude that the matrix of $\varphi$ corresponding to any orthonormal basis of $V$ is Hermitian or, if $\mathbb { K } = \mathbb { R }$ , even symmetric. Such an orthonormal basis exists by Proposition F.41. From the Spectral Theorem for Hermitian or symmetric matrices (Horn & Johnson, 2012) we conclude that $\varphi$ is unitarily (or for real matrices: orthogonally) diagonalizable with only real eigenvalues. Thus, there is an orthogonal decomposition of $V$ into eigenspaces: $V = \oplus _ { \lambda }$ eigenvalue $E _ { \lambda } ( \varphi )$ . + +Let $E _ { \lambda } ( \varphi )$ be any eigenspace. We now claim that it is an invariant subspace of $\rho$ . Indeed, for all $g \in G$ and $v \in E _ { \lambda } ( \varphi )$ we have since $\varphi$ is an intertwiner: + +$$ +\varphi ( \rho ( g ) ( v ) ) = \rho ( g ) ( \varphi ( v ) ) = \rho ( g ) ( \lambda v ) = \lambda \rho ( g ) ( v ) . +$$ + +Since $V$ is finite-dimensional, $E _ { \lambda } ( \varphi )$ is topologically closed by Proposition F.47, and since $V$ is irreducible, we necessarily have $E _ { \lambda } ( \varphi ) = 0$ or $\bar { E } _ { \lambda } ( \varphi ) = V$ . Since not all eigenspaces can be zero, we conclude that there is an eigenvalue $\lambda$ with $E _ { \lambda } ( \varphi ) = V$ , meaning $\varphi = \lambda \mathrm { i d } _ { V }$ . + +Assume $f \neq 0$ . We now claim that $\lambda > 0$ . Indeed, note that for all $v \in V$ we have + +$$ +\begin{array} { r l } & { \lambda \| v \| ^ { 2 } = \langle \varphi ( v ) | v \rangle } \\ & { \qquad = \langle f ^ { * } \circ f ( v ) | v \rangle } \\ & { \qquad = \langle f ( v ) | f ( v ) \rangle } \\ & { \qquad = \| f ( v ) \| ^ { 2 } . } \end{array} +$$ + +Thus, if $v \in V$ is any vector with $f ( v ) \neq 0$ , then we obtain $\begin{array} { r } { \lambda = \left( \frac { \| f ( v ) \| } { \| v \| } \right) ^ { 2 } > 0 } \end{array}$ + +Now define $g : V \to V ^ { \prime }$ as $g = \lambda ^ { - \frac { 1 } { 2 } } f$ . $g$ is clearly still an intertwiner. We can also show it is an isometry: + +$$ +\begin{array} { l } { { \langle g ( v ) | g ( w ) \rangle = \lambda ^ { - 1 } \langle f ( v ) | f ( w ) \rangle } } \\ { { \ = \lambda ^ { - 1 } \langle \varphi ( v ) | w \rangle } } \\ { { \ = \lambda ^ { - 1 } \lambda \langle v | w \rangle } } \\ { { \ = \langle v | w \rangle . } } \end{array} +$$ + +Note that since $V ^ { \prime }$ is irreducible and $f ( V ) ~ \subseteq ~ V ^ { \prime }$ topologically closed due to $V$ being finitedimensional, we necessarily have that $f$ is surjective. Thus, we have shown that $\mu f$ with $\mu : = \lambda ^ { - \frac { 1 } { 2 } }$ is an isomorphism of unitary representations. □ + +Proposition B.30 (Schur’s Orthogonality). Let $\rho : G \to \operatorname { U } ( V )$ and $\rho ^ { \prime } : G \to \operatorname { U } ( V ^ { \prime } )$ be nonisomorphic irreducible unitary representations of the compact group $G$ , of which at least one is finite-dimensional. Let $\rho ^ { u v }$ and $\rho ^ { \prime } { } ^ { \bar { u } ^ { \prime } v ^ { \prime } }$ be matrix coefficients of them, which are functions in $L _ { \mathbb { K } } ^ { 2 } ( G )$ due to their continuity. Then they are orthogonal, i.e., $\left. \rho ^ { u v } \Big | \rho ^ { \prime u ^ { \prime } v ^ { \prime } } \right. = 0 .$ . + +Proof. Without loss of generality, we can assume $V ^ { \prime }$ to be finite-dimensional. Assume that $l : V ^ { \prime } $ $V$ is any linear function. We can associate to it the function $f : V ^ { \prime } \to V$ given by + +$$ +f ( w ^ { \prime } ) : = \int _ { G } \rho ( g ) l \rho ^ { \prime } ( g ) ^ { - 1 } w ^ { \prime } d g . +$$ + +For all $h \in G$ we have + +$$ +\begin{array} { l } { \displaystyle { \rho ( h ) f \rho ^ { \prime } ( h ) ^ { - 1 } = \int _ { G } \rho ( h ) \rho ( g ) l \rho ^ { \prime } ( g ) ^ { - 1 } \rho ^ { \prime } ( h ) ^ { - 1 } d g } } \\ { \displaystyle { \quad = \int _ { G } \rho ( h g ) l \rho ^ { \prime } ( h g ) ^ { - 1 } d g } } \\ { \displaystyle { \quad = \int _ { G } \rho ( g ) l \rho ^ { \prime } ( g ) ^ { - 1 } d g } } \\ { \displaystyle { \quad = f , } } \end{array} +$$ + +and thus $\rho ( h ) f = f \rho ^ { \prime } ( h )$ , which means that $f$ is an intertwiner. In this derivation, $\rho ( h )$ could be put insight the integral since $\rho ( h )$ is continuous and an integral is a limit over finite sums, which commutes with the continuous $\rho ( h )$ . By Schur’s Lemma B.29, we necessarily have $f = 0$ . Now look at the specific linear function $l : V ^ { \prime } \to V$ given by $l ( w ^ { \prime } ) : = \langle v ^ { \prime } | w ^ { \prime } \rangle v$ with the fixed vectors $v , v ^ { \prime }$ corresponding to the matrix coefficients. We obtain $f = 0$ , for $f$ defined as before, and thus: + +$$ +\begin{array} { r l } { 0 = \langle u | f ( u ^ { \prime } ) \rangle = u \Big \vert \int _ { G } \varphi ^ { ( i _ { 2 } ) / i _ { 2 } \beta ^ { \prime } } ( g ) ^ { - 1 } ( u ^ { \prime } ) d g } & { } \\ & { = \int _ { G } u | \rho ( g ) | i \rho ^ { \prime } ( g ) ^ { - 1 } ( u ^ { \prime } ) \rangle d g } \\ & { = \int _ { G } u \Big \vert \rho ( g ) [ \langle v ^ { \prime } | \rho ^ { \prime } ( g ) ^ { - 1 } ( u ^ { \prime } ) \rangle v ] d g } \\ & { = \int _ { G } u | \rho ( g ) ( v ) \rangle \cdot v ^ { \prime } | \rho ( g ) ^ { - 1 } ( u ^ { \prime } ) \rangle d g } \\ & { = \int _ { G } \frac { 1 } { \langle u | \rho ( g ) ( v ) \rangle } \cdot \frac { 1 } { \langle u ^ { \prime } | \rho ( g ) ( v ^ { \prime } ) \rangle / d g } } \\ & { = \int _ { G } \frac { 1 } { \rho ^ { \prime \prime \prime } ( g ) \rho ( g ) \rho ^ { \prime \prime } ( g ) d g } } \\ & { = \int _ { G } \frac { 1 } { \rho ^ { \prime \prime \prime } ( g ) \rho ^ { \prime \prime \prime } ( g ) d g } } \\ & { = \langle \rho ^ { \mathrm { a r } } | \rho ^ { \mathrm { a r } } \rangle . } \end{array} +$$ + +In this derivation, the integral could be put out of the scalar product since the scalar product is continuous, see Proposition F.38, and since integrals are certain limits over finite sums, with which the scalar product commutes. □ + +Note that there are more general Schur’s orthogonality relations in the case that $\mathbb { K } = \mathbb { C }$ , see Knapp (2002), Corollary 4.10. These then engage with the matrix coefficients of one and the same representation. This, together with a version of Schur’s lemma that only holds over $\mathbb { C }$ leads to the strengthening of the Peter-Weyl theorem that shows that the multiplicities $n _ { l }$ are given by $\dim ( V _ { l } )$ . + +Proposition B.31. All irreducible unitary representations of a compact group $G$ are finitedimensional. + +Proof. Assume $\rho : G \to \operatorname { U } ( V )$ was an irreducible unitary representation on an infinite-dimensional space $V$ . Let $\rho ^ { u v }$ be any of its matrix coefficients. By Proposition B.30, and since an infinitedimensional representation can never be isomorphic to a finite-dimensional representation, $\rho ^ { u v }$ is perpendicular to all matrix coefficients of finite-dimensional irreducible unitary representations. Due to the linearity of the scalar product, $\rho ^ { u v }$ is perpendicular to the whole linear span of these matrix coefficients and thus to the topological closure of this span. The last step follows from the continuity of the scalar product, see Proposition F.38. By Theorem B.27 this closure is the whole space $L _ { \mathbb { K } } ^ { 2 } ( G )$ . Therefore, $\rho ^ { u v }$ is even perpendicular to itself, and thus $\rho ^ { u v } = 0$ . + +Overall, for arbitrary $u , v \in V$ and $g \in G$ we obtain $0 = \rho ^ { u v } ( g ) = \overline { { \langle u | \rho ( g ) ( v ) \rangle } }$ and thus (by setting $u = \rho ( g ) ( v ) ) \rho ( g ) ( v ) = 0$ and consequently $\rho ( g ) = 0$ . We obtain $\rho = 0$ , a contradiction. Thus infinite-dimensional irreducible unitary representations cannot exist. □ + +As a consequence, we mention that the finiteness conditions in Schur’s lemma and Schur’s Orthogonality were not necessary to state since all irreducible unitary representations are finite-dimensional anyway. We obtain from this and from Schur’s Lemma B.29 that isomorphism classes and equivalence classes of irreducible unitary representations are one and the same. + +B.2.3 A PROOF OF THE PETER-WEYL THEOREM FOR THE REGULAR REPRESENTATION + +In this section, we engage with the Peter-Weyl theorem for the regular representation on $L _ { \mathbb { K } } ^ { 2 } ( G )$ . The case of $L _ { \mathbb { K } } ^ { 2 } ( X )$ for a homogeneous space $X$ will be dealt with in Section B.2.4. The core arguments in the proofs of this section are adapted from Williams (1991). + +As before, let $\widehat { G }$ be the set of isomorphism classes of irreducible representations of $G$ . For $l \in \widehat { G }$ let $\rho _ { l }$ bbe a representative for the isomorphism class $l$ . Furthermore, for each $\rho _ { l } : G \to \operatorname { U } ( V _ { l } )$ + +let $v _ { l } ^ { 1 } , \ldots , v _ { l } ^ { \dim ( V _ { l } ) }$ be an arbitrary orthonormal basis, which exists due to Proposition F.41 (mostly written without the superscript, i.e., as $v ^ { 1 } , v ^ { 2 } , \ldots$ , if the corresponding isomorphism class is clear). Denote $\rho _ { l } ^ { i j } : = \rho _ { l } ^ { v ^ { i } v ^ { j } }$ . Remember that matrix coefficients of unitary representations are continuous by Remark B.25, and thus functions in $L _ { \mathbb { K } } ^ { 2 } ( G )$ . Then, let ${ \mathcal { E } } \subseteq L _ { \mathbb { K } } ^ { 2 } ( G )$ be the linear span of the matrix coefficients of all irreducible unitary representations. In the next Lemma, we want to show that $\mathcal { E }$ is already spanned by the matrix coefficients corresponding to representatives of isomorphism classes and their orthonormal bases: + +Lemma B.32. We have + +$$ +\mathcal { E } = \operatorname { s p a n } _ { \mathbb { K } } \left\{ \rho _ { l } ^ { i j } \vert l \in \widehat { G } , i , j \in \{ 1 , \ldots , \dim ( V _ { l } ) \} \right\} . +$$ + +Proof. First, we show that isomorphic representations don’t add distinct matrix coefficients. Thus, let $\rho \cong \rho _ { l }$ and let $f : V \to V _ { l }$ be the corresponding isomorphism. Then we have $\rho _ { l } ( g ) \circ f = f \circ \rho ( g )$ and thus, since $f$ is a unitary transformation, $\rho ( g ) = f ^ { * } \circ \bar { \rho _ { l } } ( g ) \circ f$ , for all $g \in G$ , see Proposition F.44. Now let $u , v \in V$ be arbitrary. We obtain + +$$ +\begin{array} { l } { \rho ^ { u v } ( g ) = \overline { { \langle u | \rho ( g ) ( v ) \rangle } } } \\ { = \overline { { \langle u | f ^ { * } \rho _ { l } ( g ) f ( v ) \rangle } } } \\ { = \overline { { \langle f ( u ) | \rho _ { l } ( g ) ( f ( v ) ) \rangle } } } \\ { = \rho _ { l } ^ { f ( u ) f ( v ) } ( g ) , } \end{array} +$$ + +which proves the first claim. Now we want to show that we only need to consider the $\rho _ { l } ^ { i j }$ . Thus, let $u , v \in V _ { l }$ be arbitrary. They allow for linear combinations + +$$ +u = \sum _ { i } \lambda ^ { i } v ^ { i } , v = \sum _ { i } \mu ^ { i } v ^ { i } +$$ + +with coefficients $\lambda ^ { i } , \mu ^ { i } \in \mathbb { K }$ . We obtain: + +$$ +\begin{array} { r l } & { \rho _ { l } ^ { u v } ( g ) = \overline { { \langle u | \rho _ { l } ( g ) ( v ) \rangle } } } \\ & { \qquad = \sum _ { i } \sum _ { j } \lambda ^ { i } \overline { { \mu ^ { j } } } \cdot \overline { { \langle v ^ { i } | \rho _ { l } ( g ) ( v ^ { j } ) \rangle } } } \\ & { \qquad = \left( \sum _ { i } \sum _ { j } \lambda ^ { i } \overline { { \mu ^ { j } } } \rho _ { l } ^ { i j } \right) ( g ) , } \end{array} +$$ + +thus showing that $\rho _ { l } ^ { u v }$ is in the linear span of the matrix coefficients corresponding to the orthonormal basis. This concludes the proof. □ + +For an isomorphism class $l \in { \widehat { G } }$ , let $\mathcal { E } _ { l } : = \operatorname { s p a n } \left\{ \rho _ { l } ^ { i j } \mid i , j \in \{ 1 , \dots , \dim ( V _ { l } ) \} \right\} \subseteq L _ { \mathbb { K } } ^ { 2 } ( G )$ be the linear subspace of $\mathcal { E }$ generated by matrix coefficients corresponding to $l$ . Let furthermore for all $j$ the space $\mathcal { E } _ { l } ^ { j } \subseteq \mathcal { E } _ { l }$ be the subspace generated by all $\rho _ { l } ^ { i j }$ for $i \in \{ 1 , \dots , \dim ( V _ { l } ) \}$ . In the next lemma, we prove that these are actually closed subrepresentations of the regular representation. + +Lemma B.33. For $j \in \{ 1 , \dots , \dim ( V _ { l } ) \}$ , $\mathcal { E } _ { l } ^ { j }$ is a closed invariant subspace of $L _ { \mathbb { K } } ^ { 2 } ( G )$ . In particular, $\mathcal { E } _ { l }$ is a closed invariant subspace of $L _ { \mathbb { K } } ^ { 2 } ( G )$ . + +Proof. Closedness follows immediately since this space is finite-dimensional and thus complete, see Proposition F.47. We need to show that $\lambda ( g ) \rho _ { l } ^ { i j } \in \mathcal { E } _ { l } ^ { j }$ for all $g \in G$ and all $i , j$ . We can compute + +this directly: + +$$ +\begin{array} { r l } { \left( \lambda ( g ) \rho _ { i } ^ { i j } \right) ( g ^ { \prime } ) = \rho _ { i } ^ { i j } ( g ^ { - 1 } g ^ { \prime } ) } \\ & { = \overline { { \langle v ^ { \downarrow } | \rho _ { i } ( g ^ { - 1 } g ^ { \prime } ) ( v ^ { i j } ) \rangle } } } \\ & { = \overline { { \langle \rho _ { i } ( g ) ( v ^ { i } ) | \rho _ { i } ( g ^ { \prime } ) ( v ^ { j } ) \rangle } } } \\ & { = \overline { { \langle \sum _ { i ^ { \prime } } \langle v ^ { i ^ { \prime } } | \rho _ { i } ( g ) ( v ^ { i } ) \rangle } } \overline { { v ^ { i ^ { \prime } } | \rho _ { i } ( g ^ { \prime } ) ( v ^ { i } ) \rangle } } } \\ & { = \sum _ { i ^ { \prime } } \overline { { \langle v ^ { \downarrow } | \rho _ { i } ( g ) ( v ^ { i } ) \rangle } } \cdot \overline { { \langle v ^ { i ^ { \prime } } | \rho _ { i } ( g ^ { \prime } ) ( v ^ { j } ) \rangle } } } \\ & { = \sum _ { i ^ { \prime } } \overline { { \langle v ^ { \downarrow } | \rho _ { i } ( g ^ { - 1 } ) ( v ^ { i ^ { \prime } } ) \rangle } } \overline { { \rho _ { i } ^ { \prime } \langle j ^ { \prime } \rangle } } } \\ & { = \left( \sum _ { i ^ { \prime } } \rho _ { i ^ { \prime } } ^ { i i ^ { \prime } } ( g ^ { - 1 } ) \rho _ { i ^ { \prime } } ^ { i ^ { \prime } } \right) ( g ^ { \prime } ) } \end{array} +$$ + +where the coefficients $\rho _ { l } ^ { i i ^ { \prime } } ( g ^ { - 1 } )$ do not depend on $g ^ { \prime }$ . Consequently, $\lambda ( g ) \rho _ { l } ^ { i j } \in \mathcal { E } _ { l } ^ { j }$ . + +Lemma B.34. Let $\rho : G \to \operatorname { U } ( V )$ and $\rho ^ { \prime } : G \to \operatorname { U } ( V ^ { \prime } )$ be unitary representations, $\rho$ being irreducible and $V ^ { \prime } \ne 0$ . Furthermore, assume that $f : V \to V ^ { \prime }$ is a surjective intertwiner. Then $V ^ { \prime }$ is also irreducible and $f$ an equivalence. + +Proof. Assume by contradiction that $V ^ { \prime }$ is reducible. Thus, there is a nontrivial closed invariant subspace $0 \subsetneq W \subsetneq V ^ { \prime }$ . Now the following can easily be checked: + +1. $0 \subsetneq f ^ { - 1 } ( W ) \subsetneq V$ . +2. $f ^ { - 1 } ( W )$ is an invariant subspace of $V$ . +3. $f ^ { - 1 } ( W )$ is a closed subset of $V$ . + +Once we have this, we have a contradiction to the fact that $V$ is irreducible. + +1 and 2 can be checked by the reader, and 3 follows since $V$ is, as an irreducible representation, finite-dimensional by Proposition B.31 and thus every subspace is closed by Proposition F.47. + +Therefore, we know that $V ^ { \prime }$ is irreducible. Now use Schur’s Lemma B.29 to conclude that $f$ , being nonzero, necessarily is an equivalence. □ + +Proposition B.35. There is an equivalence of representations $f _ { l } ^ { j } : V _ { l } \mathcal { E } _ { l } ^ { j }$ given on the orthonormal basis by $f _ { l } ^ { j } ( v ^ { i } ) = \rho _ { l } ^ { i j }$ . Consequently, there is an isomorphism $V _ { l } \cong \mathcal { E } _ { l } ^ { j }$ of unitary representations. + +Proof. We need to show that $f _ { l } ^ { j }$ is equivariant. Using the result of the derivation of Lemma B.33, we compute + +$$ +\begin{array} { r l } & { f _ { l } ^ { j } ( \rho _ { l } ( g ) ( v ^ { i } ) ) = f _ { l } ^ { j } \left( \sum _ { i ^ { \prime } } \langle v ^ { i } | \rho _ { l } ( g ) ( v ^ { i } ) \rangle v ^ { i ^ { \prime } } \right) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array} +$$ + +so $f _ { l } ^ { j } \circ \rho _ { l } ( g ) = \lambda ( g ) \circ f _ { l } ^ { j }$ for all $g \in G$ , which is what we wanted to show. That $f$ is an intertwiner also requires it to be continuous: this follows since $V _ { l }$ is finite-dimensional, and so all linear functions on it are continuous. + +Now, that $f _ { l } ^ { j }$ is even an equivalence follows from Lemma B.34 by noting that $\mathcal { E } _ { l } ^ { j } \neq 0$ . Indeed, if it was zero then we would have $\rho _ { l } ^ { i j } ( g ) = 0$ for all $i$ , and thus $\rho ( g )$ would not be invertible, in contrast that it is a unitary automorphism. + +Thus, there is even an isomorphism $V _ { l } \cong \mathcal { E } _ { l } ^ { j }$ by Schur’s Lemma B.29. + +Lemma B.36. Let $\rho : G \to \operatorname { U } ( V )$ be a unitary representation. Let $V _ { 1 } \subseteq V$ be a subrepresentation. +Then the orthogonal complement $V _ { 1 } ^ { \perp }$ is a subrepresentation as well. + +Proof. We have $\langle v \vert v _ { 1 } \rangle = 0$ for all $v \in V _ { 1 } ^ { \bot }$ and all $v _ { 1 } \in V _ { 1 }$ . Now, let $g \in G$ be arbitrary. From the unitarity of $\rho$ we obtain + +$$ +\langle \rho ( g ) ( v ) | v _ { 1 } \rangle = \bigl \langle v \bigl | \rho ( g ^ { - 1 } ) ( v _ { 1 } ) \bigr \rangle = 0 . +$$ + +The last step follows from $\rho ( g ^ { - 1 } ) ( v _ { 1 } ) \in V _ { 1 }$ , which holds since $V _ { 1 }$ is a subrepresentation. Overall, this shows $\hat { \rho } ( g ) ( v ) \in V _ { 1 } ^ { \bot }$ as well, and so this is a subrepresentation. □ + +Lemma B.37. Let $\rho : G \to \operatorname { U } ( V )$ be a finite-dimensional unitary representation. Furthermore, assume that $W _ { 1 } , W _ { 2 }$ are irreducible subrepresentations. If they are not isomorphic, then they are perpendicular, i.e., $\langle w _ { 1 } | w _ { 2 } \rangle = 0$ for all $w _ { 1 } \in W _ { 1 }$ and $w _ { 2 } \in W _ { 2 }$ . + +Proof. Let $P : V \to W _ { 1 }$ be the orthogonal projection from $V$ to $W _ { 1 }$ , defined as the adjoint of the canonical inclusion $i : W _ { 1 } \to V$ , i.e., defined by the property + +$$ +\langle w _ { 1 } | P ( v ) \rangle = \langle i ( w _ { 1 } ) | v \rangle = \langle w _ { 1 } | v \rangle +$$ + +for all $v \in V$ and $w _ { 1 } \in W _ { 1 }$ , see also Proposition F.46. We now show that $P$ is equivariant. For all $g \in G$ , $v \in V$ and $w _ { 1 } \in W _ { 1 }$ we have: + +$$ +\begin{array} { r l } & { \langle w _ { 1 } \vert P ( \rho ( g ) ( v ) ) \rangle = \langle w _ { 1 } \vert \rho ( g ) ( v ) \rangle } \\ & { \qquad = \langle \rho ( g ^ { - 1 } ) ( w _ { 1 } ) \vert v \rangle } \\ & { \qquad = \langle \rho ( g ^ { - 1 } ) ( w _ { 1 } ) \vert P ( v ) \rangle } \\ & { \qquad = \langle w _ { 1 } \vert \rho ( g ) ( P ( v ) ) \rangle , } \end{array} +$$ + +where we used in the third step that $W _ { 1 }$ is a subrepresentation. Since this holds for all $w _ { 1 } \in W _ { 1 }$ , we obtain $P ( \rho ( g ) ( v ) ) = \rho ( g ) ( P \bar { ( } v ) )$ by Proposition F.45 and overall that $P$ is equivariant. + +In particular, also the restriction $P | _ { W _ { 2 } } : W _ { 2 } \to W _ { 1 }$ is equivariant. Since $W _ { 1 }$ and $W _ { 2 }$ are not isomorphic, we obtain by Schur’s Lemma B.29 that $P | _ { W _ { 2 } } = 0$ , i.e., for all $w _ { 1 } \in W _ { 1 }$ and $w _ { 2 } \in W _ { 2 }$ we have $\langle w _ { 1 } | w _ { 2 } \rangle = \langle \dot { w } _ { 1 } | P | _ { W _ { 2 } } ( w _ { 2 } ) \rangle = \langle w _ { 1 } | 0 \rangle = 0$ . Thus, $W _ { 1 }$ and $W _ { 2 }$ are perpendicular as claimed. □ + +Proposition B.38. Let $\rho : G \to \operatorname { U } ( V )$ be any finite-dimensional unitary representation. Then $V$ decomposes into an orthogonal direct sum + +$$ +V = \bigoplus _ { i = 1 } ^ { n } V _ { i } +$$ + +such that $V _ { i } \subseteq V$ are irreducible subrepresentations of $\rho$ + +Proof. Let $V _ { 1 }$ be any irreducible subrepresentation of $V$ : This can be obtained by noting that if $V$ is not already irreducible (in which case $V _ { 1 } = V ,$ ), then we find a nontrivial subrepresentation $0 \subsetneq W \subsetneq V$ . By iteratively proceeding with $W$ , we eventually need to reach an irreducible representation since $V$ is finite-dimensional. + +Now, let $V _ { 1 } ^ { \perp }$ be the orthogonal complement of $V _ { 1 }$ . From Lemma B.36 we know that this is a subrepresentation of $V$ . By induction on the dimension of $V$ , and since $V _ { 1 } ^ { \perp }$ has strictly smaller dimension, we can assume that ${ \bf \dot { \cal V } } _ { 1 } ^ { \perp }$ already splits into an orthogonal direct sum of irreducible subrepresentations $V _ { 1 } ^ { \perp } = \textstyle \bigoplus _ { i = 2 } ^ { n } V _ { i }$ , and overall, ${ \bar { V } } { \bar { = } } \bigoplus _ { i = 1 } ^ { n } V _ { i }$ is the decomposition we were looking for. □ + +The following proposition will not be used now, but we make use of it later when showing that there are only finitely many basis kernels in a steerable CNN for a compact group: + +Proposition B.39 (Krull-Remak-Schmidt Theorem). In the situation of Proposition B.38, the orthogonal direct sum decomposition is essentially unique. That is, the type and multiplicities of the irreducible direct summands is always the same. + +Proof. If one has one decomposition of $V$ in which an irreducible representation $U$ does not appear, then it cannot appear in any decomposition since $U$ would be perpendicular to all the irreps in the decomposition of $V$ by Lemma B.37 and thus zero. Therefore, the types of irreducible representations is always the same. That the multiplicities are always the same follows by the same argument and for dimension-reasons. □ + +We can now finally prove The Peter-Weyl Theorem B.22 for the case that $X = G$ + +Proof. By Proposition B.38 and Lemma B.33 there is some orthogonal decomposition $\begin{array} { r l } { \mathcal { E } _ { l } } & { { } = } \end{array}$ $\textstyle \bigoplus _ { i = 1 } ^ { n _ { i } } V _ { l i }$ into irreducible invariant subspaces. Now assume that there is an $i$ such that $V _ { l i } \not \cong V _ { l }$ . By Proposition B.35 this means that $V _ { l i } \not \approx \mathcal { E } _ { l } ^ { j }$ for all $j = 1 , \dots , \dim ( V _ { l } )$ . By Lemma B.37 we obtain $V _ { l i } \perp \mathcal { E } _ { l } ^ { j }$ for all $j$ and thus, since $\textstyle \sum _ { j } \mathcal { E } _ { l } ^ { j } = \mathcal { E } _ { l }$ , we obtain $V _ { l i } \perp \mathcal { E } _ { l }$ and overall $V _ { l i } = 0$ , a contradiction. + +Thus, the assumption was wrong and all $V _ { l i }$ in the orthogonal direct sum are isomorphic to $V _ { l }$ . + +Now let ${ \mathit { l } } \neq { \mathit { l } } ^ { \prime }$ and $i , j$ be arbitrary. We have $\mathcal { E } _ { l } \perp \mathcal { E } _ { l ^ { \prime } }$ by Proposition B.30, and thus in particular Vli ⊥ Vl0j . Furthermore, we have nl ≤ dim(Vl) since El = Pdim(j=1 $\begin{array} { r } { \mathcal { E } _ { l } \stackrel { \cdot } { = } \sum _ { j = 1 } ^ { \dim ( V _ { l } ) } \mathcal { E } _ { l } ^ { j } = \bigoplus _ { i = 1 } ^ { n _ { l } } \bar { V } _ { l i } } \end{array}$ , and $\mathrm { d i m } ( V _ { l } ) < \infty$ by Proposition B.31. + +Moreover, we have $\begin{array} { r } { \bigoplus _ { l \in \widehat { G } } \bigoplus _ { i = 1 } ^ { n _ { l } } V _ { l i } = \bigoplus _ { l \in \widehat { G } } \mathcal { E } _ { l } = \mathcal { E } } \end{array}$ , which is topologically dense in $L _ { \mathbb { K } } ^ { 2 } ( G )$ by Theorem B.27. + +Finally, that $n _ { l } = \dim ( V _ { l } )$ if $\mathbb { K } = \mathbb { C }$ follows by invoking a stronger version of Schur’s orthogonality than we have developed, and which works only over the complex numbers (Knapp, 2002). □ + +B.2.4 A PROOF OF THE PETER-WEYL THEOREM FOR GENERAL $L _ { \mathbb { K } } ^ { 2 } ( X )$ + +Now let $X$ be a homogeneous space of $G$ . Then, as mentioned in Section B.1.3, there is a measure $\mu$ on $X$ which is left- $G$ -invariant (Nachbin & Bechtolsheim, 1965) in the sense that we have for all $g \in G$ and all square-integrable functions $f \in L _ { \mathbb { K } } ^ { 2 } ( X )$ : + +$$ +\int _ { X } f ( g \cdot x ) d x = \int _ { X } f ( x ) d x . +$$ + +Furthermore, let $\pi : G \to X$ be the projection given by $g \mapsto g x ^ { * }$ for a fixed element $x ^ { * } \in X$ . One important result is that there is a Fubini-like theorem for evaluation of integrals on $G$ using the invariant measure on $X$ . Namely, for arbitrary $x \in X$ , let $g ( x ) \in G$ be any lift, i.e., any element in $G$ with $\pi ( g ( x ) ) = x$ . This exists since the action is transitive. Let $H : = G _ { x ^ { * } } \subseteq G$ be the stabilizer subgroup. For a square-integrable function $f : G \to \mathbb { K }$ , we can then construct the average $\operatorname { a v } ( f ) : X \to \mathbb { K }$ by + +$$ +\operatorname { a v } ( f ) ( x ) : = \int _ { H } f ( g ( x ) h ) d h , +$$ + +where we integrate using the Haar-measure on $H$ .11 If it is hard to understand why this is called an average, note that $X \cong G / H$ , i.e., points in $X$ can be interpreted as cosets of $G$ , and then the average just averages over cosets.12 + +This construction is well-defined, i.e., does not depend on the specific choice of the lift $g ( x )$ . Indeed, let $g ( x ) ^ { \prime }$ be another lift of $x$ . Then $g ( x ) ^ { \prime } = g ( x ) h ^ { \prime }$ for some $h ^ { \prime } \in H$ , since $H$ is the stabilizer + +subgroup. Consequently, using the invariance of the Haar measure, we see: + +$$ +\int _ { H } f ( g ( x ) ^ { \prime } h ) d h = \int _ { H } f ( g ( x ) h ^ { \prime } h ) d h = \int _ { H } f ( g ( x ) h ) d h , +$$ + +and thus the well-definedness of the average $\operatorname { a v } ( f ) : X \to \mathbb { K }$ . Integration of $f$ on the whole of $G$ is a “complete” average, and thus we can hope that averaging $\operatorname { a v } ( f )$ leads to this complete integral. This is indeed the case, i.e., $\operatorname { a v } ( f )$ is square-integrable on $X$ and one has (Nachbin $\&$ Bechtolsheim, 1965) + +$$ +\int _ { G } f ( g ) d g = \int _ { X } \operatorname { a v } ( f ) ( x ) d x . +$$ + +We will use this important result later in order to see that $L _ { \mathbb { K } } ^ { 2 } ( X )$ embeds with good properties into $L _ { \mathbb { K } } ^ { 2 } ( G )$ . + +We now want to prove the Peter-Weyl theorem for $L _ { \mathbb { K } } ^ { 2 } ( X )$ . We first present a general argument showing an orthogonal decomposition of $L _ { \mathbb { K } } ^ { 2 } ( X )$ into irreducible subspaces, and then use a specific argument to deduce that the multiplicities of irreducible subrepresentations are necessarily bounded by the multiplicities in $L _ { \mathbb { K } } ^ { 2 } ( G )$ . + +Proposition B.40. Let $\rho : G \to \operatorname { U } ( V )$ be any unitary representation. Then there is a dense subrepresentation which splits as an orthogonal direct sum of irreducible subrepresentations. + +Proof. We sketch the proof in Kowalski (2014), Corollary 5.4.2. In this book, the proof is done only for the complex numbers C, but it is obvious that each step carries over without any changes to arbitrary $\mathbb { K } \in \{ \mathbb { R } , \mathbb { C } \}$ . The rough steps are as follows: + +1. From $\rho$ one builds a function $\overline { { { \rho } } } ~ : ~ L _ { \mathbb { K } } ^ { 2 } ( G ) ~ \to ~ \operatorname { H o m } _ { \mathbb { K } } ( V , V )$ , given by $\overline { { \rho } } ( \varphi ) ( v ) \ =$ $\textstyle \int _ { G } \varphi ( { \dot { g } } ) \rho ( g ) ( v ) d g$ . This is analogous to our construction of kernel operators (special representation operators) from kernels, which we will handle in the next chapter, See Theorem C.7. +2. Given $v \in V$ fixed, one obtains the function ${ \overline { { \rho } } } ^ { v } : L _ { \mathbb { K } } ^ { 2 } ( G ) \to V$ , $\varphi \mapsto { \overline { { \rho } } } ( \varphi ) ( v )$ . One can check easily that this is an intertwiner. +3. For each finite-dimensional subrepresentation $E \subseteq L _ { \mathbb { K } } ^ { 2 } ( G )$ , the image ${ \overline { { \rho } } } ^ { v } ( E ) \subseteq V$ is a finite-dimensional subrepresentation of $V$ . +4. For $v \ne 0$ , using analytical arguments and the Peter-Weyl theorem for $L _ { \mathbb { K } } ^ { 2 } ( G )$ , one can prove that there is an $E$ such that ${ \overline { { \rho } } } ^ { v } ( E ) \subseteq V$ is not zero. + +Having that, one can use Proposition B.38 in order to deduce that $\overline { { \rho } } ^ { v } ( E )$ contains an irreducible subrepresentation, and so does $V$ . + +With this at hand, one can proceed inductively as follows: Given an irreducible subrepresentation $V _ { 1 } ~ \subseteq ~ V$ , one can consider the orthogonal complement $V _ { 1 } ^ { \perp }$ , which is by Lemma B.36 again a subrepresentation of $V$ . Thus, this also has, by the same argument as above, an irreducible subrepresentation $V _ { 2 }$ and so on. By induction (or better: using Zorn’s Lemma), one can then “fill up” $V$ with orthogonal irreducible subrepresentations, deducing the result. □ + +Consequently, since $L _ { \mathbb { K } } ^ { 2 } ( X )$ carries a unitary representation of $G$ by $\left[ \lambda ( g ) ( \varphi ) \right] ( x ) : = \varphi ( g ^ { - 1 } x )$ , we can deduce that it contains a dense subrepresentation which splits as an orthogonal direct sum of irreducible subrepresentations. But we would like to know more details about this, in particular the multiplicities of the irreps. For this to work, we want to embed $L _ { \mathbb { K } } ^ { 2 } ( X )$ into $L _ { \mathbb { K } } ^ { 2 } ( G )$ and thus deduce a more specific result from the decomposition of $L _ { \mathbb { K } } ^ { 2 } ( G )$ . + +Let as before $x ^ { * } \in X$ be an arbitrary point and let $\pi : G \to X$ be the projection given by $\pi ( g ) : =$ $g x ^ { * }$ . Consider the function $\pi ^ { * } : L _ { \mathbb { K } } ^ { 2 } { \dot { ( X ) } } L _ { \mathbb { K } } ^ { 2 } ( G )$ given by $\pi ^ { * } ( \varphi ) : = \varphi \circ \pi$ . It is unclear a priori whether this is well-defined: For example, it might be that an $f : X \to \mathbb { K }$ which is zero outside a measure 0 set gets lifted to $\pi ^ { * } ( f ) : G \to \mathbb { K }$ which does not have this property, and thus $\pi ^ { * }$ would not be an actual function.13 Thus, we need some lemmas: + +Lemma B.41. Let $f : X \to \mathbb { K }$ be square-integrable. Then we have $\operatorname { a v } ( \pi ^ { * } ( f ) ) = f$ . + +Proof. Using Eq. (9) and that $H$ is the stabilizer subgroup we compute: + +$$ +\begin{array} { r l } { { \operatorname { a v } ( \pi ^ { * } ( f ) ) ( x ) - \int _ { H } \pi ^ { * } ( f ) ( g ( x ) h ) d h } } \\ & { = \int _ { H } f ( \pi ( g ( x ) h ) ) d h } \\ & { = \int _ { H } f ( \pi ( g ( x ) ) ) d h } \\ & { = \int _ { H } f ( x ) d h } \\ & { = \int _ { H } f ( x ) d h } \\ & { = f ( x ) \int _ { H } 1 d h } \\ & { = f ( x ) \mu ( H ) } \\ & { = f ( x ) . } \end{array} +$$ + +Lemma B.42. Let $A \subseteq X$ be any measurable set. Let $\mathbf { 1 } _ { A } : X \to \{ 0 , 1 \} \subseteq \mathbb { K }$ be its indicator function. Then $\pi ^ { * } ( \mathbf { 1 } _ { A } ) = \mathbf { 1 } _ { \pi ^ { - 1 } ( A ) }$ . + +Proof. This can easily be checked. + +Lemma B.43. Let $\varphi : X \to \mathbb { K }$ be zero outside a measure zero set $A$ . Then $\pi ^ { * } ( \varphi )$ is zero outside $\pi ^ { - 1 } ( A )$ which is also a measure zero set. + +Proof. If $g \not \in \pi ^ { - 1 } ( A )$ then $\pi ( g ) \not \in A$ and thus: + +$$ +0 = \varphi ( \pi ( g ) ) = \pi ^ { * } ( \varphi ) ( g ) +$$ + +which proves the first statement. The second is shown as follows using both Lemmas B.41 and B.42 and Eq. (9): + +$$ +\begin{array} { r l } & { \mu ( \pi ^ { - 1 } ( A ) ) = \displaystyle \int _ { G } \mathbf { 1 } _ { \pi ^ { - 1 } ( A ) } ( g ) d g } \\ & { \quad \quad \quad \quad = \displaystyle \int _ { G } \pi ^ { - } ( \mathbf { 1 } _ { A } ) ( g ) d g } \\ & { \quad \quad \quad = \displaystyle \int _ { X } \arcsin ( \pi ^ { * } ( \mathbf { 1 } _ { A } ) ) ( x ) d x } \\ & { \quad \quad \quad = \displaystyle \int _ { X } \mathbf { 1 } _ { A } ( x ) d x } \\ & { \quad \quad \quad = \mu ( A ) } \\ & { \quad \quad = 0 , } \end{array} +$$ + +thus showing what was claimed. + +Thus, our concern about well-definedness as a function is invalid and we can now prove an embedding result: + +Proposition B.44. $\pi ^ { * } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to L _ { \mathbb { K } } ^ { 2 } ( G )$ is a well-defined intertwiner and a unitary transformation, i.e., for all ϕ, ψ ∈ L2K(X ) we have hπ∗(ϕ)|π∗(ψ)iL2K(G) = hϕ|ψiL2K(X). + +Proof. For well-definedness, we still need to show that $\pi ^ { * } ( \varphi )$ is again square-integrable for squareintegrable $\varphi : X \to \mathbb { K }$ . This is indeed the case due to Eq. (9). Namely, let $| \pi ^ { * } ( \varphi ) | ^ { 2 } : G \to { \bar { \mathbb { K } } }$ and + +consider its average $\operatorname { a v } ( | \pi ^ { * } ( \varphi ) | ^ { 2 } )$ . Clearly, we have $| \pi ^ { * } ( \varphi ) | ^ { 2 } = \pi ^ { * } ( | \varphi | ^ { 2 } )$ and thus, using Lemma B.41, $\mathrm { a v } ( | \pi ^ { * } ( \varphi ) | ^ { 2 } ) = | \ddot { \varphi } | ^ { 2 }$ . We obtain: + +$$ +\begin{array} { l } { \displaystyle \int _ { G } | \pi ^ { * } ( \varphi ) | ^ { 2 } ( g ) d g = \int _ { X } \mathrm { a v } ( | \pi ^ { * } ( \varphi ) | ^ { 2 } ) ( x ) d x } \\ { \displaystyle \qquad = \int _ { X } | \varphi ( x ) | ^ { 2 } d x } \\ { \displaystyle \qquad < \infty . } \end{array} +$$ + +Thus, $\pi ^ { * }$ is not only well-defined but even fulfills $\| \pi ^ { * } ( \varphi ) \| _ { L _ { \mathbb { K } } ^ { 2 } ( G ) } = \| \varphi \| _ { L _ { \mathbb { K } } ^ { 2 } ( X ) }$ , which also shows the continuity of $\pi ^ { * }$ . With similar arguments, we show that $\pi ^ { * }$ respects the whole scalar product, i.e., is a uniform transformation: + +$$ +\begin{array} { l } { { \displaystyle \langle \pi ^ { * } ( \varphi ) | \pi ^ { * } ( \psi ) \rangle _ { L _ { \mathrm { R } } ^ { 2 } ( G ) } = \int _ { G } \left( \overline { { \pi ^ { * } ( \varphi ) } } \cdot \pi ^ { * } ( \psi ) \right) ( g ) d g } \ ~ } \\ { { \displaystyle ~ = \int _ { X } \mathrm { a v } \big ( \overline { { \pi ^ { * } ( \varphi ) } } \cdot \pi ^ { * } ( \psi ) \big ) ( x ) d x } \ ~ } \\ { { \displaystyle ~ = \int _ { X } \overline { { \varphi ( x ) } } \psi ( x ) d x } \ ~ } \\ { { \displaystyle ~ = \langle \varphi | \psi \rangle _ { L _ { \mathrm { R } } ^ { 2 } ( X ) } } . } \end{array} +$$ + +The step from the second to the third line follows as before by noting that $\overline { { \pi ^ { * } ( \varphi ) } } \cdot \pi ^ { * } ( \psi ) = \pi ^ { * } ( \overline { { \varphi } } \cdot \psi )$ and invoking Lemma B.41 again. + +The linearity of $\pi ^ { * }$ is obvious, and the equivariance is done as follows: note that for arbitrary $g , g ^ { \prime } \in G$ we have $\pi ( g ^ { - 1 } g ^ { \prime } ) = ( g ^ { - 1 } g ^ { \prime } ) x ^ { * } \stackrel { \cdot } { = } g ^ { - 1 } ( g ^ { \prime } x ^ { * } ) = g ^ { - 1 } \pi ( g ^ { \prime } )$ and therefore: + +$$ +\begin{array} { r l } & { \left[ \pi ^ { * } ( \lambda ( g ) \varphi ) \right] ( g ^ { \prime } ) = ( \lambda ( g ) \varphi ) ( \pi ( g ^ { \prime } ) ) } \\ & { \qquad = \varphi ( g ^ { - 1 } \pi ( g ^ { \prime } ) ) } \\ & { \qquad = \varphi ( \pi ( g ^ { - 1 } g ^ { \prime } ) ) } \\ & { \qquad = \pi ^ { * } ( \varphi ) ( g ^ { - 1 } g ^ { \prime } ) } \\ & { \qquad = [ \lambda ( g ) \pi ^ { * } ( \varphi ) ] ( g ^ { \prime } ) . } \end{array} +$$ + +Thus, we shown everything which was to show. + +Thus, $\pi ^ { * } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to L _ { \mathbb { K } } ^ { 2 } ( G )$ is an embedding which even preserves the scalar product. We can therefore view $L _ { \mathbb { K } } ^ { 2 } ( X )$ as a subspace: $L _ { \mathbb { K } } ^ { 2 } ( X ) \subseteq L _ { \mathbb { K } } ^ { 2 } ( G )$ . 14 + +We can finally complete the proof of the Peter-Weyl Theorem B.22: + +Proof of Theorem B.22. Assume that + +$$ +\bigoplus _ { l \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { l } } V _ { l i } \subseteq L _ { \mathbb { K } } ^ { 2 } ( X ) \subseteq L _ { \mathbb { K } } ^ { 2 } ( G ) +$$ + +is a dense subspace such that the direct sum is orthogonal, where $V _ { l i } \cong V _ { l }$ for all $l , i$ . This exists by Proposition B.40. + +Remember that $n _ { l }$ denotes the multiplicity of $V _ { l }$ as a subrepresentation in $L _ { \mathbb { K } } ^ { 2 } ( G )$ . We now want to show that $m _ { l } \le n _ { l }$ . Since $V _ { l i }$ is perpendicular to all $\mathcal { E } _ { l ^ { \prime } }$ with ${ \mathit { l } } ^ { \prime } \neq { \mathit { l } }$ by Lemma B.37, $V _ { l i }$ must be contained in the orthogonal complement of $\oplus _ { l ^ { \prime } \neq l } \mathcal { E } _ { l ^ { \prime } }$ . This is exactly $\mathcal { E } _ { l }$ , which we show in a final lemma after this proof. So $V _ { l i } \subseteq \mathcal { E } _ { l }$ for all $i$ . Thus, we obtain the result $m _ { l } \le n _ { l }$ by dimension reasons. This was all there was left to show. □ + +Proof. We already know $\mathcal { E } _ { l } \subseteq \big ( \bigoplus _ { l \neq l ^ { \prime } \in \widehat { G } } \mathcal { E } _ { l ^ { \prime } } \big ) ^ { \perp }$ from Proposition B.30. Now, assume this inclusion is not an equality. Then there is $v \notin \mathcal { E } _ { l }$ such that $v \in \left( \bigoplus _ { l \neq l ^ { \prime } \in \widehat { G } } \mathcal { E } _ { l ^ { \prime } } \right) ^ { \perp }$ . The space spanK $( v , \mathcal { E } _ { l } )$ does contain an orthonormal basis by Proposition F.41, where the procedure of Gram-Schmidt orthonormalization allows starting with an orthonormal basis of $\mathcal { E } _ { l }$ and to fill it up to one of the whole space spanK $( v , \mathcal { E } _ { l } )$ . Thus, we can assume $v \in \mathcal { E } _ { l } ^ { \bot }$ as well. Overall, $v \in \left( \bigoplus _ { l ^ { \prime } \in \widehat { G } } \mathcal { E } _ { l ^ { \prime } } \right) ^ { \perp }$ , and by taking topological closure and using that the scalar product is continuous by Proposition F.38, obtain $v \in \bigl ( \widehat { \mathbb { O } } _ { l ^ { \prime } \in \widehat { G } } \mathcal { E } _ { l ^ { \prime } } \bigr ) ^ { \perp } = ( L _ { \mathbb { K } } ^ { 2 } ( G ) ) ^ { \perp }$ by the Peter-Weyl theorem for the regular representation. This means $v = 0 \in \mathcal { E } _ { l }$ , a contradiction to $v \notin \mathcal { E } _ { l }$ . + +Thus, our assumption is wrong and such a vector $v$ cannot exist. We obtain the equality as desired. □ + +# C THE CORRESPONDENCE BETWEEN STEERABLE KERNELS ANDREPRESENTATION OPERATORS + +In this chapter, we formulate and prove Theorem C.7, which gives a precise one-to-one correspondence between steerable kernels on the one hand, and certain representation operators which we call kernel operators on the other hand. Representation operators are a representation-theoretic abstraction of the scalar, vector and tensor operators from physics, that were explained in Section 2. The correspondence will allow us to prove a Wigner-Eckart theorem for steerable kernels in Chapter D and, ultimately, to obtain a complete description of steerable kernel bases. We formulate the correspondence in Section C.1, while Section C.2 gives a detailed and rigorous proof of it. + +As in Chapter B, K is either of the two fields R or C. + +# C.1 FUNDAMENTALS OF THE CORRESPONDENCE + +In Section C.1, we formulate the correspondence between steerable kernels and special representation operators that we name kernel operators. We do this by first studying steerable CNNs and the kernel constraint in Section C.1.1, which progressively leads us to consider steerable kernels on homogeneous spaces of general compact groups in Section C.1.2. This abstract formulation of steerable kernels will show apparent similarities to the concept of representation operators in Section C.1.3. We study them in purely representation-theoretic terms in Section C.1.4. However, they importantly differ in the fact that steerable kernels are not linear, whereas representation operators are – this is a difference that we need to bridge. Finally, after defining kernel operators as special representation operators, we give the formulation of the correspondence in Theorem C.7 in Section C.1.5 and shortly give some intuitions about why it is true. + +C.1.1 STEERABLE KERNELS AND THE RESTRICTION TO HOMOGENEOUS SPACES + +The concept of steerable CNNs outlined here follows (Weiler et al., 2018a; Weiler & Cesa, 2019). In a nutshell, they work as follows: + +The network is supposed to process feature fields $f : \mathbb { R } ^ { d } \mathbb { K } ^ { c }$ with $d \in \mathbb { N }$ . $c$ is the dimension of the features themselves, i.e., the number of channels. For example, planar RGB-images correspond to the case $d = 2$ and $c = 3$ . + +Furthermore, a compact group $G$ (Definition B.4) is considered that acts on $\mathbb { R } ^ { d }$ , for example, the special orthogonal group $\mathrm { S O } ( d )$ , the orthogonal group $\mathrm { O } ( d )$ or the finite groups $\mathrm { C } _ { N }$ or $\mathrm Ḋ \mathrm Ḋ \mathrm Ḋ \ Ḍ Ḍ _ { N }$ if $d = 2$ . 15 Then for each layer, the input and output features have a certain type, i.e., representation, which may differ from layer to layer. That is, the input (and output as well) consists of a function $f : \mathbb { R } ^ { d } \mathbb { K } ^ { \dot { c } }$ , and $G$ acts on $\mathbb { K } ^ { c }$ with a linear representation $\rho$ , see Definition B.10. This action induces an action of the semi-direct product $( \mathbb { R } ^ { d } , + ) \rtimes G$ on the space of all signals,16 where $t \in ( { \mathbb { R } } ^ { d } , + )$ and $g \in G$ : + +$$ +\left( \left[ \operatorname { I n d } _ { G } ^ { \mathbb { R } ^ { d } \times G } \rho \right] ( t g ) \cdot f \right) ( x ) : = \rho ( g ) \cdot f ( g ^ { - 1 } ( x - t ) ) . +$$ + +Let the kernel that “maps” between the layers by convolution17 be given by a function + +$$ +K : \mathbb { R } ^ { d } \mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } } . +$$ + +That is, for an input $f _ { \mathrm { i n } } : \mathbb { R } ^ { d } \mathbb { K } ^ { c _ { \mathrm { i n } } }$ , the output $f _ { \mathrm { o u t } } : \mathbb { R } ^ { d } \mathbb { K } ^ { c _ { \mathrm { o u t } } }$ is given by + +$$ +f _ { \mathrm { o u t } } ( x ) = \left[ K \star f _ { \mathrm { i n } } \right] ( x ) = \int _ { \mathbb { R } ^ { d } } K ( y ) f _ { \mathrm { i n } } ( x + y ) d y , +$$ + +where $K ( y ) \in \mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ acts for any $\boldsymbol { y } \in \mathbb { R } ^ { d }$ as a linear transformation from $\mathbb { K } ^ { c _ { \mathrm { i n } } }$ to $\mathbb { K } ^ { c _ { \mathrm { o u t } } }$ + +The goal is now to find kernels $K$ such that convolution with these kernels commutes with the induced actions on the input and output fields. That is, for all input fields $f _ { \mathrm { i n } }$ and for all $t \in \mathbb { R } ^ { d }$ and $g \in G$ we want the following property: + +$$ +\begin{array} { r } { K \star \left( \left[ \mathrm { I n d } _ { G } ^ { \mathrm { R } ^ { d } \rtimes G } \rho _ { \mathrm { i n } } \right] ( t g ) \cdot f _ { \mathrm { i n } } \right) = \left[ \mathrm { I n d } _ { G } ^ { \mathrm { R } ^ { d } \rtimes G } \rho _ { \mathrm { o u t } } \right] ( t g ) \cdot \left( K \star f _ { \mathrm { i n } } \right) . } \end{array} +$$ + +It was shown in Weiler et al. (2018a) that a kernel $K$ has this equivariance property if and only if the kernel satisfies a certain constraint. We are rederiving it here for convenience. + +Writing out both sides we obtain the following equality that needs to hold for all $f _ { \mathrm { i n } }$ and all $x , t \in$ $\mathbb { R } ^ { d }$ : + +$$ +\int _ { \mathbb { R } ^ { d } } K ( y ) \rho _ { \mathrm { i n } } ( g ) f _ { \mathrm { i n } } \big ( g ^ { - 1 } ( x + y - t ) \big ) d y = \rho _ { \mathrm { o u t } } ( g ) \int _ { \mathbb { R } ^ { d } } K ( y ) f _ { \mathrm { i n } } \big ( g ^ { - 1 } ( x - t ) + y \big ) d y . +$$ + +Substituting $y = g ^ { - 1 } y$ on the left side and using $| \operatorname* { d e t } g | = 1$ due to the compactness of $G$ , and putting $\rho _ { \mathrm { o u t } } ( g )$ inside the integral on the right side, which is possible due to linearity, we obtain: + +$$ +\int _ { \mathbb { R } ^ { d } } \left[ K ( g y ) \rho _ { \mathrm { i n } } ( g ) \right] f _ { \mathrm { i n } } ( g ^ { - 1 } x - g ^ { - 1 } t + y ) d y = \int _ { \mathbb { R } ^ { d } } \left[ \rho _ { \mathrm { o u t } } ( g ) K ( y ) \right] f _ { \mathrm { i n } } ( g ^ { - 1 } x - g ^ { - 1 } t + y ) d y . +$$ + +Since this needs to hold for all fields $f _ { \mathrm { i n } }$ , we necessarily have $K ( g x ) \rho _ { \mathrm { i n } } ( g ) = \rho _ { \mathrm { o u t } } ( g ) K ( x )$ for all $\boldsymbol { x } \in \mathbb { R } ^ { d }$ and all $g \in G$ and obtain the kernel constraint + +$$ +K ( g x ) = \rho _ { \mathrm { o u t } } ( g ) \circ K ( x ) \circ \rho _ { \mathrm { i n } } ( g ) ^ { - 1 } . +$$ + +This work will create a general theory for how to solve this kernel constraint, which means to find a parameterization for the space of all kernels that fulfill this constraint. We now explain how to make this problem more tractable: formally, the action of $G$ on $\mathbb { R } ^ { d }$ is a group action as in Definition B.5. However, it cannot be transitive as in Definition B.7 since $G$ is compact and $\mathbb { R } ^ { d }$ is not. Thus $\mathbb { R } ^ { d }$ splits into a disjoint union of orbits (Definition B.6), of the action: + +$$ +\mathbb { R } ^ { d } = \bigcup _ { k \in K } X _ { k } . +$$ + +That this is a disjoint union can be explained as follows: define the relation $\sim$ on $\mathbb { R } ^ { d }$ by $x \sim x ^ { \prime }$ if $g x = x ^ { \prime }$ for some $g \in G$ . This is then an equivalence relation, and so $\mathbb { R } ^ { d }$ splits into a disjoint union of equivalence classes. One then can show that these equivalence classes are precisely the orbits of the group action. For example, such orbits take the form of spheres $S ^ { d - 1 }$ if $G = { \mathrm { S O } } ( d )$ or $G = \mathrm { O } ( d )$ and the form of a finite set of points if $G = \mathrm { C } _ { N }$ or $G = \mathrm { D } _ { N }$ . + +The idea is now that the kernel constraint 10 only constrains the behavior of the kernel at each orbit individually, and thus a solution on each orbit can be “patched together” to a solution on the whole of $\mathbb { R } ^ { d }$ . Indeed, assume that $K _ { k } : X _ { k } \to \mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ individually fulfill the kernel constraint, which means that for all $x _ { k } \in X _ { k }$ and $g \in G$ we have + +$$ +K _ { k } ( g x _ { k } ) = \rho _ { \mathrm { o u t } } ( g ) \circ K _ { k } ( x _ { k } ) \circ \rho _ { \mathrm { i n } } ( g ) ^ { - 1 } . +$$ + +Then, define the patch of these orbit-kernels by $K : \mathbb { R } ^ { d } \mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ as $K ( x ) = K _ { k } ( x )$ if $x \in X _ { k }$ . This is well-defined since each $x$ is in precisely one orbit. Then clearly, $K$ satisfies the kernel constraint 10. Moreover, each kernel $K$ which fulfills the kernel constraint emerges from such a construction, since we can simply set $K _ { k } : = K | _ { X _ { k } }$ . Overall, we see that we can restrict our attention to orbits. In Weiler et al. (2018b) and later Weiler et al. (2018a), a discretized implementation is done where the kernel is discretized into finitely many orbits with a smooth Gaussian radial profile. We will come back to these practical questions of parameterization in Remark D.19, once we have fully developed the theory of steerable CNNs. + +# C.1.2 AN ABSTRACT DEFINITION OF STEERABLE KERNELS + +Motivated by the discussion in the last section, we now define steerable kernels in precise terms and will stick to that definition throughout this work. The definition will be more abstract than usual in the deep learning community, but we are rewarded since such an abstract definition makes it easier to apply representation-theoretic results. + +Without loss of generality, we will in the rest of this work only consider kernels on orbits. Thus, let $X : = G \cdot x$ be an arbitrary orbit. We consider steerable kernels $K : X \mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ . Note that the restriction of the action $\dot { G } \times \mathbb { R } ^ { d } \to \mathbb { R } ^ { d }$ to $X$ , written $G \times X \to X$ , makes $X$ to a homogeneous space of $G$ , see Definition B.7. Thus, instead of viewing $X$ as a subset of $\mathbb { R } ^ { d }$ , we view $X$ as an arbitrary homogeneous space of an arbitrary compact group $G$ . Notably, this framework is more general than usually studied in the context of steerable CNNs on $\mathbb { R } ^ { d }$ , since we allow also groups that are not Lie groups and homogeneous spaces which are not naturally embedded in an $\mathbf { \bar { \mathbb { R } } } ^ { d }$ , as well as finite homogeneous spaces of finite groups all at the same time. + +Furthermore, we replace $\mathbb { K } ^ { c _ { \mathrm { i n } } }$ and $\mathbb { K } ^ { c _ { \mathrm { o u t } } }$ by coordinate-independent $\mathbb { K }$ -vector spaces $V _ { \mathrm { i n } }$ and $V _ { \mathrm { o u t } }$ , and therefore $\mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ by the space of linear functions from $V _ { \mathrm { i n } }$ to $V _ { \mathrm { o u t } }$ , written $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . We assume there are linear representations $\rho _ { \mathrm { i n } } : G \to { \mathrm { G L } } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G \to { \mathrm { G L } } ( V _ { \mathrm { o u t } } )$ . + +Overall, this means that steerable kernels are certain maps $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . The only property they need to fulfill is the kernel constraint $K ( g x ) = \rho _ { \mathrm { o u t } } ( g ) \circ K ( x ) \circ \rho _ { \mathrm { i n } } ( g ) ^ { - 1 }$ for all $g \in G$ and $x \in X$ . This can be viewed in representation-theoretic terms by defining the Homrepresentation: + +Definition C.1 (Hom-Representation). Let $\rho _ { \mathrm { i n } } : G \to { \mathrm { G L } } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G \to { \mathrm { G L } } ( V _ { \mathrm { o u t } } )$ be two finite-dimensional $G$ -representations over the field K. The space $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ of $\mathbb { K }$ -linear (not necessarily $G$ -equivariant) functions from $V _ { \mathrm { i n } }$ to $V _ { \mathrm { o u t } }$ also carries an induced $G$ -representation, with action + +$$ +\left[ \rho _ { \mathrm { H o m } } ( g ) \right] ( f ) : = \rho _ { \mathrm { o u t } } ( g ) \circ f \circ \rho _ { \mathrm { i n } } ( g ) ^ { - 1 } . +$$ + +We call this the Hom-representation. + +Remark C.2. Of course, one needs to check that this is indeed a linear representation. Continuity follows from the continuity of $\rho _ { \mathrm { i n } }$ and $\rho _ { \mathrm { o u t } }$ as follows: the topology on $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ is just the Euclidean topology of $\mathbb { K } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ coming from a basis of $V _ { \mathrm { i n } }$ and $V _ { \mathrm { o u t } }$ . In these bases, $\rho _ { \mathrm { i n } } ( g )$ and $\rho _ { \mathrm { o u t } } ( g )$ are given by matrices. All matrix coefficients are continuous by Remark B.25. Now, in order to show that $\rho _ { \mathrm { H o m } }$ is continuous, pick a fixed element $f \in \mathbb { K } ^ { c _ { \mathrm { i n } } \times c _ { \mathrm { o u t } } }$ . One needs to show that the map + +$$ +\rho _ { \mathrm { H o m } } ^ { f } : G \to \mathbb { K } ^ { c _ { \mathrm { i n } } \times c _ { \mathrm { o u t } } } , g \mapsto \rho _ { \mathrm { o u t } } ( g ) \circ f \circ \rho _ { \mathrm { i n } } ( g ^ { - 1 } ) +$$ + +is continuous. Since all matrix coefficients are continuous and since also the inversion $G \to G , g \mapsto$ $g ^ { - 1 }$ is continuous by the definition of a topological group, the map $\rho _ { \mathrm { H o m } } ^ { f }$ is basically just a stacked linear combination of continuous functions and thus continuous itself. + +The linearity of each $\rho _ { \mathrm { H o m } } ( g )$ is also clear. So what needs to be checked is that $\rho _ { \mathrm { H o m } }$ is a group homomorphism. And indeed, it is, exploiting the corresponding property of $\rho _ { \mathrm { i n } }$ and $\rho _ { \mathrm { o u t } }$ : + +$$ +\begin{array} { r l } & { \left[ \rho _ { \mathrm { H o m } } ( g g ^ { \prime } ) \right] ( f ) = \rho _ { \mathrm { o u t } } ( g g ^ { \prime } ) \circ f \circ \rho _ { \mathrm { i n } } ( g g ^ { \prime } ) ^ { - 1 } } \\ & { \qquad = \rho _ { \mathrm { o u t } } ( g ) \circ \left( \rho _ { \mathrm { o u t } } ( g ^ { \prime } ) \circ f \circ \rho _ { \mathrm { i n } } ( g ^ { \prime } ) ^ { - 1 } \right) \circ \rho _ { \mathrm { i n } } ( g ) ^ { - 1 } } \\ & { \qquad = \left[ \rho _ { \mathrm { H o m } } ( g ) \right] \left( \left[ \rho _ { \mathrm { H o m } } ( g ^ { \prime } ) \right] ( f ) \right) } \\ & { \qquad = \left[ \rho _ { \mathrm { H o m } } ( g ) \circ \rho _ { \mathrm { H o m } } ( g ^ { \prime } ) \right] ( f ) , } \end{array} +$$ + +and so the claim follows. + +With this definition in mind, steerable kernels $K : X \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ are just functions with the property $K ( g x ) = [ \rho _ { \mathrm { H o m } } ( g ) ] \left( K ( x ) \right)$ . Summarizing, we have the following abstract definition of steerable kernels (different from Definition 3.2, we here allow also input- and output representations that are not irreducible and make explicit reference to the Hom-representation): + +Definition C.3 (Steerable Kernel). Let $G$ be any compact group and $X$ be any homogeneous space of $G$ . Furthermore, let $\rho _ { \mathrm { i n } } : G \to { \mathrm { G L } } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G \to { \mathrm { G L } } ( V _ { \mathrm { o u t } } )$ be finite-dimensional representations of $G$ . We assume that $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ is equipped with the Hom-representation $\rho _ { \mathrm { H o m } }$ . A $G$ -steerable kernel is an equivariant function $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ , i.e., a function such that + +$$ +K ( g x ) = \left[ \rho _ { \mathrm { H o m } } ( g ) \right] ( K ( x ) ) +$$ + +for all $g \in G$ and $x \in X$ . We denote the vector-space of all these kernels by + +$$ +\mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) = \{ K : X \to \mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \mid K { \mathrm { ~ i s ~ s t e e r a b l e ~ } } \} . +$$ + +Notably, steerable kernels are not linear in a meaningful sense with respect to their input. + +That the space of steerable kernels forms a vector space, as claimed in this definition, can easily be checked. + +# C.1.3 MORE DETAILS ON THE COMPARISON OF REPRESENTATION OPERATORS ANDSTEERABLE KERNELS + +Steerable kernels satisfy the constraint + +$$ +K ( g x ) = \rho _ { \mathrm { o u t } } ( g ) \circ K ( x ) \circ \rho _ { \mathrm { i n } } ( g ) ^ { - 1 } , +$$ + +whereas, as we saw in Section 2, representation operators are collections $( A _ { 1 } , \dotsc , A _ { N } )$ of operators $A _ { i } : \mathcal { H } \to \mathcal { H }$ that satisfy the constraint + +$$ +\sum _ { j = 1 } ^ { N } \pi ( g ) _ { i j } A _ { j } \ = \ U ( g ) ^ { \dagger } A _ { i } U ( g ) \qquad \forall g \in G . +$$ + +Hereby, $U : G \to \operatorname { U } ( { \mathcal { H } } )$ and $\pi : G \to \operatorname { U } ( \mathbb { C } ^ { N } )$ are unitary representations. Unfortunately, these equations still look somewhat different from each other. We can make them more similar by inverting $g$ and using the unitarity of $\pi$ (note the swap of $j$ and $i$ and the complex conjugation): + +$$ +\sum _ { j = 1 } ^ { N } \overline { { { \pi } } } ( g ) _ { j i } A _ { j } \ = \ U ( g ) A _ { i } U ( g ) ^ { \dagger } \qquad \forall g \in G . +$$ + +In order to make the analogy to steerable kernels stronger, we would like to interpret a representation operator as one object $\pmb { A }$ instead of separate operators $A _ { i }$ , in the same way as a kernel $K$ is one single object and not just a disjoint collection of linear functions in $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . For this, we interpret $\pmb { A }$ as a function that assigns to arbitrary vectors in $\mathbb { C } ^ { N }$ an operator. Namely, let $\left\{ \boldsymbol { e } _ { i } \right\}$ be the standard basis of $\mathbb { C } ^ { N }$ . We then define $\pmb { A }$ as the unique linear map which is given on basis elements as follows: + +$$ +A : e _ { i } \mapsto A _ { i } . +$$ + +We can then deduce the following, where we use the linearity of $\pmb { A }$ in the second step, the definition of $A _ { j }$ in the third and fifth step, and Eq. (13) in the fourth step: + +$$ +\begin{array} { l } { \displaystyle { \pmb { A } \big ( \overline { { \pi } } ( g ) ( e _ { i } ) \big ) = \pmb { A } \bigg ( \sum _ { j } \overline { { \pi } } ( g ) _ { j i } e _ { j } \bigg ) } } \\ { \displaystyle = \sum _ { j } \overline { { \pi } } ( g ) _ { j i } \pmb { A } ( e _ { j } ) } \\ { \displaystyle = \sum _ { j } \overline { { \pi } } ( g ) _ { j i } \pmb { A } _ { j } } \\ { \displaystyle = { U } ( g ) { A } _ { i } { U } ( g ) ^ { \dagger } } \\ { \displaystyle = { U } ( g ) { A } ( e _ { i } ) { U } ( g ) ^ { \dagger } . } \end{array} +$$ + +If now $v = \textstyle \sum _ { i } \lambda _ { i } e _ { i }$ is an arbitrary vector in $\mathbb { C } ^ { N }$ , not necessarily a standard basis vector, then from the linearity of $\pmb { A }$ and Eq. (14) we obtain + +$$ +\begin{array} { r } { \pmb { A } \big ( \mpb { \pi } ( g ) ( v ) \big ) = \pmb { U } ( g ) \pmb { A } ( v ) \pmb { U } ( g ) ^ { - 1 } . } \end{array} +$$ + +This equation is essentially the starting point for the definition of a representation operator as it can be found in Jeevanjee [2011]. + +This, finally, really looks like Eq. (12). In this comparison, the action of the group $G$ on $\mathbb { R } ^ { d }$ in deep learning is replaced by the action of $G$ via $\overline { { \pi } }$ on the space $\mathbb { C } ^ { N }$ . The main difference is that steerable kernels are not necessarily linear. This difference will be bridged in Theorem C.7. + +# C.1.4 REPRESENTATION OPERATORS AND KERNEL OPERATORS + +Now that we have a clear abstract idea of what steerable kernels are and saw strong analogies to representation operators, we can begin to formulate precise theoretical connections. In this section, we therefore begin with formulating a purely representation-theoretic and more abstract working definition of representation operators and will then formulate the main theorem of this chapter, Theorem C.7. + +We come to the main definition, which is directly motivated from Eq. (15). It differs from (Jeevanjee, 2011) by allowing the input- and output representations to differ. We furthermore restrict to finitedimensional input- and output representations due to our specific applications. As explained in Section C.1.3, this new definition furthermore somewhat differs from the one given in Section 2 since now we view representation operators as one object instead of viewing it as a collection of several linear operators. + +Definition C.4 (Representation Operator). Let $\rho _ { \mathrm { i n } } : G \to { \mathrm { G L } } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G \to \mathrm { G L } ( V _ { \mathrm { o u t } } )$ be finite-dimensional $G$ -representations. Let $\lambda : G \ \to \ \mathrm { G L } ( T )$ be a third $G$ -representation, not necessarily finite-dimensional. Then a representation operator is an intertwiner $\kappa : T $ $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ , where the right space is equipped with the Hom-representation as in Definition C.1. We denote the vector space of all these representation operators by + +$$ +\mathrm { H o m } _ { G , \mathbb { K } } ( T , \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) = \{ K : T \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \mid K \mathrm { i s ~ a n ~ i n t e r t w i n e r } \} . +$$ + +Note that representation operators are by definition linear, which is a requirement that needs to be satisfied for the standard Wigner-Eckart theorem. We clearly see strong similarities between this definition and the formalization of steerable kernels in Definition C.3. The main difference is that we assume representation operators to be linear. This is in notation captured by the subscript K that we put in the corresponding Hom-space. One may think that there is another difference, namely coming from the fact that intertwiners are by definition continuous with respect to the topologies involved. Two things need to be said about this: + +1. First of all, one may wonder what continuity for representation operators actually means. This can be clarified as follows: By assumption, $G$ -representations are always on vector spaces with topologies, and thus $T$ has a topology. Furthermore, in Remark C.2 we clarified the topology on $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . Then, being continuous just means, as always, to be continuous with respect to the topologies of these two spaces. + +2. The second remark is that this apparent difference in the requirement of continuity for steerable kernels and representation operators is actually non-existent. This is explained by the following Proposition which says that steerable kernels are automatically continuous. Note that this is not true for steerable kernels that are defined on the domain $\mathbb { R } ^ { d }$ – in that case, continuity is only guaranteed when restricting to orbits. + +Proposition C.5. Let $K : X \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ be a steerable kernel. Then $K$ is continuous. + +Proof. For brevity, denote $V : = \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ and $\rho : = \rho _ { \mathrm { H o m } }$ . Let $x ^ { * } \in X$ be any point and $G _ { x ^ { * } }$ the stabilizer corresponding to the action of $G$ on $X$ . Remember the homeomorphism $\varphi : G / H \to X , [ g ] \mapsto g x ^ { * }$ from Lemma B.21. Since this is a homeomorphism, the kernel $K$ is continuous if and only if the composition $K \circ \varphi$ is continuous, since then $K = ( K \circ \varphi ) \circ \varphi ^ { - 1 }$ is a composition of continuous functions. Thus, we evaluate $K \circ \varphi$ : + +$$ +( K \circ \varphi ) ( [ g ] ) = K ( \varphi ( [ g ] ) ) = K ( g x ^ { * } ) = \rho ( g ) ( K ( x ^ { * } ) ) , +$$ + +where in the last step we have used the equivariance of $K$ . Thus, if we set $v ^ { * } : = K ( x ^ { * } ) \in V$ , then we obtain the simple relation $( K \circ \varphi ) ( [ g ] ) = \rho ( g ) ( v ^ { \ast } ) .$ . This is by definition just the unique map on the quotient, $G / H V$ , coming from $\rho ^ { v ^ { * } } : G \to V$ , $g \mapsto \rho ( g ) ( v ^ { * } )$ . This last map is continuous by definition of a linear representation. The universal property of quotients Proposition F.12 then shows that $K \circ \varphi$ is continuous as well, and so we are done. All of this is visualized in the following commutative diagram, where $q : G \to G / H$ , $g \mapsto [ g ]$ is the canonical projection: + +![](images/12025ef1c9575e91d1a62ae6faf58eb2a16e846dd383a7a534dc5ae9b73ae9bc.jpg) + +Thus, the only difference between steerable kernels and representation operators is indeed the linearity. We now look at special representation operators that play the main role in this work: + +Definition C.6 (Kernel Operator). Let $\rho _ { \mathrm { i n } } : G \to { \mathrm { G L } } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G \to { \mathrm { G L } } ( V _ { \mathrm { o u t } } )$ be finitedimensional $G$ -representations. Let $\lambda : G \to \operatorname { U } ( L _ { \mathbb { K } } ^ { 2 } ( X ) )$ be the standard unitary representation on the space of square-integrable functions of a homogeneous space $X$ , given, as in Section B.1.3, by + +$$ +\left[ \lambda ( g ) ( \varphi ) \right] ( g ^ { \prime } ) = \varphi ( g ^ { - 1 } g ^ { \prime } ) . +$$ + +A kernel operator is a representation operator ${ \mathcal { K } } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . We denote the space of these by + +$$ +\begin{array} { r l } & { \mathrm { H o m } _ { G , \mathrm { K } } ( L _ { \mathrm { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) } \\ & { \qquad = \{ K : L _ { \mathrm { K } } ^ { 2 } ( X ) \to \mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \mid K \mathrm { ~ i s ~ a n ~ i n t e r t w i n e r ~ } \} . } \end{array} +$$ + +Notably, kernel operators are $\mathbb { K }$ -linear in their input. + +# C.1.5 FORMULATION OF THE CORRESPONDENCE BETWEEN STEERABLE KERNELS ANDKERNEL OPERATORS + +The following Theorem lies at the heart of our investigations and establishes that steerable kernels can be considered as kernel operators, which we defined as special representation operators. More precisely, we will give an explicit isomorphism between the space of steerable kernels and the space of kernel operators. + +We shortly explain why the theorem is useful. First of all, using a Wigner-Eckart theorem for kernel operators that we prove in Theorem D.13, one can explicitly describe a basis $B$ of the space of kernel operators $\operatorname { H o m } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) )$ . Then, since we have an isomorphism of vector spaces to the space of steerable kernels, one can “carry over” this basis to a basis for the space of steerable kernels, namely $\operatorname { H o m } _ { G } ( X , \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) )$ . This basis will then have a convenient explicit form that we establish in Theorem D.16 and is exactly what we need in order to parameterize an equivariant neural network layer. We now come to a precise formulation of the theorem: + +Theorem C.7 (Kernel-Operator-Correspondence). Let $\rho _ { \mathrm { i n } } : G \to \mathrm { G L } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G \to$ $\mathrm { G L } ( V _ { \mathrm { o u t } } )$ be finite-dimensional $G$ -representations and $X$ be a homogeneous space of $G$ . Then there is an isomorphism + +$$ +\mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , \overbrace { V _ { \mathrm { o u t } } ) ) } ^ { \widehat { ( \cdot ) } } \overbrace { \mathrm { H o m } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) } ^ { \widehat { ( \cdot ) } } +$$ + +between the space of steerable kernels on the left and the space of kernel operators on the right. The two maps are defined as follows: + +1. For a steerable kernel $K : X \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ , the extension ${ \widehat K } \ : \ L _ { \mathbb { K } } ^ { 2 } ( X ) \ \to$ $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ is given by + +$$ +{ \widehat { K } } ( f ) : = \int _ { X } f ( x ) K ( x ) d x . +$$ + +2. For a kernel operator ${ \mathcal K } : L _ { \mathbb K } ^ { 2 } ( X ) \to \operatorname { H o m } _ { \mathbb K } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ,$ , the restriction $\mathcal { K } | _ { X } : X \ $ $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ is given by + +$$ +K | _ { X } ( x ) : = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \mathcal { K } ( \delta _ { U } ) . +$$ + +Hereby, $\mathcal { U } _ { x }$ is the directed set of open neighborhoods of $x$ , see Example F.27. $\delta _ { U } : X \to \mathbb { K }$ +is the approximated Dirac delta function with $\begin{array} { r } { \delta _ { U } ( y ) = \frac { 1 } { \mu ( U ) } i f y \in \dot { U } } \end{array}$ and $\delta _ { U } ( y ) = 0$ , else. +The limit is a limit of nets as in Definition $F . 2 9$ . + +This theorem requires some explanation. First of all, $\widehat { K }$ is supposed to be a kernel operator, i.e., a map $L _ { \mathbb { K } } ^ { 2 } ( X ) \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . Thus, $\widehat K ( f )$ should be a linear function $V _ { \mathrm { i n } } \to V _ { \mathrm { o u t } }$ . The formal expression of it can indeed be considered as such: + +$$ +{ \widehat { K } } ( f ) = \int _ { X } f ( x ) K ( x ) d x : v _ { \mathrm { i n } } \mapsto \int _ { X } f ( x ) \left[ K ( x ) \right] ( v _ { \mathrm { i n } } ) d x \in V _ { \mathrm { o u t } } . +$$ + +Due to the continuity of $K$ proven in Proposition ${ \mathrm { C } } . 5 ^ { 1 8 }$ and the integrability of $f$ , the function $X V _ { \mathrm { o u t } }$ , $x \mapsto f ( x ) \left[ K ( x ) \right] ( v _ { \mathrm { i n } } )$ is also integrable, meaning the expression in Eq. (16) can be evaluated. This explains the meaning of the map $\widehat { ( \cdot ) }$ in Theorem C.7. + +For the map $( \cdot ) | _ { X }$ in the other direction, we want to shortly explain the intuitions in a more informal way. For this, we consider Dirac delta functions $\delta _ { x }$ for $x \in X$ . Such a “function” $\delta _ { x } : X \to \mathbb { K }$ for a point $x \in X$ can be imagined as a function taking value infinity at $x$ and zero elsewhere. It is characterized by the property that $\begin{array} { r } { \int _ { X } \delta _ { x } ( x ^ { \prime } ) f ( x ^ { \prime } ) d x ^ { \prime } = f ( x ) } \end{array}$ for any function $f \in L _ { \mathbb { K } } ^ { 2 } ( X )$ . We think of $\delta _ { x }$ as being a function in $L _ { \mathbb { K } } ^ { 2 } ( X )$ , even though technically, it is not in this space. This is since $\propto \notin \mathbb { K }$ . + +Now, informally, we can think of the limit $\begin{array} { r } { K | _ { X } ( x ) = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } K ( \delta _ { U } ) } \end{array}$ as being given by $\mathcal { K } ( \delta _ { x } )$ , the value that $\kappa$ takes at the Dirac delta function $\delta _ { x }$ . This is since the limit of nets progressively “shrinks down” the open neighborhood $U$ of $x$ . Of course, $\kappa ( \delta _ { x } )$ is not really well-defined since $\delta _ { x } \notin L _ { \mathbb { K } } ^ { 2 } ( X )$ , but we can pretend that it is for gaining intuitions. + +Now that we have understood the formulation of the theorem, we might wonder, why should such a theorem be true? A first intuition comes from an analogy with linear algebra: namely, assume $B$ is a basis of a $\mathbb { K }$ -vector space $V$ and $W$ any other vector space. Then linear maps ${ \hat { f } } : V \to W$ are in one-to-one correspondence with (not assumed to be linear) functions $f : B \to W$ , and this isomorphism is given by restriction and linear extension: + +$$ +\mathrm { H o m } ( B , W ) \xrightarrow [ ( \cdot ) ] { \widehat { ( \cdot ) } } \mathrm { H o m } _ { \mathbb { K } } ( V , W ) . +$$ + +Thus, we can think of the homogeneous space $X$ as a “continuous basis” of the space of squareintegrable functions. Sums are then replaced by integrals, and evaluations at a basis element by evaluations at Dirac delta functions of elements in $X$ . + +For the actual proof of Theorem C.7, informally, one direction seems pretty clear from the properties of the Dirac delta: + +$$ +\widehat K \vert _ { X } ( x ) = \widehat K ( \delta _ { x } ) = \int _ { X } \delta _ { x } ( x ^ { \prime } ) K ( x ^ { \prime } ) d x ^ { \prime } = K ( x ) . +$$ + +But the other direction is less obvious: it seems like the space of kernel operators is considerably larger than the space of steerable kernels, since kernel operators are defined on a larger space. Therefore it is hard to believe that the construction is also inverse in the other direction. However, it pays off to ponder a bit more over what the Dirac delta construction does: Basically, we “embed” $X$ into $L _ { \mathbb { K } } ^ { \dot { 2 } } ( X )$ by means of the Dirac delta functions, i.e., $x \mapsto \delta _ { x }$ and, as such, view $X$ as a subset of $L _ { \mathbb { K } } ^ { 2 } ( X )$ (albeit a subset that is only in approximation in that space). Steerable kernels are then “partial” kernel operators in the sense that they are only defined on this subset $X \subseteq L _ { \mathbb { K } } ^ { 2 } ( X )$ . What then needs to be understood is why there is only one unique extension of each steerable kernel $K$ to a kernel operator $\kappa$ on the whole of $L _ { \mathbb { K } } ^ { 2 } ( X )$ : if this is understood, then the space of kernel operators cannot be larger than the space of steerable kernels. And indeed, if there is an extension of $K$ to $\kappa$ on $L _ { \mathbb { K } } ^ { 2 } ( X )$ , it has to be unique: each $f \in L _ { \mathbb { K } } ^ { 2 } ( X )$ can be approximated by finite linear combinations of scaled indicator functions. Then by linearity of the kernel operator $\kappa$ , we can evaluate $\kappa ( f )$ by knowing $\kappa ( \delta \sigma )$ for scaled indicator functions $\delta _ { U }$ on small measurable sets $U$ . And these approximate $K ( x ) \stackrel { \cdot } { = } \dot { \mathcal { K } } ( \delta _ { x } )$ for $x \in U$ arbitrarily well by construction. This determines the behavior of $\kappa$ . The details of all of this can be found in the next section. + +# C.2 A PROOF OF THE CORRESPONDENCE BETWEEN STEERABLE KERNELS AND KERNELOPERATORS + +Here, we give a step-by-step proof of Theorem C.7. The details of this investigation will not be needed later, and so a reader who is mainly interested in the applications to steerable CNNs can safely skip reading this section and go on reading Chapter D. + +# C.2.1 A REDUCTION TO UNITARY IRREDUCIBLE REPRESENTATIONS + +In this section, we make the proof more manageable by reducing $\mathrm { H o m _ { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ to an irreducible representation. First, remember that Proposition B.20 shows that there is a scalar product on $\mathrm { H o m } _ { \mathrm { K } } \mathrm { \bar { ( } } V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ such that it’s Hom-representation becomes unitary. Since all norms on finitedimensional spaces are equivalent, as is well known, this will not change the topology. Then, we can decompose $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ into an orthogonal direct sum of irreducible unitary representations by Proposition B.38. Let ${ \mathrm { H o m } } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \cong \bigoplus _ { i = 1 } ^ { n } V _ { i }$ be such a decomposition. We get canonical19 isomorphisms + +$$ +\mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) \cong \bigoplus _ { i = 1 } ^ { n } \mathrm { H o m } _ { G } ( X , V _ { i } ) +$$ + +and + +$$ +\mathrm { H o m } _ { G , \mathrm { K } } ( L _ { \mathrm { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) \cong \bigoplus _ { i = 1 } ^ { n } \mathrm { H o m } _ { G , \mathrm { K } } ( L _ { \mathrm { K } } ^ { 2 } ( X ) , V _ { i } ) . +$$ + +Thus, we can show Theorem C.7 by showing it for irreducible unitary representations instead of $\mathrm { H o m } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } )$ . Overall, we have reduced our Theorem to the following, simpler statement: + +Theorem C.8 (Kernel-Operator-Correspondence, Restated). Let $\rho : G \to \operatorname { U } ( V )$ be an irreducible unitary representation and $X$ a homogeneous space of $G$ . Then there is an isomorphism + +$$ +\mathrm { H o m } _ { G } ( X , V ) \overset { \widehat { ( \cdot ) } } { \longleftarrow } \overset { \widehat { ( \cdot ) } } { \mathrm { H o m } _ { G , \mathbb { K } } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , V ) +$$ + +which is given as follows: for $K \in \mathrm { H o m } _ { G } ( X , V )$ we set $\begin{array} { r } { \widehat { K } ( f ) = \int _ { X } f ( x ) K ( x ) d x } \end{array}$ and for $\kappa \in$ ${ \mathrm { H o m } } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , V )$ we set $K | _ { X } ( x ) = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \mathcal { K } ( \delta _ { U } )$ , with $\delta _ { U }$ being an approximated Dirac delta function as before. + +From now on, we assume that $X$ and $\rho : G \to \operatorname { U } ( V )$ is fixed as in the formulation of Theorem C.8. + +# C.2.2 WELL-DEFINEDNESS OF $\widehat { ( \cdot ) }$ + +Lemma C.9. The function ${ \widehat { ( \cdot ) } } : \operatorname { H o m } _ { G } ( X , V ) \to \operatorname { H o m } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , V )$ is well-defined, i.e.: for an equivariant function $K : X V$ , the function ${ \widehat { K } } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to V$ is linear, equivariant and continuous. + +Proof. Linearity of $\widehat { K }$ is clear. Equivariance can be proven using the equivariance of $K$ and the left invariance of the Haar measure on the homogeneous space $X$ : + +$$ +\begin{array} { r l } { { \widehat { R } ( \lambda ( g ) f ) = \int _ { X } ( \lambda ( g ) f ) ( x ) K ( x ) d x } } \\ & { = \int _ { X } f ( g ^ { - 1 } \cdot x ) K ( x ) d x } \\ & { = \int _ { X } f ( x ) K ( g \cdot x ) d x } \\ & { = \int _ { X } f ( x ) [ \rho ( g ) ( K ( x ) ) ] d x } \\ & { = \rho ( g ) [ \int _ { X } f ( x ) K ( x ) d x ] } \\ & { = \rho ( g ) [ \widehat { R } ( f ) ] . } \end{array} +$$ + +The action by $\rho ( g )$ could be put out of the integral since $\rho ( g )$ it is linear and continuous, and since integrals can be approximated by finite sums. + +Now about continuity: By Proposition F.18, we only need to show continuity in 0. Thus, let $( f _ { k } ) _ { k }$ be a sequence of functions $f _ { k } \in L _ { \mathbb { K } } ^ { 2 } ( X )$ with $\begin{array} { r } { \operatorname* { l i m } _ { k \to \infty } \| f _ { k } \| _ { L ^ { 2 } } = 0 } \end{array}$ . Then we obtain + +$$ +\begin{array} { r l r } { { \| \widehat K ( f _ { k } ) \| _ { V } = \| \int _ { X } f _ { k } ( x ) K ( x ) d x \| _ { V } } } \\ & { } & { \leq \int _ { X } | f _ { k } ( x ) | \cdot \| K ( x ) \| _ { V } d x } \\ & { } & { \leq \operatorname* { m a x } _ { x ^ { \prime } } \| K ( x ^ { \prime } ) \| _ { V } \cdot \int _ { X } | f _ { k } ( x ) | d x , } \end{array} +$$ + +where the continuity of $K$ proven in Proposition C.5 was used.20 For the right expression, using the Cauchy-Schwarz inequality Proposition F.34 we obtain + +$$ +\begin{array} { r l } { \displaystyle \int _ { X } | f _ { k } ( x ) | d x = \int _ { X } | f _ { k } ( x ) | \cdot 1 d x } \\ { \displaystyle } & { = | \langle | f _ { k } | | 1 \rangle | } \\ { \displaystyle } & { \le \| f _ { k } \| _ { L ^ { 2 } } \cdot \| 1 \| _ { L ^ { 2 } } } \\ { \displaystyle } & { = \| f _ { k } \| _ { L ^ { 2 } } . } \end{array} +$$ + +So, overall, if $\begin{array} { r } { \operatorname* { l i m } _ { k \to \infty } \| f _ { k } \| _ { L ^ { 2 } } = 0 } \end{array}$ , then $\begin{array} { r } { \operatorname* { l i m } _ { k \infty } \| \widehat { K } ( f _ { k } ) \| _ { V } = 0 } \end{array}$ as well, which proves continuity. + +# C.2.3 WELL-DEFINEDNESS OF $( \cdot ) | _ { X }$ + +While it is clear that the limit $\mathrm { l i m } _ { U \in \mathcal { U } _ { x } } \mathcal { K } ( \delta _ { U } )$ from Theorem C.8 is unique if it exists (Conway, 2014), it is somewhat unclear why it exists in the first place. For this, we need to better understand the properties of the (approximated) Dirac delta. The most important one is the following, which we hinted at already in the intuitions we gave before this section: basically, Dirac deltas help for evaluating continuous functions at specific points: + +Lemma C.10. For each $x \in X$ and $Y : X \mathbb { K }$ continuous we have $\begin{array} { r } { \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } { \langle \delta _ { U } | Y \rangle } = Y ( x ) } \end{array}$ . + +Proof. We have + +$$ +\begin{array} { r l } { { \big | \delta _ { U } | Y - Y ( x ) \big | = \bigg | \int _ { X } \delta _ { U } ( x ^ { \prime } ) Y ( x ^ { \prime } ) d x ^ { \prime } - \mu ( U ) \cdot \frac { 1 } { \mu ( U ) } Y ( x ) \bigg | } } \\ & { = \bigg | \int _ { U } \frac { 1 } { \mu ( U ) } Y ( x ^ { \prime } ) d x ^ { \prime } - \int _ { U } \frac { 1 } { \mu ( U ) } Y ( x ) d x ^ { \prime } \bigg | } \\ & { = \bigg | \int _ { U } \frac { 1 } { \mu ( U ) } ( Y ( x ^ { \prime } ) - Y ( x ) ) d x ^ { \prime } \bigg | } \\ & { \leq \int _ { U } \frac { 1 } { \mu ( U ) } | Y ( x ^ { \prime } ) - Y ( x ) | d x ^ { \prime } . } \end{array} +$$ + +Let $\epsilon > 0$ . Since $Y$ is continuous in $x$ , there is $U _ { \epsilon } \in \mathcal { U } _ { x }$ such that $Y ( x ^ { \prime } ) \in \mathrm { B } _ { \epsilon } ( Y ( x ) )$ for all $x ^ { \prime } \in U _ { \epsilon }$ or, equivalently, $| Y ( x ^ { \prime } ) - Y ( x ) | < \epsilon$ . Thus, for all $U _ { \epsilon } \supseteq U$ , i.e., all $U _ { \epsilon } \leq U$ in $\mathcal { U } _ { x }$ we obtain + +$$ +\begin{array} { l } { \displaystyle \left| ~ \left. \delta _ { U } | Y \right. - Y ( x ) \right| \le \int _ { U } \frac 1 { \mu ( U ) } | Y ( x ^ { \prime } ) - Y ( x ) | d x ^ { \prime } } \\ { \displaystyle \qquad \le \int _ { U } \frac 1 { \mu ( U ) } \epsilon d x ^ { \prime } } \\ { \displaystyle \qquad = \epsilon \cdot \mu ( U ) \cdot \frac 1 { \mu ( U ) } } \\ { \displaystyle \qquad = \epsilon } \end{array} +$$ + +and consequently $\begin{array} { r } { \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } { \langle \delta _ { U } | Y \rangle } = Y ( x ) } \end{array}$ . + +Before we can show the well-definedness of $\kappa | _ { X }$ , we first want to get a better description of $\kappa$ . For this, recall from the Peter-Weyl theorem that $L _ { \mathbb { K } } ^ { 2 } ( X ) = { \widehat { \bigoplus } } _ { l \in { \widehat { G } } } \bigoplus _ { i = 1 } ^ { m _ { l } } V _ { l i }$ . With this at our disposal, bwe can formulate the following Lemma on the form of intertwiners on $L _ { \mathbb { K } } ^ { 2 } ( X )$ : + +Lemma C.11. Let ${ \mathcal { K } } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to V$ be an intertwiner. Let $l \in \widehat { G }$ be the unique index such that $V \cong V _ { l i }$ for all $i = 1 , \dots , m _ { l }$ . Let $Y _ { l i } ^ { n }$ , $n = 1 , \ldots , d _ { l }$ be an orthonormal basis of $V _ { l i }$ where $d _ { l } = \dim ( V _ { l } )$ . Then + +$$ +\begin{array} { r } { \mathcal { K } ( f ) = et { } { ' } \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { l } } \langle Y _ { l i } ^ { n } | f \rangle \mathcal { K } ( Y _ { l i } ^ { n } ) } \end{array} +$$ + +for all $f \in L _ { \mathbb { K } } ^ { 2 } ( X )$ + +Proof. We can write $f \in L _ { \mathbb { K } } ^ { 2 } ( X )$ according to the discussion after Definition F.40 as + +$$ +f = \sum _ { l ^ { \prime } \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { l ^ { \prime } } } \sum _ { n = 1 } ^ { [ l ^ { \prime } ] } \langle Y _ { l ^ { \prime } i } ^ { n } | f \rangle Y _ { l ^ { \prime } i } ^ { n } . +$$ + +Note that $\mathcal { K } \vert _ { V _ { l ^ { \prime } i } } : V _ { l ^ { \prime } i } V$ is an intertwiner as well, and so by Schur’s Lemma B.29 it is necessarily zero unless ${ \mathit { l } } ^ { \prime } = l$ is the unique index such that $V _ { l i } \cong V$ . Due to its continuity and linearity, $\kappa$ commutes with infinite sums and we obtain + +$$ +\begin{array} { r l } & { \mathcal { K } ( f ) = \sum _ { l ^ { \prime } \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { l ^ { \prime } } } \sum _ { n = 1 } ^ { [ l ^ { \prime } ] } \left. Y _ { l ^ { \prime } i } ^ { n } | f \right. K \left( Y _ { l ^ { \prime } i } ^ { n } \right) } \\ & { \qquad = \sum _ { l ^ { \prime } \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { l ^ { \prime } } } \sum _ { n = 1 } ^ { [ l ^ { \prime } ] } \left. Y _ { l ^ { \prime } i } ^ { n } | f \right. K | _ { V _ { l ^ { \prime } i } } \left( Y _ { l ^ { \prime } i } ^ { n } \right) } \\ & { \qquad = \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { l } } \left. Y _ { l i } ^ { n } | f \right. K ( Y _ { l i } ^ { n } ) . } \end{array} +$$ + +Corollary C.12. We have $\begin{array} { r } { \mathcal { K } | _ { X } ( x ) = \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { l } } \overline { { Y _ { l i } ^ { n } ( x ) } } \mathcal { K } ( Y _ { l i } ^ { n } ) } \end{array}$ . In particular, the defining limit exists. + +Proof. Since the $Y _ { l i } ^ { n }$ are by the proof of the Peter-Weyl theorem in the finite-dimensional space $\mathcal { E } _ { l }$ spanned by matrix coefficients of the irreducible representation $\rho _ { l } : G \to \operatorname { U } ( V _ { l } )$ and since these matrix coefficients are continuous by Remark B.25, the $Y _ { l i } ^ { n }$ are as finite linear combinations of them also continuous functions. Thus, from Lemma C.10 and C.11 together we obtain: + +$$ +\begin{array} { r l } { { K | \boldsymbol { x } ( \boldsymbol { x } ) = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } K ( \delta _ { U } ) } } \\ & { = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { l } } \langle Y _ { l i } ^ { n } | \delta _ { U } \rangle K ( Y _ { l i } ^ { n } ) } \\ & { = \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { l } } [ \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \langle Y _ { l i } ^ { n } | \delta _ { U } \rangle ] K ( Y _ { l i } ^ { n } ) } \\ & { = \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { l } } \frac { Y _ { l i } ^ { n } ( x ) } { Y _ { l i } ^ { n } ( x ) } K ( Y _ { l i } ^ { n } ) . } \end{array} +$$ + +The complex conjugation came into play since the order in the scalar product is swapped compared to Lemma C.10. □ + +Thus, since we now know that $\kappa | _ { X }$ as a function makes sense, we can finally prove the welldefinedness of $\kappa \mapsto \mathcal { K } | _ { X }$ , + +Lemma C.13. The function $( \cdot ) | _ { X } : \mathrm { H o m } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , V ) \to \mathrm { H o m } _ { G } ( X , V )$ is well-defined, that is: for a linear, equivariant and continuous function ${ \mathcal { K } } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to V$ , the restriction $\mathcal { K } | _ { X } : X \to V$ is equivariant. + +Proof. We have + +$$ +\begin{array} { l } { { \displaystyle K | { \boldsymbol x } ( { \boldsymbol g } \cdot { \boldsymbol x } ) = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } K ( \delta { \boldsymbol U } ) } } \\ { ~ = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } K ( \delta _ { { \boldsymbol U } { \boldsymbol U } } ) } \\ { ~ = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } K ( \lambda ( { \boldsymbol g } ) \delta _ { \boldsymbol U } ) } \\ { ~ = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \rho ( { \boldsymbol g } ) [ K ( \delta _ { U } ) ] } \\ { ~ = \rho ( \boldsymbol { g } ) \big [ \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } K ( \delta _ { U } ) \big ] } \\ { ~ = \rho ( { \boldsymbol g } ) [ K | x ( x ) ] , } \end{array} +$$ + +where the steps are justified as follows: The first step is just the definition of $\kappa | _ { X }$ . The second step uses that the open neighborhood of $g x$ are precisely the $g$ -translated open neighborhoods of $x$ since $g : X \to X$ is a homeomorphism. The third step is easy to check. The fourth step uses the equivariance of $\kappa$ . The fifth step uses the continuity of $\rho ( g )$ , which follows since $\rho ( g )$ is a unitary transformation. The last step is again the definition of $\kappa | _ { X }$ . □ + +# C.2.4 $\widehat { ( \cdot ) }$ AND $( \cdot ) | _ { X }$ ARE INVERSE TO EACH OTHER + +We can now finish the proof of Theorem C.8 and consequently of Theorem C.7: + +Proof of Theorem C.8. After all the preparation, we only need to still show that the maps $\widehat { ( \cdot ) }$ and $( \cdot ) | _ { X }$ are inverse to each other. For ${ \hat { K } } | _ { X } = K$ , i.e., the injectivity of the function $K \mapsto { \widehat { K } }$ and surjectivity of the function $\kappa \mapsto \mathcal { K } | _ { X }$ , we compute: + +$$ +\begin{array} { l } { { \displaystyle \left. \widehat { K } \right| _ { X } ( x ) = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \widehat { K } \left( \delta _ { U } \right) } } \\ { ~ } \\ { { \displaystyle ~ = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \int _ { X } \delta _ { U } ( x ^ { \prime } ) K ( x ^ { \prime } ) d x ^ { \prime } } } \\ { ~ } \\ { { \displaystyle ~ = K ( x ) } . } \end{array} +$$ + +The last step follows from Lemma C.10 by identifying $V = V _ { l }$ with $\mathbb { K } ^ { d _ { l } }$ and viewing $K$ as consisting of continuous component functions $K ^ { n } : X \mathbb { K }$ , $n \in \{ 1 , \ldots , d _ { l } \}$ . The continuity of $K$ was shown in Proposition C.5. + +For showing ${ \widehat { \ K | _ { X } } } = \kappa$ we do a computation using the description of $\kappa$ from Lemma C.11 and the description of $\kappa | _ { X }$ from Corollary C.12: + +$$ +\begin{array} { l } { { \displaystyle \widehat { K | _ { X } } ( f ) = \int _ { X } f ( x ) \mathcal { K } | _ { X } ( x ) d x } } \\ { { \displaystyle = \int _ { X } f ( x ) \Big ( \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { l } } \overline { { { Y _ { l i } ^ { n } ( x ) } } } \mathcal { K } ( Y _ { l i } ^ { n } ) \Big ) d x } } \\ { { \displaystyle ~ = \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { i } } \Big ( \int _ { X } f ( x ) \overline { { { Y _ { l i } ^ { n } ( x ) } } } d x \Big ) \mathcal { K } ( Y _ { l i } ^ { n } ) } } \\ { { \displaystyle ~ = \sum _ { i = 1 } ^ { m _ { l } } \sum _ { n = 1 } ^ { d _ { i } } \langle Y _ { l i } ^ { n } | f \rangle \mathcal { K } ( Y _ { l i } ^ { n } ) } } \\ { { \displaystyle ~ = \mathcal { K } ( f ) } . } \end{array} +$$ + +This finally finishes the proof. + +# D A WIGNER-ECKART THEOREM FOR STEERABLE KERNELS OF GENERAL COMPACT GROUPS + +In Chapter C we have seen the most important theoretical insight of this work: steerable kernels on a homogeneous space $X$ correspond one-to-one to kernel operators (certain representation operators) on the space of square-integrable functions $L _ { \mathbb { K } } ^ { 2 } ( X )$ . In this chapter, we will develop the most important consequence of this correspondence: a Wigner-Eckart theorem for steerable kernels and consequently a description of a basis for steerable kernels. This works for both fields $\mathbb { R }$ and C, for an arbitrary compact group $G$ , an arbitrary homogeneous space $X$ and arbitrary finite-dimensional input- and output fields. Additionally, it covers the general theory of equivariant CNNs on homogeneous spaces developed in (Cohen et al., 2019b). + +In Section D.1 we will work towards formulating the most important theorems. Since these will involve tensor products, we will start with defining and studying tensor products of pre-Hilbert spaces and (unitary) representations. Afterward, we will define the Clebsch-Gordan coefficients, which relate a tensor product of irreducible representations to the irreducible subrepresentations of this tensor product. This will lead to a formulation of the original Wigner-Eckart theorem similar as it appears in quantum mechanics, including a proof. The original Wigner-Eckart theorem is a statement about representation operators on irreducible representations. However, we consider kernel operators on $\dot { L } _ { \mathbb { K } } ^ { 2 } ( X )$ which is not irreducible. Also, different from the original Theorem, we also consider representations over the real numbers, which leads to a replacement of reduced matrix elements by endomorphisms. Therefore we then formulate a generalization of the original theorem. Then, using the correspondence between kernel operators and steerable kernels from Theorem C.7, we can transform this into a Wigner-Eckart theorem for steerable kernels and ultimately a statement about a basis of the space of steerable kernels. We conclude with some remarks about how to use the basis kernels in practice. + +Afterward, in Section D.2, we give the remaining proof of the Wigner-Eckart theorem for kernel operators, which we omit in the section before. First, we reduce the statement to the dense subspace of $L _ { \mathbb { K } } ^ { 2 } ( X )$ which is a direct sum of all irreducible subrepresentations. We then describe a correspondence between representation operators and intertwiners on a certain tensor product, the so-called hom-tensor adjunction. Finally, we finish with the full proof of the Wigner-Eckart theorem. + +As always, let $\mathbb { K }$ be either of the two fields $\mathbb { R }$ and $\mathbb { C }$ and $G$ be a compact topological group. $X$ is any homogeneous space of $G$ . + +D.1 A WIGNER-ECKART THEOREM FOR STEERABLE KERNELS AND THEIR KERNEL BASES + +D.1.1 TENSOR PRODUCTS OF PRE-HILBERT SPACES AND UNITARY REPRESENTATIONS + +In order to state the Wigner-Eckart theorem, we need the notion of representations on tensor products. This is defined similarly to Hom-representations, see Definition C.1. For this, we first need to discuss the notion of a tensor product of vector spaces: + +Definition D.1 (Tensor Product). Let $V$ and $V ^ { \prime }$ be two vector spaces over $\mathbb { K }$ . Then $V \otimes V ^ { \prime }$ , the tensor product of $V$ and $V ^ { \prime }$ , is a vector space over $\mathbb { K }$ with the following properties: + +1. There is a bilinear function $\otimes : V \times V ^ { \prime } \to V \otimes V ^ { \prime } , ( v , v ^ { \prime } ) \mapsto v \otimes v ^ { \prime } . V \otimes V ^ { \prime }$ is generated by elements of the form $v \otimes v ^ { \prime }$ . + +2. It has the following universal property: for any bilinear function $\beta : V \times V ^ { \prime } \to P$ into a vector space $P$ , there is a unique linear function ${ \overline { { \beta } } } : V \otimes V ^ { \prime } \to P$ given on elements of the form $v \otimes v ^ { \prime }$ by $\overline { { \beta } } ( v \otimes v ^ { \prime } ) = \beta ( v , v ^ { \prime } )$ . In other words, the following diagram commutes: + +$$ +\begin{array} { l } { { V \times V ^ { \prime } \xrightarrow [ ] { \beta } P } } \\ { { \otimes } } \\ { { V \otimes V ^ { \prime } } } \end{array} +$$ + +3. If $V$ and $V ^ { \prime }$ are finite-dimensional with bases $\{ v _ { 1 } , \ldots , v _ { n } \} \subseteq V$ and $\{ v _ { 1 } ^ { \prime } , \ldots , v _ { m } ^ { \prime } \} \subseteq V ^ { \prime }$ , then $\{ v _ { i } \otimes v _ { j } ^ { \prime } \} _ { i , j } \subseteq V \otimes V ^ { \prime }$ is a basis of $V \otimes V ^ { \prime }$ . In particular, the dimension of $V \otimes V ^ { \prime }$ is $n \cdot m$ . + +Property 3 follows from 1 and 2 and would therefore not necessarily be needed in the definition. The explicit construction of tensor products shall not matter for our purposes since the properties above characterize it up to isomorphism. The second property stated in the definition is of large importance since it tells us how we can define linear functions on $V \otimes V ^ { \prime }$ : if we have a guess for such a function $\varphi : V \otimes V ^ { \prime } \to P$ (of which we don’t yet know whether its “assignment rule” is well-defined), then we just need to test whether the function $\tilde { \varphi } : V \times V ^ { \prime } \to P$ given by $\tilde { \varphi } ( v , v ^ { \prime } ) : = \varphi ( v \otimes v ^ { \prime } )$ is bilinear. If it is, then $\varphi$ is a well-defined linear function. We will use this soon in the following context: Assume $f : V \to V$ and $g : V ^ { \prime } \to V ^ { \prime }$ are linear functions. Then we would like to define a function $f \otimes g : V \otimes V ^ { \prime } \to V \otimes V ^ { \prime }$ by $( f \otimes g ) ( v \otimes v ^ { \prime } ) = f ( v ) \otimes g ( v ^ { \prime } )$ . For this to work, we need to test whether the assignment $( v , v ^ { \prime } ) \mapsto f ( v ) \otimes g ( v ^ { \prime } )$ is a bilinear function $V \times V ^ { \prime } \to V \otimes V ^ { \prime }$ . Clearly, it is, and so $f \otimes g$ is a well-defined linear function! We use this in Definition D.3 in order to define the tensor product of representations. + +Since we actually deal with Hilbert spaces most of the time, we would like to build tensor products of Hilbert spaces. However, their definition is not completely straightforward since one cannot just take the tensor product of the underlying vector spaces but needs to additionally build the completion of the resulting space (Kadison & Ringrose, 1997). Since this complicates the considerations related to a correspondence we later formulate in Proposition D.23, we go a slightly different route. Instead of describing the tensor product of Hilbert spaces, we describe the tensor product of pre-Hilbert spaces, which does not require a completion step. Recall from Definition F.3 that a pre-Hilbert space is basically a Hilbert space that is not necessarily complete. + +Definition D.2 (Tensor Product of pre-Hilbert spaces). Let $V , V ^ { \prime }$ be two pre-Hilbert spaces with scalar products $\langle \cdot | \cdot \rangle$ and $\langle \cdot | \cdot \rangle ^ { \prime }$ . Then the tensor product of vector spaces $V \otimes V ^ { \prime }$ can be made into a pre-Hilbert space using the scalar product which is given on generators by + +$$ +\left. v \otimes v ^ { \prime } | w \otimes w ^ { \prime } \right. _ { \otimes } : = \left. v | w \right. \cdot \left. v ^ { \prime } | w ^ { \prime } \right. ^ { \prime } . +$$ + +This is then anti-linearly extended in the first (i.e., “Bra”), and linearly extended in the second (i.e., “Ket”) component. + +One can show that this makes $V \otimes V ^ { \prime }$ a pre-Hilbert space. For simplicity, we will from now on not notationally distinguish the different scalar products involved. With this preparation, we can come to the notion of tensor product representations: + +Definition D.3 (Tensor Product Representation). Let $\rho : G \to { \mathrm { G L } } ( V )$ and $\rho ^ { \prime } : G \to { \mathrm { G L } } ( V ^ { \prime } )$ be two linear representations, where $V$ and $V ^ { \prime }$ are pre-Hilbert spaces. Then on the tensor product $V \otimes V ^ { \prime }$ of pre-Hilbert spaces, we can define the tensor product representation $\rho \otimes \rho ^ { \prime }$ by + +$$ +\rho \otimes \rho ^ { \prime } : G \to { \mathrm { G L } } ( V \otimes V ^ { \prime } ) , g \mapsto \rho ( g ) \otimes \rho ^ { \prime } ( g ) , +$$ + +where $\rho ( g ) \otimes \rho ^ { \prime } ( g ) : V \otimes V ^ { \prime } \to V \otimes V ^ { \prime }$ is given on generators by + +$$ +\left( \rho ( g ) \otimes \rho ^ { \prime } ( g ) \right) ( v \otimes v ^ { \prime } ) : = \rho ( g ) ( v ) \otimes \rho ^ { \prime } ( g ) ( v ^ { \prime } ) . +$$ + +Lemma D.4. The map $\rho \otimes \rho ^ { \prime } : G \to { \mathrm { G L } } ( V \otimes V ^ { \prime } )$ defined above is a linear representation. + +Proof. Clearly, each $( \boldsymbol { \rho } \otimes \boldsymbol { \rho } ^ { \prime } ) ( \boldsymbol { g } )$ is linear and we have $( \rho \otimes \rho ^ { \prime } ) ( g g ^ { \prime } ) = ( \rho \otimes \rho ^ { \prime } ) ( g ) \circ ( \rho \otimes \rho ^ { \prime } ) ( g ^ { \prime } )$ . Thus, for showing that it is a linear representation, we need to show it is continuous. Assume we already knew continuity of all maps $( \bar { \rho \otimes } \rho ^ { \prime } ) ^ { v \otimes v ^ { \prime } } : G \to V \otimes V ^ { \prime }$ , $g \mapsto \left[ ( \rho \otimes \rho ^ { \prime } ) ( g ) \right] ( v \otimes v ^ { \prime } )$ . Then for linear combinations $\begin{array} { r } { \xi = \sum _ { i = 1 } ^ { n } \lambda _ { i } \left( v _ { i } \otimes v _ { i } ^ { \prime } \right) } \end{array}$ we obtain using the linearity of $( \boldsymbol { \rho } \otimes \boldsymbol { \rho } ^ { \prime } ) ( \boldsymbol { g } )$ : + +$$ +\begin{array} { l } { { ( \rho \otimes \rho ^ { \prime } ) ^ { \xi } ( g ) = \left[ ( \rho \otimes \rho ^ { \prime } ) ( g ) \right] ( \xi ) } } \\ { { \ = \left[ ( \rho \otimes \rho ^ { \prime } ) ( g ) \right] \left( \sum _ { i = 1 } ^ { n } \lambda _ { i } \left( v _ { i } \otimes v _ { i } ^ { \prime } \right) \right) } } \\ { { \ = \sum _ { i = 1 } ^ { n } \lambda _ { i } \left[ ( \rho \otimes \rho ^ { \prime } ) ( g ) \right] ( v _ { i } \otimes v _ { i } ^ { \prime } ) } } \\ { { \ = \left( \sum _ { i = 1 } ^ { n } \lambda _ { i } ( \rho \otimes \rho ^ { \prime } ) ^ { v _ { i } \otimes v _ { i } ^ { \prime } } \right) ( g ) . } } \end{array} +$$ + +Now, since scalar multiplication and addition in topological vector spaces is continuous, and since pre-Hilbert spaces are special topological vector spaces, the continuity of $( \boldsymbol { \rho } \otimes \boldsymbol { \rho } ^ { \prime } ) ^ { \xi }$ follows from that of all $( \rho \otimes \rho ^ { \prime } ) ^ { v \otimes v ^ { \prime } }$ . + +What’s left is proving the continuity of functions of the form $( \rho \otimes \rho ^ { \prime } ) ^ { v \otimes v ^ { \prime } }$ . For notational simplicity, write $f = \rho ^ { v } : G \to V$ and $f ^ { \prime } : \rho ^ { \prime } { } ^ { v ^ { \prime } }$ , which are both continuous since $\rho$ and $\rho ^ { \prime }$ are linear representations. We want to show that also $f \otimes f ^ { \prime } : G \to V \otimes V ^ { \prime }$ is continuous. We can test continuity in each point $g _ { 0 } \in G$ separately by Definition F.6. For each $g \in G$ we then obtain, with $\mathrm { R e }$ being the real part of a complex number: + +$$ +\begin{array} { r l } & { \| ( f \otimes f ^ { \prime } ) ( g ) - ( f \otimes f ^ { \prime } ) ( g _ { 0 } ) \| ^ { 2 } } \\ & { \qquad = \| [ f ( g ) \otimes f ^ { \prime } ( g ) - f ( g ) \otimes f ^ { \prime } ( g _ { 0 } ) ] + [ f ( g ) \otimes f ^ { \prime } ( g _ { 0 } ) - f ( g _ { 0 } ) \otimes f ^ { \prime } ( g _ { 0 } ) ] \| ^ { 2 } } \\ & { \qquad = \| f ( g ) \otimes [ f ^ { \prime } ( g ) - f ^ { \prime } ( g _ { 0 } ) ] + [ f ( g ) - f ( g _ { 0 } ) ] \otimes f ^ { \prime } ( g _ { 0 } ) \| ^ { 2 } } \\ & { \qquad = \| f ( g ) \otimes [ f ^ { \prime } ( g ) - f ^ { \prime } ( g _ { 0 } ) ] \| ^ { 2 } + \| [ f ( g ) - f ( g _ { 0 } ) ] \otimes f ^ { \prime } ( g _ { 0 } ) \| ^ { 2 } } \\ & { \qquad + 2 \operatorname { R e } f ( g ) \otimes [ f ^ { \prime } ( g ) - f ^ { \prime } ( g _ { 0 } ) ] | [ f ( g ) - f ( g _ { 0 } ) ] \otimes f ^ { \prime } ( g _ { 0 } ) } \\ & { \qquad = \| f ( g ) \| ^ { 2 } \cdot \| f ^ { \prime } ( g ) - f ^ { \prime } ( g _ { 0 } ) \| ^ { 2 } + \| f ( g ) - f ( g _ { 0 } ) \| ^ { 2 } \cdot \| f ^ { \prime } ( g _ { 0 } ) \| ^ { 2 } } \\ & { \qquad + 2 \operatorname { R e } ( \langle f ( g ) | f ( g ) - f ^ { \prime } ( g _ { 0 } ) \| ^ { 2 } + \| f ( g ) - f ( g _ { 0 } ) \| ^ { 2 } \cdot \| f ^ { \prime } ( g _ { 0 } ) \| ^ { 2 } } \\ & { \qquad + 2 \operatorname { R e } ( \langle f ( g ) | f ( g ) - f ( g _ { 0 } ) \rangle \cdot \langle f ^ { \prime } ( g ) - f ^ { \prime } ( g _ { 0 } ) | f ^ { \prime } ( g _ { 0 } ) \rangle ) . } \end{array} +$$ + +All in all we see the following: If $g$ is sufficiently close to $g _ { 0 }$ , then due to the continuity of $f , f ^ { \prime }$ , the scalar product, multiplication in $\mathbb { K }$ and the real part, $\| ( f \otimes f ^ { \prime } ) ( g ) - ( f \otimes f ^ { \prime } ) ( g _ { 0 } ) \| ^ { 2 }$ gets arbitrarily close to 0. This shows the continuity of $f \otimes f ^ { \prime }$ and we are done. □ + +Lemma D.5. Let $\rho : G \to \operatorname { U } ( V )$ and $\rho ^ { \prime } : G \to \operatorname { U } ( V ^ { \prime } )$ be unitary representations on pre-Hilbert spaces. Then also $\rho \otimes \rho ^ { \prime } : G \to \operatorname { U } ( V \otimes V ^ { \prime } )$ is a well-defined unitary representation. + +Proof. According to Lemma D.4 we only need to check whether all $\rho ( g ) \otimes \rho ^ { \prime } ( g )$ are unitary transformations. This follows immediately from the unitarity of $\rho ( g )$ and $\rho ^ { \prime } ( g )$ . + +D.1.2 THE CLEBSCH-GORDAN COEFFICIENTS AND THE ORIGINAL WIGNER-ECKART THEOREM + +In this section, we describe the Clebsch-Gordan coefficients and the original Wigner-Eckart theorem. Except for the proof, we roughly follow Jeevanjee (2011). For the proof, we follow the more general treatment in Agrawala (1980).21 + +For our aims, let $\rho _ { j } : G \to \operatorname { U } ( V _ { j } )$ and $\rho _ { l } : G \to \operatorname { U } ( V _ { l } )$ be representatives of isomorphism classes of irreducible unitary representations.22 Then consider their tensor product representation + +$$ +\rho _ { j } \otimes \rho _ { l } : G \to \operatorname { U } ( V _ { j } \otimes V _ { l } ) +$$ + +which is again a unitary representation according to Lemma D.5. If $V _ { j }$ and $V _ { l }$ are of dimension $d _ { j }$ and $d _ { l }$ , respectively, then $V _ { j } \otimes V _ { l }$ is of dimension $d _ { j } \cdot d _ { l }$ . Since it is a finite-dimensional unitary representation, it is itself an orthogonal direct sum of finitely many irreducible unitary representations by Proposition B.38: + +$$ +V _ { j } \otimes V _ { l } \cong \bigoplus _ { J \in \widehat { G } } \bigoplus _ { s = 1 } ^ { [ J ( j l ) ] } V _ { J } . +$$ + +Here $\widehat { G }$ is, as before, the set of isomorphism classes of irreducible unitary representations and $\left[ J ( j l ) \right]$ is the number of times that $\rho _ { J } : G \to \operatorname { U } ( V _ { J } )$ appears in the direct sum decomposition of $V _ { j } \otimes V _ { l }$ . Note that for most $J$ we have $[ J ( j l ) ] = 0$ , and for some $J$ we may have $[ J ( j l ) ] > 1$ , see Section E.2, where it turns out that $\rho _ { 0 }$ is contained twice in $\rho _ { m } \otimes \rho _ { m }$ . + +Now, choose – once and for all – orthonormal bases of all involved irreps, which exists according to Proposition F.41: + +$$ +\begin{array} { r l r } & { } & { \left\{ Y _ { j } ^ { m } \mid m = 1 , \ldots , d _ { j } \right\} \subseteq V _ { j } , } \\ & { } & { \left\{ Y _ { l } ^ { n } \mid n = 1 , \ldots , d _ { l } \right\} \subseteq V _ { l } , } \\ & { } & { \left\{ Y _ { J } ^ { M } \mid M = 1 , \ldots , d _ { J } \right\} \subseteq V _ { J } . } \end{array} +$$ + +This notation is supposed to remind about spherical harmonics since they form a basis for irreducible representations of the group SO(3). But as mentioned in the footnote, we do not consider these basis elements to be functions here. + +Furthermore, let $l _ { s } : V _ { J } V _ { j } \otimes V _ { l }$ be the linear, equivariant and isometric (i.e., scalar product preserving) embeddings that correspond to the direct sum decomposition of $V _ { j } \otimes V _ { l }$ into irreps, where $s$ ranges in $\{ 1 , \ldots , [ \bar { J ( j l ) } ] \}$ . With this in mind, we can define the Clebsch-Gordan coefficients: + +Definition D.6 (Clebsch-Gordan Coefficients). The Clebsch-Gordan Coefficients are given by + +$$ +\langle s , J M | j m ; l n \rangle : = \Big \langle l _ { s } ( Y _ { J } ^ { M } ) \big | Y _ { j } ^ { m } \otimes Y _ { l } ^ { n } \Big \rangle . +$$ + +Note that in the literature, people usually only consider Clebsch-Gordan coefficients of the specific groups SO(3), SU(2), SU(3) or similar groups appearing in physics. Also note that in the physics context, there is only one linear, equivariant, isometric embedding $l _ { s }$ , which follows directly from Schur’s Lemma D.8. Therefore, it is sensible that the embedding is usually not part of the notation of these coefficients. In our case, however, when considering real representations, there can be several such embeddings $l _ { s }$ . This happens if the endomorphism space of $V _ { J }$ is nontrivial. An example is given by the two-dimensional irreducible representations of SO(2) over the real numbers which we discuss in Section E.2. Since, however, we do not want to depart too much from the notation usually considered in physics, we also omit the embedding from the notation. The index $s$ however needs to be present in order to index the possibly different appearances of $V _ { J }$ in $V _ { j } \otimes V _ { l }$ . + +With this preparation, we can explain the Wigner-Eckart theorem the way it is usually considered in physics, as a prelude for the generalization that we consider in the next section. + +In this (and only this!) section, we assume that our field is $\mathbb { C }$ , since this is the case considered in physics. The Wigner-Eckart theorem aims to obtain a description for all possible representation operators ${ \mathcal { K } } : { \bar { V _ { j } } } \operatorname { H o m } _ { \mathbb { C } } ( V _ { l } , V _ { J } )$ . This is, for example, useful for describing state transitions in the electrons of hydrogen atoms. To motivate the generalization in the next section, we shortly explain the derivation: we can consider the equivalent function ${ \mathcal { K } } : V _ { j } \otimes V _ { l } \to V _ { J }$ given by $\tilde { \mathcal { K } } ( v _ { j } \otimes v _ { l } ) : = \left[ \mathcal { K } ( v _ { j } ) \right] ( v _ { l } )$ on the tensor product. As one can compute, and as we will see in more generality in Proposition D.23, ${ \tilde { \cal K } } : V _ { j } \otimes V _ { l } V _ { J }$ is an intertwiner, where on the left we consider the tensor product representation. We assume, as is the case for $G = \mathrm { S O ( 3 ) }$ or $G = { \mathrm { S U } } ( 2 )$ for usual applications in physics, that $V _ { J }$ is exactly once a direct summand of $V _ { j } \otimes V _ { l }$ . Then, since by Schur’s Lemma B.29 there cannot be nontrivial equivariant linear maps between nonisomorphic irreps, $\tilde { \mathcal { K } }$ restricted to each direct summand of $V _ { j } \otimes V _ { l }$ vanishes, except the one isomorphic to $V _ { J }$ . More precisely, assume that + +$$ +V _ { j } \otimes V _ { l } \cong V _ { J } \oplus \bigoplus _ { l ^ { \prime } } V _ { l ^ { \prime } } +$$ + +is a decomposition of $V _ { j } \otimes V _ { l }$ into copies of irreducible representations, where each $V _ { l ^ { \prime } }$ is nonisomorphic to $V _ { J }$ . Then the information contained in $\tilde { \kappa }$ is equal to the information contained in the restriction ${ \tilde { \cal K } } | _ { V _ { J } } : V _ { J } V _ { J }$ . Since it is an intertwiner from a representation to itself, it deserves a special name. We state the following definition for arbitrary $\mathbb { K } \in \{ \mathbb { R } , \mathbb { C } \}$ , since it will be of crucial importance in our generalization of the Wigner-Eckart theorem: + +Definition D.7 (Endomorphism). Let $\rho : G \to { \mathrm { G L } } ( V )$ be a linear representation. An intertwiner from $V$ to $V$ is called endomorphism. The vector space of endomorphisms is written as + +$$ +\operatorname { E n d } _ { G , \mathbb { K } } ( V ) : = \operatorname { H o m } _ { G , \mathbb { K } } ( V , V ) . +$$ + +A version of Schur’s lemma gives a simple description for endomorphisms of irreducible representations in the case that the underlying field is the complex numbers $\mathbb { C }$ . It makes use of the property of the complex numbers to be algebraically closed: + +Lemma D.8 (Schur’s Lemma). Let $\rho : G \to { \mathrm { G L } } ( V )$ be an irreducible representation. If the underlying field is the complex numbers $\mathbb { C }$ , then the set of endomorphisms, i.e., intertwiners from $V$ to $V$ , only consists of the complex multiples of the identity: + +$$ +\operatorname { E n d } _ { G , \mathbb { C } } ( V ) = \{ c \cdot { \mathrm { i d } } _ { V } \mid c \in \mathbb { C } \} \cong \mathbb { C } . +$$ + +Proof. See Jeevanjee (2011). + +This means that ${ \tilde { \mathcal { K } } } | _ { V J } = c \cdot \operatorname { i d } _ { V J }$ for some complex number $c \in \mathbb { C }$ . Now if we let $p : V _ { j } \otimes V _ { l } \to V _ { J }$ be the projection corresponding to the direct sum decomposition of $V _ { j } \otimes V _ { l }$ , then we obtain + +$$ +\tilde { \cal K } = \tilde { \cal K } | _ { V _ { J } } \circ p = ( c \cdot \mathrm { i d } _ { V _ { J } } ) \circ p = c \cdot p . +$$ + +That is, we have just found out that one complex number, $c$ , is able to completely characterize $\tilde { \kappa }$ and consequently $\kappa !$ This is basically already the Wigner-Eckart theorem. However, it is useful to find a formulation that describes $\kappa$ with respect to bases of the different irreducible representations. For this, we define matrix elements of representation operators. Before we come to the definition, we introduce some notation: If $f : V \to V ^ { \prime }$ is a linear continuous map between Hilbert spaces, we set + +$$ +\langle y | f | x \rangle : = \langle y | f ( x ) \rangle +$$ + +for each $x \in V$ and $y \in V ^ { \prime }$ . The symmetry in this notation is supposed to remind about the fact that $f$ has an adjoint, see Definition F.42, and thus can be applied to $y$ just as well as to $x$ , but we will not make use of this fact. + +Definition D.9 (Matrix Element). Let $T , V _ { l }$ and $V _ { J }$ be unitary representations with orthonormal bases $\{ Y _ { j } ^ { m } \} \subseteq T$ (with $j$ possibly also varying), $\{ Y _ { l } ^ { n } \} \subseteq V _ { l }$ and $\left\{ Y _ { J } ^ { M } \right\} \subseteq V _ { J }$ , respectively. Let ${ \mathcal { K } } : T \to { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ be a representation operator. Then it’s matrix elements are given by the scalars + +$$ +\big < J M | \mathcal { K } _ { j } ^ { m } \big | l n \big > : = \big < Y _ { J } ^ { M } \big | \mathcal { K } ( Y _ { j } ^ { m } ) \big | Y _ { l } ^ { n } \big > . +$$ + +In the same way, if $f : V _ { l } \to V _ { J }$ is any linear (not necessarily equivariant) map, then its matrix elements are given by the scalars + +$$ +\langle J M | f | l n \rangle : = \left. Y _ { J } ^ { M } \big | f \big | Y _ { l } ^ { n } \right. . +$$ + +Remark D.10. We shortly explain this term. Usually, in linear algebra, one has to do with linear functions $f : V \to V ^ { \prime }$ between vector spaces carrying bases $\{ v _ { j } \} \subseteq V$ and $\{ v _ { i } ^ { \prime } \} \subseteq V ^ { \prime }$ . For each basis element $v _ { j } \in V$ one can then find coefficients $A _ { i j } \in \mathbb { K }$ such that + +$$ +f ( v _ { j } ) = \sum _ { i } A _ { i j } v _ { i } ^ { \prime } . +$$ + +The $A _ { i j }$ are called the matrix elements of $f$ and characterize $f$ completely. Now if the bases are orthonormal bases as in Definition F.40, then the coefficients are given by + +$$ +A _ { i j } = \langle v _ { i } ^ { \prime } | f ( v _ { j } ) \rangle = \langle v _ { i } ^ { \prime } | f | v _ { j } \rangle . +$$ + +In a similar way we can understand the matrix elements of a representation operator, only that the linear function itself depends on a chosen basis vector of $V _ { j }$ . As for linear functions, the matrix elements of a representation operator completely characterize it. + +One last remark: since in this section, $V _ { J }$ appears only once as a direct summand in $V _ { j } \otimes V _ { l }$ , we omit the additional “quantum number” $s$ in the notation for the Clebsch-Gordan coefficients. With this preparation, we can formulate and prove the original version of the Wigner-Eckart theorem. Remember that there is a unique complex number $c$ such that $\tilde { \kappa }$ is given by $\tilde { \mathcal { K } } = c \cdot p$ for a projection $p : V _ { j } \otimes V _ { l } \to V _ { J }$ . We now denote this by $\langle J \| \mathcal { K } \| l \rangle : = c$ . + +Theorem D.11 (Wigner-Eckart Theorem). The matrix elements of the representation operator $\kappa$ : $V _ { j } \to { \mathrm { H o m } } _ { \mathbb { C } } ( V _ { l } , V _ { J } )$ are given by + +$$ +\big \langle J M \big | K _ { j } ^ { m } \big | l n \big \rangle = \big \langle J \| K \| l \big \rangle \cdot \big \langle J M \big | j m ; l n \big \rangle , +$$ + +with the $\langle J M | j m ; l n \rangle$ being the Clebsch-Gordan coefficients (which are independent from the representation operator $\mathcal { K }$ ). + +Proof. Let $i : V _ { J } \to V _ { j } \otimes V _ { l }$ be the embedding corresponding to the direct sum decomposition of $V _ { j } \otimes V _ { l }$ . It is an adjoint of the projection $p : V _ { j } \otimes V _ { l } \to V _ { J }$ according to the proof of Proposition F.46. By what we’ve argued above, there exists some $c \in \mathbb { C }$ such that: + +$$ +\begin{array} { r l } & { \langle J M | K _ { j } ^ { m } | l n \rangle = \langle Y _ { J } ^ { M } | K ( Y _ { j } ^ { m } ) | Y _ { l } ^ { n } \rangle } \\ & { \quad \quad \quad \quad = \langle Y _ { J } ^ { M } | \tilde { K } ( Y _ { j } ^ { m } \otimes Y _ { l } ^ { n } ) \rangle } \\ & { \quad \quad \quad = \langle Y _ { J } ^ { M } | c \cdot p ( Y _ { j } ^ { m } \otimes Y _ { l } ^ { n } ) \rangle } \\ & { \quad \quad \quad = c \cdot \big \langle Y _ { J } ^ { M } \big | p ( Y _ { j } ^ { m } \otimes Y _ { l } ^ { n } ) \big \rangle } \\ & { \quad \quad \quad = c \cdot \big \langle i ( Y _ { J } ^ { M } ) \big | Y _ { j } ^ { m } \otimes Y _ { l } ^ { n } \big \rangle } \\ & { \quad \quad \quad = \langle J \| K \| l \rangle \cdot \langle J M | j m ; l n \rangle . } \end{array} +$$ + +As a short explanation: in the fifth step it was used that $i$ and $p$ are adjoint to each other, and consequently, we move from considering the tensor product in $V _ { J }$ to that one in $V _ { j } \otimes V _ { l }$ . In the last step, the definition of the Clebsch-Gordan coefficients was used, and additionally, the notation $\langle J \| \kappa \| \bar { l } \rangle : = c$ that we mentioned before the theorem. The index $s$ is everywhere missing since $V _ { J }$ appears only once in $V _ { j } \otimes V _ { l }$ . This finishes the proof. □ + +Definition D.12 (Reduced Matrix Element). The unique number $c = \langle J \| K \| l \rangle \in \mathbb { C }$ in this theorem is called the reduced matrix element. To reiterate, it characterizes the representation operator completely. + +# D.1.3 REDUCTION TO IRREDUCIBLE UNITARY REPRESENTATIONS + +Let $G$ be any compact group and $X$ any homogeneous space of $G$ . Before we state the WignerEckart Theorem for steerable kernels in the next section, we first want to explain why we can restrict to the case of irreducible unitary input- and output representations. Our explanations are adapted from Weiler & Cesa (2019). + +Thus, let $\rho _ { \mathrm { i n } } : G \to { \mathrm { G L } } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G \to { \mathrm { G L } } ( V _ { \mathrm { o u t } } )$ be general finite-dimensional input- and output representations. We consider the task of finding a basis for the space of steerable kernels $\mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) )$ . By Theorem B.20 and Proposition B.38, there are equivalences of representations (i.e., linear isomorphisms that intertwine between the representations) + +$$ +Q _ { \mathrm { i n } } : V _ { \mathrm { i n } } \to \bigoplus _ { \mu \in I _ { \mathrm { i n } } } V _ { \mu } , \qquad Q _ { \mathrm { o u t } } : V _ { \mathrm { o u t } } \to \bigoplus _ { \nu \in I _ { \mathrm { o u t } } } V _ { \nu } , +$$ + +where $\rho _ { \mu } : G \to \operatorname { U } ( V _ { \mu } )$ and $\rho _ { \nu } : G \to \operatorname { U } ( V _ { \nu } )$ are irreducible unitary representations. Both for the input- and the output representation, the same irrep can appear several times, e.g., there can be $\mu \neq \bar { \mu ^ { \prime } }$ such that $\rho _ { \mu } \cong \rho _ { \mu ^ { \prime } }$ . Now, notice that the map + +$$ +\Phi _ { Q _ { \mathrm { o u t } } , Q _ { \mathrm { i n } } } : { \mathrm { H o m } } _ { G } \left( X , { \mathrm { H o m } } _ { \mathrm { K } } \left( \bigoplus _ { \mu \in I _ { \mathrm { i n } } } V _ { \mu } , \bigoplus _ { \nu \in I _ { \mathrm { o u t } } } V _ { \nu } \right) \right) \to { \mathrm { H o m } } _ { G } ( X , { \mathrm { H o m } } _ { \mathrm { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) +$$ + +given for all $x \in X$ by + +$$ +\left[ \Phi _ { Q _ { \mathrm { o u t } } , Q _ { \mathrm { i n } } } ( K ) \right] ( x ) : = Q _ { \mathrm { o u t } } ^ { - 1 } \circ K ( x ) \circ Q _ { \mathrm { i n } } +$$ + +is clearly an isomorphism. Thus, once a basis for the first kernel space is known, we just need to postcompose and precompose each basis kernel with $Q _ { \mathrm { o u t } } ^ { - 1 }$ and $Q _ { \mathrm { i n } }$ , respectively, in order to get a basis for the space we actually care about. Furthermore, the map + +$$ +\Psi : \bigoplus _ { \nu \in I _ { \mathrm { o n t } } } \bigoplus _ { \mu \in I _ { \mathrm { i n } } } \mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { \mu } , V _ { \nu } ) ) \to \mathrm { H o m } _ { G } \left( X , \mathrm { H o m } _ { \mathbb { K } } \left( \bigoplus _ { \mu \in I _ { \mathrm { i n } } } V _ { \mu } , \bigoplus _ { \nu \in I _ { \mathrm { o n t } } } V _ { \nu } \right) \right) +$$ + +given by + +$$ +\left[ \Psi ( ( K ^ { \nu \mu } ) _ { \nu , \mu } ) ( x ) \right] \left( ( v _ { \mu } ) _ { \mu } \right) : = \Bigg ( \sum _ { \mu \in I _ { \mathrm { i n } } } K ^ { \nu \mu } ( x ) ( v _ { \mu } ) \Bigg ) _ { \nu } \in \bigoplus _ { \nu \in I _ { \mathrm { o u t } } } V _ { \nu } , +$$ + +where $x \in X$ and $( v _ { \mu } ) _ { \mu } \in \oplus _ { \mu \in I _ { \mathrm { i n } } } V _ { \mu }$ are arbitrary, is also clearly an isomorphism. It expresses that we can take a collection of steerable kernels $( K ^ { \nu \mu } ) _ { \nu , \mu }$ and build with it a block-matrix, which is steerable again, as can easily be checked. Accordingly, if we have basis kernels for a space ${ \mathrm { H o m } } _ { G } ( X , { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { \mu } , V _ { \nu } ) )$ for some $\mu , \nu$ , then we can, by applying $\Psi$ , map it to block basis kernels which are zero outside the block with indices $\nu$ and $\mu$ . Overall, by doing this for all $\mu , \nu$ , we thus recover a full basis for the space ${ \mathrm { H o m } } _ { G } \left( X , { \mathrm { H o m } } _ { \mathbb { K } } \left( \bigoplus _ { \mu \in I _ { \mathrm { i n } } } V _ { \mu } , \bigoplus _ { \nu \in I _ { \mathrm { o u t } } } V _ { \nu } \right) \right)$ . By applying the base change $\Phi _ { Q _ { \mathrm { o u t } } , Q _ { \mathrm { i n } } }$ from above, we thus get a basis for $\operatorname { H o m } _ { G } ( X , \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) )$ . In summary, knowing a basis of steerable kernels for irreducible unitary input- and output representations gives us one for all finite-dimensional input- and output representations. Finally, note that the transformation of basis kernels using $\Phi _ { Q _ { \mathrm { o u t } } , Q _ { \mathrm { i n } } }$ and $\Psi$ can be done in the network initialization process and does not need to be performed in each forward pass. + +# D.1.4 THE WIGNER-ECKART THEOREM FOR STEERABLE KERNELS + +Now that we have seen the Wigner-Eckart theorem in a version similar to how it usually appears in physics, it is time to state the version which we will need in this work for applications in deep learning. The treatment is similar to the formulation in Agrawala (1980), which presents a generalization of the Wigner-Eckart theorem to the case that $V _ { J }$ may appear several times as a direct summand in the direct sum decomposition of the tensor product. However, this paper still only considers the Wigner-Eckart theorem for the case of the complex numbers C. If we allow the real numbers as well, we cannot be sure that endomorphisms of irreducible representations are just given by one number. This is a complication we will deal with below by allowing matrix elements of general endomorphisms. Furthermore, we will deal with topological considerations that did not play a role in Agrawala (1980). And lastly, we transport the theorem over into the nonlinear realm of steerable kernels. + +As discussed in the last section, we can restrict the considerations to (representatives of isomorphism classes of) irreducible unitary input- and output representations. Thus, assume the inputrepresentation to be the irrep $\rho _ { l } : \dot { G } { \bf \overrightarrow { \bf { \sigma } } } { \bf { \bf { U } } } ( V _ { l } )$ and the output-representation to be the irrep $\rho _ { J } : G \to \operatorname { U } ( V _ { J } )$ . The idea is now that kernel operators ${ \mathcal { K } } : { \dot { L } } _ { \mathbb { K } } ^ { 2 } ( { \dot { X } } ) \to { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ can be described on each direct summand of the domain individually, and that on each of these summands, arguments similar to those for the original Wigner-Eckart theorem apply. + +According to the Peter-Weyl Theorem B.22 the space $L _ { \mathbb { K } } ^ { 2 } ( X )$ has a dense subset which is a direct sum of irreducible unitary representations: + +$$ +L _ { \mathbb { K } } ^ { 2 } ( X ) = { \widehat { \bigoplus _ { j \in { \widehat { G } } } } } \bigoplus _ { i = 1 } ^ { m _ { j } } V _ { j i } . +$$ + +Each $V _ { j i }$ is, as a subrepresentation of $L _ { \mathbb { K } } ^ { 2 } ( X )$ , isomorphic to $V _ { j }$ . $V _ { j }$ is itself not assumed to be embedded in $L _ { \mathbb { K } } ^ { 2 } ( X )$ . + +For arbitrary $j \in { \widehat { G } }$ , fix once and for all orthonormal bases $\{ Y _ { j i } ^ { m } \} \subseteq V _ { j i }$ corresponding to the basis $\{ Y _ { j _ { . } } ^ { m } \}$ of $V _ { j }$ .23 Furthermore, assume that for all $s = 1 , \ldots , [ J ( j l ) ]$ ], $p _ { j i s } : V _ { j i } \otimes V _ { l } V _ { J }$ is a projection which is an adjoint of the linear equivariant isometric embedding $l _ { j i s } : V _ { J } V _ { j i } \otimes V _ { l }$ . This is assumed to be aligned with the embeddings $V _ { J } \to V _ { j } \otimes V _ { l }$ with respect to the isomorphisms $V _ { j } \cong V _ { j i }$ that underlie the correspondence of basis elements $Y _ { j } ^ { m } \sim Y _ { j i } ^ { m }$ . What this means is that the Clebsch-Gordan coefficients with respect to all of these embeddings, for all $i$ , are equal: + +$$ + l _ { j i s } ( Y _ { J } ^ { M } ) | Y _ { j i } ^ { m } \otimes Y _ { l } ^ { n } = s , J M | j m ; l n . +$$ + +Now we state and prove the Wigner-Eckart theorem, which gives an explicit description of representation operators ${ \mathcal { K } } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ in terms of endomorphisms of $V _ { J }$ and then transfers this statement over to a statement about steerable kernels $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ . Before we state the theorem, we want to shortly explain what to expect: in the derivation of the original Wigner-Eckart theorem in Section D.1.2, we saw that a kernel operator could be expressed as ${ \bar { \mathcal { K } } } : V _ { j } \otimes { \bar { \mathcal { V } } } _ { l } V _ { J }$ . This was in turn equal to $\tilde { \mathcal { K } } = c \circ p$ for an endomorphism $c : V _ { J } \to V _ { J }$ and the projection $p$ corresponding to the appearance of $V _ { J }$ in the direct sum decomposition of $V _ { j } \otimes V _ { l }$ . This time, however, $V _ { J }$ can be found often in $L _ { \mathbb { K } } ^ { 2 } ( X ) \otimes V _ { l }$ , namely: + +1. For each isomorphism class of irreps $j \in { \widehat { G } }$ , +2. For each appearance $i = 1 , \ldots , m _ { j }$ of the irrep $V _ { j }$ in $L _ { \mathbb { K } } ^ { 2 } ( X )$ and +3. For each appearance $s = 1 , \ldots , \left[ J ( j l ) \right]$ of the irrep $V _ { J }$ in the tensor product representation $V _ { j } \otimes V _ { l }$ . $\left[ J ( j l ) \right]$ can be zero, which means that $j$ does not contribute. + +We therefore expect $\tilde { \kappa }$ to be a whole sum of compositions of endomorphisms with projections, for each combination of valid $j , i$ and $s$ . Furthermore, the specific structure of $L _ { \mathbb { K } } ^ { 2 } ( X )$ will be exploited as well by using orthogonal projections from $L _ { \mathbb { K } } ^ { 2 } ( X )$ to summands $V _ { j i }$ . Overall, we hope this sufficiently motivates the theorem: + +Theorem D.13 (Wigner-Eckart Theorem for Steerable Kernels). We state the theorem in three parts: + +1. (Basis-independent Wigner-Eckart for Kernel Operators) There is an isomorphism of vector spaces + +$$ +\mathrm { R e p } : \bigoplus _ { j \in \hat { G } } ^ { m _ { j } } \bigoplus _ { i = 1 } ^ { [ J ( j l ) ] } \mathrm { E n d } _ { G , \mathbb { K } } ( V _ { J } ) \mathrm { H o m } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) +$$ + +which is given by + +$$ +\left[ \mathrm { R e p } ( ( c _ { j i s } ) _ { j i s } ) ( \varphi ) \right] ( v _ { l } ) : = \sum _ { j \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { \left[ J ( j l ) \right] } \sum _ { m = 1 } ^ { d _ { j } } \left. Y _ { j i } ^ { m } \middle \vert \varphi \right. \cdot c _ { j i s } \left( p _ { j i s } ( Y _ { j i } ^ { m } \otimes v _ { l } ) \right) +$$ + +where $( c _ { j i s } ) _ { j i s }$ is a tuple of endomorphisms, $\varphi : X \to \mathbb { K }$ is any square-integrable function and $v _ { l } \in V _ { l }$ is any element. + +2. (Basis-independent Wigner-Eckart for Steerable Kernels) There is an isomorphism of vector spaces + +$$ +{ \mathrm { G K e r : } } \bigoplus _ { j \in { \widehat { G } } } ^ { m _ { j } } \bigoplus _ { i = 1 } ^ { [ J ( j l ) ] } { \mathrm { E n d } } _ { G , \mathbb { K } } ( V _ { J } ) \to { \mathrm { H o m } } _ { G } ( X , { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) +$$ + +which is given by + +$$ +\left[ \mathrm { G K e r } ( ( c _ { j i s } ) _ { j i s } ) ( x ) \right] ( v _ { l } ) : = \sum _ { j \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { \left[ J ( j l ) \right] } \sum _ { m = 1 } ^ { d _ { j } } \left. i , j m | x \right. \cdot c _ { j i s } \left( p _ { j i s } ( Y _ { j i } ^ { m } \otimes v _ { l } ) \right) +$$ + +where $\left( { { c _ { j i s } } } \right) _ { j i s }$ is a tuple of endomorphisms, $x \in X$ is any point and $v _ { l } ~ \in ~ V _ { l }$ is any element. Here, $\langle i , j m | x \rangle : = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \left. Y _ { j i } ^ { m } \big | \delta _ { U } \right.$ , which is according to Proposition $C . I O$ equal to $\overline { { Y _ { j i } ^ { m } ( x ) } }$ . + +3. (Basis-dependent Wigner-Eckart for Steerable Kernels) Let $K = \mathrm { G K e r } ( ( c _ { j i s } ) _ { j i s } )$ be the steerable kernel corresponding to the tuple of endomorphisms $\left( { { c _ { j i s } } } \right) _ { j i s }$ according to the isomorphism above. Then the matrix elements of $K ( x ) \in \mathrm { H o m } _ { \mathbb { K } } ( \bar { V } _ { l } , V _ { J } )$ are explicitly given by + +$$ +\begin{array} { r l r } { { \langle J M | K ( x ) | l n \rangle = } } \\ & { } & { \displaystyle \sum _ { j \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { [ J ( j l ) ] } \sum _ { m = 1 } ^ { d _ { j } } \sum _ { M ^ { \prime } = 1 } ^ { d _ { J } } \big \langle J M \big | c _ { j i s } \big | J M ^ { \prime } \big \rangle \cdot \big \langle s , J M ^ { \prime } \big | j m ; l n \big \rangle \cdot \big \langle i , j m \big | x \big \rangle . } \end{array} +$$ + +Remark D.14. Before we come to the proof, we have some remarks to make about this theorem: + +1. In line with the usual convention, we call the $\left. J M \middle | c _ { j i s } \middle | J M ^ { \prime } \right.$ the generalized reduced matrix elements of the representation operator $\kappa$ . Different from the situation in physics, these can depend nontrivially on the specific basis indices $M$ and $M ^ { \prime }$ . If the space of endomorphisms is 1-dimensional, as is the case when considering representations over $\mathbb { C }$ , then each $c _ { j i s }$ is a diagonal matrix, meaning that it is characterized by only one complex number, for simplicity with the same name $c _ { j i s }$ . Then one has $\langle J M | { \bar { c _ { j i s } } } | J \bar { M } ^ { \prime } \rangle = \delta _ { M \bar { M } ^ { \prime } } .$ · $c _ { j i s }$ and the sum over $M ^ { \prime }$ disappears. What this means for the matrix form of basis kernels of steerable CNNs will be discussed in Corollary D.17. + +2. The coefficients $\langle s , J M ^ { \prime } | j m ; l n \rangle$ are as before the Clebsch-Gordan coefficients. Note that the input $x$ of $K$ appears only in $\langle i , j m \vert x \rangle$ . Those two parts of the right-hand side of the formula are always the same, independent of the kernel $K$ . + +3. The Clebsch-Gordan coefficients are traditionally defined with respect to isometric embeddings $l _ { j i s } : V _ { J } V _ { j } \otimes V _ { l }$ since this makes them less ambiguous. However, we mention that the property of being isometric is no requirement for the construction of Clebsch-Gordan coefficients or the proof of the Wigner-Eckart theorem, being equivariant and linear is sufficient. This then means that the copies $l _ { s } ( Y _ { J } ^ { M } )$ do not anymore form an orthonormal basis. We will use this relaxation in the example in Section E.2, where we do not want to be bothered with obtaining isometric embeddings. + +4. The names for the isomorphisms in the theorem are meant as follows: Rep is the map that maps a tuple of endomorphisms to a kernel operator, which is a special representation operator. GKer maps a tuple of endomorphisms to a $\mathbf { G }$ -steerable kernel. It is not meant as a notation for a kernel in the sense of a nullspace in linear algebra. + +5. Furthermore, a reader with a background in abstract algebra may wonder why we build the direct sum of spaces of endomorphisms instead of the direct product. The reason is that a posteriori, it turns out that only finitely many $j$ contribute nontrivially, and so the direct sum is equal to the direct product. For a proof of the finiteness, see Remark D.18 below. + +6. As a last remark, we want to mention that part 1 of the theorem is not the most general version we could do. We chose to formulate the Wigner-Eckart theorem for $L _ { \mathbb { K } } ^ { 2 } { \bar { ( X ) } }$ specifically since this is the space we use it for. However, an appropriate isomorphism can probably be formulated for any unitary representation instead of $L _ { \mathbb { K } } ^ { 2 } ( X )$ , only that we then need to take care that we replace direct sums by direct products if the index sets on the left side are infinite. Additionally, $V _ { l }$ and $V _ { J }$ could be replaced by arbitrary finite-dimensional representations, and an appropriate adaptation of the theorem would apply. Whether $V _ { l }$ and $V _ { J }$ could also be replaced by infinite-dimensional unitary representations would need to be explored, but an extension to such a case seems possible. + +Proof of Theorem D.13. The proof of 1 will be done in Section D.2 since it requires some work. However, the proofs of 2 and 3 are relatively straightforward once we believe 1 and so we do them here: + +From 1 we know that Rep is an isomorphism. Furthermore, from Theorem C.7 we know that + +$$ +( \cdot ) | _ { X } : \mathrm { H o m } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) \to \mathrm { H o m } _ { G , \mathbb { K } } ( X , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) +$$ + +is an isomorphism as well, and this is given by $\begin{array} { r } { K | _ { X } ( x ) : = \operatorname* { l i m } _ { U \in \mathcal { U } _ { x } } \mathcal { K } ( \delta _ { U } ) } \end{array}$ , where we take the limit over the directed set of open neighborhoods of $x$ . We define the isomorphism GKer now simply as the composition, i.e., $\mathrm { G K e r } : = ( \bar { \cdot } ) | _ { X } \circ \mathrm { R e p }$ . This isomorphism is then explicitly given by: + +$$ +\begin{array} { l } { { \displaystyle \left[ \operatorname { G K e r } \left( \left( c _ { j i s } \right) _ { j i s } \right) ( x ) \right] \left( v _ { l } \right) = \left[ \operatorname { R e p } \left( \left( c _ { j i s } \right) _ { j i s } \right) \right] \left( x \right) \left( v _ { l } \right) } } \\ { { \displaystyle \qquad = \operatorname * { l i m } _ { v \in \mathbb { Z } _ { i } } \left[ \operatorname { R e p } \left( \left( c _ { j i s } \right) _ { j i s } \right) \left( \delta _ { U } \right) \right] \left( v _ { l } \right) } } \\ { { \displaystyle \qquad = \operatorname * { l i m } _ { v \in \mathbb { Z } _ { i } } \sum _ { j \in \widehat { G } ^ { \delta } = i = 1 } \sum _ { s = 1 } ^ { m _ { j } } \sum _ { m = 1 } ^ { \left\lfloor T / \delta \right\rceil } \left( Y _ { j i } ^ { m } \right) \cdot c _ { j i s } \left( p _ { j i s } \left( Y _ { j i } ^ { m } \otimes v _ { l } \right) \right) } } \\ { { \displaystyle \qquad = \sum _ { j \in \widehat { G } ^ { \delta + 1 } } \sum _ { s = 1 } ^ { m _ { j } } \sum _ { m = 1 } ^ { \left\lfloor T / \delta \right\rfloor } \sum _ { \left[ \operatorname { t i m } _ { v \in \mathcal { G } _ { i } } \left. Y _ { j i } ^ { m } \right. \right] } \cdot c _ { j i s } \left( p _ { j i s } \left( Y _ { j i } ^ { m } \otimes v _ { l } \right) \right) } } \\ { { \displaystyle \qquad = \sum _ { j \in \widehat { G } ^ { \delta + 1 } } \sum _ { s = 1 } ^ { m _ { j } } \sum _ { m = 1 } ^ { \left\lfloor T / \delta \right\rfloor } \sum _ { \left( i , j \ m \right) \left\lfloor x \right. \cdot c _ { j i s } \left( p _ { j i s } \left( Y _ { j i } ^ { m } \otimes v _ { l } \right) \right) } } . } \end{array} +$$ + +This already proves 2. Now, in the following computation, we will use that $c _ { j i s } \circ p _ { j i s } = c _ { j i s } \circ$ ◦ $\operatorname { i d } _ { V _ { J } } \circ p _ { j i s }$ pired by notation in physics, we can write the identity on . For 3, we then compute $V _ { J }$ as $\mathrm { i d } _ { V _ { J } } \ =$ $\sum _ { M ^ { \prime } = 1 } ^ { d _ { J } } \left| Y _ { J } ^ { M ^ { \prime } } \right. \cdot \left. Y _ { J } ^ { M ^ { \prime } } \right|$ + +$$ +\begin{array} { r l } & { ( J M | K ( x ) | i n ) } \\ & { = Y _ { j } ^ { M } \middle | K ( x ) \middle | Y _ { n } ^ { n } } \\ & { = Y _ { j } ^ { M } \middle | [ G K e ( ( \sigma _ { j \mathrm { s i } } ) j _ { \mathrm { s i } } ) ( x ) ] ( Y _ { 1 } ^ { n } ) } \\ & { = \displaystyle \sum _ { j \in \widetilde { G } ^ { \ast } = 1 } \sum _ { s = 1 } ^ { m } \sum _ { m = 1 } ^ { d } i , j m | x \cdot Y _ { j } ^ { M } | c _ { j \mathrm { s i } } \circ p _ { j \mathrm { s i } } | Y _ { j } ^ { m } \otimes Y _ { 1 } ^ { m } } \\ & { \quad \mathrm { ~ } } \\ & { = \displaystyle \sum _ { j \in \widetilde { G } ^ { \ast } = 1 } \sum _ { s = 1 } ^ { | J ( \widetilde { J } ) | } \sum _ { m = 1 } ^ { d } \sum _ { s = 1 } ^ { d } i , j m | x \cdot Y _ { j } ^ { M } | c _ { j \mathrm { s i } } | Y _ { j } ^ { M ^ { \prime } } \cdot Y _ { j } ^ { M ^ { \prime } } \middle | p _ { j \mathrm { s i } } | Y _ { j } ^ { m } } \\ & { \quad \mathrm { ~ } } \\ & { \quad \mathrm { ~ } = \displaystyle \sum _ { j \in \widetilde { G } ^ { \ast } = 1 } ^ { m } \sum _ { s = 1 } ^ { | J ( \widetilde { J } ) | } \sum _ { m = 1 } ^ { d } \sum _ { s = 1 } ^ { d } J M \middle | c _ { j \mathrm { s i } } | J M \cdot X _ { j } ^ { M } \middle | c _ { j \mathrm { s i } } | Y _ { j } ^ { M ^ { \prime } } \cdot Y _ { j } ^ { M ^ { \prime } } \middle | p _ { j \mathrm { s i } } | Y _ { j } ^ { m } } \\ & \quad = \displaystyle \sum _ { j \in \widetilde { G } ^ { \ast } = 1 } ^ { m } \sum _ { s = 1 } ^ { | J ( \widetilde { J } ) | } \sum _ { m = 1 } ^ { d } \sum _ { s = 1 } ^ { d } J M \middle | c _ { j \mathrm { s i } } | J M \cdot s , J M \end{array} +$$ + +In the last step, we used the Clebsch-Gordan coefficients, see Definition D.6 and, as mentioned before, that $p _ { j i s }$ is adjoint to the embedding $l _ { j i s } : V _ { J } V _ { j i } \otimes V _ { l }$ . □ + +Remark D.15. Here, we want to argue that our kernel space solution also covers that of general equivariant CNNs on homogeneous spaces (Cohen et al., 2019b). One definition of the kernel space in that setting is + +$$ +\begin{array} { r l } & { \operatorname { H o m } _ { G _ { \mathrm { i n } } \times G _ { \mathrm { o u t } } } ( H , \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) } \\ & { = \big \{ K : H \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \mid K ( g _ { \mathrm { o u t } } h g _ { \mathrm { i n } } ) = \rho _ { \mathrm { o u t } } ( g _ { \mathrm { o u t } } ) \circ K ( h ) \circ \rho _ { \mathrm { i n } } ( g _ { \mathrm { i n } } ) \big \} , } \end{array} +$$ + +where $H$ is a loccally compact group and $G _ { \mathrm { i n } } , G _ { \mathrm { o u t } } \subseteq H$ are subgroups with input- and output representations $\rho _ { \mathrm { i n } } : G _ { \mathrm { i n } } \to \mathrm { G L } ( V _ { \mathrm { i n } } )$ and $\rho _ { \mathrm { o u t } } : G _ { \mathrm { o u t } } \to \mathrm { G L } ( V _ { \mathrm { o u t } } )$ . For compact groups $G _ { \mathrm { i n } }$ and $G _ { \mathrm { o u t } }$ , this is covered by our setting as follows: we define $G : = G _ { \mathrm { o u t } } \times G _ { \mathrm { i n } }$ and $\pmb { g } : = ( g _ { \mathrm { o u t } } , g _ { \mathrm { i n } } )$ . We can define the left action of $G$ on $H$ by $g \cdot h : = { { g } _ { \mathrm { o u t } } } h { { g } _ { \mathrm { i n } } ^ { - 1 } }$ . Furthermore, we can reformulate the representations of $G _ { \mathrm { i n } }$ and $G _ { \mathrm { o u t } }$ to representations of the group $G$ by setting $\rho _ { \mathrm { i n } } : G \to \mathrm { G L } ( V _ { \mathrm { i n } } )$ + +with $\rho _ { \mathrm { i n } } ( g ) : = \rho _ { \mathrm { i n } } ( g _ { \mathrm { i n } } )$ , and similarly for $\pmb { \rho _ { \mathbf { o u t } } }$ . We furthermore notice that in Eq. (19) we could also have inverted $g _ { \mathrm { i n } }$ since that constraint needs to apply to all elements of $G _ { \mathrm { i n } }$ . Thus, we then see that the kernel space can be equivalently defined by + +$$ +\begin{array} { r l } & { \operatorname { H o m } _ { G _ { \mathrm { i n } } \times G _ { \mathrm { o u t } } } ( H , \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) ) } \\ & { = \big \{ K : H \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { \mathrm { i n } } , V _ { \mathrm { o u t } } ) \mid K ( g \cdot h ) = \rho _ { \mathrm { o u t } } ( g ) \circ K ( h ) \circ \rho _ { \mathrm { i n } } ( g ) ^ { - 1 } \big \} , } \end{array} +$$ + +which precisely is the kernel constraint of steerable CNNs in Eq. (2). Thus, if we restrict to a homogeneous space of the action of $G$ on $H$ , we recover steerable kernels as in Definition 3.2 and can apply Theorem 4.1. + +# D.1.5 GENERAL STEERABLE KERNEL BASES + +Now that we have a Wigner-Eckart theorem for steerable kernels, which gives a one-to-one correspondence between steerable kernels and tuples of endomorphisms, we can finally describe what a basis of the space of steerable kernels looks like. For this, additionally to the notation in the last section, we assume that $\{ c _ { r } \mid r = 1 , \ldots , E _ { J } \}$ is a basis of $\operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ . + +Theorem D.16 (Steerable Kernel Bases). $A$ basis of the space of steerable kernels ${ \mathrm { H o m } } _ { G } ( X , { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) )$ ) is given by + +$$ +\{ K _ { j i s r } : X \to \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \mid j \in \widehat { G } , i \in \{ 1 , \ldots , m _ { j } \} , s \in \{ 1 , \ldots , [ J ( j l ) ] \} , r = 1 , \ldots , E _ { J } \} , +$$ + +where the basis kernels $K _ { j i s r }$ have matrix elements + +$$ +\langle J M | K _ { j i s r } ( x ) | l n \rangle = \sum _ { m = 1 } ^ { d _ { j } } \sum _ { M ^ { \prime } = 1 } ^ { d _ { J } } \left. J M \big | c _ { r } \big | J M ^ { \prime } \right. \cdot \left. s , J M ^ { \prime } \big | j m ; l n \right. \cdot \left. i , j m \big | x \right. . +$$ + +Now, for each $M ^ { \prime } \in \{ 1 , \ldots , d _ { J } \}$ , let $\mathrm { C G } _ { J ( j l ) s } ^ { M ^ { \prime } }$ be the $d _ { j } \times d _ { l }$ -matrix of Clebsch-Gordan coefficients $\langle s , J M ^ { \prime } | j m ; l n \rangle$ , with only $m$ and $n$ varying. Furthermore, let $\langle i , j | x \rangle$ be the row vector with entries $\langle i , j m \vert x \rangle$ for $m = 1 , \ldots , d _ { j }$ . In matrix-notation with respect to the bases $\{ Y _ { J } ^ { M } \} \subseteq V _ { J }$ and $\{ Y _ { l } ^ { n } \} \subseteq V _ { l }$ , we can then express the basis kernel $K _ { j i s r } ( x ) : V _ { l } V _ { J }$ as follows: + +$$ +K _ { j i s r } ( x ) = c _ { r } \cdot \left( \begin{array} { l } { \langle i , j | x \rangle \cdot { \mathrm { C G } } _ { J ( j l ) s } ^ { 1 } } \\ { \vdots } \\ { \langle i , j | x \rangle \cdot { \mathrm { C G } } _ { J ( j l ) s } ^ { d _ { J } } } \end{array} \right) . +$$ + +In this formula, all “dots” mean conventional matrix multiplication and $c _ { r }$ is by abuse of notation the matrix of the endomorphism $c _ { r }$ . + +Proof. For the first statement, note that a basis for Lj∈G Lmji=1 $\begin{array} { r l } { } & { \bigoplus _ { j \in \widehat { G } } \bigoplus _ { i = 1 } ^ { m _ { j } } \bigoplus _ { s = 1 } ^ { [ J ( j l ) ] } \mathrm { E n d } _ { G , \mathbb { K } } ( V _ { J } ) } \end{array}$ L[J(jl)]s=1 EndG,K(VJ ) is given by all the tuples $t _ { j i s r } : = ( 0 , \ldots , c _ { r } , \ldots , 0 )$ that have $c _ { r }$ at position $j i s$ , for all combinations of $j , i , s$ and $r$ . Thus, from the isomorphism GKer in the second part of Theorem D.13 we obtain that all $K _ { j i s r } : =$ $\operatorname { G K e r } ( t _ { j i s r } )$ together form a basis for the space of steerable kernels $\mathrm { H o m } _ { G } ( X , \mathrm { H o m } _ { \mathbb { K } } ( \bar { V _ { l } } , V _ { J } ) )$ . When applying the basis-dependent form in part 3 of that theorem to $K _ { j i s r }$ , the first three sums in Eq. (18) just disappear since $t _ { j i s r }$ is zero almost everywhere. Furthermore, $c _ { j i s }$ is replaced by the basis endomorphism $c _ { r }$ . We obtain the claimed result. + +For the final statement on the matrix representation, note that + +$$ +\begin{array} { l } { { \langle J M | K _ { j i s r } ( x ) | l n \rangle = \sum _ { m = 1 } ^ { d _ { j } } \sum _ { M ^ { \prime } = 1 } ^ { d _ { J } } \left. J M | c _ { r } \big | J M ^ { \prime } \right. \cdot \left. s , J M ^ { \prime } \big | j m ; l n \right. \cdot \left. i , j m \big | x \right. } } \\ { { = \sum _ { M ^ { \prime } = 1 } ^ { d _ { J } } \left. J M \big | c _ { r } \big | J M ^ { \prime } \right. \sum _ { m = 1 } ^ { d _ { j } } \left. i , j m \big | x \right. \cdot \left. s , J M ^ { \prime } \big | j m ; l n \right. } } \\ { { = c _ { r } ^ { M } \cdot \left( \sum _ { m = 1 } ^ { d _ { j } } \left. i , j m \big | x \right. \cdot \left. s , J M ^ { \prime } \big | j m ; l n \right. \right) _ { M ^ { \prime } = 1 } ^ { d _ { J } } } } \\ { { = c _ { r } ^ { M } \cdot \left( \left. i , j \big | x \right. \cdot \mathrm { C G } _ { J ( j l ) s } ^ { M ^ { \prime } - n } \right) _ { M ^ { \prime } = 1 } ^ { d _ { J } } . } } \end{array} +$$ + +Here, $c _ { r } ^ { M }$ is the $M ^ { \prime }$ ’th row of the matrix $c _ { r }$ . The result follows by dropping the indices $M$ and $n$ . + +The next corollary means that endomorphisms can be ignored if the space of endomorphisms is 1-dimensional, which is in particular the case if $\mathbb { K } = \mathbb { C }$ . + +Corollary D.17. Assume that $\dim ( \operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } ) ) = 1$ . Then a basis of steerable kernels $K : X $ ${ \mathrm { H o m } } _ { \mathrm { K } } ( V _ { l } , V _ { J } )$ is given by all $K _ { j i s }$ with matrices + +$$ +K _ { j i s } ( x ) = \left( \begin{array} { c } { \langle i , j | x \rangle \cdot \mathrm { C G } _ { J ( j l ) s } ^ { 1 } } \\ { \vdots } \\ { \langle i , j | x \rangle \cdot \mathrm { C G } _ { J ( j l ) s } ^ { d _ { J } } } \end{array} \right) . +$$ + +In particular, this is the case $i f \mathbb { K } = \mathbb { C }$ . + +Proof. In this case, a basis for the space of endomorphisms is given by the single endomorphism $c = \operatorname { i d } _ { V _ { J } }$ . Postcomposition with the identity does not change the matrix, and so the result follows. + +For $\mathbb { K } = \mathbb { C }$ we have $\dim ( \operatorname { E n d } _ { G , \mathbb { C } } ( V _ { J } ) ) = 1$ by Schur’s Lemma D.8, and thus the result follows. + +We end with two remarks regarding the parameterization of steerable CNNs. The first remark considers the case of steerable CNNs of the form $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ on a homogeneous space $X$ . The second remark connects this back to the case that $X$ is an orbit embedded in $\bar { \mathbb { R } } ^ { d }$ . + +Remark D.18 (Parameterization in the abstract). First of all, we want to understand that there are only finitely many basis kernels $K _ { j i s r }$ . To this end, note that the index sets for $i , s ,$ , and $r$ are necessarily finite for all $j$ , and thus we need to understand the finite range of $j$ . A priori, $j$ can run over the whole set $\widehat { G }$ , which can be infinite. But, as we argue now, for only finitely many $j \in { \widehat { G } }$ we can have $V _ { J }$ in a direct sum decomposition of $V _ { j } \otimes V _ { l }$ , which rescues the finiteness: + +Namely, $V _ { J }$ is in the direct sum decomposition of $V _ { j } \otimes V _ { l }$ if and only if the vector space ${ \mathrm { H o m } } _ { G , \mathbb { K } } ( V _ { j } \otimes V _ { l } , V _ { J } )$ is nonzero by Schur’s Lemma B.29. By the hom-tensor adjunction that we will show in Proposition D.23 in more generality, this is the case if an only if ${ \mathrm { H o m } } _ { G , \mathbb { K } } ( V _ { j } , { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) )$ is nonzero. And finally, this is the case if and only if $V _ { j }$ is in a direct sum decomposition of the representation ${ \mathrm { H o m } } _ { \mathrm { K } } ( V _ { l } , V _ { J } )$ , again by Schur’s lemma. Now, since ${ \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ is finite-dimensional, this can only be the case for finitely many $j$ , and so we are done.24 + +Overall, this means the following: To parameterize an equivariant neural network, one needs arbitrary parameters $w _ { j i s r } \in \mathbb { K }$ for all combinations of $j \in { \widehat { G } }$ , $i \in \{ 1 , \ldots , m _ { j } \}$ , $s \in \{ 1 , \ldots , [ J ( j l ) ] \}$ and $r = 1 , \dots , E _ { J }$ . A general steerable Kernel $K : X \to \operatorname { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ then takes the form + +$$ +\begin{array} { r } { K = \sum _ { j \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { [ J ( j l ) ] } \sum _ { r = 1 } ^ { E _ { J } } w _ { j i s r } K _ { j i s r } , } \end{array} +$$ + +with the basis kernels $K _ { j i s r }$ as in Theorem D.16. + +Remark D.19 (Parameterization in practice). Remember that our original motivation for the use of homogeneous spaces in Section C.1.1 was that $\mathbb { R } ^ { d }$ splits as a disjoint union of homogeneous spaces, on which the kernel constraint acts separately. For simplicity, we assume that the compact group acting on $\mathbb { R } ^ { d }$ is either $G = \mathrm { S O } ( d )$ or $\bar { G } = \mathrm { O } \bar { ( } d )$ , but the general ideas hold also for the finite transformation groups in $\mathbb { R } ^ { d }$ – the only difference is that in these finite cases, the set of representatives of orbits becomes larger. + +Thus, $\mathbb { R } ^ { d }$ splits into orbits $\begin{array} { r } { \mathbb { R } ^ { d } = \bigcup _ { r \geq 0 } S ^ { n - 1 } ( r ) } \end{array}$ , where $S ^ { n - 1 } ( r )$ is the sphere of radius $r$ (with $S ( 0 ) = \{ 0 \}$ being a single point). + +We’ll discuss the orbit $X _ { 0 } = \{ 0 \}$ , the origin, separately below. But note that all other orbits are necessarily homeomorphic to each other and thus can be treated on equal footing. Therefore, let $S ^ { n - 1 }$ be the standard sphere with radius 1 and $K _ { j i s r } : S ^ { n - 1 } \to \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ be basis kernels for this choice. Then for a general steerable kernel ${ \underset { \cdot } { K } } : { \mathbb { R } ^ { d } } { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ there are arbitrary functions $w _ { j i s r } : \mathbb { R } _ { > 0 } \to \mathbb { K }$ such that, for all $x \in \mathbb { R } ^ { d } \setminus \{ 0 \}$ , we have: + +$$ +K ( \boldsymbol { x } ) = \sum _ { \boldsymbol { j } \in \widehat { G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { [ J ( \boldsymbol { j } \boldsymbol { l } ) ] } \sum _ { r = 1 } ^ { E _ { \boldsymbol { j } } } w _ { j i s r } ( \Vert \boldsymbol { x } \Vert ) \cdot K _ { j i s r } \left( \frac { \boldsymbol { x } } { \Vert \boldsymbol { x } \Vert } \right) . +$$ + +For $x = 0$ , we might use our heavy theory to solve the kernel constraint, but it is more illuminating to do it from scratch since this case is so simple: we have $K ( 0 ) : V _ { l } V _ { J }$ , and the kernel constraint takes the form + +$$ +K ( 0 ) = K ( g \cdot 0 ) = \rho _ { J } ( g ) \circ K ( 0 ) \circ \rho _ { l } ( g ) ^ { - 1 } +$$ + +for all $g \in G$ , which is equivalent to $K ( 0 ) \circ \rho _ { l } ( g ) = \rho _ { J } ( g ) \circ K ( 0 )$ for all $g \in G$ . This just means that $K ( 0 ) : V _ { l } V _ { J }$ is an intertwiner, and by Schur’s Lemma B.29 it is either $0$ if $l \neq J$ or an arbitrary endomorphism $V _ { J } V _ { J }$ if $l ~ = ~ J$ . Thus, assuming $l ~ = ~ J$ and choosing basis-endomorphisms $c _ { r } : V _ { J } \to V _ { J }$ , there are coefficients $w _ { r } \in \mathbb { K }$ such that + +$$ +K ( 0 ) = \sum _ { r = 1 } ^ { E _ { J } } w _ { r } \cdot c _ { r } . +$$ + +The reader may find it interesting to check that this solution is precisely what is also predicted by our theory using that $L _ { \mathbb { K } } ^ { 2 } ( \{ 0 \} ) \cong \mathbb { K }$ is just isomorphic to the trivial representation of $G$ . + +All in all, we now know what the most general steerable kernels look like. In practice, one needs to choose the functions $w _ { j i s r } : \mathbb { R } _ { > 0 } \to \mathbb { K }$ . For representations over the real numbers, i.e., with $\mathbb { K } = \mathbb { R }$ , one choice is to only consider finitely many radii and Gaussian radial profiles around them. Then instead of learning the whole function $w _ { j i s r }$ , one learns finitely many real parameters that choose “how activated” a basis kernel $K _ { j i s r }$ is for a certain radius. This is, for example, the route taken in Weiler et al. (2018b;a); Weiler & Cesa (2019). If one deals with complex representations, one usually goes the same route, only that the parameters that choose how “activated” the basis kernels are will then be complex numbers. One can either parameterize them as $a + i b$ with a real part $a$ and a complex part $b$ . This intuitively means that $a$ activates the standard version of the kernel $K _ { j i s r }$ , whereas $b$ activates the kernel $i K _ { j i s r }$ , which can be imagined as a version of the kernel turned by $9 0 °$ . One other possibility is to parameterize a complex number as $\alpha \cdot e ^ { i \beta }$ with a scaling factor $\alpha > 0$ and a phase shift $\beta$ . This is the route chosen in Worrall et al. (2016). + +In Chapter E we will look at examples of determining the basis kernels $K _ { j i s r }$ , which will hopefully further illuminate the theorem. In the next section, we go back to the theory and prove the remaining parts of the Wigner-Eckart theorem. + +# D.2 PROOF OF THE WIGNER-ECKART THEOREM FOR KERNEL OPERATORS + +In this section, we prove the first part of Theorem D.13, the Wigner-Eckart theorem for Kernel Operators, since we have skipped this in the last section. It is not necessary to read this section and the reader may wish to directly go to the chapter on examples E. We will make frequent use of topological concepts from Chapter F.1 in this section. + +The strategy is the following: in Section D.2.1, we show that + +$$ +\mathrm { H o m } _ { G , \mathbb { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) \cong \mathrm { H o m } _ { G , \mathbb { K } } \bigg ( \bigoplus _ { j \in \widehat { G } } ^ { m _ { j } } V _ { j i } , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \bigg ) , +$$ + +which basically means that we can ignore the “topological closure” of the direct sum which is dense in $L _ { \mathbb { K } } ^ { 2 } ( X )$ . This works, intuitively, since kernel operators are continuous, and so they are determined by what they do on a dense subset. Then, in section D.2.2, we show that + +$$ +\mathrm { H o m } _ { G , \mathrm { K } } \left( \bigoplus _ { j \in \widehat { G } } ^ { m _ { j } } V _ { j i } , \mathrm { H o m } _ { \mathrm { K } } ( V _ { l } , V _ { J } ) \right) \cong \mathrm { H o m } _ { G , \mathrm { K } } \left( \bigoplus _ { j \in \widehat { G } } ^ { m _ { j } } V _ { j i } \otimes V _ { l } , V _ { J } \right) , +$$ + +which is the main step that we need in order to be able to make use of the Clebsch-Gordan coefficients, namely when we decompose the tensor product. Finally, in Section D.2.3, we finish the proof of Theorem D.13. + +# D.2.1 REDUCTION TO A DENSE SUBSPACE OF $L _ { \mathbb { K } } ^ { 2 } ( X )$ + +In this section, we reduce the statement to representation operators on $\textstyle \bigoplus _ { j \in { \widehat { G } } } \bigoplus _ { i = 1 } ^ { m _ { j } } V _ { j i }$ . For simplicity, we write the double direct sum from now on as $\bigoplus _ { j i }$ . + +Furthermore, remember that $V _ { l }$ and $V _ { J }$ are finite-dimensional, and thus ${ \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ can be identified with matrices in $\mathbb { K } ^ { d _ { J } \times d _ { l } }$ . This space is a Euclidean space and thus has a scalar product and consequently also a norm, see Chapter F.1. Consequently, each kernel operator is a continuous map between normed vector spaces, which we’ll use in the following. + +A short terminological note: kernel operators are just representation operators on $L _ { \mathbb { K } } ^ { 2 } ( X )$ and only have their name due to the relation to steerable kernels. Thus, the terminological difference to representation operators in the following reduction result has no further meaning: + +Lemma D.20. The restriction map + +$$ +\mathrm { H o m } _ { G , \mathrm { K } } ( L _ { \mathbb { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) ) \to \mathrm { H o m } _ { G , \mathrm { K } } \left( \bigoplus _ { j i } V _ { j i } , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \right) +$$ + +given by $K \mapsto \mathcal { K } | _ { \oplus _ { j i } V _ { j i } }$ , between kernel operators on the left and representation operators on the right is an isomorphism. + +Proof. First of all, the kernel operators on the left are actually uniformly continuous by Proposition F.18. Thus, by Lemma F.22, the restriction map is an injection into uniformly continuous representation operators on $\bigoplus _ { j i } V _ { j i }$ . The set of all these maps is equal to the set of all representation operators by Proposition F.18 again. + +Thus, in order to be finished, we only need to see that the unique extension of a representation operator ${ \mathcal { K } } : \oplus _ { j i } V _ { j i } \to { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , { \bar { V _ { J } } } )$ to a continuous function $\overline { { \mathcal { K } } } : L _ { \mathbb { K } } ^ { 2 } ( X ) \to \operatorname { H o m } _ { K } ^ { \bullet } ( V _ { l } , V _ { J } )$ is a kernel operator, which means it is linear and equivariant. + +For linearity, let $a \in \mathbb { K }$ and $f \in L _ { \mathbb { K } } ^ { 2 } ( X )$ . Let $( f _ { k } ) _ { k }$ be a sequence in $\textstyle \bigoplus _ { j i } V _ { j i }$ that converges to $f$ . Using the continuity of $\overline { { \mathcal { K } } }$ and the linearity of $\kappa$ we obtain: + +$$ +\begin{array} { r l } { K ( a \cdot f ) = \overline { { K } } \big ( \underset { k \infty } { \operatorname* { l i m } } \big ( a \cdot f _ { k } \big ) \big ) } & { } \\ & { = \underset { k \infty } { \operatorname* { l i m } } \overline { { K } } \big ( a \cdot f _ { k } \big ) } \\ & { = \underset { k \infty } { \operatorname* { l i m } } K \big ( a \cdot f _ { k } \big ) } \\ & { = \underset { k \infty } { \operatorname* { l i m } } a \cdot K \big ( f _ { k } \big ) } \\ & { = \underset { k \infty } { \operatorname* { l i m } } \frac { K } { \big ( f _ { k } \big ) } } \\ & { = a \cdot \frac { 1 } { k \infty } \overline { { K } } \big ( f _ { k } \big ) } \\ & { = a \cdot \overline { { K } } \big ( \underset { k \infty } { \operatorname* { l i m } } f _ { k } \big ) } \\ & { = a \cdot \overline { { K } } ( f ) . } \end{array} +$$ + +Linearity with respect to addition can be shown similarly. For the equivariance we can argue in the same way, only that we additionally need to use the continuity of the representations $\lambda : G \to$ $\mathrm { U } ( L _ { \mathbb { K } } ^ { 2 } ( X ) )$ and $\rho _ { \mathrm { H o m } } : G \to { \mathrm { G L } } ( { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) )$ . □ + +# D.2.2 THE HOM-TENSOR ADJUNCTION + +Lemma D.21. Let ${ \mathcal { K } } : \oplus _ { l i } V _ { l i } \to V$ be linear and equivariant, where $V$ is an irrep. Then $\kappa$ is continuous. + +Proof. By Schur’s Lemma D.8,25 we know that $\kappa$ factors through the irreducible representations that are isomorphic to $V$ . That is, let $V _ { j }$ be that irrep and $p _ { j i } : \mathsf { \bar { \theta } } _ { l i } V _ { l i } \to V _ { j i }$ be the canonical projections. Then there are intertwiners $c _ { i } : V _ { j i } \to V$ such that $\textstyle K = \sum _ { i } c _ { i } \circ p _ { j i }$ . Each $c _ { i }$ is continuous since it is a linear function between finite-dimensional normed vector spaces. Since also summation on normed vector spaces is continuous, we only need to show that the projections $p _ { j i }$ are continuous. + +This follows from the following fact on how the norm on $\bigoplus _ { l i } V _ { l i }$ is composed from the norms on each $V _ { l i }$ : For an element $\begin{array} { r } { f = \bar { \sum _ { l i } } f _ { l i } \in \bigoplus _ { l i } V _ { l i } } \end{array}$ with $f _ { l i } \in V _ { l i }$ , we have: + +$$ +\begin{array} { r } { \| f \| ^ { 2 } = \sum _ { l i } \| f _ { l i } \| ^ { 2 } . } \end{array} +$$ + +The reason for this is that the $V _ { l i }$ are perpendicular to each other. Consequently, if $( f ^ { k } ) _ { k }$ with $f ^ { k } \in \oplus _ { l i } V _ { l i }$ converges to 0, then also ${ \bar { ( } } p _ { j i } ( f ^ { k } ) { \big ) } _ { k } ~ = ~ ( f _ { j i } ^ { k } ) _ { k }$ converges to 0, which shows the continuity of $p _ { j i }$ in 0 and thus general continuity by Proposition F.18. □ + +Remark D.22. Note the curious fact that we cannot get rid of the equivariance condition in the preceding Lemma. I.e., if we have a linear function $\textstyle { \mathcal { K } } : \bigoplus _ { l } V _ { l } \to V$ , then we cannot deduce that $\kappa$ is continuous. We omit the index $i$ for simplicity. If equivariance is no requirement, then we only deal with vector spaces, which are in general isomorphic to spaces of (maybe infinite) tuples of elements in $\mathbb { K }$ . Thus, let the function $\mathcal { K } : \bar { \bigoplus } _ { l \in \mathbb { N } } \mathbb { K } \mathbb { K }$ given by + +$$ +\begin{array} { r } { ( a _ { l } ) _ { l } \mapsto \sum _ { l } l \cdot a _ { l } . } \end{array} +$$ + +This is linear but not continuous in 0. The latter can be seen by considering the sequence $( a ^ { k } ) _ { k }$ with $a ^ { k } = ( 0 , \ldots , 0 , \frac { 1 } { k } , 0 , \ldots )$ that has value $\textstyle { \frac { 1 } { k } }$ on position $k$ and otherwise only zeros. This sequence converges to the 0-sequence in norm. However, we have ${ \mathcal { K } } ( a ^ { k } ) = 1$ for all $k$ , thus the images do not converge to $0 = \kappa ( 0 )$ .  + +From the preceding lemma, we are able to obtain the following alternative description of representation operators: + +Proposition D.23 (Hom-tensor Adjunction). The map + +$$ +\quad \widetilde { \mathrm { ( \cdot ) } } : \mathrm { H o m } _ { G , \mathbb { K } } \left( \bigoplus _ { j i } V _ { j i } , \mathrm { H o m } _ { \mathbb { K } } ( V _ { l } , V _ { J } ) \right) \to \mathrm { H o m } _ { G , \mathbb { K } } \left( \left( \bigoplus _ { j i } V _ { j i } \right) \otimes V _ { l } , V _ { J } \right) +$$ + +given by + +$$ +\tilde { \mathcal { K } } ( v _ { j } \otimes v _ { l } ) : = \left[ \mathcal { K } ( v _ { j } ) \right] ( v _ { l } ) +$$ + +is an isomorphism. + +Proof. For continuity, note the following: by straightforward extensions of Lemma D.21, all linear and equivariant maps $\oplus _ { j i } V _ { j i } \to { \mathrm { H o m } } _ { \mathbb { K } } ( V _ { l } , V _ { J } )$ and $( \bigoplus _ { j i } V _ { j i } ) \otimes V _ { l } V _ { J }$ are necessarily continuous, and thus we can ignore continuity altogether. The rest of the proof can be done as in Agrawala (1980). For illustrating the most important part, we show that $\tilde { \mathcal { K } }$ is actually equivariant: + +$$ +\begin{array} { r l } & { \tilde { K } \big ( [ ( \rho _ { j } \otimes \rho _ { l } ) ( g ) ] ( v _ { j } \otimes v _ { l } ) \big ) = \tilde { K } \big ( [ \rho _ { j } ( g ) ] ( v _ { j } ) \otimes [ \rho _ { l } ( g ) ] ( v _ { l } ) \big ) } \\ & { \qquad = [ K ( \rho _ { j } ( g ) ( v _ { j } ) ) ] \big ( \rho _ { l } ( g ) ( v _ { l } ) \big ) } \\ & { \qquad = \big [ \rho _ { \mathrm { H o m } } ( g ) ( K ( v _ { j } ) ) \big ] ( \rho _ { l } ( g ) ( v _ { l } ) ) } \\ & { \qquad = \big ( \rho _ { J } ( g ) \circ \mathcal { K } ( v _ { j } ) \circ \rho _ { l } ( g ) ^ { - 1 } \big ) \big ( \rho _ { l } ( g ) ( v _ { l } ) \big ) } \\ & { \qquad = \rho _ { J } ( g ) ( \mathcal { K } ( v _ { j } ) ( v _ { l } ) ) } \\ & { \qquad = \rho _ { J } ( g ) ( \tilde { K } ( v _ { j } \otimes v _ { l } ) ) . } \end{array} +$$ + +Remark D.24. Some readers may wonder why this is called an adjunction. With removing some of the notation in the Proposition, one has + +$$ +\mathrm { H o m } _ { G , \mathbb { K } } ( T , \mathrm { H o m } _ { \mathbb { K } } ( U , V ) ) \cong \mathrm { H o m } _ { G , \mathbb { K } } ( T \otimes U , V ) . +$$ + +Now, for notational clarity, set $F : = \operatorname { H o m } _ { \mathbb { K } } ( U , \cdot )$ and $\begin{array} { r } { H : = ( \cdot ) \otimes U } \end{array}$ and remove the subscripts. Then the formula can be written as + +$$ +\mathrm { H o m } ( T , F ( V ) ) \cong \mathrm { H o m } ( H ( T ) , V ) . +$$ + +With replacing the notation if the Hom-spaces with a scalar product, and the isomorphism sign with equality, this reads as follows: + +$$ +\langle T | F ( V ) \rangle = \langle H ( T ) | V \rangle . +$$ + +Similar to adjoints in Hilbert spaces, we can then view $F$ and $H$ as adjoint to each other. In categorical terms, they are a pair of adjoint functors, see Lane et al. (1998). + +# D.2.3 PROOF OF THEOREM D.13 + +After the work done in the prior sections, we are ready to complete the proof of Theorem D.13! + +Proof of Theorem D.13. Only the first part of that theorem still needs to be proven. We have the following string of isomorphisms, which we will explain below: + +$$ +\begin{array} { r l } { \mathrm { H o m } _ { \mathcal { Q } , \mathbb { R } } ( \mathcal { L } _ { \mathbb { R } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathbb { R } } ( V _ { i } , V _ { j } ) ) \cong \mathrm { H o m } _ { \mathcal { Q } , \mathbb { R } } \left( \bigoplus _ { j _ { i } } V _ { j _ { i } } , \mathrm { H o m } _ { \mathbb { R } } ( V _ { i } , V _ { j } ) \right) } \\ & { \cong \mathrm { H o m } _ { \mathcal { Q } , \mathbb { R } } \left( \left( \bigoplus _ { j _ { i } } V _ { j _ { i } } \right) \otimes V _ { i } , V _ { j } \right) } \\ & { \cong \mathrm { H o m } _ { \mathbb { Q } , \mathbb { R } } \left( \bigoplus _ { j _ { i } } ( V _ { j _ { i } } \otimes V _ { i } ) , V _ { j } \right) } \\ & { \cong \underset { \hat { \mathcal { P } } } { \bigoplus } \mathrm { H o m } _ { \mathcal { Q } , \mathbb { R } } ( V _ { j _ { i } } \otimes V _ { i } , V _ { j } ) } \\ & { \cong \underset { \hat { \mathcal { P } } } { \bigoplus } \underset { \hat { \mathcal { P } } } { \bigoplus } \mathrm { H o m } _ { \mathcal { Q } , \mathbb { R } } ( V _ { j _ { i } } , V _ { j } ) } \\ & { \cong \underset { \hat { \mathcal { P } } } { \bigoplus } \underset { \hat { \mathcal { P } } } { \bigoplus } \mathrm { H o m } _ { \mathcal { Q } , \mathbb { R } } ( V _ { j _ { i } } , V _ { j } ) } \\ & { = \underset { \hat { \mathcal { P } } } { \bigoplus } \underset { \hat { \mathcal { P } } = 1 } { \bigoplus } \underset { \hat { \mathcal { P } } = 1 } { \bigoplus } \mathrm { E m } _ { \mathbb { Q } , \mathbb { R } } ( V _ { j } ) . } \end{array} +$$ + +The steps are justified as follows: + +1. For the first step, use Lemma D.20. + +2. For the second step, use Proposition D.23. + +3. For the third step, use that there is a natural isomorphism $\left( \bigoplus _ { j i } V _ { j i } \right) \otimes V _ { l } \cong \bigoplus _ { j i } ( V _ { j i } \otimes V _ { l } ) .$ + +4. For the fourth step, use that linear equivariant maps can be described on each direct summand individually (and that we do not need to worry about continuity due to Lemma D.21). + +5. For the fifth step, precompose with the linear equivariant isometric embeddings $l _ { j i s } : V _ { J } $ $V _ { j i } \otimes V _ { l }$ and use, again, that linear equivariant maps can be described on each direct summand individually. Furthermore, use Schur’s Lemma B.29 in order to see that the other summands disappear. + +6. The last step is just a reformulation. + +Now, we call the string of isomorphisms from right to left + +$$ +\mathrm { R e p } : \bigoplus _ { j \in \hat { G } } ^ { m _ { j } } \bigoplus _ { i = 1 } ^ { [ J ( j l ) ] } \mathrm { E n d } _ { G , \mathrm { K } } ( V _ { J } ) \mathrm { H o m } _ { G , \mathrm { K } } ( L _ { \mathrm { K } } ^ { 2 } ( X ) , \mathrm { H o m } _ { \mathrm { K } } ( V _ { l } , V _ { J } ) ) +$$ + +and are only left with understanding that it is actually given by Eq. (17). For this, we take a tuple $( c _ { j i s } ) _ { j i s }$ of endomorphisms and explicitly trace back “where it comes from”. As in Lemma D.21, let $p _ { j i } : \oplus _ { j ^ { \prime } i ^ { \prime } } V _ { j ^ { \prime } i ^ { \prime } } \to V _ { j i }$ be the canonical projection, which is by Proposition F.46 explicitly given by $\begin{array} { r } { p _ { j i } ( \varphi ) = \sum _ { m = 1 } ^ { d _ { j } } \left. Y _ { j i } ^ { m } \middle | \varphi \right. Y _ { j i } ^ { m } } \end{array}$ . Furthermore, let $p _ { j i s } : V _ { j i } \otimes V _ { l } V _ { J }$ be the projections corresponding to the embeddings $l _ { j i s }$ . Then from bottom to top, $( c _ { j i s } ) _ { j i s }$ gets transformed as follows: + +$$ +\begin{array} { r l } \displaystyle ( c _ { j i s } ) _ { j i s } \mapsto \left( \begin{array} { l } { \left[ { \boldsymbol J } ( j l ) \right] } \\ { \displaystyle \sum _ { s = 1 } ^ { \boldsymbol J } c _ { j i s } \circ p _ { j i s } \right) _ { j i } } \\ { \mapsto \displaystyle \sum _ { j \in \widehat { \boldsymbol G } } \sum _ { i = 1 } ^ { m _ { j } } \sum _ { s = 1 } ^ { [ { \boldsymbol J } ( j l ) ] } c _ { j i s } \circ p _ { j i s } \circ ( p _ { j i } \otimes \mathrm { i d } _ { V _ { i } } ) } \\ { \mapsto \mathrm { R e p } ( ( c _ { j i s } ) _ { j i s } ) } \end{array} \end{array} +$$ + +In the last step, the hom-tensor adjunction Proposition D.23 is used, but in the other direction. As an illustration, the composition of functions over which we sum can be shown in the following commutative diagram: + +$$ +\displaystyle \bigoplus _ { i ^ { \prime } j ^ { \prime } } V _ { j ^ { \prime } i ^ { \prime } } \otimes V _ { l } \xrightarrow [ ] { p _ { j i } \otimes \mathrm { i d } _ { V _ { l } } } V _ { j i } \otimes V _ { l } \xrightarrow [ ] { p _ { j i s } } V _ { J } \xrightarrow [ ] { c _ { j i s } } V _ { J } +$$ + +$$ +c _ { j i s } \circ p _ { j i s } \circ ( p _ { j i } \otimes \mathrm { i d } _ { V _ { l } } ) +$$ + +We obtain: + +$$ +\begin{array} { r l } { \displaystyle \big [ \mathbb { R e p } \big ( ( c _ { j i s } ) _ { j i s } \big ) ( \varphi ) \big ] ( v _ { l } ) = \sum _ { j \in \widetilde { \mathcal { O } } } \displaystyle \sum _ { s = 1 } ^ { m _ { \beta } } \sum _ { s = 1 } ^ { \lfloor ( J / \beta ) \rfloor } \Big [ c _ { j i s } \circ p _ { j i s } \circ ( p _ { j i s } \tilde { \varphi } ) \mathrm { d } \psi _ { l } \big ) \Big ] ( \varphi \otimes v _ { l } ) } & { } \\ & { = \displaystyle \sum _ { j \in \widetilde { \mathcal { O } } } \sum _ { i ^ { \prime } = 1 } ^ { m _ { \beta } } \sum _ { s = 1 } ^ { \lfloor ( J / \beta ) \rfloor } \Big ( c _ { j i s } \circ p _ { j j s } \circ ( p _ { j i s } ( \varphi ) \otimes v _ { l } ) \Big ) ( p _ { j i s } \circ v _ { l } ) } \\ & { = \displaystyle \sum _ { j \in \widetilde { \mathcal { O } } } \sum _ { i ^ { \prime } = 1 } ^ { m _ { \beta } } \sum _ { s = 1 } ^ { \lfloor ( J / \beta ) \rfloor } \Big ( c _ { j i s } \circ p _ { j j s } \circ \Big ( \displaystyle \sum _ { m = 1 } ^ { d _ { \beta } } \big \langle Y _ { j i } ^ { m } \big | \varphi \rangle Y _ { j i } ^ { m } \otimes v _ { l } \Big ) } \\ & { = \displaystyle \sum _ { j \in \widetilde { \mathcal { O } } } \sum _ { i ^ { \prime } = 1 } ^ { m _ { \beta } } \sum _ { s = 1 } ^ { \lfloor ( J / \beta ) \rfloor } \sum _ { j \in \widetilde { \mathcal { O } } } \Big \langle Y _ { j i s } ^ { m } \circ ( p _ { j i s } ( \varphi ) \cdot c _ { j i s } \circ ( p _ { j i s } ( \varphi ) \wedge Y _ { j i } ^ { m } \otimes v _ { l } ) \Big \rangle . } \end{array} +$$ + +That, finally, finishes the proof. + +# E EXAMPLE APPLICATIONS + +In this chapter, we develop some relevant examples of the theory outlined in prior chapters. All of these examples are applications of Theorem D.16 and Corollary D.17. These examples are concerned with the following question: Given a specific field $\mathbb { K } \in \{ \mathbb { R } , \mathbb { C } \}$ , compact transformation group $G$ and homogeneous space $X$ of $G$ , how can a basis of steerable kernels $K : X $ ${ \mathrm { H o m } } _ { \mathrm { K } } ( V _ { l } , V _ { J } )$ for given irreducible representations $\rho _ { l } : G \to \operatorname { U } ( V _ { l } )$ and $\rho _ { J } : G \to \operatorname { U } ( V _ { J } )$ be determined? The theorems give an outline for what needs to be done in order to succeed in this task, and the steps are always as follows: + +1. For each $l \in \widehat { G }$ , a representative for the isomorphism class of irreducible representations $l$ needs to be determined. That is, one needs to determine $\rho _ { l } : G \to \operatorname { U } ( V _ { l } )$ and an orthonormal basis $\{ Y _ { l } ^ { n } \mid n \in \{ 1 , \ldots , d _ { l } \} \}$ . We omit the index $n$ if there is only one basis element. Usually, we have $V _ { l } = \mathbb { K } ^ { d _ { l } }$ and the orthonormal basis is just the standard basis. +2. The Peter-Weyl Theorem B.22 gives the existence-statement for a decomposition of $L _ { \mathbb { K } } ^ { 2 } ( X )$ into irreducible subrepresentations. We need an explicit such decomposition, i.e.: we need to find multiplicities $m _ { j }$ , irreducible subrepresentations $V _ { j i } \cong V _ { j }$ for $i \in \{ 1 , \ldots , m _ { j } \}$ and basis functions $Y _ { j i } ^ { m } \in V _ { j i } \subseteq L _ { \mathbb { K } } ^ { 2 } ( X )$ corresponding to the $Y _ { j } ^ { m }$ such that $L _ { \mathbb { K } } ^ { 2 } ( X ) =$ ${ \widehat { \bigoplus } } _ { j \in { \widehat { G } } } \oplus _ { i = 1 } ^ { m _ { j } } V _ { j i } .$ +3. For each combination of $j , l$ and $J$ in $\widehat { G }$ , one needs to find the number of times $[ J ( j l ) ]$ that $V _ { J }$ appears in a direct sum decomposition of $V _ { j } \otimes V _ { l }$ . Then, for each $s \in \{ 1 , \ldots , [ J ( \dot { j } l ) ] \}$ , and for all basis-indices $M , m$ and $n$ , one needs to determine the Clebsch-Gordan coefficients $\langle s , J M | j m ; l n \rangle$ . We omit the index $s$ if $V _ { J }$ appears only once in the direct sum decomposition of $V _ { j } \otimes V _ { l }$ . +4. For each $J$ one needs to determine a basis $\{ c _ { r } \mid r = 1 , \ldots , E _ { J } \}$ of the space of endomorphisms of $V _ { J }$ , namely $\operatorname { E n d } _ { G , \mathbb { K } } ( V _ { J } )$ . + +Once all of this is done, one can then simply write down the basis kernels according to Eq. (22) or, in case that the space of endomorphisms is 1-dimensional, Eq. (23). The ingredients determined above are purely representation-theoretic information about the situation at hand, which hopefully makes the reader appreciate the results even more: we do not simply determine basis kernels; we understand in detail, along the way, the representation theory of the group and homogeneous space. + +Note that we are not concerned with practical considerations related to how fine-grained to do this in practice (for example, if the space on which the kernels operate splits into infinitely many orbits). For such questions, we refer back to Remark D.19. + +In the following sections, we discuss harmonic networks (SO(2)-equivariant CNNs with complex representations), SO(2)-equivariant CNNs with real representations, reflection-equivariant networks, SO(3)-equivariant CNNs with both complex and real representations, and O(3)-equivariant CNNs with both complex and real representations. For each of these examples, we go through the four steps outlined above. We recommend looking at the first example in detail: we conduct it in the greatest detail and it is the easiest to understand and thus serves as a nice introduction. + +# E.1 SO(2)-STEERABLE KERNELS FOR COMPLEX REPRESENTATIONS – HARMONIC NETWORKS + +Here, we explain how the kernel constraint for harmonic networks (Worrall et al., 2016) can be solved using our theory. In the case of harmonic networks, we have $\mathbb { K } = \mathbb { C }$ , $G = \mathrm { S O ( 2 ) }$ , $\dot { X } = S ^ { 1 }$ . As in most examples that follow, we ignore the solution of the kernel constraint in the origin, since it is usually easy to solve. For simplifying the formulas, we employ the isomorphism + +$$ +\mathrm { S O ( 2 ) } \stackrel { \sim } { \longrightarrow } \mathrm { U ( 1 ) } , \qquad \left( { a } \quad - { b } \right) \mapsto a + i b +$$ + +and always write $\mathrm { U } ( 1 )$ instead of SO(2). Here, $\mathrm { U } ( 1 )$ is the group of rotations of $\mathbb { C }$ , i.e., the group of elements in $\mathbb { C }$ with absolute value 1. It is also called the circle group since the group elements lie on a circle in the complex plane. Note that the change from SO(2) to the isomorphic group U(1) is done purely for convenience reasons, and SO(2) could be used just as well. + +We now go through the four steps outlined above. Our statements about the representation theory of the circle group can be found in Kowalski (2014), chapter 5. + +E.1.1 CONSTRUCTION OF THE IRREDUCIBLE REPRESENTATIONS OF U(1) + +We have ${ \widehat { \mathrm { U } ( 1 ) } } = \mathbb { Z }$ , and for $l \in \mathbb { Z }$ we can construct a representative $\rho _ { l } : \mathrm { U } ( 1 ) \to \mathrm { U } ( V _ { l } )$ as follows: $V _ { l } = \mathbb { C }$ is just the canonical 1-dimensional C-vector space, and $\rho _ { l }$ is given by + +$$ +\left[ \rho _ { l } ( g ) \right] ( z ) : = g ^ { l } \cdot z , +$$ + +where $g$ is regarded as an element in C. One can easily check that this is an irreducible representation. The orthonormal basis element for each such representation is just given by $1 \in \mathbb { C } = V _ { l }$ . This already answers step 1 of the outline above. + +# E.1.2 THE PETER-WEYL THEOREM FOR $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 1 } )$ + +For step 2, we need to determine the Peter-Weyl decomposition of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 1 } )$ , where we regard $S ^ { 1 }$ as a subset of C. Let $Y _ { l 1 } : S ^ { 1 } \to \mathbb { C }$ be given by $Y _ { l 1 } ( z ) = z ^ { - l }$ . Let $\bar { V } _ { l 1 } \subseteq L _ { \mathbb { C } } ^ { 2 } ( S ^ { 1 } )$ just be given by its span: $V _ { l 1 } = \mathrm { s p a n } _ { \mathbb { C } } ( Y _ { l 1 } )$ . We want to see that this is a subrepresentation of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 1 } )$ . To see this, remember that the unitary representation on $L _ { \mathbb { C } } ^ { 2 } ( X )$ is given by $\lambda : \mathrm { U } ( 1 ) \mathrm { U } ( \bar { L } _ { \mathbb { C } } ^ { 2 } ( \dot { S } ^ { 1 } ) )$ with $\left[ \lambda ( g ) \varphi \right] ( z ) = \varphi ( g ^ { - 1 } z )$ . We have + +$$ +\left[ \lambda ( g ) Y _ { l 1 } \right] ( z ) = Y _ { l 1 } ( g ^ { - 1 } z ) = ( g ^ { - 1 } z ) ^ { - l } = g ^ { l } \cdot z ^ { - l } = \left( g ^ { l } \cdot Y _ { l 1 } \right) ( z ) +$$ + +and thus $\lambda ( g ) Y _ { l 1 } = g ^ { l } Y _ { l 1 } \in V _ { l 1 }$ , which is what we claimed. Since the $V _ { l 1 }$ are 1-dimensional, they are necessarily irreducible for dimension reasons. Now, an important result from Fourier analysis is that the $Y _ { l 1 }$ for $l \in \mathbb { Z }$ actually form an orthonormal basis of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 1 } )$ and that, consequently, the Peter-Weyl decomposition of $L _ { \mathbb { C } } ^ { \frac { \cdot } { 2 } } ( S ^ { 1 } )$ looks as follows: + +$$ +L _ { \mathbb { C } } ^ { 2 } ( S ^ { 1 } ) = \widehat { \bigoplus _ { l \in \mathbb { Z } } } V _ { l 1 } . +$$ + +From this we see that the multiplicities $m _ { l }$ are all given by 1. What is missing is the connection to the irreps $\rho _ { l } : \mathrm { U } ( 1 ) \to \mathrm { U } ( V _ { l } )$ , but we have already indicated this in the notation. Namely, the map $f _ { l } : V _ { l } V _ { l 1 }$ given by $z \mapsto z \cdot Y _ { l 1 }$ is clearly an isomorphism of vector spaces, and due to Eq. (24) even an isomorphism of representations: + +$$ +\begin{array} { r l } & { f _ { l } \big ( \rho _ { l } ( g ) ( z ) \big ) = f _ { l } \big ( g ^ { l } \cdot z \big ) } \\ & { \quad \quad = ( g ^ { l } \cdot z ) \cdot Y _ { l 1 } } \\ & { \quad \quad = z \cdot ( g ^ { l } \cdot Y _ { l 1 } ) } \\ & { \quad \quad = z \cdot ( \lambda ( g ) ( Y _ { l 1 } ) ) } \\ & { \quad \quad = \lambda ( g ) \big ( z \cdot Y _ { l 1 } \big ) } \\ & { \quad \quad = \lambda ( g ) \big ( f _ { l } ( z ) \big ) . } \end{array} +$$ + +Thus, $f _ { l } \circ \rho _ { l } ( g ) = \lambda ( g ) \circ f _ { l }$ for all $g \in \operatorname { U } ( 1 )$ and, as claimed, $f _ { l }$ turns out to be an isomorphism. +This finishes step 2 of the outline above. + +# E.1.3 THE CLEBSCH-GORDAN DECOMPOSITION + +For step 3, we proceed as follows: The map + +$$ +f : V _ { j } \otimes V _ { l } \to V _ { j + l } , z _ { j } \otimes z _ { l } \mapsto z _ { j } \cdot z _ { l } +$$ + +is clearly well-defined and linear by the universal property of tensor products, see Definition D.1. Furthermore, it is an isometry: namely, since the scalar product in $\mathbb { C }$ is just the usual multiplication (with the left entry being complex conjugated), we obtain + +$$ +\begin{array} { r l } & { \left. f ( z _ { j } \otimes z _ { l } ) \big | f ( z _ { j } ^ { \prime } \otimes z _ { l } ^ { \prime } ) \right. = \left. z _ { j } z _ { l } \big | z _ { j } ^ { \prime } z _ { l } ^ { \prime } \right. } \\ & { \qquad = \overline { { z _ { j } z _ { l } } } \cdot z _ { j } ^ { \prime } z _ { l } ^ { \prime } } \\ & { \qquad = \overline { { z _ { j } } } z _ { j } ^ { \prime } \cdot \overline { { z _ { l } } } z _ { l } ^ { \prime } } \\ & { \qquad = \left. z _ { j } \big | z _ { j } ^ { \prime } \right. \cdot \left. z _ { l } | z _ { l } ^ { \prime } \right. } \\ & { \qquad = \left. z _ { j } \otimes z _ { l } \big | z _ { j } ^ { \prime } \otimes z _ { l } ^ { \prime } \right. . } \end{array} +$$ + +In the last step, we have used the definition of the scalar product on the tensor product, Definition D.2. Thus, $f$ is an isomorphism of Hilbert spaces. Finally, it also respects the representations since + +$$ +\begin{array} { r l } & { f \big ( \left[ \left( \rho _ { j } \otimes \rho _ { l } \right) ( g ) \right] ( z _ { j } \otimes z _ { l } ) \big ) = f \big ( \left[ \rho _ { j } ( g ) \right] ( z _ { j } ) \otimes \left[ \rho _ { l } ( g ) \right] ( z _ { l } ) \big ) } \\ & { \qquad = f \big ( g ^ { j } z _ { j } \otimes g ^ { l } z _ { l } \big ) } \\ & { \qquad = g ^ { j } z _ { j } \cdot g ^ { l } z _ { l } } \\ & { \qquad = g ^ { j + l } \cdot \left( z _ { j } z _ { l } \right) } \\ & { \qquad = \left[ \rho _ { j + l } ( g ) \right] ( f ( z _ { j } \otimes z _ { l } ) ) } \end{array} +$$ + +and thus $f \circ ( \rho _ { j } \otimes \rho _ { l } ) ( g ) = \rho _ { j + l } ( g ) \circ f$ for all $g \in \operatorname { U } ( 1 )$ . Finally, the basis vectors correspond in the simplest possible way since $f ( 1 \otimes 1 ) = 1$ . + +Overall, what we’ve shown is the following: $V _ { J }$ is a direct summand of $V _ { j } \otimes V _ { l }$ if and only if $J = j + l$ . If this is the case, we have $[ J ( j l ) ] = 1$ and can thus omit the index $s$ . The only ClebschGordan coefficient is then given by $\langle J 1 | j 1 l 1 \rangle = 1$ since the basis elements directly correspond. + +# E.1.4 ENDOMORPHISMS OF $V _ { J }$ + +This is the simplest part: Since we are considering representations over C, Schur’s Lemma D.8 tells us that $\operatorname { E n d } _ { \operatorname { U } ( 1 ) , \operatorname { C } } ( V _ { J } )$ is 1-dimensional for each irrep $J$ , and thus we can ignore the endomorphisms altogether. + +# E.1.5 BRINGING EVERYTHING TOGETHER + +We now show that a basis of steerable kernels $K : S ^ { 1 } \to \operatorname { H o m } _ { \mathbb { C } } ( V _ { l } , V _ { J } )$ of the group $\mathrm { U } ( 1 )$ is given, when expressed as $1 \times 1$ -matrix parameterized by $S ^ { 1 }$ , by the basis function $Y _ { l - J } : S ^ { 1 } \to \mathbb { C }$ . We + +remove the index “1” at the basis function to remove clutter. How can we see this result, using Eq. (23)? + +Note that $V _ { J }$ can only appear as a direct summand of $V _ { j } \otimes V _ { l }$ if $j = J - l$ by what we’ve shown above. The “matrix” of Clebsch-Gordan coefficients $\mathrm { C G } _ { J ( ( J - l ) l ) }$ is then just the number 1. We can omit the vacuous indices $i$ and $s$ and obtain that the only basis kernel is given by + +$$ +\begin{array} { r } { K _ { J - l } ( x ) = \langle Y _ { J - l } | x \rangle = \overline { { Y _ { J - l } ( x ) } } } \\ { = \overline { { x ^ { - ( J - l ) } } } } \\ { = x ^ { - ( l - J ) } } \\ { = Y _ { l - J } ( x ) . } \end{array} +$$ + +This result is precisely equal to the one obtained in the original paper (Worrall et al., 2016). This concludes our investigations of harmonic networks. + +# E.2 SO(2)-STEERABLE KERNELS FOR REAL REPRESENTATIONS + +In this section, we look at the case $\mathbb { K } = \mathbb { R }$ , $G = \mathrm { S O ( 2 ) }$ and $X = S ^ { 1 }$ . In the following sections, we again step by step determine the representation-theoretic ingredients that we need for the application of our theorem. Compared to Chapter A, which focuses more on the components themselves and how they relate to the general situation, this section has a stronger focus on actually determining the final kernels, which also involves the task of determining the Clebsch-Gordan coefficients explicitly. We remark that the resulting kernels are not new, since Weiler & Cesa (2019) have solved for this kernel basis already. However, we want to emphasize again that with our method, we learn more about the representation theory of SO(2) and thus get an overall better conceptual understanding of how the kernels arise. + +Since it will help the presentation of our results, we set $\mathrm { S O ( 2 ) } = \mathbb { R } / 2 \pi \mathbb { Z } .$ , i.e., we view ${ \mathrm { S O } } ( 2 )$ as a group of angles. We also set $S ^ { 1 } = \mathbb { R } / 2 \pi \mathbb { Z }$ , i.e., we take the interval $[ 0 , 2 \pi ]$ as the space where our functions are defined. Consequently, since we want our Haar measure to be normalized, we have to put the fraction $\scriptstyle { \frac { 1 } { 2 \pi } }$ before all of our integrals, different from what we did in our treatment of SO(2) over $\mathbb { C }$ . + +Note that since we now consider representations over the real numbers, unitary representations become orthogonal and we write $\mathrm { O } ( \bar { V } )$ instead of $\mathrm { U } ( V )$ . + +# E.2.1 CONSTRUCTION OF THE IRREDUCIBLE REPRESENTATIONS OF SO(2) + +The irreps of SO(2) over $\mathbb { R }$ are given by $\rho _ { l } : \mathrm { S O } ( 2 ) \to \mathrm { O } ( V _ { l } )$ , $l \in \mathbb { N } _ { \geq 0 }$ . For $l = 0$ , we have $V _ { 0 } = \mathbb { R }$ and the action is trivial. For $l \geq 1$ , $V _ { l } = \mathbb { R } ^ { 2 }$ as a vector space. The action is given by + +$$ +\left[ \rho _ { l } ( \phi ) \right] ( v ) = \left( \begin{array} { c c } { \cos ( l \phi ) } & { - \sin ( l \phi ) } \\ { \sin ( l \phi ) } & { \phantom { + } \cos ( l \phi ) } \end{array} \right) \cdot v +$$ + +for $\phi \in \mathrm { S O } ( 2 ) = \mathbb { R } / 2 \pi \mathbb { Z }$ . The orthonormal basis is in both cases just given by standard basis vectors. + +# E.2.2 THE PETER-WEYL THEOREM FOR $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ + +Now we look at square-integrable functions $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ that we now assume to take real values. As before, SO(2) acts on this space by $( \lambda ( \phi ) f ) ( x ) = f ( x - \phi )$ .26 For notational simplicity, we write $\mathrm { c o s } _ { l }$ for the function that maps $x$ to $\cos ( l x )$ , and analogously for $\mathrm { s i n } _ { l }$ . One then can show the following, which is a standard result in Fourier analysis: + +Proposition E.1. The functions $\mathrm { c o s } _ { l }$ , $\mathrm { s i n } _ { l }$ , $l \geq 1$ span an irreducible invariant subspace of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ of dimension 2, explicitly given by + +$$ +\mathrm { s p a n } _ { \mathbb { R } } ( \cos _ { l } , \sin _ { l } ) = \big \{ \alpha \cos _ { l } + \beta \sin _ { l } \mid \alpha , \beta \in \mathbb { R } \big \} +$$ + +which is isomorphic as an orthogonal representation to $V _ { l }$ by ${ \sqrt { 2 } } \cos _ { l } \mapsto { \binom { 1 } { 0 } }$ and $\sqrt { 2 } \sin _ { l } \mapsto$ $\binom { 0 } { 1 }$ .27 Furthermore, $\mathrm { { s i n } _ { 0 } = 0 }$ and $\cos _ { 0 } = 1$ are constant functions and their span is 1-dimensional and equivariantly isomorphic to $V _ { 0 }$ by $\cos _ { 0 } \mapsto 1$ . + +Finally, the functions ${ \sqrt { 2 } } \cdot \cos _ { l }$ , $\sqrt { 2 } \cdot \sin _ { l }$ form an orthonormal basis of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ , i.e., every function can be written uniquely as a (possibly infinite) linear combination of these basis functions. + +When setting $V _ { l 1 } = \mathrm { s p a n } _ { \mathbb { R } } ( \cos _ { l } , \sin _ { l } )$ , we thus obtain a decomposition + +$$ +L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } ) = { \widehat { \bigoplus _ { l \geq 0 } } } V _ { l 1 } . +$$ + +Thus, we have $m _ { l } = 1$ for all $l \in \mathbb N$ . All in all, we know everything there is to know about the Peter-Weyl theorem in our situation. + +# E.2.3 THE CLEBSCH-GORDAN DECOMPOSITION + +We now do the explicit decomposition of $V _ { j } \otimes V _ { l }$ into irreps, which will give us the Clebsch-Gordan coefficients that we need. Instead of doing the decomposition in terms of $V _ { j }$ and $V _ { l }$ themselves, in the proofs we actually use the isomorphic images $V _ { j 1 }$ and $V _ { l 1 }$ in $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ . For doing so, we first need some trigonometric formulas in our disposal: + +Lemma E.2. The sine and cosine functions fulfill the following rules: + +$l . \ \cos _ { j + l } = \cos _ { j } \cos _ { l } - \sin _ { j } \sin _ { l } .$ 2. $\begin{array} { r } { \sin _ { j + l } = \sin _ { j } \cos _ { l } + \cos _ { j } \sin _ { l } } \end{array}$ . 3. $\mathrm { c o s } _ { j - l } = \mathrm { c o s } _ { j } \mathrm { c o s } _ { l } + \mathrm { s i n } _ { j } \mathrm { s i n } _ { l } .$ . 4. $\begin{array} { r } { \sin _ { j - l } = \sin _ { j } \cos _ { l } - \cos _ { j } \sin _ { l } . } \end{array}$ . + +Proof. The first two are well-known and the last two follow directly from the first two using sin−j = $- \sin _ { j }$ and $\mathrm { c o s } _ { - j } = \mathrm { c o s } _ { j }$ . + +We will need the following general lemma: + +Lemma E.3. Let $f : V \to V ^ { \prime }$ be an intertwiner between representations $\rho : G \to { \mathrm { G L } } ( V )$ and $\rho ^ { \prime } : G \to { \mathrm { G L } } ( V ^ { \prime } )$ . Then ${ \mathrm { n u l l } } ( f ) = \{ v \in V | f ( v ) = 0 \}$ is an invariant linear subspace of $V .$ + +Proof. This can easily be checked by the reader. + +As a remark on notation for the following proposition: We write the Clebsch-Gordan coefficients $\mathrm { C G } _ { J ( j l ) s }$ of irreps $V _ { J }$ , $V _ { j }$ and $V _ { l }$ with dimensions $d _ { J } , d _ { j }$ and $d _ { l }$ as a $d _ { J } \times ( d _ { j } \times d _ { l } )$ -tensor. That is, it consists of $d _ { J }$ “rows”, each of which is a $d _ { j } \times d _ { l }$ -matrix. If $V _ { J }$ appears only once in the tensor product, we omit the index $s$ as before. + +Proposition E.4. We have the following decomposition results: + +1. For $j = l = 0$ we have $V _ { 0 } \otimes V _ { 0 } \cong V _ { 0 }$ and Clebsch-Gordan coefficients $\mathrm { C G } _ { 0 ( 0 0 ) } = \bigl ( [ 1 ] \bigr )$ . + +2. For $j = 0 , l > 0$ we have $V _ { 0 } \otimes V _ { l } \cong V _ { l }$ and Clebsch-Gordan coefficients $\mathrm { C G } _ { l ( 0 l ) } =$ $\left( \begin{array} { l l } { { [ 1 } } & { { 0 ] } } \\ { { [ 0 } } & { { 1 ] } } \end{array} \right)$ . + +3. For $j > 0$ , $l = 0$ , we get $V _ { j } \otimes V _ { 0 } \cong V _ { j }$ and Clebsch-Gordan coefficients $\mathrm { C G } _ { j ( j 0 ) } =$ + +$$ +\begin{array} { r } { ( [ \begin{array} { l } { 1 } \\ { 0 } \\ { [ 0 ^ { \vphantom { \frac { 1 } { 2 } } } ] } \end{array} ) . } \end{array} +$$ + +4. For $j > l > 0$ we get $V _ { j } \otimes V _ { l } \cong V _ { j - l } \oplus V _ { j + l }$ . The Clebsch-Gordan coefficients are given + +$$ +b y \mathrm { C G } _ { j - l , ( j l ) } = ( \begin{array} { r r } { { [ 1 } } & { { 0 ] } } \\ { { 0 } } & { { 1 } } \\ { { [ 0 } } & { { - 1 ] } } \\ { { 1 } } & { { 0 ] } } \end{array} ) a n d \mathrm { C G } _ { j + l , ( j l ) } = ( \begin{array} { r r } { { [ 1 } } & { { 0 ] } } \\ { { 0 } } & { { - 1 } } \\ { { [ 0 } } & { { 1 } } \\ { { 1 } } & { { 0 ] } } \end{array} ) . +$$ + +5. For $l > j > 0$ we get $V _ { j } \otimes V _ { l } \cong V _ { l - j } \oplus V _ { j + l }$ . The Clebsch-Gordan coefficients are given + +$$ +b y \mathrm { C G } _ { ( l - j ) ( j l ) } = ( [ \begin{array} { l l } { 1 } & { 0 } \\ { 0 } & { 1 } \\ { 0 } & { 1 } \\ { - 1 } & { 0 } \end{array} ] ) a n d \mathrm { C G } _ { j + l , ( j l ) } = ( \begin{array} { l l } { [ 1 } & { 0 } \\ { 0 } & { - 1 } \\ { [ 0 } & { 1 ] } \\ { 1 } & { 0 } \end{array} ) . +$$ + +6. For Cleb $j ~ = ~ l ~ > ~ 0$ , we getefficients $V _ { l } \otimes V _ { l } \cong V _ { 0 } ^ { 2 } \oplus V _ { 2 l }$ n the, and $\mathrm { C G } _ { 0 ( l l ) 1 } = \left( \left[ \begin{array} { c c } { { 1 } } & { { 0 } } \\ { { 0 } } & { { 1 } } \end{array} \right] \right)$ $\mathrm { C G } _ { 0 ( l l ) 2 } = \left( \left[ \begin{array} { c c } { { 0 } } & { { \mp 1 } } \\ { { \pm 1 } } & { { 0 } } \end{array} \right] \right)$ $\begin{array} { r } { \mathrm { C G } _ { 2 l , ( l l ) } = \left( \begin{array} { c c } { \left[ 1 \right]} & { 0 } \\ { 0 } & { - 1 } \\ { \left[ 0 } & { 1 \right] } \\ { 1 } & { 0 } \end{array} \right) , } \end{array}$ the last one being the same as the Clebsch-Gordan coefficients $\mathrm { C G } _ { j + l , ( j l ) }$ from above. In $\mathrm { C G } _ { 0 ( l l ) 1 }$ and $\mathrm { C G } _ { 0 ( l l ) 2 }$ , a fourth index is present, namely 1 and 2, respectively. This is the index “ $s$ ” that was missing in all the prior examples, since this is the first time an irrep appears more than once in a tensor product decomposition. Note that for $\mathrm { C G } _ { 0 ( l l ) 2 }$ , we have exactly one positive and one negative entry present, but both are equally valid and mirror the lower halves in $\mathrm { C G } _ { j - l , ( j l ) }$ from part 4 and $\mathrm { C G } _ { l - j , ( j l ) }$ from part 5. + +Proof. In the proof, instead of working directly with the irreps $\rho _ { j } : \mathrm { S O } ( 2 ) \mathrm { O } ( V _ { j } )$ , we use the isomorphic copies $V _ { j 1 }$ in $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ given in Proposition E.1. Since we think that it does not help understanding to carry the index “1” in all computations, we omit this index. + +The proof of 1, 2, and 3 is clear. + +For 4 and 5, consider the (unnormalized) basis $\left\{ \cos _ { j } \otimes \cos _ { l } , \cos _ { j } \otimes \sin _ { l } , \sin _ { j } \otimes \cos _ { l } , \sin _ { j } \otimes \sin _ { l } \right\}$ of $V _ { j } \otimes V _ { l }$ . Our goal is to express these basis elements with respect to basis elements of invariant subspaces. We do this by explicitly constructing an isomorphism to a decomposition of irreps. To that end, let $p : V _ { j } \otimes V _ { l } \to ^ { \cdot } L _ { \mathbb { R } } ^ { 2 } ( \hat { S } ^ { 1 } )$ be given by $f \otimes g \mapsto f \cdot g$ , which is clearly a well-defined intertwiner. We get as image of $p$ the set + +$$ +\begin{array} { r l } & { \operatorname { i m } ( p ) = \operatorname { s p a n } _ { \mathbb { R } } \big ( p ( \cos _ { j } \otimes \cos _ { l } ) , ~ p ( \cos _ { j } \otimes \sin _ { l } ) , ~ p ( \sin _ { j } \otimes \cos _ { l } ) , ~ p ( \sin _ { j } \otimes \sin _ { l } ) \big ) } \\ & { \qquad = \operatorname { s p a n } _ { \mathbb { R } } \big ( \cos _ { j } \cdot \cos _ { l } , ~ \cos _ { j } \cdot \sin _ { l } , ~ \sin _ { j } \cdot \cos _ { l } , ~ \sin _ { j } \cdot \sin _ { l } \big ) . } \end{array} +$$ + +From Lemma E.2 we obtain: + +$$ +\begin{array} { r l } { ( a ) } & { p ( \cos _ { j } \otimes \cos _ { l } ) \ - \ p ( \sin _ { j } \otimes \sin _ { l } ) \ = \ \cos _ { j + l } , } \\ { ( b ) } & { p ( \cos _ { j } \otimes \sin _ { l } ) \ + \ p ( \sin _ { j } \otimes \cos _ { l } ) \ = \ \sin _ { j + l } , } \\ { ( c ) } & { p ( \cos _ { j } \otimes \cos _ { l } ) \ + \ p ( \sin _ { j } \otimes \sin _ { l } ) \ = \ \cos _ { j - l } , } \\ { ( d ) } & { p ( \sin _ { j } \otimes \cos _ { l } ) \ - \ p ( \cos _ { j } \otimes \sin _ { l } ) \ = \ \sin _ { j - l } . } \end{array} +$$ + +Since the right hand sides are linearly independent basis functions of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 1 } )$ , we obtain: + +$$ +\begin{array} { r } { \operatorname { i m } ( p ) = \operatorname { s p a n } _ { \mathbb { R } } \big ( \cos _ { j + l } , ~ \sin _ { j + l } , ~ \cos _ { j - l } , ~ \sin _ { j - l } \big ) = V _ { | j - l | } \oplus V _ { j + l } . } \end{array} +$$ + +Note for the last step that due to symmetry, $\cos _ { j - l } = \cos _ { l - j }$ and $\mathrm { s i n } _ { j - l } = - \sin _ { l - j }$ + +We now specialize to the case of 4, i.e., $j > l > 0$ . In this case, $V _ { | j - l | } = V _ { j - l }$ , and the basis is given by $\mathrm { c o s } _ { j - l }$ and $\mathrm { s i n } _ { j - l }$ , as in the right hand sides of Eq. (25) (c) and (d). Consequently, Eq. (25) is already the expansion of the new basis elements with the old, and the coefficients are consequently the Clebsch-Gordan coefficients.28 More precisely, if we want to compute, for example, CGj−l,(jl), + +then we observe from (c) that + +$$ +\begin{array} { r l r } { \cos _ { j - l } = } & { + 1 \cdot p ( \cos _ { j } \otimes \cos _ { l } ) } & { + 0 \cdot p ( \cos _ { j } \otimes \sin _ { l } ) } \\ & { + 0 \cdot p ( \sin _ { j } \otimes \cos _ { l } ) } & { + 1 \cdot p ( \sin _ { j } \otimes \sin _ { l } ) } \end{array} +$$ + +from which we can already read the upper half of $\mathrm { C G } _ { j - l , ( j l ) }$ as the coefficients in this equation (which we conveniently visually arranged in the right way). For the lower half, we do proceed the same for $\mathrm { s i n } _ { j - l }$ , using (d). Then, for $\mathrm { C G } _ { j + l , ( j l ) }$ , we proceed exactly the same, using parts (a) and (b). That proves 4. + +For 5, we have $l > j > 0$ . In this case, $V _ { | j - l | } = V _ { l - j }$ , i.e., the basis is given by $\cos _ { l - j } = \cos _ { j - l }$ and $\mathrm { s i n } _ { l - j } = - \mathrm { s i n } _ { j - l }$ . The latter means that in part (d) of Eq. (25), we need to replace $\mathrm { s i n } _ { j - l }$ by $\mathrm { s i n } _ { l - j }$ and thus change the signs on the left hand side. This change means that $\mathrm { C G } _ { j + l , ( j l ) }$ will remain the same as in 4, the upper half of $\mathrm { C G } _ { l - j , ( j l ) }$ will remain the same as the upper half of $\mathrm { C G } _ { j - l , ( j l ) }$ from part 4 since the cosine in part (c) of Eq. (25) is symmetric, and the lower part will flip the signs. This fully proves 5. + +Finally, we prove 6. We have $j = l$ and still consider the same function $p$ . Note that $p ( \cos _ { j } \otimes \cos _ { l } ) +$ $p ( \sin _ { j } \otimes \sin _ { l } ) = 1$ and $p ( \sin _ { j } \otimes \cos _ { l } ) - p ( \cos _ { j } \otimes \sin _ { l } ) = 0$ are constant functions that span the 1- dimensional trivial representation. Thus, we see that $p$ is a surjection + +$$ +p : V _ { l } \otimes V _ { l } \to V _ { 0 } \oplus V _ { 2 l } +$$ + +with null space spanned by $\begin{array} { r } { \sin _ { j } \otimes \cos _ { l } - \cos _ { j } \otimes \sin _ { l } } \end{array}$ . Such a null space is automatically an invariant subspace as well, and since it is one-dimensional, it also must be isomorphic to the trivial representation. Overall, this gives us an isomorphism + +$$ +V _ { l } \otimes V _ { l } \cong V _ { 0 } ^ { 2 } \oplus V _ { 2 l } . +$$ + +From this, we can as before read off the Clebsch-Gordan coefficients. The only thing that changes is that parts (c) and (d) of Eq. (25) now correspond to two different copies of $V _ { 0 }$ , which means that the Clebsch-Gordan coefficients $\mathrm { C G } _ { 0 ( l l ) }$ now split up in two parts $\mathrm { C G } _ { 0 ( l l ) 1 }$ and $\mathrm { C G } _ { 0 ( l l ) 2 }$ . Note that in the trivial representation, the isomorphism that sends the basis vector to its negative is clearly equivariant, which means that both combinations of signs that we give in the final formula for $\mathrm { C G } _ { 0 ( l l ) 2 }$ are valid. □ + +# E.2.4 ENDOMORPHISMS OF $V _ { J }$ + +We now describe the endomorphisms of the irreducible representations, our last ingredient: + +Proposition E.5. We have $\operatorname { E n d } _ { \mathrm { S O ( 2 ) } , \mathbb { R } } ( V _ { 0 } ) \cong \mathbb { R } ,$ , i.e., multiplications with all real numbers are valid endomorphisms of $V _ { 0 }$ . For $l \geq 1$ , we get + +$$ +\operatorname { E n d } _ { \operatorname { S O } ( 2 ) , \mathbb { R } } ( V _ { l } ) = \{ \binom { a } { b } \ \frac { - b } { a } ) \Big | a , b \in \mathbb { R } \} , +$$ + +which is the set of all scaled rotations of $\mathbb { R } ^ { 2 }$ . When identifying $ { \mathbb { R } } ^ { 2 } \cong \mathbb { C }$ , we can also view these transformations as arbitrary multiplications with a complex number. + +As a consequence, $\mathrm { i d _ { R } }$ is a basis for $\operatorname { E n d } _ { \mathrm { S O ( 2 ) } , \mathrm { R } } ( V _ { 0 } )$ and $\left\{ { \left( { \begin{array} { c c } { 1 } & { 0 } \\ { 0 } & { 1 } \end{array} } \right) } , { \left( { \begin{array} { c c } { 0 } & { - 1 } \\ { 1 } & { 0 } \end{array} } \right) } \right\}$ a basis for $\mathrm { E n d } _ { \mathrm { S O ( 2 ) } , \mathrm { R } } ( V _ { l } ) f o r l \ge 1 .$ . + +Proof Sketch. For $l \geq 1$ and an arbitrary matrix $E = { \binom { a b } { c d } }$ that commutes with all rotation matrices $\rho _ { l } ( \phi )$ , i.e., $E \circ \rho _ { l } ( \phi ) = \rho _ { l } ( \phi ) \circ E$ , one can easily show the constraints $a = d$ and $b = - c ,$ from which the result follows. □ + +# E.2.5 BRINGING EVERYTHING TOGETHER + +Now we have done all needed preparation and can solve the kernel constraint explicitly, using the matrix-form of the Wigner-Eckart theorem for steerable kernels, Theorem D.16. This is, as mentioned before, a new derivation of the results in Weiler & Cesa (2019). One can compare with table 8 in their appendix which only differs by (irrelevant) constants. + +Proposition E.6. We consider steerable kernels $K : S ^ { 1 } \mathrm { H o m } _ { \mathbb { R } } ( V _ { l } , V _ { J } )$ , where $V _ { l }$ and $V _ { J }$ are irreducible representations of SO(2). Then the following holds: + +1. For $l = J = 0$ , we get $K ( x ) = a \cdot ( 1 )$ for every $x \in S ^ { 1 }$ and an arbitrary real number $a \in \mathbb { R }$ independent of $x$ . + +$l = 0$ , $J > 0$ , a basis for steerable kernels is given by $\binom { \cos _ { J } } { \sin _ { J } }$ and $\left( { - \sin _ { J } } \right) $ + +3. For $l > 0$ and $J = 0$ , a basis for steerable kernels is given by (cosl $\mathrm { s i n } _ { l }$ ), $\begin{array} { r l } { ( \sin _ { l } } & { { } - \cos _ { l } ) } \end{array}$ $ { l } , J \quad > \quad 0$ , and  $\begin{array} { r l } { \left( \begin{array} { c c } { \cos _ { J - l } } & { - \sin _ { J - l } } \\ { \sin _ { J - l } } & { \cos _ { J - l } } \end{array} \right) } \end{array}$ , $\left( { \begin{array} { c c } { - \sin _ { J - l } } & { - \cos _ { J - l } } \\ { \cos _ { J - l } } & { - \sin _ { J - l } } \end{array} } \right) , \left( { \begin{array} { c c } { \cos _ { J + l } } & { \sin _ { J + l } } \\ { \sin _ { J + l } } & { - \cos _ { J + l } } \end{array} } \right) $ , and  $\binom { - \sin _ { J + l } } { \cos _ { J + l } } \quad \cos _ { J + l } \rangle$ + +Proof. The proof of 1 is clear. + +For 2, note that $V _ { J }$ can only appear in $V _ { j } \otimes V _ { 0 }$ if $j = J$ . The relevant Clebsch-Gordan coefficients are by Proposition E.4 therefore $\mathrm { C G } _ { J ( J 0 ) } = \left( \begin{array} { l } { { \left[ 1 \right] } } \\ { { 0 } } \\ { { \left[ 0 \right] } } \\ { { 1 } } \end{array} \right) .$ Furthermore, the orthonormal basis of $V _ { j 1 } = V _ { J 1 }$ is given by Proposition E.1 up to constants by $\langle \cos _ { J } , \sin _ { J } \rangle$ , which we have to write as a row-vector according to Theorem D.16. Thereby, we can ignore the complex conjugation since we work over the real numbers. Our final ingredient is the endomorphism basis of $V _ { J }$ , which is by Proposition E.5 given by $c _ { 1 } = \mathrm { i d } _ { \mathrm { R } ^ { 2 } }$ and $c _ { 2 } = { \binom { 0 } { 1 } } \quad { \binom { - 1 } { 0 } }$ . Overall, the basis kernels are given by + +$$ +c _ { i } \cdot { \sqrt { [ \cos _ { J } \quad \sin _ { J } ] \cdot { \sqrt { 1 } } } } ) = c _ { i } \cdot { \binom { \cos _ { J } } { \sin _ { J } } } . +$$ + +The result follows. + +For 3, we find $V _ { 0 }$ only in $V _ { j } \otimes V _ { l }$ if $j ~ = ~ l$ , and even twice so. The relevant Clebsch-Gordan coefficients are therefore by Proposition E.4 given by $\mathrm { C G } _ { 0 ( l l ) 1 } = \left( \left[ 1 \begin{array} { c c } { { 0 } } \\ { { 0 } } \end{array} \right] \right)$ and $\mathrm { C G } _ { 0 ( l l ) 2 } \ =$ $\left( { \begin{array} { r r } { \left[ 0 \right. } & { \left. - 1 \right] } \\ { 1 } & { 0 } \end{array} } \right)$ . The basis-functions in $V _ { j 1 } = V _ { l 1 }$ are by Proposition E.1 up to constants $\{ \cos _ { l } , \sin _ { l } \}$ again written as a row-vector. Finally, $V _ { J } = V _ { 0 }$ has only $\mathrm { i d _ { R } }$ as a basis-endomorphism by Proposition E.5, so this can be ignored altogether by Corollary D.17. We obtain the following basis for steerable kernels: + +$$ +\begin{array} { r l } & { \quad \left( \left[ \cos \iota \quad \sin \iota \right] \left[ \begin{array} { c c } { 1 } & { 0 } \\ { 0 } & { 1 } \end{array} \right] \right) = ( 1 \cos \iota \quad 1 \sin \iota ) } \\ & { \quad \left( \left[ \cos \iota \quad \sin \iota \right] \left[ \begin{array} { c c } { 0 } & { - 1 } \\ { 1 } & { 0 } \end{array} \right] \right) = ( 1 \sin \iota \quad - 1 \cos \iota ) . } \end{array} +$$ + +For 4, we consider only the case $l < J$ . By Proposition E.4 we have + +$$ +V _ { J - l } \otimes V _ { l } \cong V _ { \left| 2 l - J \right| } \oplus V _ { J } , V _ { l + J } \otimes V _ { l } \cong V _ { J } \oplus V _ { 2 l + J } , +$$ + +i.e., $j ~ = ~ J - l$ and $j = l + J$ leads to a tensor product decomposition containing $V _ { J }$ , but no other $j$ does. Thus, the relevant Clebsch-Gordan coefficients are by Proposition E.4 the matrices $\mathrm { C G } _ { J , ( J - l , l ) }$ and $\mathrm { C G } _ { J , ( l + J , l ) }$ . + +We now consider the first case, i.e., $j = J - l$ . The Clebsch-Gordan coefficients are $\mathrm { C G } _ { J , ( J - l , l ) } =$ $\mathrm { C G } _ { l + j , ( j l ) } = \left( \left[ 0 \begin{array} { r r } { { 1 } } & { { 0 } } \\ { { 0 } } & { { - 1 } } \\ { { 0 } } & { { 1 } } \\ { { 1 } } & { { 0 } } \end{array} \right] \right) .$ The basis functions of $V _ { ( J - l ) 1 }$ are by Proposition E.1 furthermore given by $\{ \cos _ { J - l } , \sin _ { J - l } \}$ . Finally, $V _ { J }$ has again the two basis endomorphisms $c _ { 1 } = \mathrm { i d } _ { \mathbb { R } ^ { 2 } }$ and $c _ { 2 }$ from above. Thus, we obtain the following basis kernel for $c _ { 1 }$ : + +$$ +c _ { 1 } \cdot { ( \begin{array} { l l l } { [ \cos _ { J - l } } & { \sin _ { J - l } ] \cdot } \\ { [ \cos _ { J - l } } & { \sin _ { J - l } ] \cdot } \\ { [ \cos _ { J - l } } & { \sin _ { J - l } ] \cdot } \\ { } & { \sin _ { J - l } ] \cdot } \end{array} ) } = { ( \begin{array} { l l l } { \cos _ { J - l } } & { - \sin _ { J - l } } \\ { \sin _ { J - l } } & { \cos _ { J - l } ) } \end{array} ) } . +$$ + +Consequently, for $c _ { 2 }$ as the basis endomorphism we need to postcompose with $c _ { 2 }$ and get: + +$$ +\binom { 0 } { 1 } - 1 \atop 0 \sp { . } \cdot \binom { \cos _ { J - l } } { \sin _ { J - l } } - \sin _ { J - l } \sp { . } \biggr ) = \left( \begin{array} { r c } { { - \sin _ { J - l } } } & { { - \cos _ { J - l } } } \\ { { \cos _ { J - l } } } & { { - \sin _ { J - l } } } \end{array} \right) . +$$ + +These are half of the basis kernels. For the other half, we need to look at the case $j = l + J$ . The Clebsch-Gordan coefficients are by part 4 of Proposition E.4 given by $\mathrm { C G } _ { J , ( l + J , l ) } = \mathrm { C G } _ { j - l , ( j l ) } =$ $\left( { \begin{array} { r r } { \left[ 1 \right. } & { \left. 0 \right] } \\ { 0 } & { 1 } \\ { \left[ 0 \right. } & { - 1 } \\ { 1 } & { \left. 0 \right] } \end{array} } \right) .$ The basis functions of $V _ { ( l + J ) 1 }$ are by Proposition E.1 furthermore given by $\{ \cos _ { J + l } , \sin _ { J + l } \}$ . For the basis endomorphism $c _ { 1 }$ we thus get the basis kernel + +$$ +\begin{array}{c} c _ { 1 } \cdot { ( \begin{array} { l l } { [ \cos _ { J + l } } & { \sin _ { J + l } ] \cdot } \\ { [ \cos _ { J + l } } & { \sin _ { J + l } ] \cdot } & { [ 0 } \end{array} } 1 \\ { [ \cos _ { J + l } } & { \sin _ { J + l } ] \cdot { [ \begin{array} { l l } { 0 } & { - 1 } \\ { 1 } & { 0 } \end{array} ] } ) } & { = ( \sin _ { J + l } \quad \cdot \sin _ { J + l } ) . } \end{array} ) +$$ + +Consequently, for $c _ { 2 }$ as the basis endomorphism we need to postcompose with $c _ { 2 }$ and get: + +$$ +\left( \begin{array} { c c } { { 0 } } & { { - 1 } } \\ { { 1 } } & { { 0 } } \end{array} \right) \cdot \left( \begin{array} { c c } { { \cos _ { J + l } } } & { { \sin _ { J + l } } } \\ { { \sin _ { J + l } } } & { { - \cos _ { J + l } } } \end{array} \right) = \left( \begin{array} { c c } { { - \sin _ { J + l } } } & { { \cos _ { J + l } } } \\ { { \cos _ { J + l } } } & { { \sin _ { J + l } } } \end{array} \right) . +$$ + +Overall, for the case $l \ < \ J$ we have determined all four basis kernels in Eqs. (26), (27), (28), and (29). The cases $l = J$ and $l > J$ can be considered analogously, and in every case the correct Clebsch-Gordan coefficients have to be picked. By using $\mathrm { c o s } _ { l - J } = \mathrm { c o s } _ { J - l }$ and $\mathrm { s i n } _ { l - J } = - \mathrm { s i n } _ { J - l }$ , this will, in the end, always lead to the same final formulas. This result is consistent with Table 8 in Weiler & Cesa (2019). □ + +# E.3 $\mathbb { Z } _ { 2 }$ -STEERABLE KERNELS FOR REAL REPRESENTATIONS + +In this section, we discuss steerable CNNs that use the finite group $\mathbb { Z } _ { 2 }$ , which we identify with $( \{ - 1 , + 1 \} , \cdot )$ , for their symmetries. We let this group act on the plane $\mathbb { R } ^ { 2 }$ by vertical reflections, though other choices are possible as well: + +$$ +x \cdot { \binom { a } { b } } = { \binom { x a } { b } } . +$$ + +This example is simple and one may see it as contrived to apply our relatively heavy theory to it. We include it mainly as a demonstration that our results can also be applied to non-smooth finite groups as instances of compact groups. Furthermore, we will fully recover the relationship to the original group convolutional CNNs from Cohen & Welling (2016a) and thereby demonstrate that all the different developed theories are consistent with each other. + +E.3.1 THE IRREDUCIBLE REPRESENTATIONS OF $\mathbb { Z } _ { 2 }$ OVER THE REAL NUMBERS + +Let $\rho : \mathbb { Z } _ { 2 } \to { \mathrm { G L } } ( V )$ be an irreducible real representation. Note that + +$$ +\rho ( - 1 ) \circ \rho ( - 1 ) = \rho ( ( - 1 ) \cdot ( - 1 ) ) = \rho ( 1 ) = \mathrm { i d } _ { V } , +$$ + +and thus $\rho ( - 1 )$ is an involution satisfying the equation $\rho ( - 1 ) ^ { 2 } - \mathrm { i d } _ { V } = 0$ . It is well-known from linear algebra that involutions are diagonalizable, and thus $\rho ( - 1 )$ leaves 1-dimensional subspaces invariant. By irreducibility of $\rho$ this means that $V$ itself needs to be 1-dimensional. Consequently, we can assume $V = \mathbb { R }$ without loss of generality. Note that the computations above mean that we have + +$$ +\left( \rho ( - 1 ) - \mathrm { i d _ { \mathbb { R } } } \right) \circ \left( \rho ( - 1 ) + \mathrm { i d _ { \mathbb { R } } } \right) = 0 +$$ + +and thus we need to have $\rho ( - 1 ) - \mathrm { i d _ { \mathrm { R } } } \ = \ 0$ or $\rho ( - 1 ) + \mathrm { i d _ { \mathrm { R } } } \ = \ 0$ . It follows $\rho ( - 1 ) \ = \ \mathrm { i d _ { \mathrm { R } } }$ or $\rho ( - 1 ) = - \operatorname { i d } _ { \mathbb { R } }$ . Overall, all these investigations mean that we have precisely two irreducible representations of $\mathbb { Z } _ { 2 }$ up to equivalence. We call them $\rho _ { + } : \mathbb { Z } _ { 2 } \to \operatorname { O } ( V _ { + } )$ and $\rho _ { - } : \mathbb { Z } _ { 2 } \to \operatorname { O } ( V _ { - } )$ , where $\rho _ { + } ( - 1 ) = \mathrm { i d } _ { \mathrm { R } }$ and $\rho _ { - } \dot { ( } - 1 ) = - \operatorname { i d } _ { \mathbb { R } }$ and $V _ { + } = V _ { - } = \mathbb { R }$ . + +# E.3.2 THE PETER-WEYL THEOREM FOR $L _ { \mathbb { R } } ^ { 2 } ( X )$ + +Here we do the Peter-Weyl decomposition for $L _ { \mathbb { R } } ^ { 2 } ( X )$ , where $X$ is one of the two homogeneous spaces $X = \{ - 1 , 1 \}$ and $X = \{ 0 \}$ with the obvious actions coming from the groups $\mathbb { Z } _ { 2 }$ . This time, we also discuss orbits with only one point since we later want to get a description of kernels on the whole of $\mathbb { R } ^ { 2 }$ for comparisons with group convolutional CNNs. + +We start with $X = \{ - 1 , 1 \}$ . Note that the measure on $X$ is just the normalized counting measure, and thus all functions $f : X \to \mathbb { R }$ are square-integrable. We define the two functions + +$$ +\begin{array} { r l } & { f _ { + } : X \mathbb { R } , f _ { + } ( x ) = 1 \mathrm { ~ f o r ~ a l l ~ } x \in X = \{ - 1 , 1 \} , } \\ & { f _ { - } : X \mathbb { R } , f _ { - } ( x ) = x \mathrm { ~ f o r ~ a l l ~ } x \in X = \{ - 1 , 1 \} } \end{array} +$$ + +We then define $V _ { + 1 } = \operatorname { s p a n } _ { \mathbb { R } } ( f _ { + } )$ and $V _ { - 1 } = \operatorname { s p a n } _ { \mathbb { R } } ( f _ { - } )$ . This gives a decomposition + +$$ +L _ { \mathbb { R } } ^ { 2 } ( X ) = V _ { + 1 } \oplus V _ { - 1 } +$$ + +since we have for all $f \in L _ { \mathbb { R } } ^ { 2 } ( X )$ + +$$ +f = \frac { f ( 1 ) + f ( - 1 ) } { 2 } \cdot f _ { + } + \frac { f ( 1 ) - f ( - 1 ) } { 2 } \cdot f _ { - } . +$$ + +Furthermore, the maps $1 \mapsto f _ { + }$ and $1 \mapsto f _ { - }$ give isomorphisms of representations $V _ { + } \cong V _ { + 1 }$ and $V _ { - } \cong V _ { - 1 }$ , respectively. + +Now, assume that $X = \{ 0 \}$ with the trivial action coming from $\mathbb { Z } _ { 2 }$ . Then $L _ { \mathbb { R } } ^ { 2 } ( X ) = V _ { + 1 }$ generated from the function $f _ { + } : X \to \mathbb { R }$ , $f _ { + } ( 0 ) = 1$ . As before, $1 \mapsto f _ { + }$ gives an isomorphism $V _ { + } \cong V _ { + 1 }$ . This concludes the investigations of the Peter-Weyl theorem. + +E.3.3 THE CLEBSCH-GORDAN DECOMPOSITION + +We have the following four isomorphisms of representations: + +$$ +\begin{array} { l l } { { V _ { + } \otimes V _ { + } \cong V _ { + } , } } & { { V _ { + } \otimes V _ { - } \cong V _ { - } , } } \\ { { V _ { - } \otimes V _ { + } \cong V _ { - } , } } & { { V _ { - } \otimes V _ { - } \cong V _ { + } , } } \end{array} +$$ + +each time simply given by $a \otimes b \mapsto a b$ . It can easily be checked that these are isomorphisms. In Section E.6.3 the reader can find a proof for similar, sign-dependent isomorphisms for the case that the group is O(3). For each such isomorphism, there is precisely one Clebsch-Gordan coefficient and it is just given by 1. Thus, as in the case of harmonic networks in Section E.1.5, we can just ignore the Clebsch-Gordan coefficients altogether in the final formulas for our basis kernels. + +# E.3.4 ENDOMORPHISMS OF $V _ { + }$ AND $V _ { - }$ + +Since $V _ { + }$ and $V _ { - }$ are themselves only 1-dimensional, the endomorphism spaces are necessarily 1- dimensional as well and just given by arbitrary $1 \times 1$ -matrices, i.e., arbitrary stretchings. As in the example of harmonic networks, we can therefore ignore the endomorphisms as well. + +# E.3.5 BRINGING EVERYTHING TOGETHER + +Different from the other examples, we will in this section not only engage with the final steerable kernels on homogeneous spaces but also discuss how these assemble to kernels defined on the whole plane $\mathbb { R } ^ { 2 }$ . In the end, we will then also discuss how kernels for the regular representation would look like. + +But first, we engage with the homogeneous spaces. We start with $X = \{ - 1 , 1 \}$ and consider steerable kernels $K \colon \bar { X } \operatorname { H o m } _ { \mathbb { R } } ( V _ { \mathrm { i n } } , \bar { V } _ { \mathrm { o u t } } )$ for irreducible $V _ { \mathrm { i n } }$ and $V _ { \mathrm { o u t } }$ . There are four possibilities for the input and output representations: + +STEERABLE KERNELS $K : X \to \operatorname { H o m } _ { \mathbb { R } } ( V _ { + } , V _ { + } )$ + +$V _ { + }$ can only be in a tensor product $V \otimes V _ { + }$ if the sign of $V$ is positive as well. Such a space appears precisely once in $L _ { \mathbb { R } } ^ { 2 } ( X )$ according to Section E.3.2. Since endomorphisms and Clebsch-Gordan coefficients do not appear by what we’ve shown before, and since complex conjugation doesn’t do anything over the real numbers, a basis for steerable kernels is just given by the one kernel $K _ { + } = f _ { + }$ itself. Here, we identify ${ \mathrm { H o m } } _ { \mathrm { R } } ( V _ { + } , V _ { + } )$ with $\mathbb { R }$ since it only consists of $1 \times 1$ -matrices. + +STEERABLE KERNELS $K : X \to \operatorname { H o m } _ { \mathbb { R } } ( V _ { + } , V _ { - } )$ : + +By the same arguments, a basis is given by the one kernel $K _ { - } = f _ { - }$ . + +STEERABLE KERNELS $K : X \to \operatorname { H o m } _ { \mathbb { R } } ( V _ { - } , V _ { + } )$ : + +Again, a basis for steerable kernels is given by $K _ { - } = f _ { - }$ . + +STEERABLE KERNELS $K : X \to \operatorname { H o m } _ { \mathbb { R } } ( V _ { - } , V _ { - } )$ : + +A basis is given by $K _ { + } = f _ { + }$ + +Finally, we also need to engage with the case that $X = \{ 0 \}$ consists only of a single point. Similarly to above, in the “even” case that the signs of input- and output representations agree, a basis is given by $K _ { + } = f _ { + }$ with $f _ { + } ( 0 ) = 1$ . If, however, the signs do not agree, then only $K = 0$ fulfills the constrained and the basis is empty. + +Now, we assemble this to kernels on the whole of $\mathbb { R } ^ { 2 }$ . We saw above that we only need to distinguish two cases, namely (a) the case that the signs of input and output representation agree and (b) that they do not. + +For case (a), let $K : \mathbb { R } ^ { 2 } \mathbb { R }$ be a steerable kernel, where $\mathbb { R }$ is isomorphic to the Hom-space between equal-sign representations. $\mathbb { R } ^ { 2 }$ splits disjointly into orbits, namely $\left\{ \left( { a \atop b } \right) , \left( { - a \atop b } \right) \right\}$ for all $a \in \mathbb { R } _ { \geq 0 }$ and $b \in \mathbb { R }$ . If $a = 0$ , then the orbit is just a single point, which means that we have a vertical line of single-point orbits. The solution above showed that on each orbit, the kernel needs to be constant (since $f _ { + }$ is constant) and overall this just translates to + +$$ +K \left( { a atop b } \right) = K \left( { - a \atop b } \right) +$$ + +for all $a \geq 0$ and $b \in \mathbb { R }$ . Consequently, $K$ is just an arbitrary left-right symmetric kernel. + +In the case that the input- and output representations do not share their sign, by the same arguments we see that $K : \mathbb { R } ^ { 2 } \mathbb { R }$ is an arbitrary left-right anti-symmetric kernel which is zero on the vertical line $\binom { 0 } { b }$ for arbitrary $b \in \mathbb { R }$ . + +Other than these left-right restrictions, the kernel can be freely learned. Overall, this means that we learn one “half” of the kernel and can recover the other half by the symmetry property derived above. + +# E.3.6 GROUP CONVOLUTIONAL CNNS FOR $\mathbb { Z } _ { 2 }$ + +We now investigate what all this means if we consider regular representations instead of irreducible representations, thus corresponding to group convolutional kernels as in (Cohen & Welling, 2016a). In this case, we will see an interesting “twist” in the kernel, which makes this example more interesting than one might initially think. The twist emerges as follows: For regular representations, we consider steerable kernels + +$$ +K : \mathbb { R } ^ { 2 } \mathrm { H o m } _ { \mathbb { R } } ( L _ { \mathbb { R } } ^ { 2 } ( \mathbb { Z } _ { 2 } ) , L _ { \mathbb { R } } ^ { 2 } ( \mathbb { Z } _ { 2 } ) ) +$$ + +Now, there are two relatively canonical bases we can choose in the left and the right space. We already know from above that $\{ f _ { + } , f _ { - } \}$ is the basis to choose if we want to express steerable kernels corresponding to irreducible representations. However, for vanilla group convolutional CNNs, the basis usually chosen is $\{ e _ { + 1 } , e _ { - 1 } \}$ where $e _ { + 1 } ( x ) = \delta _ { + 1 , x }$ and $e _ { - 1 } ( x ) = \delta _ { - 1 , x }$ . We then obtain the following four base change relations: + +$$ +\begin{array} { l } { { f _ { + } = e _ { + 1 } + e _ { - 1 } , \quad f _ { - } = e _ { + 1 } - e _ { - 1 } , } } \\ { { e _ { + 1 } = \displaystyle \frac { 1 } { 2 } f _ { + } + \displaystyle \frac { 1 } { 2 } f _ { - } , \quad e _ { - 1 } = \displaystyle \frac { 1 } { 2 } f _ { + } - \displaystyle \frac { 1 } { 2 } f _ { - } . } } \end{array} +$$ + +Thus, the base change matrices are given by + +$$ +B = \left( { \begin{array} { c c } { 1 } & { 1 } \\ { 1 } & { - 1 } \end{array} } \right) , \quad B ^ { - 1 } = \left( { \begin{array} { c c } { { \frac { 1 } { 2 } } } & { 1 } \\ { { \frac { 1 } { 2 } } } & { - { \frac { 1 } { 2 } } } \end{array} } \right) . +$$ + +Now, assume that $K : \mathbb { R } ^ { 2 } \mathrm { H o m } _ { \mathbb { R } } ( L _ { \mathbb { R } } ^ { 2 } ( \mathbb { Z } _ { 2 } ) , L _ { \mathbb { R } } ^ { 2 } ( \mathbb { Z } _ { 2 } ) ) \cong \mathbb { R } ^ { 2 \times 2 }$ is expressed with respect to the basis $\{ f _ { + } , f _ { - } \}$ . If we write $K$ as a matrix + +$$ +K = \left( \begin{array} { c c } { { K _ { 1 1 } } } & { { K _ { 1 2 } } } \\ { { K _ { 2 1 } } } & { { K _ { 2 2 } } } \end{array} \right) +$$ + +then we know that $K _ { 1 1 }$ and $K _ { 2 2 }$ map between equal-sign representations and $K _ { 1 2 }$ and $K _ { 2 1 }$ between unequal-sign representations. Consequently, from what we’ve found above, $K _ { 1 1 }$ and $K _ { 2 2 }$ are symmetric, whereas $K _ { 1 2 }$ and $K _ { 2 1 }$ are antisymmetric. What we now want to figure out is how exactly this translates to a property of the kernel expressed in the basis $\{ e _ { + } , e _ { - } \}$ . + +Thus, let $K ^ { \prime }$ be this corresponding kernel. Then using the base change matrices above we obtain + +$$ +{ \begin{array} { r l } { \left( K _ { 1 1 } ^ { \prime } } & { K _ { 1 2 } ^ { \prime } \right) = K ^ { \prime } } \\ { \left( K _ { 2 1 } ^ { \prime } } & { K _ { 2 2 } ^ { \prime } \right) = K ^ { \prime } } \\ & { \qquad = B \cdot K \cdot B ^ { - 1 } } \\ & { \qquad = \left( 1 \qquad 1 \right) \cdot \left( K _ { 1 1 } \quad K _ { 1 2 } \right) \cdot \left( { \frac { 1 } { 2 } } \quad \qquad { \frac { 1 } { 2 } } \right) } \\ & { \qquad = \left( { \frac { 1 } { 2 } } \left[ K _ { 1 1 } + K _ { 1 2 } + K _ { 2 1 } + K _ { 2 2 } \right] \quad { \frac { 1 } { 2 } } \left[ K _ { 1 1 } - K _ { 1 2 } + K _ { 2 1 } - K _ { 2 2 } \right] \right) . } \\ & { \qquad = \left( { \frac { 1 } { 2 } } \left[ K _ { 1 1 } + K _ { 1 2 } - K _ { 2 1 } - K _ { 2 2 } \right] \quad { \frac { 1 } { 2 } } \left[ K _ { 1 1 } - K _ { 1 2 } - K _ { 2 1 } + K _ { 2 2 } \right] \right) . } \end{array} } +$$ + +What symmetry properties does this kernel obey? In order to understand this, we use the following convention: for $\boldsymbol { y } \in \mathbb { R } ^ { 2 }$ we set $- y = { \binom { - y _ { 1 } } { y _ { 2 } } }$ , i.e., the vertically flipped image of $y$ . Then we have, using the symmetry and anti-symmetry of the entries of the original kernel $K$ : + +$$ +\begin{array} { l } { { K _ { 2 2 } ^ { \prime } ( - y ) = \displaystyle \frac { 1 } { 2 } \big [ K _ { 1 1 } ( - y ) - K _ { 1 2 } ( - y ) - K _ { 2 1 } ( - y ) + K _ { 2 2 } ( - y ) \big ] } } \\ { { \ ~ } } \\ { { \ ~ = \displaystyle \frac { 1 } { 2 } \big [ K _ { 1 1 } ( y ) + K _ { 1 2 } ( y ) + K _ { 2 1 } ( y ) + K _ { 2 2 } ( y ) \big ] } } \\ { { \ ~ = K _ { 1 1 } ^ { \prime } ( y ) , } } \\ { { \ ~ K _ { 2 1 } ^ { \prime } ( - y ) = \displaystyle \frac { 1 } { 2 } \big [ K _ { 1 1 } ( - y ) + K _ { 1 2 } ( - y ) - K _ { 2 1 } ( - y ) - K _ { 2 2 } ( - y ) \big ] } } \\ { { \ ~ = \displaystyle \frac { 1 } { 2 } \big [ K _ { 1 1 } ( y ) - K _ { 1 2 } ( y ) + K _ { 2 1 } ( y ) - K _ { 2 2 } ( y ) \big ] } } \\ { { \ ~ = K _ { 1 2 } ^ { \prime } ( y ) . } } \end{array} +$$ + +Thus the second row of $K ^ { \prime }$ is basically the same as the first, only that the kernels swap with each other and are internally flipped. This is a special case of the outcome in Cohen & Welling (2016a), which is also described clearly in Weiler et al. (2018b): in group convolutional kernels which are steerable with respect to finite groups, the kernels get copied and applied in all orientations demanded by the group. + +What we would still like to understand is if we can also reverse the direction: That is, assume that we start with a group convolutional kernel $K ^ { \prime }$ of which we know that $K _ { 2 2 ^ { \prime } } ( - y ) = K _ { 1 1 } ^ { \prime } ( y )$ and $K _ { 2 1 } ^ { \prime } ( - y ) = K _ { 1 2 } ^ { \prime } ( y )$ for all $\boldsymbol { y } \in \mathbb { R } ^ { 2 }$ . If we then do a base change, we would like to know if the resulting kernel consists of symmetric and antisymmetric entries. Namely, set + +$$ +\begin{array} { r l } { \bigg ( K _ { 1 1 } } & { K _ { 1 2 } \bigg ) = K } \\ { K _ { 2 1 } } & { K _ { 2 2 } \bigg ) = K } \\ & { \quad \quad = B ^ { - 1 } \cdot K ^ { \prime } \cdot B } \\ & { \quad \quad = \bigg ( \frac { 1 } { 2 } \qquad \frac { 1 } { 2 } \bigg ) \cdot \bigg ( K _ { 1 1 } ^ { \prime } \quad K _ { 1 2 } ^ { \prime } \bigg ) \cdot \binom { 1 } { 1 } \quad 1 \bigg ) } \\ & { \quad \quad = \bigg ( \frac { 1 } { 2 } \qquad - \frac { 1 } { 2 } \bigg ) \cdot \bigg ( K _ { 2 1 } ^ { \prime } \quad K _ { 2 2 } ^ { \prime } \bigg ) \quad \frac { 1 } { 2 } \big [ K _ { 1 1 } ^ { \prime } - K _ { 1 2 } ^ { \prime } + K _ { 2 1 } ^ { \prime } - K _ { 2 2 } ^ { \prime } \big ] } \\ & { \quad \quad = \bigg ( \frac { 1 } { 2 } \big [ K _ { 1 1 } ^ { \prime } + K _ { 1 2 } ^ { \prime } - K _ { 2 1 } ^ { \prime } - K _ { 2 2 } ^ { \prime } \big ] \quad \frac { 1 } { 2 } \big [ K _ { 1 1 } ^ { \prime } - K _ { 1 2 } ^ { \prime } - K _ { 2 1 } ^ { \prime } + K _ { 2 2 } ^ { \prime } \big ] \bigg ) . } \end{array} +$$ + +The reader can easily check that we can deduce that $K _ { 1 1 }$ and $K _ { 2 2 }$ are symmetric and that $K _ { 1 2 }$ and $K _ { 2 1 }$ are anti-symmetric. We have thus fully shown the equivalence of the kernel solutions in the setting of steerable CNNs compared to the setting of group convolutional CNNs for the specific group $\mathbb { Z } _ { 2 }$ . + +# E.4 SO(3)-STEERABLE KERNELS FOR COMPLEX REPRESENTATIONS. + +In the first two sections, we have discussed SO(2)-equivariant kernels (i.e., SE(2)-equivariant neural networks) both over $\mathbb { C }$ and R. The situation over R was considerably more complicated and required new arguments. In this section, we will discuss SO(3)-equivariant kernels (i.e., SE(3)-equivariant neural networks) for complex representations. In Section E.5 we will then look at the real case, which will essentially give the exact same results, thus differing somewhat from the considerations about SO(2). Different from the earlier sections, we will from now on be less explicit and care more about the general properties of the different functions and coefficients we consider. SO(3)- equivariant networks with real representations have before been implemented in Weiler et al. (2018a) and Thomas et al. (2018), among others. + +# E.4.1 THE IRREDUCIBLE REPRESENTATIONS OF SO(3) OVER THE COMPLEX NUMBERS + +In this section, we state the complex irreducible representations of SO(3). We will not state the matrices explicitly since the matrix elements are considerably more complicated than in the earlier examples that we saw. For each $l \in \mathbb { N } _ { \geq 0 }$ , there is one irreducible unitary representation + +The matrices $D _ { l } ( g )$ for $g \in \mathrm { S O } ( 3 )$ are called the Wigner $D$ -matrices.29 There are, up to equivalence, no other irreducible representations of SO(3) over $\mathbb { C }$ . A reference for all this is the original work Wigner (1944). + +We note that the indices for the dimensions in $\mathbb { C } ^ { 2 l + 1 }$ are $- l , - l + 1 , \dots , l - 1 , l$ by general convention. + +E.4.2 THE PETER-WEYL THEOREM FOR $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ AS A REPRESENTATION OF SO(3) + +Here, we describe how $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ , considered as a unitary representation via $\lambda ~ : ~ \mathrm { S O ( 3 ) } ~ $ $\mathrm { U } \big ( L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } ) \big )$ , with $[ \lambda ( g ) \varphi ] ( x ) = \varphi ( g ^ { - 1 } x )$ , contains densely a direct sum of irreducible representations. For doing so, we proceed by first describing spherical harmonics without formulas and stating their orthonormality properties, and then stating how they transform under rotation. This will then yield the result. Note that we do not need to describe explicit formulas for the spherical harmonics, which are again somewhat complicated since we are more interested in their properties in relation to Hilbert space theory and representation theory. A reference for all this is MacRobert (1947). + +The spherical harmonics are continuous functions $Y _ { l } ^ { n } : S ^ { 2 } \to \mathbb { C }$ for $l \in \mathbb { N } _ { \geq 0 }$ and $n = - l , \ldots , l$ . Thus, they are elements of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ . They have the following properties: + +1. $\left. Y _ { l } ^ { n } \Big | Y _ { l ^ { \prime } } ^ { n ^ { \prime } } \right. = \delta _ { l l ^ { \prime } } \delta _ { n n ^ { \prime } }$ for all $l , l ^ { \prime } , n , n ^ { \prime } .$ . +2. The linear span of the spherical harmonics is dense in $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ . +3. They transform as follows under rotation: $\begin{array} { l } { { \lambda ( g ) ( Y _ { l } ^ { n } ) ~ = ~ \sum _ { n ^ { \prime } = - l } ^ { l } D _ { l } ^ { n ^ { \prime } n } ( g ) Y _ { l } ^ { n ^ { \prime } } } } \end{array}$ , where $D _ { l } ^ { n ^ { \prime } n } ( g )$ are the matrix elements of the Wigner D-matrices defined in Section E.4.1. + +Properties 1 and 2 together imply that the spherical harmonics form an orthonormal basis of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ , see Definition F.40. Let + +$$ +V _ { l 1 } : = \operatorname { s p a n } _ { \mathbb { C } } ( Y _ { l } ^ { n } \mid n = - l , \ldots , l ) . +$$ + +Then we already obtain $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } ) = { \widehat { \bigoplus } } _ { l \geq 0 } V _ { l 1 }$ . Now, let $e ^ { n } \in \mathbb { C } ^ { 2 l + 1 }$ be the $n$ ’th standard basis vector, for $n = - l , \ldots , l .$ . Then property 3 means that the linear map given on basis vectors by + +$$ +f : V _ { l } \to V _ { l 1 } , e ^ { n } \mapsto Y _ { l } ^ { n } +$$ + +is an isomorphism of unitary representations. More precisely, $f$ is clearly a unitary transformation and a linear isomorphism, and it is furthermore equivariant on basis vectors since + +$$ +\begin{array} { l } { f \left( D _ { l } ( g ) ( e ^ { n } ) \right) = f \left( \sum _ { n ^ { \prime } = - l } ^ { l } D _ { l } ^ { n ^ { \prime } n } ( g ) e ^ { n ^ { \prime } } \right) } \\ { \quad \quad \quad = \sum _ { n ^ { \prime } = - l } ^ { l } D _ { l } ^ { n ^ { \prime } n } ( g ) f ( e ^ { n ^ { \prime } } ) } \\ { \quad \quad \quad = \sum _ { n ^ { \prime } = - l } ^ { l } D _ { l } ^ { n ^ { \prime } n } ( g ) Y _ { l } ^ { n ^ { \prime } } } \\ { \quad \quad = \lambda ( g ) ( Y _ { l } ^ { n } ) } \\ { \quad \quad = \lambda ( g ) ( f ( e ^ { n } ) ) . } \end{array} +$$ + +General equivariance then follows from equivariance on basis vectors. This concludes this section. + +# E.4.3 THE CLEBSCH-GORDAN DECOMPOSITION + +Explicit formulas for the Clebsch-Gordan coefficients of SO(3) are given in Bohm & Lowe (1993). ¨ The most important fact is the following: There is a decomposition + +$$ +V _ { j } \otimes V _ { l } \cong \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J } +$$ + +of representations. Furthermore, the Clebsch-Gordan coefficients $\langle J M | j m ; l n \rangle$ are all real numbers, a fact that we will use in Section E.5. + +# E.4.4 ENDOMORPHISMS OF $V _ { J }$ + +As in the case of harmonic networks, this is again simple: we are considering representations over C, and so Schur’s Lemma D.8 tells us that $\mathrm { E n d } _ { \mathrm { S O ( 3 ) } } ( V _ { J } )$ is 1-dimensional for each irrep $J$ . We can therefore ignore the endomorphisms once again. + +# E.4.5 BRINGING EVERYTHING TOGETHER + +Now, with all this prior work, let us determine the equivariant kernels $K : S ^ { 2 } \mathrm { H o m } _ { \mathbb { C } } ( V _ { l } , V _ { J } )$ for the irreducible representations $D _ { l } : \mathrm { S O ( 3 ) } \mathrm { U } ( V _ { l } )$ and $D _ { J } : \mathrm { S O ( 3 ) } \mathrm { U } ( V _ { J } )$ . For this, we use Eq. (23). Since each $V _ { j }$ appears only once in the direct sum decomposition of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ according to Section E.4.2 and since $V _ { J }$ can only appear once in the direct sum decomposition of a tensor product $V _ { j } \otimes V _ { l }$ according to Section E.4.3 , we do not need the indices $i$ and $s$ . Furthermore, as mentioned in the last section, the endomorphisms are trivial, which is why we also do not need the index $r$ . Overall, we see that we simply have basis kernels $K _ { j } : S ^ { 2 } \to \operatorname { H o m } _ { \mathbb { C } } ( V _ { l } , V _ { J } )$ for all $j$ with $| l - J | \leq j \leq l + J$ .30 They are explicitly given by + +$$ +K _ { j } ( x ) = \left( \begin{array} { c } { \langle j | x \rangle \cdot \mathrm { C G } _ { J ( j l ) } ^ { 1 } } \\ { \vdots } \\ { \langle j | x \rangle \cdot \mathrm { C G } _ { J ( j l ) } ^ { d _ { J } } } \end{array} \right) +$$ + +for all $x \in S ^ { 2 }$ . Remembering that $\langle j m | x \rangle = \overline { { Y _ { j } ^ { m } ( x ) } }$ , the individual matrix elements of $K _ { j } ( x )$ are then given by + +$$ +\langle J M | K _ { j } ( x ) | l n \rangle = \sum _ { m = - j } ^ { j } \langle J M | j m ; l n \rangle \cdot \overline { { Y _ { j } ^ { m } } } ( x ) . +$$ + +This ends the discussion. + +# E.5 SO(3)-STEERABLE KERNELS FOR REAL REPRESENTATIONS + +In this section, we want to argue why the results in the last section transfer over to the real case as well. Most of the investigations in this section are probably well-known. However, we were not able to find sources that explicitly explain the representation theory of SO(3) over the real numbers, and so we develop lots of it here from scratch. We thereby make use of the theory over C, some results about real spherical harmonics, and the general theory of real and quaternionic representations outlined in Brocker & Dieck (2003). We need to somewhat turn the order around in ¨ this section in order to develop the results. Therefore we first investigate the Peter-Weyl theorem, then look at the endomorphism spaces of the appearing irreducible representations and afterward, as a consequence, show that the representations appearing in the decomposition of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } )$ are already exhaustive. + +E.5.1 THE PETER-WEYL THEOREM FOR $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } )$ AS A REPRESENTATION OF SO(3) + +The most important finding is the following, which is taken from Gallier & Quaintance (2020): One can do a base change for the spherical harmonics as follows to obtain real versions of them. Namely, let + +$$ +{ } ^ { r } Y _ { l } ^ { n } = { \left\{ \begin{array} { l l } { \displaystyle { \frac { i } { \sqrt { 2 } } } \left( Y _ { l } ^ { n } - ( - 1 ) ^ { n } Y _ { l } ^ { - n } \right) } & { { \mathrm { i f } } n < 0 , } \\ { \displaystyle Y _ { l } ^ { 0 } } & { { \mathrm { i f } } n = 0 , } \\ { \displaystyle { \frac { 1 } { \sqrt { 2 } } } \left( Y _ { l } ^ { - n } + ( - 1 ) ^ { n } Y _ { l } ^ { n } \right) } & { { \mathrm { i f } } n > 0 . } \end{array} \right. } +$$ + +One can then show that these functions are real-valued continuous functions and therefore $^ { r } Y _ { l } ^ { n } \in$ $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } )$ . Furthermore, they are an orthonormal basis of this space. We can then, as before, set $^ r V _ { l 1 }$ as the span of the $^ r Y _ { l } ^ { n } \in \dot { L } _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } )$ and obtain a decomposition + +$$ +L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } ) = { \widehat { \bigoplus } _ { l \geq 0 } r _ { l 1 } } . +$$ + +We need to understand the transformation properties of these real-valued spherical harmonics under rotation. To understand this explicitly, we set $B _ { l } \in \mathbb { C } ^ { ( 2 l + 1 ) \times ( 2 l + 1 ) }$ as the (complex) base change matrix between the complex and real spherical harmonics. Its entries are given according to Eq. (31) such that the following relation holds for all $n = - l , \ldots , l$ : + +$$ +r { Y _ { l } ^ { n } } = \sum _ { n ^ { \prime } = - l } ^ { l } B _ { l } ^ { n ^ { \prime } n } \cdot Y _ { l } ^ { n ^ { \prime } } . +$$ + +Since for a given $l$ , both the complex and real spherical harmonics are linearly independent, the matrix $B _ { l }$ is invertible. Let $B _ { l } ^ { - 1 }$ be its inverse. Then it is generally known from linear algebra that + +we also obtain the inverse relation: + +$$ +Y _ { l } ^ { n } = \sum _ { n ^ { \prime } = - l } ^ { l } ( B _ { l } ^ { - 1 } ) ^ { n ^ { \prime } n } \cdot { } ^ { r } Y _ { l } ^ { n ^ { \prime } } . +$$ + +Using both these relations and the rotation properties of the complex spherical harmonics from Section E.4.2 we obtain the following rotation property for the real spherical harmonics: + +$$ +\begin{array} { r l } { \lambda ( g ) ( T Y _ { t } ^ { n } ) = \displaystyle \sum _ { n = - l } ^ { l } B _ { t } ^ { n , n } \cdot \lambda ( g ) ( Y _ { t } ^ { n , n } ) } \\ { = \displaystyle \sum _ { n = - l } ^ { l } B _ { t } ^ { n , n } \sum _ { n = - l } ^ { l } D _ { t } ^ { n , n } ( g ) \cdot Y _ { t } ^ { n , n } } \\ { = \displaystyle \sum _ { n = - l } ^ { l } B _ { t } ^ { n , n } \sum _ { n = - l } ^ { l } D _ { t } ^ { n , n } ( g ) \cdot Y _ { t } ^ { n , n } } \\ { = \displaystyle \sum _ { n = - l } ^ { l } B _ { t } ^ { n , n } \sum _ { n = - l } ^ { l } D _ { t } ^ { n , n } ( g ) \cdot \sum _ { n = - l } ^ { l } ( B _ { t } ^ { - 1 } ) ^ { n , n } \cdots \gamma _ { t } ^ { n , n } } \\ { = \displaystyle \sum _ { n = - l } ^ { l } \left( \displaystyle \sum _ { n = - l } ^ { l } \displaystyle \sum _ { n = - l - n - l } ^ { l } ( B _ { t } ^ { - 1 } ) ^ { n , n } \cdots D _ { t } ^ { n , 2 n , 1 } ( g ) \cdot B _ { t } ^ { n , 1 , n } \right) \cdot Y _ { t } ^ { n , n } } \\ { = \displaystyle \sum _ { n = - l } ^ { l } \left( B _ { t } ^ { - 1 } \cdot D _ { t } ( g ) \cdot B _ { t } \right) ^ { n , n } \cdot \gamma _ { t } ^ { n , n } . } \end{array} +$$ + +Now if we set ${ } ^ { r } D _ { l } ( g ) : = B _ { l } ^ { - 1 } \cdot D _ { l } ( g ) \cdot B _ { l }$ , then we obtain the transformation property + +$$ +\lambda ( g ) ( ^ { r } Y _ { l } ^ { n } ) = \sum _ { n ^ { \prime } = - l } ^ { l } { ^ { r } D _ { l } ( g ) ^ { n ^ { \prime } n } \cdot ^ { r } Y _ { l } ^ { n ^ { \prime } } } +$$ + +which is analogous to the one in Section E.4.2. + +Proof. Note that since ${ } ^ { r } Y _ { l } ^ { n }$ is a real-valued function, the rotation $\lambda ( g ) ( ^ { r } Y _ { l } ^ { n } )$ is real-valued as well. Thus, it is in the space $L _ { \mathbb { R } } ^ { 2 ^ { \circ } } ( S ^ { 2 } )$ . The real spherical harmonics are a basis of this space, which means that the coefficients when expanding $\lambda ( g ) ( ^ { r } Y _ { l } ^ { n } )$ in this basis are necessarily real as well. These coefficients are precisely given by the ${ } ^ { r } D _ { l } ( g ) ^ { n ^ { \prime } n }$ according to Eq. (32). □ + +Now, we have the choice to view $^ r D _ { l }$ as either a real or a complex representation, but first we take the complex viewpoint and see it as a function $^ r D _ { l } : \mathrm { S O ( 3 ) } \bar { } \mathrm { G } \bar { \mathrm { L } } ( \mathbb { C } ^ { 2 l + 1 } )$ . Notationwise, the following is important: the $\cdot _ { r } , \cdot $ in ${ \boldsymbol { r } } _ { D _ { l } }$ indicates that the elements in this matrix are real but does not tell us on which space it acts. This will always be clarified by the context. We have the following: + +Lemma E.8. $^ { r } D _ { l } : \mathrm { S O ( 3 ) } \to \mathrm { U } ( \mathbb { C } ^ { 2 l + 1 } )$ is an irreducible unitary representation and isomorphic to $D _ { l }$ . + +Proof. First of all, it is an actual linear representation since + +$$ +^ { r } D _ { l } ( g g ^ { \prime } ) = B _ { l } ^ { - 1 } D _ { l } ( g g ^ { \prime } ) B _ { l } = B _ { l } ^ { - 1 } D _ { l } ( g ) B _ { l } B _ { l } ^ { - 1 } D _ { l } ( g ^ { \prime } ) B _ { l } = { } ^ { r } D _ { l } ( g ) \cdot { } ^ { r } D _ { l } ( g ^ { \prime } ) +$$ + +where we used that $D _ { l }$ is a linear representation. Now since $Y _ { l } ^ { n }$ and $^ { r } Y _ { l } ^ { n }$ are both orthonormal bases of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ , the base change matrix $B _ { l }$ needs to be a unitary matrix. Consequently, ${ } ^ { r } D _ { l } ( g ) =$ $B _ { l } ^ { - 1 } D _ { l } ( g ) \dot { B } _ { l }$ is as a product of unitary transformations itself unitary, which means that ${ } ^ { r } D _ { l }$ is a unitary representation. Furthermore, we obtain $B _ { l } \cdot { \dot { \boldsymbol { r } } } D _ { l } ( g ) = D _ { l } ( { \dot { \boldsymbol { g } } } ) \cdot B _ { l }$ , which means that $B _ { l }$ gives an isomorphism $r _ { D _ { l } } \cong D _ { l }$ of unitary representations. From the fact that $D _ { l }$ is irreducible, we obtain that ${ \bf \Delta } ^ { r } D _ { l }$ is irreducible as well. □ + +Now we take the real viewpoint. Let ${ } ^ { r } V _ { l } = \mathbb { R } ^ { 2 l + 1 }$ . + +Lemma E.9. $^ r D _ { l } : \mathrm { S O ( 3 ) } \mathrm { O } ( ^ { r } V _ { l } )$ is an irreducible orthogonal representation. + +Proof. ${ } ^ { r } D _ { l } ( g )$ is a unitary matrix for each $g \in \mathrm { S O } ( 3 )$ by Lemma E.8, and since its matrix elements are real by Lemma E.7, it automatically is an orthogonal matrix. If it was reducible, then there would be a real base change matrix that brings ${ } ^ { r } D _ { l }$ in a nontrivial block-diagonal shape. However, this base change would in particular be complex, meaning that we would conclude that the complex version of the representation ${ } ^ { r } D _ { l }$ is reducible. But it is not, due to Lemma E.8. □ + +Now, remember that $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } ) = { \widehat { \bigoplus } _ { l \geq 0 } } ^ { r } V _ { l 1 }$ and that ${ } ^ { r } V _ { l 1 }$ is generated from the real spherical harmonics. Also, remember that the real spherical harmonics transform as in Eq. (32). Thus, with the same arguments as in Eq. (30) we obtain ${ \bf { \Lambda } } ^ { r } V _ { l 1 } \cong { \bf { \Lambda } } ^ { r } V _ { l }$ , which is from the preceding lemmas an irreducible orthogonal representation. Thus, we have found the Peter-Weyl decomposition of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } )$ . + +# E.5.2 ENDOMORPHISMS OF ${ } ^ { r } V _ { J }$ + +In the next section, we will show that the ${ } ^ { r } D _ { J } : \mathrm { S O } ( 3 ) \mathrm { O } ( { } ^ { r } V _ { J } )$ already given an exhaustive list of the irreducible representations of SO(3) over the real numbers. In this section, we first describe their endomorphism spaces since this will help in showing that there cannot be any other irreducible representations. Fortunately, the situation is again simple: + +Proposition E.10. $\operatorname { E n d } _ { \mathrm { S O ( 3 ) , R } } ( ^ { r } V _ { J } )$ is one-dimensional for each $J \geq 0$ . + +Proof. Let $f : { } ^ { r } V _ { J } { } ^ { r } V _ { J }$ be an endomorphism. Since ${ } ^ { r } V _ { J } = \mathbb { R } ^ { 2 J + 1 }$ we can view $f$ as a matrix in $\mathbb { R } ^ { ( 2 \bar { J } + 1 ) \times ( 2 \bar { J } + 1 ) }$ . That $f$ is an endomorphism then means + +$$ +f \cdot { } ^ { r } D _ { J } ( g ) = { } ^ { r } D _ { J } ( g ) \cdot f +$$ + +for all $g \in \mathrm { S O } ( 3 )$ . Now note that as a real matrix, f is in particular a complex matrix, i.e., $f \in$ $\mathbb { C } ^ { ( 2 J + 1 ) \times ( 2 J + 1 ) }$ . Also, remember that we can view ${ } ^ { r } D _ { J }$ also as a complex irreducible representation $^ r D _ { J } : \mathrm { S O ( 3 ) } \to \mathrm { U } ( \mathbb { C } ^ { 2 J + 1 } )$ by Lemma E.8. What this means is that $f \in \mathrm { E n d } _ { \mathrm { S O ( 3 ) } , \mathrm { C } } ( \mathbb { C } ^ { 2 J + 1 } )$ , which is isomorphic to C by Schur’s Lemma D.8. Thus, $f$ is a complex multiple of the identity. Since $f$ is a real matrix, it is thus a real multiple of the identity. The result follows. □ + +# E.5.3 GENERAL NOTES ON THE RELATION BETWEEN REAL AND COMPLEX REPRESENTATIONS + +In the next section we show that there can, up to isomorphism, not be other irreducible representations than the ${ } ^ { r } D _ { l } : \mathrm { S O ( 3 ) } \mathrm { O } ( { } ^ { r } V _ { l } )$ . In order to do so, we first need to better understand the relationship between real and complex representations of compact groups. These investigations will carry over to the investigations for O(3) that we do in Section E.6 as well. + +The following definition of a classification of real irreducible representations of a compact group $G$ can be found in Brocker & Dieck (2003), Theorem II. ¨ 6.7. In this book, it is a theorem, since the authors give an independent but equivalent definition of these notions. + +Definition E.11 (Real, Complex, and Quaternionic Type Irreducible Representations). Let $\rho : G $ $\mathrm { O } ( V )$ be a real irreducible representation of a compact group $G$ . Then $\rho$ is said to be of + +1. real type if $\operatorname { E n d } _ { G , \mathbb { R } } ( V ) \cong \mathbb { R }$ , +2. complex type if $\operatorname { E n d } _ { G , \mathbb { R } } ( V ) \cong \mathbb { C }$ and +3. quaternionic type if $\operatorname { E n d } _ { G , \mathbb { R } } ( V ) \cong \mathbb { H }$ , where $\mathbb { H }$ are the quaternions. + +Here, these isomorphisms respect both addition and multiplication. The multiplication in the endomorphism spaces is thereby given by composition of functions. + +Furthermore, Brocker & Dieck (2003) shows in Theorem II. ¨ 6.3 that there is no other possibility for an irreducible real representation, i.e., they can be completely categorized by being of real, complex or quaternionic type. Additionally, since R, C and $\mathbb { H }$ already differ in their R-dimension, it is enough to check whether the R-dimension of an endomorphism space is 1, 2 or 4 in order to do the classification. + +In order to compare real and complex representations we need to define two functors between those:31 + +Definition E.12 (Restriction and Extension). Let ${ } ^ { c } \rho : G \to \mathrm { G L } ( { } ^ { c } V )$ be a complex representation. Furthermore, let $r _ { \rho } : G \to { \mathrm { G L } } ( { \boldsymbol { \mathbf { \mathit { r } } } } _ { V } )$ be a real representation. Then we define their restriction and extension as follows: + +1. Set $r ( ^ { c } V )$ as the $\mathbb { R }$ -vector space that has the same underlying abelian group as $^ c V$ and the scalar multiplication from $\mathbb { R }$ which is the restriction of the multiplication from C. The restriction $r ( ^ { c } \rho ) : G \to { \mathrm { G L } } ( r ( ^ { c } V ) )$ is defined as the exact same map as $^ c \rho$ , only that $r ( { } ^ { c } \rho ) ( g ) : r ( { } ^ { \overset { } { c } } V ) \to r ( { } ^ { c } V )$ is now viewed as an automorphism of real vector spaces. + +2. We define the extension by $e ( ^ { r } V ) : = \mathbb { C } \otimes _ { \mathbb { R } } { } ^ { r } V$ , where $\mathbb { C }$ is regarded as an $\mathbb { R }$ -vector space. This construction becomes a C-vector space by scalar multiplication $z \cdot ( z ^ { \prime } \otimes v ) : = ( z z ^ { \prime } ) \otimes v$ We can then define $e ( { } ^ { r } \rho ) : G \to { \mathrm { G L } } ( e ( { \bar { r } } V ) )$ by setting $e ( \bar { r _ { \rho } } ) ( g ) : = \mathrm { i d } _ { \mathbb { C } } \otimes ( \bar { r _ { \rho } } ( g ) )$ . + +Note that the extension operation doubles the $\mathbb { R }$ -dimension, whereas for the restriction it stays equal. Therefore, we can not hope that these operations are inverse to each other. However, we have the following, almost as nice statement: + +Proposition E.13. For each real representation $\rho : G \to { \mathrm { G L } } ( V )$ there is a natural isomorphism $r ( e ( V ) ) \cong V \oplus V$ of R-representations. + +Proof. This is the first statement in Brocker & Dieck (2003), Proposition II. ¨ 6.1. + +The following definition is actually not the definition that Brocker & Dieck (2003) formulate. How-¨ ever, it is an equivalent characterization that follows from their Proposition II.6.6 (vii), (viii) and (ix) and is more convenient for our needs: + +Definition E.14 (Real Type Complex Representation). Let $\rho : G \to { \mathrm { G L } } ( V )$ be a complex irreducible representation. Then $\rho$ is called of real type if there is an isomorphism of real representations $r ( V ) \cong \bar { U } \oplus U$ where + +1. $\rho _ { U } : G \to { \mathrm { G L } } ( U )$ is an irreducible real representation and + +2. $r ( \rho ) : G \to { \mathrm { G L } } ( r ( V ) )$ is the restriction of $\rho$ , as defined in Definition E.12. + +Proposition E.15. Assume $G$ is a compact group such that all complex irreducible representations are of real type. Then also all real irreducible representations are of real type. + +Proof. This follows from Brocker & Dieck (2003), Proposition II. ¨ 6.6 (ii) and (iii). + +Proposition E.16. Let $\rho : G \to { \mathrm { G L } } ( V )$ be an irreducible real representation of real type. Then its extension $e ( \rho ) : G \to { \mathrm { G L } } ( e ( V ) )$ given as in Definition E.12 is an irreducible complex representation (also of real type). + +Proof. This is precisely Brocker & Dieck (2003), Proposition II. ¨ 6.6(i). + +E.5.4 THE IRREDUCIBLE REPRESENTATIONS OF SO(3) OVER THE REAL NUMBERS + +The rough strategy is to use the fact that the ${ } ^ { r } D _ { l }$ , viewed as complex irreducible representations, are an exhaustive list of all the complex irreps. Then, using the restriction and extension operators $r$ and $e$ between real and complex representations, we can show that in the specific case of SO(3), there can not be any other real irreducible representations than the ${ } ^ { r } D _ { l }$ , viewed as real representations. + +Lemma E.17. All complex irreducible representations of SO(3) are of real type. + +Proof. From Section E.4.1 and Lemma E.8 we know that the $^ { r } D _ { l } : \mathrm { S O ( 3 ) } \to \mathrm { U } ( \mathbb { C } ^ { 2 l + 1 } )$ give us, up to equivalence, all the complex irreducible representations of SO(3). According to Definition E.14 we now need to understand that its restriction splits into the direct sum of twice the same irreducible real representation. We do this as follows: + +We can write $r ( \mathbb { C } ^ { 2 l + 1 } ) = \mathbb { R } ^ { 2 l + 1 } \oplus ( i \mathbb { R } ) ^ { 2 l + 1 } = { } ^ { r } V _ { l } \oplus i ^ { r } V _ { l }$ , which is a decomposition of $\mathbb { C } ^ { 2 l + 1 }$ when viewed as an $\mathbb { R }$ -vector space. Then, we can note that both + +$$ +\begin{array} { r l } & { { ^ { r } D _ { l } } : \mathrm { S O } ( 3 ) \to \mathrm { O } ( ^ { r } V _ { l } ) \mathrm { a n d } } \\ & { { ^ { r } D _ { l } } : \mathrm { S O } ( 3 ) \to \mathrm { O } ( i ^ { r } V _ { l } ) } \end{array} +$$ + +are well-defined $\mathbb { R }$ -representations, which follows from the fact that the matrix elements are all real. Furthermore, the first map is actually an irreducible real representation by Lemma E.9. The second one is isomorphic to the first since one can show that + +$$ +i : { } ^ { r } V _ { l } \to i ^ { r } V _ { l } , a \mapsto i \cdot a +$$ + +is an isomorphism of real SO(3)-representations. This gives us precisely the splitting of $r ( \mathbb { C } ^ { 2 l + 1 } )$ as a representation that we were looking for. □ + +Corollary E.18. All irreducible real representations of SO(3) are of real type. + +Proof. This follows directly from Lemma E.17 and Proposition E.15. + +Proposition E.19. The ${ } ^ { r } D _ { l } : \mathrm { S O } ( 3 ) \mathrm { O } ( { } ^ { r } V _ { l } )$ are, up to equivalence, all real irreducible representations of SO(3). + +Proof. Assume that $\rho : \mathrm { S O } ( 3 ) \mathrm { G L } ( V )$ is an irreducible real representation of $\mathrm { S O ( 3 ) }$ . It is of real type by Corollary E.18. By Proposition E.16, the extension ${ \dot { e } } ( \rho ) : G \to { \mathrm { G L } } ( { \dot { e } } ( V ) )$ is an irreducible complex representation. Since the ${ \boldsymbol { r } } _ { D _ { l } }$ give us all complex irreducible representations up to equivalence by Section E.4.1 and Lemma E.8, there is an equivalence of complex SO(3)- representations $e ( V ) \cong \mathbb { C } ^ { 2 l + 1 }$ for some $l$ . Since functors respect isomorphisms (and equivalences are isomorphisms in the categories of $G$ -representations) and the restriction operation is a functor,32 and using Proposition E.13 as well as the proof of Lemma E.17 we obtain: + +$$ +V \oplus V \cong r ( e ( V ) ) \cong r ( \mathbb { C } ^ { 2 l + 1 } ) \cong { } ^ { r } V _ { l } \oplus i ^ { r } V _ { l } = { } ^ { r } V _ { l } \oplus { } ^ { r } V _ { l } . +$$ + +Using the Krull-Remak-Schmidt Theorem B.39, we see that there is an isomorphism of SO(3)- representations $V \cong { } ^ { r } V _ { l }$ . This finishes the proof. □ + +# E.5.5 THE CLEBSCH-GORDAN DECOMPOSITION + +We are almost there. The only thing left to understand is the Clebsch-Gordan decomposition. Remember the following from Section E.4.3: For the complex irreducible representations there are decompositions + +$$ +V _ { j } \otimes V _ { l } \cong \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J } +$$ + +where on each space, the representations $D _ { j } , D _ { l }$ and $D _ { J }$ are given by the Wigner D-matrices. Furthermore, the Clebsch-Gordan coefficients are all real. Now, we know that ${ } ^ { r } D _ { l }$ is, as a complex representation, isomorphic to $D _ { l }$ by Lemma E.8, and such a representation then acts on $\mathbb { C } ^ { 2 l + \mathrm { \hat { 1 } } }$ as well. Consequently, we also get the decomposition + +$$ +\mathbb { C } ^ { 2 j + 1 } \otimes \mathbb { C } ^ { 2 l + 1 } \cong \bigoplus _ { J = | l - j | } ^ { l + j } \mathbb { C } ^ { 2 J + 1 } +$$ + +of the complex representations ${ } ^ { r } D _ { j }$ and ${ } ^ { r } D _ { l }$ . Obviously, the Clebsch-Gordan coefficients can be chosen to be exactly the same as before, and thus they are again real. + +Let the above isomorphism be called $f$ . Now, we can view all involved vector spaces as $\mathbb { R }$ -vector spaces as well. Furthermore, we have subspaces $^ r V _ { j } = \mathbb { R } ^ { 2 j + 1 }$ , ${ } ^ { r } V _ { l } = \mathbb { R } ^ { 2 l + 1 }$ and ${ } ^ { r } V _ { J } = \mathbb { R } ^ { 2 J + 1 }$ which are also invariant under the representations ${ } ^ { r } \bar { D } _ { j }$ , ${ \bf \Delta } ^ { r } D _ { l }$ and ${ } ^ { r } D _ { J }$ . Consequently, we can just restrict the isomorphism above to a map + +$$ +f | : { ^ { r } V _ { j } } \otimes { ^ { r } V _ { l } } \sp { \bullet } \bigoplus _ { J = | l - j | } ^ { l + j } { ^ { r } V _ { J } } . +$$ + +which is well-defined since the Clebsch-Gordan coefficients are real. It needs to be injective, since it is a restriction of an isomorphism. For dimension reasons, the restriction then needs to be an isomorphism, and obviously, it has the exact same Clebsch-Gordan coefficients as the original map $f$ .33 + +# E.5.6 BRINGING EVERYTHING TOGETHER + +By what we’ve shown in the last sections, we see that the situation is basically the same as in Section E.4.5. The only thing that changes is that we now use the real spherical harmonics, and therefore the complex conjugation disappears. What this overall means is the following: let ${ } ^ { r } D _ { l } :$ $\mathrm { S O ( 3 ) } \mathrm { O } ( ^ { r } V _ { l } ) \bar $ and ${ } ^ { r } D _ { J } : \mathrm { S O } ( 3 ) { } \mathrm { O } ( { } ^ { r } V _ { J } )$ be the representations determining the input and output fields. Then a basis for steerable kernels $K : S ^ { 2 } \ { \overset { \cdot } { \to } } \ \operatorname { H o m } _ { \mathbb { R } } ( { } ^ { r } V _ { l } , { } ^ { r } V _ { J } )$ is given by kernels $K _ { j } \mathrm { : } S ^ { 2 } \mathrm { H o m } _ { \mathbb { R } } ( ^ { r } V _ { l } , ^ { r } V _ { J } )$ for all $| l - J | \leq j \leq l + J$ . The matrix elements are given by + +$$ +\langle J M | K _ { j } ( x ) | l n \rangle = \sum _ { m = - j } ^ { j } \langle J M | j m ; l n \rangle \cdot { } ^ { r } Y _ { j } ^ { m } ( x ) . +$$ + +# E.6 O(3)-STEERABLE KERNELS FOR COMPLEX REPRESENTATIONS + +In this section, we deal with O(3)-equivariant kernels for complex representations and then, in the next section, will transport the results over to real representations. In the earlier examples, we saw that the Peter-Weyl decomposition of $L _ { \mathbb { K } } ^ { 2 } ( X )$ always contained each irreducible representation of the symmetry group exactly once. The example of O(3) is the first in which this is not the case: parity will play a role in determining which irreducible representations make their way in the space of square-integrable functions and which do not. Overall, we hope that the example of O(3) is a sufficient justification for our use of the multiplicities $m _ { j }$ of irreducible representations that we considered in all our theorems. $\mathrm { O ( 3 ) }$ -equivariant networks are to the best of our knowledge not described in any published work yet. + +# E.6.1 THE IRREDUCIBLE REPRESENTATIONS OF O(3) + +The most important observation is the following, after which we can deduce the irreducible representations of O(3) from those of SO(3): + +Lemma E.20. Let $\mathbb { Z } _ { 2 } : = ( \{ - 1 , + 1 \} , \cdot )$ be the group with two elements. Then the map + +$$ +\cdot : \mathbb { Z } _ { 2 } \times \operatorname { S O } ( 3 ) \to \operatorname { O } ( 3 ) , ( s , g ) \mapsto s g +$$ + +is an isomorphism of groups. + +Proof. It is a group homomorphism since $s \in \{ - 1 , + 1 \}$ can be represented by a multiple of the identity matrix, and as such it commutes with every matrix $g$ . That $\cdot$ is an isomorphism follows since all matrices in O(3) either have determinant 1 or $- 1$ . The matrices with determinant 1 form $\mathrm { S O ( 3 ) }$ and are the image of $\{ + 1 \} \times \mathrm { S O } ( 3 )$ . The matrices with determinant $- 1$ are the image of $\{ - 1 \} \times \mathrm { S O } ( 3 )$ . □ + +Note the fact that for $g \in \mathrm { S O } ( 3 )$ , $- g$ has determinant $- 1$ , which we used in the proof. This does only hold for $g \in \mathrm { S O } ( d )$ with $d$ being odd. Therefore, the above lemma is not true for $d$ even. In the even case, we obtain a semidirect product and the story complicates somewhat. + +Earlier, we already considered tensor product representations of one and the same group. A related notion is that of tensor product representations of two different groups:34 + +Definition E.21 (Tensor Product Representation). Let $G$ and $H$ be two compact groups. Let $\rho _ { G } :$ $G \to { \mathrm { G L } } ( V _ { G } )$ and $\rho _ { H } : H \to { \mathrm { G L } } ( { \bar { V } } _ { H } )$ be representations of the two groups $G$ and $H$ . Then the tensor product representation is given by + +$$ +\begin{array} { r l } & { \rho _ { G } \otimes \rho _ { H } : G \times H \to { \mathrm { G L } } ( V _ { G } \otimes V _ { H } ) , } \\ & { \left[ \left( \rho _ { G } \otimes \rho _ { H } \right) ( g , h ) \right] ( v _ { G } \otimes v _ { H } ) : = \rho _ { G } ( g ) ( v _ { G } ) \otimes \rho _ { H } ( h ) ( v _ { H } ) . } \end{array} +$$ + +This is again a linear representation. + +Proposition E.22. Representatives of isomorphism classes of irreducible representations of $G \times H$ are given precisely by all the $\rho _ { G } \otimes \rho _ { H }$ , where $\rho _ { G }$ and $\rho _ { H }$ run through representatives of isomorphism classes of irreducible representations of $G$ and $H$ , respectively. + +Proof. This is proven in chapter II, Proposition 4.14 and 4.15 of Brocker & Dieck (2003). ¨ + +It is important to note that the proof of the above proposition uses the property of the complex numbers to be algebraically closed in crucial steps, and therefore it is unclear how exactly a generalization to representations over the real numbers looks like. Therefore, we will not use the above proposition in our later considerations for real representations of O(3). + +However, in our current situation, we can apply it without problems. This proposition, together with Lemma E.20, suggests that we should understand the irreducible representations of $\mathbb { Z } _ { 2 }$ . We already saw this for real representations before and essentially obtain the same result: + +Lemma E.23. The irreducible representations of $\mathbb { Z } _ { 2 }$ are up to equivalence precisely the following two, which we state for simplicity only on the generator: + +$$ +\begin{array} { r l } & { \rho _ { + } : \mathbb { Z } _ { 2 } \to { \mathrm { G L } } ( \mathbb { C } ) , \rho _ { + } ( - 1 ) = \mathrm { i d } _ { \mathbb { C } } } \\ & { \rho _ { - } : \mathbb { Z } _ { 2 } \to { \mathrm { G L } } ( \mathbb { C } ) , \rho _ { - } ( - 1 ) = - \mathrm { i d } _ { \mathbb { C } } . } \end{array} +$$ + +Proof. This can be shown in exactly the same way as in Section E.3.1. + +Thus we are ready to state our result about the irreducible representations of $\mathrm { O ( 3 ) }$ : + +Proposition E.24. The irreducible representations of O(3) are up to equivalence given as follows: for each $l \in \mathbb { N } _ { \geq 0 }$ there are precisely two representations $\overline { { D _ { l + } } } : \mathrm { O } ( 3 ) \to \mathrm { U } ( V _ { l + } )$ and $D _ { l - } : \mathrm { O } ( 3 ) \to$ $\mathrm { U } ( V _ { l - } )$ with $\bar { V _ { l + } } = \mathbb { C } ^ { 2 l + 1 } = V _ { l - }$ , given as follows: + +$$ +\begin{array} { r l } & { D _ { l + } ( s g ) = D _ { l } ( g ) ~ f o r { a l l } s \in \mathbb { Z } _ { 2 } , ~ g \in \mathrm { S O ( 3 ) } . } \\ & { D _ { l - } ( s g ) = s D _ { l } ( g ) f o r { a l l } s \in \mathbb { Z } _ { 2 } , ~ g \in \mathrm { S O ( 3 ) } . } \end{array} +$$ + +Proof. Remember from Section E.4.1 that the irreducible representations of $\mathrm { S O ( 3 ) }$ are given by the Wigner D-matrices $D _ { l }$ . From Lemma E.23 we know that the irreducible representations of $\mathbb { Z } _ { 2 }$ are given by $\rho _ { + }$ and $\rho _ { - }$ . From the isomorphism ${ \bf O } ( 3 ) \cong { \bf Z } _ { 2 } \times \mathrm { S O } ( 3 )$ from Lemma E.20 and from Proposition E.22 we thus obtain that the irreducible representations of O(3) are precisely given by all $\rho _ { + } \otimes D _ { l }$ and $\rho _ { - } \otimes D _ { l }$ . We now show that $\rho _ { - } \otimes D _ { l }$ is equivalent to $D _ { l - }$ : We have + +$$ +\rho _ { - } \otimes D _ { l } : \operatorname { O } ( 3 ) \to \operatorname { G L } ( \mathbb { C } \otimes V _ { l } ) , \ \left[ ( \rho _ { - } \otimes D _ { l } ) ( s g ) \right] ( z \otimes v ) = s z \otimes \left[ D _ { l } ( g ) \right] ( v ) . +$$ + +Now, consider the linear isomorphism $f : \mathbb { C } \otimes V _ { l } V _ { l + }$ , $z \otimes v \mapsto z v$ . We only need to check that it is equivariant and are then done: + +$$ +\begin{array} { r l } & { f \big ( \left[ ( \rho _ { - } \otimes D _ { l } ) ( s g ) \right] ( z \otimes v ) \big ) = f \big ( s z \otimes \left[ D _ { l } ( g ) \right] ( v ) \big ) } \\ & { \qquad = s z \cdot \left[ D _ { l } ( g ) \right] ( v ) } \\ & { \qquad = [ s D _ { l } ( g ) ] ( z v ) } \\ & { \qquad = [ D _ { l - } ( s g ) ] ( f ( z \otimes v ) ) . } \end{array} +$$ + +The statement about $D _ { l + }$ can be shown using the exact same map $f$ . + +34It is not a direct generalization due to the presence of two different group elements being applied. + +E.6.2 THE PETER-WEYL THEOREM FOR $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ AS REPRESENTATION OF O(3) + +The considerations in this section follow almost entirely from Section E.4.2. There we saw that, as a representation over SO(3), we have a decomposition + +$$ +L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } ) = { \widehat { \bigoplus _ { l \geq 0 } } } V _ { l 1 } +$$ + +with the spaces $V _ { l 1 }$ being spanned by the spherical harmonics $Y _ { l } ^ { n }$ , $n = - l , \ldots , l$ . We immediately see that in $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ , viewed as a representation over O(3), there is not enough space for all the irreducible representations, since they appear in pairs as shown in Proposition E.24.35 Thus, we need to figure out which irreducible representations are present and which are not. The core of this question is answered by the following proposition: + +Lemma E.25 (Parity in spherical harmonics). The spherical harmonics obey the following parity rules: + +$$ +Y _ { l } ^ { n } ( s x ) = s ^ { l } \cdot Y _ { l } ^ { n } ( x ) +$$ + +for all $l \geq 0$ , $n = - l , \ldots , l$ , $s \in \mathbb { Z } _ { 2 }$ and $x \in S ^ { 2 }$ . + +Proof. This is a well-known property of the spherical harmonics. + +Thus, together with Section E.4.2 we get the following transformation behavior of spherical harmonics under the group O(3), where $s \in \mathbb { Z } _ { 2 }$ and $g \in \mathrm { S O } ( 3 )$ : + +$$ +\begin{array} { l } { { \displaystyle \lambda ( s g ) ( Y _ { l } ^ { n } ) = s ^ { l } \lambda ( g ) ( Y _ { l } ^ { n } ) } } \\ { { \displaystyle = s ^ { l } \sum _ { n ^ { \prime } = - l } ^ { l } D _ { l } ^ { n ^ { \prime } n } ( g ) Y _ { l } ^ { n ^ { \prime } } } } \\ { { \displaystyle = \sum _ { n ^ { \prime } = - l } ^ { l } \left( s ^ { l } D _ { l } ^ { n ^ { \prime } n } ( g ) \right) Y _ { l } ^ { n ^ { \prime } } } } \\ { { \displaystyle = \left\{ \sum _ { n ^ { \prime } = - l } ^ { l } D _ { l + } ^ { n ^ { \prime } n } ( s g ) Y _ { l } ^ { n ^ { \prime } } , l \mathrm { ~ e v e n } \right. } } \end{array} +$$ + +Thus, we obtain the following decomposition of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ : + +$$ +L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } ) = \widehat { \bigoplus _ { l \geq 0 } } V _ { l 1 + } \oplus \widehat { \bigoplus _ { l \geq 0 \atop l \mathrm { o d d } } } V _ { l 1 - } . +$$ + +Here, $V _ { l 1 + }$ and $V _ { l 1 - }$ are generated from the spherical harmonics of order $l$ and we have $V _ { l 1 + } \cong V _ { l + }$ and $V _ { l 1 - } \cong V _ { l - }$ as representations according to the transformation behavior we saw above. + +E.6.3 THE CLEBSCH-GORDAN DECOMPOSITION + +Remember from Section E.4.3 that we have a decomposition of SO(3)-representations + +$$ +V _ { j } \otimes V _ { l } \cong \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J } +$$ + +given by real Clebsch-Gordan coefficients. Now for O(3), remember that as vector spaces we have for all $j$ (and equally for $l$ and $J$ ) equalities $V _ { j } = V _ { j - } = V _ { j + }$ , and so we guess that in the isomorphism above, we just need to figure out the correct signs in order to be compatible with the + +corresponding representations. The idea is that “multiplying the signs at the left” should lead to the “sign at the right”, and this paradigm leads us to believe that there are the following isomorphisms: + +$$ +\begin{array} { l l } { { V _ { j + } \otimes V _ { l + } \cong \displaystyle \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J + } , } } & { { V _ { j + } \otimes V _ { l - } \cong \displaystyle \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J - } , } } \\ { { V _ { j - } \otimes V _ { l + } \cong \displaystyle \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J - } , } } & { { V _ { j - } \otimes V _ { l - } \cong \displaystyle \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J + } . } } \end{array} +$$ + +Wethat $f : V _ { j } \otimes V _ { l } \to \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J }$ rphism since the arguments are always the same. So, assumeis an isomorphism and thus in particular intertwines the given representations. Now, we take the exact same map $f : V _ { j - } \otimes V _ { l + } \to \bigoplus _ { J = | l - j | } ^ { l + j } V _ { J - }$ and only need to figure out that it is equivariant with respect to the given representations, using the same property for the original isomorphism we started with: + +$$ +\begin{array} { l } { { { \displaystyle f \circ \left[ D _ { j - } ( s g ) \otimes D _ { l + } ( s g ) \right] = f \circ \left[ s ( D _ { j } ( g ) \otimes D _ { l } ( g ) ) \right] } } } \\ { { { } } } \\ { { { } = s \bigoplus _ { { \scriptstyle { J = | l - j | } \atop { { \scriptstyle l + j } } \atop { { \scriptstyle J = | l - j | } \atop { { \scriptstyle J = | l - j | } \atop { { \scriptstyle J = | l - j | } \atop { { \scriptstyle J = | l - j | } \atop { { \scriptstyle J = | l - j | } \atop { { \scriptstyle J = | l - j | } } } } } } } } } } } \\ { { { { } } } } \end{array} +$$ + +This shows the claim. From these considerations, it also follows that the Clebsch-Gordan coefficients do not in any way depend on the signs of the spaces $V _ { j } , V _ { l } , V _ { J }$ . Thus, we write them generically as $\langle J M | j m ; l n \rangle$ . + +# E.6.4 ENDOMORPHISMS OF $V _ { J }$ + +As always over C, Schur’s Lemma D.8 shows that the endomorphism spaces are 1-dimensional, and thus we can ignore endomorphisms. + +# E.6.5 BRINGING EVERYTHING TOGETHER + +Now we can finally compute the basis for steerable kernels. The section on the Clebsch-Gordan decomposition suggests that we need to do a case distinction for this. Namely, the possible kernels depend on the signs of $V _ { l }$ and $V _ { J }$ . The results basically follow analogously to the results in Section E.4.5. + +STEERABLE KERNELS $K : S ^ { 2 } \operatorname { H o m } _ { \mathbb { C } } ( V _ { l + } , V _ { J + } )$ : + +$V _ { J + }$ can only be in a tensor product $V _ { j } \otimes V _ { l + }$ if the sign of $j$ is positive. Spaces $V _ { j 1 + }$ appear in the tensor product decomposition of $L _ { \mathbb { C } } ^ { 2 } ( S ^ { 2 } )$ precisely for even $j$ , according to Section E.6.2. Thus, a basis for steerable kernels is given by all $K _ { j }$ with even $j \in \left\{ | l - J | , \ldots , l + J \right\}$ . It has matrix elements + +$$ +\langle J M | K _ { j } ( x ) | l n \rangle = \sum _ { m = - j } ^ { j } \langle J M | j m ; l n \rangle \cdot \overline { { Y _ { j } ^ { m } } } ( x ) , +$$ + +exactly as in Section E.4.5. + +STEERABLE KERNELS $K : S ^ { 2 } \operatorname { H o m } _ { \mathbb { C } } ( V _ { l + } , V _ { J - } )$ : + +Analogously, a basis for steerable kernels is given by all $K _ { j }$ , with odd $j \in \left\{ | l - J | , \dots , l + J \right\}$ . + +STEERABLE KERNELS $K : S ^ { 2 } \operatorname { H o m } _ { \mathbb { C } } ( V _ { l - } , V _ { J + } )$ : + +Again, a basis for steerable kernels is given by all $K _ { j }$ with odd $j \in \left\{ | l - J | , \dots , l + J \right\}$ . + +STEERABLE KERNELS $K : S ^ { 2 } \operatorname { H o m } _ { \mathbb { C } } ( V _ { l - } , V _ { J - } )$ : + +As in the first case, a basis for steerable kernels is given by all $K _ { j }$ with even $j \in \left\{ | l - J | , \dots , l + J \right\}$ . + +Thus, we have determined all kernel bases for the group O(3) over the complex numbers. Compared to SO(3), we see that the kernel spaces get roughly halved. The reason for this is that with a bigger symmetry group, the kernel needs to obey more rules, which means that the kernel constraint has fewer solutions. + +# E.7 O(3)-STEERABLE KERNELS FOR REAL REPRESENTATIONS + +Basically, we can argue exactly as in Section E.5.4 in order to transport the results for complex representations over to the real world. We shortly sketch the procedure and outcome. As we know from Section E.3.1, $\rho _ { - } : \mathbb { Z } _ { 2 } \to \operatorname { O } ( \mathbb { R } )$ and $\rho _ { + } : \mathbb { Z } _ { 2 } \to \operatorname { O } ( \mathbb { R } )$ are the only irreducible real representations of $\mathbb { Z } _ { 2 }$ . Thus, for each $l \geq 0$ we obtain two irreducible real representations $^ { r } D _ { l + } : \mathrm { O } ( 3 ) \to \mathrm { O } ( ^ { r } V _ { l + } )$ and ${ } ^ { r } D _ { l - } : \mathrm { O ( 3 ) } \mathrm { O } ( { } ^ { r } V _ { l - } )$ . As before, they also act on complex vector spaces and are as such isomorphic to the complex irreducible representations of O(3). One can then show as in Lemma E.17 that all complex irreducible representations are of real type since they split into two copies of the real version of this representation. Thus, by Corollary E.18, all real irreducible representations are of real type, and this means that we can proceed exactly as in Proposition E.19 in order to show that the $^ r D _ { l + }$ and ${ } ^ { r } D _ { l - }$ are already all the irreducible real representations of O(3) up to equivalence. + +For the Peter-Weyl decomposition of $L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } )$ , we only need to note that the real spherical harmonics emerge with a base change from the complex ones, as seen in Eq. (31), and thus fulfill the same parity rules as the complex spherical harmonics. This gives us a decomposition + +$$ +L _ { \mathbb { R } } ^ { 2 } ( S ^ { 2 } ) = \widehat { \bigoplus _ { l \geq 0 \atop l \mathrm { e v e n } } } ( ^ { r } V _ { l 1 + } ) \oplus \widehat { \bigoplus _ { l \geq 0 \atop l \mathrm { o d d } } } ( ^ { r } V _ { l 1 - } ) . +$$ + +For the Clebsch-Gordan coefficients, we again get decompositions + +$$ +{ } ^ { r } V _ { j } \otimes { } ^ { r } V _ { l } \cong \bigoplus _ { J = | l - j | } { } ^ { r } V _ { J } +$$ + +where the signs on the left must “multiply to” the signs on the right, as in Section E.6.3. Finally, the endomorphism spaces must be 1-dimensional since the endomorphism spaces of the complex versions are 1-dimensional. + +Overall, we obtain the same kernels as in Section E.6.5, only that we need to use the real spherical harmonics as our steerable filters and can get rid of the complex conjugation. + +# F MATHEMATICAL PRELIMINARIES + +In this chapter, we state mathematical preliminaries that we use throughout the earlier chapters. In this whole chapter, K is one of the two fields $\mathbb { R }$ or C. + +F.1 TOPOLOGICAL SPACES, NORMED SPACES, AND METRIC SPACES + +Since in this work, we want to develop the theory of representations over compact groups, and since this is a topological property, we need to formulate some topological concepts (Conway, 2014). Additionally, the vector spaces on which our compact groups act also carry a topology, mostly coming from their Hilbert space structure. + +Definition F.1 (Topological Space, Open Sets, Closed Sets). A topological space $( X , \tau )$ consists of a set $X$ and a set $\tau$ of subsets of $X$ , called the open sets, such that arbitrary unions and finite intersections of open sets are open. In particular, $X$ and the empty set $\varnothing$ are open. Closed sets are the complements of open sets and fulfill dual axioms: arbitrary intersections and finite unions of closed sets are closed. + +Let in the following $X$ and $Y$ be topological spaces. + +Definition F.2 (Open Neighborhood). Let $x \in X$ . An open set $U \subseteq X$ is called open neighborhood of $x$ if $x \in U$ . + +Definition F.3 (Hausdorff Space). $X$ is called a Hausdorff space if two distinct points can always be separated by open sets, i.e., for all $x , y \in X$ there exist $U _ { x } , U _ { y }$ open such that $x \in U _ { x } , y \in U _ { y }$ , and $U _ { x } \cap U _ { y } = \emptyset$ . + +In this work, all topological spaces are Hausdorff. + +Definition F.4 (Subspace). Assume $A \subseteq X$ is a subset. Then the set $\mathcal { T } _ { A } : = \{ U \cap A | U \in \mathcal { T } \}$ is a topology for $A$ and thus makes $A$ a topological space as well. It is called a subspace of $X$ . + +Whenever we consider a subset of a topological space, it is viewed as a topological space with this construction. + +Definition F.5 (Closure, Density). For $A \subseteq X$ , its closure $\overline { { A } }$ is defined as the smallest closed subset of $X$ that contains $A$ . Equivalently, it is the intersection of all closed subsets of $X$ containing $A$ , which is closed by the axioms of a topology. $A$ is called dense in $X$ if ${ \overline { { A } } } = X$ . + +Definition F.6 (Continuous Function, Homeomorphism). A function $f : X \to Y$ is called continuous if preimages of open sets are always open. Equivalently, for each point $x _ { 0 } \in X$ and each open neighborhood $V$ of $f { \bar { ( x _ { 0 } ) } }$ there is an open neighborhood $U$ of $x _ { 0 }$ such that $f ( U ) \subseteq V$ . + +A homeomorphism is a continuous bijective function with a continuous inverse. + +Note that compositions of continuous functions are continuous as well. + +Definition F.7 (Open Cover, Compact Space). An open cover of $X$ is a family of open sets $\{ U _ { i } \} _ { i \in I }$ that cover $X$ , i.e., $\textstyle X = \bigcup _ { i \in I } U _ { i }$ . $X$ is called compact if all open covers have a finite subcover, that is: For all open covers $\{ U _ { i } \} _ { i \in I }$ there exists a finite subset $J \subseteq I$ such that $\{ U _ { i } \} _ { i \in J }$ is still an open cover of $X$ . + +Proposition F.8. If $X$ is compact and $f : X \to Y$ is continuous, then $f ( X ) \subseteq Y$ is compact as well. In particular, if $f$ surjective, then $Y$ is compact. + +Proof. See Sutherland (1975), Proposition 13.15. + +Proposition F.9. Let $f : X \to Y$ be a continuous bijection and assume that $X$ is compact and that $Y$ is Hausdorff. Then the inverse $f ^ { - 1 }$ is continuous as well and thus $f$ is a homeomorphism. + +Proof. See Sutherland (1975), Proposition 13.26. + +Definition F.10 (Product Topology). The product topology on $X \times Y$ is the coarsest (i.e., smallest in terms of inclusion) topology that makes both projections $p _ { X } : X \times Y \to X$ and $p _ { Y } : X \times Y Y$ continuous. + +If $Z$ is a third topological space and we have two continuous functions $f _ { X } : Z \to X$ and $f _ { Y } : Z \to$ $Y$ , then the function $f _ { X } \times f _ { Y } : Z \to X \times Y$ , $z \mapsto ( f _ { X } ( z ) , f _ { Y } ( z ) )$ is continuous as well. + +Definition F.11 (Quotient Map, Quotient Space). A continuous function $f : X \to Y$ is called a quotient map if $f$ is surjective and if $U \subseteq Y$ is open if and only if $f ^ { - 1 } ( U ) \subseteq X$ is open. + +Let $\sim$ be any equivalence relation on $X$ and $X / \sim$ be the quotient set formed by identifying equivalent elements. Let $q : X \to X / { \sim }$ be the canonical function sending each element to its equivalence class. We define $U \subseteq X / \sim$ to be open if $q ^ { - 1 } ( U ) \subseteq X$ is open. Then $q$ is a quotient map and $X / \sim$ is called a quotient space. + +Proposition F.12 (Universal property of Quotient Maps). Let $q : X \to X / { \sim }$ be a standard quotient map and $f : X \to Y$ be any continuous function such that $f ( x ) = f ( x ^ { \prime } )$ whenever $x \sim x ^ { \prime }$ . Then there is a unique continuous function ${ \overline { { f } } } : X / { \sim } \to Y$ such that the following diagram commutes: + +$$ + \begin{array} { c c c } { { X \stackrel { f } { \longrightarrow } Y } } \\ { { q \downarrow \stackrel { } { } \stackrel { \overline { { { f } } } } { f } } } \end{array} +$$ + +$\overline { { f } }$ is given on equivalence classes by ${ \overline { { f } } } ( [ x ] ) = f ( x )$ . + +Proof. See Conway (2014), Proposition 2.8.7. + +It can be shown that all quotient maps are equivalent to a construction of the form $q : X \to X / { \sim }$ . Namely, for a quotient map $f : X \to Y$ , define $\sim$ by $x \sim x ^ { \prime }$ if $f ( x ) = f ( x ^ { \prime } )$ . Then the map ${ \overline { { f } } } : X / { \sim } \to Y$ , $[ x ] \mapsto f ( x )$ is a well-defined continuous map by the universal property of quotient maps Proposition F.12. One can show that this is a homeomorphism. Thus for a quotient map $f : X \to Y$ we also call $Y$ a quotient space. + +Our route for defining concrete topologies is in most cases through the existence of inner products on Hilbert spaces, which will be defined in detail in Definition F.32. Namely, inner products define norms, which define metrics (Kaplansky, 2001), which in turn define topologies. For this, we need some definitions: + +Definition F.13 (Norm). Let $V$ be a $\mathbb { K }$ -vector space, A norm on $V$ is a map $\| \cdot \| : V \to \mathbb { R } _ { \ge 0 }$ with the following properties for all $\lambda \in \mathbb { K }$ and $v , w \in V$ : + +1. $\| v \| = 0$ if and only if $v = 0$ . +2. $\| \lambda v \| = | \lambda | \cdot \| v \|$ . +3. Triangle inequality: $\| v + w \| \leq \| v \| + \| w \|$ . + +If $\langle \cdot | \cdot \rangle : V \times V \to \mathbb { K }$ is an inner product on a Hilbert space, then it defines a norm $\| \cdot \| : V \to \mathbb { R } _ { \ge 0 }$ by $\| x \| : = { \sqrt { \langle x | x \rangle } }$ . + +Definition F.14 (Metric). Let $Y$ be a set. A metric on $Y$ is a function $d : Y \times Y \to \mathbb { R } _ { \geq 0 }$ with the following properties for all $x , y , z \in Y$ : + +1. $d ( x , y ) = 0$ if and only if $x = y$ . +2. Symmetry: $d ( x , y ) = d ( y , x )$ . +3. Triangle inequality: $d ( x , z ) \leq d ( x , y ) + d ( y , z )$ . + +A norm $\| \cdot \| : V \to \mathbb { R } _ { \ge 0 }$ defines a metric $d : V \times V \to \mathbb { R }$ by setting $d ( x , y ) : = \| x - y \|$ . In turn, a metric defines a topology as follows: open balls are given by all sets of the form $\mathrm { B } _ { \epsilon } ( x ) : = \{ y \in$ $V \mid d ( x , y ) < \epsilon \}$ for all $x \in V$ and $\epsilon > 0$ . Open sets are then defined as arbitrary unions of arbitrary open balls. + +Additionally, we need notions about convergence in this work. Since we will deal with them mostly in the context of metric spaces (with normed vector spaces and Hilbert spaces being special cases, as explained above), we focus on these notions for metric spaces. + +Definition F.15 (Convergent Sequence). Let $Y$ be a metric space. Then a sequence $( y _ { k } ) _ { k }$ in $Y$ is said to converge to $y$ if for all $\epsilon > 0$ there is a $k _ { \epsilon } \in \mathbb { N }$ such that $y _ { k } \in \mathrm { B } _ { \epsilon } ( y )$ for all $k \geq k _ { \epsilon }$ . + +With this in mind, one can give an equivalent definition of continuity that applies to metric spaces: + +Definition F.16 (Continuity in Metric Spaces). A function $f : Y \to Z$ between metric spaces is continuous in $y \in Y$ if for each sequence $( y _ { k } ) _ { k }$ of points $y _ { k } \in Y$ converging to a point $y \in Y$ , we also have that the sequence $f ( y _ { k } )$ converges to $f ( y )$ . This can be understood in terms of the function “commuting with limits”: + +$$ +\operatorname* { l i m } _ { k \to \infty } f ( y _ { k } ) = f { \big ( } \operatorname* { l i m } _ { k \to \infty } y _ { k } { \big ) } . +$$ + +Furthermore, $f : Y \to Z$ is called continuous if it is continuous in all points $y \in Y$ . + +Equivalently, the following holds: $f : Y \to Z$ is continuous in $y \in Y$ if and only of for all $\epsilon > 0$ there is a $\delta > 0$ such that $f \left( \mathrm { B } _ { \delta } ( y ) \right) \subseteq \mathrm { B } _ { \epsilon } ( f ( y ) )$ . + +Definition F.17 (Uniform Continuity). A function $f : Y \to Z$ between metric spaces is called uniformly continuous if for each $\epsilon > 0$ there is a $\delta > 0$ such that for all $y , y ^ { \prime } \in Y$ with $d _ { Y } ( y , y ^ { \prime } ) < \delta$ we obtain $d _ { Y } ( f ( y ) , f ( y ^ { \prime } ) ) < \epsilon$ . + +The following is a result we use several times in the main text: + +Proposition F.18. Let $f : V \to V ^ { \prime }$ be a linear function between normed vector spaces. Then the following are equivalent: + +1. $f$ is uniformly continuous. + +2. $f$ is continuous. + +3. $f$ is continuous in 0. + +Proof. Trivially, 1 implies 2, which in turn implies 3. Now assume 3, i.e., $f$ is continuous in 0. Let $\epsilon > 0$ . Then by continuity in 0, there exists $\delta > 0$ such that for all $v \in V$ with $\| v \| = \| v - 0 \| < \delta$ we obtain $\| f ( v ) \| = \| f ( v ) - f ( 0 ) \| < \epsilon$ . Now let $v , v ^ { \prime } \in V$ be arbitrary with $\| v - v ^ { \prime } \| < \delta$ . Then by the linearity of $f$ we obtain: + +$$ +\| f ( v ) - f ( v ^ { \prime } ) \| = \| f ( v - v ^ { \prime } ) \| < \epsilon , +$$ + +which is exactly what we wanted to show. + +Sometimes, sequences look like they converge since their elements get ever closer to each other. However, not all such sequences need to converge. Therefore, there is the following notion: + +Definition F.19 (Cauchy Sequence). Let $Y$ be a metric space. A sequence $( y _ { k } ) _ { k }$ in $Y$ is a Cauchy Sequence if for all $\epsilon > 0$ there is $k _ { \epsilon } \in \mathbb { N }$ such that for all $\bar { k } , k ^ { \prime } > k _ { \epsilon }$ we have $d ( y _ { k } , y _ { k ^ { \prime } } ) < \epsilon$ . + +For example, one can consider the metric space $\mathbb { R } \backslash \{ 0 \}$ together with the usual metric. Then the sequence $\left( { \frac { 1 } { k } } \right) _ { k }$ is a Cauchy sequence but does not converge since the limit (in R!), which would be 0, is not in $\mathbb { R } \stackrel { \cdot } { | } \{ 0 \}$ . Thus, the following notion is useful: + +Definition F.20 (Complete Metric Space). A metric space $Y$ is called complete if every Cauchy sequence converges. + +Definition F.21 (Completion). Let $Y$ be a metric space. A completion of $Y$ is a metric space $Y ^ { \prime }$ which contains $Y$ as a dense subspace and such that $Y ^ { \prime }$ is complete. + +Proposition F.22 (Universal Property of Completions). Assume that $Y \subseteq Y ^ { \prime }$ is a pair of metric spaces, where $Y ^ { \prime }$ is a completion of $Y$ . Then the following universal property holds: + +Let $Z$ be any complete metric space and $f : Y \to Z$ be any uniformly continuous function. Then there is a unique continuous function $f ^ { \prime } : Y ^ { \prime } \to Z$ that extends $f$ , i.e., such that $f ^ { \prime } | _ { Y } = f$ . $f ^ { \prime }$ furthermore is also uniformly continuous. This can be expressed by the following commutative diagram, where $i : Y \to Y ^ { \prime }$ is the canonical inclusion: + +$$ +\begin{array} { l } { { Y \xrightarrow { \quad f \quad } Z } } \\ { { \Biggl \downarrow i { \Biggl \downarrow } ^ { \quad } } } \\ { { Y ^ { \prime } } } \end{array} +$$ + +Proof. See, for example, Kaplansky (2001). + +Definition F.23 (Boundedness). Let $Y$ be a metric space. A subset $A \subseteq Y$ is called bounded if there is a constant $C > 0$ such that $d ( a , b ) \leq C$ for all $a , b \in A$ . + +Theorem F.24 (Heine-Borel Theorem). A subset $A \subseteq \mathbb { K } ^ { d }$ is compact if and only if it is closed and bounded. + +Proof. See Conway (2014), Theorem 1.4.8. + +Corollary F.25 (Extreme Value Theorem). Let $f : X \to \mathbb { R }$ be continuous, where $X$ is any nonempty compact topological space. Then $f$ has a maximum and a minimum. + +Proof. By Proposition F.8, $f ( X ) ~ \subseteq \mathbb { R }$ is compact. By Theorem F.24 this means that $f ( X )$ is closed and bounded. Boundedness means that the supremum is finite and closedness means that the supremum must lie in $f ( X )$ , and consequently it is a maximum. For the minimum, the same arguments apply. □ + +# F.2 LIMITS OF NETS AND APPROXIMATED DIRAC DELTA FUNCTIONS + +In this section, we discuss “limits of nets”, where a net can be imagined as a sequence over an index set which may be “too big to be handled as a sequence over the natural numbers”. They appear in the formulation of Theorem C.7. This material can, for example, be found in (Conway, 2014). + +Definition F.26 (Partially Ordered Set, Directed Set). Let $I$ be an index set and $\leq$ a relation on it. $I = ( I , \leq )$ is a partially ordered set if: + +1. $\leq$ is reflexive, i.e., $i \leq i$ for all $i \in I$ + +2. $\leq$ is antisymmetric, that is: $i \leq j$ and $j \le i$ together imply $i = j$ . + +3. $\leq$ is transitive, that is: $i \leq j$ and $j \le k$ together imply $i \leq k$ . + +A partially ordered set $I$ is called directed if for all $i , j \in I$ there exists $k \in I$ such that $i \leq k$ and $j \le k$ . + +Example F.27. Clearly, the natural numbers together with the standard order relation form a directed set. + +An important example for our purposes is the following: let $Z$ be any topological space (for example, a homogeneous space $X$ of a compact group $G$ ) and $x \in Z$ be any point. Furthermore, define $\mathcal { U } _ { x }$ as the set of open neighborhoods of $x$ , i.e., open sets $U \subseteq Z$ such that $x \in U$ . On this set, we define $U \leq V$ if $U \supseteq V$ , i.e., by reversed inclusion. Then $( { { \mathcal { U } } _ { x } } , \le )$ is a directed set: + +1. Reflexivity is clear since $V \supseteq V$ for all $V$ . + +2. Antisymmetry is clear since $U \supseteq V$ and $V \supseteq U$ together clearly imply $U = V$ . + +3. Transitivity is clear since $U \supseteq V$ and $V \supseteq W$ together clearly imply $U \supseteq W$ . + +4. For directedness, let $U , V \in \mathcal { U } _ { x }$ . Define $W = U \cap V$ . Then $W \in \mathcal { U } _ { x }$ and clearly $U \supseteq W$ and $V \supseteq W$ , which is what was to show. + +Note that $\mathcal { U } _ { x }$ is usually not totally ordered, i.e., there are usually $U , V \in \mathcal { U } _ { x }$ such that neither $U \supseteq V$ nor $V \supseteq U$ . + +Definition F.28 (Net). Let $Z$ be any topological space and $I$ a directed set. Then a net in $Z$ is a function $x : I Z$ . We write a net as $( x _ { i } ) _ { i \in I }$ , in analogy to sequences. + +Definition F.29 (Convergence of Nets). Let $( x _ { i } ) _ { i \in I }$ be a net in a topological space $Z$ . Let $x \in Z$ . We say that $( x _ { i } ) _ { i \in I }$ converges to $x$ , written $\operatorname* { l i m } _ { i \in I } x _ { i } \ = \ x$ , if the following holds: for all open neighborhoods $U$ of $x$ there is an $i _ { 0 } \in I$ such that for all $i \geq i _ { 0 }$ we have $x _ { i } \in U$ . + +Now we define the approximated Dirac delta for the special case that $X$ is a homogeneous space of a compact group $G$ . Remember that there is a Haar measure $\mu$ on $X$ . + +Definition F.30 (Approximated Dirac Delta). For $\varnothing \neq U \subseteq X$ open, we define the approximated Dirac delta by $\delta _ { U } : X \to \mathbb { K }$ with + +$$ +\delta _ { U } ( x ) = { \frac { 1 } { \mu ( U ) } } \cdot \mathbf { 1 } _ { U } ( x ) = { \left\{ { \frac { 1 } { \mu ( U ) } } , \ x \in U \right. } +$$ + +We have $\delta _ { U } \in L _ { \mathbb { K } } ^ { 2 } ( X )$ . + +A priori, it is unclear that open sets have positive measure, which is needed for the well-definedness of this construction, since otherwise we divide by zero. Thus, we need the following lemma: + +Lemma F.31. Let $\varnothing \neq U \subseteq X$ be an open set. Then $\mu ( U ) > 0$ . + +Proof. Consider the family of open sets $( g U ) _ { g \in G }$ . That all of these sets are necessarily open follows since the action $G \times X \to X$ is continuous, and thus by the definition of a group action, each $g \in G$ induces a homeomorphism $X \to X , x \mapsto g x$ . Now, since the action is transitive, $( g U ) _ { g \in G }$ is an open cover of $X$ , and since $X$ is compact, see Definition F.7, it has an open subcover $( g _ { i } U ) _ { i = 1 } ^ { n }$ with $g _ { i } \in G$ . Note that $\mu ( g _ { i } U ) = \mu ( U )$ for all $i$ since the measure $\mu$ on $X$ is by definition left invariant under the action of $G$ . Overall, we obtain + +$$ +1 = \mu ( X ) = \mu { \Biggr ( } \bigcup _ { i = 1 } ^ { n } g _ { i } U { \Biggr ) } \leq \sum _ { i = 1 } ^ { n } \mu ( g _ { i } U ) = \sum _ { i = 1 } ^ { n } \mu ( U ) = n \cdot \mu ( U ) +$$ + +and thus $\textstyle \mu ( U ) \geq { \frac { 1 } { n } } > 0$ . + +F.3 PRE-HILBERT SPACES AND HILBERT SPACES + +Here, we state foundational concepts in the theory of Hilbert spaces (Debnath & Mikusinski, 2005). Definition F.32 (pre-Hilbert Space, Hilbert space). A pre-Hilbert space $V = ( V , \langle \cdot | \cdot \rangle )$ consists of the following data: + +1. A vector space $V$ over K. + +2. An inner product $\langle \cdot | \cdot \rangle : V \times V \to \mathbb { K }$ , $( x , y ) \mapsto \langle x | y \rangle$ . + +It has the following properties that hold for all $x , x ^ { \prime } , y , y ^ { \prime } \in V , \lambda \in \mathbb { K }$ : + +1. The inner product is conjugate linear in the first component: $\langle x + x ^ { \prime } | y \rangle = \langle x | y \rangle + \langle x ^ { \prime } | y \rangle$ and $\langle \lambda x | y \rangle = { \overline { { \lambda } } } \langle x | y \rangle$ , where $\bar { \lambda }$ is the complex conjugate of $\lambda$ . + +2. The inner product is linear in the second component: $\langle x | y + y ^ { \prime } \rangle = \langle x | y \rangle + \langle x | y ^ { \prime } \rangle$ and $\langle x | \lambda y \rangle = \lambda \langle x | y \rangle$ . + +3. The inner product is conjugate symmetric: $\langle y | x \rangle = { \overline { { \langle x | y \rangle } } }$ + +4. The inner product is positive definite: $\langle x | x \rangle > 0$ unless $x = 0$ . + +If additionally, the following statement holds, then $V$ is called a Hilbert Space: + +5. $V$ , together with the norm $\| \cdot \| : V \to V$ induced from the inner product by $\| x \| : = { \sqrt { \langle x | x \rangle } }$ , and consequently the metric defined by $d ( x , y ) : = \| x - y \|$ , is a complete metric space as in Definition F.20. + +Remark F.33. Of course, all Hilbert Spaces are pre-Hilbert spaces, and so all Propositions about pre-Hilbert spaces in the following apply to Hilbert spaces just as well. + +Note that the first property follows from the second and third. We also mention that usually, inner products on Hilbert spaces are assumed to be linear in the first and conjugate linear in the second component, in contrast to how we view it. The reason for our choice is that our work is inspired by connections to physics where our convention is more common. It is basically the bra-ket convention. Furthermore, note that if $\mathbb { K } = \mathbb { R }$ , then conjugate linear maps are linear and thus the inner product will be linear in both components. Additionally, it will be symmetric instead of only conjugate symmetric. + +Proposition F.34 (Cauchy-Schwartz Inequality). For any two elements $v , w$ in a pre-Hilbert space $V$ , we have + +$$ +| \left. v | w \right. | \leq \| v \| \cdot \| w \| . +$$ + +We have equality if and only if v and w are linearly dependent. + +Proof. See Debnath & Mikusinski (2005), Theorem 3.2.9. + +Definition F.35 (Orthogonality). Two vectors $v , w$ in a pre-Hilbert space $V$ are called orthogonal, written $v \perp w$ , i $\mathbf { f } \langle v | w \rangle = 0$ . + +Obviously, being orthogonal is a symmetric relation. + +Definition F.36 (Orthogonal Complement). Let $V$ be a pre-Hilbert space and $W \subseteq V$ a subset. +$v \in V$ is orthogonal to $W$ if $\langle v \mid w \rangle = 0$ for all $w \in W$ . + +The orthogonal complement of $W$ , denoted $W ^ { \perp }$ , is the set of all vectors in $V$ that are orthogonal to $W$ . + +Proposition F.37 (Closedness of Complements). Let $W \subseteq V$ be a subset of a pre-Hilbert space $V$ Then $W ^ { \perp }$ is a topologically closed linear subspace of $V$ . + +Proof. See Debnath & Mikusinski (2005), Theorem 3.6.2. + +Proposition F.38 (Continuity of Scalar Product). For any pre-Hilbert space $V$ , the scalar product $\langle \cdot | \cdot \rangle : V \times V \to \mathbb { K }$ is continuous. + +Proof. See Debnath & Mikusinski (2005), Theorem 3.3.12. + +Definition F.39 (Orthonormal System). A family $( v _ { i } ) _ { i \in I }$ of elements in a pre-Hilbert space is called orthonormal system if $\lVert \boldsymbol { v } _ { i } \rVert = 1$ for all $i \in I$ and $v _ { i } \perp v _ { j }$ for all $i \neq j$ . + +Definition F.40 (Orthonormal Basis). An orthonormal system $( v _ { i } ) _ { i \in I }$ in a Hilbert space $V$ is called orthonormal basis if the linear span of all $\{ v _ { i } \} _ { i \in I }$ is dense in $V$ . If this is the case, then each $v \in V$ can be uniquely written as + +$$ +v = \sum _ { i \in I } \alpha _ { i } v _ { i } +$$ + +with only countably many $\alpha _ { i } \in \mathbb { K }$ being nonzero. The coefficients are given by $\alpha _ { i } = \langle v _ { i } | v \rangle$ + +We stress that while the index set $I$ can be uncountably infinite, the sequence expansions of each element in $V$ only have countably many entries. It is obvious from the Peter-Weyl Theorem B.22 and this definition that the functions + +$$ +\left\{ Y _ { l i } ^ { m } \mid l \in \widehat { G } , i \in \{ 1 , \ldots , m _ { l } \} , m \in \{ 1 , \ldots , d _ { l } \} \right\} +$$ + +form an orthonormal basis of $L _ { \mathbb { K } } ^ { 2 } ( X )$ + +Proposition F.41 (Gram-Schmidt Orthonormalization). For every linearly independent sequence $( y _ { k } ) _ { k }$ in a pre-Hilbert space $V$ with $N \in \mathbb { N } \cup \{ \infty \}$ elements, one can find an orthonormal sequence $( v _ { k } ) _ { k }$ in $V$ such that the following holds: for all $n \in \mathbb { N }$ , $n \leq N$ , the progressive linear span stays the same: + +$$ +\operatorname { s p a n } _ { \mathbb { K } } ( v _ { 1 } , \dots , v _ { n } ) = \operatorname { s p a n } _ { \mathbb { K } } ( y _ { 1 } , \dots , y _ { n } ) . +$$ + +In particular, since every finite-dimensional Hilbert space has a vector space basis, it necessarily also has an orthonormal basis. + +Proof. See Debnath & Mikusinski (2005), page 110. + +Definition F.42 (Adjoint of an Operator). Let $f : V \to V ^ { \prime }$ be a continuous linear function between Hilbert spaces. Then there is a unique continuous linear function $f ^ { * } : V ^ { \prime } \to V$ such that for all $v \in V$ and $v ^ { \prime } \in V ^ { \prime }$ one has: + +$$ +\langle f ( v ) | v ^ { \prime } \rangle _ { V ^ { \prime } } = \langle v | f ^ { * } ( v ^ { \prime } ) \rangle _ { V } . +$$ + +$f ^ { * }$ is called the adjoint of $f$ + +The existence of adjoints is, for example, discussed in Debnath & Mikusinski (2005), page 158. This book only considers the case of operators on a Hilbert space to itself, but these considerations generalize to the setting with two different Hilbert spaces. One has the following: + +Proposition F.43. Let $f : V \to V ^ { \prime }$ and $g : V ^ { \prime } \to V ^ { \prime \prime }$ be continuous linear functions between Hilbert spaces. Then: + +1. $( f ^ { * } ) ^ { * } = f .$ . +2. $\mathrm { i d } _ { V } ^ { * } = \mathrm { i d } _ { V }$ . +3. $( g \circ f ) ^ { * } = f ^ { * } \circ g ^ { * } .$ . + +Proof. All of these properties follow directly from the uniqueness of adjoints. + +Proposition F.44. Let $f : V \to V ^ { \prime }$ be a unitary transformation between Hilbert spaces, i.e., an invertible linear function such that $\langle f ( v ) | f ( w ) \rangle = \langle v | \bar { w } \rangle$ for all $v , w \in V$ . Then the adjoint is the inverse, i.e., $f ^ { * } = f ^ { - 1 }$ . + +Proof. First of all, the inverse $f ^ { - 1 }$ is again continuous due to the unitarity of $f$ . Furthermore, due to the unitarity, we obtain + +$$ +\begin{array} { r } { \langle f ( v ) | v ^ { \prime } \rangle = \langle f ( v ) \big | f ( f ^ { - 1 } ( v ^ { \prime } ) ) \rangle } \\ { = \langle v \big | f ^ { - 1 } ( v ^ { \prime } ) \rangle } \end{array} +$$ + +for all $v \in V$ and $v ^ { \prime } \in V ^ { \prime }$ . Due to the uniqueness of adjoints, we obtain $f ^ { - 1 } = f ^ { * }$ + +The following proposition is sometimes used in the main text: + +Proposition F.45. Let $v , w \in V$ be two elements in a pre-Hilbert space such that $\langle v | u \rangle = \langle w | u \rangle$ for all $u \in V$ . Then $v = w$ . + +Proof. We have + +$$ +\langle v - w | u \rangle = \langle v | u \rangle - \langle w | u \rangle = 0 +$$ + +for all $u \in V$ . In particular, when setting $u = v - w$ we obtain + +$$ +\langle v - w | v - w \rangle = 0 +$$ + +and thus $v - w = 0$ , i.e., $v = w$ + +Proposition F.46 (Orthogonal Projection Operators). Let $W \subseteq V$ be a topologically closed subspace of a Hilbert space. Then there is a continuous linear function $P : V W$ such that for all $v \in V$ and $w \in W$ we have + +$$ +\langle P ( v ) | w \rangle = \langle v | w \rangle . +$$ + +Furthermore, if $W$ is finite-dimensional and $w _ { 1 } , \ldots , w _ { n }$ and orthonormal basis, then $P$ is given explicitly by + +$$ +P ( v ) = \sum _ { i = 1 } ^ { n } \left. w _ { i } | v \right. w _ { i } . +$$ + +Proof. That $W$ is topologically closed means that $W$ , with the scalar product inherited from $V$ , is a complete metric space. Thus, $W$ is a Hilbert space as well. Therefore, the continuous linear embedding $i : W \to V$ given by $w \mapsto w$ has an adjoint $i ^ { * } : V W$ by Definition F.42. Set $P : = i ^ { * }$ . For arbitrary $v \in V$ and $w \in W$ we obtain: + +$$ +\begin{array} { c } { { \langle P ( v ) | w \rangle = \langle i ^ { * } ( v ) | w \rangle } } \\ { { { } } } \\ { { = \langle v | i ( w ) \rangle } } \\ { { { } } } \\ { { { } = \langle v | w \rangle . } } \end{array} +$$ + +For the second statement, note that for all $j \in \{ 1 , \ldots , n \}$ we have, using that the $w _ { i }$ are orthonormal: + +$$ +\begin{array} { r l } & { \left. \sum _ { i = 1 } ^ { n } \left. w _ { i } | v \right. w _ { i } \middle | w _ { j } \right. = \sum _ { i = 1 } ^ { n } \overline { { \left. w _ { i } | v \right. } } \left. w _ { i } | w _ { j } \right. } \\ & { \qquad = \langle v | w _ { j } \rangle } \\ & { \qquad = \langle P ( v ) | w _ { j } \rangle . } \end{array} +$$ + +By Proposition F.45 and since the $w _ { j }$ generate $W$ we obtain $\begin{array} { r } { \sum _ { i = 1 } ^ { n } \left. w _ { i } | v \right. w _ { i } = P ( v ) } \end{array}$ as claimed. + +Proposition F.47. Let $\left( V , \langle \cdot | \cdot \rangle \right)$ be a finite-dimensional pre-Hilbert space. Then this space is already complete and thus a Hilbert space. + +In particular, all finite-dimensional subspaces of Hilbert spaces are topologically closed. + +Proof. The proof of the Gram-Schmidt orthonormalization in Proposition F.41 does not make use of the completeness of the Hilbert space, and thus it holds for pre-Hilbert spaces as well. Consequently, $V$ , being finite-dimensional, has an orthonormal basis. It is thus isomorphic to $\mathbb { K } ^ { n }$ together with the standard scalar product, which is well-known to be complete. Thus, $V$ is a Hilbert space. + +Now, let $W \subseteq V$ be a finite-dimensional subspace of a Hilbert space $V$ which may be infinitedimensional. Then $W$ is a pre-Hilbert space and by what was just shown a Hilbert space. Consequently, all sequences in $W$ which have a limit in $V$ need, by completeness, to have that limit already in $W$ . This shows that $W$ is topologically closed. □ \ No newline at end of file diff --git a/md/train/c8P9NQVtmnO/c8P9NQVtmnO.md b/md/train/c8P9NQVtmnO/c8P9NQVtmnO.md new file mode 100644 index 0000000000000000000000000000000000000000..936f82828877977330761dab728acb199446e66c --- /dev/null +++ b/md/train/c8P9NQVtmnO/c8P9NQVtmnO.md @@ -0,0 +1,382 @@ +# FOURIER NEURAL OPERATOR FORPARAMETRIC PARTIAL DIFFERENTIAL EQUATIONS + +Zongyi Li zongyili $@$ caltech.edu + +Nikola Kovachki nkovachki@caltech.edu + +Kamyar Azizzadenesheli kamyar $@$ purdue.edu + +Burigede Liu bgl@caltech.edu + +Kaushik Bhattacharya bhatta@caltech.edu + +Andrew Stuart astuart@caltech.edu + +Anima Anandkumar anima@caltech.edu + +# ABSTRACT + +The classical development of neural networks has primarily focused on learning mappings between finite-dimensional Euclidean spaces. Recently, this has been generalized to neural operators that learn mappings between function spaces. For partial differential equations (PDEs), neural operators directly learn the mapping from any functional parametric dependence to the solution. Thus, they learn an entire family of PDEs, in contrast to classical methods which solve one instance of the equation. In this work, we formulate a new neural operator by parameterizing the integral kernel directly in Fourier space, allowing for an expressive and efficient architecture. We perform experiments on Burgers’ equation, Darcy flow, and Navier-Stokes equation. The Fourier neural operator is the first ML-based method to successfully model turbulent flows with zero-shot super-resolution. It is up to three orders of magnitude faster compared to traditional PDE solvers. Additionally, it achieves superior accuracy compared to previous learning-based solvers under fixed resolution. + +# 1 INTRODUCTION + +Many problems in science and engineering involve solving complex partial differential equation (PDE) systems repeatedly for different values of some parameters. Examples arise in molecular dynamics, micro-mechanics, and turbulent flows. Often such systems require fine discretization in order to capture the phenomenon being modeled. As a consequence, traditional numerical solvers are slow and sometimes inefficient. For example, when designing materials such as airfoils, one needs to solve the associated inverse problem where thousands of evaluations of the forward model are needed. A fast method can make such problems feasible. + +Conventional solvers vs. Data-driven methods. Traditional solvers such as finite element methods (FEM) and finite difference methods (FDM) solve the equation by discretizing the space. Therefore, they impose a trade-off on the resolution: coarse grids are fast but less accurate; fine grids are accurate but slow. Complex PDE systems, as described above, usually require a very fine discretization, and therefore very challenging and time-consuming for traditional solvers. On the other hand, data-driven methods can directly learn the trajectory of the family of equations from the data. As a result, the learning-based method can be orders of magnitude faster than the conventional solvers. + +Machine learning methods may hold the key to revolutionizing scientific disciplines by providing fast solvers that approximate or enhance traditional ones (Raissi et al., 2019; Jiang et al., 2020; Greenfeld et al., 2019; Kochkov et al., 2021). However, classical neural networks map between finite-dimensional spaces and can therefore only learn solutions tied to a specific discretization. This is often a limitation for practical applications and therefore the development of mesh-invariant neural networks is required. We first outline two mainstream neural network-based approaches for PDEs – the finite-dimensional operators and Neural-FEM. + +Finite-dimensional operators. These approaches parameterize the solution operator as a deep convolutional neural network between finite-dimensional Euclidean spaces Guo et al. (2016); Zhu + +![](images/47713b0420c585850977bd3b16156952782e947ca3562ab3b8e9a44fed87d0ed.jpg) +Zero-shot super-resolution: Navier-Stokes Equation with Reynolds number 10000; Ground truth on top and prediction on bottom; trained on $6 4 \times 6 4 \times 2 0$ dataset; evaluated on $2 5 6 \times 2 5 6 \times 8 0$ (see Section 5.4). + +Figure 1: top: The architecture of the Fourier layer; bottom: Example flow from Navier-Stokes. + +& Zabaras (2018); Adler & Oktem (2017); Bhatnagar et al. (2019); Khoo et al. (2017). Such approaches are, by definition, mesh-dependent and will need modifications and tuning for different resolutions and discretizations in order to achieve consistent error (if at all possible). Furthermore, these approaches are limited to the discretization size and geometry of the training data and hence, it is not possible to query solutions at new points in the domain. In contrast, we show, for our method, both invariance of the error to grid resolution, and the ability to transfer the solution between meshes. + +Neural-FEM. The second approach directly parameterizes the solution function as a neural network (E & Yu, 2018; Raissi et al., 2019; Bar & Sochen, 2019; Smith et al., 2020; Pan & Duraisamy, 2020). This approach is designed to model one specific instance of the PDE, not the solution operator. It is mesh-independent and accurate, but for any given new instance of the functional parameter/coefficient, it requires training a new neural network. The approach closely resembles classical methods such as finite elements, replacing the linear span of a finite set of local basis functions with the space of neural networks. The Neural-FEM approach suffers from the same computational issue as classical methods: the optimization problem needs to be solved for every new instance. Furthermore, the approach is limited to a setting in which the underlying PDE is known. + +Neural Operators. Recently, a new line of work proposed learning mesh-free, infinitedimensional operators with neural networks (Lu et al., 2019; Bhattacharya et al., 2020; Nelsen & Stuart, 2020; Li et al., 2020b;a; Patel et al., 2021). The neural operator remedies the mesh-dependent nature of the finite-dimensional operator methods discussed above by producing a single set of network parameters that may be used with different discretizations. It has the ability to transfer solutions between meshes. Furthermore, the neural operator needs to be trained only once. Obtaining a solution for a new instance of the parameter requires only a forward pass of the network, alleviating the major computational issues incurred in Neural-FEM methods. Lastly, the neural operator requires no knowledge of the underlying PDE, only data. Thus far, neural operators have not yielded efficient numerical algorithms that can parallel the success of convolutional or recurrent neural networks in the finite-dimensional setting due to the cost of evaluating integral operators. Through the fast Fourier transform, our work alleviates this issue. + +Fourier Transform. The Fourier transform is frequently used in spectral methods for solving differential equations, since differentiation is equivalent to multiplication in the Fourier domain. Fourier transforms have also played an important role in the development of deep learning. In theory, they appear in the proof of the universal approximation theorem (Hornik et al., 1989) and, empirically, they have been used to speed up convolutional neural networks (Mathieu et al., 2013). Neural network architectures involving the Fourier transform or the use of sinusoidal activation functions have also been proposed and studied (Bengio et al., 2007; Mingo et al., 2004; Sitzmann et al., 2020). Recently, some spectral methods for PDEs have been extended to neural networks (Fan et al., 2019a;b; Kashinath et al., 2020). We build on these works by proposing a neural operator architecture defined directly in Fourier space with quasi-linear time complexity and state-of-the-art approximation capabilities. + +Our Contributions. We introduce the Fourier neural operator, a novel deep learning architecture able to learn mappings between infinite-dimensional spaces of functions; the integral operator is restricted to a convolution, and instantiated through a linear transformation in the Fourier domain. + +• The Fourier neural operator is the first work that learns the resolution-invariant solution operator for the family of Navier-Stokes equation in the turbulent regime, where previous graph-based neural operators do not converge. • By construction, the method shares the same learned network parameters irrespective of the discretization used on the input and output spaces. It can do zero-shot super-resolution: trained on a lower resolution directly evaluated on a higher resolution, as shown in Figure 1. • The proposed method consistently outperforms all existing deep learning methods even when fixing the resolution to be $6 4 \times 6 4$ . It achieves error rates that are $3 0 \%$ lower on Burgers’ Equation, $6 0 \%$ lower on Darcy Flow, and $3 0 \%$ lower on Navier Stokes (turbulent regime with Reynolds number 10000). When learning the mapping for the entire time series, the method achieves $< 1 \%$ error with Reynolds number 1000 and $8 \%$ error with Reynolds number 10000. • On a $2 5 6 \times 2 5 6$ grid, the Fourier neural operator has an inference time of only 0.005s compared to the $2 . 2 s$ of the pseudo-spectral method used to solve Navier-Stokes. Despite its tremendous speed advantage, the method does not suffer from accuracy degradation when used in downstream applications such as solving the Bayesian inverse problem, as shown in Figure 6. + +We observed that the proposed framework can approximate complex operators raising in PDEs that are highly non-linear, with high frequency modes and slow energy decay. The power of neural operators comes from combining linear, global integral operators (via the Fourier transform) and nonlinear, local activation functions. Similar to the way standard neural networks approximate highly non-linear functions by combining linear multiplications with non-linear activations, the proposed neural operators can approximate highly non-linear operators. + +# 2 LEARNING OPERATORS + +Our methodology learns a mapping between two infinite dimensional spaces from a finite collection of observed input-output pairs. Let $D \subset \mathbb { R } ^ { d }$ be a bounded, open set and $\mathcal { A } = \mathcal { A } ( D ; \mathbb { R } ^ { d _ { a } } )$ and $\mathcal { U } = \mathcal { U } ( D ; \mathbb { R } ^ { d _ { u } } )$ be separable Banach spaces of function taking values in $\mathbb { R } ^ { d _ { a } }$ and $\mathbb { R } ^ { d _ { u } }$ respectively. Furthermore let $G ^ { \dagger } : { \mathcal { A } } { \mathcal { U } }$ be a (typically) non-linear map. We study maps $G ^ { \dagger }$ which arise as the solution operators of parametric PDEs – see Section 5 for examples. Suppose we have observations $\{ a _ { j } , u _ { j } \} _ { j = 1 } ^ { N }$ where $a _ { j } \sim \mu$ is an i.i.d. sequence from the probability measure $\mu$ supported on $\mathcal { A }$ and $u _ { j } = G ^ { \dagger } ( a _ { j } )$ is possibly corrupted with noise. We aim to build an approximation of $G ^ { \dagger }$ by constructing a parametric map + +$$ +G : { \mathcal { A } } \times \Theta \to { \mathcal { U } } \qquad { \mathrm { o r ~ e q u i v a l e n t l y , } } \qquad G _ { \theta } : { \mathcal { A } } \to { \mathcal { U } } , \quad \theta \in \Theta +$$ + +for some finite-dimensional parameter space $\Theta$ by choosing $\theta ^ { \dagger } \in \Theta$ so that $G ( \cdot , \theta ^ { \dagger } ) = G _ { \theta ^ { \dagger } } \approx G ^ { \dagger }$ . This is a natural framework for learning in infinite-dimensions as one could define a cost functional $C : \mathcal { U } \times \mathcal { U } \mathbb { R }$ and seek a minimizer of the problem + +$$ +\operatorname* { m i n } _ { \theta \in \Theta } \mathbb { E } _ { a \sim \mu } [ C ( G ( a , \theta ) , G ^ { \dagger } ( a ) ) ] +$$ + +which directly parallels the classical finite-dimensional setting (Vapnik, 1998). Showing the existence of minimizers, in the infinite-dimensional setting, remains a challenging open problem. We will approach this problem in the test-train setting by using a data-driven empirical approximation to the cost used to determine $\theta$ and to test the accuracy of the approximation. Because we conceptualize our methodology in the infinite-dimensional setting, all finite-dimensional approximations share a common set of parameters which are consistent in infinite dimensions. A table of notation is shown in Appendix 3. + +Learning the Operator. Approximating the operator $G ^ { \dagger }$ is a different and typically much more challenging task than finding the solution $u \in \mathcal { U }$ of a PDE for a single instance of the parameter $a \in { \mathcal { A } }$ . Most existing methods, ranging from classical finite elements, finite differences, and finite volumes to modern machine learning approaches such as physics-informed neural networks + +(a) + +![](images/24f2ccbe3bc2d8627081eba7adb6f66640a082a7d8e5c2af70cd7899d53c7623.jpg) +Figure 2: top: The architecture of the neural operators; bottom: Fourier layer. + +(a) The full architecture of neural operator: start from input $a$ . 1. Lift to a higher dimension channel space by a neural network $P$ . 2. Apply four layers of integral operators and activation functions. 3. Project back to the target dimension by a neural network $Q$ . Output $u$ . (b) Fourier layers: Start from input $v$ . On top: apply the Fourier transform $\mathcal { F }$ ; a linear transform $R$ on the lower Fourier modes and filters out the higher modes; then apply the inverse Fourier transform $\mathcal { F } ^ { - 1 }$ . On the bottom: apply a local linear transform $W$ . + +(PINNs) (Raissi et al., 2019) aim at the latter and can therefore be computationally expensive. This makes them impractical for applications where a solution to the PDE is required for many different instances of the parameter. On the other hand, our approach directly approximates the operator and is therefore much cheaper and faster, offering tremendous computational savings when compared to traditional solvers. For an example application to Bayesian inverse problems, see Section 5.5. + +Discretization. Since our data $a _ { j }$ and $u _ { j }$ are, in general, functions, to work with them numerically, we assume access only to point-wise evaluations. Let $D _ { j } \ = \ \{ x _ { 1 } , \ldots , x _ { n } \} \ \subset \ D$ be a $n$ -point discretization of the domain $D$ and assume we have observations $a _ { j } | _ { D _ { j } } \in \mathbb { R } ^ { n \times d _ { a } }$ , $u _ { j } | _ { D _ { j } } \in \mathbb { R } ^ { n \times d _ { v } }$ , for a finite collection of input-output pairs indexed by $j$ . To be discretization-invariant, the neural operator can produce an answer $u ( x )$ for any $x \in D$ , potentially $x \notin D _ { j }$ . Such a property is highly desirable as it allows a transfer of solutions between different grid geometries and discretizations. + +# 3 NEURAL OPERATOR + +The neural operator, proposed in (Li et al., 2020b), is formulated as an iterative architecture $v _ { 0 } \mapsto$ $v _ { 1 } \mapsto . . . \mapsto v _ { T }$ where $v _ { j }$ for $j = 0 , 1 , \ldots , T - 1$ is a sequence of functions each taking values in $\mathbb { R } ^ { d _ { v } }$ . As shown in Figure 2 (a), the input $a \in { \mathcal { A } }$ is first lifted to a higher dimensional representation $v _ { 0 } ( x ) = P ( a ( x ) )$ by the local transformation $P$ which is usually parameterized by a shallow fullyconnected neural network. Then we apply several iterations of updates $v _ { t } \mapsto v _ { t + 1 }$ (defined below). The output $u ( x ) = Q ( v _ { T } ( x ) )$ is the projection of $v _ { T }$ by the local transformation $Q : \mathbb { R } ^ { d _ { v } } \mathbb { R } ^ { d _ { u } }$ . In each iteration, the update $v _ { t } \mapsto v _ { t + 1 }$ is defined as the composition of a non-local integral operator $\kappa$ and a local, nonlinear activation function $\sigma$ . + +Definition 1 (Iterative updates) Define the update to the representation $v _ { t } \mapsto v _ { t + 1 }$ by + +$$ +v _ { t + 1 } ( x ) : = \sigma \Bigl ( W v _ { t } ( x ) + \bigl ( K ( a ; \phi ) v _ { t } \bigr ) ( x ) \Bigr ) , \qquad \forall x \in D +$$ + +where $\mathcal { K } : \mathcal { A } \times \Theta _ { \mathcal { K } } \to \mathcal { L } ( \mathcal { U } ( D ; \mathbb { R } ^ { d _ { v } } ) , \mathcal { U } ( D ; \mathbb { R } ^ { d _ { v } } ) )$ maps to bounded linear operators on $\mathcal { U } ( D ; \mathbb { R } ^ { d _ { v } } )$ and is parameterized by $\phi \in \Theta \kappa$ , $W : \mathbb { R } ^ { d _ { v } } \mathbb { R } ^ { d _ { v } }$ is a linear transformation, and $\sigma : \mathbb { R } \mathbb { R }$ is $a$ non-linear activation function whose action is defined component-wise. + +We choose $\textstyle \mathcal { K } ( a ; \phi )$ to be a kernel integral transformation parameterized by a neural network. + +Definition 2 (Kernel integral operator $\kappa$ ) Define the kernel integral operator mapping in (2) by + +$$ +\big ( \mathcal { K } ( a ; \phi ) v _ { t } \big ) ( x ) : = \int _ { D } \kappa \big ( x , y , a ( x ) , a ( y ) ; \phi \big ) v _ { t } ( y ) \mathrm { d } y , \qquad \forall x \in D +$$ + +where $\kappa _ { \phi } : \mathbb { R } ^ { 2 ( d + d _ { a } ) } \mathbb { R } ^ { d _ { v } \times d _ { v } }$ is a neural network parameterized by $\phi \in \Theta \kappa$ + +Here $\kappa _ { \phi }$ plays the role of a kernel function which we learn from data. Together definitions 1 and 2 constitute a generalization of neural networks to infinite-dimensional spaces as first proposed in Li et al. (2020b). Notice even the integral operator is linear, the neural operator can learn highly non-linear operators by composing linear integral operators with non-linear activation functions, analogous to standard neural networks. + +If we remove the dependence on the function $a$ and impose $\kappa _ { \phi } ( x , y ) = \kappa _ { \phi } ( x - y )$ , we obtain that (3) is a convolution operator, which is a natural choice from the perspective of fundamental solutions. We exploit this fact in the following section by parameterizing $\kappa _ { \phi }$ directly in Fourier space and using the Fast Fourier Transform (FFT) to efficiently compute (3). This leads to a fast architecture that obtains state-of-the-art results for PDE problems. + +# 4 FOURIER NEURAL OPERATOR + +We propose replacing the kernel integral operator in (3), by a convolution operator defined in Fourier space. Let $\mathcal { F }$ denote the Fourier transform of a function $\dot { f } : D \mathbb { R } ^ { d _ { v } }$ and $\scriptstyle { \mathcal { F } } ^ { - 1 }$ its inverse then + +$$ +( { \mathcal { F } } f ) _ { j } ( k ) = \int _ { D } f _ { j } ( x ) e ^ { - 2 i \pi \langle x , k \rangle } \mathrm { d } x , \qquad ( { \mathcal { F } } ^ { - 1 } f ) _ { j } ( x ) = \int _ { D } f _ { j } ( k ) e ^ { 2 i \pi \langle x , k \rangle } \mathrm { d } k +$$ + +for $j = 1 , \ldots , d _ { v }$ where $i = \sqrt { - 1 }$ is the imaginary unit. By letting $\kappa _ { \phi } ( x , y , a ( x ) , a ( y ) ) = \kappa _ { \phi } ( x - y )$ in (3) and applying the convolution theorem, we find that + +$$ +\bigl ( \mathcal { K } ( a ; \phi ) v _ { t } \bigr ) ( x ) = \mathcal { F } ^ { - 1 } \bigl ( \mathcal { F } ( \kappa _ { \phi } ) \cdot \mathcal { F } ( v _ { t } ) \bigr ) ( x ) , \qquad \forall x \in D . +$$ + +We, therefore, propose to directly parameterize $\kappa _ { \phi }$ in Fourier space. + +Definition 3 (Fourier integral operator $\kappa$ ) Define the Fourier integral operator + +$$ +\bigl ( \mathcal { K } ( \phi ) v _ { t } \bigr ) ( x ) = \mathcal { F } ^ { - 1 } \Bigl ( R _ { \phi } \cdot ( \mathcal { F } v _ { t } ) \Bigr ) ( x ) \qquad \forall x \in D +$$ + +where $R _ { \phi }$ is the Fourier transform of a periodic function $\kappa : \bar { D } \mathbb R ^ { d _ { v } \times d _ { v } }$ parameterized by $\phi \in \Theta \kappa$ . An illustration is given in Figure 2 (b). + +For frequency mode $k \in D$ , we have $( \mathcal { F } v _ { t } ) ( k ) \in \mathbb { C } ^ { d _ { v } }$ and $R _ { \phi } ( k ) \in \mathbb { C } ^ { d _ { v } \times d _ { v } }$ . Notice that since we assume $\kappa$ is periodic, it admits a Fourier series expansion, so we may work with the discrete modes $k \in { \mathbb { Z } ^ { d } }$ . We pick a finite-dimensional parameterization by truncating the Fourier series at a maximal number of modes $k _ { \operatorname* { m a x } } = | Z _ { k _ { \operatorname* { m a x } } } | = | \{ k \in \mathbb { Z } ^ { d } : | k _ { j } | \leq k _ { \operatorname* { m a x } , j }$ , for $j = 1 , \ldots , d \} |$ . We thus parameterize $R _ { \phi }$ directly as complex-valued $( k _ { \operatorname* { m a x } } \times d _ { v } \times d _ { v } )$ -tensor comprising a collection of truncated Fourier modes and therefore drop $\phi$ from our notation. Since $\kappa$ is real-valued, we impose conjugate symmetry. We note that the set $Z _ { k _ { \mathrm { m a x } } }$ is not the canonical choice for the low frequency modes of $v _ { t }$ . Indeed, the low frequency modes are usually defined by placing an upper-bound on the $\ell _ { 1 }$ -norm of $k \in { \mathbb { Z } ^ { d } }$ . We choose $Z _ { k _ { \mathrm { m a x } } }$ as above since it allows for an efficient implementation. + +The discrete case and the FFT. Assuming the domain $D$ is discretized with $n \in \mathbb N$ points, we have that $v _ { t } \in \mathbb { R } ^ { n \times d _ { v } }$ and $\mathcal { F } ( v _ { t } ) \in \mathbb { C } ^ { n \times d _ { v } ^ { \smile } }$ . Since we convolve $v _ { t }$ with a function which only has $k _ { \mathrm { m a x } }$ Fourier modes, we may simply truncate the higher modes to obtain $\mathcal { F } ( v _ { t } ) \in \mathbb { C } ^ { k _ { \operatorname* { m a x } } \times d _ { v } }$ . Multiplication by the weight tensor $R \in \mathbf { \bar { \mathbb { C } } } ^ { k _ { \operatorname* { m a x } } \times d _ { v } \times d _ { v } }$ is then + +$$ +\big ( R \cdot ( \mathcal { F } v _ { t } ) \big ) _ { k , l } = \sum _ { j = 1 } ^ { d _ { v } } R _ { k , l , j } ( \mathcal { F } v _ { t } ) _ { k , j } , \qquad k = 1 , \dots , k _ { \operatorname* { m a x } } , \quad j = 1 , \dots , d _ { v } . +$$ + +When the discretization is uniform with resolution $s _ { 1 } \times \cdot \cdot \cdot \times s _ { d } = n$ , $\mathcal { F }$ can be replaced by the Fast Fourier Transform. For $f \in \mathbb { R } ^ { n \times d _ { v } }$ , $k = ( k _ { 1 } , \ldots , k _ { d } ) \in \mathbb { Z } _ { s _ { 1 } } \times \cdot \cdot \cdot \times \mathbb { Z } _ { s _ { d } }$ , and $x = ( x _ { 1 } , \ldots , x _ { d } ) \in D$ , the FFT $\hat { \mathcal { F } }$ and its inverse $\hat { \mathcal { F } } ^ { - 1 }$ are defined as + +$$ +\begin{array} { r l } & { ( \hat { \mathcal { F } } f ) _ { l } ( k ) = \displaystyle \sum _ { x _ { 1 } = 0 } ^ { s _ { 1 } - 1 } \cdots \sum _ { x _ { d } = 0 } ^ { s _ { d } - 1 } f _ { l } ( x _ { 1 } , \ldots , x _ { d } ) e ^ { - 2 i \pi \sum _ { j = 1 } ^ { d } \frac { x _ { j } k _ { j } } { s _ { j } } } , } \\ & { ( \hat { \mathcal { F } } ^ { - 1 } f ) _ { l } ( x ) = \displaystyle \sum _ { k _ { 1 } = 0 } ^ { s _ { 1 } - 1 } \cdots \sum _ { k _ { d } = 0 } ^ { s _ { d } - 1 } f _ { l } ( k _ { 1 } , \ldots , k _ { d } ) e ^ { 2 i \pi \sum _ { j = 1 } ^ { d } \frac { x _ { j } k _ { j } } { s _ { j } } } } \end{array} +$$ + +for $l = 1 , \ldots , d _ { v }$ . In this case, the set of truncated modes becomes + +$$ +Z _ { k _ { \mathrm { m a x } } } = \{ ( k _ { 1 } , \ldots , k _ { d } ) \in \mathbb { Z } _ { s _ { 1 } } \times \cdot \cdot \cdot \times \mathbb { Z } _ { s _ { d } } \mid k _ { j } \leq k _ { \operatorname* { m a x } , j } +$$ + +$$ +s _ { j } - k _ { j } \leq k _ { \operatorname* { m a x } , j } , \mathrm { f o r } j = 1 , \ldots , d \} . +$$ + +When implemented, $R$ is treated as a $( s _ { 1 } \times \cdot \cdot \cdot \times s _ { d } \times d _ { v } \times d _ { v } )$ -tensor and the above definition of $Z _ { k _ { \mathrm { m a x } } }$ corresponds to the “corners” of $R$ , which allows for a straight-forward parallel implementation of (5) via matrix-vector multiplication. In practice, we have found that choosing $k _ { \operatorname* { m a x } , j } = 1 2$ which yields $k _ { \operatorname* { m a x } } = 1 2 ^ { d }$ parameters per channel to be sufficient for all the tasks that we consider. + +Parameterizations of $R$ . In general, $R$ can be defined to depend on $( \mathcal { F } a )$ to parallel (3). Indeed, we can define $R _ { \phi } : \mathbb { Z } ^ { d } \times \mathbb { R } ^ { d _ { v } } \mathbb { R } ^ { d _ { v } \times d _ { v } }$ as a parametric function that maps $\big ( k , ( \mathcal { F } a ) ( k ) \big )$ to the values of the appropriate Fourier modes. We have experimented with linear as well as neural network parameterizations of $R _ { \phi }$ . We find that the linear parameterization has a similar performance to the previously described direct parameterization, while neural networks have worse performance. This is likely due to the discrete structure of the space $\mathbb { Z } ^ { d }$ . Our experiments in this work focus on the direct parameterization presented above. + +Invariance to discretization. The Fourier layers are discretization-invariant because they can learn from and evaluate functions which are discretized in an arbitrary way. Since parameters are learned directly in Fourier space, resolving the functions in physical space simply amounts to projecting on the basis $e ^ { 2 \pi i \left. x , k \right. }$ which are well-defined everywhere on $\mathbb { R } ^ { d }$ . This allows us to achieve zero-shot super-resolution as shown in Section 5.4. Furthermore, our architecture has a consistent error at any resolution of the inputs and outputs. On the other hand, notice that, in Figure 3, the standard CNN methods we compare against have an error that grows with the resolution. + +Quasi-linear complexity. The weight tensor $R$ contains $k _ { \operatorname* { m a x } { } } < n$ modes, so the inner multiplication has complexity $O ( k _ { \operatorname* { m a x } } )$ . Therefore, the majority of the computational cost lies in computing the Fourier transform $\mathcal { F } ( v _ { t } )$ and its inverse. General Fourier transforms have complexity ${ \dot { O } } ( n ^ { 2 } )$ , however, since we truncate the series the complexity is in fact $O ( n k _ { \operatorname* { m a x } } )$ , while the FFT has complexity $O ( n \log n )$ . Generally, we have found using FFTs to be very efficient. However a uniform discretization is required. + +# 5 NUMERICAL EXPERIMENTS + +In this section, we compare the proposed Fourier neural operator with multiple finite-dimensional architectures as well as operator-based approximation methods on the 1-d Burgers’ equation, the 2-d Darcy Flow problem, and 2-d Navier-Stokes equation. The data generation processes are discussed in Appendices A.3.1, A.3.2, and A.3.3 respectively. We do not compare against traditional solvers (FEM/FDM) or neural-FEM type methods since our goal is to produce an efficient operator approximation that can be used for downstream applications. We demonstrate one such application to the Bayesian inverse problem in Section 5.5. + +We construct our Fourier neural operator by stacking four Fourier integral operator layers as specified in (2) and (4) with the ReLU activation as well as batch normalization. Unless otherwise specified, we use $N = 1 0 0 0$ training instances and 200 testing instances. We use Adam optimizer to train for 500 epochs with an initial learning rate of 0.001 that is halved every 100 epochs. We set $k _ { \operatorname* { m a x } , j } = 1 6 , d _ { v } = 6 4$ for the 1-d problem and $k _ { \operatorname* { m a x } , j } = 1 2 , d _ { v } = 3 2$ for the 2-d problems. Lower resolution data are downsampled from higher resolution. All the computation is carried on a single Nvidia V100 GPU with 16GB memory. + +Remark on Resolution. Traditional PDE solvers such as FEM and FDM approximate a single function and therefore their error to the continuum decreases as the resolution is increased. On the other hand, operator approximation is independent of the ways its data is discretized as long as all relevant information is resolved. Resolution-invariant operators have consistent error rates among different resolutions as shown in Figure 3. Further, resolution-invariant operators can do zero-shot super-resolution, as shown in Section 5.4. + +Benchmarks for time-independent problems (Burgers and Darcy): NN: a simple point-wise feedforward neural network. RBM: the classical Reduced Basis Method (using a POD basis) (De + +![](images/ccd83d87eb17dedce6b2605c5a253578b14747d2dce6282d84e35bec0901f81f.jpg) +Figure 3: Benchmark on Burger’s equation, Darcy Flow, and Navier-Stokes + +Left: benchmarks on Burgers equation; Mid: benchmarks on Darcy Flow for different resolutions; Right: the learning curves on Navier-Stokes $\nu = 1 \mathrm { e } - 3$ with different benchmarks. Train and test on the same resolution. For acronyms, see Section 5; details in Tables 1, 3, 4. + +Vore, 2014). FCN: a the-state-of-the-art neural network architecture based on Fully Convolution Networks (Zhu & Zabaras, 2018). PCANN: an operator method using PCA as an autoencoder on both the input and output data and interpolating the latent spaces with a neural network (Bhattacharya et al., 2020). GNO: the original graph neural operator (Li et al., 2020b). MGNO: the multipole graph neural operator (Li et al., 2020a). LNO: a neural operator method based on the low-rank decomposition of the kernel $\begin{array} { r } { \kappa ( x , y ) : = \sum _ { j = 1 } ^ { r } \phi _ { j } ( x ) \psi _ { j } ( y ) } \end{array}$ , similar to the unstacked DeepONet proposed in (Lu et al., 2019). FNO: the newly purposed Fourier neural operator. + +Benchmarks for time-dependent problems (Navier-Stokes): ResNet: 18 layers of 2-d convolution with residual connections (He et al., 2016). U-Net: A popular choice for image-to-image regression tasks consisting of four blocks with 2-d convolutions and deconvolutions (Ronneberger et al., 2015). TF-Net: A network designed for learning turbulent flows based on a combination of spatial and temporal convolutions (Wang et al., 2020). FNO-2d: 2-d Fourier neural operator with a RNN structure in time. FNO-3d: 3-d Fourier neural operator that directly convolves in space-time. + +# 5.1 BURGERS’ EQUATION + +The 1-d Burgers’ equation is a non-linear PDE with various applications including modeling the one dimensional flow of a viscous fluid. It takes the form + +$$ +\begin{array} { r l } { \partial _ { t } u ( x , t ) + \partial _ { x } ( u ^ { 2 } ( x , t ) / 2 ) = \nu \partial _ { x x } u ( x , t ) , \quad } & { x \in ( 0 , 1 ) , t \in ( 0 , 1 ] } \\ { u ( x , 0 ) = u _ { 0 } ( x ) , \quad } & { x \in ( 0 , 1 ) } \end{array} +$$ + +with periodic boundary conditions where $u _ { 0 } \in L _ { \mathrm { p e r } } ^ { 2 } ( ( 0 , 1 ) ; \mathbb { R } )$ is the initial condition and $\nu \in \mathbb { R } _ { + }$ is the viscosity coefficient. We aim to learn the operator mapping the initial condition to the solution at time one, $G ^ { \dagger } : L _ { \mathrm { p e r } } ^ { 2 } ( ( 0 , 1 ) ; \mathbb { R } ) \to H _ { \mathrm { p e r } } ^ { r } ( ( 0 , 1 ) ; \mathbb { R } )$ defined by $u _ { 0 } \mapsto u ( \cdot , 1 )$ for any $r > 0$ . + +The results of our experiments are shown in Figure 3 (a) and Table 3 (Appendix A.3.1). Our proposed method obtains the lowest relative error compared to any of the benchmarks. Further, the error is invariant with the resolution, while the error of convolution neural network based methods (FCN) grows with the resolution. Compared to other neural operator methods such as GNO and MGNO that use Nystrom sampling in physical space, the Fourier neural operator is both more accurate and ¨ more computationally efficient. + +# 5.2 DARCY FLOW + +We consider the steady-state of the 2-d Darcy Flow equation on the unit box which is the second order, linear, elliptic PDE + +$$ +\begin{array} { r l r l } { - \nabla \cdot ( a ( x ) \nabla u ( x ) ) = f ( x ) } & { } & { x \in ( 0 , 1 ) ^ { 2 } } \\ { u ( x ) = 0 } & { } & { x \in \partial ( 0 , 1 ) ^ { 2 } } \end{array} +$$ + +with a Dirichlet boundary where $a \ \in \ L ^ { \infty } ( ( 0 , 1 ) ^ { 2 } ; \mathbb { R } _ { + } )$ is the diffusion coefficient and $f \in$ $L ^ { 2 } ( ( 0 , 1 ) ^ { 2 } ; \mathbb { R } )$ is the forcing function. This PDE has numerous applications including modeling the pressure of subsurface flow, the deformation of linearly elastic materials, and the electric potential in conductive materials. We are interested in learning the operator mapping the diffusion coefficient to the solution, $G ^ { \dag } : L ^ { \infty } ( ( 0 , 1 ) _ { : } ^ { 2 } ; \mathbb { R } _ { + } ) \to H _ { 0 } ^ { 1 } ( ( 0 , \bar { 1 } ) ^ { 2 } ; \mathbb { R } _ { + } )$ defined by $a \mapsto u$ . Note that although the PDE is linear, the operator $G ^ { \dagger }$ is not. + +The results of our experiments are shown in Figure 3 (b) and Table 4 (Appendix A.3.2). The proposed Fourier neural operator obtains nearly one order of magnitude lower relative error compared to any benchmarks. We again observe the invariance of the error with respect to the resolution. + +# 5.3 NAVIER-STOKES EQUATION + +We consider the 2-d Navier-Stokes equation for a viscous, incompressible fluid in vorticity form on the unit torus: + +$$ +\begin{array} { r l r l } { \partial _ { t } w ( x , t ) + u ( x , t ) \cdot \nabla w ( x , t ) = \nu \Delta w ( x , t ) + f ( x ) , } & { } & { x \in ( 0 , 1 ) ^ { 2 } , t \in ( 0 , T ] } \\ { \nabla \cdot u ( x , t ) = 0 , } & { } & & { x \in ( 0 , 1 ) ^ { 2 } , t \in [ 0 , T ] } \\ { w ( x , 0 ) = w _ { 0 } ( x ) , } & { } & & { x \in ( 0 , 1 ) ^ { 2 } } \end{array} +$$ + +where $u \in C ( [ 0 , T ] ; H _ { \mathrm { p e r } } ^ { r } ( ( 0 , 1 ) ^ { 2 } ; \mathbb { R } ^ { 2 } ) )$ for any $r > 0$ is the velocity field, $w = \nabla \times u$ is the vorticity, $w _ { 0 } \in L _ { \mathrm { p e r } } ^ { 2 } ( ( 0 , 1 ) ^ { 2 } ; \mathbb { R } )$ is the initial vorticity, $\nu \in \mathbb { R } _ { + }$ is the viscosity coefficient, and $f \in$ $L _ { \mathrm { p e r } } ^ { 2 } ( ( 0 , 1 ) ^ { 2 } ; \mathbb { R } )$ is the forcing function. We are interested in learning the operator mapping the vorticity up to time 10 to the vorticity up to some later time $T > 1 0$ $1 0 , G ^ { \dagger } : C ( [ 0 , 1 0 ] ; H _ { \mathrm { p e r } } ^ { r } ( ( 0 , 1 ) ^ { 2 } ; \mathbb { R } ) ) \to$ $C ( ( 1 0 , T ] ; H _ { \mathrm { p e r } } ^ { r } ( ( 0 , 1 ) ^ { 2 } ; \mathbb { R } ) )$ defined by $w | _ { ( 0 , 1 ) ^ { 2 } \times [ 0 , 1 0 ] } \mapsto w | _ { ( 0 , 1 ) ^ { 2 } \times ( 1 0 , T ] }$ . Given the vorticity it is easy to derive the velocity. While vorticity is harder to model compared to velocity, it provides more information. By formulating the problem on vorticity, the neural network models mimic the pseudospectral method. We experiment with the viscosities $\nu = { 1 } \mathrm { e } \mathrm { - } 3 , { 1 } \mathrm { e } \mathrm { - } 4 , { 1 } \mathrm { e } \mathrm { - } 5$ , decreasing the final time $T$ as the dynamic becomes chaotic. Since the baseline methods are not resolution-invariant, we fix the resolution to be $6 4 \times 6 4$ for both training and testing. + +Table 1: Benchmarks on Navier Stokes (fixing resolution $6 4 \times 6 4$ for both training and testing) + +
ConfigParametersTime perv=le-3 T=50v=le-4 T=30 N = 1000V=le-4 T=30 N = 10000v=le-5 T=20
FNO-3D6,558,537epoch 38.99sN = 1000 0.00860.19180.0820N = 1000 0.1893
FNO-2D414,517127.80s0.01280.15590.08340.1556
U-Net24,950,49148.67s0.02450.20510.11900.1982
TF-Net7,451,72447.21s0.02250.22530.11680.2268
ResNet266,64178.47s0.07010.28710.23110.2753
+ +As shown in Table 1, the FNO-3D has the best performance when there is sufficient data $( \nu ~ =$ 1e−3, $N = 1 0 0 0$ and $\nu = 1 \mathrm { e } { - } 4 , N = 1 0 0 0 0 )$ . For the configurations where the amount of data is insufficient $\langle \nu = 1 \mathrm { e - } 4$ , $N = 1 0 0 0$ and $\nu = 1 \mathrm { e } { - } 5 , N = 1 0 0 0 )$ , all methods have $> 1 5 \%$ error with FNO-2D achieving the lowest. Note that we only present results for spatial resolution $6 4 \times 6 4$ since all benchmarks we compare against are designed for this resolution. Increasing it degrades their performance while FNO achieves the same errors. + +2D and 3D Convolutions. FNO-2D, U-Net, TF-Net, and ResNet all do 2D-convolution in the spatial domain and recurrently propagate in the time domain $( 2 \mathrm { D } \mathrm { + R N N } )$ . The operator maps the solution at the previous 10 time steps to the next time step (2D functions to 2D functions). On the other hand, FNO-3D performs convolution in space-time. It maps the initial time steps directly to the full trajectory (3D functions to 3D functions). The $2 \mathrm { D } { + } \mathrm { R } \mathrm { N } \mathrm { N }$ structure can propagate the solution to any arbitrary time $T$ in increments of a fixed interval length $\Delta t$ , while the Conv3D structure is fixed to the interval $[ 0 , T ]$ but can transfer the solution to an arbitrary time-discretization. We find the 3-d method to be more expressive and easier to train compared to its RNN-structured counterpart. + +# 5.4 ZERO-SHOT SUPER-RESOLUTION. + +The neural operator is mesh-invariant, so it can be trained on a lower resolution and evaluated at a higher resolution, without seeing any higher resolution data (zero-shot super-resolution). Figure 1 shows an example where we train the FNO-3D model on $6 4 \times 6 4 \times 2 0$ resolution data in the setting above with $( \nu = 1 \mathrm { e } { - } 4 , N = 1 0 0 0 0 )$ and transfer to $2 5 6 \times 2 5 6 \times 8 0$ resolution, demonstrating super-resolution in space-time. Fourier neural operator is the only model among the benchmarks (FNO-2D, U-Net, TF-Net, and ResNet) that can do zero-shot super-resolution. And surprisingly, it can do super-resolution not only in the spatial domain but also in the temporal domain. + +# 5.5 BAYESIAN INVERSE PROBLEM + +In this experiment, we use a function space Markov chain Monte Carlo (MCMC) method (Cotter et al., 2013) to draw samples from the posterior distribution of the initial vorticity in Navier-Stokes given sparse, noisy observations at time $T = 5 0$ . We compare the Fourier neural operator acting as a surrogate model with the traditional solvers used to generate our train-test data (both run on GPU). We generate 25,000 samples from the posterior (with a 5,000 sample burn-in period), requiring 30,000 evaluations of the forward operator. + +As shown in Figure 6 (Appendix A.5), FNO and the traditional solver recover almost the same posterior mean which, when pushed forward, recovers well the late-time dynamic of Navier Stokes. In sharp contrast, FNO takes $0 . 0 0 5 s$ to evaluate a single instance while the traditional solver, after being optimized to use the largest possible internal time-step which does not lead to blow-up, takes $2 . 2 s$ . This amounts to 2.5 minutes for the MCMC using FNO and over 18 hours for the traditional solver. Even if we account for data generation and training time (offline steps) which take 12 hours, using FNO is still faster! Once trained, FNO can be used to quickly perform multiple MCMC runs for different initial conditions and observations, while the traditional solver will take 18 hours for every instance. Furthermore, since FNO is differentiable, it can easily be applied to PDE-constrained optimization problems without the need for the adjoint method. + +Spectral analysis. Due to the way we parameterize $R _ { \phi }$ , the function output by (4) has at most $k _ { \mathrm { m a x } , j }$ Fourier modes per channel. This, however, does not mean that the Fourier neural operator can only approximate functions up to $k _ { \operatorname* { m a x } , j }$ modes. Indeed, the activation functions which occur between integral operators and the final decoder network $Q$ recover the high frequency modes. As an example, consider a solution to the Navier-Stokes equation with viscosity $\nu = 1 \mathrm { e } - 3$ . Truncating this function at 20 Fourier modes yields an error around $2 \%$ while our Fourier neural operator learns the parametric dependence and produces approximations to an error of $\leq 1 \%$ with only $k _ { \operatorname* { m a x } , j } = 1 2$ parameterized modes. + +Non-periodic boundary condition. Traditional Fourier methods work only with periodic boundary conditions. However, the Fourier neural operator does not have this limitation. This is due to the linear transform $W$ (the bias term) which keeps the track of non-periodic boundary. As an example, the Darcy Flow and the time domain of Navier-Stokes have non-periodic boundary conditions, and the Fourier neural operator still learns the solution operator with excellent accuracy. + +# 6 DISCUSSION AND CONCLUSION + +Requirements on Data. Data-driven methods rely on the quality and quantity of data. To learn Navier-Stokes equation with Reynolds number $R e \ = \ 1 \mathrm { e } { + } 4$ , we need to generate $N \ = \ 1 0 0 0 0$ training pairs $\{ a _ { j } , u _ { j } \}$ with the numerical solver. However, for more challenging PDEs, generating a few training samples can be already very expensive. A future direction is to combine neural operators with numerical solvers to levitate the requirements on data. Recurrent structure. The neural operator has an iterative structure that can naturally be formulated as a recurrent network where all layers share the same parameters without sacrificing performance. (We did not impose this restriction in the experiments.) Computer vision. Operator learning is not restricted to PDEs. Images can naturally be viewed as real-valued functions on 2-d domains and videos simply add a temporal structure. Our approach is therefore a natural choice for problems in computer vision where invariance to discretization crucial is important (Chi et al., 2020). + +# ACKNOWLEDGEMENTS + +The authors want to thank Ray Wang and Rose Yu for meaningful discussions. Z. Li gratefully acknowledges the financial support from the Kortschak Scholars Program. A. Anandkumar is supported in part by Bren endowed chair, LwLL grants, Beyond Limits, Raytheon, Microsoft, Google, Adobe faculty fellowships, and DE Logi grant. K. Bhattacharya, N. B. Kovachki, B. Liu, and A. M. Stuart gratefully acknowledge the financial support of the Army Research Laboratory through the Cooperative Agreement Number W911NF-12-0022. Research was sponsored by the Army Research Laboratory and was accomplished under Cooperative Agreement Number W911NF-12-2- 0022. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the Army Research Laboratory or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein. + +# REFERENCES + +Jonas Adler and Ozan Oktem. Solving ill-posed inverse problems using iterative deep neural networks. Inverse Problems, nov 2017. doi: 10.1088/1361-6420/aa9581. URL https: //doi.org/10.1088%2F1361-6420%2Faa9581. +Leah Bar and Nir Sochen. Unsupervised deep learning algorithm for pde-based forward and inverse problems. arXiv preprint arXiv:1904.05417, 2019. +Yoshua Bengio, Yann LeCun, et al. Scaling learning algorithms towards ai. Large-scale kernel machines, 34(5):1–41, 2007. +Saakaar Bhatnagar, Yaser Afshar, Shaowu Pan, Karthik Duraisamy, and Shailendra Kaushik. Prediction of aerodynamic flow fields using convolutional neural networks. Computational Mechanics, pp. 1–21, 2019. +Kaushik Bhattacharya, Nikola B. Kovachki, and Andrew M. Stuart. Model reduction and neural networks for parametric pde(s). preprint, 2020. +Lu Chi, Borui Jiang, and Yadong Mu. Fast fourier convolution. Advances in Neural Information Processing Systems, 33, 2020. +S. L. Cotter, G. O. Roberts, A. M. Stuart, and D. White. Mcmc methods for functions: Modifying old algorithms to make them faster. Statistical Science, 28(3):424–446, Aug 2013. ISSN 0883-4237. doi: 10.1214/13-sts421. URL http://dx.doi.org/10.1214/13-STS421. +Ronald A. DeVore. Chapter 3: The Theoretical Foundation of Reduced Basis Methods. 2014. doi: 10.1137/1.9781611974829.ch3. URL https://epubs.siam.org/doi/abs/10.1137/ 1.9781611974829.ch3. +Weinan E and Bing Yu. The deep ritz method: A deep learning-based numerical algorithm for solving variational problems. Communications in Mathematics and Statistics, 3 2018. ISSN 2194-6701. doi: 10.1007/s40304-018-0127-z. +Yuwei Fan, Cindy Orozco Bohorquez, and Lexing Ying. Bcr-net: A neural network based on the nonstandard wavelet form. Journal of Computational Physics, 384:1–15, 2019a. +Yuwei Fan, Lin Lin, Lexing Ying, and Leonardo Zepeda-Nunez. A multiscale neural network based ´ on hierarchical matrices. Multiscale Modeling & Simulation, 17(4):1189–1213, 2019b. +Daniel Greenfeld, Meirav Galun, Ronen Basri, Irad Yavneh, and Ron Kimmel. Learning to optimize multigrid pde solvers. In International Conference on Machine Learning, pp. 2415–2423. PMLR, 2019. +Xiaoxiao Guo, Wei Li, and Francesco Iorio. Convolutional neural networks for steady flow approximation. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2016. + +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. + +Kurt Hornik, Maxwell Stinchcombe, Halbert White, et al. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989. + +Chiyu Max Jiang, Soheil Esmaeilzadeh, Kamyar Azizzadenesheli, Karthik Kashinath, Mustafa Mustafa, Hamdi A Tchelepi, Philip Marcus, Anima Anandkumar, et al. Meshfreeflownet: A physics-constrained deep continuous space-time super-resolution framework. arXiv preprint arXiv:2005.01463, 2020. + +Karthik Kashinath, Philip Marcus, et al. Enforcing physical constraints in cnns through differentiable pde layer. In ICLR 2020 Workshop on Integration of Deep Neural Models and Differential Equations, 2020. + +Yuehaw Khoo, Jianfeng Lu, and Lexing Ying. Solving parametric PDE problems with artificial neural networks. arXiv preprint arXiv:1707.03351, 2017. + +Dmitrii Kochkov, Jamie A Smith, Ayya Alieva, Qing Wang, Michael P Brenner, and Stephan Hoyer. Machine learning accelerated computational fluid dynamics. arXiv preprint arXiv:2102.01010, 2021. + +Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Multipole graph neural operator for parametric partial differential equations, 2020a. + +Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Neural operator: Graph kernel network for partial differential equations. arXiv preprint arXiv:2003.03485, 2020b. + +Lu Lu, Pengzhan Jin, and George Em Karniadakis. Deeponet: Learning nonlinear operators for identifying differential equations based on the universal approximation theorem of operators. arXiv preprint arXiv:1910.03193, 2019. + +Michael Mathieu, Mikael Henaff, and Yann LeCun. Fast training of convolutional networks through ffts, 2013. + +Luis Mingo, Levon Aslanyan, Juan Castellanos, Miguel Diaz, and Vladimir Riazanov. Fourier neural networks: An approach with sinusoidal activation functions. 2004. + +NH Nelsen and AM Stuart. The random feature model for input-output maps between banach spaces. arXiv preprint arXiv:2005.10224, 2020. + +Shaowu Pan and Karthik Duraisamy. Physics-informed probabilistic learning of linear embeddings of nonlinear dynamics with guaranteed stability. SIAM Journal on Applied Dynamical Systems, 19(1):480–509, 2020. + +Ravi G Patel, Nathaniel A Trask, Mitchell A Wood, and Eric C Cyr. A physics-informed operator regression framework for extracting data-driven continuum models. Computer Methods in Applied Mechanics and Engineering, 373:113500, 2021. + +Maziar Raissi, Paris Perdikaris, and George E Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686–707, 2019. + +Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pp. 234–241. Springer, 2015. + +Vincent Sitzmann, Julien NP Martel, Alexander W Bergman, David B Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. arXiv preprint arXiv:2006.09661, 2020. + +Jonathan D Smith, Kamyar Azizzadenesheli, and Zachary E Ross. Eikonet: Solving the eikonal equation with deep neural networks. arXiv preprint arXiv:2004.00361, 2020. + +Vladimir N. Vapnik. Statistical Learning Theory. Wiley-Interscience, 1998. + +Rui Wang, Karthik Kashinath, Mustafa Mustafa, Adrian Albert, and Rose Yu. Towards physicsinformed deep learning for turbulent flow prediction. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1457–1466, 2020. + +Yinhao Zhu and Nicholas Zabaras. Bayesian deep convolutional encoder–decoder networks for surrogate modeling and uncertainty quantification. Journal of Computational Physics, 2018. ISSN 0021-9991. doi: https://doi.org/10.1016/j.jcp.2018.04.018. URL http://www. sciencedirect.com/science/article/pii/S0021999118302341. + +# A APPENDIX + +# A.1 TABLE OF NOTATIONS + +A table of notations is given in Table 2. + +Table 2: table of notations + +
Notation Meaning
Operator learningDcRdxEDa ∈ A= (D;Rda)u ∈U= (D;Rdu)DjG² :A→UμThe spatial domain for the PDEPoints in the the spatial domainThe input coefficient functionsThe target solution functionsThe discretization of (aj,uj)The operator mapping the coefficients to the solutionsA probability measure where aj sampled from.
Neural operatorU(x)∈RdudaduduK : R2(d+1) →Rdu×du中t=0,...,T0The neural network representation of u(x)Dimension of the input a(x).Dimension of the output u(x).The dimension of the representation v(x)The kernel maps (x,y,a(x),a(y)) to a dy × d matrixThe parameters of the kernel network KThe time steps (layers)The activation function
Fourier operatorF,F-1RWkkmaxFourier transformation and its inverse.The linear transformation applied on the lower Fourier modes.The linear transformation (bias term) applied on the spatial domain.Fourier modes /wave numbers.The max Fourier modes used in the Fourier layer.
HyperparametersNnSVTThe number of training pairs.The size of the discretization.The resolution of the discretization (sd = n).The viscosity.The time interval [O,T] for time-dependent equation.
+ +# A.2 SPECTRAL ANALYSIS + +The spectral decay of the Navier Stokes equation data is shown in Figure 4. The spectrum decay has a slope $k ^ { - 5 / 3 }$ , matching the energy spectrum in the turbulence region. And we notice the energy spectrum does not decay along with time. + +We also present the spectral decay in term of the truncation $k _ { m a x }$ defined in 4 as shown in Figure5. We note all equations (Burgers, Darcy, and Navier-Stokes with $\nu \leq 1 \mathrm { e } { - 4 }$ ) exhibit high frequency modes. Even we truncate at $k _ { m a x } = 1 2$ in the Fourier layer, the Fourier neural operator can recover the high frequency modes. + +# A.3 DATA GENERATION + +In this section, we provide the details of data generator for the three equation we used in Section 5. + +![](images/935eb5d09a2858b9d89d2f07d454ba4a50ddfeaa6db73e62950aa4080022dbfb.jpg) +Figure 4: Spectral Decay of Navier-Stokes equations + +The spectral decay of the Navier-stokes equation data we used in section 5.3. The y-axis is the spectrum; the $\mathbf { X }$ -axis is the wavenumber $| k | = k _ { 1 } + k _ { 2 }$ . + +![](images/bd9a3b97b63e751f0867517ae5ededa124bd7af9e103c3f18efc52feb56cdf6a.jpg) +Figure 5: Spectral Decay in term of $k _ { m a x }$ + +The error of truncation in one single Fourier layer without applying the linear transform $R$ . The y-axis is the normalized truncation error; the $\mathbf { X }$ -axis is the truncation mode $k _ { m a x }$ . + +# A.3.1 BURGERS EQUATION + +Recall the 1-d Burger’s equation on the unit torus: + +$$ +\begin{array} { r l } { \partial _ { t } u ( x , t ) + \partial _ { x } ( u ^ { 2 } ( x , t ) / 2 ) = \nu \partial _ { x x } u ( x , t ) , \quad } & { x \in ( 0 , 1 ) , t \in ( 0 , 1 ] } \\ { u ( x , 0 ) = u _ { 0 } ( x ) , \quad } & { x \in ( 0 , 1 ) . } \end{array} +$$ + +The initial condition $u _ { 0 } ( x )$ is generated according to $u _ { 0 } \sim \mu$ where $\mu = \mathcal { N } ( 0 , 6 2 5 ( - \Delta + 2 5 I ) ^ { - 2 } )$ with periodic boundary conditions. We set the viscosity to $\nu = 0 . 1$ and solve the equation using a split step method where the heat equation part is solved exactly in Fourier space then the non-linear part is advanced, again in Fourier space, using a very fine forward Euler method. We solve on a spatial mesh with resolution $2 ^ { 1 3 } = \bar { 8 1 9 2 }$ and use this dataset to subsample other resolutions. + +# A.3.2 DARCY FLOW + +The 2-d Darcy Flow is a second-order linear elliptic equation of the form + +$$ +\begin{array} { r l } { - \nabla \cdot ( a ( x ) \nabla u ( x ) ) = f ( x ) \quad } & { x \in ( 0 , 1 ) ^ { 2 } } \\ { u ( x ) = 0 \quad } & { x \in \partial ( 0 , 1 ) ^ { 2 } . } \end{array} +$$ + +The coefficients $a ( x )$ are generated according to $a \sim \mu$ where $\mu = \psi _ { \# } \mathcal N ( 0 , ( - \Delta + 9 I ) ^ { - 2 } )$ with zero Neumann boundary conditions on the Laplacian. The mapping $\psi : \mathbb { R } \mathbb { R }$ takes the value 12 on the positive part of the real line and 3 on the negative and the push-forward is defined pointwise. The forcing is kept fixed $f ( x ) = 1$ . Such constructions are prototypical models for many physical systems such as permeability in subsurface flows and material microstructures in elasticity. Solutions $u$ are obtained by using a second-order finite difference scheme on a $4 2 1 \times 4 2 1$ grid. Different resolutions are downsampled from this dataset. + +# A.3.3 NAVIER-STOKES EQUATION + +Recall the 2-d Navier-Stokes equation for a viscous, incompressible fluid in vorticity form on the unit torus: + +$$ +\begin{array} { r l r l } & { \partial _ { t } w ( x , t ) + u ( x , t ) \cdot \nabla w ( x , t ) = \nu \Delta w ( x , t ) + f ( x ) , } & & { x \in ( 0 , 1 ) ^ { 2 } , t \in ( 0 , T ] } \\ & { \qquad \nabla \cdot u ( x , t ) = 0 , } & & { x \in ( 0 , 1 ) ^ { 2 } , t \in [ 0 , T ] } \\ & { \qquad w ( x , 0 ) = w _ { 0 } ( x ) , } & & { x \in ( 0 , 1 ) ^ { 2 } . } \end{array} +$$ + +The initial condition $w _ { 0 } ( x )$ is generated according to $w _ { 0 } \sim \mu$ where $\mu = \mathcal { N } ( 0 , 7 ^ { 3 / 2 } ( - \Delta { + } 4 9 I ) ^ { - 2 . 5 } )$ with periodic boundary conditions. The forcing is kept fixed $f ( x ) = 0 . 1 ( \sin ( 2 \pi ( x _ { 1 } + x _ { 2 } ) ) +$ $\cos ( { \bar { 2 \pi } } ( x _ { 1 } + x _ { 2 } ) ) )$ ). The equation is solved using the stream-function formulation with a pseudospectral method. First a Poisson equation is solved in Fourier space to find the velocity field. Then the vorticity is differentiated and the non-linear term is computed is physical space after which it is dealiased. Time is advanced with a Crank–Nicolson update where the non-linear term does not enter the implicit part. All data are generated on a $2 5 6 \times 2 5 6$ grid and are downsampled to $6 4 \times 6 4$ . We use a time-step of $\mathrm { 1 e { - } 4 }$ for the Crank–Nicolson scheme in the data-generated process where we record the solution every $t = 1$ time units. The step is increased to $2 \mathrm { e } { - 2 }$ when used in MCMC for the Bayesian inverse problem. + +# A.4 RESULTS OF BURGERS’ EQUATION AND DARCY FLOW + +The details error rate on Burgers’ equation and Darcy Flow are listed in Table 3 and Table 4. + +Table 3: Benchmarks on 1-d Burgers’ equation + +
Networkss= 256s= 512s= 1024s = 2048s = 4096s= 8192
NN0.47140.45610.48030.46450.47790.4452
GCN0.39990.41380.41760.41570.41910.4198
FCN0.09580.14070.18770.23130.28550.3238
PCANN0.03980.03950.03910.03830.03920.0393
GNO0.05550.05940.06510.06630.06660.0699
LNO0.02120.02210.02170.02190.02000.0189
MGNO0.02430.03550.03740.03600.03640.0364
FNO0.01490.01580.01600.01460.01420.0139
+ +Table 4: Benchmarks on 2-d Darcy Flow + +
Networkss=85s=141s=211s= 421
NN0.17160.17160.17160.1716
FCN0.02530.04930.07270.1097
PCANN0.02990.02980.02980.0299
RBM0.02440.02510.02550.0259
GNO0.03460.03320.03420.0369
LNO0.05200.04610.0445
MGNO0.04160.04280.04280.0420
FNO0.01080.01090.01090.0098
+ +# A.5 BAYESIAN INVERSE PROBLEM + +Results of the Bayesian inverse problem for the Navier-Stokes equation are shown in Figure 6. It can be seen that the result using Fourier neural operator as a surrogate is as good as the result of the traditional solver. + +![](images/a7207702dccdb90c87f83495300ee949d84c7d72cff3999894b46e8c49e78d4d.jpg) + +The top left panel shows the true initial vorticity while bottom left panel shows the true observed vorticity at $T = 5 0$ with black dots indicating the locations of the observation points placed on a $7 \times 7$ grid. The top middle panel shows the posterior mean of the initial vorticity given the noisy observations estimated with MCMC using the traditional solver, while the top right panel shows the same thing but using FNO as a surrogate model. The bottom middle and right panels show the vorticity at $T = 5 0$ when the respective approximate posterior means are used as initial conditions. + +Figure 6: Results of the Bayesian inverse problem for the Navier-Stokes equation. \ No newline at end of file diff --git a/md/train/dgtpE6gKjHn/dgtpE6gKjHn.md b/md/train/dgtpE6gKjHn/dgtpE6gKjHn.md new file mode 100644 index 0000000000000000000000000000000000000000..d52acb43c71b88f194bbf0fc52082b3d0c96dee6 --- /dev/null +++ b/md/train/dgtpE6gKjHn/dgtpE6gKjHn.md @@ -0,0 +1,523 @@ +# FEDBE: MAKING BAYESIAN MODEL ENSEMBLE APPLICABLE TO FEDERATED LEARNING + +Hong-You Chen The Ohio State University, USA chen.9301@osu.edu + +Wei-Lun Chao The Ohio State University, USA chao.209@osu.edu + +# ABSTRACT + +Federated learning aims to collaboratively train a strong global model by accessing users’ locally trained models but not their own data. A crucial step is therefore to aggregate local models into a global model, which has been shown challenging when users have non-i.i.d. data. In this paper, we propose a novel aggregation algorithm named FEDBE, which takes a Bayesian inference perspective by sampling higher-quality global models and combining them via Bayesian model Ensemble, leading to much robust aggregation. We show that an effective model distribution can be constructed by simply fitting a Gaussian or Dirichlet distribution to the local models. Our empirical studies validate FEDBE’s superior performance, especially when users’ data are not i.i.d. and when the neural networks go deeper. Moreover, FEDBE is compatible with recent efforts in regularizing users’ model training, making it an easily applicable module: you only need to replace the aggregation method but leave other parts of your federated learning algorithm intact. + +# 1 INTRODUCTION + +Modern machine learning algorithms are data and computation hungry. It is therefore desired to collect as many data and computational resources as possible, for example, from individual users (e.g., users’ smartphones and pictures taken on them), without raising concerns in data security and privacy. Federated learning has thus emerged as a promising learning paradigm, which leverages individuals’ computational powers and data securely — by only sharing their locally trained models with the server — to jointly optimize a global model (Konecnˇ y et al., 2016; Yang et al., 2019). \` + +Federated learning (FL) generally involves multiple rounds of communication between the server and clients (i.e., individual sites). Within each round, the clients first train their own models using their own data, usually with limited sizes. The server then aggregates these models into a single, global model. The clients then begin the next round of training, using the global model as the initialization. + +We focus on model aggregation, one of the most critical steps in FL. The standard method is FEDAVG (McMahan et al., 2017), which performs element-wise average over clients’ model weights. Assuming that each client’s data are sampled i.i.d. from their aggregated data, FEDAVG has been shown convergent to the ideal model trained in a centralized way using the aggregated data (Zinkevich et al., 2010; McMahan et al., 2017; Zhou & Cong, 2017). Its performance, however, can degrade drastically if such an assumption does not hold in practice (Karimireddy et al., 2020; Li et al., 2020b; Zhao et al., 2018): FEDAVG simply drifts away from the ideal model. Moreover, by only taking weight average, FEDAVG does not fully utilize the information among clients (e.g., variances), and may have negative effects on over-parameterized models like neural networks due to their permutation-invariant property in the weight space (Wang et al., 2020; Yurochkin et al., 2019). + +To address these issues, we propose a novel aggregation approach using Bayesian inference, inspired by (Maddox et al., 2019). Treating each client’s model as a possible global model, we construct a distribution of global models, from which weight average (i.e., FEDAVG) is one particular sample and many other global models can be sampled. This distribution enables Bayesian model ensemble — aggregating the outputs of a wide spectrum of global models for a more robust prediction. We show that Bayesian model ensemble can make more accurate predictions than weight average at a single round of communication, especially under the non i.i.d. client condition. Nevertheless, lacking a single global model that represents Bayesian model ensemble and can be sent back to clients, Bayesian model ensemble cannot directly benefit federated learning in a multi-round setting. + +We therefore present FEDBE, a learning algorithm that effectively incorporates Bayesian model Ensemble into federated learning. Following (Guha et al., 2019), we assume that the server has access to a set of unlabeled data, on which we can make predictions by model ensemble. This assumption can easily be satisfied: the server usually collects its own data for model validation, and collecting unlabeled data is simpler than labeled ones. (See section 6 for more discussion, including the privacy concern.) Treating the ensemble predictions as the “pseudo-labels” of the unlabeled data, we can then summarize model ensemble into a single global model by knowledge distillation (Hinton et al., 2015) — using the predicted labels (or probabilities or logits) as the teacher to train a student global model. The student global model can then be sent back to the clients to begin their next round of training1. + +We identify one key detail of knowledge distillation in FEDBE. In contrast to its common practice where the teacher is highly accurate and labeled data are accessible, the ensemble predictions in federated learning can be relatively noisy2. To prevent the student from over-fitting the noise, we apply stochastic weight average (SWA) (Izmailov et al., 2018) in distillation. SWA runs stochastic gradient descent (SGD) with a cyclical learning rate and averages the weights of the traversed models, allowing the traversed models to jump out of noisy local minimums, leading to a more robust student. + +We validate FEDBE on CIFAR-10/100 (Krizhevsky et al., 2009) and Tiny-ImageNet (Le & Yang, 2015) under different client conditions (i.e., i.i.d. and non-i.i.d. ones), using ConvNet (TensorFlow team, 2016), ResNet (He et al., 2016), and MobileNetV2 (Howard et al., 2017; Sandler et al., 2018). FEDBE consistently outperforms FEDAVG, especially when the neural network architecture goes deeper. Moreover, FEDBE can be compatible with existing FL algorithms that regularize clients’ learning or leverage server momentum (Li et al., 2020a; Sahu et al., 2018; Karimireddy et al., 2020; Hsu et al., 2019) and further improves upon them. Interestingly, even if the unlabeled server data have a different distribution or domain from the test data (e.g., taken from a different dataset), FEDBE can still maintain its accuracy, making it highly applicable in practice. + +# 2 RELATED WORK (MORE IN APPENDIX A) + +Federated learning (FL). In the multi-round setting, FEDAVG (McMahan et al., 2017) is the standard approach. Many works have studied its effectiveness and limitation regarding convergence, robustness, and communication cost, especially in the situations of non-i.i.d. clients. Please see Appendix A for a list of works. Many works proposed to improve FEDAVG. FEDPROX (Li et al., 2020a; Sahu et al., 2018), FEDDANE (Li et al., 2019), Yao et al. (2019), and SCAFFOLD (Karimireddy et al., 2020) designed better local training strategies to prevent clients’ model drifts. Zhao et al. (2018) studied the use of shared data between the server and clients to reduce model drifts. Reddi et al. (2020) and Hsu et al. (2019) designed better update rules for the global model by server momentum and adaptive optimization. Our FEDBE is complementary to and can be compatible with these efforts. + +In terms of model aggregation. Yurochkin et al. (2019) developed a Bayesian non-parametric approach to match clients’ weights before average, and FEDMA (Wang et al., 2020) improved upon it by iterative layer-wise matching. One drawback of FEDMA is its linear dependence of computation and communication on the network’s depth, not suitable for deeper models. Also, both methods are not yet applicable to networks with residual links and batch normalization (Ioffe & Szegedy, 2015). We improve aggregation via Bayesian ensemble and knowledge distillation, bypassing weight matching. + +Ensemble learning and knowledge distillation. Model ensemble is known to be more robust and accurate than individual base models (Zhou, 2012; Dietterich, 2000; Breiman, 1996). Several recent works (Anil et al., 2018; Guo et al., 2020; Chen et al., 2020) investigated the use of model ensemble and knowledge distillation (Hinton et al., 2015) in an online fashion to jointly learn multiple models, where the base models and distillation have access to the centralized labeled data or decentralized data of the same distribution. In contrast, client models in FL are learned with isolated and likely non-i.i.d. and limited data; our distillation is performed without labeled data. We thus propose to sample base models of higher quality for Bayesian ensemble and employ SWA for robust distillation. + +Knowledge distillation in FL. Guha et al. (2019) considered one-round FL and applied distillation to obtain a global model from the direct ensemble of clients’ models. A similar idea was used in (Papernot et al., 2017) in a different context. Our method can be viewed as an extension of (Guha et al., 2019) to multi-round FL, with higher-quality base models being sampled from a global distribution for more robust ensemble. Knowledge distillation was also used in (Li & Wang, 2019) and (Jeong et al., 2018) but for different purposes. Li & Wang (2019) performed ensemble distillation for each client, aiming to learn strong personalized models but not the global model. Jeong et al. (2018) aimed to speed up communication by sending averaged logits of clients’ data, not models, between clients and the server. The clients then use the aggregated logits to regularize local training via distillation. The accuracy, however, drops drastically compared to FEDAVG in exchange for faster communication. In contrast, we distill on the server using unlabeled data collected at the server, aiming to build a stronger global model. The most similar work to ours is a concurrent work by Lin et al. $( 2 0 2 0 ) ^ { 3 }$ , which also employs ensemble distillation on the server in a multi-round setting. Our work is notably different from all the above methods by taking the Bayesian perspective to sample better base models and investigating SWA for distillation, significantly improving the performance on multi-round FL. + +# 3 BAYESIAN MODEL ENSEMBLE FOR FEDERATED LEARNING + +# 3.1 BACKGROUND: FEDAVG + +Federated learning (FL) usually involves a server coordinating with many clients to jointly learn a global model without data sharing, in which FEDAVG (McMahan et al., 2017) in a standard approach. Denote by $s$ the set of clients, $\mathcal { D } _ { i } = \{ ( \boldsymbol { x } _ { n } , y _ { n } ) \} _ { n = 1 } ^ { N _ { i } }$ the labeled data of client $i$ , and $\bar { \mathbf { \Gamma } } _ { \bar { \mathbf { \Gamma } } } \bar { \mathbf { \Gamma } } _ { \bar { \mathbf { \Gamma } } }$ the weights of the current global model, FEDAVG starts with client training of all the clients in parallel, initializing each clients’ model ${ \pmb w } _ { i }$ with $\bar { \pmb w }$ and performing SGD for $K$ steps with a step size $\eta _ { l }$ + +# Client training: + +$$ +\pmb { w } _ { i } \pmb { w } _ { i } - \eta _ { l } \nabla \ell ( B _ { k } , \pmb { w } _ { i } ) , \mathrm { f o r } k = 1 , 2 , \cdots , K , +$$ + +where $\ell$ is a loss function and $B _ { k }$ is the mini-batch sampled from $\mathcal { D } _ { i }$ at the $k$ th step. After receiving all the clients’ models $\{ w _ { i } ; i \in { \mathcal { S } } \}$ , given $\begin{array} { r } { \left. \mathcal { D } \right. = \sum _ { i } \mathsf { \bar { \vert } } \mathcal { D } _ { i } \vert } \end{array}$ , FEDAVG performs weight average to update the global model $\bar { \pmb w }$ + +$$ +\mathbf { M o d e l \ a g g r e g a t i o n \ ( b y \ w e i g h t { a v e r a g e } ) } : \qquad \bar { w } \gets \sum _ { i } \frac { | { \mathcal { D } } _ { i } | } { | { \mathcal { D } } | } w _ { i } . +$$ + +With the updated global model $\bar { \mathbf { \Gamma } } _ { \bar { \mathbf { \Gamma } } } \bar { \mathbf { \Gamma } } _ { \bar { \mathbf { \Gamma } } }$ , FEDAVG then starts the next round of client training. The whole procedure of FEDAVG therefore iterates between Equation 1 and Equation 2, for $R$ rounds. + +In the case that $\mathcal { D } _ { i }$ is i.i.d. sampled from the aggregated data $\textstyle { \mathcal { D } } = \bigcup _ { i \in { \mathcal { S } } } { \mathcal { D } } _ { i }$ , FEDAVG has been shown convergent to the ideal model $\scriptstyle w ^ { \star }$ learned directly from $\mathcal { D }$ in a centralized manner (Stich, 2019; Haddadpour & Mahdavi, 2019; Khaled et al., 2020). In reality, however, the server has little control and knowledge about the clients. Each client may have different data distributions in the input (e.g., image distribution) or output (e.g., label distribution). Some clients may disconnect at certain rounds. All of these factors suggest the non-i.i.d. nature of federated learning in practice, under which the effectiveness of FEDAVG can largely degrade (Zhao et al., 2018; Li et al., $2 0 2 0 \mathrm { b }$ ; Hsu et al., 2019). For example, Karimireddy et al. (2020) show that $\bar { \pmb { w } }$ in Equation 2 can drift away from $\boldsymbol { w } ^ { \star }$ . + +# 3.2 A BAYESIAN PERSPECTIVE + +We propose to view the problem of model drift from a Bayesian perspective. In Bayesian learning, it is the posterior distribution $p ( \pmb { w } | \mathcal { D } )$ of the global model being learned, from which $\bar { \pmb w }$ and $\scriptstyle { { \pmb w } ^ { \star } }$ can be regarded as two particular samples (i.e., point estimates). Denote by $p ( \boldsymbol { y } | \boldsymbol { x } ; \boldsymbol { w } )$ the output probability of a global model $\pmb { w }$ , one approach to mitigate model drift is to perform Bayesian inference (Neal, 2012; Barber, 2012) for prediction, integrating the outputs of all possible models w.r.t. the posterior + +$$ +p ( y | \mathbf { x } ; \mathcal { D } ) = \int p ( y | \mathbf { x } ; \pmb { w } ) p ( \pmb { w } | \mathcal { D } ) d \pmb { w } +$$ + +rather than relying on a single point estimate. While Equation 3 is intractable in general, we can approximate it by the Monte Carlo method, sampling $M$ models for model ensemble + +$$ +p ( \boldsymbol { y } | \boldsymbol { x } ; \mathcal { D } ) \approx \frac { 1 } { M } \sum _ { m = 1 } ^ { M } p ( \boldsymbol { y } | \boldsymbol { x } ; \boldsymbol { w } ^ { ( m ) } ) , \mathrm { ~ w h e r e ~ } \boldsymbol { w } ^ { ( m ) } \sim p ( \boldsymbol { w } | \mathcal { D } ) . +$$ + +The question is: how to estimate $p ( \pmb { w } | \mathcal { D } )$ in federated learning, given merely client models $\{ w _ { i } \} ?$ + +# 3.3 BAYESIAN MODEL ENSEMBLE WITH APPROXIMATED POSTERIORS + +We resort to a recently proposed idea, named stochastic weight average-Gaussian (SWAG) (Maddox et al., 2019), for estimating the posterior. SWAG employed a cyclical or constant learning rate in SGD, following SWA (Izmailov et al., 2018). SWAG then constructs a Gaussian distribution $\mathbf { \widetilde { \rho } } _ { p ( w | \mathcal { D } ) }$ by fitting the parameters to the model weights it traverses in SGD. + +In federated learning, by rewriting ${ \pmb w } _ { i }$ as $\bar { \mathbf { \pmb { w } } } - \mathbf { \nabla } _ { \mathbf { \lambda } }$ , where $\mathbf { } g _ { i } = - ( \boldsymbol { w } _ { i } - \bar { \boldsymbol { w } } )$ denotes the $K$ -step stochastic gradient on a mini-batch $\mathcal { D } _ { i } \subset \mathcal { D }$ (McMahan et al., 2017), we can indeed view each client’s model ${ \pmb w } _ { i }$ as taking $K$ -step SGD to traverse the weight space of global models. + +Gaussian. To this end, we propose to fit a diagonal Gaussian distribution $\begin{array} { r } { { \mathcal { N } } ( { \boldsymbol { \mu } } , { \boldsymbol { \Sigma } } _ { \mathrm { d i a g } } ) } \end{array}$ to the clients’ models $\{ w _ { i } \}$ following (Maddox et al., 2019), + +$$ +\mu = \sum _ { i } \frac { | { \mathcal D } _ { i } | } { | { \mathcal D } | } w _ { i } , \qquad \Sigma _ { \mathrm { d i a g } } = \mathrm { d i a g } \left( \sum _ { i } \frac { | { \mathcal D } _ { i } | } { | { \mathcal D } | } ( w _ { i } - \mu ) ^ { 2 } \right) , +$$ + +from which we can sample $\{ \pmb { w } ^ { ( m ) } \sim \mathcal { N } ( \pmb { \mu } , \Sigma _ { \mathrm { d i a g } } ) \} _ { m = 1 } ^ { M }$ for model ensemble (cf. Equation 4). Here $( \cdot ) ^ { 2 }$ means taking element-wise square. We note that, both the clients’ models $\{ w _ { i } \}$ and FEDAVG $\bar { \pmb { w } }$ are possible samples from $\begin{array} { r } { { \mathcal { N } } ( { \boldsymbol { \mu } } , { \boldsymbol { \Sigma } } _ { \mathrm { d i a g } } ) } \end{array}$ . + +Dirichlet. We investigate another way to construct $p ( \pmb { w } | \mathcal { D } )$ , inspired by the fact that an averaged stochastic gradient is in general closer to the true gradient than individual stochastic gradients (Haddadpour & Mahdavi, 2019; Izmailov et al., 2018; Liang et al., 2019; Stich, 2019; Zhou & Cong, 2017). By viewing each client’s model as ${ \pmb w } _ { i } = \bar { \pmb w } - { \pmb g } _ { i }$ , such a fact suggests that a convex combination (i.e., weighted average) of clients’ models can lead to a better model than each client alone: + +$$ +w = \sum _ { i } \frac { \gamma _ { i } \lvert \mathcal { D } _ { i } \rvert } { \sum _ { i ^ { \prime } } \gamma _ { i ^ { \prime } } \lvert \mathcal { D } _ { i ^ { \prime } } \rvert } w _ { i } = \bar { w } - \sum _ { i } \frac { \gamma _ { i } \lvert \mathcal { D } _ { i } \rvert } { \sum _ { i ^ { \prime } } \gamma _ { i ^ { \prime } } \lvert \mathcal { D } _ { i ^ { \prime } } \rvert } g _ { i } , +$$ + +where $\gamma = [ \gamma _ { 1 } , \cdot \cdot \cdot , \gamma _ { | S | } ] ^ { \top } \in \Delta ^ { | S | - 1 }$ is a vector on the $( | S | - 1 )$ -simplex. To this end, we use a Dirichlet distribution $\operatorname { D i r } ( \alpha )$ to model the distribution of $\gamma$ , from which we can then sample $\mathbf { \Delta } _ { \pmb { w } } ^ { ( m ) }$ by + +$$ +{ \pmb w } ^ { ( m ) } = \sum _ { i } \frac { \gamma _ { i } ^ { ( m ) } | { \mathcal D } _ { i } | } { \sum _ { i ^ { \prime } } \gamma _ { i ^ { \prime } } ^ { ( m ) } | { \mathcal D } _ { i ^ { \prime } } | } { \pmb w } _ { i } , \qquad \gamma ^ { ( m ) } \sim p ( \gamma ) = p ( \gamma _ { 1 } , \cdots , \gamma _ { | S | } ) = \frac { 1 } { \mathrm { B } ( { \alpha } ) } \prod _ { i } \gamma _ { i } ^ { \alpha _ { i } - 1 } , +$$ + +where ${ \pmb { \alpha } } = [ \alpha _ { 1 } , \cdot \cdot \cdot , \alpha _ { | S | } ] ^ { \top } \succ { \bf 0 }$ is the parameter of a Dirichlet distribution, and $\mathbf { B } ( \alpha )$ is the multivariate beta function for normalization. We study different $_ { \pmb { \alpha } }$ in subsection C.1. + +To sum up, Bayesian model ensemble in federated learning takes the following two steps: + +• Construct $p ( \pmb { w } | \mathcal { D } )$ from the clients’ models $\{ w _ { i } \}$ (cf. Equation 5 or Equation 7) • Sample $\{ \pmb { w } ^ { ( m ) } \sim p ( \pmb { w } | \mathcal { D } ) \} _ { m = 1 } ^ { M }$ and perform ensemble (cf. Equation 4) + +Analysis. We validate Bayesian model ensemble with a three-class classification problem on the Swiss roll data in Figure 1 (a). We consider three clients with the same amount of training data: each has $8 0 \%$ data from one class and $2 0 \%$ from the other two classes, essentially a non-i.i.d. case. We apply FEDAVG to train a two-layer MLP for 10 rounds (each round with 2 epochs). We then show the test accuracy of models sampled from Equation 7 (with $\pmb { \alpha } = 0 . 5 \times \mathbf { 1 } _ { , }$ ) — the corners of the triangle (i.e., $\Delta ^ { 2 \cdot }$ ) in Figure 1 (b) correspond to the clients; the position inside the triangle corresponds to the $\gamma$ coefficients. We see that, the sampled models within the triangle usually have higher accuracy than the clients’ models. Surprisingly, the best performing model that can be sampled from a Dirichlet distribution is not FEDAVG (the center of the triangle), but the one drifting to the bottom right. This suggests that Bayesian model ensemble can lead to higher accuracy (by averaging over sampled models) than FEDAVG alone. Indeed, by combining 10 randomly sampled models via Equation 4, Bayesian model ensemble attains a $6 9 \%$ test accuracy, higher than $6 4 \%$ by FEDAVG. Figure 1 (c) further shows that the sampled models have a better alignment between the prediction confidence and accuracy than the clients’ (mean results of 3 clients or samples). See subsection C.1 for details. + +![](images/8b5e474b48abbbf749844dae8fa8f49b5d46c87bd69ff5f0e480c6d8e700aa98.jpg) +Figure 1: An illustration of models that can be sampled from a Dirichlet distribution (Equation 7). (a) A three-class toy data with three clients, each has non-i.i.d. imbalanced data. (b) We show the sampled model’s corresponding $\gamma$ (position in the triangle) and its test accuracy (color). FEDAVG is at the center; clients’ models are at corners. The best performing model (star) is not at the center, drifting away from FEDAVG. (c) Histograms of (in)correctly predicted examples at different confidences ( $\mathbf { \Delta x }$ -axis) by sampled models and clients. + +To further compare FEDAVG and ensemble, we linearize $p ( \boldsymbol { y } | \boldsymbol { x } ; \cdot )$ at $\bar { \pmb w }$ (Izmailov et al., 2018), + +$$ +p ( \boldsymbol { y } | \boldsymbol { x } ; \boldsymbol { w } ^ { ( m ) } ) = p ( \boldsymbol { y } | \boldsymbol { x } ; \bar { \boldsymbol { w } } ) + \langle \nabla p ( \boldsymbol { y } | \boldsymbol { x } ; \bar { \boldsymbol { w } } ) , \Omega ^ { ( m ) } \rangle + O ( \| \Omega ^ { ( m ) } \| ^ { 2 } ) , +$$ + +where $\Omega ^ { ( m ) } = \pmb { w } ^ { ( m ) } - \bar { \pmb { w } }$ and $\langle \cdot , \cdot \rangle$ is the dot product. By averaging the sampled models, we arrive at + +$$ +\frac { 1 } { M } \sum _ { m } p ( y | x ; w ^ { ( m ) } ) - p ( y | x ; \bar { w } ) = \langle \nabla p ( y | x ; \bar { w } ) , \frac { 1 } { M } \sum _ { m } \Omega ^ { ( m ) } \rangle + O ( \Omega ^ { 2 } ) = O ( \Omega ^ { 2 } ) , +$$ + +where $\Omega = \operatorname* { m a x } _ { m } \left. \Omega ^ { ( m ) } \right.$ . In federated learning, especially in the non-i.i.d. cases, $\Omega$ can be quite large. Bayesian ensemble thus can have a notable difference (improvement) compared to FEDAVG. + +# 4 FEDBE + +Bayesian model ensemble, however, cannot directly benefit multi-round federated learning, in which a single global model must be sent back to the clients to continue client training. We must translate the prediction rule of Bayesian model ensemble into a single global model. + +Server input :initial global model $\pmb { w }$ , SWA scheduler ηSWA, unlabeled data $\mathcal { U } = \{ \pmb { x } _ { j } \} _ { j = 1 } ^ { J }$ ; +Client i’s input :local step size $\eta _ { l }$ , local labeled data $\mathcal { D } _ { i }$ ; +for $r \gets 1$ to $R$ do Sample clients ${ \mathcal { S } } \subseteq \{ 1 , \cdots , N \}$ ; Communicate $\textbf { \em w }$ to all clients $i \in S$ ; for each client $i \in S$ in parallel do Initialize local model $\mathbf { \Delta } \mathbf { \psi } \mathbf { \Sigma } \mathbf { w } _ { i } \gets \mathbf { \Delta } \mathbf { w }$ ; ${ \boldsymbol { w } } _ { i } \gets$ Client trainin $\mathbf { \Omega } _ { \mathfrak { s } } ( \mathfrak { w } _ { i } , \mathcal { D } _ { i } , \eta _ { l } )$ ; [Equation 1] Communicate ${ \pmb w } _ { i }$ to the server; end Construct $\begin{array} { r } { \pmb { \bar { w } } = \sum _ { i \in \pmb { S } } \frac { | \mathcal { D } _ { i } | } { \sum _ { i ^ { \prime } \in \pmb { S } } | \mathcal { D } _ { i } ^ { \prime } | } \pmb { w } _ { i } } \end{array}$ ; Construct global model distribution $p ( \pmb { w } | \mathcal { D } )$ from $\{ w _ { i } ; i \in \mathcal { S } \}$ ; [Equation 5 or Equation 7] Sample $M$ global models $\{ \pmb { w } ^ { ( m ) } \sim p ( \pmb { w } | \mathcal { D } ) \} _ { m = 1 } ^ { M }$ ; Construct {w(m0)}M0m0= {w¯} ∪ {wi; i ∈ S} ∪ {w(m)}Mm= ; Construct $\mathcal { T } = \{ \pmb { x } _ { j } , \pmb { \hat { p } } _ { j } \} _ { j = 1 } ^ { J }$ , where pˆj = 10 Pm0 p(y|xj ; w(m0)); [Equation 4] Knowledge distillation: ${ \pmb w } \gets \mathrm { S W A } ( { \bar { \pmb w } } , { \mathcal T } , \eta _ { \mathrm { S W A } } )$ ; +end +Server output : $\textbf { \em w }$ . + +To this end, we make an assumption that we can access a set of unlabeled data $\mathcal { U } = \{ \pmb { x } _ { j } \} _ { j = 1 } ^ { J }$ at the server. This can easily be satisfied since collecting unlabeled data is simpler than labeled ones. We use $\mathcal { U }$ for two purposes. On one hand, we use $\mathcal { U }$ to memorize the prediction rule of Bayesian model ensemble, turning $\mathcal { U }$ into a pseudo-labeled set $\mathcal { T } = \{ ( \pmb { x } _ { j } , \bar { \hat { p } _ { j } } ) \} _ { j = 1 } ^ { J } ,$ where a prob $\begin{array} { r } { \hat { \pmb { p } } _ { j } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } p ( y | \pmb { x } _ { j } ; \pmb { w } ^ { ( m ) } ) } \end{array}$ isnd, we use $\tau$ as supervision to train a global model $\textbf { \em w }$ , aiming to mimic the prediction rule of Bayesian model ensemble on $\mathcal { U }$ + +This process is reminiscent of knowledge distillation (Hinton et al., 2015) to transfer knowledge from a teacher model (in our case, the Bayesian model ensemble) to a student model (a single global model). Here we apply a cross entropy loss to learn $\begin{array} { r } { \pmb { w } : - \frac { 1 } { J } \sum _ { j } \hat { \pmb { p } } _ { j } ^ { \top } \log ( p ( y | \pmb { x } _ { j } ; \pmb { w } ) ) } \end{array}$ . + +SWA for knowledge distillation. Optimizing $\textbf { \em w }$ using standard SGD, however, may arrive at a suboptimal solution: the resulting $\pmb { w }$ can have much worse test accuracy than ensemble. We identify one major reason: the ensemble prediction $\hat { p } _ { j }$ can be noisy (e.g., arg $\operatorname* { m a x } _ { c } \hat { p } _ { j } [ c ]$ is not the true label of $\boldsymbol { \mathscr { x } } _ { j }$ ), especially in the early rounds of FL. The student model $\pmb { w }$ thus may over-fit the noise. We note that, this finding does not contradict our observations in subsection 3.3: Bayesian model ensemble has higher test accuracy than FEDAVG but is still far from being perfect (i.e., $1 0 0 \%$ accuracy). To address this issue, we apply SWA (Izmailov et al., 2018) to train $\pmb { w }$ . SWA employs a cyclical learning rate schedule in SGD by periodically imposing a sharp increase in step sizes and averages the weights of models it traverses, enabling $\pmb { w }$ to jump out of noisy local minimums. As will be shown in section 5, SWA consistently outperforms SGD in distilling the ensemble predictions into the global model. + +We name our algorithm FEDBE (Federated Bayesian Ensemble) and summarize it in algorithm 1. While knowledge distillation needs extra computation at the server, it is hardly a concern as the server is likely computationally rich. (See subsection D.1 for details.) We also empirically show that a small number of sampled models (e.g., $M = 1 0 \sim 2 0$ ) are already sufficient for FEDBE to be effective. + +# 5 EXPERIMENT + +# 5.1 SETUP (MORE DETAILS IN APPENDIX B) + +Datasets, models, and settings. We use CIFAR-10/100 (Krizhevsky et al., 2009), both contain 50K training and 10K test images, from 10 and 100 classes. We also use Tiny-ImageNet (Le & Yang, 2015), which has 500 training and 50 test images per class for 200 classes. We follow (McMahan et al., 2017) to use a ConvNet (LeCun et al., 1998) with 3 convolutional and 2 fully-connected layers. We also use ResNet-{20, 32, 44, 56} (He et al., 2016) and MobileNetV2 (Sandler et al., 2018). We split part of the training data to the server as the unlabeled data, distribute the rest to the clients, and evaluate on the test set. We report mean $\pm$ standard deviation (std) over five times of experiments. + +Implementation details. As mentioned in (McMahan et al., 2017; Wang et al., 2020; Li et al., 2020b), FEDAVG is sensitive to the local training epochs $E$ per round $\begin{array} { r } { \langle E = \lceil \frac { K \mid B _ { K } \mid } { \mid \mathcal { D } _ { i } \mid } \rceil } \end{array}$ in Equation 1). Thus, in each experiment, we first tune $E$ from $[ 1 , 5 , 1 0 , 2 0 , 3 0 , 4 0 ]$ for FEDAVG and adopt the same $E$ to FEDBE. Li et al. (2020b); Reddi et al. (2020) suggested that the local step size $\eta _ { l }$ (see Equation 1) must decay along the communication rounds in non-i.i.d. settings for convergence. We set the initial $\eta _ { l }$ as 0.01 and decay it by 0.1 at $30 \%$ and $60 \%$ of total rounds, respectively. Within each round of local training, we use SGD optimizer with weight decay and a 0.9 momentum and impose no further decay on local step sizes. Weight decay is crucial in local training (cf. subsection B.3). For ResNet and MobileNetV2, we use batch normalization (BN). See subsection C.5 for a discussion on using group normalization (GN) (Wu & He, 2018; Hsieh et al., 2020), which converges much slower. + +Baselines. Besides FEDAVG, we compare to one-round training with 200 local epochs followed by model ensemble at the end (1-Ensemble). We also compare to vanilla knowledge distillation $\mathbf { \widetilde { v } }$ -Distillation), which performs ensemble directly over clients’ models and uses a SGD momentum optimizer (with a batch size of 128 for 20 epochs) for distillation in each round. For fast convergence, we initialize distillation with the weight average of clients’ models and sharpen the pseudo label as $\begin{array} { r } { \hat { p } _ { j } [ c ] \hat { p } _ { j } [ c ] ^ { 2 } / \sum _ { c ^ { \prime } } \hat { p } _ { j } [ c ^ { \prime } ] ^ { 2 } } \end{array}$ , similar to (Berthelot et al., 2019). We note that, v-Distillation is highly similar to (Lin et al., 2020) except for different hyper-parameters. We also compare to FEDPROX (Li et al., 2020a) and FEDAVGM (Hsu et al., 2019) on better local training and using server momentum. + +FEDBE. We focus on Gaussian (cf. Equation 5). Results with Dirichlet distributions are in subsection C.1. We sample $M { = } 1 0$ models and combine them with the weight average of clients and individual clients for ensemble. For distillation, we apply SWA (Izmailov et al., 2018), which uses a cyclical schedule with the step size $\eta _ { \mathrm { S W A } }$ decaying from 1e−3 to 4e−4, and collect models at the end of every cycle (every 25 steps) after the $2 5 0 \mathrm { t h }$ step. We follow other settings of v-Distillation (e.g., distill for 20 epochs per round). We average the collected models to obtain the global model. + +5.2 MAIN STUDIES: CIFAR-10 WITH NON-I.I.D. CLIENTS USING DEEP NEURAL NETWORKS + +Setup. We focus on CIFAR-10. We randomly split 10K training images to be the unlabeled data at the server. We distribute the remaining images to 10 clients with two non-i.i.d. cases. Step: Each client has 8 minor classes with 10 images per class, and 2 major classes with 1,960 images per class, inspired by (Cao et al., 2019). Dirichlet: We follow (Hsu et al., 2019) to simulate a heterogeneous partition for $N$ clients on $C$ classes. For class $c$ , we draw a $N$ -dim vector $\pmb { q } _ { c }$ from $\operatorname { D i r } ( 0 . 1 )$ and assign data to client $n$ proportionally to ${ \mathbf { } q } _ { c } [ n ]$ . The clients have different numbers of total images. + +Table 1: Mean±std of test accuracy $( \% )$ on non-i.i.d. CIFAR-10. $\star :$ : trained with 50K images without splitting. + +
Non-i.i.d. Type]MethodConvNetResNet20ResNet32ResNet44ResNet56
Step1-Ensemble60.5±0.2849.9±0.4635.5±0.5032.8±0.3823.3±0.52
FEDAVG72.0±0.2570.2±0.1766.5±0.3660.5±0.2651.4±0.15
v-Distillation69.2±0.1872.6±0.6268.4±0.3360.4±0.5356.4±1.10
FEDBE (w/o SWA)72.1±1.2174.9±1.4171.1±0.7561.0±0.7556.6±0.85
FEDBE74.5±0.51 77.5±0.4272.7±0.2765.5±0.3260.7±0.45
Dirichlet1-Ensemble63.3±0.56 45.2±1.0639.5±0.7831.5±0.77 27.2±0.65
FEDAVG72.3±0.1274.4±0.3673.4±0.2367.1±0.54 62.2±0.45
v-Distillation67.7±0.98 73.1±0.78 70.8±0.64 66.9±0.85 62.8±0.66
FEDBE (w/o SWA)70.1±0.4275.9±0.5673.9±0.5568.2±0.7263.2±0.71
FEDBE73.9±0.45 78.2±0.36 77.7±0.45 71.5±0.38 67.0±0.30
Centralized*SGD84.591.792.693.193.4
+ +Table 2: Compatibility of FEDBE with FEDAVGM and FEDPROX on non-i.i.d. CIFAR-10. + +
Non-i.i.d. Type MethodConvNet1ResNet20ResNet32ResNet44ResNet56
StepFEDPROX72.5±0.71 71.1±0.52 67.7±0.26 60.4±0.71 54.9±0.66
FEDBE +FEDPROX74.9±0.38 77.7±0.45 72.9±0.44 64.5±0.37 60.1±0.62
FEDAVGM72.3±0.55 73.2±0.57 70.0±0.62 59.9±0.65 52.7±0.49
FEDBE +FEDAVGM74.5±0.47 78.0±0.46 73.6±0.50 65.5±0.40 59.7±0.51
DirichletFEDPROX72.6±0.38 76.1±0.49 73.4±0.51 68.1±0.79 60.9±0.46
FEDBE +FEDPROX74.6±0.35 78.7±0.49777.3±0.60 71.7±0.43 66.5±0.41
FEDAVGM73.0±0.4376.5±0.4475.5±0.79 67.7±0.46 58.9±0.72
FEDBE +FEDAVGM74.4±0.49 78.5±0.66 78.5±0.26 72.0±0.51 67.0±0.55
+ +Results. We implement all methods with 40 rounds4, except for the one-round Ensemble. We assume that all clients are connected at every round. We set the local batch size as 40. Table 1 summarizes the results. FEDBE outperforms the baselines by a notable margin. Compared to FEDAVG, FEDBE consistently leads to a $2 \sim 9 \%$ gain, which becomes larger as the network goes deeper. By comparing FEDBE to FEDBE (w/o SWA) and v-Distillation, we see the consistent improvement by SWA for distillation and Bayesian ensemble with sampled models. We note that, FEDAVG outperforms 1-Ensemble and is on a par with v-Distillation5, justifying (a) the importance of multi-round training; (b) the challenge of ensemble distillation. Please see subsection C.2 for an insightful analysis. + +Compatibility with existing efforts. Our improvement in model aggregation is compatible with recent efforts in better local training (Li et al., 2020a; Karimireddy et al., 2020) and using server momentum (Reddi et al., 2020; Hsu et al., 2019). Specifically, Reddi et al. (2020); Hsu et al. (2019) applied the server momentum to FEDAVG by treating FEDAVG in each round as a step of adaptive optimization. FEDBE can incorporate this idea by initializing distillation with their FEDAVG. Table 2 shows the results of FEDPROX (Li et al., 2020a) and FEDAVGM (Hsu et al., 2019), w/ or w/o FEDBE. FEDBE can largely improve them. The combination even outperforms FEDBE alone in many cases. + +Effects of Bayesian Ensemble. We focus on the Step setting. We compare different combinations of client models C: $\{ w _ { i } \}$ , client weight average A: $\bar { \pmb w }$ , and $M$ samples from Gaussian S: $\{ \pmb { w } ^ { ( m ) } \} _ { m = 1 } ^ { M }$ to construct the distillation targets $\tau$ for FEDBE in algorithm 1. As shown in Table 3, sampling global models for Bayesian ensemble improves the accuracy. Sampling $M = 1 0 \sim 2 0$ samples (plus weight average and clients to form ensemble) is sufficient to make FEDBE effective (see Figure 2). + +Table 3: FEDBE distillation targets. A: client average; C: clients; S: samples. + +
Distillation Targets丨ConvNettResNet20
s72.6±0.28 73.4±0.46 73.1±0.46 75.2±0.61
S+A A+C[73.9±0.33 76.1±0.47 73.0±0.3675.4±0.38
s+c S+A+C74.0±0.66 77.9±0.56 77.5±0.42
Ground-truth labels|76.6±0.21|74.5±0.51 80.2±0.23
+ +![](images/b5f32516f507e955c865a4efba4f0b2876b8af801f70cf43439f7aea5caaf110.jpg) +Figure 2: # of sampled models in FEDBE. + +![](images/820658658c106bfb911d5e5a9158770c019866551e8ab83365373652cc0cbd4f.jpg) +Figure 3: FEDAVG while monitoring the Bayesian ensemble. + +![](images/ef1e9939094a8ce4960071426ac567a42ab57e549476de74f58059bc2342d176.jpg) +Figure 4: # of layers (ConvNet). GT: with ground-truth targets. + +Table 4: FEDBE on non-i.i.d CIFAR-10 with different unlabeled data $\mathcal { U }$ + +
Non-i.i.d. Typeu|uConvNetResNet20ResNet32ResNet44ResNet56
StepCIFAR-1010K74.5±0.5177.5±0.4272.7±0.2765.5±0.3260.7±0.45
CIFAR-10050K74.4±0.4578.2±0.5872.2±0.3565.1±0.3761.0±0.49
Tiny-ImageNet100K74.5±0.6477.1±0.5172.3±0.4364.5±0.5160.9±0.32
DirichletCIFAR-1010K73.9±0.4578.2±0.3677.7±0.45 71.5±0.3867.0±0.30
CIFAR-10050K73.5±0.4178.6±0.6376.5±0.61 72.0±0.71 66.9±0.57
Tiny-ImageNet100K74.0±0.35 78.2±0.72 76.7±0.52 71.6±0.66 67.3±0.32
+ +![](images/adfcf6e37c0e0a0345d70a245511f5bd209d74ccd1379009fc2acb379274002c.jpg) +Figure 5: Effects on varying the size and domains of the server dataset on CIFAR-10 experiments. + +Bayesian model ensemble vs. weight average for prediction. In Figure 3, we perform FEDAVG and show the test accuracy at every round, together with the accuracy by Bayesian model ensemble, on the Step-non-i.i.d CIFAR-10 experiment using ResNet20. That is, we take the clients’ models learned with FEDAVG to construct the distribution, sample models from it, and perform ensemble for the predictions. Bayesian model ensemble outperforms weight average at nearly all the rounds, even though it is noisy (i.e., not with $1 0 0 \%$ accuracy). + +Effects of unlabeled data. FEDBE utilizes unlabeled data $\mathcal { U }$ to enable knowledge distillation. Figure 5a studies the effect of $| \mathcal { U } |$ : we redo the same Step experiments but keep 25K training images away from clients and vary $| \mathcal { U } |$ in the server. FEDBE outperforms FEDAVG even with 1K unlabeled dataset (merely $4 \%$ of the total client data). We note that, FEDAVG (ResNet20) trained with the full 50K images only reaches $7 2 . 5 \%$ , worse than FEDBE, justifying that the gain by FEDBE is not simply from seeing more data. Adding more unlabeled data consistently but slightly improve FEDBE. + +We further investigate the situation that the unlabeled data come from a different domain or task. This is to simulate the cases that (a) the server has little knowledge about clients’ data and (b) the server cannot collect unlabeled data that accurately reflect the test data. In Table 4, we replace the unlabeled data to CIFAR-100 and Tiny-ImageNet. The accuracy matches or even outperforms using CIFAR-10, suggesting that out-of-domain unlabeled data are sufficient for FEDBE. The results also verify that FEDBE uses unlabeled data mainly as a medium for distillation, not a peep at future test data. + +In Figure 5b and Figure 5c, we investigate different sizes of CIFAR-100 or Tiny-ImageNet as the unlabeled data (cf. Table 4). We found that even with merely 2K unlabeled data, which is $5 \%$ of the total 40K CIFAR-10 labeled data and $2 \sim 4 \%$ of the original 50K-100K unlabeled data, FEDBE can already outperform FedAvg by a margin. This finding is aligned with what we have included in Figure 5a, where we showed that a small amount of unlabeled data is sufficient for FEDBE to be effective. Adding more unlabeled data can improve the accuracy but the gain is diminishing. + +Network depth. Unlike in centralized training that deeper models usually lead to higher accuracy (bottom row in Table 1, trained with 200 epochs), we observe an opposite trend in FL: all methods suffer accuracy drop when ResNets go deeper. This can be attributed to (a) local training over-fitting to small and non-i.i.d. data or (b) local models drifting away from each other. FEDBE suffers the least among all methods, suggesting it as a promising direction to resolve the problem. To understand the current limit, we conduct a study in Figure 4 by injecting more convolutional layers into ConvNet (Step setting). FEDAVG again degrades rapidly, while FEDBE is more robust. If we replace Bayesian ensemble by the CIFAR-10 ground truth labels as the distillation target, FEDBE improves with more layers added, suggesting that how to distill with noisy labeled targets is the key to improve FEDBE. + +Table 5: Partial participation (Tiny-ImageNet) + +
Method ResNet20MobileNetV2
i.i.dFEDAVG32.4±0.68 26.1±0.98
FEDBE 35.4±0.5828.9±1.15
non-i.i.dFEDAVG FEDBE127.5±0.78 25.5±1.23 32.4±0.81 27.8±0.99
+ +Table 6: Systems heterogeneity (non-i.i.d. CIFAR-10) + +
MethodConvNet ResNet20
FEDAVG70.6±0.46 69.9±0.59 64.0±0.50
FEDPROX71.2±0.55 69.4±0.48 65.9±0.63
FEDBE73.3±0.56 77.1±0.61 70.2±0.39
+FEDPROX73.7±0.24 77.5±0.51 71.6±0.37
+ +# 5.3 PRACTICAL FEDERATED SYSTEMS + +Partial participation. We examine FEDBE in a more practical environment: (a) more clients are involved, (b) each client has fewer data, and (c) not all clients participate in every round. We consider a setting with 100 clients, in which 10 clients are randomly sampled at each round and iterates for 100 rounds, similar to (McMahan et al., 2017). We study both i.i.d. and non-i.i.d (Step) cases on Tiny-ImageNet, split 10K training images to the server, and distribute the rest to the clients. For the non-i.i.d case, each client has 2 major classes (351 images each) and 198 minor classes (1 image each). FEDBE outperforms FEDAVG (see Table 5). See subsection C.7 for results on CIFAR-100. + +Systems heterogeneity. In real-world FL, clients may have different computation resources, leading to systems heterogeneity (Li et al., 2020a). Specifically, some clients may not complete local training upon the time of scheduled aggregation, which might hurt the overall aggregation performance. We follow (Li et al., 2020a) to simulate the situation by assigning each client a local training epoch $E _ { i }$ , sampled uniformly from $( 0 , 2 0 ]$ , and aggregate their partially-trained models.Table 6 summarizes the results on non-i.i.d (Step) CIFAR-10. FEDBE outperforms FEDAVG and FEDPROX (Li et al., 2020a). + +# 6 DISCUSSION + +Privacy. Federated learning offers data privacy since the server has no access to clients’ data. It is worth noting that having unlabeled data not collected from the clients does not weaken the privacy if the server is benign, which is a general premise in the federated setting (McMahan et al., 2017). For instance, if the collected data are de-identified and the server does not intend to match them to clients, clients’ privacy is preserved. In contrast, if the server is adversarial and tries to infer clients’ information, federated learning can be vulnerable even without the unlabeled data: e.g., federated learning may not satisfy the requirement of differential privacy or robustness to membership attacks. + +Unlabeled data. Our assumption that the server has data is valid in many cases: e.g., a self-driving car company may collect its own data but also collaborate with customers to improve the system. Bassily et al. (2020a;b) also showed real cases where public data is available in differential privacy. + +# 7 CONCLUSION + +Weight average in model aggregation is one major barrier that limits the applicability of federated learning to i.i.d. conditions and simple neural network architectures. We address the issue by using Bayesian model ensemble for model aggregation, enjoying a much robust prediction at a very low cost of collecting unlabeled data. With the proposed FEDBE, we demonstrate the applicability of federated learning to deeper networks (i.e., ResNet20) and many challenging conditions. + +# ACKNOWLEDGMENTS + +We are thankful for the generous support of computational resources by Ohio Supercomputer Center and AWS Cloud Credits for Research. + +# REFERENCES + +Rohan Anil, Gabriel Pereyra, Alexandre Tachard Passos, Robert Ormandi, George Dahl, and Geoffrey Hinton. Large scale distributed neural network training through online distillation. 2018. URL https://openreview.net/pdf?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rkr1UDeC-. + +David Barber. Bayesian reasoning and machine learning. Cambridge University Press, 2012. + +Raef Bassily, Albert Cheu, Shay Moran, Aleksandar Nikolov, Jonathan Ullman, and Zhiwei Steven Wu. Private query release assisted by public data. In ICML, 2020a. + +Raef Bassily, Shay Moran, and Anupama Nandi. Learning from mixtures of private and public populations. arXiv preprint arXiv:2008.00331, 2020b. + +Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010. + +David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin A Raffel. Mixmatch: A holistic approach to semi-supervised learning. In NeurIPS, 2019. + +Keith Bonawitz, Hubert Eichner, Wolfgang Grieskamp, Dzmitry Huba, Alex Ingerman, Vladimir Ivanov, Chloe Kiddon, Jakub Konecny, Stefano Mazzocchi, H Brendan McMahan, et al. Towards federated learning at scale: System design. arXiv preprint arXiv:1902.01046, 2019. + +Leo Breiman. Bagging predictors. Machine learning, 24(2):123–140, 1996. + +Eric Brochu, Vlad M Cora, and Nando De Freitas. A tutorial on bayesian optimization of expensive cost functions, with application to active user modeling and hierarchical reinforcement learning. arXiv preprint arXiv:1012.2599, 2010. + +Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss. In Advances in Neural Information Processing Systems, pp. 1565–1576, 2019. + +Defang Chen, Jian-Ping Mei, Can Wang, Yan Feng, and Chun Chen. Online knowledge distillation with diverse peers. In AAAI, 2020. + +Thomas G Dietterich. Ensemble methods in machine learning. In International workshop on multiple classifier systems, pp. 1–15, 2000. + +Felix Draxler, Kambis Veschgini, Manfred Salmhofer, and Fred A Hamprecht. Essentially no barriers in neural network energy landscape. In ICML, 2018. + +Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1):2096–2030, 2016. + +Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry P Vetrov, and Andrew G Wilson. Loss surfaces, mode connectivity, and fast ensembling of dnns. In NeurIPS, 2018. + +Boqing Gong, Yuan Shi, Fei Sha, and Kristen Grauman. Geodesic flow kernel for unsupervised domain adaptation. In CVPR, 2012. + +Boqing Gong, Kristen Grauman, and Fei Sha. Learning kernels for unsupervised domain adaptation with applications to visual object recognition. IJCV, 109(1-2):3–27, 2014. + +Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In NIPS, 2005. + +Neel Guha, Ameet Talwlkar, and Virginia Smith. One-shot federated learning. arXiv preprint arXiv:1902.11175, 2019. + +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. 2017. + +Qiushan Guo, Xinjiang Wang, Yichao Wu, Zhipeng Yu, Ding Liang, Xiaolin Hu, and Ping Luo. Online knowledge distillation via collaborative learning. In CVPR, 2020. + +Farzin Haddadpour and Mehrdad Mahdavi. On the convergence of local descent methods in federated learning. arXiv preprint arXiv:1910.14425, 2019. + +Chaoyang He, Murali Annavaram, and Salman Avestimehr. Group knowledge transfer: Federated learning of large cnns at the edge. Advances in Neural Information Processing Systems, 33, 2020. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. + +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. + +Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. 2017. + +Kevin Hsieh, Amar Phanishayee, Onur Mutlu, and Phillip B Gibbons. The non-iid data quagmire of decentralized machine learning. In ICML, 2020. + +Tzu-Ming Harry Hsu, Hang Qi, and Matthew Brown. Measuring the effects of non-identical data distribution for federated visual classification. arXiv preprint arXiv:1909.06335, 2019. + +Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E Hopcroft, and Kilian Q Weinberger. Snapshot ensembles: Train 1, get m for free. In ICLR, 2017. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. + +Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Averaging weights leads to wider optima and better generalization. In UAI, 2018. + +Eunjeong Jeong, Seungeun Oh, Hyesung Kim, Jihong Park, Mehdi Bennis, and Seong-Lyun Kim. Communication-efficient on-device machine learning: Federated distillation and augmentation under non-iid private data. arXiv preprint arXiv:1811.11479, 2018. + +Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank J Reddi, Sebastian U Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for on-device federated learning. In ICML, 2020. + +A Khaled, K Mishchenko, and P Richtarik. Tighter theory for local sgd on identical and heterogeneous ´ data. In AISTATS, 2020. + +Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In NIPS, 2014. + +Jakub Konecnˇ y, H Brendan McMahan, Felix X Yu, Peter Richt \` arik, Ananda Theertha Suresh, and ´ Dave Bacon. Federated learning: Strategies for improving communication efficiency. arXiv preprint arXiv:1610.05492, 2016. + +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. + +Ya Le and Xuan Yang. Tiny imagenet visual recognition challenge. CS 231N, 2015. + +Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. + +Daliang Li and Junpu Wang. Fedmd: Heterogenous federated learning via model distillation. arXiv preprint arXiv:1910.03581, 2019. + +Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smithy. Feddane: A federated newton-type method. In 2019 53rd Asilomar Conference on Signals, Systems, and Computers, pp. 1227–1231. IEEE, 2019. + +Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. In MLSys, 2020a. + +Xiang Li, Kaixuan Huang, Wenhao Yang, Shusen Wang, and Zhihua Zhang. On the convergence of fedavg on non-iid data. In ICLR, 2020b. + +Xianfeng Liang, Shuheng Shen, Jingchang Liu, Zhen Pan, Enhong Chen, and Yifei Cheng. Variance reduced local sgd with lower communication complexity. arXiv preprint arXiv:1912.12844, 2019. + +Tao Lin, Lingjing Kong, Sebastian U Stich, and Martin Jaggi. Ensemble distillation for robust model fusion in federated learning. arXiv preprint arXiv:2006.07242, 2020. + +Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9(Nov):2579–2605, 2008. + +Wesley J Maddox, Pavel Izmailov, Timur Garipov, Dmitry P Vetrov, and Andrew Gordon Wilson. A simple baseline for bayesian uncertainty in deep learning. In NeurIPS, 2019. + +H Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, et al. Communication-efficient learning of deep networks from decentralized data. In AISTATS, 2017. + +Radford M Neal. Bayesian learning for neural networks, volume 118. Springer Science & Business Media, 2012. + +Nicolas Papernot, Mart´ın Abadi, Ulfar Erlingsson, Ian Goodfellow, and Kunal Talwar. Semisupervised knowledge transfer for deep learning from private training data. In ICLR, 2017. + +Sashank Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konecnˇ y, \` Sanjiv Kumar, and H Brendan McMahan. Adaptive federated optimization. arXiv preprint arXiv:2003.00295, 2020. + +Amirhossein Reisizadeh, Aryan Mokhtari, Hamed Hassani, Ali Jadbabaie, and Ramtin Pedarsani. Fedpaq: A communication-efficient federated learning method with periodic averaging and quantization. arXiv preprint arXiv:1909.13014, 2019. + +Shiori Sagawa, Pang Wei Koh, Tatsunori B Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. In ICLR, 2020. + +Anit Kumar Sahu, Tian Li, Maziar Sanjabi, Manzil Zaheer, Ameet Talwalkar, and Virginia Smith. On the convergence of federated optimization in heterogeneous networks. arXiv preprint arXiv:1812.06127, 2018. + +Kuniaki Saito, Kohei Watanabe, Yoshitaka Ushiku, and Tatsuya Harada. Maximum classifier discrepancy for unsupervised domain adaptation. In CVPR, 2018. + +Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4510–4520, 2018. + +Virginia Smith, Chao-Kai Chiang, Maziar Sanjabi, and Ameet S Talwalkar. Federated multi-task learning. In NIPS, 2017. + +Sebastian U Stich. Local sgd converges fast and communicates little. In ICLR, 2019. + +Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Advances in neural information processing systems, pp. 1195–1204, 2017. + +TensorFlow team. Tensorflow convolutional neural networks tutorial. http://www. tensorflow.org/tutorials/deep_cnn, 2016. + +Hongyi Wang, Mikhail Yurochkin, Yuekai Sun, Dimitris Papailiopoulos, and Yasaman Khazaeni. Federated learning with matched averaging. In ICLR, 2020. + +Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision (ECCV), pp. 3–19, 2018. + +Qiang Yang, Yang Liu, Tianjian Chen, and Yongxin Tong. Federated machine learning: Concept and applications. ACM Transactions on Intelligent Systems and Technology (TIST), 10(2):1–19, 2019. + +Xin Yao, Tianchi Huang, Rui-Xiao Zhang, Ruiyu Li, and Lifeng Sun. Federated learning with unbiased gradient aggregation and controllable meta updating. arXiv preprint arXiv:1910.08234, 2019. + +Mikhail Yurochkin, Mayank Agarwal, Soumya Ghosh, Kristjan Greenewald, Trong Nghia Hoang, and Yasaman Khazaeni. Bayesian nonparametric federated learning of neural networks. In ICML, 2019. + +Zhengming Zhang, Zhewei Yao, Yaoqing Yang, Yujun Yan, Joseph E Gonzalez, and Michael W Mahoney. Benchmarking semi-supervised federated learning. arXiv preprint arXiv:2008.11364, 2020. + +Yue Zhao, Meng Li, Liangzhen Lai, Naveen Suda, Damon Civin, and Vikas Chandra. Federated learning with non-iid data. arXiv preprint arXiv:1806.00582, 2018. + +Fan Zhou and Guojing Cong. On the convergence properties of a $k$ -step averaging stochastic gradient descent algorithm for nonconvex optimization. arXiv preprint arXiv:1708.01012, 2017. + +Zhi-Hua Zhou. Ensemble methods: foundations and algorithms. CRC press, 2012. + +Xiaojin Jerry Zhu. Semi-supervised learning literature survey. Technical report, University of Wisconsin-Madison Department of Computer Sciences, 2005. + +Martin Zinkevich, Markus Weimer, Lihong Li, and Alex J Smola. Parallelized stochastic gradient descent. In NIPS, 2010. + +# SUPPLEMENTARY MATERIAL + +We provide details omitted in the main paper. + +• Appendix A: additional related work (cf. section 2 of the main paper). +• Appendix B: details of experimental setups (cf. subsection 5.1 of the main paper). +• Appendix C: additional experimental results and analysis (cf. subsection 5.2 of the main paper). +• Appendix D: additional discussions (cf. section 4 and subsection 5.2 of the main paper). +• Appendix E: additional analysis to address reviewers’ comments. + +# A ADDITIONAL RELATED WORK + +Federated leatning (FL). In the multi-round federated setting, FEDAVG (McMahan et al., 2017) is the standard approach. Many works have studied its effectiveness and limitation regarding convergence (Khaled et al., 2020; Li et al., 2020b; Karimireddy et al., 2020; Li et al., 2020b; Liang et al., 2019; Stich, 2019; Zhao et al., 2018; Zhou & Cong, 2017; Haddadpour & Mahdavi, 2019), system robustness (Li et al., 2020a; Smith et al., 2017; Bonawitz et al., 2019), and communication cost (Konecnˇ y et al., 2016; Reisizadeh et al., 2019), especially for the situations that clients are not \` i.i.d. (Li et al., 2020b; Zhao et al., 2018; Li et al., 2020a; Sahu et al., 2018) and have different data distributions, stability, etc. + +Ensemble learning and stochastic weight average. Recent works (Huang et al., 2017; Draxler et al., 2018; Garipov et al., 2018) have developed efficient ways to obtain the base models for ensemble; e.g., by employing a dedicated learning rate schedule to sample models along a single pass of SGD training (Hsu et al., 2019). SWA (Maddox et al., 2019) applied the same learning rate schedule but simply took weight average over the base models to obtain a single strong model. We apply SWA, but for the purpose of learning with noisy labels in knowledge distillation. + +Bayesian deep learning. Bayesian approaches (Neal, 2012; Barber, 2012; Brochu et al., 2010) incorporate uncertainty in decision making by placing a distribution over model weights and marginalizing these models to form a whole predictive distribution. Our work is inspired by (Maddox et al., 2019), which constructs the distribution by fitting the parameters to traversed models along SGD training. + +Others. Our work is also related to semi-supervised learning (SSL) and unsupervised domain adaptation (UDA). SSL leverages unlabeled data to train a better model when limited labeled data are provided (Grandvalet & Bengio, 2005; Kingma et al., 2014; Tarvainen & Valpola, 2017; Berthelot et al., 2019; Zhu, 2005); UDA leverages unlabeled data to adapt a model trained from a source domain to a different but related target domain (Gong et al., 2012; 2014; Ganin et al., 2016; Saito et al., 2018; Ben-David et al., 2010). We also leverage unlabeled data, but for model aggregation. We note that, UDA and SLL generally assume the access to labeled (source) data, which is not the case in federated learning: the server cannot access clients’ labeled data. + +# B EXPERIMENTAL SETUPS + +# B.1 IMPLEMENTATION DETAILS + +As mentioned in the main paper (subsection 5.1), we select the number of local epochs, used in training a client model within one round of communication, according to the performance of FEDAVG. Other algorithms, like FEDBE and v-Distillation, then follow the same numbers. For ConvNet and ResNet experiments, we fixed $E = 2 0$ . We use $E = 1 0$ for MobileNet experiments. For all 1-Ensemble baselines, we tuned $E$ from $[ 1 0 , 2 0 , . . . , 2 0 0 ]$ . + +We observed that applying weight decay in local client training improves all FL methods, but the suitable hyper-parameter can be different for different methods on different network architectures. Tuning it specifically for each method is thus essential for fair comparisons. We search the weight decay hyper-parameter for each network and each method in [1e−3, 1e−4] with a validation set. + +For methods with distillation (FEDBE and v-Distillation), We tune the epochs for v-Distillation from [1, 5, 10, 20, 30, 40] and find 20 to be stable across different setups. We apply 20 to FEDBE as well. + +In constructing the pseudo-labeled data $\tau$ , we perform inference on the unlabeled data $\mathcal { U }$ in the server without data augmentation. We perform data augmentation in both local training on $\mathcal { D } _ { i }$ and knowledge distillation on $\tau$ . The $3 2 \times 3 2$ CIFAR images are padded 2 pixels each side, randomly flipped horizontally, and then randomly cropped back to $3 2 \times 3 2$ . The $6 4 \times 6 4$ Tiny-ImageNet images are padded 4 pixels each side, randomly flipped horizontally, and then randomly cropped back to $6 4 \times 6 4$ . In Table 4 of the main paper, we resize images of Tiny-ImageNet to $3 2 \times 3 2$ . + +For neural networks that contain batch normalization layers (Ioffe & Szegedy, 2015), we apply the same way as in section 3 to construct the global distribution for the layers and we observe no issues in our experiments. SWAG (Maddox et al., 2019) also reported that it performs stably even on very deep networks. + +# B.2 TRAINING FEDAVG + +For the local learning rate $\eta _ { l }$ , we observed that an appropriate value of $\eta _ { l }$ is important when training on the non-i.i.d local data. The local models cannot converge if the learning rate is set to a too large value (also shown in (Reddi et al., 2020)), and the models cannot reach satisfying performance within the local epochs $E$ with a too-small value as shown in Figure 6. Also, unlike the common practice of training a neural network with learning rate decay in the centralized setting, we observed that applying it within each round of local training (decay by 0.99 every step) results in much worse client models. The local models would need a large enough learning rate to converge with a fixed $E$ and we use 0.01 as the base learning rate for local training in all our experiments. + +Although decaying $\eta _ { l }$ within each round of local training is not helpful, decaying $\eta _ { l }$ along the rounds of communication could improve the performance. Wang et al. (2020) and Reddi et al. (2020) provided both theoretical and empirical studies suggesting that the local learning rate must decay along the communication rounds to alleviate client shifts in non-i.i.d setting. In our experiments, at the $r$ th round of communication, the local client training starts with a learning rate $\eta _ { l }$ , which is 0.01 if $r < 0 . 3 R$ , 0.001 if $0 . 3 R \le r < 0 . 6 R$ , and 0.0001 otherwise, where $R$ is the total rounds of communication. In Figure 7, we examined this schedule with different degrees of $\alpha$ in the Dirichlet-non-i.i.d setting. We observed consistent improvements and applied it to all our experiments in section 5. + +![](images/df7fe25bf28c31a93028abdade16061c6d3fd5697a3b25a3f2bb41a653b94c7a.jpg) +Figure 6: FEDAVG with ConvNet on Step-noni.i.d CIFAR-10 with or without learning rate decay within each round of local training. + +![](images/42865e7d930b8b983c97e1070af833fcac54d409e24ce10a306f3f41119bdbc9.jpg) +Figure 7: FEDAVG with ConvNet on Dirichletnon-i.i.d CIFAR-10 with or without learning rate decay at latter rounds of communication. We experimented with different values of $\alpha$ in $\operatorname { D i r } ( \alpha )$ . + +# B.3 EFFECTS OF WEIGHT DECAY IN LOCAL CLIENT TRAINING + +Federated learning on non-i.i.d data of clients is prone to model drift due to the deviation of local data distributions and is sensitive to the number of local epochs $E$ (Wang et al., 2020; Li et al., 2020b; McMahan et al., 2017). To prevent local training from over-fitting the local distribution, we apply $\ell _ { 2 }$ regularization as weight decay. In a different context of distributed deep learning, Sagawa et al. (2020) also showed that $\ell _ { 2 }$ regularization can improve the generalization by preventing the local model from perfectly fitting the non-i.i.d training data. + +Table 7: FEDBE with models sampled from a Dirichlet distribution on Step-non-i.i.d. CIFAR-10. We compare different $\alpha \times 1$ in setting the parameter of a Dirichlet distribution. + +
aConvNetResNet20
0.172.5±0.4475.9±0.66
0.573.6±0.7377.3±0.86
174.2±0.5177.1±0.71
273.2±0.8376.8±0.55
+ +As shown in Figure 8 where we compared FEDAVG and FEDBE with or without weight decay in local training, we found that weight decay not only leads to a higher test accuracy but also makes both algorithms more robust to the choice of local epochs $E$ . + +![](images/167809cd5e70eb8dcb7be26297b2324390e57ec44fc56fe98ad973cdaede931e.jpg) +Figure 8: FEDAVG and FEDBE with ConvNet on CIFAR-10 (Step-non-i.i.d) with or without weight decay in local training, for different numbers of local epochs $E$ . + +C EXPERIMENTAL RESULTS AND ANALYSIS + +C.1 GLOBAL MODEL SAMPLING IN FEDBE + +In the main paper, we mainly report accuracy by FEDBE with models sampled from a Gaussian distribution (cf. Equation 5 of the main paper). Here we report results using a Dirichlet distribution for model sampling (cf. Equation 7 of the main paper) in Table 7. We compare different ${ \pmb { \alpha } } = { \pmb { \alpha } } \times { \bf 1 }$ in setting the parameter of a Dirichlet distribution. We see that the accuracy is not sensitive to the change of $\alpha$ . Compared to Table 1 of the main paper, FEDBE with Dirichlet is slightly worse than FEDBE with Gaussian (by $\leq 0 . 5 \%$ ) but much better than FEDAVG. + +To further study the models sampled from the global model distribution constructed in FEDBE, we compare the prediction accuracy and confidences (the maximum values of the predicted probabilities) of clients’ models and sampled models. We show the histogram of correctly and incorrectly predicted test examples at different prediction confidences. As shown in Figure 9, we observe that clients’ models tend to be over-confident by assigning high confidences to wrong predictions. We hypothesize that it is because clients’ local training data are scarce and class-imbalanced. On the other hand, sampled models have much better alignment between confidences and accuracy (i.e., higher confidences, higher accuracy). + +C.2 ANALYSIS ON WEIGHT AVERAGE, (BAYESIAN) MODEL ENSEMBLE, AND DISTILLATION + +To investigate the difference of weight average, (Bayesian) model ensemble, and distillation in making predictions, we focus on one-round federated learning, in which the client models are trained in the same way regardless of what aggregation approach to be used. We experiment with Step-non-i.i.d. CIFAR-10 using ConvNet, and train the 10 local client models for 200 epochs. We then compare (a) weight average to combine the models, (b) model ensemble, and (c) Bayesian model ensemble with $M = 1 0$ extra samples beyond weight average and individual clients. For (b) and (c), we further apply knowledge distillation using the unlabeled server data to summarize the ensemble predictions into a single global model using SGD or SWA. We note that, method (a) is equivalent to one-round FEDAVG; method (b) without distillation is the same as 1-Ensemble; method (b) with SGD distillation is equivalent to one-round v-Distillation; method (c) with SWA is equivalent to one-round FEDBE. Table 8 shows the results with several interesting findings. First, without distillation, model ensemble clearly outperforms weight average and Bayesian model ensemble further adds a $2 \%$ gain, supporting our claims in section 3. Second, summarizing model ensemble into one global model largely degrades the accuracy, showing the challenges of applying ensemble distillation in federated learning. The $6 0 . 5 \%$ and $6 2 . 5 \%$ accuracy by ensemble, although relatively higher than others, may still be far from perfect to be used as distillation targets. Third, distillation with SWA outperforms SGD for both model ensemble and Bayesian model ensemble, justifying our proposed usage of SWA. Fourth, with or without distillation, Bayesian model ensemble always outperforms model ensemble, with very little cost of estimating the global model distribution and performing sampling. Fifth, even with the degraded accuracy after distillation, model ensemble and Bayesian model ensemble, after distilled into a single model, still outperforms weight average notably. Finally, although in the one-round setting we hardly see the advantage of distilling the model ensemble into a single model, + +![](images/b21dc80f376e6222c7eeec98f3c4e80923069de42652e385a1f23f4f9b1f58b1.jpg) +Figure 9: Histograms of correctly and incorrectly predicted examples (vertical axes) along the confidence values (the maximum values of the predicted probabilities). Upper row: Swiss roll dataset used in Figure 1 of main paper (averaged over 3 clients or sampled models); lower row: Step-non-i.i.d. CIFAR-10 (averaged over 10 clients or sampled models). + +Table 8: One-round federated learning on Step-non-i.i.d. CIFAR-10 with ConvNet. We compare different strategies to combine the clients’ local models, including weight average, (Bayesian) model ensemble, and ensemble distillation (with SGD or SWA). + +
MethodDistillation
NoneSGDSWA
(a) Weight average24.7±0.851
(b) Model ensemble60.5±0.2832.0±0.7433.1±1.02
(c) Bayesian model ensemble62.5±0.3535.1±0.7635.7±0.86
+ +# FEDAVG: inference on CIFAR-100 + +![](images/9b4317a82452ab7bba083d6c66ed7dd9bc5b30a1adaeab11af3e9314e519e365.jpg) +FEDAVG: inference on CIFAR-10 + +![](images/d52c42cdfa255223bb1b6cd310b9635d053d94a302d7693d9469baa9c33d6627.jpg) +FEDBE: inference on CIFAR-100 + +![](images/e53b30366ecd6c926d4b48a1dbf8df791680199aab850c96244f19dda50d2461.jpg) +FEDBE: inference on CIFAR-10 + +![](images/1f8cd8b6b99eb9b969d388fd2c1336d70916c3d3969886a7e4785506d3a47a29.jpg) +Figure 10: Feature visualization of FEDAVG and FEDBE models. All models are trained on Step-non-i.i.d. CIFAR-10, then inference on CIFAR-10/100 test sets. The features are colored with the ground-truth labels (CIFAR-10) or the predictions (CIFAR-100). + +with multiple rounds of communication as in the main paper (cf. subsection 5.2), its advantage becomes much clear—it allows the next-round local training to start from a better initialization (in comparison to weight average) and eventually leads to much higher accuracy than 1-Ensemble. + +# C.3 FEDBE VS. FEDAVG + +We provide further comparisons between FEDBE and FEDAVG. First, we perform Bayesian model ensemble at the end of FEDAVG training (Step-non-i.i.d. CIFAR-10). We achieve $7 2 . 5 \%$ with ResNet20, better than FEDAVG $( 7 0 . 2 \%$ in Table 1 of the main paper) but still worse than FEDBE $( 7 7 . 5 \% )$ , demonstrating the importance of incorporating Bayesian model ensemble into multi-round federated learning. + +To further analyze why FEDBE improves over FEDAVG, we train models on Step-non-i.i.d CIFAR-10, inference on the test sets, and visualize the features. We trained a FEDBE ResNet20 model for only 15 rounds such that the test accuracy is similar to a FEDAVG ResNet20 model trained for 40 rounds. In Figure 10, we plot their features using t-SNE (Maaten & Hinton, 2008) on the CIFAR-10/100 testing sets (consider 3 semantically different classes: automobile, cat, and frog) and color the features with the ground-truth labels of CIFAR-10 test set or the predictions of the models on CIFAR-100 test set. Interestingly, we observe that the features of FEDBE are more discriminative (separated) than the features of FEDAVG, especially on CIFAR-100, even if FEDBE and FEDAVG have similar test accuracy on CIFAR-10. + +We further discuss Table 3 of the main paper. We perform data augmentation on $\tau$ in knowledge distillation. This explains why we obtain improvement over FEDAVG when using the FEDAVG predictions as the target labels $( 7 2 . 6 \% / 7 3 . 4 \%$ vs. $7 2 . 0 \% / 7 0 . 2 \%$ in Table 1 of the main text, using ConvNet/ResNet20). We note that without data augmentation, using FEDAVG predictions as the target leads to zero gradients in knowledge distillation since we initialize the student model with FEDAVG. The results suggest the slight benefit of collecting unlabeled data for knowledge distillation in model aggregation. + +![](images/5a2f1c7d41971d3cb7995cb60077fe9ed62d603fb3b47b49db6b0f9468eda07a.jpg) +Figure 11: ResNet20 test accuracy on Step-non-i.i.d. CIFAR-10, with different numbers of epochs for distillation using SGD and SWA for FEDBE. + +# C.4 FEDBE WITH SWA AND SGD + +We found that distillation with SGD is more sensitive to noisy labels and the number of epochs. For ResNet20 (Table 1), FEDBE with FEDAVG $+ \textrm { C } + \textrm { S }$ w/o SWA (i.e., using SGD) achieves $7 4 . 9 \%$ with 20 epochs but $7 4 . 0 \%$ with 40 epoch. In contrast, FEDBE with SWA is much stable. As shown in Figure 11, the accuracy stays stable with more than 10 epochs being used, achieving $7 7 . 5 \%$ with 20 epochs and $7 7 . 3 \%$ with 40 epochs. + +# C.5 BATCH NORMALIZATION VS. GROUP NORMALIZATION + +Hsieh et al. (2020) showed that FEDAVG in non-i.i.d cases can be improved by replacing the batch normalization (BN) layers with group normalization (GN) layers (Wu & He, 2018). However, we observe that ResNets with GN converge much slower, which is consistent with the observations in (Zhang et al., 2020). In our CIFAR-10 (Step) experiments, FEDAVG using ResNet20 with GN can outperform that with BN slightly if both are trained with 200 rounds $( 7 6 . 4 \%$ vs. $7 4 . 6 \%$ ). FEDBE can further improve the performance: FEDBE with GN/BN achieves $7 9 . 6 \% / 8 0 . 2 \%$ . + +# C.6 COMPATIBILITY WITH SCAFFOLD + +SCAFFOLD (Karimireddy et al., 2020) is a recently proposed FL method to regularize local training. We experiment with SCAFFOLD on non-i.i.d. (Step) CIFAR-10. We find that SCAFFOLD cannot directly perform well with deeper networks (ResNet20: $5 9 . 4 \%$ ; ResNet32: $5 5 . 3 \%$ ). Nevertheless, FEDBE $+ \cal S { \bf C }$ AFFOLD can improve upon it, achieving $7 6 . 4 \%$ and $7 2 . 7 \%$ , respectively. + +To further analyze why FEDBE improves SCAFFOLD, we plot the test accuracy of SCAFFOLD vs. FEDBE $+ \cal S { \bf C }$ AFFOLD at every communication round. We see that both methods perform similarly in the early rounds. SCAFFOLD with weight average could not improve the accuracy after roughly 10 rounds. FEDBE $+ \mathrm { { S C } }$ AFFOLD, in contrast, performs Bayesian ensemble and distillation to obtain the global model, bypassing weight average and gradually improving the test accuracy. We therefore argue that, as long as FEDBE can improve SCAFFOLD slightly at every later round, the ultimate gain can be large. We also attribute the gain brought by FEDBE to the robustness of Bayesian ensemble for model aggregation. + +# C.7 PARTIAL PARTICIPATION ON CIFAR-100 (CF. SUBSECTION 5.3) + +We also conduct the experiments on CIFAR-100 with the non-i.i.d. Step setting. We consider a setting with 100 clients, in which 10 clients are randomly sampled at each round and iterates for 100 rounds, similar to (McMahan et al., 2017). We split 10K images from the 50K training images to the server, and distribute the remaining ones to the clients. Each client has 5 major classes (61 images each) and 95 minor classes (1 image each). Table 9 shows the results: FEDBE consistently outperforms FEDAVG. + +![](images/9ebcae6d76b61960f64c773ac3c83f7a81f8181506874595168378eb496b8531.jpg) +Figure 12: Step-non-i.i.d CIFAR-10 experiments accuracy curves of SCAFFOLD on ResNet20. + +Table 9: Non-i.i.d CIFAR-100 + +
MethodConvNetResNet20ResNet32
FEDAVG32.5±0.7837.5±0.6533.3±0.55
FEDBE36.6±0.5243.5±0.8937.7±0.69
+ +# D DISCUSSION + +# D.1 EXTRA COMPUTATION COST + +FEDBE involves more computation compared to FEDAVG. The extra cost is on the server and no extra burden is on the clients. In practice, the server is assumed to be computationally rich so the extra training time is negligible w.r.t. communication time. Using a 2080 Ti GPU on CIFAR10 (ConvNet), building distributions and sampling takes 0.2s, inference of a model takes 2.4s, and distillation takes 10.4s. Constructing the ensemble predictions $\boldsymbol { \mathcal { T } } = \{ ( \boldsymbol { { \bf { x } } } _ { j } , \hat { p } _ { j } ) \} _ { j = 1 } ^ { J }$ , where $\begin{array} { r } { \hat { \pmb { p } } _ { j } \ = \ \frac { 1 } { M } \sum _ { m = 1 } ^ { M } p ( y | \pmb { x } _ { j } ; \pmb { w } ^ { ( m ) } ) } \end{array}$ , requires each $\pmb { w } ^ { ( m ) }$ to be evaluated on $\mathcal { U }$ , which can be easily parallelized in modern GPU machines. The convergence speed of the Monte Carlo approximation√ in Equation 4 is $1 / \sqrt { M }$ , yet we observe that $M = 1 0 \sim 2 0$ is sufficient for Bayesian model ensemble to be effective. + +# D.2 FEDAVG ON DEEPER NETWORKS + +Deeper models are known to be poorly calibrated (Guo et al., 2017), especially when trained on limited and imbalanced data. The loss surfaces can be non-convex (Garipov et al., 2018; Draxler et al., 2018). FEDAVG thus may not fuse clients well and may need significantly more rounds of communication with local training of small step sizes to prevent client’s model drifting. + +# E FURTHER ANALYSIS + +# E.1 TEST ACCURACY AT DIFFERENT ROUNDS + +We follow the experimental setup in section 5 and further show the test accuracy of the compared methods at different communication rounds (in total 40 rounds) in Figure 13. Specifically, we experiment with ResNet20 and ResNet32 for both the Step-non-i.i.d. and Dirichlet-non-i.i.d. settings on CIFAR-10 (the results at 40 rounds are the same as those listed in Table 1). FEDBE obtains the highest accuracy after roughly 10 rounds, and could gradually improve as more rounds are involved. Interestingly, v-Distillation, which performs ensemble directly over clients’ models without other sampled models, normally obtains the highest accuracy in the first 10 rounds, but is surpassed by FEDBE after that. We hypothesize that in the first 10 rounds, as the clients models are still not well trained, the constructed distributions may not be stable. We also note that except 1-Ensemble, the other methods with ensemble mostly outperform FEDAVG in the first 10 rounds, showing their robustness in aggregation. + +![](images/5e577bb15f682ee413bc5442a0e714aa725f501f04efc211962d1fd8652db1e0.jpg) +Figure 13: CIFAR-10 curves of test accuracy at different communication rounds. We study both non-i.i.d settings (Step and Dirichlet) using ResNet20 and ResNet32 (cf. subsection E.1). \ No newline at end of file diff --git a/md/train/fgrc9OTuB_g/fgrc9OTuB_g.md b/md/train/fgrc9OTuB_g/fgrc9OTuB_g.md new file mode 100644 index 0000000000000000000000000000000000000000..9f9f5eea7e787fa2333d084f2eb3fc8fc23d5f17 --- /dev/null +++ b/md/train/fgrc9OTuB_g/fgrc9OTuB_g.md @@ -0,0 +1,495 @@ +# An Analysis of Abstracted Model-Based Reinforcement Learning + +Anonymous Author(s) +Affiliation +Address +email + +# Abstract + +1 Many methods for Model-based Reinforcement Learning (MBRL) provide guaran +2 tees for the accuracy of the Markov decision process (MDP) model they can deliver. +3 At the same time, state abstraction techniques allow for a reduction of the size of +4 an MDP while maintaining a bounded loss with respect to the original problem. +5 It may come as a surprise, therefore, that no such guarantees are available when +6 combining both techniques, i.e., where MBRL merely observes abstract states. Our +7 theoretical analysis shows that abstraction can introduce a dependence between +8 samples collected online (i.e., in the real world), which invalidates most results +9 for MBRLs in this setting. Collecting samples using a simulator can avoid this +10 problem. We conclude that we should be careful when applying MBRL methods +11 to abstracted real-world data. + +# 12 1 Introduction + +13 When trying to find good solutions to MDPs using Reinforcement Learning (RL) a fundamental +14 problem is the exploration-exploitation dilemma: when to take actions to obtain more information, +15 and when to take actions that maximize reward based on the current knowledge. Tabular MBRL +16 methods have found good ways to deal with this dilemma [7, 28, 14]. +17 However, MDPs can be very large, which can be problematic for these methods. One way to deal +18 with this is to reduce the size of the MDP. State abstractions are one way to do this [17, 1]. We +19 are interested in approximate state abstractions since they allow for greater reductions of the MDP, +20 though there is a trade-off with solution quality [1]. Specifically, we assume we have an approximate +21 model similarity abstraction function $\phi$ [1] that maps states to abstract states. The environment +22 returns states $s$ , but the agent receives $\phi ( s )$ , see Figure 1. This setting, which was considered before +23 [22, 2], is what we call Abstracted RL, and is the topic of this paper. +24 Abstracted RL corresponds to RL in a Partially +25 Observable MDP (POMDP), as previously de +26 scribed [5]. It is well known that policies for +27 POMDPs that only base their action on the last +28 observation $\phi ( s )$ could be arbitrarily bad [26]. +29 However, when we assume that $\phi$ is an approx +30 imate model similarity abstraction [1] this worst +31 case may not apply: Based on the observed ab +32 stract states the agent learns an (empirical) abstract model. If we could show that this learned model +33 is close to an ‘abstract MDP’ (details in Section 2.2), we could give finite-sample guarantees on the +34 performance in the original MDP by combining results from MBRL and abstraction. +35 However, in MBRL, to guarantee (with high probability) that the learned model is close to the actual +36 environment model, it is typical (e.g., [28, 14]) to use concentration inequalities such as Theorem +37 2 from Weissman et al. [30]. But this theorem relies on independent and identically distributed +38 (i.i.d.) samples for each state-action pair. In this paper, we analyze online collection of such samples +39 in Abstracted RL and show that they are not independent1, which means that most guarantees for +40 existing MBRL methods do not hold in the online Abstracted RL setting.2 +41 On the positive side, when we have access to a simulator, we show how this can be used to collect the +42 data such that the typical MBRL guarantees hold and we can learn an accurate model. We discuss +43 that emulating this in the real world is possible, but extremely sample inefficient, thus highlighting +44 the difficulty of assuming that we would have access to an i.i.d. dataset, as in some earlier works. + +![](images/558915b358a6bfb9d141a08438b36473b3a9748fe909488d6952bfbe3fae7ccf.jpg) +Figure 1: Abstracted RL, the agent observes $\bar { s } =$ $\phi ( s )$ instead of $s$ . Image based on Abel et al. [2] + +# 45 2 Preliminaries + +46 We assume the environment the agent is acting in can be represented by an infinite horizon MDP +47 $M : = \langle S , A , T , R , \gamma \rangle$ . Where $S$ is a finite set of states $s \in S$ , $A$ a finite set of actions $a \in A$ , $T$ +48 a transition function $T ( s ^ { \prime } | s , a ) = \operatorname* { P r } ( s ^ { \prime } | s , a ) .$ $R$ a reward function $R ( s , a )$ which gives the reward +49 received when the agent executes action $a$ in state $s$ , and $\gamma$ the discount factor $( 0 \leq \gamma < 1 $ ). +50 In RL the goal of the agent is to find an optimal policy $\pi ^ { * } : S A$ which maximizes the expectation +51 of the discounted cumulative reward. $V ^ { \pi } ( s )$ denotes the expected value of the discounted cumulative +52 reward under policy $\pi$ starting from state $s$ . Similarly, $Q ^ { \bar { \pi } } ( s , a )$ denotes the expected value of the +53 discounted cumulative reward when first taking action $a$ from state $s$ and then following policy $\pi$ . + +# 54 2.1 Model-Based RL + +55 MBRL methods learn a model from the experiences, these are obtained by the agent acting in the +56 MDP. The learned model is usually the empirical model, directly based on the experience the agent +57 obtains [7, 28, 14]. Per state-action pair the agent stores the next-states reached after taking action $a$ +58 from state $s$ in sequence $Y _ { s , a } \colon Y _ { s , a } : \{ s ^ { \prime ( 1 ) } , s ^ { \bar { \prime } ( 2 ) } , \cdot \cdot \cdot , s ^ { \prime ( m ) } \}$ . We use $Y$ to refer to the collection of +59 all $Y _ { s , a }$ . From this the empirical, or learned, model $T _ { Y }$ is constructed, that just counts how often we +60 have seen the transition to a next-state, and normalizes this: + +$$ +\forall _ { s ^ { \prime } \in S } T _ { Y } ( s ^ { \prime } | s , a ) \triangleq \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \mathbb { 1 } \{ Y _ { s , a } ^ { ( i ) } = s ^ { \prime } \} , +$$ + +where 61 $\mathbb { 1 } \{ \cdot \}$ denotes the indicator function of the specified event, i.e., it is 1 if $Y _ { s , a } ^ { ( i ) } = s ^ { \prime }$ and 0 62 otherwise. + +63 To give finite-sample guarantees on the accuracy of the estimate $T _ { Y }$ , 3 concentration bounds such as +64 Theorem 2.1 from Weissman et al. [30] are often used, e.g. in Strehl and Littman [28], Jaksch et al. +65 [14]. However, these typically make use of the fact that samples are i.i.d. In most MBRL settings this +66 is not a problem under some assumptions, e.g. when the MDP is communicating [25]. In this case +67 due to the Markov property the obtained samples are i.i.d. +68 In general, of course the hope is that with enough samples the learned model $T _ { Y }$ becomes accurate. +69 With accurate we mean that the distance between $T _ { Y } ( \cdot | s , a )$ and $T ( \cdot | s , a )$ will be small, where the +70 distance is measured using the $L _ { 1 }$ norm, defined as: + +$$ +| | T _ { Y } ( \cdot | s , a ) - T ( \cdot | s , a ) | | _ { 1 } \triangleq \sum _ { s ^ { \prime } \in S } | T _ { Y } ( s ^ { \prime } | s , a ) - T ( s ^ { \prime } | s , a ) | . +$$ + +71 Part of theorem 2.1 from Weissman et al. [30], slightly reworded, then gives a guarantee of accuracy: + +Lemma 1 (72 $L _ { 1 }$ inequality [30]). Let $\pmb { Y } _ { s , a } = Y ^ { ( 1 ) } , Y ^ { ( 2 ) } , \cdot \cdot \cdot , Y ^ { ( m ) }$ be i.i.d. random variables 73 distributed according to $T ( \cdot | s , a )$ . Then, for all $\epsilon > 0$ , + +$$ +\operatorname* { P r } ( | | T _ { Y } ( \cdot | s , a ) - T ( \cdot | s , a ) | | _ { 1 } \geq \epsilon ) \leq ( 2 ^ { | S | } - 2 ) e ^ { - \frac { 1 } { 2 } m \epsilon ^ { 2 } } . +$$ + +74 In this way, MBRL can upper bound the probability that the learned model, based on $m$ samples, for +75 a state-action pair $( s , a ) \bar { T _ { Y } } ( \cdot | s , a )$ will be far away $( \geq \epsilon )$ from the true model $T ( \cdot | s , a )$ . +76 The situation is more subtle if the MDP is not communicating, i.e., if there exists $s _ { 1 } , s _ { 2 } \in S$ for which +77 there is no deterministic policy that eventually leads from $s _ { 1 }$ to $s _ { 2 }$ . This can create a dependence +78 between the samples [28]. Intuitively this happens because, if we look at one particular state-action +79 pair $( s , a )$ , there might be a transition to state $s ^ { \prime }$ such that the probability to return to $s$ is 0. Thus if +80 we would have $n$ outcomes of $( s , a )$ we would immediately know that at least $n - 1$ outcomes were +81 not state $s ^ { \prime }$ . Since as soon as we observe $s ^ { \prime }$ , we know the agent would not be able to return to state $s$ . +82 Strehl and Littman [28] show that in this setting it is still possible to use Lemma 3 as an upper bound. + +# 2.2 State abstraction for given models + +84 In the planning setting, where the model is known a priori, a state abstraction can be formulated as +85 a grouping or mapping from ground states to abstract states [18]. This is done with an abstraction +86 function $\phi$ , a surjective function that maps from ground states, $s \in S$ , to abstract states $\bar { s } \in \bar { S }$ : +87 $\phi ( s ) : S { \bar { S } }$ . Here $\bar { S }$ is defined as $\bar { S } = \bar { \{ { \phi ( s ) \vert s \in S \} } }$ .We use the ¯ notation to refer to the abstract +88 space. We slightly overload notation and let $\bar { s }$ both denote an abstract state as well as the set of +89 ground states that map to the abstract state $\bar { s }$ , i.e., $\bar { s } = \{ g \in S \mid \phi ( g ) = \bar { s } \}$ , if $\bar { s } \in \bar { S }$ . The use should +90 be clear from the context. We define the probability to transition to an abstract state $\operatorname* { P r } ( \bar { s } ^ { \prime } | s , a )$ as +91 follows: + +$$ +\operatorname* { P r } ( { \bar { s } } ^ { \prime } | s , a ) \triangleq \sum _ { s ^ { \prime } \in { \bar { s } } ^ { \prime } } T ( s ^ { \prime } | s , a ) . +$$ + +92 This is a very general form of state abstraction, that clusters together states with different dynamics +93 into abstract states. Note that we do assume that the given state abstraction deterministically maps +94 states to an abstract state. This in contrast to some related work on problems with block structure +95 [10], where a Markov state can lead to multiple observations (abstract states in our terminology) that +96 need to be aggregated appropriately to result in a small MDP [4, 10]. +97 Approximate model similarity abstraction Many different abstraction criteria exist [17], here we +98 focus on approximate model similarity abstraction [1]. In this abstraction two states can map to the +99 same abstract state if their behavior is similar, i.e., when the reward function and the transitions to +100 abstract states are close. Approximate model-similarity is defined as follows: + +101 Definition 1. An approximate model-similarity abstraction, $\phi _ { m o d e l , \eta } ,$ for fixed $\eta ,$ satisfies: + +$$ +\begin{array} { r l r } & { \phi _ { m o d e l , \eta } ( s _ { 1 } ) = \phi _ { m o d e l , \eta } ( s _ { 2 } ) \ } & { \Longrightarrow \ \forall _ { a } \left| R ( s _ { 1 } , a ) - R ( s _ { 2 } , a ) \right| \le \eta , } \\ & { } & { \forall _ { \bar { s } ^ { \prime } \in \bar { S } , a } \left| \mathrm { P r } ( \bar { s } ^ { \prime } | s _ { 1 } , a ) - \mathrm { P r } ( \bar { s } ^ { \prime } | s _ { 2 } , a ) \right| \le \eta . } \end{array} +$$ + +102 From now on we will just refer to $\phi _ { \mathrm { m o d e l } , \eta }$ as $\phi$ . + +103 We note that the abstraction we consider, approximate model-similarity abstraction, is still quite +104 generic. It can cluster together states that have different transition and reward functions. However, in +105 the online Abstracted RL setting, the differences in dynamics can cause a dependence between the +106 samples, as we will show in detail in section 3. E.g. looking at $( { \bar { s } } , a )$ , the probability that we reach a +107 state $s ^ { \prime }$ depends both on the probability that we reach a particular state $s \in { \bar { s } }$ and then state $s ^ { \prime }$ from $s$ +108 Returning to abstraction of a given model, it is possible to construct an abstract MDP $\bar { M } _ { \omega }$ from +109 the model of an MDP $M$ and an abstraction function $\phi$ , where $\omega$ is an action-specific 4 weighting +110 function, defined as follows: +111 Definition 2. We refer to the weight associated with a ground state, $s \in S$ , and action, $a \in A$ , by +112 $\omega ( s , a )$ . We have: $\bar { \prime } _ { s \in S , \ a \in A } 0 \leq \bar { \omega } ( s , a ) \leq 1$ and $\begin{array} { r } { \sum _ { s ^ { \prime } \in \phi ( s ) } \omega ( s ^ { \prime } , a ) = 1 } \end{array}$ . +113 The weighting function can be used to create abstract transition and reward functions, which are a +114 weighted average of the ground function. In this way, from $M , \phi$ and any $\omega$ we can construct an +115 abstract MDP $\bar { M } _ { \omega }$ : + +Definition 3. Given an MDP 116 $M$ , $\phi _ { ; }$ , and $\omega$ , $\bar { M } _ { \omega } = \langle \bar { S } , A , \bar { T } _ { \omega } , \bar { R } _ { \omega } , \gamma \rangle$ is constructed as: + +$$ +\begin{array} { c } { { \bar { S } = \{ \phi ( s ) \mid s \in S \} , A = A , \gamma = \gamma , } } \\ { { \forall _ { \bar { s } \in \bar { S } , \ a \in A } \bar { R } _ { \omega } ( \bar { s } , a ) = \displaystyle \sum _ { s \in \bar { s } } \omega ( s , a ) R ( s , a ) , } } \\ { { \forall _ { \bar { s } , \bar { s } ^ { \prime } \in \bar { S } , \ a \in A } \bar { T } _ { \omega } ( \bar { s } ^ { \prime } | \bar { s } , a ) = \displaystyle \sum _ { s \in \bar { s } } \sum _ { s ^ { \prime } \in \bar { s } ^ { \prime } } \omega ( s , a ) T ( s ^ { \prime } | s , a ) . } } \end{array} +$$ + +An abstract MDP 117 $\bar { M } _ { \omega }$ is just an $M D P$ . This means we can use any planning method we like to find an optimal policy 118 $\bar { \pi } ^ { * }$ for $\bar { M } _ { \omega }$ . + +119 What we are interested in is the performance of a policy on the abstract space, when applied on the +120 original problem $M$ . Any policy on the abstract space $\bar { \pi }$ can be used in $M$ as follows $\bar { \pi } ( s ) \bar { : } = \bar { \pi } ( \phi ( s ) )$ , +121 leading to $V ^ { \bar { \pi } ^ { * } }$ . It has been shown that we can upper bound the loss in performance due to using an +122 optimal policy for $\bar { M } _ { \omega }$ , $\bar { \pi } ^ { * }$ in $M$ instead of using the optimal solution for $M$ [8, 1, 29]: + +Lemma 2 (Lemma 4 [29]). An approximate model similarity abstraction (Definition $^ { l }$ ), has suboptimality bounded in $\begin{array} { r } { \eta \colon \forall _ { s \in S } V ^ { * } \bar { ( s ) } - V ^ { \bar { \pi } ^ { * } } ( s ) \le \frac { 2 \eta + 2 \gamma ( | \bar { S } | - 1 ) \eta } { ( 1 - \gamma ) ^ { 2 } } } \end{array}$ . + +# 125 3 Abstracted MBRL and the problem of online data collection + +126 As explained, we are interested in Abstracted RL, where we have an approximate model similarity +127 abstraction function $\phi$ and an MDP $M$ . The agent acts in $M$ but only observes $\phi ( s )$ using abstraction +128 function $\phi$ , as in Figure 1. This setting can also be seen as a POMDP, where the states are hidden and +129 there is a deterministic observation function, $o = \phi ( s )$ . However, in contrast to the usual POMDP +130 settings, we look for a myopic (memoryless) policy. While we know that in general this can lead to +131 arbitrarily bad results [26], in this case the value loss would be bounded in the planning setting by +132 Lemma 2. However, now we assume we are in the Abstracted RL setting, and the result for planning +133 may not hold for the learned model. +134 We assume we know $S , A , R , \gamma$ , and $\phi$ (and thus $\bar { S }$ ), but do not know the transition function.5 Since +135 we do not know the transition function we can neither simply do planning on $M$ nor can we construct +136 an abstract MDP, using Definition 3, and solve that. Instead, we let the agent interact with $M$ but +137 use $\phi$ to let the agent observe $\phi ( s )$ , instead of $s$ , and build a learned (abstract) model from the +138 observations it obtains. We show the general Abstracted MBRL procedure in Algorithm 1. + +The agent collects data for every abstract state-action pair 139 $( { \bar { s } } , a )$ , which is stored as sequences $\bar { Y } _ { \bar { s } , a }$ + +$$ +\bar { Y } _ { \bar { s } , a } : \{ { \bar { s } } ^ { \prime ( 1 ) } , { \bar { s } } ^ { \prime ( 2 ) } , \cdot \cdot \cdot , { \bar { s } } ^ { \prime ( m ) } \} . +$$ + +Similar to before in (1), we construct a learned model 140 $\bar { T } _ { Y }$ , now looking at the abstract next-states that 141 were reached: + +$$ +\bar { T } _ { Y } ( \bar { s } ^ { \prime } | \bar { s } , a ) \triangleq \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \mathbb { 1 } \{ \bar { Y } _ { \bar { s } , a } ^ { ( i ) } = \bar { s } ^ { \prime } \} . +$$ + +142 If this model would be equal, or close, to the transition function $\bar { T } _ { \omega }$ of an abstract MDP $\bar { M } _ { \omega }$ , for +143 some valid $\omega$ , we could upper bound the loss in performance due to applying learned policy $\bar { \pi } ^ { * }$ to $M$ +144 instead of the optimal policy $\pi ^ { * }$ [1, 29]. +146 Our main question is: do the finite-sample model learning guarantees of MBRL algorithms still hold +147 in the Abstracted RL setting? + +
Algorithm1 Procedure:Abstracted MBRLAlgorithm2 COLLECTSAMPLES Online
Input: M,Φ,δ,∈,π Y = COLLECTSAMPLES(M,𝜙,δ,∈π) The sampling results in sequences Ys,a, one forInput: M,,δ,∈,π s = initial state // The number of samples m is based on the
every pair (s, a): Ys,=Φ(s(1)),.,,(s'(m))simulator_analysis,Theorem 1. κ = δ/(|S||Al)
=(1),...,s(m) for all (s,a,s') ∈ S × A × S dom=[(2-ln() 2
m =} end forfor all s ∈ S do Ys,a=[] end for
My := (S,A,Ty,R,) π*=Value Iteration(My)while min(s,a) |Ys,a| < m do
Apply to Ms=(s) a=π(s) s' = Step(s,a)
+ +# 3.1 Online data collection + +149 In this section we follow the MBRL method from Algorithm 1, collecting samples online using +150 Algorithm 2.6 Starting from an initial state the agent follows a policy $\pi$ . Instead of observing the +151 states $s$ , the agent observes abstract states $\bar { s } = \phi ( s )$ , see Figure 1. +152 We make two important assumptions in order to make analysis possible. We assume that the MDP +153 is ergodic [25] 7 and that the policy assigns a positive probability to every action in every abstract +154 state. Together this can guarantee that Algorithm 2 can obtain any finite number of samples for every +155 abstract state-action pair within finite time. + +56 Our question is, can we still use Lemma 1 to guarantee that we learn an accurate model? + +157 Since we learn an abstract transition model $\bar { T } _ { Y }$ , we want to be able to guarantee that this learned +158 model will be close to the transition model of some abstract MDP. To define this transition model, +159 we first look at how the data is collected. +160 In the online data collection, a sample in $\bar { Y } _ { \bar { s } , a }$ is drawn when the agent takes action $a$ when it is +161 in a ground state $s \in \bar { s }$ . Specifically the $i$ -th abstract $\bar { Y } _ { \bar { s } , a } ^ { ( i ) } \ = \ \bar { s } ^ { \prime }$ is drawn from (ground) state +162 $X _ { \bar { s } , a } ^ { ( i ) } = s \in \bar { s }$ : + +$$ +\bar { Y } _ { \bar { s } , a } ^ { ( i ) } \sim \mathrm { P r } ( \cdot | X _ { \bar { s } , a } ^ { ( i ) } = s , a ) . +$$ + +Let 163 $X _ { \bar { s } , a } = ( X _ { \bar { s } , a } ^ { ( i ) } ) _ { i = 1 } ^ { m }$ denote the sequence of ground states $s \in { \bar { s } }$ from which the agent took action 164 . Each ground state gets a weight according to how often it was sampled from, which we formalize with the weighting function165 $\begin{array} { r } { \omega _ { X } \colon \forall _ { ( \bar { s } , a ) , s \in \bar { s } } \omega _ { X } \bigl ( s , a \bigr ) \triangleq \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \mathbb { 1 } \{ X _ { \bar { s } , a } ^ { ( i ) } = s \} } \end{array}$ . We use $\omega _ { X }$ to define 166 $\hat { T } _ { \omega _ { X } }$ analogous to (8): + +$$ +\forall _ { ( \bar { s } , a ) , \bar { s } ^ { \prime } } \bar { T } _ { \omega _ { X } } \left( \bar { s } ^ { \prime } | \bar { s } , a \right) = \sum _ { s \in \bar { s } } \omega _ { X } ( s , a ) \sum _ { s ^ { \prime } \in \bar { s } ^ { \prime } } T ( s ^ { \prime } | s , a ) . +$$ + +167 We want to have a concentration inequality to provide bounds on the deviation of the learned model +168 $\bar { T } _ { Y }$ from $\hat { T } _ { \omega _ { X } }$ , we refer to this inequality as the abstract L1 inequality, similar in form to (3): + +$$ +P ( | \bar { T } _ { Y } ( \cdot | \bar { s } , a ) - \bar { T } _ { \omega _ { X } } ( \cdot | \bar { s } , a ) | _ { 1 } \geq \epsilon ) \leq \delta , +$$ + +where 169 $\bar { T } _ { Y } ( \cdot | \bar { s } , a )$ is defined according to (10) and $\hat { T } _ { \omega _ { X } }$ according to (12). + +170 If we could directly obtain i.i.d. samples from $\hat { T } _ { \omega _ { X } }$ and base our learned model $\bar { T } _ { Y }$ on the obtained +171 samples, then we would be able to show that the abstract L1 inequality holds by applying Lemma 1. +172 Since in this case, we would have $m$ i.i.d. samples per abstract state-action pair, distributed according +173 to $\bar { T } _ { \omega _ { X } } ( \cdot | \bar { s } , a )$ . + +the samples. Since every sample 175 in (11). These can have different176 $\bar { Y } ^ { ( i ) }$ was obtainributions if g action . $a$ from state ${ \cal X } _ { \bar { s } , a } ^ { ( i ) } = s \in \bar { s }$ $X _ { \bar { s } , a } ^ { ( i ) } \neq X _ { \bar { s } , a } ^ { ( j ) }$ + +77 Non Identically Distributed While Lemma 1 assumes i.i.d. random variables, we show that it also +78 holds when the random variables are independent but not (necessarily) identically distributed. +179 Lemma 3. Let $\begin{array} { r l r } { X _ { \bar { s } , a } } & { { } = } & { s _ { 1 } , \cdot \cdot \cdot , s _ { m } } \end{array}$ be a sequence of states $ { \mathcal { S } } _ { s } \in { \mathcal { S } } _ { } 0$ and let +180 $\bar { { \bf Y } } _ { \bar { s } , a } = \bar { { \cal Y } } ^ { ( 1 ) } , \bar { { \cal Y } } ^ { ( 2 ) } , \cdot \cdot \cdot , \bar { { \cal Y } } ^ { ( m ) }$ be independent random variables distributed according to +181 $\mathrm { P r } ( \cdot | s _ { 1 } , a ) , \cdot \cdot \cdot , \mathrm { P r } ( \cdot | s _ { m } , a )$ (Eqn. 4). Then, for all $\epsilon > 0$ , + +$$ +\begin{array} { r } { \operatorname* { P r } ( | | \bar { T } _ { Y } ( \cdot | \bar { s } , a ) - \bar { T } _ { \omega _ { X } } ( \cdot | \bar { s } , a ) | | _ { 1 } \geq \epsilon ) \leq ( 2 ^ { | \bar { S } | } - 2 ) e ^ { - \frac { 1 } { 2 } m \epsilon ^ { 2 } } . } \end{array} +$$ + +182 The proof can be found in Appendix B. It mostly follows the proof by Weissman et al. [30], which uses +183 Hoeffding’s inequality [12] and the union bound [6].8 Lemma 3 shows that the fact that Hoeffding’s +184 inequality does not need identically distributed data can be carried over to the setting from Lemma 1. + +185 Independence We may be tempted to assume the samples are independent, i.e., + +$$ +\forall _ { \bar { s } _ { 1 } , \cdots , \bar { s } _ { m } \in ( \bar { S } ) ^ { m } } \operatorname* { P r } ( \bar { Y } _ { \bar { s } , a } ^ { ( 1 ) } = \bar { s } _ { 1 } , \cdots , \bar { Y } _ { \bar { s } , a } ^ { ( m ) } = \bar { s } _ { m } ) = \operatorname* { P r } ( \bar { Y } _ { \bar { s } , a } ^ { ( 1 ) } = \bar { s } _ { 1 } ) \cdot \cdot \cdot P ( \bar { Y } _ { \bar { s } , a } ^ { ( m ) } = \bar { s } _ { m } ) +$$ + +86 however, this may not be the case: + +Observation 1. When collecting samples online, i.e., based on Algorithm 2, the samples cannot be assumed to be independent. + +The following counterexample illustrates this. + +190 Counterexample To show that the samples may not be indepen +191 dent, we will give a counterexample. We use the example MDP and +192 abstraction in Figure 2, where we have 4 (ground) states, 3 abstract +193 states and only 1 action. We look at the transition probability from +194 abstract state $A$ $, { \bar { T } } _ { Y } ( \cdot | A )$ . +195 We will consider two samples and show that for at least one com +196 bination of $\bar { s } _ { 1 }$ and $\bar { s } _ { 2 }$ the samples are not independent. Consider +197 $\bar { s } _ { 1 } = \bar { s } _ { 2 } = B$ . That is, the first two times that we experience a +198 transition from the abstract state $A$ , we end up in $B$ . + +199 the starting state. Then we have and $\mathrm { P r } ( \bar { Y } _ { A } ^ { ( 1 ) } = B ) =$ $\operatorname* { P r } ( B | 1 ) = 0 . 6$ + +$$ +\operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 2 ) } = B ) = \sum _ { \bar { s } \in \bar { \cal S } } \operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 2 ) } = B | \bar { Y } _ { A } ^ { ( 1 ) } = \bar { s } ) \operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 1 ) } = \bar { s } ) +$$ + +![](images/596348f5df8a7d9a095f28522a8ea9d1b1aecc37093cd955880be0e569bee57b.jpg) +Figure 2: Simple MDP, with only 1 action, and abstraction. The small circles are ground states (1,2,3,4). A, B and C are the abstract states. The numbers along the arrows show the transition probabilities, e.g. $P ( 3 | 1 ) = 0 . 6 $ . + +$$ += 0 + 0 . 6 \cdot 0 . 6 + 0 . 4 \cdot 0 . 4 = 0 . 5 2 . +$$ + +So then we end up with: 201 $\operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 1 ) } = B ) \operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 2 ) } = B ) = 0 . 6 \cdot 0 . 5 2 = 0 . 3 2 1$ . And for the joint probability: 202 $\mathrm { P r } ( \bar { Y } _ { A } ^ { ( 1 ) } = B , \bar { Y } _ { A } ^ { ( 2 ) } = B ) = \mathrm { P r } ( \bar { Y } _ { A } ^ { ( 1 ) } = B ) \mathrm { P r } ( \bar { Y } _ { A } ^ { ( 2 ) } = B | \bar { Y } _ { A } ^ { ( 1 ) } = B ) = 0 . 6 \cdot 0 . 6 = 1$ 203 0.36. + +Thus we have that 204 independent. Lead $\operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 1 ) } = B , \bar { Y } _ { A } ^ { ( 2 ) } = B ) \not = \operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 1 ) } = B ) \operatorname* { P r } ( \bar { Y } _ { A } ^ { ( 2 ) } = B )$ , the samples are not + +6 Observation 2. As independence cannot be guaranteed, Lemmas 1 and 3 cannot be readily applied to show that the abstract $L l$ inequality holds. + +# 3.2 Simulator data collection + +Here we also want to give a guarantee in the form of the abstract L1 inequality from (13). While in the previous section we found this was not possible because the samples were dependent, here we assume that we have access to a simulator. To some extent this is not surprising, but to the best of our knowledge, this is the first work that explicitly shows how to combine MBRL and abstraction, using a simulator. We assume that this allows us to select (or move to) any state and draw a sample from its transition function. This we call the independent samples assumption: + +Assumption 1 (Independent samples). We assume we can obtain independent samples, e.g. for any state-action pair $( s , a )$ we can draw samples directly from its transition function $T ( \cdot | s , a )$ . + +217 In case a simulator of the MDP is available this is a reasonable assumption. For every $( \bar { s } , a )$ the +218 simulator sampling procedure (Algorithm 3 in Appendix B) selects a prototype $x _ { \bar { s } , a } \in \bar { s }$ to sample +219 from. We define a weighting function $\omega _ { x } ( s , a )$ that has weight 1 if $s$ is the prototype $x _ { \bar { s } , a }$ and 0 +220 otherwise: + +$$ +\forall _ { ( \bar { s } , a ) , s \in \bar { s } } \omega _ { x } ( s , a ) \triangleq \mathbb { 1 } \{ s = x _ { \bar { s } , a } \} . +$$ + +221 Then we use this $\omega _ { x }$ to define the abstract transition function $\hat { T } _ { \omega _ { X } }$ according to (8). $\bar { T } _ { \omega _ { x } } ( \bar { s } ^ { \prime } | \bar { s } , a ) =$ +222 $\begin{array} { r } { \sum _ { s ^ { \prime } \in \bar { s } ^ { \prime } } T \bigl ( s ^ { \prime } | s = x _ { \bar { s } , a } , a \bigr ) } \end{array}$ . This way the samples that we collect for one pair $( { \bar { s } } , a )$ are i.i.d., they are +223 independent because of our assumption of independent samples and identically distributed because +224 we sample from the prototype. This means we can use Lemma 1. We show that with the simulator +225 we can combine MBRL and abstraction, and still learn an accurate model, that is, we can guarantee +226 that $\bar { T } _ { Y }$ will be close to $\hat { T } _ { \omega _ { x } }$ , with high probability: + +Theorem 1. Under assumption $^ { l }$ , and following the procedure in Algorithm $^ { l }$ , with the data collection from Algorithm $^ 3$ (Appendix $B$ ), with inputs $| \bar { S } | , A , \epsilon$ and $\delta$ . For $\bar { T } _ { Y }$ constructed by the algorithm we have that with probability $1 - \delta$ , the following holds: + +$$ +\forall _ { ( \bar { s } , a ) } \vert \vert \bar { T } _ { Y } \big ( \cdot \vert \bar { s } , a \big ) - \bar { T } _ { \omega _ { x } } \big ( \cdot \vert \bar { s } , a \big ) \vert \vert _ { 1 } \leq \epsilon . +$$ + +230 By Assumption 1 we can obtain any number of independent samples for each abstract state action +231 pair $( \bar { s } , a )$ . Using Lemma 1 we can then derive the number of samples $m$ that is required for each +232 pair $( \bar { s } , a )$ such that, after applying a union bound, we obtain the bounds in (19). The full proof can +233 be found in Appendix B. + +# 234 4 Related work + +235 There is a lot of work that considers the combination of abstraction with either planning or (online) +236 RL. In a lot of these works the dependence of samples that arises in Abstracted RL is not an issue +237 due to various assumptions, similarly to how in MBRL dependence of samples is often not an issue +238 because of the Markov property and the assumption that the MDP is communicating [25]. Often +239 this is either due the assumption that data has been obtained i.i.d., the specific type of abstraction, or +240 because access to an MDP model is assumed. +241 One paper that does give a result for the Abstracted RL setting is the work by Abel et al. [2]. +242 They show that in this setting R-MAX [7] no longer maintains its guarantees when paired with any +243 type of state-abstraction function, though their example is specifically for approximate Q-function +244 abstractions. They also show that the expected trajectory of a learning agent in a constructed +245 abstract MDP (Definition 3) is not the same as in Abstracted RL. Their work makes clear there is a +246 complication when combining MBRL and abstraction, here we further investigated the cause of this +247 complication, the dependence between samples. +248 For planning in constructed abstract MDPs, some main results for exact state-abstractions come +249 from Li et al. [18] and for approximate state-abstractions from Abel et al. [1]. The results from Abel +250 et al. [1] allow for quantifying an upper bound on performance for policies found in a constructed + +abstract MDP, as in section 2.2. Taïga et al. [29] build on this by giving a result for performing RL on top of the constructed abstract MDP. They provide upper bounds for this setting when using MBIE with exploratory bonus (MBIE-EB) [28]. In addition, they give an example to show that in this combination you cannot guarantee optimal performance in the original MDP. Still, they show that an upper bound on the loss in value can be given. + +Both Paduraru et al. [24] and Jiang et al. [15] deal with the issue of dependence by making the explicit assumption that samples are obtained i.i.d. Paduraru et al. [24] consider the setting where we are given a dataset for a continuous domain and then use discretization to aggregate states into abstract states. They then give PAC-style guarantees on the learned abstract model and the value that a policy based on this model can achieve in the real MDP. Instead of using the L1 deviation bound from Weissman et al. [30], Paduraru et al. [24] use a similar bound for i.i.d. samples by Devroye and Gyorfi [9], which requires a minimum amount of samples. Another difference is that their results calculate the probability that the model will be $\epsilon$ -accurate given a fixed dataset. They assume that the data has been gathered i.i.d., but our Lemma 3 shows that merely independent data would be enough. At the same time, our results show that when we collect data online in the Abstracted RL setting, their guarantees will not hold. + +Jiang et al. [15] operate in the abstraction selection setting, where the agent is provided with a set of abstraction functions (state representations). They do not assume that any of the abstraction functions results in a Markov model, but they do assume a given dataset, with data that was collected i.i.d. They give a bound directly on how accurate the Q-values based on the (implicitly) learned model will be, rather than on the accuracy of the model itself. As we showed, the assumption that the data is i.i.d. is not a trivial assumption, since it means the data cannot just have been collected online. They do mention that samples will not be strictly independent if a fixed exploration policy is used to collect data but do not mention what the implications are. + +There are quite a few other papers in the abstraction selection setting, several of these assume that the given set of state representations contains a Markov model [11, 19, 23]. Hallak et al. [11] give asymptotic guarantees for selecting the correct model and on building an exact MDP model. The assumption that there is an MDP model in the given set of representations is crucial in their analysis since for this ‘true model’ the samples are i.i.d. Similarly, both Maillard et al. [19] and Ortner et al. [23] also assume that the given set of state representations contains a Markov model. They create an algorithm for which they obtain regret bounds, their analysis also makes use of the Markov representation. + +Other work in the abstraction selection setting does not assume that the set of abstraction functions contains a Markov model [16, 22]. However, Ortner et al. [22] use Theorem 2.1 from Weissman et al. [30] that requires i.i.d. samples, which we have shown here cannot be guaranteed in this setting. Lattimore et al. [16] operate in a setting more general than MDPs, where the dynamics of the true environment depend arbitrarily on a history of actions, rewards, and observations. The agent gets as input a finite set of environments, one of which is the true environment. Since the input includes the full model of each environment, the agent does not have to learn a transition model. Instead, to obtain regret bounds, they directly compare the rewards the agent obtains to the expected rewards of the given environments and eliminate environments that are implausible given the observed rewards. + +Another way to deal with the issue of dependence is by looking at convergence in the limit [27, 13, 20]. Singh et al. [27] give an asymptotic result for the convergence of Q-learning and TD(0) in MDPs with soft state aggregation. Soft state aggregation means that a state $s$ belongs to a cluster $x$ with some probability $P ( x | s )$ , this means a state $s$ can belong to several clusters. The state-abstraction functions we consider are a special case of this, where each state is part of exactly one abstract state (or cluster). Their result relies on having a stationary policy that assigns a non-zero probability to every action in every state and the assumption that the MDP is ergodic. Together these imply there is a limiting state distribution, and using this they show convergence asymptotically. Our main interest is in finite-samples guarantees with policies that change due to exploration, whereas this work gives convergence guarantees in the limit using a fixed policy. + +Hutter [13] gives a variety of results focusing on both approximate and exact abstractions in environments without MDP assumptions. Several of these are in the planning setting, similar to those of Abel et al. [1]. Most relevant for us is their Theorem 12, which for online RL shows convergence in the limit of the empirical transition function under weak conditions, e.g. if the abstract process itself + +306 is an MDP. Under this condition however the problem reduces to RL in an (abstract) MDP, rather +307 than Abstracted RL. +308 Majeed and Hutter [20] build on the work by Hutter [13] and focus on the combination of model-free +309 RL and exact abstraction. They show that, under the condition of state uniformity, q-learning can be +310 shown to converge in the limit to the optimal solution. State uniformity means that histories that are +311 grouped together have the same optimal q-values. In contrast to our setting, they look at an exact +312 abstraction, extending it to approximate aggregation was left as an open question. +313 Other related work is in the area of MDPs with rich observations or block structure [4, 10]. However, +314 in that setting each observation can be generated only from a single hidden state, which means that +315 the issue of non-i.i.d. data due to abstraction does not arise. In contrast, in our setting multiple +316 (hidden) states generate the same observation. Azizzadenesheli et al. [4] state their setting can be +317 seen as an aggregation problem, where the observations can be aggregated to form a small (latent) +318 MDP. But in our case, we do not try to learn the MDP (as it is not small). Du et al. [10] describe +319 that their setting is similar to exact model similarity (or bisimulation), but we focus on approximate +320 model similarity which is what introduces the problems as described here. + +# 321 5 Discussion + +322 When collecting samples online in Abstracted RL, there is a potential dependence between samples, +323 meaning we cannot use the typically used concentration results that assume i.i.d. samples, e.g. +324 Theorem 2.1 from Weissman et al. [30], the empirical Bernstein inequality [3, 21] or the Chernoff +325 bound. In case the samples are only weakly dependent, it may be that concentration inequalities +326 for (weakly) dependent variables are a viable alternative through which we can come to guarantees +327 on the learned model. Alternatively, it may be possible to change the sampling process to ensure +328 independent samples. One way to ensure independent samples is to, as in the simulator setting, select +329 a prototype state and only use the samples collected from this state. Though in this case, we will be +330 discarding information when we reach a state $s \in { \bar { s } }$ that is not the prototype. +331 Our assumption on the simulator that we can go/reset to any state to draw samples from it can be +332 relaxed, though it may mean that the procedure takes considerably more time. Consider the case +333 where we cannot just reset the simulator to the state $s$ from which we want to sample, and instead, it +334 would behave like the MDP. In this case, we would have to take the right actions to arrive at the state +335 $s$ from which we would like to sample. Since we assume we do not know $T$ , this may take a long +336 time. This also shows the difficulty of assuming that in the MBRL setting somehow have access to an +337 i.i.d. dataset, as has been assumed in some earlier work [24, 15]. + +# 338 6 Conclusion + +339 We analyzed Abstracted RL: the combination of MBRL and state abstraction when the model of +340 the MDP is not available. We have shown that in Abstracted RL samples obtained online cannot +341 be assumed to be independent. Since many current guarantees from MBRL methods rely on this +342 assumption, their guarantees do not hold in this setting. And in fact, no current methods exist that +343 give (correct) finite-sample quality guarantees for the models learned in this setting. This also means +344 that current results that rely on an i.i.d. assumption cannot be readily transferred to the Abstracted +345 RL setting. + +In addition, we show that with a simulator, since we can draw independent samples, it is still possible to give guarantees on the accuracy of the model. However, having access to a simulator may often not be possible. An important step is to see if the MBRL guarantees can be adapted to Abstracted RL for online sample collection. + +# References + +[1] David Abel, David Hershkowitz, and Michael Littman. Near optimal behavior via approximate state abstraction. In International Conference on Machine Learning, pages 2915–2923, 2016. + +[2] David Abel, Dilip Arumugam, Lucas Lehnert, and Michael Littman. State abstractions for lifelong reinforcement learning. In International Conference on Machine Learning, pages 10–19, 2018. +[3] Jean-Yves Audibert, Rémi Munos, and Csaba Szepesvári. Tuning bandit algorithms in stochastic environments. In International conference on algorithmic learning theory, pages 150–165. Springer, 2007. +[4] Kamyar Azizzadenesheli, Alessandro Lazaric, and Animashree Anandkumar. Reinforcement learning in rich-observation mdps using spectral methods. arXiv preprint arXiv:1611.03907, 2016. +[5] Aijun Bai, Siddharth Srivastava, and Stuart J Russell. Markovian state and action abstractions for mdps via hierarchical mcts. In IJCAI, pages 3029–3039, 2016. +[6] George Boole. An investigation of the laws of thought: on which are founded the mathematical theories of logic and probabilities. Dover Publications, 1854. +[7] Ronen I Brafman and Moshe Tennenholtz. R-max-a general polynomial time algorithm for near-optimal reinforcement learning. Journal of Machine Learning Research, 3(Oct):213–231, 2002. +[8] Richard Dearden and Craig Boutilier. Abstraction and approximate decision-theoretic planning. Artificial Intelligence, 89(1-2):219–283, 1997. +[9] L. Devroye and L. Gyorfi. Nonparametric Density Estimation: The L1 View. Wiley Interscience Series in Discrete Mathematics. Wiley, 1985. +[10] Simon Du, Akshay Krishnamurthy, Nan Jiang, Alekh Agarwal, Miroslav Dudik, and John Langford. Provably efficient rl with rich observations via latent state decoding. In International Conference on Machine Learning, pages 1665–1674. PMLR, 2019. +[11] Assaf Hallak, Dotan Di-Castro, and Shie Mannor. Model selection in markovian processes. In Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 374–382, 2013. +[12] Wassily Hoeffding. Probability inequalities for sums of bounded random variables. Journal of the American Statistical Association, 58(301):13–30, 1963. +[13] Marcus Hutter. Extreme state aggregation beyond markov decision processes. Theoretical Computer Science, 650:73–91, 2016. +[14] Thomas Jaksch, Ronald Ortner, and Peter Auer. Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11(Apr):1563–1600, 2010. +[15] Nan Jiang, Alex Kulesza, and Satinder Singh. Abstraction selection in model-based reinforcement learning. In International Conference on Machine Learning, pages 179–188, 2015. +[16] Tor Lattimore, Marcus Hutter, Peter Sunehag, et al. The sample-complexity of general reinforcement learning. In Proceedings of the 30th International Conference on Machine Learning. Journal of Machine Learning Research, 2013. +[17] Lihong Li. A unifying framework for computational reinforcement learning theory. PhD thesis, Rutgers University-Graduate School-New Brunswick, 2009. +[18] Lihong Li, Thomas J Walsh, and Michael L Littman. Towards a unified theory of state abstraction for mdps. In ISAIM, 2006. +[19] Odalric-Ambrym Maillard, Phuong Nguyen, Ronald Ortner, and Daniil Ryabko. Optimal regret bounds for selecting the state representation in reinforcement learning. In International Conference on Machine Learning, pages 543–551. PMLR, 2013. +[20] Sultan Javed Majeed and Marcus Hutter. On q-learning convergence for non-markov decision processes. In IJCAI, pages 2546–2552, 2018. +[21] Andreas Maurer and Massimiliano Pontil. Empirical bernstein bounds and sample variance penalization. arXiv preprint arXiv:0907.3740, 2009. +[22] Ronald Ortner, Odalric-Ambrym Maillard, and Daniil Ryabko. Selecting near-optimal approximate state representations in reinforcement learning. In International Conference on Algorithmic Learning Theory, pages 140–154. Springer, 2014. +[23] Ronald Ortner, Matteo Pirotta, Alessandro Lazaric, Ronan Fruit, and Odalric-Ambrym Maillard. Regret bounds for learning state representations in reinforcement learning. In Advances in Neural Information Processing Systems, pages 12738–12748, 2019. +[24] Cosmin Paduraru, Robert Kaplow, Doina Precup, and Joelle Pineau. Model-based reinforcement learning with state aggregation. In 8th European Workshop on Reinforcement Learning, 2008. +[25] Martin L Puterman. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons, 2014. +[26] Satinder P Singh, Tommi Jaakkola, and Michael I Jordan. Learning without state-estimation in partially observable markovian decision processes. In Machine Learning Proceedings 1994, pages 284–292. Elsevier, 1994. +[27] Satinder P Singh, Tommi Jaakkola, and Michael I Jordan. Reinforcement learning with soft state aggregation. In Advances in neural information processing systems, pages 361–368, 1995. +[28] Alexander L Strehl and Michael L Littman. An analysis of model-based interval estimation for markov decision processes. Journal of Computer and System Sciences, 74(8):1309–1331, 2008. +[29] Adrien Ali Taïga, Aaron Courville, and Marc G Bellemare. Approximate exploration through state abstraction. arXiv preprint arXiv:1808.09819, 2018. +[30] Tsachy Weissman, Erik Ordentlich, Gadiel Seroussi, Sergio Verdu, and Marcelo J Weinberger. Inequalities for the l1 deviation of the empirical distribution. Hewlett-Packard Labs, Tech. Rep, 2003. + +# Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] In Section 6 we describe one the limitations of our work. +(c) Did you discuss any potential negative societal impacts of your work? [N/A] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] We state our general assumptions on the environment in Section 2 and more specific assumptions in Section 3, Section 3.1 and Section 3.2. +(b) Did you include complete proofs of all theoretical results? [Yes] In the Appendix. + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A] +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A] +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A] + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [N/A] +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file diff --git a/md/train/g11CZSghXyY/g11CZSghXyY.md b/md/train/g11CZSghXyY/g11CZSghXyY.md new file mode 100644 index 0000000000000000000000000000000000000000..91b13a18efbd8f2c2c131fa15acaec24bb99a7ea --- /dev/null +++ b/md/train/g11CZSghXyY/g11CZSghXyY.md @@ -0,0 +1,380 @@ +# COMBINING ENSEMBLES AND DATA AUGMENTATION CAN HARM YOUR CALIBRATION + +Yeming Wen∗1, Ghassen Jerfel∗2, Rafael Muller2, Michael W. Dusenberry2, Jasper Snoek2, Balaji Lakshminarayanan2 & Dustin Tran2 ∗ Equal contribution, 1University of Texas, Austin, 2Google Brain + +# ABSTRACT + +Ensemble methods which average over multiple neural network predictions are a simple approach to improve a model’s calibration and robustness. Similarly, data augmentation techniques, which encode prior information in the form of invariant feature transformations, are effective for improving calibration and robustness. In this paper, we show a surprising pathology: combining ensembles and data augmentation can harm model calibration. This leads to a trade-off in practice, whereby improved accuracy by combining the two techniques comes at the expense of calibration. On the other hand, selecting only one of the techniques ensures good uncertainty estimates at the expense of accuracy. We investigate this pathology and identify a compounding under-confidence among methods which marginalize over sets of weights and data augmentation techniques which soften labels. Finally, we propose a simple correction, achieving the best of both worlds with significant accuracy and calibration gains over using only ensembles or data augmentation individually. Applying the correction produces new state-of-the art in uncertainty calibration across CIFAR-10, CIFAR-100, and ImageNet.1 + +# 1 INTRODUCTION + +Many success stories in deep learning (Krizhevsky et al., 2012; Sutskever et al., 2014) are in restricted settings where predictions are only made for inputs similar to the training distribution. In real-world scenarios, neural networks can face truly novel data points during inference, and in these settings it can be valuable to have good estimates of the model’s uncertainty. For example, in healthcare, reliable uncertainty estimates can prevent over-confident decisions for rare or novel patient conditions (Dusenberry et al., 2019). We highlight two recent trends obtaining state-of-the-art in uncertainty and robustness benchmarks. + +Ensemble methods are a simple approach to improve a model’s calibration and robustness (Lakshminarayanan et al., 2017). The same network architecture but optimized with different initializations can converge to different functional solutions, leading to decorrelated prediction errors. By averaging predictions, ensembles can rule out individual mistakes (Lakshminarayanan et al., 2017; Ovadia et al., 2019). Additional work has gone into efficient ensembles such as MC-dropout (Gal and Ghahramani, 2016), BatchEnsemble, and its variants (Wen et al., 2020; Dusenberry et al., 2020; Wenzel et al., 2020). These methods significantly improve calibration and robustness while adding few parameters to the original model. + +Data augmentation is an approach which is orthogonal to ensembles in principle, encoding additional priors in the form of invariant feature transformations. Intuitively, data augmentation enables the model to train on more data, encouraging the model to capture certain invariances with respect to its inputs and outputs; data augmentation may also produce data that may be closer to an out-ofdistribution target task. It has been a key factor driving state-of-the-art: for example, Mixup (Zhang et al., 2018; Thulasidasan et al., 2019a), AugMix (Hendrycks et al., 2020), and test-time data augmentation (Ashukha et al., 2020). + +A common wisdom in the community suggests that ensembles and data augmentation should naturally combine. For example, the majority of uncertainty models in vision with strong performance are built upon baselines leveraging standard data augmentation (He et al., 2016; Hendrycks et al., 2020) (e.g., random flips, cropping); Hafner et al. (2018) cast data augmentation as an explicit prior for Bayesian neural networks, treating it as beneficial when ensembling; and Hendrycks et al. (2020) highlights further improved results in AugMix when combined with Deep Ensembles (Hansen and Salamon, 1990; Krogh and Vedelsby, 1995). However, we find the complementary benefits between data augmentations and ensembels are not universally true. Section 3.1 illustrates the poor calibration of combining ensembles (MC-dropout, BatchEnsemble and Deep Ensembles) and Mixup on CIFAR: the model outputs excessive low confidence. Motivated by this pathology, in this paper, we investigate in more detail why this happens and propose a method to resolve it. + +Contributions. In contrast to prior work, which finds individually that ensembles and Mixup improve calibration, we find that combining ensembles and Mixup consistently degrades calibration performance across three ensembling techniques. From a detailed analysis, we identify a compounding under-confidence, where the soft labels in Mixup introduce a negative confidence bias that hinders its combination with ensembles. We further find this to be true for other label-based strategies such as label smoothing. Finally, we propose CAMixup to correct this bias, pairing well with ensembles. CAMixup produces new state-of-the-art calibration on both CIFAR-10/100 (e.g., $0 . 4 \%$ and $2 . 3 \%$ on CIFAR-10 and CIFAR-10C), building on Wide ResNet 28-10 for competitive accuracy (e.g., $9 7 . 5 \%$ and $8 9 . 8 \%$ ) and on ImageNet $( 1 . 5 \% )$ , building on ResNet-50 for competitive accuracy $( 7 7 . 4 \% )$ . + +2 BACKGROUND ON CALIBRATION, ENSEMBLES AND DATA AUGMENTATION + +# 2.1 CALIBRATION + +Uncertainty estimation is critical but ground truth is difficult to obtain for measuring performance. Fortunately, calibration error, which assesses how well a model reliably forecasts its predictions over a population, helps address this. Let $( \hat { Y } , \hat { P } )$ denote the class prediction and associated confidence (predicted probability) of a classifier. + +Expected Calibration Error(ECE): One notion of miscalibration is the expected difference between confidence and accuracy (Naeini et al., 2015): $E _ { \hat { P } } [ | \mathbb { P } ( \hat { Y } = Y | \hat { P } = p ) - p | ]$ . ECE approximates this by binning the predictions in $[ 0 , 1 ]$ under $M$ equally-spaced intervals, and then taking a weighted average of each bins’ accuracy/confidence difference. Let $B _ { m }$ be the set of examples in the $m ^ { \tilde { t } h }$ bin whose predicted confidence falls into interval $\textstyle { \bigl ( } { \frac { m - 1 } { M } } , { \frac { m } { M } } { \bigr ] }$ . The bin $B _ { m }$ ’s accuracy and confidence are: + +$$ +\mathrm { A c c } ( B _ { m } ) = \frac { 1 } { | B _ { m } | } \sum _ { x _ { i } \in B _ { m } } \mathbb { 1 } ( \hat { y } _ { i } = y _ { i } ) , \quad \mathrm { C o n f } ( B _ { m } ) = \frac { 1 } { | B _ { m } | } \sum _ { x _ { i } \in B _ { m } } \hat { p } _ { i } , +$$ + +where $\hat { y } _ { i }$ and $y _ { i }$ are the predicted and true labels and $\hat { p _ { i } }$ is the confidence for example $x _ { i }$ . Given $n$ examples, ECE is $\begin{array} { r } { \sum _ { m = 1 } ^ { M ^ { - } } \frac { | B _ { m } | } { n } \bigg | \operatorname { A c c } ( B _ { m } ) - \operatorname { C o n f } ( B _ { m } ) \bigg | } \end{array}$ . + +# 2.2 ENSEMBLES + +Aggregating the predictions of multiple models into an ensemble is a well-established strategy to improve generalization (Hansen and Salamon, 1990; Perrone and Cooper, 1992; Dietterich, 2000). + +BatchEnsemble: BatchEnsemble takes a network architecture and shares its parameters across ensemble members, adding only a rank-1 perturbation for each layer in order to decorrelate member predictions (Wen et al., 2020). For a given layer, define the shared weight matrix among $K$ ensemble members as $\mathbf { W } \in \mathbb { R } ^ { m \times d }$ . A tuple of trainable vectors $\mathbf { r } _ { k } \in \mathbb { R } ^ { m }$ and $\mathbf { s } _ { k } \in \mathbb { R } ^ { n }$ are associated with each ensemble member $k$ . The new weight matrix for each ensemble member in BatchEnsemble is + +$$ +\mathbf { W } _ { k } ^ { \prime } = \mathbf { W } \circ \mathbf { F } _ { k } , { \mathrm { ~ w h e r e ~ } } \mathbf { F } _ { k } = \mathbf { r } _ { k } \mathbf { s } _ { k } ^ { \top } \in \mathbb { R } ^ { m \times d } , +$$ + +where $\circ$ denotes the element-wise product. Applying rank-1 perturbations via $\mathbf { r }$ and s adds few additional parameters to the overall model. We use an ensemble size of 4 in all experiments. + +MC-Dropout: Gal and Ghahramani (2016) interpret Dropout (Srivastava et al., 2014) as an ensemble model, leading to its application for uncertainty estimates by sampling multiple dropout masks at test time in order to ensemble its predictions. We use an ensemble size of 20 in all experiments. + +Deep Ensembles: Composing an ensemble of models, each trained with a different random initialization, provides diverse predictions (Fort et al., 2019) which have been shown to outperform strong baselines on uncertainty estimation tasks (Lakshminarayanan et al., 2017). We use an ensemble size of 4 in all experiments. + +In this work, we focus on the interaction between data augmentation strategies and BatchEnsemble, MC-Dropout, and deep ensembles. Other popular ensembling approaches leverage weight averaging such as Polyak-Ruppert (Ruppert, 1988), checkpointing (Huang et al., 2017), and stochastic weight averaging (Izmailov et al., 2018) to collect multiple sets of weights during training and aggregate them to make predictions with only a single set. + +# 2.3 DATA AUGMENTATION + +Data augmentation encourages a model to make invariant predictions under desired transformations which can greatly improve generalization performance. For example, in computer vision, random leftright flipping and cropping are de-facto approaches (He et al., 2016). We highlight two state-of-the-art techniques which we study. + +Mixup: Mixup (Zhang et al., 2018) manipulates both the features and the labels in order to encourage linearly interpolating predictions. Given an example $( x _ { i } , y _ { i } )$ , Mixup applies + +$$ +\tilde { x } _ { i } = \lambda x _ { i } + ( 1 - \lambda ) x _ { j } , \quad \tilde { y } _ { i } = \lambda y _ { i } + ( 1 - \lambda ) y _ { j } . +$$ + +Here, $x _ { j }$ is sampled from the training dataset (taken from the minibatch), and $\lambda \sim \operatorname { B e t a } ( a , a )$ for a fixed hyperparameter $a > 0$ . + +Mixup was shown to be effective for generalization and calibration of deep neural networks (Zhang et al., 2018; Thulasidasan et al., 2019b). Recent work has investigated why Mixup improves generalization (Guo et al., 2018; Shimada et al., 2019) and adversarial robustness (Beckham et al., 2019; Pang et al., 2020; Mangla et al., 2020). Given Mixup’s simplicity, many extensions have been proposed with further improvements (Yun et al., 2019; Berthelot et al., 2019; Verma et al., 2019; Roady et al., 2020; Chou et al., 2020). + +AugMix: Searching or sampling over a set of data augmentation operations can lead to significant improvement on both generalization error and calibration (Cubuk et al., 2019b;a). AugMix (Hendrycks et al., 2020) applies a sum of augmentations, each with random weighting, with a Jensen-Shannon consistency loss to encourage similarity across the augmentations. AugMix achieves state-of-the-art calibration across in- and out-of-distribution tasks. Let $\mathcal { O }$ be the set of data augmentation operations and $k$ be the number of AugMix iterations. AugMix samples $w _ { 1 } , \dots , w _ { k } \sim { \mathrm { D i r i c h l e t } } ( a , \dots , a )$ for a fixed hyperparameter $a > 0$ and $\boldsymbol { \mathrm { o p } } _ { 1 } , \ldots , \boldsymbol { \mathrm { o p } } _ { k }$ from $\mathcal { O }$ . Given an interpolation parameter $m$ , sampled from $\mathrm { B e t a } ( a , a )$ , the augmented input $\tilde { x } _ { a u g m i x }$ is: + +$$ +\tilde { x } _ { a u g m i x } = m x _ { o r i g } + ( 1 - m ) x _ { a u g } , \qquad x _ { a u g } = \sum _ { i = 1 } ^ { k } w _ { i } \mathrm { o p } _ { i } ( x _ { o r i g } ) . +$$ + +# 3 MIXUP-ENSEMBLE PATHOLOGY + +We seek to understand the effect of data augmentations on ensembles. In particular, we hope to verify the hypothesis of compounding improvements when combining the seemingly orthogonal techniques of data augmentation and ensembles. To our surprise, we find that augmentation techniques can be detrimental to ensemble calibration. + +# 3.1 THE SURPRISING MISCALIBRATION OF ENSEMBLES WITH MIXUP + +Ensembles are the most known and simple approaches to improving calibration (Ovadia et al., 2019; Lakshminarayanan et al., 2017), and Thulasidasan et al. (2019b) showed that Mixup improves calibration in a single network. Motivated by this, Fig. 1 applies Mixup to each ensemble member on CIFAR-10/CIFAR-100 with WideResNet 28-10 (Zagoruyko and Komodakis, 2016). Here, we searched over Mixup’s optimal hyperparameter $\alpha$ (Eq. 3) and found that $\alpha = 1$ gives the best result, which corroborates the finding in Zhang et al. (2018). All data points in Fig. 1 are averaged over 5 random seeds. + +Figs. 1a and 1b demonstrate improved test accuracy (Red (ensembles without Mixup) to Blue (ensembles with Mixup)). However, if we shift focus to Figs. 1c and 1d’s calibration error, it is evident that combining Mixup with ensembles leads to worse calibration (Red to Blue). This is counterintuitive as we would expect Mixup, which improves calibration of individual models (Thulasidasan et al., 2019a), to also improve the calibration of their ensemble. Fig. 1 confirms this pattern across BatchEnsemble (BE), MC-dropout (MC), and deep ensembles (DE). This pathology also occurs on ImageNet, as seen in Table 1. + +![](images/7de16ef0003a45865f116896bc4adabc694829b6b0ca10008acf67cfc5bcbe5e.jpg) +Figure 1: WideResNet 28-10 on CIFAR-10/CIFAR-100. Red: Ensembles without Mixup; Blue: Ensembles with Mixup; Orange: Individual models in ensembles without Mixup. (a) & (b): Applying Mixup to different ensemble methods leads to consistent improvement on test accuracy. (c) & (d): Applying Mixup to different ensemble methods harms calibration. Averaged over 5 random seeds. + +Why do Mixup ensembles degrade calibration? To investigate this in more detail, Fig. 2 plots a variant of reliability diagrams (DeGroot and Fienberg, 1983) on BatchEnsemble. We bin the predictions into $M = 1 5$ equally spaced intervals based on their confidence (softmax probabilities) and compute the difference between the average confidence and the average accuracy as in Eq. 1 for each bin. Fig. 2 tracks this difference over varying confidence levels. A positive difference (Acc−Conf) implies under-confidence with respect to the true frequencies; negative implies over-confidence; and zero implies perfect calibration. + +The backbone model in Fig. 2 is BatchEnsemble with an ensemble size of 4 (we also found this consistent for MC-Dropout and Deep-Ensemble). The figure presents 4 methods: Single: vanilla WideResNet 28-10; MixupSingle: WideResNet 28-10 model trained with Mixup; BatchEnsemble: vanilla BatchEnsemble WideResNet 28-10 model; MixupBE: BatchEnsemble WideResNet 28-10 model trained with Mixup. Fig. 2 shows that only models trained with Mixup have positive $( \operatorname { A c c } - \operatorname { C o n f } )$ values on the test set, which suggests that Mixup encourages under-confidence. Mixup ensemble’s under-confidence is also greater in magnitude than that of the individual Mixup models. This suggests that Mixup ensembles suffer from compounding under-confidence, leading to a worse calibration for the ensemble than the individual Mixup models’ calibration. This is contrary to our intuition that ensembles always improves calibration. + +![](images/c2ab4f9142caea72ad8e4cfafd8a5bf0ae7a9877e08d8dcff755f5ba49661364.jpg) +Figure 2: Reliability diagrams on CIFAR100 with a WideResNet 28-10. + +To further visualize this issue, Appendix C’s Fig. 8 investigates the confidence (softmax probabilities) surface of deep ensembles and Mixup when trained on a toy dataset consisting of 5 clusters, each with a different radius. We ensemble over 4 independently trained copies of 3-layer MLPs. Deep ensemble’s predictive confidence is plotted over the entire input data space in Fig. 8c. The resulting predictions are extremely confident except at the decision boundaries. Deep Ensemble still displays high confidence in the area nearest to the origin which is expected to have lower confidence level. On the other hand, Fig. 8d shows that Mixup-Ensemble is only confident in a very constrained area around the training clusters, leading to an overall under-confident classifier which confirms our postulation of compounding under-confidence. + +# 3.2 IS THE PATHOLOGY SPECIFIC TO MIXUP? + +At the core of the issue is that Mixup conflates data uncertainty (uncertainty inherent to the data generating process) with model uncertainty. Soft labels can correct for over-confidence in single models which have no other recourse to improve uncertainty estimates. However, when combined with ensembles, which incorporate model uncertainty, this correction may be unnecessary. Because image classification benchmarks tend to be deterministic, soft labels encourage predictions on training data to be less confident about their true targets even if they are correct. We validate this hypothesis by showing it also applies to label smoothing. + +Label Smoothing: Like Mixup, label smoothing applies soft labels: it smoothens decision boundaries by multiplying a data point’s true class by $( 1 - \alpha )$ , with probability $\alpha$ spread equally across other classes. Using the same experimental setup as before, we apply increasing levels of label smoothing to ensembles of WideResNet 28-10 models trained on CIFAR-10. Fig. 3 demonstrates the harmful effect of label smoothing on CIFAR-10 ECE, particularly when aggressive (coeff $\geq 0 . 2$ ). In the concurrent work, Qin et al. (2020) found that label smoothing plus ensemble leads to worse calibration. They showed that adjusting model confidence successfully corrects the compounding underconfidence. + +![](images/2328151ade7bb16f576d3496a242db1d6119f59bda46bd5b2894e140726a9e82.jpg) +Errorand ECE of Label Smoothing on WideResNet 28-10 trained on CIFAR-10 +Figure 3: ECE and Error on CIFAR-10 with label smoothing on MC Dropout, Deep Ensembles, and BatchEnsemble. ECE degrades with label smoothing, particularly when it is more aggressive $( \geq 0 . 2 )$ . + +# 4 CONFIDENCE ADJUSTED MIXUP ENSEMBLES (CAMIXUP) + +In this section, we aim to fix the compounding under-confidence issue when combining Mixup and ensembles without sacrificing its improved accuracy on both in- and out-of-distribution data. + +# 4.1 CLASS BASED CAMIXUP + +Mixup encourages model under-confidence as shown in Fig. 2. Notice that Mixup assigns a uniform hyperparameter $\alpha$ to all examples in the training set. To improve Mixup, we start from the intuition that in classification, some classes are prone to be more difficult than others to predict. This can be confirmed by Fig. 4a, which provides examples of per-class test accuracy. Ideally, we prefer our model to be confident when it is predicting over easy classes such as cars and ships. For harder classes like cats and dogs, the model is encouraged to be less confident to achieve better calibration. + +Therefore, instead of a uniform Mixup hyperparameter for all classes, we propose to adjust the Mixup hyperparameter of each class by the difference between its accuracy and confidence. CAMixup’s intuition is that we want to apply Mixup on hard classes on which models tend to be over-confident. On easy examples, we impose the standard data-augmentation without Mixup. This partially prevents Mixup models from being over-confident on difficult classes while maintaining its good calibration on out-of-distribution inputs.2 + +Denote the accuracy and confidence of class $i$ as $\operatorname { A c c } ( C _ { i } )$ and $\operatorname { C o n f } ( C _ { i } )$ . We adjust Mixup’s $\lambda$ in Eqn. 3 by the sign of $\operatorname { A c c } ( C _ { i } ) - \operatorname { C o n f } ( C _ { i } )$ , which are defined as $\begin{array} { r } { \operatorname { A c c } ( \dot { C } _ { i } ) = \frac { 1 } { | C _ { i } | } \dot { \sum } _ { x _ { j } \in C _ { i } } \mathbb { 1 } \bar { ( y _ { j } = i ) } } \end{array}$ and $\begin{array} { r } { \mathrm { C o n f } ( C _ { i } ) = \frac { 1 } { | C _ { i } | } \sum _ { x _ { j } \in C _ { i } } \hat { p _ { i } } } \end{array}$ . + +$$ +\lambda _ { i } = { \left\{ \begin{array} { l l } { 0 } & { \operatorname { A c c } ( C _ { i } ) > \operatorname { C o n f } ( C _ { i } ) } \\ { \lambda } & { \operatorname { A c c } ( C _ { i } ) \leq \operatorname { C o n f } ( C _ { i } ) . } \end{array} \right. } +$$ + +![](images/95afc36f6c2c12253cda3c96aa22255d9112dd3f392eab512b9f9ded1ff43870.jpg) +Figure 4: Left: An illustration of the proposed CAMixup data augmentation. Selected per-class test accuracies are showed in brown. Overall test accuracy is $9 6 . 2 \%$ on CIFAR-10; Right: Number of epochs (out of 250) where CAMixup enables Mixup for selected classes in BatchEnsemble. CAMixup tends to assign Mixup to hard classes. Counts are accumulated individually for each ensemble member (ensemble size 4). + +If the model is already under-confident on class $i$ $( \operatorname { A c c } ( C _ { i } ) > \operatorname { C o n f } ( C _ { i } ) )$ , Mixup is not applied to examples in the class, and $\lambda _ { i } = 0$ . However, if $\operatorname { A c c } ( C _ { i } ) \leq \operatorname { C o n f } ( C _ { i } )$ , the model is over-confident on this class, and Mixup is applied to reduce model confidence. We compute the accuracy and confidence on a validation dataset after each training epoch. + +![](images/448a92d6a9ed5defb12abf632c929d52ca4d0d5dfd34a7d32422b6742a648e99.jpg) +Figure 5: WideResNet 28-10 on CIFAR-10/CIFAR-100. Red: Ensembles without Mixup; Blue: Ensembles with Mixup; Green: Our proposed CAMixup improves both accuracy & ECE of ensembles. + +Notice that $\lambda _ { i }$ is dynamically updated at the end of each epoch. To understand which classes are more often assigned Mixup operation, Fig. 4 calculates the number of times that $\lambda _ { i } > 0$ throughout training. The maximum number of times is the number of total training epochs, which is 250 in the BatchEnsemble model. We find that CAMixup rarely enables Mixup to easy classes such as cars and ships: the number of times is less than $1 0 \%$ of the total epochs. For harder classes like cats and dogs, CAMixup assigns Mixup operation almost every epoch, accounting for more than $8 0 \%$ of total epochs. In summary, Fig. 4 shows that CAMixup reduces model confidence on difficult classes and encourages model confidence on easy classes, leading to better overall calibration. Appendix D.1’s Fig. 9a also shows that CAMixup effectively shifts the confidence to the lower region. + +Fig. 5 presents results of CAMixup on CIFAR-10 and CIFAR-100 test set, where we compare the effect of Mixup and CAMixup on different ensembling strategies (BatchEnsemble, MC Dropout, DeepEnsemble). Adding Mixup to ensembles improves accuracy but worsens ECE. Adding CAMixup to ensembles significantly improves accuracy of ensembles in all cases. More importantly, the calibration results in Figs. 5c and 5d show that CAMixup ensembles are significantly better calibrated than Mixup ensembles, for instance, CAMixup reduces ECE by more than 5X for BatchEnsemble over Mixup. We observe a minor decrease in test accuracy (at most $0 . 2 \%$ ) when comparing CAMixup ensembles with Mixup ensembles, but we believe that this is a worthwhile trade-off given the significant improvement in test ECE. + +Table 1 presents similar experiments applied to ResNet-50 on ImageNet, using BatchEnsemble as the base ensembling strategy. These results are state of the art to the best of our knowledge: Dusenberry et al. (2020) report $1 . 7 \%$ ECE with Rank-1 Bayesian neural nets and $3 . 0 \%$ with Deep Ensembles; Thulasidasan et al. (2019a) report $3 . 2 \%$ for ResNet-50 with Mixup, $2 . 9 \%$ for ResNet-50 with an entropy-regularized loss, and $1 . 8 \%$ for ResNet-50 with label smoothing. + +Table 1: BatchEnsemble with ensemble size 4 on ImageNet. + +
ACCECE
BatchEnsemble77.02.0%
MixupBE77.52.1%
CAMixupBE77.41.5%
+ +# 4.2 PERFORMANCE UNDER DISTRIBUTION SHIFT + +Here, we assess model resilience to covariate shift by evaluating on the CIFAR-10-C and CIFAR-100-C benchmarks (C stands for corruptions) proposed by Hendrycks and Dietterich (2019a), which apply 15 types of corruptions each with 5 levels of intensity. We evaluate the performance of CAMixup vs Mixup when applied to different ensembles, and report average error on ECE across different types of corruptions and intensities. + +Fig. 6a shows that Mixup improves accuracy on the corrupted dataset because of its strong regularization effect. However, the models tend to be over-confident as one moves further from the original distribution (higher corruption intensities), so encouraging underconfidence is not an issue. This explains why Mixup ensembles maintain low ECE on out-of-distribution test data in Fig. 6b. + +![](images/e247a496dee5a83d0292aa2da827d3c725000b1b3fd45ee5b7e80a9a777da7fe.jpg) +Figure 6: WideResNet 28-10 on CIFAR-10-C. Red: Ensembles without Mixup; Blue: Ensembles with Mixup; Green: Ensembles with CAMixup (ours). + +Fig. 6b also shows that CAMixup’s calibration on out-of-distribution data (CIFAR-10-C) is also on par with Mixup ensembles. We observe the same result on CIFAR-100-C (Appendix D.1’s Fig. 9). Thus, we successfully improve model calibration on in-distribution datasets without sacrificing its calibration on out-of-distribution datasets. + +# 5 COMPOUNDING THE BENEFITS OF CAMIXUP WITH AUGMIX ENSEMBLES + +We have investigated why certain data augmentation schemes may not provide complementary benefits to ensembling. We proposed class-adjusted Mixup (CAMixup) which compounds both accuracy and ECE over vanilla ensembles. We believe that the insights from our work will allow the community and practitioners to compound SOTA performance. We provide two concrete examples. + +# 5.1 AUGMIX + +We show how CAMixup can compound performance over ensembles of models trained with AugMix, which were shown by Hendrycks et al. (2020) to achieve state-of-the-art accuracy and calibration on both clean and corrupted benchmarks. We primarily focus on improving BatchEnsemble and we investigate if adding better data augmentation schemes closes the gap between memory-efficient ensembles (BatchEnsemble) and independent deep ensembles. + +As discussed in Section 2.3, AugMix only uses label-preserving transformations. Therefore AugMix provides complementary benefits to ensembles (and CAMixup). This is consistent with calibration improvements in the literature with ensemble methods, which apply standard data augmentation such as random flips, which also do not smoothen labels. + +We consider a combination of AugMix and Mixup as it allows the model to encounter both diverse label-preserving augmentations and soft labels under a linearly interpolating regime. The combination + +![](images/0a192a9b07380f96c62a6518a30dc271c9cd46cb5426c6368fa6afb30194de5e.jpg) +Figure 7: Performance on BatchEnsemble under dataset shift. Mixup and AugMixup improve accuracy and calibration under shift but significantly worsen in-distribution calibration. Our proposed CAMixup and AugCAMixup improve accuracy and calibration. + +Table 2: Results for Wide ResNet-28-10 BatchEnsemble on in- and out-of-distribution CIFAR-10/100 with various data augmentations, averaged over 3 seeds. AugMix: AugMix $^ +$ BatchEnsemble; AugMixup: AugMix $^ +$ Mixup BatchEnsemble; AugCAMixup: AugMix $^ +$ CAMixup BatchEnsemble. Adding Mixup to AugMix model increases test accuracy and corrupt accuracy at the cost of calibration decay on testset. CAMixup bridges this gap with only a minor drop in accuracy. + +
Method/MetricCIFAR-10CIFAR-100
Acc(↑)ECE(↓)cA/cECEAcc(↑)ECE(↓)cA/cECE
AugMix BE97.361.02%89.49/2.6%83.572.96%67.12/7.1%
AugMixup BE97.521.71%90.05/2.8%83.774.19%69.26/4.8%
AugCAMixup BE97.470.45%89.81/2.4%83.742.35%68.71/4.4%
+ +AugMixup (AugMix $^ +$ Mixup) can be written as + +$$ +x = \lambda * \operatorname { A u g M i x } ( x _ { 1 } ) + ( 1 - \lambda ) \operatorname { A u g M i x } ( x _ { 2 } ) , \quad y = \lambda * y _ { 1 } + ( 1 - \lambda ) * y _ { 2 } . +$$ + +Consistent with earlier results on Mixup, Table 2 shows combining AugMixup with BatchEnsemble improves accuracy but worsens ECE, leading to under-confidence on in-distribution data. (Appendix D.2’s Fig. 10). With our proposed fix CAMixup, the combination AugCAMixup (AugMix $^ +$ CAMixup) improves calibration while retaining the highest accuracy for ensembles. Fig. 7 shows detailed results on CIFAR-10-C and CIFAR-100-C. Similar to Mixup, AugMixup improves calibration under shift but worsens calibration on in-distribution. However, our proposed AugCAMixup improves accuracy and calibration of ensembles on both clean and corrupted data. + +To the best of our knowledge, these results are state-of-the-art in the literature: Dusenberry et al. (2020) report $0 . 8 \%$ ECE and $1 . 8 \%$ ECE for CIFAR-10 and CIFAR-100 along with $8 \%$ and ${ \mathrm { { \dot { 1 } } 1 . 7 \% } }$ ECE for corruptions; Guo et al. (2017) report $0 . 5 4 \%$ and $2 . 3 \%$ ECE for the smaller Wide ResNet 32 on CIFAR-10 and CIFAR-100 with temperature scaling $9 3 \%$ and $72 \%$ accuracy), and Ovadia et al. (2019) demonstrated that temperature scaling does not extend to distribution shift. + +# 5.2 TEMPERATURE SCALING + +In concurrent work, Rahaman and Thiery (2020) consider the interplay between data augmentation and ensembling on calibration. They also find that Mixup ensembles can be under-confident, and propose temperature scaling as a solution. Their core contribution is the same but differ in slight ways: we further this analysis by showing the compounding under-confidence extends to other techniques applying soft labels such as label smoothing, and we propose CAMixup as a solution. Post-hoc calibration techniques like temperature scaling are complementary to our proposal and do not address the core conflation issue with Mixup. Corroborating findings of Ovadia et al. (2019), Appendix G shows combining CAMixup and temperature scaling can further improve test calibration error; it does not improve out-of-distribution calibration. Another concurrent work showed that calibrated ensemble members do not always lead to calibrated ensemble predictions (Anonymous, 2021). + +# 6 CONCLUSION + +Contrary to existing wisdom in the literature, we find that combining ensembles and Mixup consistently degrades calibration performance across three ensembling techniques. From a detailed analysis, we identify a compounding under-confidence, where Mixup’s soft labels (and more broadly, label-based augmentation strategies) introduce a negative confidence bias that hinders its combination with ensembles. To correct this, we propose CAMixup, which applies Mixup to only those classes on which the model tends to be over-confident, modulated throughout training. CAMixup combines well with state-of-the-art methods. It produces new state-of-the-art calibration across CIFAR-10, CIFAR-100, and ImageNet while obtaining competitive accuracy. Appendix H points out potential future work and limitations of CAMixup. + +# REFERENCES + +Chirag Agarwal and Sara Hooker. Estimating example difficulty using variance of gradients. arXiv preprint arXiv:2008.11600, 2020. + +Anonymous. Should ensemble members be calibrated? In Submitted to International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $=$ wTWLfuDkvKp. under review. + +Arsenii Ashukha, Alexander Lyzhov, Dmitry Molchanov, and Dmitry Vetrov. Pitfalls of in-domain uncertainty estimation and ensembling in deep learning. In International Conference on Learning Representations, 2020. + +Christopher Beckham, Sina Honari, Alex Lamb, Vikas Verma, Farnoosh Ghadiri, R. Devon Hjelm, and Christopher Joseph Pal. Adversarial mixup resynthesizers. ArXiv, abs/1903.02709, 2019. + +David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin A Raffel. Mixmatch: A holistic approach to semi-supervised learning. In Advances in Neural Information Processing Systems, pages 5049–5059, 2019. + +Hsin-Ping Chou, S. Chang, J. Pan, Wei Wei, and D. Juan. Remix: Rebalanced mixup. ArXiv, abs/2007.03943, 2020. + +Ekin D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. Randaugment: Practical automated data augmentation with a reduced search space. arXiv: Computer Vision and Pattern Recognition, 2019a. + +Ekin Dogus Cubuk, Barret Zoph, Dandelion Mané, V. Vasudevan, and Quoc V. Le. Autoaugment: Learning augmentation strategies from data. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 113–123, 2019b. + +Morris H. DeGroot and Stephen E. Fienberg. The Comparison and Evaluation of Forecasters. The Statistician, 32(1/2):12, March 1983. ISSN 00390526. doi: 10.2307/2987588. URL https: //www.jstor.org/stable/10.2307/2987588?origin ${ \bf \Phi } = { \bf \Phi }$ crossref. + +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Fei-Fei Li. Imagenet: A large-scale hierarchical image database. 2009 IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255, 2009. + +Thomas G. Dietterich. Ensemble methods in machine learning. In Multiple Classifier Systems, 2000. + +Michael W Dusenberry, Dustin Tran, Edward Choi, Jonas Kemp, Jeremy Nixon, Ghassen Jerfel, Katherine Heller, and Andrew M Dai. Analyzing the role of model uncertainty for electronic health records. arXiv preprint arXiv:1906.03842, 2019. + +Michael W. Dusenberry, Ghassen Jerfel, Yeming Wen, Yi-an Ma, Jasper Snoek, Katherine Heller, Balaji Lakshminarayanan, and Dustin Tran. Efficient and scalable Bayesian neural nets with rank-1 factors. In ICML, 2020. + +Stanislav Fort, Huiyi Hu, and Balaji Lakshminarayanan. Deep Ensembles: A Loss Landscape Perspective. arXiv preprint arXiv:1912.02757, 2019. + +Yarin Gal and Zoubin Ghahramani. Dropout as a Bayesian approximation: Representing model uncertainty in deep learning. In International Conference on Machine Learning, 2016. + +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On Calibration of Modern Neural Networks. In International Conference on Machine Learning (ICML), volume cs.LG. Cornell University Library, August 2017. URL http://arxiv.org/abs/1706.04599v2. + +Hongyu Guo, Yongyi Mao, and Richong Zhang. Mixup as locally linear out-of-manifold regularization. In AAAI, 2018. + +Hongyu Guo, Yongyi Mao, and Richong Zhang. Augmenting data with mixup for sentence classification: An empirical study. arXiv preprint arXiv:1905.08941, 2019. + +Danijar Hafner, Dustin Tran, Alex Irpan, Timothy Lillicrap, and James Davidson. Reliable uncertainty estimates in deep neural networks using noise contrastive priors. arXiv preprint arXiv:1807.09289, 2018. + +Lars Kai Hansen and Péter Salamon. Neural network ensembles. IEEE Trans. Pattern Anal. Mach. Intell., 12:993–1001, 1990. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Computer Vision and Pattern Recognition, 2016. + +Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019a. URL https://openreview.net/forum?id $=$ HJz6tiCqYm. + +Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019b. + +Dan Hendrycks, Norman Mu, Ekin D. Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. Augmix: A simple data processing method to improve robustness and uncertainty. ArXiv, abs/1912.02781, 2020. + +Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q. Weinberger. Deep networks with stochastic depth. In ECCV, 2016. + +Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E Hopcroft, and Kilian Q Weinberger. Snapshot ensembles: Train 1, get m for free. arXiv preprint arXiv:1704.00109, 2017. + +Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Averaging weights leads to wider optima and better generalization. In Uncertainty in Artificial Intelligence, 2018. + +Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Neural Information Processing Systems, pages 1097–1105, 2012. + +Anders Krogh and Jesper Vedelsby. Neural network ensembles, cross validation, and active learning. In Advances in neural information processing systems, pages 231–238, 1995. + +Ananya Kumar, Percy Liang, and Tengyu Ma. Verified uncertainty calibration. ArXiv, abs/1909.10155, 2019. + +Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Neural Information Processing Systems, 2017. + +Puneet Mangla, Vedant Singh, Shreyas Jayant Havaldar, and Vineeth N. Balasubramanian. Varmixup: Exploiting the latent space for robust training and inference. ArXiv, abs/2003.06566, 2020. + +Mahdi Pakdaman Naeini, Gregory F. Cooper, and Milos Hauskrecht. Obtaining Well Calibrated Probabilities Using Bayesian Binning. In AAAI Conference on Artificial Intelligence, volume 2015, pages 2901–2907, January 2015. URL https://www.ncbi.nlm.nih.gov/pmc/ articles/PMC4410090/pdf/nihms679964.pdf. + +Jeremy Nixon, Mike Dusenberry, Linchuan Zhang, Ghassen Jerfel, and Dustin Tran. Measuring Calibration in Deep Learning. arXiv:1904.01685 [cs, stat], April 2019. URL http://arxiv. org/abs/1904.01685. + +Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, D Sculley, Sebastian Nowozin, Joshua V Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model’s uncertainty? Evaluating predictive uncertainty under dataset shift. In Neural Information Processing Systems, 2019. + +Tianyu Pang, Kun Xu, and Jun Zhu. Mixup inference: Better exploiting mixup to defend adversarial attacks. ArXiv, abs/1909.11515, 2020. + +Michael P. Perrone and Leon N. Cooper. When networks disagree: Ensemble methods for hybrid neural networks. 1992. +Yao Qin, Xuezhi Wang, Alex Beutel, and Ed Huai hsin Chi. Improving uncertainty estimates through the relationship with adversarial robustness. ArXiv, abs/2006.16375, 2020. +Rahul Rahaman and Alexandre H Thiery. Uncertainty quantification and deep ensembles. arXiv preprint arXiv:2007.08792, 2020. +Ryne Roady, T. Hayes, and Christopher Kanan. Improved robustness to open set inputs via tempered mixup. ArXiv, abs/2009.04659, 2020. +Alejandro Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. FitNets: Hints for thin deep nets. CoRR, abs/1412.6550, 2015. +David Ruppert. Efficient estimations from a slowly convergent Robbins-Monro process. Technical report, Cornell University Operations Research and Industrial Engineering, 1988. +Takuya Shimada, Shoichiro Yamaguchi, Kohei Hayashi, and Sosuke Kobayashi. Data interpolating prediction: Alternative interpretation of mixup. ArXiv, abs/1906.08412, 2019. +Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1):1929–1958, 2014. +Rupesh Kumar Srivastava, Klaus Greff, and Jürgen Schmidhuber. Highway networks. CoRR, abs/1505.00387, 2015. +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Neural Information Processing Systems, 2014. +Sunil Thulasidasan, Gopinath Chennupati, Jeff A Bilmes, Tanmoy Bhattacharya, and Sarah Michalak. On mixup training: Improved calibration and predictive uncertainty for deep neural networks. In Advances in Neural Information Processing Systems, pages 13888–13899, 2019a. +Sunil Thulasidasan, Gopinath Chennupati, Jeff A. Bilmes, Tanmoy Bhattacharya, and Sarah Ellen Michalak. On mixup training: Improved calibration and predictive uncertainty for deep neural networks. In NeurIPS, 2019b. +Mariya Toneva, Alessandro Sordoni, Remi Tachet des Combes, Adam Trischler, Yoshua Bengio, and Geoffrey J Gordon. An empirical study of example forgetting during deep neural network learning. arXiv preprint arXiv:1812.05159, 2018. +Juozas Vaicenavicius, D. Widmann, Carl R. Andersson, F. Lindsten, J. Roll, and Thomas Bo Schön. Evaluating model calibration in classification. In AISTATS, 2019. +Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David Lopez-Paz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In International Conference on Machine Learning, pages 6438–6447. PMLR, 2019. +Yeming Wen, Dustin Tran, and Jimmy Ba. BatchEnsemble: An alternative approach to efficient ensemble and lifelong learning. In International Conference on Learning Representations, 2020. +Florian Wenzel, Jasper Snoek, Dustin Tran, and Rodolphe Jenatton. Hyperparameter ensembles for robustness and uncertainty quantification. In Neural Information Processing Systems, 2020. +D. Widmann, F. Lindsten, and D. Zachariah. Calibration tests in multi-class classification: A unifying framework. ArXiv, abs/1910.11385, 2019. +Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE International Conference on Computer Vision, pages 6023–6032, 2019. +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. +Hongyi Zhang, Moustapha Cissé, Yann Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. ArXiv, abs/1710.09412, 2018. + +# A DATASET DETAILS + +CIFAR & CIFAR-C: We consider two CIFAR datasets, CIFAR-10 and CIFAR-100 (Krizhevsky, 2009). Each consists of a training set of size 50K and a test set of size 10K. They are natural images with $3 2 \mathrm { x } 3 2 $ pixels. Each class has 5,000 training images and 500 training images on CIFAR-10 and CIFAR-100 respectively. In our experiments, we follow the standard data pre-processing schemes including zero-padding with 4 pixels on each sise, random crop and horizon flip (Romero et al., 2015; Huang et al., 2016; Srivastava et al., 2015). If a training method requires validation dataset such as CAMixup, we use separate 2, 500 images from 50K training images as the validation set. + +It’s important to test whether models are well calibrated under distribution shift. CIFAR-10 corruption dataset (Hendrycks and Dietterich, 2019a) is designed to accomplish this. The dataset consists of 15 types of corruptions to the images. Each corruption types have 5 intensities. Thus, in total CIFAR-10C has 75 corrupted datasets. Notice that the corrupted dataset is used as a testset without training on it. Ovadia et al. (2019) benchmarked a number of methods on CIFAR-10 corruption. Similarly, we can apply the same corruptions to CIFAR-100 dataset to obtain CIFAR-100C. + +ImageNet & ImageNet-C: We used the ILSVRC 2012 classification dataset (Deng et al., 2009) which consists of a total of 1.2 million training images, 50,000 validation images and 150,000 testing images. Images span over 1,000 classes. We follow the data augmentation scheme in He et al. (2016), such as random crop and random flip, to preprocess the training images. During testing time, we apply a $2 2 4 \mathbf { x } 2 2 4$ center crop to images. Similarly to CIFAR-C, we apply 15 corruption types with 5 intensities each to obtain ImageNet-C (Hendrycks and Dietterich, 2019b). + +# B HYPERPARAMETERS IN SECTION 3 + +We kept the same set of hyperparameters as the BatchEnsemble model in Wen et al. (2020). All hyperparameters can be found in Table 3. The most sensitive hyperparameter we found is whether to use ensemble batch norm, which applies a separate batch norm layer for each ensemble member; and the value of random_sign_init, which controls the standard deviation of Gaussian distributed initialization of s and r. We kept BatchEnsemble CIFAR-10 the same as Wen et al. (2020), which does not deploy ensemble batch norm. We enable ensemble batch norm on CIFAR-100 and ImageNet. This allows us to use larger standard deviation in the initialization. The random_sign_init is $- 0 . 5$ on CIFAR-10 and $- 0 . 7 5$ on CIFAR-100 and -0.75 on ImageNet. In the code, we use negative value to denote the standard deviation of Gaussian distribution (positive value instead initializes with a Bernoulli distribution under that probability). In our case, we only use negative random_sign_init, which means we only consider Gaussian distributed initialization in this work. + +
DatasetCIFAR-10CIFAR-100
ensemble_size base_learning_rate per_core_batch_size num_cores lr_decay_ratio train_epochs4 0.1 64 8 0.1 250
lr_decay_epochs 120.0001[80,160,200] 0.0003
random_sign_init SyncEnsemble_BN0.5 False0.75 True
+ +Table 3: Hyperparameters we used in Section 3 regarding to BatchEnsemble. The difference between CIFAR-10 and CIFAR-100 is l2, random_sign_init and whether to use SyncEnsemble_BN. + +# C EXCESSIVE UNDER-CONFIDENCE ON SYNTHETIC DATA + +To further understand the confidence surface of Mixup $^ +$ Ensembles, we provided a visualization in Fig. 8. We trained on a synthetic dataset consisting of 5 clusters, each with a different radius. We ensemble over 4 independently trained copies of 3-layer MLPs. We plotted the softmax probabilities surface of Mixup-Single model, Deep-Ensemble and Mixup-Ensemble. The softmax probabilities represent the model confidence. Fig. 8c shows that Deep-Ensemble predictions are extremely confident except at the decision boundaries. Fig. 8b displays a lower confidence than Deep-Ensemble. This is beneficial in the single model context because single deep neural networks tend to be over-confident and Mixup can partially correct this bias. On the other hand, Fig. 8d shows that MixupEnsemble is only confident in a very constrained area around the training clusters, leading to an overall under-confident classifier which confirms our postulation of compounding under-confidence. + +![](images/4c21c18d93455688887e0ec4d911ad98c2664f072558ac9645d281177ed2c49b.jpg) +Figure 8: Softmax probabilities surface of different ensemble methods (ensemble size 4) in the input space after training on synthetic data. Deep ensemble is over-confident in the area around origin. Mixup-Ensemble leads to gloabl under-confidence. + +![](images/7e18c46478f8c1945a9cec0cdf368fafe4410460963629986a99b860c4edb73f.jpg) +Figure 9: Left: Reliability diagrams on CIFAR-100 with a WideResNet 28-10. Our proposed CAMixup successfully fixes the under-confidence of Mixup BatchEnsemble, leading to better calibration. (b) & (c): Red: Ensembles without Mixup; Blue: Ensembles with Mixup; Green: Our proposed CAMixup does not harm the out-of-distribution performance. + +# D MORE CALIBRATION RESULTS OF MIXUP-BATCHENSEMBLE + +In Section 3.1, we demonstrated that combining Mixup and ensembles leads to worse calibration on testset. In this appendix section, we complement the above conclusion with the analysis on corrupted datasets and with data-augmentation techniques like AugMix. + +# D.1 SUPPLEMENTARY RESULTS ON CAMIXUP + +In this section, we provided supplementary results on CAMixup. Fig. 2 shows that combining Mixup and BatchEnsemble leads to excessive under-confidence. In Fig. 9a, we showed that our proposed CAMixup fixes this issue by correcting the confidence bias. This explains why CAMixup achieves better calibration on in-distribution testset. As demonstrated in Section 4.2, Mixup improves model out-of-distribution performance because of its strong regularization effect. We showed that our proposed CAMixup inherits Mixup’s improvement on CIFAR-10-C. Fig. 9b and Fig. 9c show that this conclusion seamlessly transfers to CIFAR-100-C. We also supplement Fig. 5 with Table 4 and Table 5, illusrating detailed numbers. + +![](images/f76a87b2f9497b7fa10e32b6f5cab1e5870f1af219775b2ca07d30be42f73fc2.jpg) +Figure 10: Reliability diagrams on CIFAR-10 and CIFAR-100. Both plots show that AugMix does not lead to under-confidence when combined with ensembles. However, if we combine AugMix with Mixup (AugMixup), the compounding under-confidence issue still exists, leading to suboptimal calibration. Our proposed AugCAMixup corrects this underconfidence bias. +Table 5: CIFAR-100 results for Wide ResNet-28-10 BatchEnsemble (Wen et al., 2020) (BE), averaged over 5 seeds. This table is used to supplement Fig. 5. + +# D.2 SUPPLEMENTARY RESULTS ON AUGMIX + +We show that Mixup does not combine with ensembles without sacrificing in-distribution calibration in Section 3.1. As discussed in Section 2.3, AugMix only uses label-preserving transformations and does not modify the labels. Intuitively, it does not reduce model confidence. We support this intuition with Fig. 10. It shows that AugMix does not lead to under-confidence. Therefore it can be combined with ensembles without any calibration issue. + +In Table 2, we showed that combining AugMix and Mixup leads to worse calibration due to the under-confidence although AugMix itself does not. To better understand the insights beyond staring at scalars, we provided the reliability diagram analysis as well. In Figure 10, we showed that the underconfidence issue of AugMixup (Augmi $\mathbf { \boldsymbol { x } } + \mathbf { \boldsymbol { M } } \mathbf { \dot { \boldsymbol { i } } } \mathbf { \boldsymbol { x } }$ up) still exists. It suggests that applying CAMixup to Augmix can correct the under-confidence bias as what we showed in Fig. 10a and Fig. 10b. Our proposed CAMixup allows to compound performance of ensembles and data augmentation to achieve the best possible performance. + +
Method/MetricCIFAR-10
Ac(↑)ECE(↓)cA/cE
BatchEnsemble96.22 ±0.071.8 ±0.2 %77.5±0.3 /12.9 ±1.2 %
Mixup BE96.98±0.086.4 ±0.4 %80.0±0.4 /9.3±0.3 %
CAMixup BE96.94 ±0.101.2 ±0.2 %81.1±0.4 /9.7±0.35%
+ +Table 4: CIFAR-10 results for Wide ResNet-28-10 BatchEnsemble (Wen et al., 2020) (BE), averaged over 5 seeds. This table is used to supplement Fig. 5. + +
Method/MetricCIFAR-100
Acc(↑)ECE(↓)cA/cE
BatchEnsemble81.85±0.092.8±0.1%54.1±0.3/19.1±0.8%
Mixup BE83.12±0.089.7±0.5 %59.3±0.3/8.8±0.4%
CAMixup BE83.02±0.102.3±0.1%59.7±0.3/8.9±0.4%
+ +
DatasetCIFAR-10CIFAR-100
MetricAcc(↑)ECE(↓)cA/cEAcc(1)ECE(↓)cA/cE
Deep Ensembles96.660.78%76.80/9.8%82.72.1%54.1/13.8%
Mixup DE97.116.15%83.33/8.0%83.909.42%61.02/8.9%
CAMixup DE96.951.92%83.01/4.4%83.685.22%59.18/8.6%
AugMix DE97.390.59%89.50/3.3%84.155.13%68.21/6.7%
AugMixup DE97.562.71%90.03/4.3%84.856.86%69.31/7.6%
AugCAMixup DE97.481.89%89.94/4.7%84.645.29%69.19/5.9%
+ +Table 6: Mixup/AugMix/AugMixup/AugCAMixup on deep ensembles. We can conclude that Mixup worsens ensemble predictions in deep ensembles as well as in BatchEnsemble. This suggests we can use CAMixup on deep ensembles as well. However, the improvement is not as obvious as it is on BatchEnsemble, leading to the fact that AugMix is the most calibrated (in- and out-of-distribution) data augmentation strategy on deep ensembles. + +# E DEEP ENSEMBLES WITH MIXUP + +We showed that CAMixup improves Mixup BatchEnsemble calibration on testset without undermining its calibration under distribution shift in Section 4. In this section, we show that the improvement can also be observed on deep ensembles. In Fig. 11, we showed the under-confidence bias we observed on Mixup $^ +$ BatchEnsemble also exists on Mixup $^ +$ deep ensembles, with an even more obvious trend. Beyond commonly used ECE measure, we also explore other calibration measures. They further confirmed our under-confidence intuition. We provide some brief explanation on how to calculate ACE, SCE and TACE. + +ACE measure is the same as ECE except for the binning scheme. Rather than equally divide the confidence evenly into several bins, ACE choses an adaptive scheme which spaces the bin intervals so that each contains an equal number of predictions. SCE is the same as ECE except that it accounts for all classes into calibration measure rather than just looking at the class with maximum probability. The softmax predictions induce infinitesimal probabilities. These tiny predictions can wash out the calibration score. TACE is proposed to set a threshold to only include predictions with large predictive probability, to address the above issue. + +We present the results of Mixup, CAMixup, AugMix, AugMixup and AugCAMixup on deep ensembles in Table 6. We notice that the improvement of CAMixup on deep ensembles is smaller than its improvement on BatchEnsemble. We postulate that this is because Mixup $^ +$ deep ensembles is much badly calibrated than Mixup $^ +$ BatchEnsemble. For example, AugMixup $^ +$ deep ensembles achieve $2 . 7 1 \%$ and $6 . 8 6 \%$ ECE on CIFAR-10 and CIFAR-100. In the meanwhile, AugMixup $^ +$ BatchEnsemble achieve $1 . 7 1 \%$ and $4 . 1 9 \%$ . Thus, even if CAMixup can improve the calibration of Mixup $^ +$ deep ensembles, it still cannot beat AugMix $^ +$ deep ensembles. As a result, when we say we close the calibration gap between BatchEnsemble and deep ensembles, we are comparing AugCAMixup BatchEnsemble (BatchEnsemble $^ +$ CAMi $\mathrm { a p } + \mathrm { A u } \{ $ mix) to AugMix deep ensembles. This is because AugMix deep ensembles achieve the best calibration among all variants we tried. How to completely fix the under-confidence in deep ensembles is a natural extension of this work. Since we focus on bridging the calibration gap between BatchEnsemble and deep ensembles, we delegate the complete fix in deep ensembles to the future work. + +# F METRICS OTHER THAN ECE + +ECE is the standard metric in calibration, but it is a biased estimate of true calibration (Vaicenavicius et al., 2019). Heavily relying on ECE metric might lead to inconsistent conclusion. In this section, we computed the calibration error with recently proposed calibration estimator which reduces bias in ECE, including debiased calibration estimator (Kumar et al., 2019) (DCE) and SKCE (Widmann et al., 2019). fig. 12 shows that our conclusion in the main section are also supported by these two recently proposed calibration estimators. In particular, the improvement of proposed CAMixup over + +![](images/633278aee038c021af573c49fd7c50e614b66a15a002152dd564d8d1cf8c29d3.jpg) +Figure 11: WideResNet-28-10 Deep Ensembles with Mixup on CIFAR-10. We plotted the reliability diagram of ensemble and individual predictions. Besides ECE, we also plotted other calibration metrics such as ACE, SCE and TACE proposed in Nixon et al. (2019). All metrics verify the conclusion that Mixup $^ +$ Ensembles leads to under-confidence on testset. + +Table 7: Results for Wide ResNet-28-10 BatchEnsemble (Wen et al., 2020) and Deep Ensembles on CIFAR-10 and CIFAR-10-C, averaged over 3 seeds. This table is used to supplement Fig. 12 + +
Method/MetricBatchEnsembleDeep-Ensembles
Acc(↑)SKCE(↓)cA/cSKCEAcc(↑)SKCE(↓)cA/cSKCE
Vanilla96.223.4e-477.5/0.02696.663.4e-554.1/0.018
Mixup96.984e-380.0/0.02497.114.4e-359.3/0.0068
CAMixup96.941.3e-481.1/0.01996.954.3e-459.7/0.0032
+ +![](images/c71a903195907a190dcd87a2fc60471bf147b76fe445b996b9cecd42435a586f.jpg) +Mixup on testset is even larger than what ECE reflects in Fig. 5. Table 7 demonstrates the specific numbers used in Fig. 12. +Figure 12: WideResNet 28-10 on CIFAR-10 and CIFAR-10-C, averaged over 3 random seeds. SKCE: Squared kernel calibration error computed in Widmann et al. (2019). DCE: Debiased calibration error in Kumar et al. (2019). Red: Ensembles without Mixup; Blue: Ensembles with Mixup; Green: Ensembles with CAMixup (ours). Both SKCE and DCE give consistent rankings on calibration error to the ranking in Fig. 5 and Fig. 6. This plot shows that our proposed CAMixup is effective in reducing Mixup calibration error when combined with ensembles. + +# G CAMIXUP WITH TEMPERATURE SCALING + +See Fig. 13. + +# H LIMITATIONS AND FUTURE WORK + +We describe limitations of our work, signalling areas for future research. One limitation of CAMixup is that all examples in the same class still share the same Mixup coefficient. This leaves room for developing more fine-grained adaptive Mixup mechanisms, such as adapting the Mixup coefficient per example. This relates to an open research question: how do you measure the training difficulty of a data point given a deep network? (Toneva et al., 2018; Agarwal and Hooker, 2020) Another limitation is we showed that CAMixup still cannot fully fix the miscalibration of Mixup $^ +$ deep ensembles in Appendix E, due to the fact that Mixup $^ +$ deep ensembles leads to even worse calibration than Mixup $^ +$ BatchEnsemble. This raises a harder question which CAMixup cannot completely solve but also leaves more research room to further understand why Mixup is worse on deep ensembles and how to address it. Thus, we leave the question on how to address the above issues to future work. Next, we determine whether to use Mixup based on the reliability (Mean Accuracy - Mean Confidence) of each class on validation set. One concern is that CAMixup does not scale well to a large number of classes. Fortunately, we showed that this works on problems up to 1000 classes (ImageNet). Additionally, Mixup has been most successful in the vision domain, hence our focus; and with preliminary success on tabular data and natural language processing (Zhang et al., 2018; Guo et al., 2019). Assessing whether CAMixup and ensembling techniques translate to text is an interesting area. + +We took a first step in developing a more fine-grained adaptive Mixup mechanism. Recall that class based CAMixup calculates the reliability (Accuracy - Confidence) at the end of each epoch, then it decided whether to apply Mixup in each class (illustrated in Fig. 4). This requires extra computation on validation dataset and it assigns uniform Mixup coefficient within one class. By leveraging recently developed forgetting count (Toneva et al., 2018), we can adjust Mixup coefficient for each example based on its forgetting counts. The intuition is if an examples is associated with high forgetting counts, it indicates the model tends to forget this example. To achieve better calibration, we should place low confidence on this example. The algorithm of forgetting counts based CAMixup is presented in Algorithm 1. In summary, we first calculate the forgetting counts for each training example and obtain the median of these counts as the threshold. Then, CAMixup applies Mixup to the training example whose forgetting counts are higher than the median. + +We provided a preliminary results on CIFAR-10 in Fig. 14. It demonstrates that forgetting counts based CAMixup outperforms class based CAMixup on most metrics across BatchEnsemble and MC-dropout. One exception is that it underperforms on test calibration on MC-dropout. We could not observe the same improvement on CIFAR-100. We postulate that the reliability of forgetting count on CIFAR-100 is not as good as it is on CIFAR-10, leading to the inconsistent results. We leave the question on how to improve orgeting count based CAMixup on CIFAR-100 into future work. + +
Algorithm CAMixup1Forgetting Count Based
initialize prevacci = O,i ∈ D initialize forgettingT[i]=O,i∈D initialize MixupCoeffli] = 0 while training do ApplyMixup MixupCoeff for example; ∈ B do compute acci end if end for rank = sort(T) threshold = rank[|D|//2] for example; ∈ B do else end if end forB ~ D # sample a minibatch onB based if prevacci > acci then T[i]=T[]+1 prevacci = acCi gradient update classifier on B if T[i] >threshold then MixupCoeff[i] = a MixupCoeff[𝑖] = 0
+ +![](images/48c4cc653f2fc176ffdc1bad559dbfb22e200b2cf241629db49fa1548ac8506b.jpg) +Figure 13: Combining CAMixup and Temperature Scaling further improves test ECE. It does not make further improvements on out-of-distribution calibration however. + +![](images/daf9fd143d0db37bed1038611e668ed8c4f6db601d7971c2dd568811b63bea74.jpg) +Figure 14: WideResNet 28-10 on CIFAR-10 and CIFAR-10-C. Green: Class based CAMixup. Purple: Forgetting count based CAMixup. Forgetting count based CAMixup outperforms class based Mixup in most metrics across BatchEnsemble and MC-dropout. \ No newline at end of file diff --git a/md/train/hMY6nm9lld/hMY6nm9lld.md b/md/train/hMY6nm9lld/hMY6nm9lld.md new file mode 100644 index 0000000000000000000000000000000000000000..7ca82ec10a8f3445ec4a3c110c38d3866ffcc719 --- /dev/null +++ b/md/train/hMY6nm9lld/hMY6nm9lld.md @@ -0,0 +1,290 @@ +# Predicting Molecular Conformation via Dynamic Graph Score Matching + +Shitong Luo\*1, Chence $\mathbf { S h i ^ { * 2 , 3 } }$ , Minkai $\mathbf { X } \mathbf { u } ^ { 2 , 3 }$ , Jian Tang2,4,5 1Peking University 2Mila - Québec AI Institute 3Université de Montréal $^ { 4 } \mathrm { H E C }$ Montréal 5CIFAR AI Research Chair luost@pku.edu.cn , chence.shi@umontreal.ca minkai.xu@umontreal.ca , jian.tang@hec.ca + +# Abstract + +Predicting stable 3D conformations from 2D molecular graphs has been a longstanding challenge in computational chemistry. Recently, machine learning approaches have demonstrated very promising results compared to traditional experimental and physics-based simulation methods. These approaches mainly focus on modeling the local interactions between neighboring atoms on the molecular graphs and overlook the long-range interactions between non-bonded atoms. However, these non-bonded atoms may be proximal to each other in 3D space, and modeling their interactions is of crucial importance to accurately determine molecular conformations, especially for large molecules and multi-molecular complexes. In this paper, we propose a new approach called Dynamic Graph Score Matching (DGSM) for molecular conformation prediction, which models both the local and long-range interactions by dynamically constructing graph structures between atoms according to their spatial proximity during both training and inference. Specifically, the DGSM directly estimates the gradient fields of the logarithm density of atomic coordinates according to the dynamically constructed graphs using score matching methods. The whole framework can be efficiently trained in an end-to-end fashion. Experiments across multiple tasks show that the DGSM outperforms state-of-theart baselines by a large margin, and it is capable of generating conformations for a broader range of systems such as proteins and multi-molecular complexes. + +# 1 Introduction + +Graph-based representations of molecules has become prevalent in a variety of tasks such as property prediction [13, 31] and molecule generation [17, 33, 45]. However, a more natural and intrinsic representation of a molecule is its 3D geometry or conformation, which represents a molecule as a set of 3D coordinates. The 3D representation of molecules is central to many tasks, such as molecular properties prediction and virtual screening. Nevertheless, determining the conformation of a molecule remains a challenging task — both computational approaches, e.g., molecular dynamics (MD) [9], and experimental approaches, e.g., crystallography, are expensive and time-consuming. + +Recently, machine learning approaches have demonstrated promising performance for molecular conformation generation. Pioneering methods such as GRAPHDG [36] and CGCF [43] first predict interatomic distances between bonded atoms and then solve 3D coordinates from the predicted distances via a post-processing algorithm. Very recently, Shi et al. proposed the CONFGF [34], which employs the score matching technique [38] to learn pseudo-forces between bonded atoms and iteratively applies the forces to a randomly initialized 3D structure until convergence. CONFGF gets rid of the two-stage fashion in prior works and significantly improves the performance. Nevertheless, these approaches have a common major limitation — they mainly focus on modeling the local interactions between bonded atoms defined by the input molecular graphs but fail to capture long-range interactions between non-bonded atoms1, as they only model distances (or gradients) between bonded atoms. While in molecular mechanics, the potential energy of a molecule that alters conformations can be modeled as a sum of four parts [22]: + +![](images/40aa5ba4168cefb1ae91527e2aef598f8197774fa9204092719b254b4b1a32df.jpg) +Figure 1: Three molecular systems where long-range interactions are crucial for their conformations. + +$$ +E = E _ { \mathrm { b o n d } } + E _ { \mathrm { a n g l e } } + E _ { \mathrm { t o r s i o n } } + E _ { \mathrm { n o n - b o n d e d } } , +$$ + +where $E _ { \mathrm { b o n d } }$ , $E _ { \mathrm { a n g l e } }$ , and $E _ { \mathrm { t o r s i o n } }$ model local interactions between bonded atoms, which are modeled in previous methods [34, 36, 43]. Long-range interactions between non-bonded atoms, denoted as $E _ { \mathrm { n o n - b o n d e d } }$ , are also non-trivial, which shape the molecular geometry via non-negligible electrostatic forces or van der Waals forces, etc. For multi-molecular complexes, non-bonded interactions dominate complexes’ geometry. An ideal solution to conformation generation should therefore capture both the local and long-range interactions. In Figure 1, we present three typical molecular systems where long-range interactions play a key role in determining their conformations. + +To tackle the aforementioned challenge of modeling long-range interactions, in this paper, we propose the Dynamic Graph Score Matching (DGSM) for molecular conformation generation, following the principle of CONFGF [34] that learns the gradients of the logarithm density of atomic coordinates. Instead of relying on the static input molecular graph as existing work, the basic idea is to dynamically construct graph structures between atoms based on their spatial proximity during both training and inference. This allows the model to (1) dynamically learn molecular graph representations with evolved graph structures that take long-range interactions into consideration, and (2) dynamically determine a set of interatomic distances that contribute to gradients of the current atomic coordinates. Specifically, the edges in the dynamic graph consist of two parts. The first part of edges are determined by covalent bonds, which capture local interactions between atoms $\mathrm { E _ { b o n d } }$ , $E _ { \mathrm { a n g l e } }$ and $E _ { \mathrm { t o r s i o n } } \mathrm { , }$ ). The second part of edges are determined dynamically by spatial proximity between atoms at each training or sampling step, i.e., two atoms are connected as long as they are proximal, no matter whether they are bonded. Such a strategy is able to effectively capture non-local interactions $( E _ { \mathrm { n o n - b o n d e d } } )$ since the magnitude of long-range interactions is inversely correlated with distances between atoms [30]. It remains meanwhile scalable as we avoid connecting all the atom-pairs, which has quadratic complexity. In addition, modeling non-bonded interactions enable the model to sample conformations for multi-molecular complexes, which represent a broader range of problems. + +We conduct extensive experiments and compare DGSM against previous state-of-the-art methods on both standard conformation generation and property prediction tasks. Numerical results show that DGSM outperforms previous methods by a clear margin, confirming the benefit of modeling long-range interactions. Besides, to further demonstrate the advantage of DGSM, we bring attention to two more challenging tasks — protein sidechain conformation prediction and multi-molecular complex structure prediction. These two new tasks represent two classes of practical challenges: predicting structures for macro-molecules and multi-molecular complexes. + +# 2 Related Work + +Prior works on conformation generation mainly rely on molecular dynamics (MD) [9], where new conformations are sequentially generated based on an initial conformation and a physical model for interatomic potentials [25, 27]. Although capable of accurately sampling equilibrium conformations, these methods are computationally intensive, especially for large molecular systems [2, 35], e.g., proteins. Another category of approaches leverage distance geometry [8] and fix distances between atoms to idealized values heuristically [4], which are much faster but less accurate. + +Recently, a variety of deep generative models have been proposed for molecular conformation generation, which strike a good balance between computational efficiency and accuracy. Among these methods, Mansimov et al. [24] first propose a variational autoencoder to directly generate 3D atomic coordinates. Albeit simple, this method fails to model the roto-translation equivariance of molecular conformations, leading to unsatisfactory performance. To preserve roto-translation equivariance, Simm and Hernandez-Lobato [36] and Xu et al. [43] first model the molecular distance geometry and then reconstruct atomic coordinates from generated distances by solving an optimization problem. The state-of-the-art method CONFGF [34] estimates pseudo-forces acting on atoms and generates conformations via Langevin MCMC [42], which bypasses the two-stage fashion in previous works and enhances the performance significantly. Two concurrent works [12, 44] exist which generate conformations in end-to-end fashion via geometry elements assembly and bilevel programming respectively. Recently there has also been attempt to use reinforcement learning for conformation search [14]. Such a method is incapable of modeling bond lengths explicitly, and is fundamentally different from other approaches. To summarize, all of the previous methods focus mainly on modeling the local interactions based on the static input molecular graphs (or augmented graphs by adding auxiliary edges between atoms that are two- and three-hops away) and overlook the long-range non-bonded interactions between atoms. In contrast, our DGSM explicitly models both the local and long-range interactions via dynamic graph score matching and effectively addresses the above issue. + +# 3 Preliminaries + +# 3.1 Notations and Problem Formulation + +Notations. Let $\mathcal { G } = \langle \nu , \mathcal { E } \rangle$ be a molecular graph, where $\mathcal { V } = \{ v _ { 1 } , v _ { 2 } , \cdot \cdot \cdot , v _ { | \mathcal { V } | } \}$ is the set of nodes representing atoms, and $\mathcal { E } = \{ e _ { i j } \ | \ ( i , j ) \subseteq \mathcal { V } \times \mathcal { V } \}$ is the set of edges representing inter-atomic bonds in the molecule. Each node $v _ { i } \in \mathcal V$ is labeled with atomic attributes, e.g., the element type $Z _ { i }$ and the atomic coordinate $\boldsymbol { r } _ { i } \in \mathbb { R } ^ { 3 }$ . Each edge $e _ { i j } \in \mathcal { E }$ is labeled with a bond type. The conformation of the molecular graph $\mathcal { G }$ can be represented as a matrix $\pmb { R } \in \mathbb { R } ^ { | \nu | \times 3 }$ . The distances between all pairs of atoms can be represented as a matrix $D \in \mathbb { R } ^ { | \mathcal { V } | \times | \mathcal { V } | }$ , where $D _ { i j } : = d _ { i j } = \| \pmb { r } _ { i } - \pmb { r } _ { j } \| _ { 2 }$ denotes the Euclidean distance between the positions of $v _ { i }$ and $v _ { j }$ . Following previous work [34, 36, 43], we expand the original molecular graph by adding auxiliary edges between atoms that are second and third neighbors in $\mathcal { G }$ to reduce the degrees of freedom in 3D coordinates. + +Problem Formulation. Given a molecular graph $\mathcal { G } = \langle \nu , \mathcal { E } \rangle$ , the task of molecular conformation generation is the conditional generation of conformations $\pmb { R } = [ \pmb { r } _ { 1 } ; \pmb { r } _ { 2 } , \pmb { \cdot } \cdot \pmb { \cdot } ; \pmb { r } _ { | \pmb { \nu } | } ] \in \mathbb { R } ^ { | \mathcal { V } | \times 3 }$ based on $\mathcal { G }$ , while being able to capture long-range interactions between non-bonded atoms. Note that $\mathcal { G }$ may has multiple connected components, e.g., protein-ligand complexes and multi-molecular complexes. + +# 3.2 Score-Based Generative Modeling + +Score-based generative modeling [15, 38–40] is a class of generative models that has recently proven effective in a variety of tasks, ranging from image generation [15, 40], audio synthesis [7, 21] to shape generation [6, 23]. For any continuously differentiable probability density $p ( { \pmb x } )$ , we define its score function $\pmb { s } ( \pmb { x } )$ as $\nabla _ { \pmb { x } } \log p ( \pmb { x } )$ , i.e., the direction where the logarithm data density grows most rapidly. Score-based generative modeling perturbs the data with different levels of Gaussian noise and jointly estimates the score function of $\bar { p } ( { \pmb x } )$ using neural networks. Samples are then generated by sampling from a sequence of decreasing noise levels with Langevin dynamics [42]. + +Formally, given a data distribution $p _ { \mathrm { d a t a } } ( \pmb { x } )$ , let $\{ \sigma _ { i } \} _ { i = 1 } ^ { L }$ be a sequence of noise levels that satisfies $\sigma _ { 1 } > \sigma _ { 2 } > \cdots > \sigma _ { L }$ and $\sigma _ { i } / \sigma _ { i - 1 } = \gamma$ . Consider a series of noise distributions $p _ { \sigma _ { i } } ( \tilde { \pmb { x } } \mid \pmb { x } ) : =$ $\mathcal { N } ( \tilde { \pmb { x } } ; \pmb { x } , \sigma _ { i } ^ { 2 } \pmb { I } )$ , and denote the corresponding perturbed data distribution as $\begin{array} { r } { p _ { \sigma _ { i } } ( \tilde { \pmb x } ) : = \int p _ { \sigma _ { i } } ( \tilde { \pmb x } \ | } \end{array}$ ${ \pmb x } ) p _ { \mathrm { d a t a } } ( { \pmb x } ) d { \pmb x }$ . Song and Ermon [38] propose to jointly approximate the score function of each noise level, denoted by ${ \bf s } _ { \pmb { \theta } } ( { \pmb x } , \sigma _ { i } )$ , with the following objective: + +$$ +\theta ^ { * } = \mathrm { a r g m i n } _ { \theta } \frac { 1 } { 2 L } \sum _ { i = 1 } ^ { L } \sigma _ { i } ^ { 2 } \mathbb { E } _ { p _ { \mathrm { d u a } } ( { \boldsymbol { x } } ) } \mathbb { E } _ { p _ { \sigma _ { i } } ( \tilde { { \boldsymbol { x } } } \mid { \boldsymbol { x } } ) } \left[ \left\| s _ { \theta } ( \tilde { { \boldsymbol { x } } } , \sigma _ { i } ) - \nabla _ { \tilde { { \boldsymbol { x } } } } \log p _ { \sigma _ { i } } ( \tilde { { \boldsymbol { x } } } \mid { \boldsymbol { x } } ) \right\| _ { 2 } ^ { 2 } \right] . +$$ + +![](images/a2c868ea8f3d1ee4db3f6d348db861fe287b6d0734ba6d8acc40b64a6e26774e.jpg) +Figure 2: The training procedure of the proposed DGSM. To model long-range interactions, the graph structures are dynamically determined by adding non-bonded edges based on added perturbations at each step. The bonded edges are marked by black border. + +Assuming sufficient data and model capacity, the optimal noise conditional score network ${ \pmb s } _ { \pmb \theta ^ { * } } \left( { \pmb x } , \sigma _ { i } \right)$ matches $\bar { \nabla } _ { \pmb { x } } \log p _ { \sigma _ { i } } ( \pmb { x } )$ almost everywhere [38]. After training score networks, Song and Ermon [38] run annealed Langevin dynamics for each $p _ { \sigma _ { i } } ( { \pmb x } )$ sequentially, where samples from each noise level serve as initializations for Langevin dynamics of the next noise level. Given $\sigma _ { L }$ small enough, the final samples from $p _ { \sigma _ { L } } ( \pmb { x } )$ approximate to samples from $p _ { \mathrm { d a t a } }$ under minor conditions. + +# 4 Model + +Our approach treats the conformation generation as sequentially moving atoms towards high-density regions guided by pseudo-forces, i.e., gradients of atoms. Following Shi et al. [34], we leverage the denoising score matching [38, 41] to approximate the gradients of the logarithm density of atomic coordinates, denoted as $\nabla _ { R } \log p ( R \mid \mathcal { G } )$ . To model atomic gradients that are sensitive to both the local and long-range interactions (Eq. 1) and inspired by the fact that long-range interactions decrease rapidly as distances increase, we propose to dynamically construct graph structures with non-bonded edges between atom pairs within a distance based on the current spatial proximity. In this way, we enable the model to effectively capture long-range non-bonded interactions while avoid connecting all atoms, which is computationally expensive. To ensure that the distribution of graph structures during training matches with that during generation, we devise a dynamic graph score matching algorithm, where graph structures are also dynamically determined during training depending on added perturbations. The whole framework is illustrated in Figure 2 and Figure 3. Below we describe the framework of score estimation for Cartesian coordinates in Section 4.1, the dynamic graph score matching algorithm in Section 4.2, and the generation procedure in Section 4.3. + +# 4.1 Score Estimation for Cartesian Coordinates + +Our goal is to learn the gradients of the logarithm density (score) of atomic coordinates, i.e., $\nabla _ { R } \log p ( R \mid \mathcal { G } )$ . Directly parameterizing score networks on absolute Cartesian coordinates with Graph Neural Networks (GNNs) [11, 13, 19, 29] relies on the arbitrary choice of rotation and translation [36, 43], which are non-essential degrees of freedom for effecting conformational changes in molecular systems. Therefore, we explicitly exclude them from the model, by first estimating scores for a set of dynamically determined interatomic distances, and then backpropagating gradients from distances to Cartesian coordinates via differentiation. + +Given a molecular graph $\mathcal { G } = \langle \nu , \mathcal { E } \rangle$ , the probability $p ( R \mid { \mathcal { G } } )$ of a conformation $\pmb { R }$ is subject to the Boltzmann distribution and is proportional to $\exp \left( - E ( R ) / k _ { B } T \right)$ , where $E ( R )$ is the conformational energy, $k _ { B }$ is the Boltzmann constant, and $T$ is the temperature. We assume the logarithm density of a conformation, i.e., the negative conformational energy up to a constant, can be parameterized as a function of interatomic distances, conditional on molecular graph $\mathcal { G }$ : + +$$ +\log p _ { \theta } ( R \mid \mathcal { G } ) : = f _ { \mathcal { G } } ( e _ { 1 } ( R ) , e _ { 2 } ( R ) , \cdot \cdot \cdot , e _ { K } ( R ) ) , +$$ + +where $\{ e _ { k } : \mathbb { R } ^ { | \mathcal { V } | \times 3 } \mathbb { R } \} _ { k = 1 } ^ { K }$ is a set of functions that calculate $K$ interatomic distances, which are invariant under the rotation and translation of $\pmb { R }$ . And $f _ { \mathcal { G } } : \mathbb { R } ^ { K } \mathbb { R }$ is a graph neural network that predicts the negative conformational energy based on distances and the 2D graph representation $\mathcal { G }$ . Using interatomic distances for energy prediction is favored in existing literature [16, 20, 31, 34], as it preserves the 3D rotation and translation symmetries of molecular systems. Since $\{ e _ { k } ( { \pmb R } ) \} _ { k = 1 } ^ { K }$ are continuously differentiable with respect to the Cartesian coordinates $\pmb { R }$ , the gradients of logarithm density of interest, i.e., $\nabla _ { R } \log p _ { \theta } ( R | \mathcal { G } )$ , is interrelated with the logarithm density of each interatomic distance via chain rule: + +$$ +\begin{array} { l } { \displaystyle \forall i , s _ { \theta } ( { \pmb R } ) _ { i } : = \frac { \partial f _ { \mathcal { G } } \left( e _ { 1 } ( { \pmb R } ) , e _ { 2 } ( { \pmb R } ) , \cdots , e _ { K } ( { \pmb R } ) \right) } { \partial r _ { i } } } \\ { \displaystyle = \sum _ { k = 1 } ^ { K } \frac { \partial f _ { \mathcal { G } } \left( e _ { 1 } ( { \pmb R } ) , e _ { 2 } ( { \pmb R } ) , \cdots , e _ { K } ( { \pmb R } ) \right) } { \partial e _ { k } ( { \pmb R } ) } \cdot \frac { \partial e _ { k } ( { \pmb R } ) } { \partial r _ { i } } } \\ { \displaystyle = \sum _ { k = 1 } ^ { K } s _ { \theta } ( e _ { k } ( { \pmb R } ) ) \cdot \frac { \partial e _ { k } ( { \pmb R } ) } { \partial r _ { i } } , } \end{array} +$$ + +where ${ \displaystyle s _ { \theta } ( \mathbf { R } ) _ { i } }$ denotes $\nabla _ { r _ { i } } \log p _ { \theta } ( R \mid \mathcal { G } )$ , $\scriptstyle s _ { \theta } ( e _ { k } ( R ) )$ denotes $\nabla _ { e _ { k } ( R ) } \log p _ { \pmb \theta } ( \pmb R \mid \mathcal { G } )$ , and $\frac { \partial e _ { k } ( \pmb { R } ) } { \partial \pmb { r } _ { i } }$ can be calculated efficiently in closed form (see supplementary material for the full derivation). + +Motivated by the above equation, we first train a noise conditional score network to jointly predict the score of interatomic distances, i.e., $\{ s _ { \theta } ( e _ { k } ( { \pmb R } ) , \sigma ) \} _ { k = 1 } ^ { K }$ . After training the noise conditional score network, the gradients of the logarithm density of atomic coordinates, i.e., $s _ { \theta } ( R , \sigma )$ , can be estimated via Eq. 4. We have the following proposition (proof in supplementary material): + +Proposition 1 (Roto-Translation Equivariance). With the assumption that we can parameterize $\log p _ { \pmb \theta } ( \pmb R | \mathcal G )$ as a function of interatomic distances, conditional on molecular graph $\mathcal { G }$ (Eq. 3), the score function $s _ { \theta } ( R )$ defined in Eq. 4 is roto-translation equivariant. + +Remarkably, the choice of $\{ e _ { k } ( { \pmb R } ) \} _ { k = 1 } ^ { K }$ is flexible under this framework and can be carefully designed for specific goals. An ideal set of interatomic distances should capture both the local and long-range interactions between atoms (Eq. 1). + +Proposition 2 (Connection with CONFGF). The recent proposed CONFGF [34] is a special case of our approach, where they only model local distances between the first-order, the second-order, and the third-order neighbors, i.e., $\{ e _ { k } \} _ { k = 1 } ^ { K }$ map the conformation to a set of distances between bonded atoms. Therefore, CONFGF fails to capture long-range interactions between non-bonded atoms. + +# 4.2 Dynamic Graph Score Matching with Noise Conditional Score Networks + +In this section, we describe the proposed dynamic graph score matching for interatomic distances, with the goal of modeling both the local and long-range interactions. To ensure that the learned score functions cover all regions with different graph structures, we dynamically construct graph structures with non-bonded edges between atoms during training, based on added perturbations. Following Song and Ermon [38], we train a noise conditional score network to jointly estimate scores for perturbed distributions of a set of dynamically-determined interatomic distances, i.e., $\{ s _ { \pmb \theta } ( e _ { k } ( \pmb R ) , \sigma ) \} _ { k = 1 } ^ { K }$ , and parameterize the score network with the message passing neural network (MPNN) [13]. + +Dynamic Score Matching. To capture long-range interactions between non-bonded atoms in a molecular system, a naive way is to treat the molecular graph as a fully-connected graph and model the gradients of logarithm density of distances between all pairs of atoms. However, such a practice is computationally expensive especially for large systems, e.g., proteins, and is sometimes unnecessary, e.g., van der Waals interactions decay rapidly as distances increase. As a remedy, we set a cutoff distance and assume each atom only interacts with all atoms within the cutoff distance, ignoring all interactions out of the considered sphere. This is a very popular strategy in computational chemistry that strikes a good balance between efficiency and accuracy [26, 31]. + +Formally, consider a molecular graph $\mathcal { G } = \langle \nu , \mathcal { E } \rangle$ with distances between all pairs of atoms $\pmb { D } \in \mathbb { \Sigma }$ $\mathbb { R } ^ { | \nu | \times | \nu | }$ computed from its conformation $\pmb { R } \in \mathbb { R } ^ { | \nu | \times 3 }$ . For a given noise level $\sigma$ , we perturb the distances $_ { D }$ with Gaussian noise at each training step on the fly, and then augment the original graph structure with non-bonded edges between atom pairs within a certain threshold distance: + +$$ +\forall ( i , j ) , \tilde { D } _ { i j } \sim \mathcal { N } ( D _ { i j } , \sigma ^ { 2 } ) , \quad \mathcal { E } _ { \sigma } = \mathcal { E } \cup \{ e _ { i j } \mid \tilde { D } _ { i j } < \delta \} , +$$ + +$$ +\begin{array} { r } { l _ { \sigma } = \{ D _ { i j } \mid e _ { i j } \in \mathcal { E } _ { \sigma } \} , \quad \tilde { d } _ { \sigma } = \{ \tilde { D } _ { i j } \mid e _ { i j } \in \mathcal { E } _ { \sigma } \} , } \end{array} +$$ + +where $\mathcal { E } _ { \sigma }$ is the constructed graph structure for noise level $\sigma$ , and $\delta$ is a hyper-parameter that controls the radius of long-range interactions. We empirically verify that a $1 0 \mathring \mathrm { A }$ cutoff is sufficient for systems we are studying, which is consistent with some experimental results in molecular dynamics [26]. $\scriptstyle d _ { \sigma }$ and $\tilde { d } _ { \sigma }$ denote the original and perturbed interatomic distances in augmented graph structure respectively. Hereafter, we omit the subscript for simplicity and use ${ \mathcal { E } } , d .$ , and $\tilde { d }$ instead, assuming all graphs are dynamically constructed during training and sampling. + +![](images/8f7d52f8c18d23459383561fc7802e024313762b231abd98f24b733b159cb4f9.jpg) +Figure 3: The generation procedure of the proposed DGSM via Langevin dynamics. The graph structure is dynamically constructed at each step of stochastic update based on the current conformation. + +With the above strategy, the graph structure of a specific molecular graph $\mathcal { G }$ is variadic depending on added perturbation, and all graph structures are possible as long as we sample sufficient enough noise. This will result in (1) a dynamically-determined graph structure for message passing and representation learning, which takes long-range interactions into consideration, and (2) a dynamicallydetermined set of interatomic distances, i.e., $\mathbf { \bar { \{ } } e _ { k } ( { \pmb R } ) \} _ { k = 1 } ^ { K }$ , for score estimation, which contributes to gradients of atomic coordinates according to Eq. 4. Note that the vanilla implementation of Eq. 5 requires computing all distances between atom pairs. In practice, to avoid quadratic complexity, we pre-filter distant neighbors before adding perturbations for each atom by constructing radius graph with $2 \delta$ threshold, and empirically verify that it performs efficiently and effectively. + +Parameterizing with MPNNs. Let $\{ \sigma _ { i } \} _ { i = 1 } ^ { L }$ be a sequence of noise levels. Our goal is to learn a noise conditional score network to jointly estimate the scores of all perturbed distance distributions, i.e., $\forall \sigma \in \{ \sigma _ { i } \} _ { i = 1 } ^ { L } : s _ { \theta } ( \tilde { d } , \sigma ) \approx \mathring { \nabla _ { \tilde { d } } } \overrightarrow { \log p _ { \sigma } } ( \tilde { d } \mid \mathcal { G } ) .$ , where $\begin{array} { r } { p _ { \sigma } ( \tilde { d } \mid \tilde { \mathcal { G } } ) = \int p ( d \mid G ) \mathcal { N } ( \tilde { d } \mid d , \sigma ^ { 2 } I ) } \end{array}$ Following suggestions of Song and Ermon [38], we parameterize the score network with a MPNN as follows (see supplementary material for the full architecture): + +$$ +\begin{array} { r l } & { \quad h _ { i } ^ { \mathrm { n o d e } } = \mathrm { M P N N } ( \mathcal { G } , \mathcal { E } , \tilde { D } ) _ { i } , \quad \forall v _ { i } \in \mathcal { V } } \\ & { \quad h _ { i j } ^ { \mathrm { e d g e } } = \mathrm { C o n c a t } ( h _ { i } ^ { \mathrm { n o d e } } , h _ { j } ^ { \mathrm { n o d e } } ) , \quad \forall e _ { i j } \in \mathcal { E } _ { \sigma } } \\ & { s _ { \theta } ( \tilde { d } , \sigma ) _ { i j } = s _ { \theta } ( \tilde { d } ) _ { i j } / \sigma = \mathrm { M L P } ( h _ { i j } ^ { \mathrm { e d g e } } ) / \sigma , \quad \forall e _ { i j } \in \mathcal { E } _ { \sigma } } \end{array} +$$ + +molec where {hnodei }|V|i=1 are node embeddings compute and the perturbed distances, $\{ h _ { i j } ^ { \mathrm { e d g e } } \}$ MPNN based on the dynamically consare embeddings for each edge in $\mathcal { E }$ ucted, and $s _ { \theta } ( \tilde { d } , \sigma ) _ { i j }$ is the predicted score for interatomic distance $\tilde { D } _ { i j }$ $( e _ { i j } \in \mathcal { E }$ ). The noise conditional network can be jointly optimized with the following objective [38]: + +$$ +\theta ^ { * } = \operatorname * { a r g m i n } _ { \theta } \frac { 1 } { 2 L } \sum _ { i = 1 } ^ { L } \sigma _ { i } ^ { 2 } \mathbb { E } _ { p ( d | \mathcal { G } ) } \mathbb { E } _ { p _ { \sigma _ { i } } ( \tilde { d } | d , \mathcal { G } ) } \Big [ \Big \lVert \frac { s _ { \theta } ( \tilde { d } ) } { \sigma _ { i } } + \frac { \tilde { d } - d } { \sigma _ { i } ^ { 2 } } \Big \rVert _ { 2 } ^ { 2 } \Big ] , +$$ + +where all expectations can be efficiently estimated using empirical averages. + +# 4.3 Generation + +After training the noise conditional score network, molecular conformations can be generated via annealed Langevin dynamics [38], guided by the gradients of atomic coordinates. The gradients can be computed via Eq. 4 based on dynamically constructed graph structures at each step of stochastic update, which allows model to effectively capture both the local and long-range interactions that contribute to the atomic gradients. Formally, given a molecular graph $\mathcal { G }$ , we first sample an initial conformation $\scriptstyle { R _ { 0 } }$ from a fixed prior distribution. We here take the prior distribution as a standard + +Gaussian $\mathcal { N } ( R _ { 0 } \mid \mathbf { 0 } , I )$ . Then, we update the conformation by running $T$ steps of Langevin dynamic to get a sample from each noise conditional score network ${ \bf \delta } _ { s _ { \theta } ( { \cal R } , \sigma _ { i } ) }$ sequentially with a special step size schedule $\alpha _ { i } = \varepsilon \cdot \sigma _ { i } ^ { 2 } / \sigma _ { L } ^ { 2 }$ . Samples from each noise level are used to initialize Langevin dynamics for the next noise level. At each sampling step $t$ , we first construct graph structures with non-bonded edges within a given distance $\delta$ based on the current pairwise distances $D _ { t - 1 }$ computed from $\mathbf { \delta } _ { R _ { t - 1 } }$ , and then get a set of interatomic distances $d _ { t - 1 }$ for score estimation: + +$$ +\mathcal { E } _ { t - 1 } = \mathcal { E } \cup \big \{ e _ { i j } ~ \big | ~ D _ { t - 1 , i j } < \delta \big \} , \quad d _ { t - 1 } = \big \{ D _ { t - 1 , i j } ~ \big | ~ e _ { i j } \in \mathcal { E } _ { t - 1 } \big \} . +$$ + +The conformation is then updated using the gradient information from the score network (Eq. 4). We provide the pseudo-code in Algorithm 1. + +# 5 Experiments + +Following previous works [34, 36, 43] on conformation generation, we evaluate the proposed DGSM using the following two standard tasks: Conformation Generation (Section 5.1), and Property Prediction (Section 5.2). To further demonstrate DGSM’s capability of modeling longrange interactions, we evaluate it on two more challenging benchmark tasks: Protein Sidechain Conformation Generation and Multi-molecular Complex Conformation Generation (Section 5.3). We describe experimental setups in task-specific sections. + +# Algorithm 1 Annealed Langevin dynamics [38] + +Require: $\mathcal { G } = \langle \nu , \mathcal { E } \rangle$ , $\{ \sigma _ { i } \} _ { i = 1 } ^ { L } , \delta , \varepsilon , T$ . + +1: Initialize conformation $\scriptstyle { R _ { 0 } }$ +2: for $i \gets 1$ to $L$ do +3: $\alpha _ { i } \varepsilon \cdot \sigma _ { i } ^ { 2 } / \sigma _ { L } ^ { 2 }$ $\triangleright \alpha _ { i }$ is the step size. +4: for $t \gets 1$ to $T$ do +5: $\mathcal { E } _ { t - 1 } , d _ { t - 1 } \gets \mathrm { a u g } ( \mathcal { E } , R _ { t - 1 } , \delta )$ . Eq. 8 +6: $s _ { \theta } ( R _ { t - 1 } , \sigma _ { i } ) \gets \mathrm { g e t } ( s _ { \theta } ( d _ { t - 1 } , \sigma _ { i } ) ) \triangleright \mathrm { E q . } 4$ +7: Draw $\boldsymbol { z } _ { t } \sim \mathcal { N } ( \mathbf { 0 } , I )$ +8: $R _ { t } \gets R _ { t - 1 } + \alpha _ { i } s _ { \theta } ( R _ { t - 1 } , \sigma _ { i } ) + \sqrt { 2 \alpha _ { i } } z _ { t }$ +9: end for +10: $R _ { 0 } \gets R _ { T }$ +11: end for +Return: Generated conformation $R _ { T }$ . + +# 5.1 Conformation Generation + +Setup. This task evaluates the model’s capability to generate stable molecular conformations by measuring both accuracy and diversity of generated conformations. Following previous works [34, 43], we use the GEOM-QM9 and GEOM-Drugs [1] datasets for this task. We use the train-test split provided by [34]. The train splits of GEOM-QM9 and GEOM-Drugs both contain 40,000 molecules, each with 5 conformations for training, or 200,000 conformations in total. The test split of GEOM-QM9 contains 200 molecules with 22,408 conformations, and the test split of GEOM-Drugs contains 200 molecules with 14,324 conformations. + +We compare DGSM against 5 state-of-the-art baselines: RDKIT [28], CVGAE [24], GRAPHDG [36], CGCF [43] and CONFGF [34]. For each molecule in the test set, we sample twice as many conformations as its reference conformations. We use the matching score (MAT) to measure the accuracy of generated conformations, and coverage score (COV) to measure the diversity following [34, 43]. Both metrics are based on Root Mean Squared Deviations (RMSD) between molecules, taking symmetries into account (see supplementary material for the details of metrics). + +Results. We report the mean and median COV and MAT scores over all the molecules in the test split on GEOM-QM9 and GEOM-Drugs datasets. As shown in Table 1, DGSM consistently outperforms all the baselines. Notably, both DGSM and CONFGF are score-based models, but DGSM achieves better performance. The difference between them is that DGSM successfully takes long-range interactions into consideration via dynamic graph score matching. This confirms the significant benefit of modeling long-range interactions. We present several conformations generated by different approaches in Figure 4, which shows that DGSM successfully captures the long-range interactions in highlighted areas while the other baselines fail, resulting in distorted structures in those areas. + +Table 1: COV and MAT scores on GEOM-QM9 and GEOM-Drugs datasets. The threshold $\delta$ of COV score is $0 . 5 \mathring \mathrm { A }$ for GEOM-QM9 and $1 . 2 5 \mathring \mathrm { A }$ for GEOM-Drugs following $\mathrm { X u }$ et al. [43]. (↑): the higher the better. (↓): the lower the better. + +
GEOM-QM9GEOM-Drugs
COV (%, ↑)COV (%, ↑)
MethodMeanMedianMeanMAT (A,↓) MedianMeanMedianMeanMAT (A,↓) Median
RDKIT[28]83.2690.780.34470.293560.9165.701.20261.1252
CVGAE [24]0.090.001.67131.60880.000.003.07022.9937
GRAPHDG [36]73.3384.210.42450.39738.270.001.97221.9845
CGCF [43]77.5280.400.42060.390354.1956.351.25751.2356
CONFGF[34]88.4994.130.26730.268562.1570.931.16291.1596
DGSM91.4995.920.21390.213778.7394.391.01540.9980
+ +![](images/d0a2cabb7c5639256dccf21a7dd886b8e4a87a4f1374a2c00f9f481477b87383.jpg) +Figure 4: Examples of conformations generated by different models based on four random molecular graphs from the test set of GEOM-Drugs. We present three reference conformations for each molecule, and visualize the best-aligned conformations generated by each method. Areas where long-range interactions should be modeled are highlighted in green. + +# 5.2 Property Prediction + +Setup. This task demonstrates how generative models for molecular conformations can be applied to property prediction as a downstream task. It also provides an assessment on the quality of generated conformations in a different light. We estimate the ensemble properties [1] of a molecular graph by aggregating its conformational properties following [34]. In specific, we first use the models + +Table 2: Mean absolute errors (MAE) of predicted ensemble properties in eV. + +
MethodEEminA△emin△emax
RDKIT0.92330.65850.36980.80210.2359
GRAPHDG9.10270.88821.79734.17430.4776
CGCF28.96612.84102.835610.63610.5954
CONFGF2.78860.17650.46882.18430.1433
DGSM1.03130.07610.19631.18110.1271
+ +to generate 50 conformations for each molecular graph in a subset of GEOM-QM9 [34], and use PSI4 [37], a quantum chemical toolkit, to calculate each conformation’s energy and HOMO-LUMO gap. Then, we calculate average energy $\overline { E }$ , lowest energy $E _ { \mathrm { m i n } }$ , average gap $\overline { { \Delta \epsilon } }$ , minimum gap $\Delta \epsilon _ { \mathrm { m i n } }$ and maximum gap $\Delta \epsilon _ { \mathrm { m a x } }$ from the conformational energy and gap. We evaluate the accuracy of estimated ensemble property by measuring their mean absolute errors (MAE) to the ground truth values. CVGAE is excluded in this task as its performance is poor, which is also reported in [36, 34]. + +Results. Table 2 shows that DGSM outperforms other machine learning-based methods by a clear margin. DGSM’s estimation of average energy $\overline { E }$ and minimum gap $\Delta \epsilon _ { \mathrm { m i n } }$ is close to RDKIT but still outperforms the most competitive ML-based method CONFGF. The calculation of conformational energy is highly sensitive to changes in geometry — even a subtle deviation in bond lengths leads to significant energy change [36]. Therefore, the superior performance of DGSM indicates that it generates much more accurate conformations than other methods, leading to more accurate property estimation. This validates again the effectiveness of modeling long-range interactions. + +# 5.3 Large Molecule and Multi-molecular Modeling + +Protein Sidechain Conformation This task is to predict protein sidechain conformations based on its backbone structures. Compared to conventional molecular conformations generation in previous sections, the main challenge of this task is two-fold: (1) large number of atoms, which prohibits constructing complete graphs that grow quadratically to model long-range interactions. + +Table 3: RMSD of different approaches on sidechain conformation generation. + +
MethodRMSD
Mean (A)Min (A)
CONFGF3.383.11
DGSM2.85 (↓15.7%)2.61 (↓ 16.1%)
+ +(2) covalent bonds are sparse, which limits the power of the edge augmentation techniques in previous work. DGSM tackles these two challenges via dynamic graph score matching as introduced. + +![](images/ddb62042f2bd28694c95bb5a17d95b0004d17ab5ff7ec35601389ceff3b8c4fc.jpg) +Figure 5: (a) An example of the generated protein sidechain conformation with atomic-level coordinates. The ground-truth sidechain (blue) and the generated sidechain (red) are highlighted. (b) Conformations of two multi-molecular complexes generated by DGSM. + +We use the SidechainNet [18] dataset for this task and follow the official train-test splits. We compare DGSM with the state-of-the-art conformation generation model CONFGF. Despite that there are some machine learning-based methods specialized in protein sidechain structure prediction [10], they are built upon rotamer libraries [5], which incorporates a lot of domain knowledge. Thus, our method is not comparable with them. The main purpose of this task is to justify the effectiveness of DGSM for large molecules. For each protein, we generate 5 sidechain conformations with different initialization, and calculate the mean and min RMSD between the ground-truth conformation and the generated conformations. We report the overall mean and min RMSD scores by averaging scores of each protein in the test set in in Table 3, which shows that DGSM achieves better performance than previous state-of-the-art model. We also present an example in Figure 5(a), and we can see that the predicted conformation is consistent with the ground truth in major parts. + +Multi-molecular Complex Conformation This task is to predict conformations for multi-molecular complexes. A multi-molecular complex is made up of multiple molecules and there is no covalent bonds between them. Long-range interactions dominate the structure of multi-molecular complexes. The purpose of this task is to demonstrate DGSM’s potential application to a broader range of problems and provide a novel benchmark for conformation generation. We use the quantum chemical software xtb [3] to construct a dataset consisting of 24 water-organic complexes each with several hundreds of conformations, and leave out 4 complexes for testing (see supplementary material for details). We do not report RMSD-based metrics such as COV and MAT because the structures of multi-molecular complexes are highly flexible. Two set of generated examples are presented in Figure 5(b). We observe that water molecules are placed regularly around the solute organic molecule. Notably, hydrogen bonds (between water and the solute, and between water and water) are formed correctly. This can also be evidenced in the histogram of Hydrogen-Oxygen distances (Figure 6), where there is a peak between $1 . 5 \mathring \mathrm { A }$ and $2 . 5 \mathring \mathrm { A }$ , i.e., the range of hydrogen bond length between Hydrogen and Oxygen. + +![](images/7ac0bfb5e265be1599bc039c6c527547e5a21c558d824a8643a79268b2d55df7.jpg) +Figure 6: The distribution of Hydrogen-Oxygen distances. The first peak from the left is covalent bonds and the second peak is hydrogen bonds. + +# 6 Conclusion and Future Work + +We propose DGSM, a novel score-based approach for generating equilibrium molecular conformations. DGSM is capable of modeling both the local and long-range interactions in molecular systems, by dynamically constructing graph structures based on spatial proximity between atoms during both training and inference. We also devise a dynamic graph score matching algorithm to effectively estimate atomic gradients, where graph structures are dynamically determined depending on added perturbations. Extensive experiments over two standard tasks and two original tasks show that DGSM outperforms the state-of-the-art method by a large margin, confirming the significant benefit of modeling long-range interactions. In the future, we plan to apply our approach to the more challenging problem of protein structure prediction. + +# Acknowledgments and Disclosure of Funding + +We would like to thank all the reviewers for the insightful comments. This project is supported by the Natural Sciences and Engineering Research Council (NSERC) Discovery Grant, the Canada CIFAR AI Chair Program, collaboration grants between Microsoft Research and Mila, Samsung Electronics Co., Ldt., Amazon Faculty Research Award, Tencent AI Lab Rhino-Bird Gift Fund and a NRC Collaborative R&D Project (AI4D-CORE-06). This project was also partially funded by IVADO Fundamental Research Project grant PRF-2019-3583139727. + +# References + +[1] Simon Axelrod and Rafael Gomez-Bombarelli. Geom: Energy-annotated molecular conformations for property prediction and molecular generation. arXiv preprint arXiv:2006.05531, 2020. + +[2] Andrew J Ballard, Stefano Martiniani, Jacob D Stevenson, Sandeep Somani, and David J Wales. Exploiting the potential energy landscape to sample free energy. Wiley Interdisciplinary Reviews: Computational Molecular Science, 5(3):273–289, 2015. + +[3] Christoph Bannwarth, Eike Caldeweyher, Sebastian Ehlert, Andreas Hansen, Philipp Pracht, Jakob Seibert, Spicher Spicher, and Stefan Grimme. Extended tight-binding quantum chemistry methods. WIREs Comput. Mol. Sci., 11:e01493, 2020. doi: 10.1002/wcms.1493. URL https://dx.doi.org/10.1002/wcms.1493. + +[4] J. Blaney and J. Dixon. Distance geometry in molecular modeling. ChemInform, 25, 2007. + +[5] Michael J Bower, Fred E Cohen, and Roland L Dunbrack Jr. Prediction of protein side-chain rotamers from a backbone-dependent rotamer library: a new homology modeling tool. Journal of molecular biology, 267(5):1268–1282, 1997. + +[6] Ruojin Cai, Guandao Yang, Hadar Averbuch-Elor, Zekun Hao, Serge J. Belongie, Noah Snavely, and Bharath Hariharan. Learning gradient fields for shape generation. ArXiv, abs/2008.06520, 2020. + +[7] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. In International Conference on Learning Representations, 2021. + +[8] Gordon M Crippen, Timothy F Havel, et al. Distance geometry and molecular conformation, volume 74. Research Studies Press Taunton, 1988. + +[9] Marco De Vivo, Matteo Masetti, Giovanni Bottegoni, and Andrea Cavalli. Role of molecular dynamics and related methods in drug discovery. Journal of medicinal chemistry, 59(9): 4035–4061, 2016. + +[10] Yilun Du, Joshua Meier, Jerry Ma, Rob Fergus, and Alexander Rives. Energy-based models for atomic-resolution protein conformations. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\equiv$ S1e_9xrFvS. + +[11] David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in neural information processing systems, pages 2224– 2232, 2015. + +[12] Octavian-Eugen Ganea, Lagnajit Pattanaik, Connor W. Coley, Regina Barzilay, Klavs F. Jensen, William H. Green, and T. Jaakkola. Geomol: Torsional geometric generation of molecular 3d conformer ensembles. ArXiv, 2021. + +[13] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 1263–1272. JMLR. org, 2017. + +[14] T. Gogineni, Ziping Xu, Exequiel Punzalan, Runxuan Jiang, Joshua A Kammeraad, Ambuj Tewari, and P. Zimmerman. Torsionnet: A reinforcement learning approach to sequential conformer search. ArXiv, abs/2006.07078, 2020. + +[15] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, 2020. + +[16] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. In International Conference on Learning Representations, 2020. + +[17] Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Junction tree variational autoencoder for molecular graph generation. arXiv preprint arXiv:1802.04364, 2018. + +[18] Jonathan E. King and D. Koes. Sidechainnet: An all-atom protein structure dataset for machine learning. arXiv, 2020. + +[19] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. + +[20] Johannes Klicpera, Janek Groß, and Stephan Günnemann. Directional message passing for molecular graphs. In International Conference on Learning Representations, 2020. + +[21] Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diffwave: A versatile diffusion model for audio synthesis. In International Conference on Learning Representations, 2021. + +[22] A. Leach. Molecular modelling: Principles and applications. 1996. + +[23] Shitong Luo and Wei Hu. Diffusion probabilistic models for 3d point cloud generation. ArXiv, abs/2103.01458, 2021. + +[24] Elman Mansimov, Omar Mahmood, Seokho Kang, and Kyunghyun Cho. Molecular geometry prediction using a deep generative graph neural network. arXiv preprint arXiv:1904.00314, 2019. + +[25] R. Parr. Density-functional theory of atoms and molecules. 1989. + +[26] S. Piana, K. Lindorff-Larsen, Robert M. Dirks, J. Salmon, R. Dror, and D. Shaw. Evaluating the effects of cutoffs and treatment of long-range electrostatics in protein folding simulations. PLoS ONE, 7, 2012. + +[27] Anthony K Rappé, Carla J Casewit, KS Colwell, William A Goddard III, and W Mason Skiff. Uff, a full periodic table force field for molecular mechanics and molecular dynamics simulations. Journal of the American chemical society, 114(25):10024–10035, 1992. + +[28] Sereina Riniker and Gregory A. Landrum. Better informed distance geometry: Using what we know to improve conformation generation. Journal of Chemical Information and Modeling, 55 (12):2562–2574, 2015. + +[29] Victor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E(n) equivariant graph neural networks, 2021. + +[30] T. Schlick. Molecular modeling and simulation: An interdisciplinary guide. 2010. + +[31] Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. In Advances in Neural Information Processing Systems, pages 991–1001. Curran Associates, Inc., 2017. + +[32] Kristof T Schütt, Farhad Arbabzadah, Stefan Chmiela, Klaus R Müller, and Alexandre Tkatchenko. Quantum-chemical insights from deep tensor neural networks. Nature communications, 8:13890, 2017. + +[33] Chence Shi, Minkai Xu, Zhaocheng Zhu, Weinan Zhang, Ming Zhang, and Jian Tang. Graphaf: a flow-based autoregressive model for molecular graph generation. arXiv preprint arXiv:2001.09382, 2020. +[34] Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. ArXiv, 2021. +[35] Jihyun Shim and Alexander D MacKerell Jr. Computational ligand-based rational design: role of conformational sampling and force fields in model development. MedChemComm, 2(5): 356–370, 2011. +[36] Gregor Simm and Jose Miguel Hernandez-Lobato. A generative model for molecular distance geometry. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119, pages 8949–8958. PMLR, 2020. +[37] Daniel G. A. Smith, L. Burns, A. Simmonett, R. Parrish, M. C. Schieber, Raimondas Galvelis, P. Kraus, H. Kruse, Roberto Di Remigio, Asem Alenaizan, A. M. James, S. Lehtola, Jonathon P Misiewicz, et al. Psi4 1.4: Open-source software for high-throughput quantum chemistry. The Journal of chemical physics, 2020. +[38] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, volume 32, pages 11918– 11930. Curran Associates, Inc., 2019. +[39] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. NeurIPS, 2020. +[40] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. +[41] Pascal Vincent. A connection between score matching and denoising autoencoders. Neural Comput., 2011. +[42] Max Welling and Yee Whye Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th International Conference on International Conference on Machine Learning, ICML’11, page 681–688, 2011. +[43] Minkai Xu, Shitong Luo, Yoshua Bengio, Jian Peng, and Jian Tang. Learning neural generative dynamics for molecular conformation generation. In International Conference on Learning Representations, 2021. +[44] Minkai Xu, Wujie Wang, Shitong Luo, Chence Shi, Yoshua Bengio, Rafael Gómez-Bombarelli, and Jian Tang. An end-to-end framework for molecular conformation generation via bilevel programming. In ICML, 2021. +[45] Jiaxuan You, Bowen Liu, Zhitao Ying, Vijay Pande, and Jure Leskovec. Graph convolutional policy network for goal-directed molecular graph generation. In Advances in neural information processing systems, pages 6410–6421, 2018. \ No newline at end of file diff --git a/md/train/hsFN92eQEla/hsFN92eQEla.md b/md/train/hsFN92eQEla/hsFN92eQEla.md new file mode 100644 index 0000000000000000000000000000000000000000..6db358af6477ddf21642e2707c0fdca705d592d0 --- /dev/null +++ b/md/train/hsFN92eQEla/hsFN92eQEla.md @@ -0,0 +1,360 @@ +# EVALUATION OF NEURAL ARCHITECTURES TRAINED WITH SQUARE LOSS VS CROSS-ENTROPY IN CLASSIFICATION TASKS + +Like Hui +Computer Science and Engineering +University of California, San Diego +San Diego, CA 92093 +lhui@ucsd.edu +Mikhail Belkin +Halıcıoglu Data Science Institute ˘ +University of California, San Diego +San Diego, CA 92093 +mbelkin@ucsd.edu + +# ABSTRACT + +Modern neural architectures for classification tasks are trained using the crossentropy loss, which is widely believed to be empirically superior to the square loss. In this work we provide evidence indicating that this belief may not be wellfounded. We explore several major neural architectures and a range of standard benchmark datasets for NLP, automatic speech recognition (ASR) and computer vision tasks to show that these architectures, with the same hyper-parameter settings as reported in the literature, perform comparably or better when trained with the square loss, even after equalizing computational resources. Indeed, we observe that the square loss produces better results in the dominant majority of NLP and ASR experiments. Cross-entropy appears to have a slight edge on computer vision tasks. + +We argue that there is little compelling empirical or theoretical evidence indicating a clear-cut advantage to the cross-entropy loss. Indeed, in our experiments, performance on nearly all non-vision tasks can be improved, sometimes significantly, by switching to the square loss. Furthermore, training with square loss appears to be less sensitive to the randomness in initialization. We posit that training using the square loss for classification needs to be a part of best practices of modern deep learning on equal footing with cross-entropy. + +# 1 INTRODUCTION + +Modern deep neural networks are nearly universally trained with cross-entropy loss in classification tasks. To illustrate, cross-entropy is the only loss function specifically discussed in connection with training neural networks for classification in popular references (Goodfellow et al., 2016; Zhang et al., 2020). It is the default for classification in widely used packages such as NLP implementation Hugging Face Transformers (Wolf et al., 2019), speech classification by ESPnet (Watanabe et al., 2018) and image classification implemented by torchvision (Marcel & Rodriguez, 2010). Yet we know of few empirical evaluations or compelling theoretical analyses to justify the predominance of cross-entropy in practice. In what follows, we use a number of modern deep learning architectures and standard datasets across the range of tasks of natural language processing, speech recognition and computer vision domains as a basis for a systematic comparison between the cross-entropy and square losses. The square loss (also known as the Brier score (Brier, 1950) in the classification context) is a particularly useful basis for comparison since it is nearly universally used for regression tasks and is available in all major software packages. To ensure a fair evaluation, for the square loss we use hyper-parameter settings and architectures exactly as reported in the literature for crossentropy, with the exception of the learning rate, which needs to be increased in comparison with cross-entropy and, for problems with a large number of classes (42 or more in our experiments), loss function rescaling (see Section 5). + +Our evaluation includes 20 separate learning tasks1 (neural model/dataset combinations) evaluated in terms of the error rate or, equivalently, accuracy (depending on the prevalent domain conventions). We also provide some additional domain-specific evaluation metrics – F1 for NLP tasks, and Top-5 accuracy for ImageNet. Training with the square loss provides accuracy better or equal to that of cross-entropy in 17 out of 20 tasks. These results are for averages over multiple random initalizations, results for each individual initialization are similar. Furthermore, we find that training with the square loss has smaller variance with respect to the randomness of the initialization in the majority of our experiments. + +Our results indicate that the models trained using the square loss are not just competitive with same models trained with cross-entropy across nearly all tasks and settings but, indeed, provide better classification results in the majority of our experiments. The performance advantage persists even when we equalize the amount of computation by choosing the number of epochs for training the square loss to be the same as the optimal (based on validation) number of epochs for cross-entropy, a setting favorable to cross-entropy. + +Note that with the exception of the learning rate, we utilized hyper-parameters reported in the literature, originally optimized for the cross-entropy loss. This suggests that further improvements in performance for the square loss can potentially be obtained by hyper-parameter tuning. + +Based on our results, we believe that the performance of modern architectures on a range of classification tasks may be improved by using the square loss in training. We conclude that the choice between the cross-entropy and the square loss for training needs to be an important aspect of model selection, in addition to the standard considerations of optimization methods and hyper-parameter tuning. + +A historical note. The modern ubiquity of cross-entropy loss is reminiscent of the predominance of the hinge loss in the era of the Support Vector Machines (SVM). At the time, the prevailing intuition had been that the hinge loss was preferable to the square loss for training classifiers. Yet, the empirical evidence had been decidedly mixed. In his remarkable thesis (Rifkin, 2002), Ryan Rifkin conducted an extensive empirical evaluation and concluded that “the performance of the RLSC [square loss] is essentially equivalent to that of the SVM [hinge loss] across a wide range of problems, and the choice between the two should be based on computational tractability considerations”. More recently, the experimental results in (Que & Belkin, 2016) show an advantage to training with the square loss over the hinge loss across the majority of the tasks, paralleling our results in this paper. We note that conceptual or historical reasons for the current prevalence of cross-entropy in training neural networks are not entirely clear. + +Theoretical considerations. The accepted justification of cross-entropy and hinge loss for classification is that they are better “surrogates” for the 0-1 classification loss than the square loss, e.g. (Goodfellow et al., 2016), Section 8.1.2. There is little theoretical analysis supporting this point of view. To the contrary, the recent work (Muthukumar et al., 2020) proves that in certain overparameterized regimes, the classifiers obtained by minimizing the hinge loss and the square loss in fact the same. While the hinge loss is different from cross-entropy, these losses are closely related in certain settings (Ji & Telgarsky, 2019; Soudry et al., 2018). See (Muthukumar et al., 2020) for a more in-depth theoretical discussion of loss functions and the related literature. + +Probability interpretation of neural network output and calibration. An argument for using the cross-entropy loss function is sometimes based on the idea that networks trained with crossentropy are able to output probability of a new data point belonging to a given class. For linear models in the classical analysis of logistic regression, minimizing cross-entropy (logistic loss) indeed yields the maximum likelihood estimator for the model (e.g.,(Harrell Jr, 2015), Section 10.5). Yet, the relevance of that analysis to modern highly non-linear and often over-parameterized neural networks is questionable. For example, in (Gal & Ghahramani, 2016) the authors state that $^ { * } I n$ classification, predictive probabilities obtained at the end of the pipeline (the softmax output) are often erroneously interpreted as model confidence”. Similarly, the work (Xing et al., 2019) asserts that “for DNNs with conventional (also referred as ‘vanilla’) training to minimize the softmax crossentropy loss, the outputs do not contain sufficient information for well-calibrated confidence estimation”. Thus, accurate class probability estimation cannot be considered an unambiguous advantage of neural networks trained with cross-entropy. While the analysis of calibration for different loss functions is beyond the scope of this paper, we note that in many practical settings accurate classification, the primary evaluation metric of this work, takes precedence over the probability estimation. + +Domain applicability. It is interesting to note that in our experiments the square loss generally performs better on NLP and ASR tasks, while cross-entropy has a slight edge on computer vision. It is tempting to infer that the square loss is suitable for NLP and speech, while cross-entropy may be more appropriate for training vision architectures. Yet we are wary of over-interpreting the evidence. In particular, we observe that the cross-entropy has a significant performance advantage on just a single vision architecture (EfficientNet (Tan & Le, 2019) trained on ImageNet). The rest of the vision results are quite similar between square loss and cross-entropy and are likely to be sensitive to the specifics of optimization and parameter tuning. Understanding whether specific loss functions are better suited for certain domain will require more in-depth experimental work. + +Related work. The choice of a loss function is an integral and essential aspect of training neural networks. Yet we are aware of few comparative analyses of loss functions and no other systematic studies of modern architectures across a range of datasets. Kline & Berardi (2005) compared the effectiveness of squared-error versus cross-entropy in estimating posterior probabilities with small neural networks, five or less nodes in each layer, and argued that cross-entropy had a performance advantage. Golik et al. (2013) provided a comparison of cross-entropy and squared error training for a hybrid HMM/neural net model for one ASR and one handwriting recognition datasets. The authors observed that with a good initialization by pre-training, training with the squared error had better performance than the cross-entropy. Sangari & Sethares (2015) analyzed the convergence of mean squared error (MSE) and cross-entropy under the normalized logistic regression model (Soft-Max) setting, and indicated the MSE loss function is robust to the true model parameter values and can converge to the same parameter estimation variance of the cross-entropy loss function with half the number of gradient descent iterations. Janocha & Czarnecki (2017) compared several different loss functions on MNIST and CIFAR-10 datasets concluding that “depending on the application of the deep model – losses other than log loss [cross-entropy] are preferable”. A recent work (Demirkaya et al., 2020) provided a theoretical comparison of square and cross-entropy losses for training mixture models. The authors argued that the cross-entropy loss has more favorable optimization landscapes in multiclass settings. To alleviate that issue, they proposed rescaling of the loss function equivalent to choosing parameter $k$ in Section 5. The authors showed that rescaling allowed the square loss to become competitive with cross-entropy on CIFAR-100, a finding that aligns with the results in our paper. + +# 2 EXPERIMENTS + +We conducted experiments on a number of benchmark datasets for NLP, ASR and computer vision, following the standard recipes given in recent papers of each domain. Four NLP datasets are MRPC, SST-2, QNLI and QQP. TIMIT, WSJ and Librispeech are three standard datasets used for training ASR systems. For vision experiments, we choose MNIST, CIFAR-10, and ImageNet. To the best of our knowledge, we are the first to experimentally compare the square loss and the cross-entropy on a wide range of datasets with different size, dimensionality (number of features) and the number of classes (up to 1000 class numbers). See Appendix A for references and description. + +Architectures. In what follows we explore several widely used modern neural architectures. For NLP tasks, we implement classifiers with a fine-tuned BERT (Devlin et al., 2018), a LSTM+Attention model (Chen et al., 2017), and a LSTM $^ +$ CNN model (He & Lin, 2016). Joint CTC-Attention based model (Kim et al., 2017), triggered attention model with VGG and BLSTM modules (Moritz et al., 2019) are used for ASR tasks. Note that for the CTC-Attention based model, the original loss function is a weighted sum of the cross-entropy and the CTC loss. When training with the square loss, we only replace the cross-entropy to be the square loss, and keep the CTC loss untouched. For vision tasks, we use TCNN (Bai et al., 2018), Wide ResNet (Zagoruyko & Komodakis, 2016), ResNet (He et al., 2016) and EfficientNet (Tan & Le, 2019) architectures. + +Experimental protocols. For training with the cross-entropy loss, we use a standard protocol, which is to stop training after the validation accuracy does not improve for five consecutive epochs. For the square loss we use two protocols. The first one is the same as for cross-entropy. The second protocol is to train the square loss using the number of epochs selected when training the cross-entropy loss with the first protocol. The second protocol is designed to equalize the usage of computational resources between the square loss and cross-entropy and is favorable to cross-entropy. + +Following the hyper-parameter settings of the architectures in the literature, we re-implement the models trained with the cross-entropy loss keeping the same architecture and hyper-parameter settings. We train the same models using the square loss, employing our two experimental protocols. The only alteration to the parameters of the network reported in the literature is adjustment of the learning rate. For datasets with a large number of labels (42 or more in our experiments) we apply loss function rescaling (see Section 5). + +The key points for the implementation are described in Section 5. The implementation details and specific hyper-parameter settings are given in Appendix B. See Appendix D for a summary of comparisons between the original results and our re-implementations. Additionally, we report the results on validation sets and training sets in Appendix C. + +The results presented below are average results of 5 runs corresponding to 5 different random initalizations for each task. The result across initializations are given in Section 3. + +# 2.1 NLP EXPERIMENTS + +We conduct 2-class classification tasks from NLP domain. The datasets information is summarized in Table 1. As in (Wang et al., 2018), we report accuracy and F1 scores for MRPC and QQP datasets, and report accuracy for SST-2 and QNLI. + +Table 1: NLP task statistics and descriptions + +
CorpusTrain[Test#classesMetricDomain
MRPC (Dolan & Brockett, 2005)3.7K1.7K2acc./F1news
SST-2 (Socher et al., 2013)67K1.8Kacc.movie reviews
QNLI (Rajpurkar et al., 2016)105K5.4Kacc.Wikipedia
QQP (Iyer et al., 2017)364K391K222acc./F1social QA questions
+ +Table 2 gives the accuracy and Table 3 gives the F1 scores of the neural models on NLP tasks. As can be seen in Table 2, in 9 out of 10 tasks using the square loss has better/equal accuracy compared with using the cross-entropy, and in terms of F1 score (see Table 3), 5 out of 6 tasks training with the square loss outperform training with the cross-entropy loss. Even with same epochs, i.e. with same computation cost, using the square loss has equal/better accuracy in 8 out of 10 tasks , and has higher F1 score in 5 out of 6 tasks. + +Table 2: NLP results, accuracy + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE (%)
BERT (Devlin et al., 2018)MRPC83.882.183.6
SST-294.093.993.9
QNLI90.690.690.6
QQP88.988.988.8
LSTM+Attention (Chen et al., 2017)MRPC71.770.971.5
QNLI79.379.079.3
QQP83.483.183.4
LSTM+CNN (He & Lin,2016)MRPC73.269.472.5
QNLI76.076.076.0
QQP84.384.484.3
+ +Table 3: NLP results, F1 scores + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE (%)
BERTMRPC88.186.788.0
(Devlin et al., 2018)QQP70.970.770.7
LSTM+AttentionMRPC80.980.680.7
(Chen et al.,2017)QQP62.662.362.6
LSTM+CNNMRPC81.078.281.0
(He & Lin,2016)QQP60.360.560.3
+ +We observe the relative improvements brought by training with the square loss vary with different model architectures, and other than LSTM $\cdot +$ CNN model on QQP dataset, all architectures trained with the square loss have better/equal accuracy and F1 score. The performance of loss functions also varies with data size, especially for MRPC, which is a relatively small dataset, all model architectures trained with the square loss gives significantly better results than the cross-entropy. + +# 2.2 AUTOMATIC SPEECH RECOGNITION (ASR) EXPERIMENTS + +We consider three datasets, TIMIT, WSJ and Librispeech, and all are ASR tasks. For Librispeech, we choose its train-clean-100 as training set, dev-clean and test-clean as validation and test set. We report phone error rate (PER) and character error rate (CER) for TIMIT, word error rate (WER) and CER for both WSJ and Librispeech. A brief description of the datasets used in our ASR experiments is given in Table $4 ^ { 2 }$ . Note that we only alter the training loss of the acoustic model, while keeping the language model and decoding part the same as described in the literature. The acoustic model is a classifier with the dictionary size as the class number. For TIMIT, getting PER and CER needs two different acoustic models, i.e. they are two separate classification tasks, 42-class classification for PER, and 27-class classification for CER. For WSJ, the size of dictionary used for acoustic model is 52. WER and CER of WSJ are calculated with one acoustic model. Hence for WSJ it is a 52-class classification task for both WER and CER. Acoustic model of Librispeech is a 1000-class classifier for both WER and CER, as we use 1000 unigram (Jurafsky, 2000) based dictionary. The results are in Table 5. + +Table 4: ASR task statistics and descriptions + +
CorpusTrainTest#classesMetricDomain
TIMIT (Garofolo et al., 1993)1.15M54K42 27PER CER3.2 hours (training set) telephone English
WSJ (Paul & Baker,1992)28.8M252K52*WER CER80 hours (training set) read newspapers
Librispeech (Panayotov et al., 2015)36M1M1000*WER CER100 hours (training set) audio books
+ +\* This is the number of classes used for training the acoustic model. + +Table 5: ASR results, error rate + +
ModelTasktrainwith square loss (%)trainwith cross-entropy (%)square loss w/ same epochs as CE (%)
Attention+CTCTIMIT (PER)20.820.820.8
(Kim et al., 2017)TIMIT (CER)32.533.432.5
VGG+BLSTMPWSJ (WER)5.15.35.1
(Moritz et al., 2019)WSJ (CER)2.42.52.4
VGG+BLSTMLibrispeech (WER)9.810.610.3
(Moritz et al.,2019)Librispeech (CER)9.710.710.2
+ +We see that the square loss performs better (equal for TIMIT PER result) in all of our tasks. It is interesting to observe that the performance advantage of the square loss reported in Table 5 increases with dataset size. In particular, the relative advantage of the square loss $9 . 3 \%$ relative improvement on CER, and $7 . 5 \%$ on WER, respectively) is largest for the biggest dataset, Librispeech. On WSJ, using the square loss has ${ \sim } 4 \%$ relative improvement on both CER and WER, while the results on TIMIT for the square loss and cross-entropy are very similar. The question of whether this dependence between the data size and the relative advantage of the square loss over cross-entropy is a coincidence or a recurring pattern requires further investigation. + +For TIMIT and WSJ, we observed that training with both the square loss and the cross-entropy need same epochs to converge. The two training protocols for training with the square loss have same performance, and both are comparable/better than training with the cross-entropy. On Librispeech, the square loss needs more epochs, but provides better performance. + +# 2.3 COMPUTER VISION EXPERIMENTS + +For vision tasks we conduct experiments on MNIST, CIFAR-10 and ImageNet, as in Table 6. + +Table 6: Vision task statistics and descriptions + +
CorpusTrain[Test#classesMetricDomain
MNIST (LeCun et al., 1998)60K10K10acc.28×28
CIFAR-10 (Krizhevsky& Hinton,2009)50K10K10acc.32 ×32
ImageNet (Russakovsky et al., 2015)~1.28M50K31000acc. Top-5 acc.224 × 224
+ +As in Table 7, on MNIST and CIFAR-10, training with the square loss and the cross-entropy have comparable accuracy. On much larger ImageNet, with ResNet-50 architecture, the accuracy and Top-5 accuracy of using the square loss are comparable with the ones got by using the cross-entropy loss. While with EfficientNet, using the cross-entropy shows better results. The performance of different loss functions varies among different architectures. On MNIST and CIFAR-10, we use exactly the same hyper-parameters well-selected for the cross-entropy loss. For ImageNet, we adjust the learning rate and add a simple rescaling scheme (see Section 5), all other hyper-parameters are the same as for the cross-entropy loss. The performance of using the square loss can improve with more hyper-parameter tuning. + +Table 7: Vision results, accuracy + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE(%)
TCNN (Bai et al.,2018)MNIST(acc.)97.797.797.7
W-Resnet (Zagoruyko & Komodakis,2016)CIFAR-10 (acc.)95.996.395.9
ResNet-50ImageNet (acc.)76.276.176.0
(He et al.,2016)ImageNet(Top-5 acc.)93.093.092.9
EfficientNetImageNet (acc.)74.677.074.6
(Tan&Le,2019)ImageNet(Top-5 acc.)92.793.392.7
+ +For all three datasets, training with the square loss converges as fast as training with the crossentropy, and our two experimental protocols for the square loss result in same accuracy performance (except ImageNet with ResNet-50 model). + +# 3 PERFORMANCE ACROSS DIFFERENT INITIALIZATIONS + +![](images/fd41992afa5473ae7d64be9e560f1759fd79b1f6d3a44b9571dccc7334757a2e.jpg) +Figure 1: Difference between accuracy (or error rate) between square loss and CE for each initialization. (Square loss acc. - CE acc.) is shown for accuracy, (CE - Square loss) for error rate. + +To evaluate the stability of the results with respect to the randomness of model initialization we analyze the results for each random seed initialization. For each random seed, we calculate the difference between the the accuracy (or the error) of networks trained with the square loss and the cross-entropy respectively. We present the results with error bars for one standard deviation in Figure 1. Absolute error and accuracy results for each run and the corresponding standard deviations are given in Appendix F. + +Table 8 (Libri is short for Librispeech and I-Net is short for ImageNet) shows the standard deviation of test accuracy/error for training with the square loss and cross-entropy. Square loss has smaller variance in 15 out of 20 tasks, which indicates that training with the square loss is less sensitive to the randomness in the training process. + +# 4 OBSERVATIONS DURING TRAINING + +Table 8: Standard deviation of test accuracy/error. Smaller number is bolded. + +
ModelDatasetSquare lossCE
BERTMRPC0.4840.766
SST-20.2790.173
QNLI0.2410.205
QQP0.0450.063
LSTM +AttentionMRPC0.4840.786
QNLI0.2100.371
QQP0.5660.352
LSTM +CNNMRPC0.3220.383
QNLI0.1730.286
QQP0.4580.161
Attention +CTCTIMIT (PER)0.5080.249
TIMIT (CER)0.3610.873
VGG+WSJ (WER)0.1840.249
BLSTMPWSJ (CER)0.0770.118
VGG+Libri (WER)0.1260.257
BLSTMLibri (CER)0.1480.316
TCNNMNIST0.1610.173
W-ResNetCIFAR-100.1840.481
ResNet-50I-Net (Top-1)0.0320.045
I-Net (Top-5)0.1260.045
EfficientNetI-Net (Top-1)0.1380.122
I-Net (Top-5)0.0890.089
+ +There are several interesting observations in terms of +the optimization speed comparing training with the square loss and the cross-entropy loss. We give the experimental observations for the cases when the class number is small, as for our NLP tasks, which are all 2-class classification tasks, and when the class number is relatively large, as for Libripseech and ImageNet (both have 1000 classes). + +![](images/88dedb56f24a859ae4a14e6a8b164e5fe8f3ac71a967026d82629db2d3e1eaf8.jpg) +Figure 2: Training curves + +We compare the convergence speed in terms of accuracy, and find that for 2-class NLP classification tasks, the training curves of training with the square loss and the cross-entropy are quite similar. Figure 2 (a) gives the accuracy of three model architectures trained with the square loss and the crossentropy along different epochs for QNLI dataset. For all three models, BERT, LSTM $+$ Attention, and LSTM+CNN, using the square loss converges as fast as cross-entropy loss, and achieves better/comparable accuracy to training with the cross-entropy. + +Convergence speed when class number is large When the class number becomes large, as on speech dataset Librispeech and vision dataset ImageNet, training with the square loss may need more epochs to converge. Figure 2 (b) gives the classification accuracy of acoustic model along different epochs, and Figure 2 (c) gives the accuracy (Top-1) and Top-5 accuracy along different training steps of ResNet on ImageNet. Training with the square loss converges slower but reaches similar/better accuracy. + +# 5 IMPLEMENTATION + +We summarize the key points of implementation in this section. Full details and the exact parameters are given in Appendix B. Two important pieces of the implementation are (1) no softmax for training with the square loss and (2) loss rescaling for datasets with large number of classes. + +No softmax. The widely accepted pipeline for modern neural classification tasks trained with the crossentropy loss contains the last softmax layer before calculating the loss. When training with the square loss that layer needs to be removed as it appears to impede optimization. + +Loss rescaling mechanism. For datasets with a small number of classes, we do not use any additional mechanisms. For datasets with a large number of output classes $\geq 4 2$ in our experiments) we employ loss rescaling which helps to accelerate training. Let $( { \pmb x } , { \pmb y } )$ denote a single labeled point, where $\pmb { x } \in \mathbb { R } ^ { d }$ is the feature vector, and $\boldsymbol { y } \in \mathbb { R } ^ { C }$ . Here $C$ is the number + +Table 9: Rescaling parameters + +
Dataset#classeskM
MRPC211
SST-2211
QNLI211
QQP211
TIMIT (CER)2711
TIMIT (WER)42115
WSJ52115
Librispeech10001530
MNIST10
CIFAR-1011
ImageNet10 10001 151 30
+ +of output labels and $\pmb { y } = [ 0 , \ldots , \underbrace { 1 } _ { } , 0 , \ldots , 0 ]$ is the corresponding one-hot encoding vector of the {zc +label $c$ . We denote our model by $f : \mathbb { R } ^ { d } \mathbb { R } ^ { C }$ . + +The standard square loss for the one-hot encoded label vector can be written (at a single point) as + +$$ +l = \frac { 1 } { C } \left( ( f _ { c } ( \pmb { x } ) - 1 ) ^ { 2 } + \sum _ { i = 1 , i \neq c } ^ { C } f _ { i } ( \pmb { x } ) ^ { 2 } \right) +$$ + +For a large number of classes, we use the rescaled square loss defined by two parameters, $k$ and $M$ , as follows: + +$$ +l _ { s } = \frac { 1 } { C } \left( k * ( f _ { c } ( \pmb { x } ) - M ) ^ { 2 } + \sum _ { i = 1 , i \neq c } ^ { C } f _ { i } ( \pmb { x } ) ^ { 2 } \right) . +$$ + +The parameter $k$ rescales the loss value at the true label, while $M$ rescales the one-hot encoding (the one-hot vector is multiplied by $M$ ). Note that when $k = M = 1$ , the rescaled square loss is same as the standard square loss in Eq. 1. The values of $k$ and $M$ for all experiments are given in Table 9. As in (Demirkaya et al., 2020), the parameter $k$ is used to increase the emphasis on the correct class in multiclass classification, and this paper proves how adding $k$ can simplify the optimization landscape. We find that for very large class numbers additional parameter $M$ further improves performance. + +# 6 SUMMARY AND DISCUSSION + +In this work we provided an empirical comparison of training with the cross-entropy and square loss functions for classification tasks in a range of datasets and architectures. We observe that the square loss outperforms cross-entropy across the majority of datasets and architectures, sometimes by a significant margin. No additional parameter modification except for adjusting the learning rate was necessary for most datasets. For datasets with a large number of classes (42 or more) we used additional loss rescaling to accelerate training. We note that all models used in our experiments were originally designed and tuned for training with the cross-entropy loss. We conjecture that if the neural architectures were selected and tuned for the square loss, performance would be further improved and no extra loss rescaling parameters would be necessary. Another important observation is that the final softmax layer, commonly used with cross-entropy, needs to be removed during training with the square loss. + +While we could only explore a small sample of modern models and learning tasks, we believe that the scope of our experiments — ten different neural architectures and ten different datasets across three major application domains — is broad enough to be indicative of the wide spectrum of neural models and datasets. Our empirical results suggest amending best practices of deep learning to include training with square loss for classification problems on equal footing with cross-entropy or even as a preferred option. They also suggest that new theoretical analyses and intuitions need to be developed to understand the important question of training loss function selection. + +# ACKNOWLEDGMENTS + +The authors acknowledge support from NSF (IIS-1815697) and NIH (R01EB022899) and a Google Faculty Research Award. We thank Nvidia for the donation of GPUs and Google for the free access to the cloud TPUs provided by the TFRC program. LH thanks Wuwei Lan for helpful discussions on NLP experiments and Peidong Wang for discussions on ASR experiments. MB thanks his co-authors on (Muthukumar et al., 2020), D. Hsu, V. Multukumar, A. Narang, A. Sahai and V. Subramanian, for insightful discussions related to loss functions and the Simons Institute for the Theory of Computing, where the initial discussions took place. We thank Ryan Rifkin for valuable feedback. + +# REFERENCES + +Shaojie Bai, J Zico Kolter, and Vladlen Koltun. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271, 2018. +Glenn W Brier. Verification of forecasts expressed in terms of probability. Monthly weather review, 78(1):1–3, 1950. +Qian Chen, Xiaodan Zhu, Zhen-Hua Ling, Si Wei, Hui Jiang, and Diana Inkpen. Enhanced LSTM for natural language inference. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 1657–1668, 2017. +Ahmet Demirkaya, Jiasi Chen, and Samet Oymak. Exploring the role of loss functions in multiclass classification. In 2020 54th Annual Conference on Information Sciences and Systems (CISS), pp. 1–5. IEEE, 2020. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. +William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005. +Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059, 2016. +John S Garofolo, Lori F Lamel, William M Fisher, Jonathan G Fiscus, and David S Pallett. Darpa timit acoustic-phonetic continous speech corpus cd-rom. nist speech disc 1-1.1. NASA STI/Recon technical report n, 93, 1993. +Pavel Golik, Patrick Doetsch, and Hermann Ney. Cross-entropy vs. squared error training: a theoretical and experimental comparison. In Interspeech, volume 13, pp. 1756–1760, 2013. +Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org. +Frank E Harrell Jr. Regression modeling strategies: with applications to linear models, logistic and ordinal regression, and survival analysis. Springer, 2015. +Hua He and Jimmy Lin. Pairwise word interaction modeling with deep neural networks for semantic similarity measurement. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 937–948, 2016. +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. +Shankar Iyer, Nikhil Dandekar, and Kornel Csernai. First Quora Dataset Release: Question Pairs. ´ In https://data.quora.com/First-Quora-Dataset-Release-Question-Pairs, 2017. +Katarzyna Janocha and Wojciech Marian Czarnecki. On loss functions for deep neural networks in classification. arXiv preprint arXiv:1702.05659, 2017. + +Ziwei Ji and Matus Telgarsky. The implicit bias of gradient descent on nonseparable data. In Conference on Learning Theory, pp. 1772–1798, 2019. + +Dan Jurafsky. Speech & language processing. Pearson Education India, 2000. + +Suyoun Kim, Takaaki Hori, and Shinji Watanabe. Joint ctc-attention based end-to-end speech recognition using multi-task learning. In 2017 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 4835–4839. IEEE, 2017. + +Douglas M Kline and Victor L Berardi. Revisiting squared-error and cross-entropy functions for training neural network classifiers. Neural Computing & Applications, 14(4):310–318, 2005. + +Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009. + +Wuwei Lan and Wei Xu. Neural network models for paraphrase identification, semantic textual similarity, natural language inference, and question answering. In Proceedings of the 27th International Conference on Computational Linguistics, pp. 3890–3902, 2018. + +Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. + +Sebastien Marcel and Yann Rodriguez. Torchvision the machine-vision package of torch. In ´ Proceedings of the 18th ACM international conference on Multimedia, pp. 1485–1488, 2010. + +Niko Moritz, Takaaki Hori, and Jonathan Le Roux. Triggered attention for end-to-end speech recognition. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5666–5670. IEEE, 2019. + +Vidya Muthukumar, Adhyyan Narang, Vignesh Subramanian, Mikhail Belkin, Daniel Hsu, and Anant Sahai. Classification vs regression in overparameterized regimes: Does the loss function matter?, 2020. + +Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015. + +Douglas B Paul and Janet M Baker. The design for the wall street journal-based csr corpus. In Proceedings of the workshop on Speech and Natural Language, pp. 357–362. Association for Computational Linguistics, 1992. + +Qichao Que and Mikhail Belkin. Back to the future: Radial basis function networks revisited. In Arthur Gretton and Christian C. Robert (eds.), Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, volume 51 of Proceedings of Machine Learning Research, pp. 1375–1383, Cadiz, Spain, 2016. PMLR. + +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016. + +Ryan Michael Rifkin. Everything old is new again: a fresh look at historical approaches in machine learning. PhD thesis, MaSSachuSettS InStitute of Technology, 2002. + +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 FeiFei. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252, 2015. + +Arash Sangari and William Sethares. Convergence analysis of two loss functions in soft-max regression. IEEE Transactions on Signal Processing, 64(5):1280–1288, 2015. + +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { ~ Y ~ N ~ g ~ } _ { }$ and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013. + +Daniel Soudry, Elad Hoffer, Mor Shpigel Nacson, Suriya Gunasekar, and Nathan Srebro. The implicit bias of gradient descent on separable data. The Journal of Machine Learning Research, 19 (1):2822–2878, 2018. +Mingxing Tan and Quoc V Le. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018. +Shinji Watanabe, Takaaki Hori, Shigeki Karita, Tomoki Hayashi, Jiro Nishitoba, Yuya Unno, Nelson Enrique Yalta Soplin, Jahn Heymann, Matthew Wiesner, Nanxin Chen, Adithya Renduchintala, and Tsubasa Ochiai. Espnet: End-to-end speech processing toolkit. In Interspeech, pp. 2207–2211, 2018. doi: 10.21437/Interspeech.2018-1456. URL http://dx.doi.org/10. 21437/Interspeech.2018-1456. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R’emi Louf, Morgan Funtowicz, and Jamie Brew. Huggingface’s transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771, 2019. +Chen Xing, Sercan Arik, Zizhao Zhang, and Tomas Pfister. Distance-based learning from errors for confidence calibration. arXiv preprint arXiv:1912.01730, 2019. +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. +Aston Zhang, Zachary C. Lipton, Mu Li, and Alexander J. Smola. Dive into Deep Learning. 2020. https://d2l.ai. + +# APPENDICES + +# A DATASETS AND TASKS + +Below we provide a summary of datasets used in the experiments. + +# NLP tasks + +• MRPC (Microsoft Research Paraphrase Corpus) (Dolan & Brockett, 2005) is a corpus of sentence pairs extracted from online news sources. Human annotation indicates whether the sentences in the pair are semantically equivalent. We report accuracy and F1 score. SST-2 (The Stanford Sentiment Treebank) (Socher et al., 2013) is a task to determine the sentiment of a given sentence. This corpus contains sentences from movie reviews and their sentiment given by human annotations. We use only sentence-level labels, and predict positive or negative sentiment. QNLI is a converted dataset from the Stanford Question Answering Dataset (Rajpurkar et al., 2016) which consists of question-paragraph pairs. As in (Wang et al., 2018), this task is to predict whether the context sentence selected from the paragraph contains the answer to the question. QQP (Quora Question Pairs dataset) (Iyer et al., 2017) contains question pairs from the question-answering website Quora. Similar to MRPC, this task is to determine whether a pair of questions are semantically equivalent. We report accuracy and F1 score. + +# ASR tasks + +• TIMIT (Garofolo et al., 1993) consists of speech from American English speakers, along with the corresponding phonemical and lexical transcription. It is widely used for acousticphonetic classification and ASR tasks. Its training set, validation set and test set are 3.2 hours, 0.15 hours, 0.15 hours long, respectively. + +• WSJ (Wall Street Journal corpus) (Paul & Baker, 1992) contains read articles from the Wall Street Journal newspaper. Its training, validation and test set are 80 hours, 1.1 hours and 0.7 hours long, respectively. Librispeech (Panayotov et al., 2015) is a large-scale (1000 hours in total) corpus of 16 kHz English speech derived from audiobooks. We choose the subset train-clean-100 (100 hours) as our training data, dev-clean (2.8 hours) as our validation set and test-clean (2.8 hours) as our test set. + +# Vision tasks + +• MNIST (LeCun et al., 1998) contains 60, 000 training images and 10, 000 testing $2 8 \times 2 8$ pixel images of hand-written digits. It is a 10-class image classification task. CIFAR-10 (Krizhevsky & Hinton, 2009) consists of $5 0 , 0 0 0 3 2 \times 3 2$ pixel training images and $1 0 , 0 0 0 3 2 \times 3 2$ pixel test images in 10 different classes. It is a balanced dataset with $6 , 0 0 0$ images of each class. ImageNet (Russakovsky et al., 2015) is an image dataset with 1000 classes, and about 1.28 million images as training set. The sizes of its validation and test set are $5 0 , 0 0 0$ and 10, 000, respectively. All images we use are in $2 2 4 \times 2 2 4$ pixels. + +# B HYPER-PARAMETER SETTINGS + +We give the implementation toolkits and specific hyper-parameter settings to help reproduce our results, and list the epochs needed for training with the square loss and the cross-entropy (CE) loss. The data processing is following the standard methods. For NLP tasks, it is the same as in (Wang et al., 2018), and for ASR tasks, it is the same as in (Watanabe et al., 2018). For vision tasks, we are following the default ones given in the implementation of the corresponding papers. + +# B.1 HYPER-PARAMETERS FOR NLP TASKS + +The implementation of BERT is based on the PyTorch toolkit (Wolf et al., 2019). The specific script we run is https://github.com/huggingface/transformers/blob/master/ examples/text-classification/run_glue.py, and we use the bert-base-cased model for fine-tuning. LSTM $+$ Attention and LSTM+CNN are implemented based on the toolkit released by (Lan & Xu, 2018). The specific hyper-parameters used in the experiments are in Table 10. As there are many hyper-parameters, we only list the key ones, and all other parameters are the default in the scripts. + +Table 10: Hyper-parameters for NLP tasks + +
ModelTaskBatchsizemax_seqlengthLearning rate w/Epochs training w/
square lossCEsquare lossCE
BERTMRPC321285e-52e-553
SST-2321282e-52e-533
QNLI321282e-52e-533
QQP321282e-52e-533
LSTM+AttentionMRPC64802e-41e-42520
QNLI32sent_len*1e-41e-42020
QQP641201e-41e-43030
LSTM+CNNMRPC64802e-41e-42020
QNLI32sent_len*8e-51e-42020
QQP321201e-31e-32020
+ +\* The max sequence length equals the max sentence length of the training set. + +# B.2 HYPER-PARAMETERS FOR ASR TASKS + +The implementation of ASR tasks is based on the ESPnet (Watanabe et al., 2018) toolkit, and the specific code we use is the run.sh script under the base folder of each task, which is https: + +//github.com/espnet/espnet/tree/master/egs/?/asr1, where ’?’ can be ’timit’, ’wsj’, and ’librispeech’. The specific hyper-parameters are following the ones in the configuration file of each task, which is under the base folder. We list the files which give the hyper-parameter settings for acoustic model training in Table 11. + +Table 11: Hyper-parameters for ASR tasks + +
ModelTaskHyper-parametersEpochs training w/ingw/
square lossCE
Attention+CTCTIMITconf/train.yaml2020
VGG+BLSTMPWSJ*conf/tuning/train_rnn.yaml1515
VGG+BLSTMLibrispeechconf/tuning/train_rnn.yaml3020
+ +\* For WSJ, we use the language model given by https://drive.google.com/ open?id ${ . } =$ 1Az-4H25uwnEFa4lENc-EKiPaWXaijcJp. \ We set mtlalpha $= 0 . 3$ , batch-size $\scriptstyle = 3 0$ . ♦ We set elayers $^ { = 4 }$ , as we use 100 hours training data. + +# B.3 HYPER-PARAMETERS FOR VISION TASKS + +The implementation of these models are based on the open source toolkits. For TCNN and EfficientNet, we use the open source implementation given by (Bai et al., 2018) and (Tan & Le, 2019), respectively. For Wide ResNet, we are based on the open source PyTorch implementation https: //github.com/xternalz/WideResNet-pytorch (W-ResNet). For ResNet-50, our experiments are based on the Tensorflow toolkit https://github.com/tensorflow/tpu/ tree/master/models/official/resnet (ResNet) implemented on TPU. The hyperparameter settings for our vision experiments are in Table 12. + +Table 12: Hyper-parameters for vision tasks + +
ModelTaskHyper-parametersEpochs training w/
square lossCE
TCNNMNIST4the default in (Bai et al., 2018)2020
Wide-ResNetCIFAR-10the default in W-ResNet,except wide-factor=20200200
ResNet-50ImageNetthe default in ResNet,for square loss, learning rate=0.3168885*112590*
EfficientNetImageNetthe default in EfficientNet-BOof (Tan & Le,2019)218949*218949*
+ +\ We are doing the permuted MNIST task as in Bai et al. (2018). \* We give the training steps as in the original implementations. + +# C EXPERIMENTAL RESULTS ON VALIDATION AND TRAINING SETS + +Table 13: NLP results on validation set, accuracy + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE (%)
BERT (Devlin et al., 2018)MRPC85.385.085.3
SST-291.291.591.2
QNLI90.890.790.8
QQP90.890.790.6
LSTM+Attention (Chen et al., 2017)MRPC76.574.875.3
QNLI79.779.779.7
LSTM+CNN (He & Lin,2016)QQP86.085.586.0
MRPC76.073.376.0
QNLI QQP76.8 84.076.8 85.376.8 84.0
+ +Table 14: NLP results on validation set, F1 scores + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE (%)
BERTMRPC89.589.689.5
(Devlin et al., 2018)QQP87.587.487.4
LSTM+AttentionMRPC83.783.383.5
(Chen et al., 2017)QQP82.181.782.1
LSTM+CNNMRPC82.681.482.6
(He & Lin, 2016)QQP77.480.277.4
+ +We report the results for validation set of NLP tasks in Table 13 for accuracy and Table 14 for F1 scores. + +The validation set results of the ASR tasks are in Table 15. + +Table 15: ASR results on validation set, error rate + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE (%)
Attention+CTCTIMIT (PER)18.118.318.1
(Kim et al., 2017)TIMIT (CER)30.431.430.4
VGG+BLSTMPWSJ (WER)8.58.88.5
(Moritz et al., 2019)WSJ (CER)3.94.03.9
VGG+BLSTMLibrispeech (WER)9.310.79.9
(Moritz et al., 2019)Librispeech (CER)9.411.110.2
+ +We report the training result for NLP tasks in Table 16 for accuracy and F1 score in Table 17. The training results for ASR tasks and vision tasks are in Table 18 and Table 19, respectively. + +Table 16: NLP results on training and test set, accuracy + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE (%)
TrainTestTrainTestTrainTest
BERT (Devlin et al., 2018)MRPC99.783.899.982.199.683.6
SST-298.694.099.293.998.693.9
QNLI98.090.697.590.698.090.6
QQP96.288.998.088.996.288.8
LSTM+Attention (Chen et al., 2017)MRPC94.671.784.970.993.271.5
QNLI87.779.390.879.087.779.3
QQP93.783.491.583.193.783.4
LSTM+CNN (He & Lin,2016)MRPC98.373.292.569.498.372.5
QNLI92.876.090.776.092.876.0
QQP91.384.395.784.491.384.3
+ +Table 17: NLP results on training and test set, F1 scores + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE (%)
TrainTestTrainTestTrainTest
BERTMRPC99.888.199.986.799.788.0
(Devlin et al., 2018)QQP94.570.997.270.794.570.7
LSTM+Attention (Chen et al., 2017)MRPC QQP96.1 91.980.9 62.689.5 89.280.6 62.394.7 91.980.7 62.6
LSTM+CNNMRPC98.881.094.578.298.881.0
(He & Lin, 2016)QQP88.060.394.260.588.060.3
+ +Table 18: ASR results on training and test set, error rate + +
ModelTasktrain with square loss (%)trainwith cross-entropy (%)square loss w/ same epochs as CE (%)
TrainTestTrainTestTrainTest
Attention+CTCTIMIT (PER)0.920.84.820.80.920.8
(Kim et al.,2017)TIMIT (CER)4.532.511.633.44.532.5
VGG+BLSTMPWSJ (WER)*0.75.10.35.30.75.1
(Moritz et al., 2019)WSJ(CER)*0.32.40.12.50.32.4
VGG+BLSTMLibrispeech (WER)*0.89.80.410.60.810.3
(Moritz et al., 2019)Librispeech (CER)*0.69.70.310.70.610.2
+ +\* For WSJ and Librispeech, we take $1 0 \%$ of the training set for the evaluation of the training error rate. + +Table 19: Vision results on training and test set, accuracy + +
ModelTasktrain with square loss (%)train with cross-entropy (%)square loss w/ same epochs as CE(%)
TrainTestTrainTestTrainTest
TCNN (Bai et al., 2018)MNIST (acc.)98.397.799.597.798.397.7
W-Resnet (Zagoruyko & Komodakis,2016)CIFAR-10 (acc.)100.095.9100.096.3100.095.9
ResNet-50ImageNet (acc.)77.776.280.576.177.776.0
(He et al., 2016)ImageNet (Top-5 acc.)93.293.093.493.093.292.9
EfficientNetImageNet (acc.)75.174.681.477.075.174.6
(Tan & Le,2019)ImageNet (Top-5 acc.)93.092.794.093.393.092.7
+ +# D OUR RESULTS COMPARED WITH THE ORIGINAL WORK + +We list our results for the models trained with the cross-entropy (CE) loss and compare them to the results reported in the literature or the toolkits in Table 20. As we observe, our results are comparable to the original reported results. + +Table 20: Training with the cross-entropy loss, our results and the reported ones + +
ModelTaskOur CE resultCE result in the literature
BERT*MRPC (acc./F1)85.0/89.685.29/89.47 (Wolf et al., 2019)
SST-2 (acc.)91.591.97 (Wolf et al.,2019)
QNLI (acc.)90.787.46 (Wolf et al., 2019)
QQP (acc./F1)90.7/87.488.40/84.31 (Wolf et al., 2019)
LSTM+Attention LSTM+CNNN/A N/A
Attention+CTCTIMIT (PER)
TIMIT (CER)20.720.5 (Watanabe et al.,2018)
VGG+BLSTMP32.733.7 (Watanabe et al.,2018)
WSJ (WER)5.45.3 (Watanabe et al., 2018)
VGG+BLSTMWSJ (CER)2.62.4 (Watanabe et al., 2018)
Librispeech (WER)10.8N/A
TCNNLibrispeech (CER) MNIST (acc.)11.0 98.0N/A
Wide-ResNetCIFAR-10 (acc.)96.597.2 (Bai et al., 2018)
ResNet-50ImageNet (acc./Top-5 acc.)76.1/93.096.11 (Zagoruyko & Komodakis, 2016) 76.0/93.0 (Tan & Le,2019)
EfficientNetImageNet (acc./Top-5 acc.)77.2/93.477.3/93.5 (Tan & Le,2019)
+ +\* The implementation in (Wolf et al., 2019) is using bert-base-uncased model, we are using bert-base-cased, which will result in a little difference. Also, as they didn’t give test set results, here for BERT, we give the results of validation set. + +The models marked with ’N/A’ in Table 20 do not have comparable results reported in the literature. Specifically, LSTM $+$ Attention and LSTM $+$ CNN models for NLP tasks are implemented based on the toolkit released by (Lan & Xu, 2018), where they did not show results on MRPC and QNLI. The QQP results are not comparable with ours as they were using a different test set, while we are using the standard test set same as in (Wang et al., 2018). The VGG $^ +$ BLSTM model for Librispeech dataset is based on ESPnet toolkit (Watanabe et al., 2018). Due to computational resources limitations, we only use train-clean-100 (100 hours) as training data and 1000 unigram based dictionary for acoustic model training, while they use 1000 hours of training data with at least 2000 unigram dictionary. + +# E REGULARIZATION TERMS + +We give the regularization term of each task in Table 21. 0 means we didn’t add regularization term. For WSJ, check the details at line 306 of https://github.com/espnet/espnet/blob/ master/espnet/nets/pytorch_backend/rnn/decoders.py. + +Table 21: Regularization term for each task + +
ModelTaskdropout*batch normRegularization Term
BERTMRPC/SST-2/QNLI/QQP0.1N0
LSTM+AttentionMRPC/QNLI/QQP0.5N0
LSTM+CNNMRPC/QNLI/QQP0.0N0
Attention+CTCTIMIT0.0N0
VGG+BLSTMPWSJ0.0Nlabel smoothing based
VGG+BLSTMLibrispeech0.0N0
TCNMNIST0.05N0
Wide-ResNetCIFAR-100.0N0
ResNet-50ImageNet0.0Y10-4 一n 2 ∑i=1
EfficientNetImageNet0.0Y10-5 n 2 i=
+ +∗ For dropout, 0.0 means have not apply dropout. + +# F VARIANCE OF ACCURACY AMONG DIFFERENT RANDOM SEEDS + +Figure 3 gives the error bar of 5 runs corresponding to 5 different random seeds, along with the results for each inidividual run. In the left of each subfigure is the result of training with the square loss, while in the right is result of the cross-entropy. As can be seen in Figure 3, using the square loss has better accuray/error rate and smaller variance in NLP and ASR tasks, which indicates that training with the square loss for those classification tasks is statistically better. + +![](images/e7fe6f296bc8becee021a4cfccdc5faa4859627edae09fbd4bae5d6f54a8fb85.jpg) +Accuracy among results of 5 random seeds +Accuracy among results of 5 random seeds +Figure 3: Accuracy/error rate variance of results among 5 random seeds \ No newline at end of file diff --git a/md/train/kHromd7SNA/kHromd7SNA.md b/md/train/kHromd7SNA/kHromd7SNA.md new file mode 100644 index 0000000000000000000000000000000000000000..19980f80c9b8e74d5a1a33f2eccb356f1ce7a398 --- /dev/null +++ b/md/train/kHromd7SNA/kHromd7SNA.md @@ -0,0 +1,275 @@ +# MOTION REPRESENTATIONS FOR ARTICULATED ANIMATION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +We propose novel motion representations for animating articulated objects consisting of distinct parts. In a completely unsupervised manner, our method identifies meaningful object parts, tracks them in a driving video, and infers their motions by considering their principal axes. In contrast to the previous keypoint-based works, our method extracts meaningful and consistent regions, describing locations, shape, and pose. The regions correspond to semantically relevant and distinct object parts, that are more easily detected in frames of the driving video. To force decoupling of foreground from background, we model non-object related global motion with a homography. Our model1 can animate a variety of objects, surpassing previous methods by a large margin on existing benchmarks. We present a challenging new benchmark with high-resolution videos and show that the improvement is particularly pronounced when articulated objects are considered. + +# 1 INTRODUCTION + +Animation—bringing static objects to life—has broad applications across education and entertainment. Animated characters and objects increase the creativity and appeal of content, improve the clarity of material through storytelling, and enhance user experiences. Imagine the Mona Lisa describing the manner in which she was painted, or Michelangelo’s David detailing the method with which he was sculpted, or an influential historical figure shedding light on key events of the past (Fig. 1); how much more engaging this would be. + +Until very recently, animation techniques necessary for achieving such results required a trained professional, specialized hardware, software, and a great deal of effort. Quality results generally still do, but vision and graphics communities have attempted to address some of these limitations by training data-driven methods (Wang + +![](images/f30413fadc3b455edf46dd95ca7f4a717bde631a83181d84719e4a045ad6cfb8.jpg) +Figure 1: An animation produced by our method. + +et al., 2018a; Chan et al., 2019; Ren et al., 2020; Geng et al., 2019; Gafni et al., 2019) on object classes for which prior knowledge of object shape and pose can be learned. This, however, requires ground truth pose and shape data to be available during training. + +Recent works have sought to avoid the need for ground truth data through unsupervised motion transfer (Wiles et al., 2018; Siarohin et al., 2019a;b). Significant progress on the several key challenges have been made, including training using image reconstruction as a loss, and disentangling motion from appearance. This has created the potential to animate a broader range of object categories, without any domain knowledge or labelled data, requiring only videos of objects in motion during training. However, two key problems remain open. The first is how to represent the parts of an articulated or non-rigid moving object, including their shapes and poses. The second is given the object parts, how to animate them using the sequence of motions in a driving video. + +Initial attempts involved extracting unsupervised keypoints (Lorenz et al., 2019; Kim et al., 2019) in end-to-end frameworks (Wiles et al., 2018; Siarohin et al., 2019b;a), then warping a feature embedding of a source image to align its keypoints with those of a driving video. Follow on work (Siarohin et al., 2019a) additionally modelled the motion around each keypoint with local, affine transformations, and introduced a generation module that both composites warped source image regions and inpaints occluded regions, to render the final image. This enabled a variety of creative applications2, for example needing only one source face image to generate a near photo-realistic animation, driven by a video of a different face. + +However, the resulting unsupervised keypoints are detected on the boundary of the objects. While points on edges are easier to identify, tracking such keypoints between frames is problematic, as any point on the boundary is a valid candidate, making it hard to establish correspondences between frames. A further problem is that the unsupervised keypoints do not correspond to semantically meaningful object parts, and represent location and direction, but not shape. Due to this limitation, animating articulated objects, such as bodies, remains challenging. Furthermore, these methods assume static backgrounds, i.e., no camera motion, leading to leakage of background motion information into one or several of the detected keypoints. Despite significant breakthroughs, these remaining deficiencies limit the scope of the core innovation to more trivial object categories and motions, and lower quality outputs, especially when objects are articulated. + +This work introduces two contributions critical to addressing these challenges. First, we redefine the underlying motion representation. Instead of using keypoints, we switch to regions that allow first-order motion to be measured, rather than regressed. This enables improved convergence, more stable, robust object and motion representations, and also empirically captures the shape of the underpinning object parts, leading to better motion segmentation. Fig. 3 contains several examples of region vs. keypoint-based motion representation. + +Secondly, we explicitly model background or camera motion between training frames by predicting the parameters of a global homography explaining non-object related motions. This enables the model to focus solely on the foreground object, making the identified points more stable, and further improves convergence. + +These contributions unlock significant gains in capability for unsupervised motion transfer methods, resulting in much improved animation of articulated objects in particular. Furthermore, the framework scales better in the number of unsupervised regions, resulting in more detailed motion. Our method outperforms previous unsupervised animation methods on a variety of datasets, including talking faces, taichi videos and animated pixel art. We additionally present a new dataset, TED talk speakers, to create a more challenging benchmark for the task of animating articulated objects. + +# 2 RELATED WORK + +Image animation methods can be separated into supervised, which require knowledge about the animated object during training, and unsupervised, which do not. Such knowledge typically includes landmarks (Cao et al., 2014; Zakharov et al., 2019; Qian et al., 2019; Ha et al., 2020), semantic segmentations (Nirkin et al., 2019), and parametric 3D models (Geng et al., 2019; Thies et al., 2016; Deng et al., 2020; Nagano et al., 2018; Liu et al., 2019). As a result, supervised methods are limited to a small number of object categories for which a lot of labelled data is available, such as faces and human bodies. Early face reenactment work (Thies et al., 2016) fitted a 3D morphable model to an image, animating and rendering it back using graphical techniques. Further works used neural networks to get higher quality rendering (Kim et al., 2018; Wang et al., 2018b), sometimes requiring multiple images per identity (Geng et al., 2019; Pumarola et al., 2018). A body of works treats animation as an image-to-image (Siarohin et al., 2018) or a video-to-video (Wang et al., 2018a; Chan et al., 2019; Ren et al., 2020) translation problem. Apart from some exceptions (Wang et al., 2019), these works further constrain the problem to animating a single instance of an object, such as a single face (Kim et al., 2018; Bansal et al., 2018) or a single human body (Chan et al., 2019; Ren et al., 2020; Wang et al., 2018a), requiring retraining (Bansal et al., 2018; Chan et al., 2019; Ren et al., 2020) or fine-tuning (Zakharov et al., 2019) for each new instance. Despite promising results, generalizing these methods beyond a limited range of object categories remains challenging. Additionally, they tend to transfer not only the motion but also the identity of the driving object, making the shape of the animated face or a body similar or identical to the driving face or body (Kim et al., 2018; Zakharov et al., 2019). + +![](images/5b23edf1ef336c348613954cba5bdb75e548528d675bde52781924f7396669c0.jpg) +Figure 2: Overview of our model. The region predictor returns heatmaps for each part in the source and the driving images. We then compute principal axes of each heatmap, to transform each region from the source to the driving frame through a whitened reference frame. Region and background transformations are combined by the pixel-wise flow prediction network. The target image is generated by warping the source image in a feature space using the pixel-wise flow, and inpainting newly introduced regions, as indicated by the confidence map. + +Unsupervised methods address some of these limitations. They do not require any labelled data regarding the shape or landmarks of the animated object. Video-generation-based animation methods predict future frames of a video, given the first frame and an animation class label, such as "make a happy face", "do jumping jack", or "play golf" (Tulyakov et al., 2018; Saito et al., 2017; Clark et al., 2019). A further group of works re-target animation from a driving video to a source frame. X2Face (Wiles et al., 2018) builds a canonical representation of an input face, and generates a warp field conditioned on the driving video. Monkey-Net (Siarohin et al., 2019b) learns a set of unsupervised keypoints to generate animations. Follow-up work substantially improves the quality of animation by considering a first order motion model (FOMM) (Siarohin et al., 2019a) for each keypoint, represented by regressing a local, affine transformation. Both of these works apply to a wider range of objects including faces, bodies, robots, and pixel art animations. Empirically, these methods extract keypoints on the boundary of the animated objects. Articulated objects such as human bodies are therefore challenging, as internal motion, for example, an arm moving across the body, is not well modeled, producing unconvincing animations. + +This work presents an unsupervised method. We argue that the limitations of previous such methods in animating articulated objects is due to an inability of their internal representations to capture complete object parts, their shape and pose. X2Face (Wiles et al., 2018) assumes an object can be represented with a single RGB texture, while other methods find keypoints on edges (Siarohin et al., 2019b;a). Our new region and background motion representations address these shortcomings. + +# 3 METHOD + +Our unsupervised animation framework consists of a system design, and methods for training this system using two different frames, source S, and driving D, from the same video. + +# 3.1 SYSTEM DESIGN + +FOMM (Siarohin et al., 2019a), the current state-of-the-art method in unsupervised animation learning, consists of two main parts: motion estimation and image generation. The contributions of our work lie in novel motion representations within the first part of this framework. Our system, outlined in Fig. 2, therefore follows the FOMM design as closely as possible, in order to demonstrate the impact due specifically to our contributions. + +![](images/b434e5f758996b8746e73620d93b6fcb9f93375ab8e8dd904e07b5ad278a1f48.jpg) +Figure 3: Comparison of motion/part representations. Regression-based keypoint representations do not provide consistent detection between frames (marked with red). Additionally, background motion leaks into one or several detected keypoints. Our PCA-based regions (with and without background motion) correctly identify meaningful parts, are consistent between frames, and use additional regions more effectively. + +# 3.1.1 REGIONS AND COARSE MOTION + +Regions FOMM learns to detect $K$ distinct object regions, where $K$ is a user-defined parameter. An encoder-decoder region predictor network takes an image as input, and outputs $K$ heatmaps, $\mathbf { M } ^ { 1 } , . . , \mathbf { M } ^ { K }$ . The final network layer is a softmax operation, s.t. $\mathbf { M } ^ { k } \in [ 0 , 1 ] ^ { H \times W }$ , where $H$ and $W$ are the height and width of the image respectively, and $\begin{array} { r } { \sum _ { z \in \mathcal { Z } } m _ { z } ^ { k } = 1 } \end{array}$ , where $z$ is a pixel location $\mathbf { \dot { x } }$ , y coordinates) in the image, the set of all pixel locations being $\mathcal { Z }$ , and $m _ { z } ^ { k }$ is the $k$ -th heatmap weight at pixel $z$ . We use the same region representation and encoder here. Nevertheless, the encoded regions differ significantly (see Fig. 3), ours mapping to meaningful object parts such as the limbs of an articulated body, due to our novel foreground motion representation, described below. + +Estimating foreground region motion FOMM estimates a first-order transformation from an image $\mathbf { X }$ to a reference frame $\mathbf { R }$ , for each region separately. The region heatmap encodes translation by its mean position, while other affine parameters are regressed per pixel and then pooled per region according to the heatmap weights. Here we change the way this transformation is represented: all motion is measured directly from the heatmap. Translation is given by the mean position, as before, while in-plane rotation and scaling in $\mathbf { X } ^ { - }$ and y-directions are computed via a principal component analysis (PCA) of the heatmap. Shear is not captured, therefore our transform isn’t fully affine, with only five degrees of freedom instead of six. Nevertheless, it captures sufficient motion, shear being a less significant component of the affine transform for this task. The transformation of a region from the reference frame to the image is computed as follows: + +$$ +{ \begin{array} { r l } & { \qquad \mu ^ { k } = \displaystyle \sum _ { z \in { \mathcal { Z } } } m _ { z } ^ { k } z , } \\ & { \qquad U ^ { k } S ^ { k } { V ^ { k } } ^ { \mathsf { T } } = \displaystyle \sum _ { z \in { \mathcal { Z } } } m _ { z } ^ { k } ( z - \mu ^ { k } ) ( z - \mu ^ { k } ) ^ { \mathsf { T } } , ~ \mathrm { ( v i a S V D ) } , } \\ & { \qquad A _ { \mathbf { X } \mathbf { R } } = \displaystyle [ U ^ { k } S ^ { k ^ { \frac { 1 } { 2 } } } , \mu ^ { k } ] . } \end{array} } +$$ + +The singular value decomposition (SVD) approach to computing PCA (Wall et al., 2003) is used here. We refer to FOMM and our estimation approaches as regression-based and PCA-based, respectively. The reference frame in both is used only as an abstract, intermediate coordinate frame between the source and driving image coordinate frames. However, here (in contrast to FOMM) it is not in fact abstract, corresponding to the coordinate frame where the heatmap is whitened (i.e. has zero mean and identity covariance); see Fig. 2. Driving to source image motion is then + +$$ +\begin{array} { r } { A _ { \mathbf { S } \mathbf { D } } ^ { k } = A _ { \mathbf { S } \mathbf { R } } ^ { k } [ A _ { \mathbf { D } \mathbf { R } } ^ { k } ] ^ { - 1 } . } \end{array} +$$ + +Estimating background motion FOMM has no background motion model. We observe that with significant background motion between frames, e.g. due to camera motion, predicted regions can therefore include the moving background, reducing test-time accuracy. To resolve this, we additionally regress a background homography transformation, $\mathbf { H }$ , using an encoder network that takes as input the source and driving images, concatenated along the channel dimension, and outputs eight real values, $h _ { 1 } , . . , h _ { 8 }$ , such that $\bar { { \bf H } } = \left[ [ h _ { 1 } , h _ { 2 } , h _ { 3 } ] ^ { \top } \left[ h _ { 4 } , h _ { 5 } , h _ { 6 } \right] ^ { \top } [ h _ { 7 } , h _ { 8 } , 1 ] ^ { \top } \right]$ . With background motion well modeled, we show that the network is able to separate background and object motion in a completely unsupervised manner. + +# 3.1.2 IMAGE GENERATION + +Given these coarse motions, FOMM then renders the target image in two stages: a pixel-wise flow generator converts coarse motions to dense optical flow, then a composition network warps the source image according to the flow, and also inpaints missing regions. We follow this architecture, and summarize these two modules here, but refer the reader to Siarohin et al. (2019a) for the full details. + +Pixel-wise flow generation Coarse motions are combined via a weighted sum, to compute a dense, per pixel motion, or flow. The per pixel weights, as well as a confidence map, are computed via an encoder-decoder network. The input is a $H \times W \times ( 4 K + 3 )$ tensor, with four channels per region, three for the source image warped according to the region’s motion model, and one for a heatmap of the region, which is a gaussian approximation to ${ \bf { M } } ^ { \breve { k } }$ , in order to avoid leakage of driving image appearance through the heatmap. Here we add a further three input channels (compared to FOMM) for the source image warped according to the background motion model. + +Warping and inpainting The source image is passed through an encoder network. The resulting feature map is warped and masked according to the pixel-wise flow and confidence map from the previous module, respectively. A decoder then renders the final image, inpainting missing parts. In contrast to FOMM, but similar to Monkey-Net (Siarohin et al., 2019b), here skip connections are used between the encoder and decoder. The skip connection feature maps are also warped and masked. + +# 3.2 TRAINING + +The proposed model is trained end-to-end using a reconstruction loss in the feature space of the pretrained VGG-19 network (Johnson et al., 2016; Wang et al., 2017). Following Siarohin et al. (2019a); Wang et al. (2003), we adopt a multi-resolution version of the reconstruction loss: + +$$ +\mathcal { L } _ { \mathrm { r e c } } ( \hat { \mathbf { D } } , \mathbf { D } ) = \sum _ { l } \sum _ { i } \left| \mathrm { V } _ { i } \big ( \mathrm { F } _ { l } \odot \hat { \mathbf { D } } \big ) - \mathrm { V } _ { i } \big ( \mathrm { F } _ { l } \odot \mathbf { D } \big ) \right| , +$$ + +where $\hat { \bf D }$ is the generated image, $\mathrm { V } _ { i }$ is the $i ^ { \mathrm { { t h } } }$ -layer of the VGG-19 pretrained network, $\mathrm { F } _ { l }$ is a downsampling operator. Similarly to Wang et al. (2017); Siarohin et al. (2019a) we used conv1_2, conv2_2, conv3_2, conv4_2, conv5_2 layers and downsampled the images to 1, 0.5, 0.25, 0.125 of the original edge size. In total we have 20 reconstruction terms. To improve detection of unsupervised regions we follow the unsupervised keypoint detection literature (Jakab et al., 2018; Zhang et al., 2018) and adopt the equivariance loss, denoted as $\mathcal { L } _ { \mathrm { e q } }$ . We use a thin-plate spline implementation provided in FOMM (Siarohin et al., 2019a). The final loss is a sum of the two loss terms, $\mathcal { L } = \mathcal { L } _ { \mathrm { r e c } } + \mathcal { L } _ { \mathrm { e q } }$ . + +![](images/97dc64f529863911ea0d5ff8c5401b09ec59c12b8c5759765a48499e1054109f.jpg) +Figure 4: Qualitative comparisons. We show representative examples of articulated animation using our method and FOMM (Siarohin et al., 2019a), on two datasets of articulated objects: TED-talks (left) and TaiChiHD (right). Zoom in for greater detail. + +# 4 EVALUATION + +We now discuss the datasets, metrics and experiments used to evaluate the proposed method. Later we compare with prior work, as well as ablate our contributions. + +# 4.1 TOY MOTION REPRESENTATION EXPERIMENT + +To demonstrate the benefit of the proposed PCAbased motion representation, we devise an experiment on rotated rectangles (see Appendix E): the task is to predict the rotation angle of a rectangle in an image. To fully isolate our contribution, we consider a supervised task, where three different architectures learn to predict angles under the $L _ { 1 }$ loss. The first, a Naive architecture, directly regresses the angle using an encoder-like architecture. The second is Regression-based, as in to FOMM (Siarohin et al., 2019a). The third uses our PCA-based approach (see Appendix E). Test results are presented in Fig. 5, against training set size. The Naive baseline struggles to produce meaningful results for any size of training set, while Regression-based performance improves with more data. However, the PCA-based significantly improves accuracy over the Regression-based one, being over an order of magnitude better with a large number of samples. This shows that it is significantly easier for the network to infer geometric parameters of the image, such as angle, using our proposed PCA-based representation. + +![](images/977dd74fcd71d52ec274f24c38abdbbe09bcd9b20a9d9ebb057ddc69537a1d61.jpg) +Figure 5: Mean test-time absolute rotation error, as a function of training set size. + +# 4.2 BENCHMARKS + +We evaluate our method on several benchmark datasets for animating human faces and bodies. Each dataset has separate training and test videos. The datasets are as follows: + +• VoxCeleb (Nagrani et al., 2017) consists of interview videos of different celebrities. We extract square, face regions and downscale them to $2 5 6 \times 2 5 6$ , following FOMM (Siarohin et al., 2019a). The number of frames per video ranging from 64 to 1024. • TaiChiHD (Siarohin et al., 2019a) consists of cropped videos of full human bodies performing Tai Chi actions. We evaluate on two resolutions of the dataset: $2 5 6 \times 2 5 6$ (from FOMM (Siarohin et al., 2019a)), and a new, $5 1 2 \times 5 1 2$ subset, removing videos lacking sufficient resolution to support that size. • TED-talks is a new dataset, collected for this paper in order to demonstrate the generalization properties of our model. We cropped the upper part of the human body from the videos, downscaling to $3 8 4 \times 3 8 4$ . The number of frames per video ranges from 64 to 1024. + +Table 2: Video reconstruction: comparison with the state of the art on four different datasets. For all methods we use $K = 1 0$ regions. (Best result in bold.) + +
TaiChiHD (256)TaiChiHD (512)TED-talksVoxCeleb
L1(AKD,MKR)AEDL1(AKD,MKR)AEDL1(AKD,MKR)AEDL1AKDAED
FOMM0.056(6.53,0.033)0.1720.075(17.12,0.66)0.2030.033(7.07,0.014)0.1630.0411.270.134
Ours0.048(5.45,0.028)0.1520.064(14.00,0.44)0.1710.026(4.02,0.007)0.1190.0401.280.133
+ +Further datasets are used in the supplementary material. + +Since video animation is a relatively new problem, there are not currently many effective ways of evaluating it. For quantitative metrics, prior works (Siarohin et al., 2019b;a) use video reconstruction accuracy as a proxy for image animation quality. We adopt the same metrics here: + +• $\mathcal { L } _ { 1 }$ error measures the difference between reconstructed video and ground-truth video pixel values using the $\mathcal { L } _ { 1 }$ metric. • Average keypoint distance (AKD) and missing keypoint rate (MKR) evaluate the difference between poses of reconstructed and ground truth video. Landmarks are extracted from both videos using public, body (Cao et al., 2017) (for TaiChiHD and TED-talks) and face (Bulat & Tzimiropoulos, 2017) (for VoxCeleb) detectors. AKD is then the average distance between corresponding landmarks, while MKR is the proportion of landmarks present in the ground-truth that are missing in the reconstructed video. • Average Euclidean distance (AED) evaluates how well identity is preserved in reconstructed video. Public re-identification networks for bodies (Hermans et al., 2017) (for TaiChiHD and TED-talks) and faces (Amos et al., 2016) extract identity from reconstructed and ground truth frame pairs, then we compute the average $\mathcal { L } _ { 2 }$ norm of their difference across all pairs. + +# 4.3 COMPARISON WITH THE STATE OF THE ART + +We compare our method with the current state of the art for unsupervised animation, FOMM (Siarohin et al., 2019a), across all datasets, on both reconstruction (the training task) and animation (the testtime task). We used an extended training schedule compared to Siarohin et al. (2019a), with $50 \%$ more iterations. To compare fairly with FOMM (Siarohin et al., 2019a), we also re-trained it with the same training schedule. + +Reconstruction quality Quantitative reconstruction results are reported in Tab. 2. We first show that our method reaches state-of-the-art results on a dataset with non-articulated objects such as faces. Indeed, when compared with FOMM (Siarohin et al., 2019a) on VoxCeleb our method shows on-par results. The situation changes, however, when articulated objects are considered, such as human bodies in TaiChiHD and TED-talks datasets, on which our improved motion representations boost all the metrics. The advantage over the state of the art holds at different resolutions, for TaiChiHD (256), TaiChiHD (512) and TED-talks, as well as for different numbers of selected regions (discussed later). + +Animation quality Fig. 3 & 4 show selected and representative animations respectively, using our method and FOMM (Siarohin et al., 2019a), on articulated bodies, both using absolute motion. The results show clear improvements, in most cases, in animation quality, especially of limbs. + +Animation quality was evaluated quantitatively through a user preference study similar to that of Siarohin et al. (2019a). AMT users were presented with the source image, driving video, and the output from our method and FOMM (Siarohin et al., 2019a), and asked which of the two videos they preferred. 50 such videos were evaluated, by 50 users each, for a total of 2500 preferences per study. The results, shown in Tab. 4, further support the reconstruction scores in Tab. 2. When the animated object is not articulated (VoxCeleb), the method delivers results comparable to the previous work. When bodies are animated (TaiChiHD & TED-talks), FOMM (Siarohin et al., 2019a) fails to correctly detect and animate the articulated body parts such as hands. Our method renders them in the driving pose even for extreme cases, leading to a high preference in favor of it. + +Finally, we applied animation from a TED-talks video to a photograph of Winston Churchill, shown in Fig. 1, demonstrating animation of out of domain data. + +Table 3: Ablation study on TaiChiHD (256) dataset with $K = 1 0$ . (Best result in bold.) + +
L1(AKD,MKR)AED
No pca or bg model0.060(6.14, 0.033)0.163
No pca0.049(6.04,0.034)0.163
No bg model0.059(5.47, 0.027)0.164
Full method0.048(5.45, 0.028)0.152
+ +Table 4: User study: the proportion $( \% )$ of users that prefer our method over FOMM (Siarohin et al., 2019a). + +
DatasetUser preference (%)
VoxCeleb52.2%
TaiChiHD (256)83.0%
TED-talks91.0%
+ +# 4.4 ABLATIONS + +In order to understand how much benefit each of our contributions bring, we ran a number of ablation experiments, detailed in Tab. 3. + +PCA-based vs. regression-based representations First we compare the PCA-based motion model with the previous, regression-based one (Siarohin et al., 2019a). From the qualitative, heatmap depictions in Fig. 3, we observe that the regression-based method localizes one edge of each corresponding part, while our method predicts regions that roughly correspond to the segmentation of the object into its constituent, articulated parts. This meaningful segmentation arises completely unsupervised. + +From Tab. 1 we note that adding the PCA-based representation alone (second row) had marginal impact on the $\mathcal { L } _ { 1 }$ score (dominated by the much larger background region), but it had a much larger impact on other metrics, which are more sensitive to object-part-related errors on articulated objects. This is corroborated by Tab. 3. + +We intuit that PCA-based estimation both captures regions and improves performance because it is much easier for the convolutional network to assign pixels of an object part to the corresponding heatmap than to directly regress motion parameters to an abstract reference frame. This is borne out by our toy experiment (sec. 4.1). In order to estimate the heatmap it need only learn all appearances of the corresponding object part, whereas regression-based networks must learn the joint space of all appearances of a part in all possible geometric configurations (e.g. rotated, scaled etc.). + +One of the most important hyper-parameters of our model is the number of regions, $K$ . The qualitative and quantitative ablations of this parameter are shown in Fig. 3 and Tab. 1 respectively. We can observe that, while the regression-based representation fails when the number of keypoints grows to 20, our PCA-based representation scales well with the number of regions. + +Modeling background motion Tab. 3 shows that methods with background motion modeling have much lower $\mathcal { L } _ { 1 }$ error. Since background constitutes a large portion of the image, and $\mathcal { L } _ { 1 }$ treats all pixels equally, this is to be expected. AED was also impacted, suggesting that the identity representation captures some background appearance. However, since AKD & MKR metrics evaluate object pose only, they are not improved by background modelling. + +# 5 CONCLUSION + +We have argued that previous unsupervised animation frameworks’ poor results on articulated objects are due to their representations. We propose a new, PCA-based, region motion representation, which we believe both makes it easier for the network to learn region motion, and encourages it to learn semantically meaningful object parts. In addition, we propose a background motion estimation module to decouple foreground and background motion. Qualitative and quantitative results across a range of datasets and tasks demonstrate several key benefits: improved region distribution and stability, improved reconstruction accuracy and user perceived quality, and an ability to scale to more regions. We also introduce a new, more challenging dataset, TED-talks, for benchmarking future improvements on this task. + +While we show some results on out of domain data (Fig. 1), generalization remains a significant challenge to making this method broadly practical in articulated animation of inanimate objects. + +# REFERENCES + +Brandon Amos, Bartosz Ludwiczuk, and Mahadev Satyanarayanan. Openface: A general-purpose face recognition. 2016. + +Aayush Bansal, Shugao Ma, Deva Ramanan, and Yaser Sheikh. Recycle-gan: Unsupervised video retargeting. In Proceedings of the European Conference on Computer Vision, 2018. + +Adrian Bulat and Georgios Tzimiropoulos. How far are we from solving the 2d & 3d face alignment problem? (and a dataset of 230,000 3d facial landmarks). In ICCV, 2017. + +Chen Cao, Qiming Hou, and Kun Zhou. Displaced dynamic expression regression for real-time facial tracking and animation. ACM Transactions on Graphics, 2014. + +Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In CVPR, 2017. + +Caroline Chan, Shiry Ginosar, Tinghui Zhou, and Alexei A Efros. Everybody dance now. In Proceedings of the IEEE International Conference on Computer Vision, 2019. + +A Clark, J Donahue, and K Simonyan. Adversarial video generation on complex datasets. arXiv preprint arXiv:1907.06571, 2019. + +Yu Deng, Jiaolong Yang, Dong Chen, Fang Wen, and Xin Tong. Disentangled and controllable face image generation via 3d imitative-contrastive learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2020. + +Oran Gafni, Lior Wolf, and Yaniv Taigman. Vid2game: Controllable characters extracted from real-world videos. arXiv preprint arXiv:1904.08379, 2019. + +Zhenglin Geng, Chen Cao, and Sergey Tulyakov. 3d guided fine-grained face manipulation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019. + +Sungjoo Ha, Martin Kersner, Beomsu Kim, Seokjun Seo, and Dongyoung Kim. Marionette: Few-shot face reenactment preserving identity of unseen targets. In Proceedings of the AAAI Conference on Artificial Intelligence, 2020. + +Alexander Hermans, Lucas Beyer, and Bastian Leibe. In defense of the triplet loss for person re-identification. arXiv:1703.07737, 2017. + +Tomas Jakab, Ankush Gupta, Hakan Bilen, and Andrea Vedaldi. Unsupervised learning of object landmarks through conditional image generation. In Proceedings of the Neural Information Processing Systems Conference, 2018. + +Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In Proceedings of the European Conference on Computer Vision, 2016. + +Hyeongwoo Kim, Pablo Garrido, Ayush Tewari, Weipeng Xu, Justus Thies, Matthias Nießner, Patrick Pérez, Christian Richardt, Michael Zollhöfer, and Christian Theobalt. Deep video portraits. ACM Transactions on Graphics, 2018. + +Yunji Kim, Seonghyeon Nam, In Cho, and Seon Joo Kim. Unsupervised keypoint learning for guiding class-conditional video prediction. In Proceedings of the Neural Information Processing Systems Conference, 2019. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2014. + +Wen Liu, Zhixin Piao, Jie Min, Wenhan Luo, Lin Ma, and Shenghua Gao. Liquid warping gan: A unified framework for human motion imitation, appearance transfer and novel view synthesis. In Proceedings of the IEEE International Conference on Computer Vision, 2019. + +Dominik Lorenz, Leonard Bereska, Timo Milbich, and Bjorn Ommer. Unsupervised part-based disentangling of object shape and appearance. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019. + +Koki Nagano, Jaewoo Seo, Jun Xing, Lingyu Wei, Zimo Li, Shunsuke Saito, Aviral Agarwal, Jens Fursund, and Hao Li. pagan: real-time avatars using dynamic textures. ACM Transactions on Graphics, 2018. + +A. Nagrani, J. S. Chung, and A. Zisserman. Voxceleb: a large-scale speaker identification dataset. In INTERSPEECH, 2017. + +Yuval Nirkin, Yosi Keller, and Tal Hassner. Fsgan: Subject agnostic face swapping and reenactment. In Proceedings of the IEEE International Conference on Computer Vision, 2019. + +Albert Pumarola, Antonio Agudo, Aleix M Martinez, Alberto Sanfeliu, and Francesc Moreno-Noguer. Ganimation: Anatomically-aware facial animation from a single image. In Proceedings of the European Conference on Computer Vision, 2018. + +Shengju Qian, Kwan-Yee Lin, Wayne Wu, Yangxiaokang Liu, Quan Wang, Fumin Shen, Chen Qian, and Ran He. Make a face: Towards arbitrary high fidelity face manipulation. In Proceedings of the IEEE International Conference on Computer Vision, 2019. + +Jian Ren, Menglei Chai, Sergey Tulyakov, Chen Fang, Xiaohui Shen, and Jianchao Yang. Human motion transfer from poses in the wild. arXiv preprint arXiv:2004.03142, 2020. + +Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In MICCAI, 2015. + +Masaki Saito, Eiichi Matsumoto, and Shunta Saito. Temporal generative adversarial nets with singular value clipping. In Proceedings of the IEEE International Conference on Computer Vision, 2017. + +Aliaksandr Siarohin, Enver Sangineto, Stéphane Lathuilière, and Nicu Sebe. Deformable gans for pose-based human image generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018. + +Aliaksandr Siarohin, Stéphane Lathuilière, Sergey Tulyakov, Elisa Ricci, and Nicu Sebe. First order motion model for image animation. In Proceedings of the Neural Information Processing Systems Conference, 2019a. + +Aliaksandr Siarohin, Stéphane Lathuilière, Sergey Tulyakov, Elisa Ricci, and Nicu Sebe. Animating arbitrary objects via deep motion transfer. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019b. + +Justus Thies, Michael Zollhofer, Marc Stamminger, Christian Theobalt, and Matthias Nießner. Face2face: Real-time face capture and reenactment of rgb videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2016. + +Sergey Tulyakov, Ming-Yu Liu, Xiaodong Yang, and Jan Kautz. Mocogan: Decomposing motion and content for video generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018. + +Michael E Wall, Andreas Rechtsteiner, and Luis M Rocha. Singular value decomposition and principal component analysis. In A practical approach to microarray data analysis, pp. 91–109. Springer, 2003. + +Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017. + +Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Guilin Liu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Video-to-video synthesis. In Proceedings of the Neural Information Processing Systems Conference, 2018a. + +Ting-Chun Wang, Ming-Yu Liu, Andrew Tao, Guilin Liu, Jan Kautz, and Bryan Catanzaro. Few-shot video-to-video synthesis. In Proceedings of the Neural Information Processing Systems Conference, 2019. + +Wei Wang, Xavier Alameda-Pineda, Dan Xu, Pascal Fua, Elisa Ricci, and Nicu Sebe. Every smile is unique: Landmark-guided diverse smile generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018b. + +Zhou Wang, Eero P Simoncelli, and Alan C Bovik. Multiscale structural similarity for image quality assessment. In Proceedings of the Thrity-Seventh Asilomar Conference on Signals, Systems & Computers, 2003. + +Olivia Wiles, A Sophia Koepke, and Andrew Zisserman. X2face: A network for controlling face generation using images, audio, and pose codes. In Proceedings of the European Conference on Computer Vision, 2018. + +Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019. + +Egor Zakharov, Aliaksandra Shysheya, Egor Burkov, and Victor Lempitsky. Few-shot adversarial learning of realistic neural talking head models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019. + +Yuting Zhang, Yijie Guo, Yixin Jin, Yijun Luo, Zhiyuan He, and Honglak Lee. Unsupervised discovery of object landmarks as structural representations. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018. + +# A TED-TALKS DATASET CREATION + +To create the TED-talks dataset, we downloaded 3,035 YouTube videos, shared under the “CC BY – $\mathrm { N C } - \mathrm { N D } 4 . 0$ International” license,3 using the "TED talks" query. From these initial candidates, we selected the videos where the upper part of the person is visible for at least 64 frames, and the height of the person bounding box was at least 384 pixels. After that, we manually filtered out static videos and videos in which a person is doing something other than presenting. We ended up with 411 videos, and split these videos in 369 training and 42 testing videos. We then split each video into chunks from a consistent camera angle (i.e. with no cuts to another camera), and for which the presenter didn’t move too far from their starting position in the chunk. We cropped the a square region around the presenter, such that they had a consistent scale, and downscaled this region to $3 8 4 \times 3 8 4$ pixels. Chunks that lacked sufficient resolution to be downscaled, or had a length shorter than 64 frames, were removed. Both the distance moved and the region cropping were achieved using a bounding box estimator for humans (Wu et al., 2019). Overall, we obtained 1,177 training video chunks and 145 test videos chunks. + +# B IMPLEMENTATION DETAILS + +For a fair comparison, in order to highlight our contributions, we mostly follow the architecture design of FOMM (Siarohin et al., 2019a). Similar to FOMM, our region predictor, background motion predictor and pixel-wise flow predictor operate on a quarter of the original resolution, e.g. $6 4 \times 6 4$ for $2 5 6 \times 2 5 6$ images, $9 6 \times 9 6$ for $3 8 4 \times 3 8 4$ and $1 2 8 \times 1 2 8$ for $5 1 2 \times 5 1 2$ . We use the U-Net (Ronneberger et al., 2015) architecture with five "convolution - batch norm - ReLU - pooling" blocks in the encoder and five "upsample - convolution - batch norm - ReLU" blocks in the decoder for both the region predictor and the pixel-wise flow predictor. For the background motion predictor, we use only the five block encoder part. Similarly to FOMM (Siarohin et al., 2019a), we use the Johnson architecture (Johnson et al., 2016) for image generation, with two down-sampling blocks, six residual-blocks, and two up-sampling blocks. However, we add skip connections that are warped and weighted by the confidence map. Our method is trained using Adam (Kingma & Ba, 2014) optimizer with learning rate $2 e - 4$ and batch size 48, 20, 12 for $2 5 6 \times 2 5 6$ , $3 8 4 \times 3 8 4$ and $5 1 2 \times 5 1 2$ resolutions respectively. During the training process, the networks observe 3M source-driving pairs, each pair selected at random from a random video chunk, and we drop the learning rate by a factor of 10 after 1.8M and 2.7M pairs. We use 4 Nvidia P100 GPUs for training. + +# C MGIF DATASET + +We run additional experiments on the MGif (Siarohin et al., 2019b) dataset to further demonstrate the superiority of PCA-based representations over regression-based ones. The dataset contains a set of animations of articulated, 2D, cartoon animals. The qualitative results are presented in the supplementary video. We can observe that our PCA-based representation successfully tracks all legs, while the regression-based representation often misses some of the legs, which leads to worse reconstruction quality. This observation is further confirmed by quantitative evaluation; the $\mathcal { L } _ { 1 }$ error for FOMM (Siarohin et al., 2019a) is 0.0223, while for our method it is 0.0206. + +# D COMPARISON WITH OTHER METHODS + +The main paper has focused on comparing our method to FOMM (Siarohin et al., 2019a), as it is both most similar to our work, and the current state-of-the-art. We show quantitative results using prior works (Wiles et al., 2018; Siarohin et al., 2019b) in Table 5. These are significantly inferior to both FOMM and our method. + +Table 5: Video reconstruction comparison. (Best result in bold.) + +
TaiChiHD (256)VoxCeleb
L1(AKD,MKR)AEDL1AKDAED
X2Face0.080(17.65, 0.109)0.270.0787.690.405
Monkey-Net0.077(10.80, 0.059)0.2280.0491.890.199
FOMM0.056(6.53, 0.033)0.1720.0411.270.134
Ours0.048(5.45, 0.028)0.1520.0401.280.133
+ +# E TOY EXPERIMENT DETAILS + +The rotated rectangles dataset consists of images of rectangles randomly rotated from $0 ^ { \circ }$ to $9 0 °$ , along with labels that indicate the angle of rotation. The rectangles have different, random colors. Visual samples are shown in Fig. 6. + +![](images/77aea8e7c834470bac00866386bc4f7458ce91a18ec5c52d79bbcaf32aa67e40.jpg) +Figure 6: Examples of synthetic rectangle dataset. + +We tested three different networks: Naive, Regression-based and PCA-based. The Naive network directly predicts an angle from an image using an encoder and a fully-connected layer. Regressionbased is similar to FOMM (Siarohin et al., 2019a); the angle is regressed per pixel an using hourglass network, and pooled according to heatmap weights predicted using the same hourglass network. PCAbased is our method described in Sec. 3; we predict the heatmap using an hourglass network, PCA is performed according to eq. equation 2, and the angle is computed from matrix $U$ as arctan $\left( U _ { 1 0 } / U _ { 0 0 } \right)$ . + +Each of the networks was trained, on subsets of the dataset of varying sizes, to minimize the $\mathcal { L } _ { 1 }$ loss between predicted and ground truth rotation angle. All models were trained for 100 epochs, with batch size 8. We used the Adam optimizer, with a learning rate of $1 0 ^ { - 4 }$ . We varied the size of the training set from 32 to 1024. Results, on a separate, fixed test set of size 128, were then computed, shown in Fig. 5. \ No newline at end of file diff --git a/md/train/kWSeGEeHvF8/kWSeGEeHvF8.md b/md/train/kWSeGEeHvF8/kWSeGEeHvF8.md new file mode 100644 index 0000000000000000000000000000000000000000..b914df7c829547195c8a5bab070c42cea8cc1aa1 --- /dev/null +++ b/md/train/kWSeGEeHvF8/kWSeGEeHvF8.md @@ -0,0 +1,396 @@ +# BENCHMARKS FOR DEEP OFF-POLICY EVALUATION + +Justin $\mathbf { F u ^ { * 1 } }$ Mohammad Norouzi∗2 Ofir Nachum∗2 George Tucker∗2 +Ziyu Wang2 Alexander Novikov3 Mengjiao Yang2 Michael R. Zhang2 +Yutian Chen3 Aviral Kumar1 Cosmin Paduraru3 Sergey Levine1 Tom Le Paine∗3 + +1UC Berkeley 2Google Brain 3DeepMind justinfu@berkeley.edu,{mnorouzi,ofirnachum,gjt,tpaine}@google.com + +# ABSTRACT + +Off-policy evaluation (OPE) holds the promise of being able to leverage large, offline datasets for both evaluating and selecting complex policies for decision making. The ability to learn offline is particularly important in many real-world domains, such as in healthcare, recommender systems, or robotics, where online data collection is an expensive and potentially dangerous process. Being able to accurately evaluate and select high-performing policies without requiring online interaction could yield significant benefits in safety, time, and cost for these applications. While many OPE methods have been proposed in recent years, comparing results between papers is difficult because currently there is a lack of a comprehensive and unified benchmark, and measuring algorithmic progress has been challenging due to the lack of difficult evaluation tasks. In order to address this gap, we present a collection of policies that in conjunction with existing offline datasets can be used for benchmarking off-policy evaluation. Our tasks include a range of challenging high-dimensional continuous control problems, with wide selections of datasets and policies for performing policy selection. The goal of our benchmark is to provide a standardized measure of progress that is motivated from a set of principles designed to challenge and test the limits of existing OPE methods. We perform an evaluation of state-of-the-art algorithms and provide open-source access to our data and code to foster future research in this area†. + +# 1 INTRODUCTION + +Reinforcement learning algorithms can acquire effective policies for a wide range of problems through active online interaction, such as in robotics (Kober et al., 2013), board games and video games (Tesauro, 1995; Mnih et al., 2013; Vinyals et al., 2019), and recommender systems (Aggarwal et al., 2016). However, this sort of active online interaction is often impractical for real-world problems, where active data collection can be costly (Li et al., 2010), dangerous (Hauskrecht & Fraser, 2000; Kendall et al., 2019), or time consuming (Gu et al., 2017). Batch (or offline) reinforcement learning, has been studied extensively in domains such as healthcare (Thapa et al., 2005; Raghu et al., 2018), recommender systems (Dudík et al., 2014; Theocharous et al., 2015; Swaminathan et al., 2017), education (Mandel et al., 2014), and robotics (Kalashnikov et al., 2018). A major challenge with such methods is the off-policy evaluation (OPE) problem, where one must evaluate the expected performance of policies solely from offline data. This is critical for several reasons, including providing high-confidence guarantees prior to deployment (Thomas et al., 2015), and performing policy improvement and model selection (Bottou et al., 2013; Doroudi et al., 2017). + +The goal of this paper is to provide a standardized benchmark for evaluating OPE methods. Although considerable theoretical (Thomas & Brunskill, 2016; Swaminathan & Joachims, 2015; Jiang & Li, 2015; Wang et al., 2017; Yang et al., 2020) and practical progress (Gilotte et al., 2018; Nie et al., 2019; Kalashnikov et al., 2018) on OPE algorithms has been made in a range of different domains, there are few broadly accepted evaluation tasks that combine complex, high-dimensional problems commonly explored by modern deep reinforcement learning algorithms (Bellemare et al., 2013; Brockman et al., 2016) with standardized evaluation protocols and metrics. Our goal is to provide a set of tasks with a range of difficulty, excercise a variety of design properties, and provide policies with different behavioral patterns in order to establish a standardized framework for comparing OPE algorithms. We put particular emphasis on large datasets, long-horizon tasks, and task complexity to facilitate the development of scalable algorithms that can solve high-dimensional problems. + +Our primary contribution is the Deep Off-Policy Evaluation (DOPE) benchmark. DOPE is designed to measure the performance of OPE methods by 1) evaluating on challenging control tasks with properties known to be difficult for OPE methods, but which occur in real-world scenarios, 2) evaluating across a range of policies with different values, to directly measure performance on policy evaluation, ranking and selection, and 3) evaluating in ideal and adversarial settings in terms of dataset coverage and support. These factors are independent of task difficulty, but are known to have a large impact on OPE performance. To achieve 1, we selected tasks on a set of design principles outlined in Section 3.1. To achieve 2, for each task we include 10 to 96 policies for evaluation and devise an evaluation protocol that measures policy evaluation, ranking, and selection as outlined in Section 3.2. To achieve 3, we provide two domains with differing dataset coverage and support properties described in Section 4. Finally, to enable an easy-to-use research platform, we provide the datasets, target policies, evaluation API, as well as the recorded results of state-of-the-art algorithms (presented in Section 5) as open-source. + +# 2 BACKGROUND + +We briefly review the off-policy evaluation (OPE) problem setting. We consider Markov decision processes (MDPs), defined by a tuple $( S , \mathcal { A } , \mathcal { T } , R , \rho _ { 0 } , \gamma )$ , with state space $s$ , action space $\mathcal { A }$ , transition distribution $\mathcal { T } ( s ^ { \prime } | s , a )$ , initial state distribution $\rho _ { 0 } ( s )$ , reward function $R ( s , a )$ and discount factor $\gamma \in \mathsf { \Gamma } ( 0 , 1 ]$ . In reinforcement learning, we are typically concerned with optimizing or estimating the performance of a policy $\pi ( a | s )$ . + +The performance of a policy is commonly measured by the policy value $V ^ { \pi }$ , defined as the expected sum of discounted rewards: + +$$ +V ^ { \pi } : = \mathbb { E } _ { s _ { 0 } \sim \rho _ { 0 } , s _ { 1 : \infty } , a _ { 0 : \infty } \sim \pi } \left[ \sum _ { { t = 0 } } ^ { \infty } \gamma ^ { t } R ( s _ { t } , a _ { t } ) \right] . +$$ + +If we have access to state and action samples collected from a policy $\pi$ , then we can use the sample mean of observed returns to estimate the value function above. However, in off-policy evaluation we are typically interested in estimating the value of a policy when the data is collected from a separate behavior policy $\pi _ { B } ( a | s )$ . This setting can arise, for example, when data is being generated online from another process, or in the purely offline case when we have a historical dataset. + +![](images/700f87fffedfa36de8d8c27b1ca0fa0c858a4fb539b569c44990ab8b8bfb60e8.jpg) +Figure 1: In Off-Policy Evaluation (top) the goal is to estimate the value of a single policy given only data. Offline Policy Selection (bottom) is a closely related problem: given a set of $_ \mathrm { N }$ policies, attempt to pick the best given only data. + +In this work we consider the latter, purely offline setting. The typical setup for this problem formulation is that we are provided with a discount $\gamma$ , a dataset of trajectories collected from a behavior policy $\mathcal { D } = \{ ( s _ { 0 } , a _ { 0 } , r _ { 0 } , s _ { 1 } , . . . ) \}$ , and optionally the action probabilities for the behavior policy $\pi _ { B } { \left( { { a } _ { t } } | { { s } _ { t } } \right) }$ . In many practical applications, logging action propensities is not possible, for example, when the behavior policy is a mix of ML and hard-coded business logic. For this reason, we focus on the setting without propensities to encourage future work on behavior-agnostic OPE methods. For the methods that require propensities, we estimate the propensities with behavior cloning. + +The objective can take multiple flavors, as shown in Fig. 1. A common task in OPE is to estimate the performance, or value, of a policy $\pi$ (which may not be the same as $\pi _ { B }$ ) so that the estimated value is as close as possible to $V ^ { \pi }$ under a metric such as MSE or absolute error. A second task is to perform policy selection, where the goal is to select the best policy or set of policies out of a group of candidates. This setup corresponds to how OPE is commonly used in practice, which is to find the best performing strategy out of a pool when online evaluation is too expensive to be feasible. + +# 3 DOPE: DEEP OFF-POLICY EVALUATION + +The goal of the Deep Off-Policy Evaluation (DOPE) benchmark is to provide tasks that are challenging and effective measures of progress for OPE methods, yet is easy to use in order to better facilitate research. Therefore, we design our benchmark around a set of properties which are known to be difficult for existing OPE methods in order to gauge their shortcomings, and keep all tasks amenable to simulation in order for the benchmark to be accessible and easy to evaluate. + +# 3.1 TASK PROPERTIES + +We describe our motivating properties for selecting tasks for the benchmark as follows: + +High Dimensional Spaces (H) High-dimensionality is a key-feature in many real-world domains where it is difficult to perform feature engineering, such as in robotics, autonomous driving, and more. In these problems, it becomes challenging to accurately estimate quantities such as the value function without the use of high-capacity models such a neural networks and large datasets with wide state coverage. Our benchmark contains complex continuous-space tasks which exercise these challenges. + +Long Time-Horizon (L) Long time horizon tasks are known to present difficult challenges for OPE algorithms. Some algorithms have difficulty doing credit assignment for these tasks. This can be made worse as the state dimension or action dimension increases. + +Sparse Rewards (R) Sparse reward tasks increase the difficulty of credit assignment and add exploration challenges, which may interact with data coverage in the offline setting. We include a range robotics and navigation tasks which are difficult to solve due to reward sparsity. + +Temporally extended control (T) The ability to make decisions hierarchically is major challenge in many reinforcement learning applications. We include two navigation tasks which require high-level planning in addition to low-level control in order to simulate the difficulty in such problems. + +# 3.2 EVALUATION PROTOCOL + +The goal of DOPE to provide metrics for policy ranking, evaluation and selection. Many existing OPE methods have only been evaluated on point estimates of value such as MSE, but policy selection is an important, practical use-case of OPE. In order to explicitly measure the quality of using OPE for policy selection, we provide a set of policies with varying value, and devise two metrics that measure how well OPE methods can rank policies. + +For each task we include a dataset of logged experiences $\mathcal { D }$ , and a set of policies $\left\{ \pi _ { 1 } , \pi _ { 2 } , . . . , \pi _ { N } \right\}$ with varying values. For each policy, OPE algorithms must use $\mathcal { D }$ to produce an estimate of the policy’s value. For evaluation of these estimates, we provide "ground truth values" $\{ V ^ { \pi _ { 1 } } , V ^ { \pi _ { 2 } } , . . . , V ^ { \pi _ { N } } \}$ that are computed by running the policy for $M \geq 1 0 0 0$ episodes, where the exact value of $M$ is given by the number of episodes needed to lower the error bar on the ground truth values to 0.666. The estimated values are then compared to these ground truth values using three different metrics encompassing both policy evaluation and selection (illustrated in Figure 2; see Appendix A.1 for mathematical definitions). + +![](images/11851548f158ebede726189b9cf558877988ffcb203baa31c41a44eac8b697c7.jpg) +Figure 2: Error is a natural measure for off-policy evaluation. However for policy selection, it is sufficient to (i) rank the policies as measured by rank correlation, or (ii) select a policy with the lowest regret. + +Absolute Error This metric measures estimate accuracy instead of its usefulness for ranking. Error is the most commonly used metric to assess performance of OPE algorithms. We opted to use absolute error instead of MSE to be robust to outliers. + +Regret $@ \mathbf { k }$ This metric measures how much worse the best policies identified by the estimates are than the best policy in the entire set. It is computed by identifying the top- $\mathbf { \nabla \cdot k }$ policies according to the estimated returns. Regret $@ \mathbf { k }$ is the difference between the actual expected return of the best policy in the entire set, and the actual value of the best policy in the top-k set. + +Rank correlation This metric directly measures how well estimated values rank policies, by computing the correlation between ordinal rankings according by the OPE estimates and ordinal rankings according to the ground truth values. + +# 4 DOMAINS + +DOPE contains two domains designed to provide a more comprehensive picture of how well OPE methods perform in different settings. These two domains are constructed using two benchmarks previously proposed for offline reinforcement learning: RL Unplugged (Gulcehre et al., 2020) and D4RL (Fu et al., 2020), and reflect the challenges found within them. + +The DOPE RL Unplugged domain is constrained in two important ways: 1) the data is always generated using online RL training, ensuring there is adequate coverage of the state-action space, and 2) the policies are generated by applying offline RL algorithms to the same dataset we use for evaluation, ensuring that the behavior policy and evaluation policies induce similar state-action distributions. Using it, we hope to understand how OPE methods work as task complexity increases from simple Cartpole tasks to controlling a Humanoid body while controlling for ideal data. + +On the other hand, the DOPE D4RL domain has: 1) data from various sources (including random exploration, human teleoperation, and RL-trained policies with limited exploration), which results in varying levels of coverage of the state-action space, and 2) policies that are generated using online RL algorithms, making it less likely that the behavior and evaluation policies share similar induced state-action distributions. Both of these result in distribution shift which is known to be challenging for OPE methods, even in simple tasks. So, using it we hope to measure how well OPE methods work in more practical data settings. + +# 4.1 DOPE RL UNPLUGGED + +DeepMind Control Suite (Tassa et al., 2018) is a set of control tasks implemented in MuJoCo (Todorov et al., 2012). We consider the subset included in RL Unplugged. This subset includes tasks that cover a range of difficulties. From Cartpole swingup, a simple task with a single degree of freedom, to Humanoid run which involves control of a complex bodies with 21 degrees o freedom. All tasks use the default feature representation of the system state, including proprioceptive information such as joint positions and velocity, and additional sensor information and target position where appropriate. The observation dimension ranges from 5 to 67. + +![](images/84968532df8fece1f619e1d287c427bd7de0a0bda8240af93031ff20b68e1997.jpg) + +Datasets and policies We train four offline RL algorithms (D4PG (Barth-Maron et al., 2018), ABM (Siegel et al., 2020), CRR (Wang et al., 2020) and behavior cloning), varying their hyperparameters. For each algorithm-task-hyperparameter combination, we train an agent with 3 random seeds on the DM Control Suite dataset from RL Unplugged and record policy snapshots at exponentially increasing intervals (after 25k learner steps, 50k, 100K, 200K, etc). Following Gulcehre et al. (2020), we consider a deterministic policy for D4PG and stochastic policies for BC, ABM and CRR. The datasets are taken from the RL Unplugged benchmark, where they were created by training multiple (online) RL agents and collecting both successful and unsuccessful episodes throughout training. All offline RL algorithms are implemented using the Acme framework (Hoffman et al., 2020). + +# 4.2 DOPE D4RL + +Gym-MuJoCo tasks. Gym-MuJoCo consists of several continuous control tasks implemented within the MuJoCo simulator (Todorov et al., 2012) and provided in the OpenAI Gym (Brockman et al., 2016) benchmark for online RL. We include the HalfCheetah, Hopper, Walker2D, and Ant tasks. We include this domain primarily for comparison with past works, as a vast array of popular RL methods have been evaluated and developed on these tasks (Schulman et al., 2015; Lillicrap et al., 2015; Schulman et al., 2017; Fujimoto et al., 2018; Haarnoja et al., 2018). + +
Statisticscartpole swingupcheetah runfinger turn hardfish swimhumanoid runwalker standwalker walkinsert ballmanipulator manipulator insert peg
Dataset size40K300K500K200K3M200K200K1.5M1.5M
State dim.51712246724244444
Action dim.1625216655
Properties-H,LH,LH,LH,LH,LH,LH,L,TH, L,T
Statisticsmaze2dantmazehalfcheetahhopperwalkeranthammerdoorrelocatepen
Dataset size1/2/4M1M1M1M1M1M11K/1M7K/1M10K/1M5K/500K
# datasets1155553333
State dim.42917111711146393945
Action dim.28636826283024
PropertiesTT,RHHHHH,RH,RH,RH,R
+ +![](images/6714f53bf565ea0dfd74bc5362e43ea3fb4200525a2e21d7b8ab73feb9bf0b90.jpg) +Table 1: Task statistics for RLUnplugged tasks (top) and D4RL tasks (bottom). Dataset size is the number of $( s , a , r , s ^ { \prime } )$ tuples. For each dataset, we note the properties it possesses: high dimensional spaces $( \mathbf { H } )$ , long time-horizon $( \mathbf { L } )$ , sparse rewards $\mathbf { ( R ) }$ , temporally extended control (T). +Figure 3: Online evaluation of policy checkpoints for 4 Offline RL algorithms with 3 random seeds. We observe a large degree of variability between the behavior of algorithms on different tasks. Without online evaluation, tuning the hyperparameters (e.g., choice of Offline RL algorithm and policy checkpoint) is challenging. This highlights the practical importance of Offline policy selection when online evaluation is not feasible. See Figure A.7 for additional tasks. + +Gym-MuJoCo datasets and policies. For each task, in order to explore the effect of varying distributions, we include 5 datasets originally proposed by Fu et al. (2020). 3 correspond to different performance levels of the agent – “random”, “medium”, and “expert”. We additionally include a mixture of medium and expert dataset, labeled “medium-expert”, and data collected from a replay buffer until the policy reaches the medium level of performance, labeled “medium-replay”. For policies, we selected 11 policies collected from evenly-spaced snapshots of training a Soft Actor-Critic agent (Haarnoja et al., 2018), which covers a range of performance between random and expert. + +![](images/5ebaf04dbcc5d5329215c6948aac75e01b21eec2cfb583947e099c796f08b7bd.jpg) + +Maze2D and AntMaze tasks. Maze2D and AntMaze are two maze navigation tasks originally proposed in D4RL (Fu et al., 2020). The domain consists of 3 mazes ranging from easy to hard (“umaze”, “medium”, “large”), and two morphologies: a 2D ball in Maze2D and the “Ant” robot of the Gym benchmark in AntMaze. For Maze2D, we provide a less challenging reward computed base on distance to a fixed goal. For the AntMaze environment reward is given only upon reaching the fixed goal. + +![](images/230fb40322661ee9e56fde36f9e0aa6c6498c3d89dda574401938853d0e5e4f4.jpg) + +Maze2D and AntMaze datasets and policies. Datasets for both morphologies consists of undirect data navigating randomly to different goal locations. The datasets for Maze2D are collected by using a high-level planner to command waypoints to a low-level PID controller in order to reach randomly selected goals. The dataset in AntMaze is generated using the same high-level planner, but the lowlevel planner is replaced with a goal-conditioned policy trained to reach arbitrary waypoints. Both of these datasets are generated from non-Markovian policies, as the high-level controller maintains a history of waypoints reached in order to construct a plan to the goal. We provide policies for all environments except “antmaze-large” by taking training snapshots obtained while running the DAPG algorithm (Rajeswaran et al., 2017). Because obtaining high-performing policies for “antmaze-large” was challenging, we instead used imitation learning on a large amount of expert data to generate evaluation policies. This expert data is obtained by collecting additional trajectories that reach the goal using a high-level waypoint planner in conjunction with a low-level goal-conditioned policy (this is the same method as was used to generate the dataset, Sec. 5 (Fu et al., 2020)). + +Adroit tasks. The Adroit domain is a realistic simulation based on the Shadow Hand robot, first proposed by Rajeswaran et al. (2017). There are 4 tasks in this domain: opening a door (“door”), pen twirling (“pen”), moving a ball to a target location (“relocate”), and hitting a nail with a hammer (“hammer”). These tasks all contain sparse rewards and are difficult to learn without demonstrations. + +![](images/a060b287ea06307afdc9142b542fc4ee4111f00969b104002141935214db2b8f.jpg) + +Adroit datasets and policies. We include 3 datasets for each task. The “human” dataset consists of a small amount of human demonstrations performing the task. The “expert” dataset consists of data collected from an expert trained via DAPG (Rajeswaran et al., 2017). Finally, the “cloned” dataset contains a mixture of human demonstrations and data collected from an imitation learning algorithm trained on the demonstrations. For policies, we include 11 policies collected from snapshots while running the DAPG algorithm, which range from random performance to expert performance. + +# 5 BASELINES AND RESULTS + +The goal of our evaluation is two-fold. First, we wish to measure the performance of a variety of existing algorithms to provide baselines and reference numbers for future research. Second, we wish to identify shortcomings in these approaches to reveal promising directions for future research. + +# 5.1 BASELINES + +We selected six methods to evaluate, which cover a variety of approaches that have been explored for the OPE problem. + +Fitted Q-Evaluation (FQE) As in Le et al. (2019), we train a neural network to estimate the value of the evaluation policy $\pi$ by bootstrapping from $Q ( s ^ { \prime } , \pi ( s ^ { \prime } ) )$ . We tried two different implementations, one from Kostrikov & Nachum $( 2 0 2 0 ) ^ { 3 }$ and another from Paine et al. (2020) labeled FQE-L2 and FQE-D respectively to reflect different choices in loss function and parameterization. + +Model-Based (MB) Similar to Paduraru (2007), we train dynamics and reward models on transitions from the offline dataset $\mathcal { D }$ . Our models are deep neural networks trained to maximize the log likelihood of the next state and reward given the current state and action, similar to models from successful model-based RL algorithms (Chua et al., 2018; Janner et al., 2019). We follow the setup detailed in Zhang et al. (2021). We include both the feed-forward and auto-regressive models labeled MB-FF and MB-AR respectively. To evaluate a policy, we compute the return using simulated trajectories generated by the policy under the learned dynamics model. + +Importance Sampling (IS) We perform importance sampling with a learned behavior policy. We use the implementation from Kostrikov & Nachum $( 2 0 2 0 ) ^ { 3 }$ , which uses self-normalized (also known as weighted) step-wise importance sampling (Precup, 2000). Since the behavior policy is not known explicitly, we learn an estimate of it via a max-likelihood objective over the dataset $\mathcal { D }$ , as advocated by Xie et al. (2018); Hanna et al. (2019). In order to be able to compute log-probabilities when the target policy is deterministic, we add artificial Gaussian noise with standard deviation 0.01 for all deterministic target policies. + +![](images/6b07deff82df731588238cb98f45f16473cd5edfe227e22423bbbf9c81785fce.jpg) +Figure 4: DOPE RL Unplugged Mean overall performance of baselines. + +![](images/542ca5444478436600eca9ff64545a7663deac4fdc14cb169fe2abbecbe92520.jpg) +Figure 5: DOPE D4RL Mean overall performance of baselines. + +Doubly-Robust (DR) We perform weighted doubly-robust policy evaluation Thomas & Brunskill (2016) using the implementation of Kostrikov & Nachum (2020)3. Specifically, this method combines the IS technique above with a value estimator for variance reduction. The value estimator is learned using deep FQE with an L2 loss function. More advanced approaches that trade variance for bias exist (e.g., MAGIC (Thomas & Brunskill, 2016)), but we leave implementing them to future work. + +DICE This method uses a saddle-point objective to estimate marginalized importance weights $d ^ { \pi } ( s , a ) / d ^ { \pi _ { B } } ( s , a )$ ; these weights are then used to compute a weighted average of reward over the offline dataset, and this serves as an estimate of the policy’s value in the MDP. We use the implementation from Yang et al. (2020) corresponding to the algorithm BestDICE.4 + +Variational Power Method (VPM) This method runs a variational power iteration algorithm to estimate the importance weights $d ^ { \pi } ( s , a ) / d ^ { \pi _ { B } } ( s , a )$ without the knowledge of the behavior policy. It then estimates the target policy value using weighted average of rewards similar to the DICE method. Our implementation is based on the same network and hyperparameters for OPE setting as in Wen et al. (2020). We further tune the hyper-parameters including the regularization parameter $\lambda$ , learning rates $\alpha \theta$ and $\alpha _ { v }$ , and number of iterations on the Cartpole swingup task using ground-truth policy value, and then fix them for all other tasks. + +# 5.2 RESULTS + +To facilitate aggregate metrics and comparisons between tasks and between DOPE RL Unplugged and DOPE D4RL, we normalize the returns and estimated returns to range between 0 and 1. For each set of policies we compute the worst value $V _ { w o r s t } = m i n \{ V ^ { \pi _ { 1 } } , V ^ { \pi _ { 2 } } , . . . , V ^ { \pi _ { N } } \}$ and best value $V _ { b e s t } = m a x \{ V ^ { \pi _ { 1 } } , V ^ { \pi _ { 2 } } , . . . , V ^ { \pi _ { N } } \}$ and normalize the returns and estimated returns according to $x ^ { \prime } = ( x - V _ { w o r s t } ) / ( V _ { b e s t } - V _ { w o r s t } )$ . + +We present results averaged across DOPE RL Unplugged in Fig. 4, and results for DOPE D4RL in Fig. 5. Overall, no evaluated algorithm attains near-oracle performance under any metric (absolute error, regret, or rank correlation). Because the dataset is finite, we do not expect that achieving oracle performance is possible. Nevertheless, based on recent progress on this benchmark (e.g., Zhang et al. (2021)), we hypothesize that the benchmark has room for improvement, making it suitable for driving further improvements on OPE methods and facilitating the development of OPE algorithms that can provide reliable estimates on the types of high-dimensional problems that we consider. + +While all algorithms achieve sub-optimal performance, some perform better than others. We find that on the DOPE RL Unplugged tasks model based (MB-AR, MB-FF) and direct value based methods (FQE-D, FQE-L2) significantly outperform importance sampling methods (VPM, DICE, IS) across all metrics. This is somewhat surprising as DICE and VPM have shown promising results in other settings. We hypothesize that this is due to the relationship between the behavior data and evaluation policies, which is different from standard OPE settings. Recall that in DOPE RL Unplugged the behavior data is collected from an online RL algorithm and the evaluation policies are learned via offline RL from the behavior data. In our experience all methods work better when the behavior policy is a noisy/perturbed version of the evaluation policy. Moreover, MB and FQE-based methods may implicitly benefit from the architectural and optimization advancements made in policy optimization settings, which focus on similar environments and where these methods are more popular than importance sampling approaches. Note that within the MB and FQE methods, design details can create a significant difference in performance. For example model architecture (MB-AR vs MB-FF) and implementation differences (FQE-D vs FQE-L2) show differing performance on certain tasks. + +![](images/59bf833b107ef1d31a150045d7e13ac9e40e4d9b9cbc89b4c573185ea8deff70.jpg) +Figure 6: Rank correlation for each baseline algorithm for each RL Unplugged task considered. + +![](images/3af2dbbd351bfeda6415b37cb655672a0ea43e6e378379836703f9c249726a6e.jpg) +Figure 7: Scatter plots of estimate vs ground truth return for MB-AR and FQE-D on selected tasks. + +On DOPE D4RL, direct value based methods still do well, with FQE-L2 performing best on the Absolute Error and Regret $@ 1$ metrics. However, there are cases where other methods outperform FQE. Notably, IS and DR outperform FQE-L2 under the rank correlation metric. As expected, there is a clear performance gap between DOPE RL Unplugged and DOPE D4RL. While both domains have challenging tasks, algorithms perform better under the more ideal conditions of DOPE RL Unplugged than under the challenging conditions of DOPE D4RL (0.69 vs 0.25 rank correlation respectively). + +In Fig. A.2 we show the rank correlation for each task in DOPE RL Unplugged. Most tasks follow the overall trends, but we will highlight a few exceptions. 1) Importance sampling is among the best methods for the humanoid run task, significantly outperforming direct value-based methods. 2) while MB-AR and FQE-D are similar overall, there are a few tasks where the difference is large, for example FQE-D outperfroms MB-AR on finger turn hard, and manipulator insert ball, where as MB-AR outperforms FQE-D on cartpole swingup, fish swim, humanoid run, and manipulator insert peg. We show the scatter plots for MB-AR and FQE-D on these tasks in Fig 7 which highlights different failure modes: when MB-AR performs worse, it assigns similar values for all policies; when FQE-D performs worse, it severely over-estimates the values of poor policies. + +We present more detailed results, separated by task, in Appendix A.2. Note in particular how in Table A.2.2, which shows the regret $@ 1$ metric for different D4RL tasks, the particular choice of dataset for the Gym-MuJoCo, Adroit, and AntMaze domains causes a significant difference in the performance of OPE methods. This indicates the importance of evaluating multiple distinct datasets, with different data distribution properties (e.g., more narrow datasets, such as expert data, vs. broader datasets, such as random data), as no tested method is reliably robust to the effects of dataset variation. + +High-dimensional tasks requiring temporally extended control were also challenging, as highlighted by the performance on the AntMaze domain. No algorithm was able to achieve a good absolute error value on such tasks, and importance sampling was the only method able to achieve a correlation consistently above zero, suggesting that these more complex tasks are a particularly important area for future methods to focus on. + +# 6 RELATED WORK + +Off-policy evaluation (OPE) has been studied extensively across a range of different domains, from healthcare (Thapa et al., 2005; Raghu et al., 2018; Nie et al., 2019), to recommender systems (Li et al., 2010; Dudík et al., 2014; Theocharous et al., 2015), and robotics (Kalashnikov et al., 2018). While a full survey of OPE methods is outside the scope of this article, broadly speaking we can categories OPE methods into groups based the use of importance sampling (Precup, 2000), value functions (Sutton et al., 2009; Migliavacca et al., 2010; Sutton et al., 2016; Yang et al., 2020), and learned transition models (Paduraru, 2007), though a number of methods combine two or more of these components (Jiang & Li, 2015; Thomas & Brunskill, 2016; Munos et al., 2016). A significant body of work in OPE is also concerned with providing statistical guarantees (Thomas et al., 2015). Our focus instead is on empirical evaluation – while theoretical analysis is likely to be a critical part of future OPE research, combining such analysis with empirical demonstration on broadly accepted and standardized benchmarks is likely to facilitate progress toward practically useful algorithms. + +Current evaluation of OPE methods is based around several metrics, including error in predicting the true return of the evaluated policy (Voloshin et al., 2019), correlation between the evaluation output and actual returns (Irpan et al., 2019), and ranking and model selection metrics (Doroudi et al., 2017). As there is no single accepted metric used by the entire community, we provide a set of candidate metrics along with our benchmark, with a detailed justification in Section 5. Our work is closely related to (Paine et al., 2020) which studies OPE in a similar setting, however in our work we present a benchmark for the community and compare a range of OPE methods. Outside of OPE, standardized benchmark suites have led to considerable standardization and progress in RL (Stone & Sutton, 2001; Dutech et al., 2005; Riedmiller et al., 2007). The Arcade Learning Environment (ALE) (Bellemare et al., 2013) and OpenAI Gym (Brockman et al., 2016) have been widely used to compare online RL algorithms to good effect. More recently, Gulcehre et al. (2020); Fu et al. (2020) proposed benchmark tasks for offline RL. Our benchmark is based on the tasks and environments described in these two benchmarks, which we augment with a set of standardized policies for evaluation, results for a number of existing OPE methods, and standardized evaluation metrics and protocols. Voloshin et al. (2019) have recently proposed benchmarking for OPE methods on a variety of tasks ranging from tabular problems to image-based tasks in Atari. Our work differs in several key aspects. Voloshin et al. (2019) is composed entirely of discrete action tasks, whereas out benchmark focuses on continuous action tasks. Voloshin et al. (2019) assumes full support for the evaluation policy under the behavior policy data, whereas we designed our datasets and policies to ensure that different cases of dataset and policy distributions could be studied. Finally, all evaluations in Voloshin et al. (2019) are performed using the MSE metric, and they do not provide standardized datasets. In contrast, we provide a variety of policies for each problem which enables one to evaluate metrics such as ranking for policy selection, and a wide range of standardized datasets for reproducbility. + +# 7 CONCLUSION + +We have presented the Deep Off-Policy Evaluation (DOPE) benchmark, which aims to provide a platform for studying policy evaluation and selection across a wide range of challenging tasks and datasets. In contrast to prior benchmarks, DOPE provides multiple datasets and policies, allowing researchers to study how data distributions affect performance and to evaluate a wide variety of metrics, including those that are relevant for offline policy selection. In comparing existing OPE methods, we find that no existing algorithms consistently perform well across all of the tasks, which further reinforces the importance of standardized and challenging OPE benchmarks. Moreover, algorithms that perform poorly under one metric, such as absolute error, may perform better on other metrics, such as correlation, which provides insight into what algorithms to use depending on the use case (e.g., policy evaluation vs. policy selection). + +We believe that OPE is an exciting area for future research, as it allows RL agents to learn from large and abundant datasets in domains where online RL methods are otherwise infeasible. We hope that our benchmark will enable further progress in this field, though important evaluation challenges remain. As the key benefit of OPE is the ability to utilize real-world datasets, a promising direction for future evaluation efforts is to devise effective ways to use such data, where a key challenge is to develop evaluation protocols that are both reproducible and accessible. This could help pave the way towards developing intelligent decision making agents that can leverage vast banks of logged information to solve important real-world problems. + +# REFERENCES + +Charu C Aggarwal et al. Recommender systems, volume 1. Springer, 2016. + +Gabriel Barth-Maron, Matthew W. Hoffman, David Budden, Will Dabney, Dan Horgan, Dhruva TB, Alistair Muldal, Nicolas Heess, and Timothy Lillicrap. Distributional policy gradients. In International Conference on Learning Representations, 2018. + +Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253–279, 2013. + +Léon Bottou, Jonas Peters, Joaquin Quiñonero-Candela, Denis X Charles, D Max Chickering, Elon Portugaly, Dipankar Ray, Patrice Simard, and Ed Snelson. Counterfactual reasoning and learning systems: The example of computational advertising. The Journal of Machine Learning Research, 14(1):3207–3260, 2013. + +Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016. + +Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. In Advances in Neural Information Processing Systems, pp. 4754–4765, 2018. + +Shayan Doroudi, Philip S Thomas, and Emma Brunskill. Importance sampling for fair policy selection. Grantee Submission, 2017. + +Miroslav Dudík, Dumitru Erhan, John Langford, Lihong Li, et al. Doubly robust policy evaluation and optimization. Statistical Science, 29(4):485–511, 2014. + +Alain Dutech, Timothy Edmunds, Jelle Kok, Michail Lagoudakis, Michael Littman, Martin Riedmiller, Bryan Russell, Bruno Scherrer, Richard Sutton, Stephan Timmer, et al. Reinforcement learning benchmarks and bake-offs ii. Advances in Neural Information Processing Systems (NIPS), 17:6, 2005. + +Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020. + +Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actorcritic methods. In International Conference on Machine Learning, pp. 1587–1596, 2018. + +Alexandre Gilotte, Clément Calauzènes, Thomas Nedelec, Alexandre Abraham, and Simon Dollé. Offline a/b testing for recommender systems. In Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining, pp. 198–206, 2018. + +Shixiang Gu, Ethan Holly, Timothy Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. In 2017 IEEE international conference on robotics and automation (ICRA), pp. 3389–3396. IEEE, 2017. + +Caglar Gulcehre, Ziyu Wang, Alexander Novikov, Tom Le Paine, Sergio Gómez Colmenarejo, Konrad Zolna, Rishabh Agarwal, Josh Merel, Daniel Mankowitz, Cosmin Paduraru, et al. Rl unplugged: Benchmarks for offline reinforcement learning. arXiv preprint arXiv:2006.13888, 2020. + +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. + +Josiah Hanna, Scott Niekum, and Peter Stone. Importance sampling policy evaluation with an estimated behavior policy. In International Conference on Machine Learning, pp. 2605–2613. PMLR, 2019. + +Milos Hauskrecht and Hamish Fraser. Planning treatment of ischemic heart disease with partially observable markov decision processes. Artificial Intelligence in Medicine, 18(3):221–244, 2000. + +Matt Hoffman, Bobak Shahriari, John Aslanides, Gabriel Barth-Maron, Feryal Behbahani, Tamara Norman, Abbas Abdolmaleki, Albin Cassirer, Fan Yang, Kate Baumli, et al. Acme: A research framework for distributed reinforcement learning. arXiv preprint arXiv:2006.00979, 2020. + +Alexander Irpan, Kanishka Rao, Konstantinos Bousmalis, Chris Harris, Julian Ibarz, and Sergey Levine. Off-policy evaluation via off-policy classification. In Advances in Neural Information Processing Systems, pp. 5437–5448, 2019. + +Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Model-based policy optimization. In Advances in Neural Information Processing Systems, pp. 12519–12530, 2019. + +Nan Jiang and Lihong Li. Doubly robust off-policy value evaluation for reinforcement learning. arXiv preprint arXiv:1511.03722, 2015. + +Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. Qt-opt: Scalable deep reinforcement learning for vision-based robotic manipulation. arXiv preprint arXiv:1806.10293, 2018. + +Alex Kendall, Jeffrey Hawke, David Janz, Przemyslaw Mazur, Daniele Reda, John-Mark Allen, Vinh-Dieu Lam, Alex Bewley, and Amar Shah. Learning to drive in a day. In 2019 International Conference on Robotics and Automation (ICRA), pp. 8248–8254. IEEE, 2019. + +Jens Kober, J Andrew Bagnell, and Jan Peters. Reinforcement learning in robotics: A survey. The International Journal of Robotics Research, 32(11):1238–1274, 2013. + +Ilya Kostrikov and Ofir Nachum. Statistical bootstrapping for uncertainty estimation in off-policy evaluation, 2020. + +Hoang M Le, Cameron Voloshin, and Yisong Yue. Batch policy learning under constraints. arXiv preprint arXiv:1903.08738, 2019. + +Lihong Li, Wei Chu, John Langford, and Robert E Schapire. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th international conference on World wide web, pp. 661–670, 2010. + +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. + +Travis Mandel, Yun-En Liu, Sergey Levine, Emma Brunskill, and Zoran Popovic. Offline policy evaluation across representations with applications to educational games. In AAMAS, pp. 1077– 1084, 2014. + +Martino Migliavacca, Alessio Pecorino, Matteo Pirotta, Marcello Restelli, and Andrea Bonarini. Fitted policy search: Direct policy search using a batch reinforcement learning approach. In 3rd International Workshop on Evolutionary and Reinforcement Learning for Autonomous Robot Systems (ERLARS 2010), pp. 35. Citeseer, 2010. + +Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. In NIPS Deep Learning Workshop. 2013. + +Rémi Munos, Tom Stepleton, Anna Harutyunyan, and Marc G. Bellemare. Safe and efficient off-policy reinforcement learning. arXiv preprint arXiv:1606.02647, 2016. + +Xinkun Nie, Emma Brunskill, and Stefan Wager. Learning when-to-treat policies. arXiv preprint arXiv:1905.09751, 2019. + +Cosmin Paduraru. Planning with approximate and learned models of markov decision processes. 2007. + +Tom Le Paine, Cosmin Paduraru, Andrea Michi, Caglar Gulcehre, Konrad Zolna, Alexander Novikov, Ziyu Wang, and Nando de Freitas. Hyperparameter selection for offline reinforcement learning. arXiv preprint arXiv:2007.09055, 2020. + +Doina Precup. Eligibility traces for off-policy policy evaluation. Computer Science Department Faculty Publication Series, pp. 80, 2000. + +Aniruddh Raghu, Omer Gottesman, Yao Liu, Matthieu Komorowski, Aldo Faisal, Finale Doshi-Velez, and Emma Brunskill. Behaviour policy estimation in off-policy policy evaluation: Calibration matters. arXiv preprint arXiv:1807.01066, 2018. + +Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, Giulia Vezzani, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. arXiv preprint arXiv:1709.10087, 2017. + +Martin Riedmiller, Jan Peters, and Stefan Schaal. Evaluation of policy gradient methods and variants on the cart-pole benchmark. In 2007 IEEE International Symposium on Approximate Dynamic Programming and Reinforcement Learning, pp. 254–261. IEEE, 2007. + +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. + +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. + +Noah Y Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, and Martin Riedmiller. Keep doing what worked: Behavioral modelling priors for offline reinforcement learning. In International Conference on Learning Representations, 2020. + +Peter Stone and Richard S Sutton. Scaling reinforcement learning toward robocup soccer. In Icml, volume 1, pp. 537–544. Citeseer, 2001. + +Richard S Sutton, Hamid Reza Maei, Doina Precup, Shalabh Bhatnagar, David Silver, Csaba Szepesvári, and Eric Wiewiora. Fast gradient-descent methods for temporal-difference learning with linear function approximation. In Proceedings of the 26th Annual International Conference on Machine Learning, pp. 993–1000, 2009. + +Richard S Sutton, A Rupam Mahmood, and Martha White. An emphatic approach to the problem of off-policy temporal-difference learning. The Journal of Machine Learning Research, 17(1): 2603–2631, 2016. + +Adith Swaminathan and Thorsten Joachims. Counterfactual risk minimization: Learning from logged bandit feedback. In International Conference on Machine Learning, pp. 814–823, 2015. + +Adith Swaminathan, Akshay Krishnamurthy, Alekh Agarwal, Miro Dudik, John Langford, Damien Jose, and Imed Zitouni. Off-policy evaluation for slate recommendation. In Advances in Neural Information Processing Systems, pp. 3632–3642, 2017. + +Gerald Tesauro. Temporal difference learning and td-gammon. Communications of the ACM, 38(3): 58–68, 1995. + +Devinder Thapa, In-Sung Jung, and Gi-Nam Wang. Agent based decision support system using reinforcement learning under emergency circumstances. In International Conference on Natural Computation, pp. 888–892. Springer, 2005. + +Georgios Theocharous, Philip S Thomas, and Mohammad Ghavamzadeh. Personalized ad recommendation systems for life-time value optimization with guarantees. In Twenty-Fourth International Joint Conference on Artificial Intelligence, 2015. + +Philip Thomas and Emma Brunskill. Data-efficient off-policy policy evaluation for reinforcement learning. In International Conference on Machine Learning, pp. 2139–2148, 2016. + +Philip S Thomas, Georgios Theocharous, and Mohammad Ghavamzadeh. High-confidence off-policy evaluation. In Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015. + +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. + +Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in starcraft ii using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019. + +Cameron Voloshin, Hoang M Le, Nan Jiang, and Yisong Yue. Empirical study of off-policy policy evaluation for reinforcement learning. arXiv preprint arXiv:1911.06854, 2019. + +Yu-Xiang Wang, Alekh Agarwal, and Miroslav Dudık. Optimal and adaptive off-policy evaluation in contextual bandits. In International Conference on Machine Learning, pp. 3589–3597. PMLR, 2017. + +Ziyu Wang, Alexander Novikov, Konrad Zołna, Jost Tobias Springenberg, Scott Reed, Bobak ˙ Shahriari, Noah Siegel, Josh Merel, Caglar Gulcehre, Nicolas Heess, and Nando de Freitas. Critic regularized regression. arXiv preprint arXiv:2006.15134, 2020. + +Junfeng Wen, Bo Dai, Lihong Li, and Dale Schuurmans. Batch stationary distribution estimation. arXiv preprint arXiv:2003.00722, 2020. + +Yuan Xie, Boyi Liu, Qiang Liu, Zhaoran Wang, Yuan Zhou, and Jian Peng. Off-policy evaluation and learning from logged bandit feedback: Error reduction via surrogate policy. arXiv preprint arXiv:1808.00232, 2018. + +Mengjiao Yang, Ofir Nachum, Bo Dai, Lihong Li, and Dale Schuurmans. Off-policy evaluation via the regularized lagrangian. arXiv preprint arXiv:2007.03438, 2020. + +Michael R Zhang, Thomas Paine, Ofir Nachum, Cosmin Paduraru, George Tucker, ziyu wang, and Mohammad Norouzi. Autoregressive dynamics models for offline policy evaluation and optimization. In International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ kmqjgSNXby. + +# A APPENDIX + +# A.1 METRICS + +The metrics we use in our paper are defined as follows: + +Absolute Error We evaluate policies using absolute error in order to be robust to outliers. The absolute error is defined as the difference between the value and estimated value of a policy: + +$$ +\mathrm { A b s E r r } = | V ^ { \pi } - \hat { V } ^ { \pi } | +$$ + +Where $V ^ { \pi }$ is the true value of the policy, and ${ \hat { V } } ^ { \pi }$ is the estimated value of the policy. + +Regret $@ \mathbf { k }$ Regret $@ \mathbf { k }$ is the difference between the value of the best policy in the entire set, and the value of the best policy in the top- $\mathbf { \nabla } \cdot \mathbf { k }$ set (where the top- $\mathbf { \nabla } \cdot \mathbf { k }$ set is chosen by estimated values). It can be defined as: + +$$ +{ \mathrm { R e g r e t } } \ @ { \mathrm { k } } = \operatorname* { m a x } _ { i \in 1 : N } V _ { i } ^ { \pi } - \operatorname* { m a x } _ { j \in { \mathrm { t o p k } } ( 1 : N ) } V _ { j } ^ { \pi } +$$ + +Where $\mathrm { t o p k } ( 1 : N )$ denotes the indices of the top $\mathbf { K }$ policies as measured by estimated values ${ \hat { V } } ^ { \pi }$ + +Rank correlation Rank correlation (also Spearman’s $\rho$ ) measures the correlation between the ordinal rankings of the value estimates and the true values. It can be written as: + +$$ +\mathrm { R a n k C o r r } = { \frac { \mathrm { C o v } ( V _ { 1 : N } ^ { \pi } , \hat { V } _ { 1 : N } ^ { \pi } ) } { \sigma ( V _ { 1 : N } ^ { \pi } ) \sigma ( \hat { V } _ { 1 : N } ^ { \pi } ) } } +$$ + +# A.2 DETAILED RESULTS + +Detailed results figures and tables are presented here. We show results by task in both tabular and chart form, as well as scatter plots which compare the estimated returns against the ground truth returns for every policy. + +# A.2.1 CHART RESULTS + +First we show the normalized results for each algorithm and task. + +![](images/8ff4364835b59575c4bab1f0423f6308e86c50cd02bbe08c7a89e003fd9f1069.jpg) +Figure A.1: Absolute error for each baseline algorithm for each RL Unplugged task considered. + +![](images/485ca075b1658539cd32f00ae7f327dd7d4a06528b953cfe8fd1706684e1505f.jpg) +Figure A.2: Rank correlation for each baseline algorithm for each RL Unplugged task considered. + +![](images/189bb4cdd710c279f5f72357dbf116f2c92c751c39499233c3dbb5511ad3211a.jpg) +Figure A.3: Regret $@ 1$ for each baseline algorithm for each RL Unplugged task considered. + +![](images/302d93007761a975655e56294eb45c6cf3cc5e3e2cdf9e2ba932b5d32576ed78.jpg) +Figure A.4: Absolute error for each baseline algorithm for each D4RL task domain considered. + +![](images/f14447e37cd7898fc1e9ceecef71a88cd525f73d5002fa2c3ae541684ae3eaa3.jpg) +Figure A.5: Rank correlation for each baseline algorithm for each D4RL task domain considered. + +![](images/038611844c687a4593ffbbe7920420665a87be89fcb5f263c532031ab813b385.jpg) +Figure A.6: Regret $@ 1$ for each baseline algorithm for each D4RL task domain considered. + +![](images/7b266cd217f7285dc0e6999fe1505a7bd9a90d9a73443f625ce28e6f3e281ad2.jpg) +Figure A.7: Online evaluation of policy checkpoints for 4 Offline RL algorithms with 3 random seeds. We observe a large degree of variability between the behavior of algorithms on different tasks. + +# A.2.2 TABULAR RESULTS + +Next, we present the results for each task and algorithm in tabular form, with means and standard deviations reported across 3 seeds. + +Table A.1: Average absolute error between OPE metrics and ground truth values at a discount factor of 0.995 In each column, absolute error values that are not significantly different from the best $( p > 0 . 0 5 )$ are bold faced. Methods are ordered by median. + +
Cartpole swingupCheetah runFinger turn hardFish swimHumanoid run
Aahilreteirrerrt inVariational power method37.53 ±3.5061.89 ±4.2546.22 ±3.9331.27 ±0.9935.29 ±3.03
Importance Sampling68.75 ±2.3944.29 ±1.9190.10 ±4.6834.82±1.9327.89 ±1.98
puno.8Best DICE22.73 ±1.6523.35 ±1.3233.52 ±3.4859.48 ±2.4731.42 ±2.04
Model based - FF6.80±0.8513.64±0.5935.99 ±3.004.75±0.2330.12 ±2.40
FQE (L2)19.02 ±1.3448.26 ±1.7827.91 ±1.1819.82 ±1.5756.28 ±3.52
pne doDoubly Robust (IS,FQE)24.38 ±2.5140.27 ±2.0525.26 ±2.4820.28±1.9053.64±3.68
FQE (distributional)12.63±1.2136.50 ±1.6210.23 ±0.937.76±0.9532.36 ±2.27
Model based - AR5.32 ±0.544.64±0.4622.93 ±1.724.31±0.2220.95 ±1.61
Walker standWalker walkManipulator insert ballManipulator insert pegMedian ↓
Ahh irreirritit nann punon pueVariational power method96.76 ±3.5987.24 ±4.2579.25 ±6.1921.95 ±1.1746.22
Importance Sampling66.50 ±1.9067.24±2.7029.93±1.1012.78 ±0.6644.29
Best DICE27.58 ±3.0147.28±3.13103.45 ±5.2122.75 ±3.0031.42
Model based - FF23.34 ±2.4152.23 ±2.3434.30 ±2.55121.12 ±1.5830.12
FQE (L2)6.51±0.7118.34 ±0.9536.32 ±1.0731.12 ±2.3727.91
Doubly Robust (IS,FQE)26.82 ±2.6624.63 ±1.6913.33 ±1.1622.28 ±2.3424.63
PEFQE (distributional)21.49 ±1.4127.57 ±1.549.75±1.1012.66 ±1.3912.66
Model based - AR19.12 ±1.235.14±0.4917.13 ±1.349.71±0.709.71
+ +Table A.2: Spearman’s rank correlation $( \rho )$ coefficient (bootstrap mean $\pm$ standard deviation) between different OPE metrics and ground truth values at a discount factor of 0.995. In each column, rank correlation coefficients that are not significantly different from the best $( p > 0 . 0 5 )$ are bold faced. Methods are ordered by median. Also see Table A.3 and Table A.1 for Normalized Regret $\textcircled { \omega } 5$ and Average Absolute Error results. + +
Cartpole swingupCheetah runFinger turn hardFish swimHumanoid run
rg ernreetiretr Yinn punoImportance Sampling-0.23 ±0.11-0.01 ±0.12-0.45±0.08-0.17 ±0.110.91 ±0.02
Best DICE-0.16 ±0.110.07 ±0.11-0.22 ±0.110.44±0.09-0.10 ±0.10
Variational power method0.01±0.110.01 ±0.12-0.25 ±0.110.56±0.080.36 ±0.09
Doubly Robust (IS,FQE)0.55±0.090.56±0.080.67 ±0.050.11±0.12-0.03±0.12
Model based -FF0.83±0.050.64±0.080.08 ±0.110.95 ±0.020.35±0.10
Ppg daFQE (distributional)0.69 ±0.070.67 ±0.060.94±0.010.59±0.100.74±0.06
FQE (L2)0.70±0.070.56±0.080.83±0.040.10±0.12-0.02 ±0.12
Model based -AR0.91±0.020.74±0.070.57 ±0.090.96±0.010.90 ±0.02
Walker standWalker walkManipulator insert ballManipulator insert pegMedian ↑
rgh eneeetrrrer nnn punorn pregImportance Sampling0.59±0.080.38±0.10-0.72±0.05-0.25 ±0.08-0.17
Best DICE-0.11±0.12-0.58 ±0.080.19 ±0.11-0.35±0.10-0.11
Variational power method-0.35±0.10-0.10±0.110.61±0.080.41±0.090.01
Doubly Robust (IS,FQE)0.88±0.030.85±0.040.42 ±0.10-0.47±0.090.55
Model based -FF0.82±0.040.80±0.050.06±0.10-0.56 ±0.080.64
FQE (distributional)0.87±0.020.89 ±0.030.63±0.08-0.23 ±0.100.69
0FQE (L2)0.96±0.010.94±0.020.70 ±0.07-0.48±0.080.70
Model Based -AR0.96±0.010.98±0.00-0.33±0.090.47 ±0.090.90
+ +
Cartpole swingupCheetah runFinger turn hardFish swimHumanoid run
pin punon'sa gdoImportance Sampling0.73±0.160.40 ±0.210.64±0.050.12 ±0.050.31±0.09
Best DICE0.68 ±0.410.27±0.050.44±0.040.35 ±0.240.84±0.22
Variational power method0.50±0.130.37 ±0.040.45 ±0.130.02 ±0.020.56 ±0.08
Doubly Robust (IS,FQE)0.28±0.050.09 ±0.050.56±0.120.61±0.120.99 ±0.00
FQE (L2)0.06±0.040.17±0.050.30±0.110.50±0.030.99 ±0.00
PrreeereerModel based - FF0.02±0.020.24±0.120.43±0.040.00±0.000.44±0.02
FQE (distributional)0.03±0.090.11 ±0.090.10±0.120.49 ±0.060.24±0.15
Model based -AR0.00±0.020.01±0.020.63±0.110.03±0.020.32 ±0.06
Walker standWalker walkManipulator insert ballManipulator insert pegMedian ↓
nn punon oeeeeeerImportance Sampling0.54 ±0.110.54±0.230.83±0.050.22 ±0.030.54
Best DICE0.24±0.070.55±0.060.44±0.070.75 ±0.040.44
Variational power method0.41±0.020.39 ±0.020.52 ±0.200.32±0.020.41
Doubly Robust (IS,FQE)0.02±0.010.05 ±0.070.30±0.100.73±0.010.30
FQE (L2)0.04±0.020.00±0.020.37 ±0.070.74±0.010.30
'OATTSModel based - FF0.18±0.100.03±0.050.83±0.060.74±0.010.24
FQE (distributional)0.03±0.030.01±0.020.50±0.300.73±0.010.11
Model based - AR0.04±0.020.04±0.020.85±0.020.30±0.040.04
+ +Table A.3: Normalized Regret $\textcircled { \omega } 5$ (bootstrap mean $\pm$ standard deviation) for OPE methods vs. ground truth values at a discount factor of 0.995. In each column, normalized regret values that are not significantly different from the best $( p > 0 . 0 5 )$ are bold faced. Methods are ordered by median. + +
Halfcheetah expertHalfcheetah mediumHalfcheetah medium-expertHalfcheetah medium-replayHalfcheetah random
VPM1404±152 945±1641217±1231400±1461409 ±1541405±155
Best DICE944±1611374±153 1382±1301427 ±1111384±1481411±154
Doubly Robust 1025 ±951222±1341078±1321440±1581446 ±156
JA'qIFQE (L2)1031±951211 ±1301015 ±103 1014±1011001±129 1003±132949 ±126
938±125
ISAntmaze large-diverseAntmaze large-playAntmaze medium-diverseAntmaze medium-playAntmaze umaze
JA'iI0.62±0.010.85±0.000.55 ±0.010.81±0.000.62 ±0.04
VPM Best DICE0.02±0.02 5.55 ±0.360.26±0.24 19.62 ±1.280.07±0.05 2.42 ±1.560.11±0.06 19.47 ±2.150.12±0.03 14.97 ±1.93
Doubly Robust0.99 ±0.011.59 ±0.010.61±0.031.47 ±0.010.87±0.04
FQE (L2)0.53±0.010.78±0.000.29 ±0.010.71±0.010.39±0.03
AntmazeDoorDoor
umaze-diverseDoor clonedexperthumanHammer cloned
IS0.14±0.02
JAt'S5IVPM0.12 ±0.03891±188648±122 879±182870±173 862±1637403 ±1126 7459 ±1114
Best DICE0.17±0.041040 ±188 697±79856±1341108±1994169 ±839
Doubly Robust0.11±0.02424±731353±218379±656101±679
FQE (L2)0.11±0.03438±811343 ±84389±605415 ±558
HammerHammerMaze2dMaze2dMaze2d
ISexperthumanlargemediumumaze
JAI'qI3052 ±6087352 ±111845.61±10.4361.29 ±7.7850.20±9.16
VPM Best DICE7312 ±11177105±110744.10 ±10.6960.30±8.3762.81±8.40
3963 ±758 Doubly Robust 3485 ±5905677±93642.46±9.66 22.94±6.8258.97 ±9.57 23.64±4.9621.95 ±4.69
FQE (L2)2950±7285768 ±751 6000 ±61224.31 ±6.5635.11 ±6.3376.93 ±4.42 79.67 ±4.93
PenPenPenRelocateRelocate
ISclonedexperthumanclonedexpert
JAAtiI1707±1284547 ±2223926±128632 ±2152731±147
VPM2324±1292325±1361569±215586±135
Best DICE1454±2194193 ±244620±214
2963±2792846±2001347 ±4851095 ±221
Doubly Robust 1323 ±982013±5642872±170412±1241193 ±350
FQE (L2)1232 ±1051057 ±281439 ±1251351±393
RelocateAntAntAntAnt
humanexpertmediummedium-expert medium-replay
IS
638 ±217605±104594±104604±102603±101
VPM806±166607 ±108570±109604±106612±105
JA'SqIBest DICE4526 ±474558±108495 ±90471±100583±110
Doubly Robust606±116584±114345 ±66326±66421±72
FQE (L2)593±113583±122345 ±64319 ±67410±79
AntHopperHopperHopperWalker2d
randomexpertmediumrandomexpert
JA'qI IS606±103106±29405 ±48412±45405 ±62
VPM570±99442 ±43433±44438±44367±68
Best DICE530±92259±54215±41122 ±16437 ±60
Doubly Robust404±106426 ±99307±85289±50519±179
FQE (L2)398±111282±76283±73261±42453±142
Walker2dWalker2dWalker2dWalker2dMedian
mediummedium-expertmedium-replayrandom
IS JA.'iI428±60436 ±62427±60430 ±61603.82
VPM426±60425 ±61424±64440±58585.53
Best DICE273±31322±60374±51419 ±57530.43
368±74217 ±46296±54347±74411.99
Doubly Robust FQE (L2)
Halfcheetah expertHalfcheetah medium-expertHalfcheetah medium-replayHalfcheetah randomDoor cloned
Rr rrrBest DICE-0.44 ±0.30-0.08±0.35-0.15 ±0.41-0.70 ±0.220.18 ±0.31
VPM0.18±0.35-0.47 ±0.29-0.07±0.360.27±0.36-0.29±0.36
FQE (L2)0.78±0.150.62±0.270.26±0.37-0.11 ±0.410.55 ±0.27
IS0.01±0.35-0.06±0.370.59 ±0.26-0.24±0.360.66±0.22
Doubly Robust0.77 ±0.170.62 ±0.270.32 ±0.37-0.02 ±0.380.60±0.28
DoorHammerHammerMaze2dMaze2d
expertclonedexpertlargemedium
Rar rarrBest DICE-0.06±0.320.35 ±0.38-0.42 ±0.310.56±0.21-0.64±0.23
VPM0.65 ±0.23-0.77 ±0.220.39 ±0.31-0.26 ±0.33-0.05±0.39
FQE (L2)0.89 ±0.09-0.15±0.330.29 ±0.340.30±0.360.16±0.38
IS0.76±0.170.58 ±0.270.64±0.240.63 ±0.190.44±0.25
Doubly Robust0.76±0.13-0.70±0.200.49 ±0.310.31±0.360.41 ±0.35
PenRelocateAntAntAnt
expertexpertexpertmediummedium-expert
Rrr rrerBest DICE-0.53±0.30-0.27±0.34-0.13±0.37-0.36±0.28-0.33±0.40
VPM0.08±0.330.39 ±0.31-0.42 ±0.38-0.20±0.31-0.28±0.28
FQE (L2)-0.01 ±0.33-0.57 ±0.28-0.13±0.320.65±0.250.37 ±0.35
IS-0.45 ±0.310.52 ±0.230.14±0.41-0.17 ±0.32-0.21 ±0.35
Doubly Robust0.52±0.28-0.40±0.24-0.28 ±0.320.66±0.260.35 ±0.35
AntAntHopperHopperHopper
medium-replayrandomexpertmediumrandom
Best DICE VPM-0.24±0.39 -0.26±0.29-0.21 ±0.35-0.08 ±0.32 0.21±0.320.19 ±0.33 0.13±0.37-0.13±0.39 -0.46±0.20
FQE (L2)0.57 ±0.280.24±0.31 0.04±0.33-0.33 ±0.30-0.29±0.33-0.11±0.36
Rrr raerIS0.07±0.390.26±0.340.37 ±0.27-0.55 ±0.260.23±0.34
Doubly Robust0.45±0.320.01±0.33-0.41 ±0.27-0.31 ±0.34-0.19 ±0.36
Walker2dWalker2dWalker2dWalker2dWalker2d
expertmediummedium-expertmedium-replayrandom
Rar rrrrBest DICE-0.37 ±0.270.12 ±0.38-0.34±0.340.55 ±0.23-0.19 ±0.36
VPM0.17 ±0.320.44±0.210.49 ±0.37-0.52±0.25-0.42 ±0.34
FQE (L2)0.35 ±0.33-0.09 ±0.360.25 ±0.32-0.19 ±0.360.21±0.31
IS0.22 ±0.37-0.25 ±0.350.24±0.330.65±0.24-0.05 ±0.38
Doubly Robust0.26 ±0.340.02 ±0.370.19 ±0.33-0.37 ±0.390.16±0.29
Median
RRrr rTTBest DICE-0.19
VPM-0.05
FQE (L2)0.21
IS0.23
Doubly Robust0.26
HalfcheetahHalfcheetah expert mediumHalfcheetah medium-expertHalfcheetah Halfcheetah medium-replay random
RreeeerBest DICE0.32 ±0.400.82 ±0.29 0.38±0.370.30±0.070.81±0.30
VPM0.14±0.09 0.33 ±0.190.80±0.340.25 ±0.090.12 ±0.07
Doubly Robust O.11±0.080.37 ±0.150.14±0.070.33±0.180.31±0.10
FQE (L2) 0.12 ±0.070.38±0.130.14±0.070.36±0.160.37 ±0.08
0.15 ±0.080.05±0.050.73 ±0.420.13±0.100.31 ±0.11
eeeerAntmazeAntmazeAntmaze AntmazeAntmaze
Best DICE 0.54±0.34large-diverse large-playmedium-diversemedium-playumaze
VPM 0.88 ±0.270.96 ±0.13 0.45 ±0.300.04±0.110.09 ±0.100.69 ±0.39
Doubly Robust 0.83 ±0.300.14±0.100.03±0.080.62 ±0.32
0.93 ±0.250.93±0.21 1.00±0.030.05 ±0.07 0.16 ±0.100.17±0.31 0.05±0.190.42 ±0.36 0.41 ±0.35
FQE (L2) IS0.14±0.090.18±0.060.86±0.06
eeeeer VPM0.39 ±0.260.71 ±0.20
AntmazeDoorDoorDoorHammer
umaze-diverseclonedexperthumancloned
Best DICE 0.42 ±0.280.65 ±0.450.37 ±0.270.10±0.270.67 ±0.48
0.63±0.32 Doubly Robust 0.79 ±0.140.81±0.33 0.11±0.080.03±0.030.69 ±0.240.72 ±0.39
FQE (L2)0.05 ±0.070.05 ±0.090.78 ±0.38 0.36 ±0.39
0.64±0.370.11 ±0.060.03±0.030.05 ±0.080.03±0.15
0.22 ±0.360.02 ±0.070.01±0.040.45 ±0.40
HammerHammerMaze2dMaze2dMaze2d
experthumanlargemediumumaze
Peeeier VPM ISBest DICE0.24±0.34 0.04±0.080.15±0.080.44±0.050.03±0.07
0.04±0.070.18 ±0.290.66 ±0.100.24±0.240.06 ±0.12
Doubly Robust 0.09 ±0.090.46±0.230.21 ±0.160.27 ±0.140.03 ±0.07
FQE (L2) 0.05±0.040.46±0.230.20±0.140.31 ±0.140.03±0.07
0.01 ±0.040.19 ±0.300.16±0.230.15 ±0.150.02±0.12
PenPenPenRelocateRelocate
Best DICE VPMclonedexperthumanclonedexpert
0.12 ±0.080.33 ±0.200.04±0.090.96 ±0.180.97±0.07
0.36 ±0.180.25 ±0.130.28 ±0.120.11 ±0.290.76 ±0.23
Doubly Robust 0.13 ±0.06 0.12 ±0.070.05±0.070.09±0.080.18±0.270.98 ±0.08
eeeeer ISFQE (L2)0.11±0.140.07 ±0.050.29±0.421.00±0.06
0.14±0.090.31±0.100.17 ±0.150.63±0.410.18±0.14
RelocateAntAnt
humanAnt expertAnt
VPMmedium medium-expertmedium-replay
Best DICE 0.97 ±0.110.62 ±0.150.43±0.100.60±0.160.64±0.13
0.77±0.180.88±0.220.40±0.210.32 ±0.240.72 ±0.43
Doubly Robust 0.17 ±0.15 0.17 ±0.140.43 ±0.220.12 ±0.180.37 ±0.130.05±0.09
Peeeier ISFQE (L2)0.43 ±0.220.12 ±0.180.36±0.140.05 ±0.09 0.16±0.23
0.63±0.410.47 ±0.320.61±0.180.46±0.18
AntHopperHopperHopperWalker2d
randomexpertmediumrandomexpert
Best DICE 0.50 ±0.29 0.15±0.240.20±0.080.18±0.190.30±0.150.35 ±0.36
VPM Doubly Robust 0.28±0.150.13±0.100.10±0.140.26±0.100.09±0.19 0.06 ±0.07
0.28±0.150.34±0.35 0.41±0.200.32 ±0.32 0.32 ±0.320.41±0.17 0.36±0.220.06 ±0.07
FQE (L2) IS0.56 ±0.220.06±0.030.38 ±0.280.05 ±0.05 0.43±0.26
Best DICEWalker2dWalker2dMedian
Walker2d Walker2dmedium-replayrandom
mediummedium-expert0.39 ±0.330.38
0.27 ±0.43 0.08±0.060.78±0.27 0.24±0.420.18±0.12 0.46 ±0.310.88±0.20
reeeerVPM0.28
Doubly Robust 0.25±0.090.30±0.120.68±0.230.15 ±0.200.25
0.22 ±0.140.24±0.200.15±0.21
ISFQE (L2)0.24
0.31±0.10
0.13 ±0.07
0.70 ±0.390.02 ±0.050.74±0.330.18
+ +# A.2.3 SCATTER PLOTS + +Finally, we present scatter plots plotting the true returns of each policy against the estimated returns. +Each point on the plot represents one evaluated policy. + +![](images/27dc0c330afae693162789506b4d638cb93996d1e87cdc79c83d85c040a6f531.jpg) +Figure A.8: Scatter plots of estimate vs ground truth return for each baseline on each task in DOPE RL Unplugged. + +![](images/2badfd8bb0006de9a5a57679cb157db81407d77dac97614bb712ce41623c1edc.jpg) +Figure A.9: Scatter plots of estimate vs ground truth return for each baseline on each task in DOPE D4RL (part 1). + +![](images/7bb5c1d87eab326cf266de6dbb4bc6e97d349271db3da26f6a9d5551f9a3b8fc.jpg) +Figure A.10: Scatter plots of estimate vs ground truth return for each baseline on each task in DOPE D4RL (part 2). + +![](images/31553c26e4588016bff4c0d1dfe07158cc733c5ce3acc93075f0d6d7a3939dce.jpg) +Figure A.11: Scatter plots of estimate vs ground truth return for each baseline on each task in DOPE D4RL (part 3). + +![](images/116074c98f24877ea5ccac9d4003864d2ca03ff67f17db00810258cd5ef95178.jpg) +Figure A.12: Scatter plots of estimate vs ground truth return for each baseline on each task in DOPE D4RL (part 4). + +![](images/fd464a243d9bb7bdd8d54cd696233b55a9824cc2a258f3a8dd598cdb9bbef6f0.jpg) +Figure A.13: Scatter plots of estimate vs ground truth return for each baseline on each task in DOPE D4RL (part 5). + +![](images/238c4fe77e72766a7ff6255ac3f5a8811bb758ad0ffea132c70da7d22cef3eae.jpg) +Figure A.14: Scatter plots of estimate vs ground truth return for each baseline on each task in DOPE D4RL (part 6). \ No newline at end of file diff --git a/md/train/kzPtpIpF8o/kzPtpIpF8o.md b/md/train/kzPtpIpF8o/kzPtpIpF8o.md new file mode 100644 index 0000000000000000000000000000000000000000..b3979c8d902a4f7b6b75193a2a518fdb7feefacb --- /dev/null +++ b/md/train/kzPtpIpF8o/kzPtpIpF8o.md @@ -0,0 +1,248 @@ +# XCiT: Cross-Covariance Image Transformers + +Alaaeldin El-Nouby1,2 Hugo Touvron1,3 Mathilde Caron1,2 Piotr Bojanowski1 + +Matthijs Douze1 Armand Joulin1 Ivan Laptev2 Natalia Neverova1 + +Gabriel Synnaeve1 Jakob Verbeek1 Hervé Jégou1 + +1Facebook AI 2Inria 3Sorbonne University + +# Abstract + +Following tremendous success in natural language processing, transformers have recently shown much promise for computer vision. The self-attention operation underlying transformers yields global interactions between all tokens, i.e. words or image patches, and enables flexible modelling of image data beyond the local interactions of convolutions. This flexibility, however, comes with a quadratic complexity in time and memory, hindering application to long sequences and highresolution images. We propose a “transposed” version of self-attention that operates across feature channels rather than tokens, where the interactions are based on the cross-covariance matrix between keys and queries. The resulting cross-covariance attention (XCA) has linear complexity in the number of tokens, and allows efficient processing of high-resolution images. Our cross-covariance image transformer (XCiT) – built upon XCA – combines the accuracy of conventional transformers with the scalability of convolutional architectures. We validate the effectiveness and generality of XCiT by reporting excellent results on multiple vision benchmarks, including (self-supervised) image classification on ImageNet-1k, object detection and instance segmentation on COCO, and semantic segmentation on ADE20k. + +# 1 Introduction + +Transformers architectures $\left[ \left[ 6 8 \right] \right]$ have provided quantitative and qualitative breakthroughs in speech and natural language processing (NLP). After a few attempts to incorporate wide-range self-attention in vision architectures $[ 7 1 , 8 2 ]$ , Dosovitskiy et al. [21] established transformers as a viable architecture for learning visual representations, reporting competitive results for image classification while relying on large-scale pre-training. Touvron et al. $\textcircled { 6 4 } \textcircled { 1 6 }$ have shown on par or better accuracy/throughput compared to strong convolutional baselines such as EfficientNets $\lVert 5 8 \rVert$ when training transformers on ImageNet-1k using extensive data augmentation and improved training schemes. Promising results have been obtained for other vision tasks, including image retrieval $\pmb { \mathbb { Z } } 2 \mathbb { I }$ , object detection and semantic segmentation $\boxed { \boxed { 4 4 } } \boxed { 7 0 } \boxed { 8 1 } \boxed { 8 3 } \boxed { }$ , as well as video understanding [2, 7, 23]. + +One major drawback of transformers is the time and memory complexity of the core self-attention operation, that increases quadratically with the number of input tokens, or similarly number of patches in computer vision. For $w \times h$ images, this translates to a complexity of $\mathcal { O } ( w ^ { 2 } \bar { h } ^ { 2 } )$ , which is prohibitive for most tasks involving high-resolution images, such as object detection and segmentation. Various strategies have been proposed to alleviate this complexity, for instance using approximate forms of self-attention $\textcircled { 1 4 4 } , \textcircled { 8 1 }$ , or pyramidal architectures which progressively downsample the feature maps $ { \mathbb { I } } ^ { { \mathbb { Z } } 0 \| }$ . However, none of the existing solutions are fully satisfactory, as they either trade complexity for accuracy, or their complexity remains excessive for processing very large images. + +We replace the self-attention, as originally introduced by Vaswani et al. $\lVert \rVert \bigotimes \rVert$ , with a “transposed” attention that we denote as “cross-covariance attention” (XCA). Cross-covariance attention substitutes the explicit full pairwise interaction between tokens by self-attention among features, where the attention map is derived from the cross-covariance matrix computed over the key and query projections of the token features. Importantly, XCA has a linear complexity in the number of patches. To construct our Cross-Covariance Image Transformers (XCiT), we combine XCA with local patch interaction modules that rely on efficient depth-wise convolutions and point-wise feedforward networks commonly used in transformers, see Figure $\mathbb { L }$ XCA can be regarded as a form of a dynamic $1 \times 1$ convolution, which multiplies all tokens with the same data-dependent weight matrix. We find that the performance of our XCA layer can be further improved by applying it on blocks of channels, rather than directly mixing all channels together. This “block-diagonal” shape of XCA further reduces the computational complexity with a factor linear in the number of blocks. + +![](images/9dcfff922e69d5962cb57fbbc31fa8195fc5262914194a68fc36a933012c1196.jpg) +Figure 1: Our XCiT layer consists of three main blocks, each preceded by LayerNorm and followed by a residual connection: (i) the core cross-covariance attention (XCA) operation, (ii) the local patch interaction (LPI) module, and (iii) a feed-forward network (FFN). By transposing the query-key interaction, the computational complexity of XCA is linear in the number of data elements $N$ , rather than quadratic as in conventional self-attention. + +Given its linear complexity in the number of tokens, XCiT can efficiently process images with more than thousand pixels in each dimension. Notably, our experiments show that XCiT does not compromise the accuracy and achieves similar results to DeiT $\mathbb { \lVert \rVert }$ and CaiT $ { \mathbb { I } } { \mathbb { I } }$ in comparable settings. Moreover, for dense prediction tasks such as object detection and image segmentation, our models outperform popular ResNet $\left[ \left[ 2 8 \right] \right]$ backbones as well as the recent transformer-based models [44, 70, 81]. Finally, we also successfully apply XCiT to the self-supervised feature learning using DINO [12], and demonstrate improved performance compared to a DeiT-based backbone $\pmb { \| 6 4 \| }$ . + +Overall, we summarize our contributions as follows: + +• We introduce cross-covariance attention (XCA), which provides a “transposed” alternative to conventional self-attention, attending over channels instead of tokens. Its complexity is linear in the number of tokens, allowing for efficient processing of high-resolution images, see Figure 2. +• XCA attends to a fixed number of channels, irrespective of the number of tokens. As a result, our models are significantly more robust to changes in image resolution at test time, and are therefore more amenable to process variable-size images. +• For image classification, we demonstrate that our models are on par with state-of-the-art vision transformers for multiple model sizes using a simple columnar architecture, i.e., in which we keep the resolution constant across layers. In particular, our XCiT-L24 model achieves $8 6 . 0 \%$ top-1 accuracy on ImageNet, outperforming its CaiT-M24 [67] and NFNet-F2 $\mathbb { \ m }$ counterparts with comparable numbers of parameters. +• For dense prediction tasks with high-resolution images, our models outperform ResNet and multiple transformer-based backbones. On the COCO benchmark, we achieve a strong performance of $4 8 . 5 \%$ and $4 3 . 7 \%$ mAP for object detection and instance segmentation respectively. Moreover, we report $4 8 . 4 \%$ mIoU for semantic segmentation on the ADE20k benchmark, outperforming the state-of-the-art Swin Transformer $\pm \ddagger { 4 } \rVert$ backbones across all comparable model sizes. +• Finally, our XCiT model is highly effective in self-supervised learning setups, achieving $8 0 . 9 \%$ top-1 accuracy on ImageNet-1k using DINO [12]. + +# 2 Related work + +Deep vision transformers. Training deep vision transformers can be challenging due to instabilities and optimization issues. Touvron et al. $\dot { \left[ 6 7 \right] }$ successfully train models with up to 48 layers using LayerScale, which weighs contributions of residual blocks across layers and improves optimization. Additionally, the authors introduce class attention layers which decouple the learning of patch features and the feature aggregation stage for classification. + +Spatial structure in vision transformers. Yuan et al. $\pmb { \mathbb { Z } } 9 \|$ propose applying a soft split for patch projection with overlapping patches which is applied repeatedly across model layers, reducing the number of patches progressively. Han et al. $\mathbb { \left| \overline { { 2 7 } } \right| }$ introduce a transformer module for intra-patch structure, exploiting pixel-level information and integrating with an inter-patch transformer to attain higher representation power. d’Ascoli et al. $\mathbb { \ m }$ consider the initialization of self-attention blocks as a convolutional operator, and demonstrate that such initialization improves the performance of vision transformers in low-data regimes. Graham et al. $\pmb { \mathbb { D } } \pmb { \ 6 } \|$ introduce LeViT, which adopts a multistage architecture with progressively reduced feature resolution similar to popular convolutional architectures, allowing for models with high inference speed while retaining a strong performance. Moreover, the authors adopt a convolution-based module for extracting patch descriptors. Yuan et al. $\left[ \left[ 7 8 \right] \right]$ improve both the performance and the convergence speed of vision transformers by replacing the linear patch projection with convolutional layers and max-pooling, as well as modifying the feed-forward networks in each transformer layer to incorporate depth-wise convolutions. + +Efficient attention. Numerous methods for efficient self-attention have been proposed in the literature to address the quadratic complexity of self-attention in the number of input tokens. These include restricting the span of the self-attention to local windows [48, 50], strided patterns $\pmb { \mathbb { I } }$ , axial patterns $\textcircled { \lvert 3 0 \rvert }$ , or an adaptive computation across layers $ { \mathbb { I } }$ . Other methods provide an approximation of the self-attention matrix which can be achieved by a projection across the token dimension $\mathbb { \lVert \rVert }$ , or through a factorization of the softmax-attention kernel [15, 37, 56, 77], which avoids explicit computation of the attention matrix. While conceptually different, our XCA performs similar computations without being sensitive to the choice of the kernel. Similarly, Lee-Thorp et al. [41] achieve faster training by substituting self-attention with unparametrized Fourier Transform. Other efficient attention methods rely on local attention and adding a small number of global tokens, thus allowing interaction among all tokens only by hopping through the global tokens $\boxed { 1 } \boxed { 5 } \boxed { 3 4 } \boxed { 8 0 }$ . Similarly, Goyal et al. $\boldsymbol { \| 2 5 \| }$ use a global workspace though which items interact, albeit one that is shared across layers. + +Transformers for high-resolution images. Several works adopt visual transformers to highresolution image tasks beyond image classification, such as object detection and image segmentation. Wang et al. $\tilde { \left. 7 0 \right. }$ design a model with a pyramidal architecture and address complexity by gradually reducing the spatial resolution of keys and values. Similarly, for video recognition Fan et al. [23] utilize pooling to reduce the resolution across the spatial and temporal dimensions to allow for an efficient computation of the attention matrix. Zhang et al. $\textcircled { 8 1 }$ adopt global tokens and local attention to reduce the model complexity, while Liu et al. $\checkmark$ provide an efficient method for local attention with shifted windows. In addition, Zheng et al. $[ [ 8 3 ] ]$ and Ranftl et al. $[ [ 5 4 ]$ study problems like semantic segmentation and monocular depth estimation with the quadratic self-attention operation. + +Data-dependent layers. Our XCiT layer can be regarded as a “dynamic” $1 \times 1$ convolution, which multiplies all token features with the same data-dependent weight matrix, derived from the key and query cross-covariance matrix. In the context of convolutional networks, Dynamic Filter Networks [9] explore a related idea, using a filter generating subnetwork to produce convolutional filters based on features in previous layers. Squeeze-and-Excitation networks $\left[ \left[ 3 2 \right] \right]$ use data dependent $1 \times 1$ convolutions in convolutional architectures. Spatially average-pooled features are fed to a 2-layer MLP which produces per channel scaling parameters. Closer in spirit to our work, Lambda layers propose a way to ensure global interaction in ResNet models $\bar { \mathbb { H } }$ . Their “content-based lambda function” is computing a similar term as our cross-covariance attention, but differing in how the softmax and $\ell _ { 2 }$ normalizations are applied. Moreover, Lambda layers also include specific positionbased lambda functions, and LambdaNetworks are based on ResNets while XCiT follows the ViT architecture. Recently data-independent analogues of self-attention have also been found to be an effective alternative to convolutional and self-attention layers for vision tasks $\textcircled { 1 2 0 } , \textcircled { 4 6 } , \textcircled { 6 2 } , \textcircled { 6 6 } $ . These methods treat entries in the attention map as learnable parameters, rather than deriving the attention map dynamically from queries and keys, but their complexity remains quadratic in the number of tokens. Zhao et al. [82] consider alternative attention forms in computer vision. + +# 3 Method + +In this section, we first recall the self-attention mechanism, and the connection between the Gram and covariance matrices, which motivated our work. We then propose our cross-covariance attention operation (XCA) – which operates along the feature dimension instead of token dimension in conventional transformers – and combine it with local patch interaction and feedforward layers to construct our Cross-Covariance Image Transformer (XCiT). See Figure $\bigtriangledown$ for an overview. + +# 3.1 Background + +Token self-attention. Self-attention, as introduced by Vaswani et al. $\lVert \overline { { 6 8 } } \rVert$ , operates on an input matrix $X \in \mathbb { R } ^ { N \times d }$ , where $N$ is the number of tokens, each of dimensionality $d$ . The input $X$ is linearly projected to queries, keys and values, using the weight matrices $\dot { W _ { q } } \in \mathbb { R } ^ { d \times d _ { q } }$ , $W _ { k } \in$ $\mathbb { R } ^ { d \times d _ { k } }$ and $W _ { v } \in \mathbb { R } ^ { d \times d _ { v } }$ , such that $Q { = } X W _ { q }$ , $K { = } X W _ { k }$ and $V { = } X W _ { v }$ , where $d _ { q } = d _ { k }$ . Keys and values are used to compute an attention map $\mathcal { A } ( K , Q ) = \operatorname { S o f t m a x } ( Q K ^ { \top } / \sqrt { d _ { k } } )$ , and the output of the self-attention operation is defined as the weighted sum of $N$ token features in $V$ with the weights corresponding to the attention map: Attention $( Q , K , V ) = \mathcal { A } ( K , Q ) V$ . The computational complexity of self-attention scales quadratically in $N$ , due to pairwise interactions between all $N$ elements. + +Relationship between Gram and covariance matrices. To motivate our cross-covariance attention operation, we recall the relation between Gram and covariance matrices. The unnormalised $d \times d$ covariance matrix is obtained as $C { = } X ^ { \top } X$ . The $N \times N$ Gram matrix contains all pairwise innerproducts: $G { = } X X ^ { \top }$ . The non-zero part of the eigenspectrum of the Gram and covariance matrix are equivalent, and the eigenvectors of $C$ and $G$ can be computed in terms of each other. If $V$ are the eigenvectors of $G$ , then the eigenvectors of $C$ are given by $U { = } X V$ . To minimise the computational cost, the eigendecomposition of either the Gram or covariance matrix can be obtained in terms of the decomposition of the other, depending on which of the two matrices is the smallest.1 + +We draw upon this strong connection between the Gram and covariance matrices to consider whether it is possible to avoid the quadratic cost to compute the $N \times N$ attention matrix, which is computed from the analogue of the $N \times N$ Gram matrix $\mathsf { \bar { Q } } K ^ { \top } { = } X W _ { q } W _ { k } ^ { \top } X ^ { \top }$ . Below we consider how we can use the $d _ { k } \times d _ { q }$ cross-covariance matrix, $K ^ { \top } Q { = } W _ { k } ^ { \top } X ^ { \top } X W _ { q }$ , which can be computed in linear time in the number of elements $N$ , to define an attention mechanism. + +# 3.2 Cross-covariance attention + +We propose a cross-covariance based self-attention function that operates along the feature dimension, rather than along the token dimension as in token self-attention. Using the definitions of queries, keys and values from above, the cross-covariance attention function is defined as: + +$$ +\operatorname { X C - A t t e n t i o n } ( Q , K , V ) = V A \operatorname { x c } ( K , Q ) , \qquad A \operatorname { x c } ( K , Q ) = \operatorname { S o f t m a x } \left( \hat { K } ^ { \top } \hat { Q } / \tau \right) , +$$ + +where each output token embedding dimension is a convex combination of the $d _ { v }$ features of its corresponding token embedding in $V$ . The attention weights $\mathcal { A }$ are computed based on the crosscovariance matrix. + +$\ell _ { 2 }$ -Normalization and temperature scaling. In addition to building our attention operation on the cross-covariance matrix, we make a second modification compared to token self-attention. We restrict the magnitude of the query and key matrices by $\ell _ { 2 }$ -normalising them, such that each column of length $N$ of the normalised matrices $\hat { Q }$ and $\hat { K }$ has unit norm, and every element in $d { \times } d$ cross-covariance matrix $\hat { K } ^ { \top } \hat { Q }$ is in the range $[ - 1 , 1 ]$ . We observed that controlling the norm strongly enhances the stability of training, especially when trained with a variable numbers of tokens. However, restricting the norm reduces the representational power of the operation by removing a degree of freedom. Therefore, we introduce a learnable temperature parameter $\tau$ which scales the inner products before the Softmax, allowing for sharper or more uniform distribution of attention weights. + +![](images/301e7b358ccf93cc7973974e2bad457d5f17a3e86617dc31e723f62a68c6c260.jpg) +Figure 2: Inference memory usage of vision transformer variants. Our XCiT models scale linearly in the number of tokens, which makes it possible to scale to much larger image sizes, even in comparison to approaches employing approximate self-attention or a pyramidal design. All measurements are performed with a batch size of 64 on a single V100-32GB GPU. + +![](images/7a6dca3126c84125944af039122617444e1690e36b6fe95f4c1ffa293a03e1ef.jpg) +Figure 3: Performance when changing the resolution at test-time for models with a similar number of parameters. All networks were trained at resolution 224, w/o distillation. XCiT is more tolerant to changes of resolution than the Gram-based DeiT and benefit more from the “FixRes” effect $\mathbb { \lVert \rVert }$ when inference is performed at a larger resolution than at train-time. + +Block-diagonal cross-covariance attention. Instead of allowing all features to interact among each other, we divide them into a $h$ groups, or “heads”, in a similar fashion as multi-head token self-attention. We apply the cross-covariance attention separately per head where for each head, we learn separate weight matrices to project $X$ to queries, keys and values, and collect the corresponding weight matrices in the tensors $\dot { W _ { q } } \in \mathbb { R } ^ { h \times d \times d _ { q } }$ , $W _ { k } \in \mathbb { R } ^ { \mathbf { \bar { h } } \times d \times d _ { k } }$ and $\dot { W } _ { v } \in \mathbb { R } ^ { h \times d \times d _ { v } }$ , where we set $d _ { k } \bar { = } d _ { q } { = } d _ { v } { = } d / h$ . Restricting the attention within heads has two advantages: (i) the complexity of aggregating the values with the attention weights is reduced by a factor $h$ ; (ii) more importantly, we empirically observe that the block-diagonal version is easier to optimize, and typically leads to improved results. This observation is in line with observations made for Group Normalization $\mathbb { [ ] }$ which normalizes groups of channels separately based on their statistics, and achieves favorable results for computer vision tasks compared to Layer Normalization $\pmb { \Vert 3 \Vert }$ , which combines all channels in a single group. Figure $\boxed { 4 }$ shows that each head learns to focus on semantically coherent parts of the image, while being flexible to change what type of features it attends to based on the image content. + +Complexity analysis. The usual token self-attention with $h$ heads has a time complexity of $\mathcal { O } ( N ^ { 2 } d )$ and memory complexity of $\mathcal { O } ( h N ^ { 2 } { + } N d )$ . Due to the quadratic complexity, it is problematic to scale token self-attention to images with a large number of tokens. Our cross-covariance attention overcomes this drawback as its computational cost of $\mathcal { O } ( N d ^ { 2 } / h )$ scales linearly with the number of tokens, as does the memory complexity of $\mathcal { O } ( d ^ { 2 } / h + N \dot { d } )$ . Therefore, our model scales much better to cases where the number of tokens $N$ is large, and the feature dimension $d$ is relatively small, as is typically the case, in particularly when splitting the features into $h$ heads. + +# 3.3 Cross-covariance image transformers + +To construct our cross-covariance image transformers (XCiT), we adopt a columnar architecture which maintains the same spatial resolution across layers, similarly to $\boxed { 1 2 1 } \boxed { 6 4 } \boxed { 6 7 }$ . We combine our cross-covariance attention (XCA) block with the following additional modules, each one being preceded by a LayerNorm $\pmb { \mathbb { B } } \|$ . See Figure $\perp$ for an overview. Since in this section we specifically design the model for computer vision tasks, tokens correspond to image patches in this context. + +Table 1: XCiT models. Design choices include model depth, patch embeddings dimensionality $d$ , and the number of heads $h$ used in XCA. By default our models are trained and tested at resolution 224 with patch sizes of $1 6 \times 1 6$ . We also train with distillation using a convolutional teacher (denoted $\Upsilon$ ) as proposed by Touvron et al. [64]. Finally, we report performance of our strongest models obtained with $8 \times 8$ patch size, fine-tuned $( \uparrow )$ and tested at resolution $3 8 4 \times 3 8 4$ (column $\textcircled { \alpha } 3 8 4 / 8 $ ), using distillation with a teacher that was also fine-tuned $@ 3 8 4$ . + +
ModelDepthd#heads#paramsGFLOPsImageNet-1k-val top-1 acc. (%)
@224/16@384/8@224/16 @224/16r@384/8r ↑
XCiT-N121212843M0.56.469.972.277.8
XCiT-T121219247M1.214.377.178.682.4
XCiT-T2424192412M2.327.379.480.483.7
XCiT-S1212384826M4.855.682.083.385.1
XCiT-S2424384848M9.1106.082.683.985.6
XCiT-M2424512884M16.2188.082.784.385.8
XCiT-L242476816189M36.1417.982.984.986.0
+ +Local patch interaction. In the XCA block communication between patches is only implicit through the shared statistics. To enable explicit communication across patches we add a simple Local Patch Interaction (LPI) block after each XCA block. LPI consists of two depth-wise $3 { \times } 3$ convolutional layers with Batch Normalization and GELU non-linearity in between. Due to its depth-wise structure, the LPI block has a negligible overhead in terms of parameters, as well as a very limited overhead in terms of throughput and memory usage during inference. + +Feed-forward network. As is common in transformer models, we add a point-wise feedforward network (FFN), which has a single hidden layer with $4 d$ hidden units. While interaction between features is confined within groups in the XCA block, and no feature interaction takes place in the LPI block, the FFN allows for interaction across all features. + +Global aggregation with class attention. When training our models for image classification, we utilize the class attention layers as proposed by Touvron et al. $ { \mathbb { I } } { \mathbb { K } } { \ b { 7 } } { \mathbb { I } }$ . These layers aggregate the patch embeddings of the last XCiT layer through writing to a CLS token by one-way attention between the CLS tokens and the patch embeddings. The class attention is also applied per head, i.e. feature group. + +Handling images of varying resolution. In contrast to the attention map involved in token selfattention, in our case the covariance blocks are of fixed size independent of the input image resolution. The softmax always operates over the same number of elements, which may explain why our models behave better when dealing with images of varying resolutions (see Figure $\textcircled{3}$ . In XCiT we include additive sinusoidal positional encoding $\lVert \rVert$ with the input tokens. We generate them in 64 dimensions from the 2d patch coordinates and then linearly project to the transformer working dimension $d$ . This choice is orthogonal to the use of learned positional encoding, as in ViT [21]. However, it is more flexible since there is no need to interpolate or fine-tune the network when changing the image size. + +Model configurations. In Table $^ 1$ we list different variants of our model which we use in our experiments, with different choices for model width and depth. For the patch encoding layer, unless mentioned otherwise, we adopt the alternative used by Graham et al. $\pmb { \mathbb { D } } \pmb { 6 } \|$ with convolutional patch projection layers. We also experimented with a linear patch projection as described in $\pmb { \mathbb { D } } \mathbf { 1 } \mathbf { h }$ , see our ablation in Table 4. Our default patch size is $1 6 \times 1 6$ , as in other vision transformer models including ViT $\scriptstyle { \left[ \left[ 2 1 \right] \right] }$ , DeiT [64] and CaiT $\pmb { \mathbb { E 7 } }$ . We also experiment with smaller $8 \times 8$ patches, which has been observed to improve performance $\mathbb { [ [ 2 ] }$ . Note that this is efficient with XCiT as its complexity scales linearly which the number of patches, while ViT, DeiT and CaiT scale quadratically. + +# 4 Experimental evaluation + +In this section we demonstrate the effectiveness and versatility of XCiT on multiple computer vision benchmarks, and present ablations providing insight on the importance of its different components. In the supplementary material we provide additional analysis, including the impact on performance of image resolution in Section ${ \bf A . l } ^ { \dot { } }$ and of multiple approximate attention baselines in Section A.2. + +Table 2: ImageNet classification. Number of parameters, FLOPs, image resolution, and top-1 accuracy on ImageNet-1k and ImageNet-V2. Training strategies vary across models, transformer-based models and the reported RegNet mostly follow recipes from DeiT [64]. + +
Model#paramsFLOPs Res.ImNetV2
EfficientNet-B5 RA [17]30M9.9B45683.7
RegNetY-4GFI53121M4.0B22480.072.4
DeiT-SY 64]22M4.6B22481.268.5
Swin-T [44]29M4.5B22481.3
CaiT-XS24Y ↑ 67]26M19.3B38484.174.1
XCiT-S12/16M26M4.8B22483.372.5
XCiT-S12/16Y↑26M14.3B38484.774.1
XCiT-S12/8Y↑26M55.6B38485.174.8
EfficientNet-B7RA [17]66M37.0B60084.7
NFNet-F0 [10]72M12.4B25683.672.6
RegNetY-8GF 园39M8.0B22481.772.4
TNT-B 四66M14.1B22482.81
国 Swin-S50M8.7B22483.0
CaiT-S24Y ↑ 67]47M32.2B38485.175.4
XCiT-S24/16M48M9.1B22483.973.3
XCiT-S24/16Y↑48M26.9B38485.174.6
XCiT-S24/8Y ↑48M105.9B38485.675.7
Fix-EfficientNet-B8园 87M89.5B80085.775.9
RegNetY-16GF[53]84M16.0B22482.972.4
Swin-B↑ 四88M47.0B38484.2
DeiT-BY↑[6487M55.5B38485.275.2
CaiT-S48Y ↑[67]89M63.8B38485.376.2
XCiT-M24/16T84M16.2B22484.373.6
XCiT-M24/16Y↑84M47.7B38485.475.1
XCiT-M24/8Y↑84M187.9B38485.876.1
NFNet-F2[ 目194M62.6B35285.174.3
NFNet-F3 目255M114.8B41685.775.2
CaiT-M24Y ↑[67186M116.1B38485.876.1
XCiT-L24/16T189M36.1B22484.974.6
XCiT-L24/16Y ↑189M106.0B338485.875.8
XCiT-L24/8Y↑189M417.8B38486.076.6
+ +![](images/d87cd7c275cbbc0e18ed54c4731e8c41009d08d1f159fc54964749277f2df726.jpg) +Figure 4: Visualization of the attention map between the CLS token and individual patches in the class-attention stage. For each column, each row represents the attention map w.r.t. one head, corresponding to the image in the first row. Each head appears sensitive to semantically coherent regions. Heads are sensitive to similar features within the same or across images (e.g. people or bird faces). They are trigger by different concepts when such features are missing (e.g., cockpit for race cars). + +# 4.1 Image classification + +We use ImageNet-1k $\mathbb { \lVert 1 9 \rVert }$ to train and evaluate our models for image classification. It consists of 1.28M training images and $5 0 \mathrm { k }$ validation images, labeled across 1,000 semantic categories. Our training setup follows the DeiT recipe $\pmb { \mathbb { \lVert 6 4 \rVert } }$ . We train our model for 400 epochs with the AdamW optimizer $| \bar { \mathbf { \nabla } } 4 \bar { 5 } | |$ using a cosine learning rate decay. In order to enhance the training of larger models, we utilize LayerScale $ { \mathbb { I } } { \mathbb { I } }$ and adjust the stochastic depth $\mathbb { \lVert 3 3 \rVert }$ for each of our models accordingly (see the supplementary material for details). Following $ { \mathbb { I } } { \mathbb { K } } 7 { \mathbb { I } }$ , images are cropped with crop ratio of 1.0 for evaluation. In addition to the ImageNet-1k validation set, we report results for ImageNet-V2 [55] which has a distinct test set. Our implementation is based on the Timm library $\lVert \ b { 7 2 } \rVert$ . + +Results on ImageNet. We present a family of seven models in Table $\lfloor 1 \rfloor$ with different operating points in terms of parameters and FLOPs. We observe that the performance of the XCiT models benefits from increased capacity both in depth and width. Additionally, consistent with $\mathbb { B 4 } \mathbb { 6 7 } \mathbb { 1 }$ we find that using hard distillation with a convolutional teacher improves the performance. Because of its linear complexity in the number of tokens, it is feasible to train XCiT at $3 8 4 \times 3 8 4$ resolution with small $8 \times 8$ patches, i.e. 2304 tokens, which provides a strong boost in performance across all configurations. + +We compare to the state-of-the-art convolutional and transformer-based architectures [10, 44, 53, 58, $\textcircled { 6 7 }$ in Table $2 .$ By varying the input image resolution and/or patch size, our models provide competitive or superior performance across model sizes and FLOP budgets. First, the models operating on $2 2 4 \times 2 2 4$ and $1 6 \times 1 6$ (e.g. XCiT-S12/16) enjoy high accuracy at relatively few FLOPs compared to their counterparts with comparable parameter count and FLOPs. Second, our models with $1 6 \times 1 6$ and $3 8 4 \times 3 8 4$ resolution images (e.g. XCiT-S12/16") yield an improved accuracy at the expense of higher FLOPs, and provide superior or on-par performance compared to state-of-the-art models with comparable computational requirements. Finally, the linear complexity of XCiT allows us to scale to process $3 8 4 \times 3 8 4$ images with $8 \times 8$ patch sizes (e.g. XCiT-S12/8"), achieving the highest accuracy across the board, albeit at a relatively high FLOPs count. + +Table 3: Self-supervised learning. Top-1 acc. on ImageNet-1k. We report with a crop-ratio 0.875 for consistency with DINO. For the last row it is set to 1.0 (improves from $8 0 . 7 \%$ to $8 0 . 9 \%$ ). All models are trained for 300 epochs. + +
SSL MethodModel#paramsFLOPsLineark-NN
MoBY 回Swin-T 国29M4.5B75.01
DINO 回ResNet-50[28]23M4.1B74.565.6
DINO 圆ViT-S/16_2122M4.6B76.172.8
DINO 圆ViT-S/8 2122M22.4B79.277.2
DINO 圆XCiT-S12/1626M4.9B77.876.0
DINO 国XCiT-S12/826M18.9B79.277.1
DINO 圆ViT-B/162187M17.5B78.276.1
DINO 园ViT-B/8 日87M78.2B80.177.4
DINO 园XCiT-M24/1684M16.2B78.876.4
DINO 圆XCiT-M24/884M64.0B80.377.9
DINO 园XCiT-M24/8↑38484M188.0B80.978.3
+ +Table 4: Ablations of various architectural design choices on the task of ImageNet-1k classification using the XCiT-S12 model. Our baseline model uses the convolutional projection adopted from LeVit. + +
ModelAblationImNet top-1 acc.
XCiT-S12/16Baseline82.0
XCiT-S12/883.4
XCiT-S12/16Linear patch proj.81.1
XCiT-S12/883.1
XCiT-S12/16w/o LPI layer80.8
w/o XCA layer75.9
XCiT-S12/16w/o l2-normal.failed
w/o learned temp. T81.8
+ +Class attention visualization. In Figure $\sharp$ we show the class attention map obtained in the feature aggregation stage. Each head focuses on different semantically coherent regions in the image (e.g. faces or umbrellas). Furthermore, heads tend to focus on similar patterns across images (e.g. bird head or human face), but adapts by focusing on other salient regions when such patterns are absent. + +Robustness to resolution changes. In Figure $3$ we report the accuracy of XCiT-S12, DeiT-S and ResNet-50 trained on $2 2 4 \times 2 2 4$ images and evaluated at different image resolutions. While DeiT outperforms ResNet-50 when train and test resolutions are similar, it suffers from a larger drop in performance as the image resolution deviates farther from the training resolution. XCiT displays a substantially increased accuracy when train and test resolutions are similar, while also being robust to resolution changes, in particular for the model with $8 \times 8$ patches. + +Self-supervised learning. We train XCiT in a self-supervised manner using DINO $\mathbb { \lVert \rVert }$ on ImageNet-1k. In Table $\bar { 3 }$ we report performance using the linear and $\mathbf { k }$ -NN protocols as in $\mathbb { \lVert \rVert }$ . Across model sizes XCiT obtains excellent accuracy with both protocols, substantially improving DINO with ResNet-50 or ViT architectures, as well as over those reported for Swin-Transformer trained with MoBY $\left[ \left[ 7 6 \right] \right]$ . Comparing the larger models to ViT, we also observed improved performance for XCiT achieving a strong $8 0 . 3 \%$ accuracy. For fair comparison, all reported models have been trained for 300 epochs. Further improved performance of small models is reported by Caron et al. $\mathbb { \lVert \rVert }$ when training for 800 epochs, which we expect to carryover to XCiT based on the results presented here. + +Analysis and ablations. In Table $\sharp$ we provide ablation experiments to analyse the impact of different design choices for our XCiT-S12 model. First, we observe the positive effect of using the convolutional patch projection as compared to using linear patch projection, for both $8 \times 8$ and $1 6 \times 1 6$ patches. Second, while removing the LPI layer reduces the accuracy by only $1 . 2 \%$ (from 82.0 to 80.8), removing the XCA layer results in a large drop of $6 . 1 \%$ , underlining the effectiveness of XCA. We noticed that the inclusion of two convolutional components – convolutional patch projection and LPI – not only brings improvements in accuracy, but also accelerates training. Third, although we were able to ensure proper convergence without $\ell _ { 2 }$ -normalization of queries and keys by tweaking the hyper-parameters, we found that it provides stability across model size (depth and width) and other hyper-parameters. Finally, while the learnable softmax temperature parameter is not critical, removing it drops accuracy by $0 . 2 \%$ . Additional ablations are provided in the supplementary material. + +Table 5: COCO object detection and instance segmentation performance on the mini-val set. All backbones are pre-trained on ImageNet-1k, use Mask R-CNN model [29] and are trained with the same 3x schedule. + +
Backbone#paramsAPAPAP5ApmAPAP
ResNet18 国31.2M36.957.140.033.653.935.7
PVT-Tiny 凯32.9M39.862.243.037.459.339.9
ViL-Tiny I8126.9M41.264.044.737.959.840.6
XCiT-T12/1626.1M42.764.346.438.561.241.1
XCiT-T12/825.8M44.566.448.840.363.543.2
ResNet50 I28]44.2M41.061.744.937.158.440.1
PVT-Small[70]44.1M43.065.346.939.962.542.8
ViL-Small8145.0M43.464.947.039.662.142.4
Swin-T [4447.8M46.068.150.341.665.144.9
XCiT-S12/1644.3M45.367.049.540.864.043.8
XCiT-S12/843.1M47.068.951.742.366.045.4
ResNet101 2863.2M42.863.247.138.560.141.3
ResNeXt101-3262.8M44.064.448.039.261.441.9
PVT-Medium 目63.9M44.266.048.240.563.143.5
ViL-Medium 图60.1M44.666.348.540.763.843.7
Swin-S4469.1M48.570.253.543.367.346.6
XCiT-S24/1665.8M46.568.050.941.865.245.0
XCiT-S24/864.5M48.169.553.043.066.546.1
ResNeXt101-6475101.9M44.464.948.839.761.942.6
PVT-Large 目81.0M44.566.048.340.763.443.7
ViL-Large 日76.1M45.767.249.941.364.444.5
XCiT-M24/16101.1M46.768.251.142.065.644.9
XCiT-M24/898.9M48.570.353.443.767.546.9
+ +Table 6: ADE20k semantic segmentation performance using Semantic FPN [38] and UperNet [74] (in comparable settings). We do not include comparisons with other state-of-the-art models that are pre-trained on larger datasets [44, 54, 83]. + +
BackboneSemantic FPNUperNet
#paramsmIoU#paramsmIoU
ResNet1828PVT-Tiny7015.5M17.0M32.935.7M--
XCiT-T12/16XCiT-T12/88.4M8.4M38.139.933.7M33.741.543.5
ResNet5028PVT-Small[70Swin-T4428.5M28.2M36.739.8-66.5M-59.9M42.0-44.5
XCiT-S12/16XCiT-S12/830.4M30.4M43.944.252.4M52.3M45.946.6
ResNet10128ResNeXt101-3275PVT-Medium 70Swin-S4447.5M47.1M48.0M=38.885.5M43.8
39.741.6---81.0M--47.6
XCiT-S24/16XCiT-S24/851.8M51.8M44.647.173.8M73.8M46.948.1
ResNeXt101-6475PVT-Large[701Swin-B国86.4M65.1M=40.242.1-=121.0M--48.1
-
XCiT-M24/16XCiT-M24/8
90.8M46.9108.9M48.4
+ +# 4.2 Object detection and instance segmentation + +Our XCiT models can efficiently process high-resolution images (see Figure 2). Additionally, XCiT has a better adaptability to varying image resolutions compared to ViT models (see Figure $3 )$ . These two properties make XCiT a good fit for dense prediction tasks including detection and segmentation. + +We evalutate XCiT for object detection and instance segmentation using the COCO benchmark [42] which consists of $1 1 8 \mathrm { k }$ training and $5 \mathrm { k }$ validation images including bounding boxes and mask labels for 80 categories. We integrate XCiT as backbone in the Mask R-CNN $\mathbb { \left[ \left[ 2 9 \right] \right. }$ detector with FPN [43]. Since the XCiT architecture is inherently columnar, we make it FPN-compatible by extracting features from different layers, e.g., layers 4, 6, 8, and 12 for XCiT-S12. All features have a constant stride of 8 or 16 based on the patch size, and the feature resolutions are adjusted to have strides of 4, 8, 16, and 32, similar to ResNet-FPN backbones, where the downsampling is achieved by max pooling and the upsampling is obtained using a single transposed convolution layer (see the supplementary material for details). The model is trained for 36 epochs (3x schedule) using the AdamW optimizer with learning rate of $1 0 ^ { - 4 }$ , 0.05 weight decay and 16 batch size. We adopt the multiscale training and augmentation strategy of DETR $\bar { \mathbb { W } }$ . Our implementation is based on the mmdetection library $\overline { { \mathbb { B } 3 } } \Vert$ . + +Results on COCO. In Table $\boxed { 5 }$ we report object detection and instance segmentation results of four variants of XCiT using $1 6 \times 1 6$ and $8 { \times } 8$ patches. We compare to ResNets $\bar { \mathbb { B } } \bar { \mathbb { B } }$ and concurrent efficient vision transformers [44, 70, 81]. All models are trained using the 3x schedule after ImageNet-1k pretraining. Note that other results with higher absolute numbers have been achieved when pre-training on larger datasets $[ \textcircled { 4 4 } ]$ or with longer schedules $\mathbb { H }$ , and are therefore not directly comparable to the reported results. First, across all model sizes XCiT outperforms the convolutional ResNet [28] and ResNeXt $\mathbb { \left. \overline { { \boldsymbol { \mathscr { Q } } \boldsymbol { 5 } } } \right. }$ by a large margin with either patch size. Second, we observe a similar increase in accuracy compared to PVT $\bar { \mathbb { I D } }$ and ViL $\mathbb { \left[ 8 1 \right] }$ backbones. Finally, XCiT provides a competitive performance with Swin $[ \overline { { 1 4 4 } } ] \cdot \big \rrangle ^ { 2 }$ For relatively small models, XCiT-S12/8 outperforms its Swin-T counterpart with a decent margin. On the other hand, Swin-S provides slightly stronger results compared to XCiT-S24/8. Utilizing smaller $8 \times 8$ patches leads to a consistent gain across all models. + +# 4.3 Semantic segmentation + +We further show transferability of our models with semantic segmentation experiments on the ADE20k dataset $\textcircled { 1 8 4 } \textcircled { 1 }$ , which consists of $2 0 \mathrm { k }$ training and 5k validation images with labels over 150 semantic categories. We integrate our backbones in two segmentation methods: Semantic FPN [38] and UperNet $\bar { \textregistered }$ . We train for 80k and 160k iterations for Semantic FPN and UperNet respectively. Following $\textcircled { | 4 4 | }$ , the models are trained using batch size 16 and an AdamW optimizer with learning rate of $6 \times 1 0 ^ { - 5 }$ and 0.01 weight decay. We apply the same method of extracting FPN features as explained in Section $\mathbb { H } . 2 \big \downarrow$ We report the performance using the standard single scale protocol (without multi-scale and flipping). Our implementation is based on the mmsegmentation library $\mathbb { \lVert 1 6 \rVert }$ . + +Results on ADE20k. We present the semantic segmentation performance using XCiT backbones in Table $6 .$ First, for Semantic FPN $\mathbb { B }$ , XCiT provides a superior performance compared to ResNet, ResNeXt and PVT backbones using either option of patch size. Second, compared to Swin Transformers using the same UperNet decoder $\pmb { \Vert 7 4 \Vert }$ , XCiT with $8 \times 8$ patches consistently achieves a higher mIoU for different models. XCiT with $1 6 \times 1 6$ patches provides a strong performance especially for smaller models where XCiT-S12/16 outperforms Swin-T. + +# 5 Conclusion + +Contributions. We present an alternative to token self-attention which operates on the feature dimension, eliminating the need for expensive computation of quadratic attention maps. We build our XCiT models with the cross-covariance attention as its core component and demonstrate the effectiveness and generality of our models on various computer vision tasks. In particular, it exhibits a strong image classification performance on par with state-of-the-art transformer models while similarly robust to changing image resolutions as convnets. XCiT is effective as a backbone for dense prediction tasks, providing excellent performance on object detection, instance and semantic segmentation. Finally, we showed that XCiT can be a strong backbone for self-supervised learning, matching the state-of-the-art results with less compute. XCiT is a generic architecture that can readily be deployed in other research domains where self-attention has shown success. + +Limitations. Our models enable training with smaller patches and on higher-resolution images, which leads to clear performance gains. However, for tasks like image classification this gain comes at a cost of relatively high number of FLOPs. In order to address this issue, other components, like FFN, could also be re-examined. Another point is that XCiT models seem to overfit more than their CaiT counterparts, see Table 2. They are more similar to some convnets in that respect. + +# References + +[1] Joshua Ainslie, Santiago Ontanon, Chris Alberti, Vaclav Cvicek, Zachary Fisher, Philip Pham, Anirudh Ravula, Sumit Sanghai, Qifan Wang, and Li Yang. Etc: Encoding long and structured inputs in transformers. In Conference on Empirical Methods in Natural Language Processing, 2020. +[2] Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia Schmid. Vivit: A ´ video vision transformer. arXiv preprint arXiv:2103.15691, 2021. +[3] Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. +[4] Irwan Bello. LambdaNetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021. +[5] Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020. +[6] Maxim Berman, Hervé Jégou, Andrea Vedaldi, Iasonas Kokkinos, and Matthijs Douze. MultiGrain: a unified image embedding for classes and instances. arXiv preprint arXiv:1902.05509, 2019. +[7] Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? arXiv preprint arXiv:2102.05095, 2021. +[8] Y-Lan Boureau, Jean Ponce, and Yann LeCun. A theoretical analysis of feature pooling in visual recognition. In International Conference on Machine Learning, 2010. +[9] B. De Brabandere, X. Jia, T. Tuytelaars, and L. Van Gool. Dynamic filter networks. In Advances in Neural Information Processing Systems, 2016. +[10] Andrew Brock, Soham De, Samuel L Smith, and Karen Simonyan. High-performance large-scale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021. +[11] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, 2020. +[12] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. arXiv preprint arXiv:2104.14294, 2021. +[13] Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, Zheng Zhang, Dazhi Cheng, Chenchen Zhu, Tianheng Cheng, Qijie Zhao, Buyu Li, Xin Lu, Rui Zhu, Yue Wu, Jifeng Dai, Jingdong Wang, Jianping Shi, Wanli Ouyang, Chen Change Loy, and Dahua Lin. MMDetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019. +[14] Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. +[15] Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020. +[16] MMSegmentation Contributors. MMSegmentation: Openmmlab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation, 2020. +[17] Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, 2020. +[18] Stéphane d’Ascoli, Hugo Touvron, Matthew Leavitt, Ari Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv preprint arXiv:2103.10697, 2021. +[19] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. +[20] Xiaohan Ding, Xiangyu Zhang, Jungong Han, and Guiguang Ding. RepMLP: Re-parameterizing convolutions into fully-connected layers for image recognition. arXiv preprint arXiv:2105.01883, 2021. +[21] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. +[22] Alaaeldin El-Nouby, Natalia Neverova, Ivan Laptev, and Hervé Jégou. Training vision transformers for image retrieval. arXiv preprint arXiv:2102.05644, 2021. +[23] Haoqi Fan, Bo Xiong, Karttikeya Mangalam, Yanghao Li, Zhicheng Yan, Jitendra Malik, and Christoph Feichtenhofer. Multiscale vision transformers. arXiv preprint arXiv:2104.11227, 2021. +[24] Albert Gordo, Jon Almazán, Jérôme Revaud, and Diane Larlus. End-to-end learning of deep visual representations for image retrieval. International journal of Computer Vision, 124, 2017. +[25] Anirudh Goyal, Aniket Didolkar, Alex Lamb, Kartikeya Badola, Nan Rosemary Ke, Nasim Rahaman, Jonathan Binas, Charles Blundell, Michael Mozer, and Yoshua Bengio. Coordination among neural modules through a shared global workspace. arXiv preprint arXiv:2103.01197, 2021. URL https: //arxiv.org/abs/2103.01197. +[26] Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Hervé Jégou, and Matthijs Douze. Levit: a vision transformer in convnet’s clothing for faster inference. arXiv preprint arXiv:2104.01136, 2021. +[27] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv preprint arXiv:2103.00112, 2021. +[28] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Computer Vision and Pattern Recognition, 2016. +[29] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In International Conference on Computer Vision, 2017. +[30] Jonathan Ho, Nal Kalchbrenner, Dirk Weissenborn, and Tim Salimans. Axial attention in multidimensional transformers. arXiv preprint arXiv:1912.12180, 2019. +[31] Grant Van Horn, Oisin Mac Aodha, Yang Song, Alexander Shepard, Hartwig Adam, Pietro Perona, and Serge J. Belongie. The iNaturalist species classification and detection dataset. arXiv preprint arXiv:1707.06642, 2017. +[32] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Computer Vision and Pattern Recognition, 2018. +[33] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European Conference on Computer Vision, 2016. +[34] Andrew Jaegle, Felix Gimeno, Andrew Brock, Andrew Zisserman, Oriol Vinyals, and Joao Carreira. Perceiver: General perception with iterative attention. arXiv preprint arXiv:2103.03206, 2021. +[35] Hervé Jégou, Matthijs Douze, and Cordelia Schmid. Hamming embedding and weak geometric consistency for large scale image search. In European Conference on Computer Vision, 2008. +[36] Hervé Jégou, Florent Perronnin, Matthijs Douze, Jorge Sánchez, Patrick Perez, and Cordelia Schmid. Aggregating local image descriptors into compact codes. IEEE Transactions on Pattern Analysis and Machine Intelligence, 34(9), 2012. +[37] Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and François Fleuret. Transformers are RNNs: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, 2020. +[38] Alexander Kirillov, Ross Girshick, Kaiming He, and Piotr Dollár. Panoptic feature pyramid networks. In Computer Vision and Pattern Recognition, 2019. +[39] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), 2013. +[40] Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, CIFAR, 2009. +[41] James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, and Santiago Ontanon. Fnet: Mixing tokens with fourier transforms. arXiv preprint arXiv:2105.03824, 2021. +[42] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European Conference on Computer Vision, 2014. +[43] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Computer Vision and Pattern Recognition, 2017. +[44] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021. +[45] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. +[46] Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet. arXiv preprint arXiv:2105.02723, 2021. +[47] M-E. Nilsback and A. Zisserman. Automated flower classification over a large number of classes. In Proceedings of the Indian Conference on Computer Vision, Graphics and Image Processing, 2008. +[48] Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, 2018. +[49] J. Philbin, O. Chum, M. Isard, J. Sivic, and A. Zisserman. Object retrieval with large vocabularies and fast spatial matching. In Computer Vision and Pattern Recognition, 2007. +[50] Jiezhong Qiu, Hao Ma, Omer Levy, Scott Wen-tau Yih, Sinong Wang, and Jie Tang. Blockwise selfattention for long document understanding. arXiv preprint arXiv:1911.02972, 2019. +[51] Filip Radenovic, Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, and Ond ´ ˇrej Chum. Revisiting oxford and paris: Large-scale image retrieval benchmarking. In Computer Vision and Pattern Recognition, 2018. +[52] Filip Radenovic, Giorgos Tolias, and Ondrej Chum. Fine-tuning CNN image retrieval with no human ´ annotation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2018. +[53] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In Computer Vision and Pattern Recognition, 2020. +[54] René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. arXiv preprint arXiv:2103.13413, 2021. +[55] Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, 2019. +[56] Zhuoran Shen, Mingyuan Zhang, Haiyu Zhao, Shuai Yi, and Hongsheng Li. Efficient attention: Attention with linear complexities. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, 2021. +[57] Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive attention span in transformers. arXiv preprint arXiv:1905.07799, 2019. +[58] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning. PMLR, 2019. +[59] Giorgos Tolias, Yannis Avrithis, and Hervé Jégou. Image search with selective match kernels: aggregation across single and multiple images. International journal of Computer Vision, 116(3), 2016. +[60] Giorgos Tolias, Ronan Sicre, and Hervé Jégou. Particular object retrieval with integral max-pooling of cnn activations. In International Conference on Learning Representations, 2016. +[61] Giorgos Tolias, Tomas Jenicek, and Ondˇrej Chum. Learning and aggregating deep local descriptors for instance-level recognition. In European Conference on Computer Vision, 2020. +[62] Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. MLP-Mixer: An all-MLP architecture for vision. arXiv preprint arXiv:2105.01601, 2021. +[63] H Touvron, A Vedaldi, M Douze, and H Jégou. Fixing the train-test resolution discrepancy. Advances in Neural Information Processing Systems, 2019. +[64] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers and distillation through attention. arXiv preprint arXiv:2012.12877, 2020. +[65] Hugo Touvron, Andrea Vedaldi, Matthijs Douze, and Hervé Jégou. Fixing the train-test resolution discrepancy: Fixefficientnet. arXiv preprint arXiv:2003.08237, 2020. +[66] Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. ResMLP: Feedforward networks for image classification with data-efficient training. arXiv preprint arXiv:2105.03404, 2021. +[67] Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021. +[68] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017. +[69] Sinong Wang, Belinda Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020. +[70] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021. +[71] Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Computer Vision and Pattern Recognition, 2018. +[72] Ross Wightman. Pytorch image models. https://github.com/rwightman/pytorch-image-models, 2019. +[73] Yuxin Wu and Kaiming He. Group normalization. In European Conference on Computer Vision, 2018. +[74] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In European Conference on Computer Vision, 2018. +[75] Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In Computer Vision and Pattern Recognition, 2017. +[76] Zhenda Xie, Yutong Lin, Zhuliang Yao, Zheng Zhang, Qi Dai, Yue Cao, and Han Hu. Self-supervised learning with swin transformers. arXiv preprint arXiv:2105.04553, 2021. +[77] Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, and Vikas Singh. Nyströmformer: A nyström-based algorithm for approximating self-attention. arXiv preprint arXiv:2102.03902, 2021. +[78] Kun Yuan, Shaopeng Guo, Ziwei Liu, Aojun Zhou, Fengwei Yu, and Wei Wu. Incorporating convolution designs into visual transformers. arXiv preprint arXiv:2103.11816, 2021. +[79] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token ViT: Training vision transformers from scratch on ImageNet. arXiv preprint arXiv:2101.11986, 2021. +[80] Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, et al. Big bird: Transformers for longer sequences. arXiv preprint arXiv:2007.14062, 2020. +[81] Pengchuan Zhang, Xiyang Dai, Jianwei Yang, Bin Xiao, Lu Yuan, Lei Zhang, and Jianfeng Gao. Multiscale vision longformer: A new vision transformer for high-resolution image encoding. arXiv preprint arXiv:2103.15358, 2021. +[82] Hengshuang Zhao, Jiaya Jia, and Vladlen Koltun. Exploring self-attention for image recognition. In Computer Vision and Pattern Recognition, 2020. +[83] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. arXiv preprint arXiv:2012.15840, 2020. +[84] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In Computer Vision and Pattern Recognition, 2017. \ No newline at end of file diff --git a/md/train/ohdw3t-8VCY/ohdw3t-8VCY.md b/md/train/ohdw3t-8VCY/ohdw3t-8VCY.md new file mode 100644 index 0000000000000000000000000000000000000000..7de53fa7cb010f784024fc8f5e158e120c0a886b --- /dev/null +++ b/md/train/ohdw3t-8VCY/ohdw3t-8VCY.md @@ -0,0 +1,417 @@ +# CTRLSUM: TOWARDS GENERIC CONTROLLABLE TEXT SUMMARIZATION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Current summarization systems yield generic summaries that are disconnected from users’ preferences and expectations. To address this limitation, we present CTRLsum, a novel framework for controllable summarization. Our approach enables users to control multiple aspects of generated summaries by interacting with the summarization system through textual input in the form of a set of keywords or descriptive prompts. Using a single unified model, CTRLsum is able to achieve a broad scope of summary manipulation at inference time without requiring additional human annotations or pre-defining a set of control aspects during training. We quantitatively demonstrate the effectiveness of our approach on three domains of summarization datasets and five control aspects: 1) entity-centric and 2) length-controllable summarization, 3) contribution summarization on scientific papers, 4) invention purpose summarization on patent filings, and 5) question-guided summarization on news articles in a reading comprehension setting. Moreover, when used in a standard, uncontrolled summarization setting, CTRLsum achieves state-of-the-art results on the CNN/DailyMail dataset.1 + +# 1 INTRODUCTION + +Neural summarization systems aim to compress a document into a short paragraph or sentence while preserving key information. There are largely two categories of summarization systems: extractive summarization that extracts important portions of a document (Cheng & Lapata, 2016; Nallapati et al., 2017; Narayan et al., 2018), and abstractive summarization that freely generates novel sentences (Rush et al., 2015; See et al., 2017; Paulus et al., 2018) which can produce coherent and fluent summaries more flexibly. In this paper we focus on abstractive summarization. + +Typically abstractive summarization methods take a document as input and yield a generic summary to cover certain information identified by the model. However, content of interest is user-dependent. Summaries should select information with respect to preferences of a user. For example, Figure 1 shows an NBA basketball news article, and the reference summary describes several match results. However, fans of certain basketball stars in these teams such as Lebron James or Stephen Curry might only be interested in the matches they played and would like to know the player’s scores as well. + +Motivated by this, we focus on controllable summarization which allows the users to manipulate the summaries from the model. We propose CTRLsum, a framework to control summaries through control tokens in the form of a set of keywords or descriptive prompts. At training time, the model learns to predict summaries conditioned on both the source document and keywords that serve as external guidance. During inference, keywords and optional prompts, which are the target prefix to constrain decoding, are combined as control tokens to convey user preferences as shown in Figure 1. + +Keywords and prompts are complementary. Prompts do not perform well in many cases such as entity or length controlled summarization as our preliminary experiments imply, but keywords can achieve those goals in a flexible way, for example, by using entity as keywords or varying the number of keywords to control entities and length respectively. However, keywords struggle in more open-ended scenarios like summarizing a list of contributions of scientific papers, while constraining the decoding with prompt “the main contributions of this paper are:(1)” is possibly sufficient to achieve the goal. + +![](images/5c901cc73ab3787b0352de473d89064efd086cdf6105295beeb08609c78ba33d.jpg) +Figure 1: Workflow of the CTRLsum framework at inference time. Users interact with summaries through textual control tokens in the form of keywords or prompts. Keywords are required as input during training and testing, while prompts are optionally used at test time. Dashed lines represent optional paths – control tokens can come from the source article, user, or both. The right portion of the figure shows actual outputs from CTRLsum. + +CTRLsum is trained using only keywords as additional input which can be easily identified from training summaries. It requires neither extra human annotations nor pre-defining control aspects for training, yet is quite flexible to achieve a broad scope of text manipulation as we will show in this paper. In contrast, prior work primarily rely on pre-defined “control codes” (Fan et al., 2018; Liu et al., 2018; Keskar et al., 2019), thus need to collect annotations for training and cannot generalize to unseen control aspects easily at test time. + +We use pretrained BART (Lewis et al., 2019) as the underlying architecture and perform experiments on three datasets in three distinct domains: CNN/Dailymail news articles (Hermann et al., 2015), arXiv scientific papers (Cohan et al., 2018), and BIGPATENT patent documents (Sharma et al., 2019). We quantitatively evaluate CTRLsum on five control aspects: (1) entity-centric $( \ S 4 . 2 )$ and (2) length-controllable summarization $( \ S 4 . 3 )$ , (3) summarizing the contributions of scientific papers, (4) summarizing the purpose of an invention (§4.4), and (5) summarizing answers to given questions in a zero-shot reading comprehension setting (§4.5). Notably, our approach also achieves comparable or superior performance to the strong BART summarization model on all datasets in a standard, uncontrolled setting $( \ S 4 . 6 )$ , leading to state-of-the-art results on the CNN/Dailymail dataset. + +# 2 CTRLSUM + +# 2.1 OVERVIEW + +Unconstrained neural summarization methods are trained to learn the conditional distribution $p ( \mathbf { y } \vert \mathbf { x } )$ , where $\mathbf { x }$ and $\mathbf { y }$ represent the source document and summary respectively. The generated summaries depend solely on the document $\mathbf { x }$ without human involvement. To control the output summaries, we propose using additional control tokens $\mathbf { z }$ to represent user preferences and training a summarization model that predicts the conditional distribution $p ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ . + +The control tokens $\mathbf { z }$ include keywords as extra inputs during training and inference. They can also optionally include prompts at test time to further constrain the decoding process. As shown in Figure 1, control tokens – in the form of keywords, prompts, or a combination of both – act as an interface between users and an otherwise black-box neural model, providing a flexible way for users to explicitly control automatic summarization. Next we describe how to obtain automatic keywords for training as well as potential applications at test time. + +# 2.2 AUTOMATIC KEYWORD EXTRACTION + +In addition to extracting keywords from training data to train the model, CTRLsum also features an automatic keywords extraction mechanism at test time, which can be used to suggest automatic + +keywords according to user preferences, or perform uncontrolled summarization without user signals. +Next we describe the keywords extraction methods at training and inference time respectively. + +Training. For training, we use the ground-truth summary to identify keywords in the source document. Specifically, we first greedily select sentences from the document that maximize the ROUGE scores (Lin, 2004) with the reference summary. This step constrains keywords to those found in important sentences. Then, we identify all the longest sub-sequences in the extracted sentences that have matched sub-sequences in the ground-truth summary, similar to the copying word recognition method in (Gehrmann et al., 2018). Finally, we remove duplicate words and stop words and keep the remaining tokens as keywords. Compared to other keywords extraction methods (Riloff & Lehnert, 1994; Mihalcea & Tarau, 2004) which output only a few salient words, our extraction retains most content words found in the summary. This encourages dependence on the given keywords by building a reliable correlation between their presence in the input and the target. It in turn ensures that user-provided keywords are not ignored by the model at test time, which is catastrophic for a controllable summarization system. + +Inference. We formulate the keyword extraction problem at test time as a sequence labeling task. Concretely, we train a BERT-based sequence tagger (Devlin et al., 2018) on the keywords and documents from training dataset. This tagger then computes the selection probability $q _ { j }$ for each token in the test document. Similar to training time extraction, we first select $n _ { s }$ sentences with the highest average token selection probability. Within these sentences words with $q _ { j } ~ > ~ \epsilon$ are selected as keywords up to a maximum number of $m _ { \mathrm { m a x } }$ . The three hyperparameters $n _ { s } , \epsilon , m _ { \mathrm { m a x } }$ are selected based on the uncontrolled summarization performance on validation datasets. The results are reasonably robust to different settings (see Appendix D for details). + +# 2.3 SUMMARIZATION: TRAINING DETAILS + +Format. At training time we prepend the keyword sequence to the source document separated with a special token. The summarization model is then trained to maximize $p ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ in an end-to-end fashion. The keyword sequence maintains the order of the keywords as they were in the source document, but we observe that the model often ignores this ordering as it frequently differs between source and target summary. We also separate keywords from different source sentences with the special token (“|”). In applications where the sentence boundary is unknown, as when users propose their own keywords, the “|” token can be ignored as in some of our experiments. + +Keyword Dropout. As mentioned in $\ S 2 . 2$ , our keyword extraction strategy retains most words from the summary found in the source document. Without regularization, the dependence on such keywords is strong enough that the model rarely generates novel words in the summary. To remedy this, we randomly drop keywords at training time so that the model learns to rely on keywords that are present in the input, while also learning to still carry over key information from the source document that is not present in the keywords. Note that keywords dropout is applied at training time only. + +Next we are going to introduce the five control aspects that we study in this paper as example use cases of CTRLsum. Qualitative examples of them are shown in Table 1. + +2.4 SUMMARIZATION: INFERENCE WITH KEYWORDS. + +The keywords provide a generic interface to control multiple aspects of summaries, which allows the user to optionally rely on automatically extracted keywords, user provided keywords, or a combination of both. This method provides clean separation of test-time user control and the training process, including pretraining. Consequently, CTRLsum can be adapted to new use cases without changing model parameters. For example, though nothing during training specifically focuses on controlling entities or length, examples below demonstrate the general applicability of keyword control to entity and length manipulation. + +Entity Control. The goal of entity control is to produce summaries that focus on entities of interest. Figure 1 exemplifies summarization with respect to different players when those player names are included as keywords directly influencing the summary. + +Length Control. Users may have different preferences as to the length of summaries. We allow such manipulation of the summary length through a user-specified length parameter. Specifically, we first separate the training data into 5 buckets by summary length so that each bucket has the same number of examples. Then we compute the average number of keywords $K _ { l }$ for each bucket on the training data. At test time, a user can specify length parameter $l \in \{ 0 , 1 , 2 , 3 , 4 \}$ to include the $K _ { l }$ keywords with the highest selection probability computed by the sequence tagger. This is similar to (Saito et al., 2020a), which uses the number of “guiding words” to control summary length. + +Table 1: Qualitative examples from the output of CTRLsum. Left column shows source or the generic reference summary. Keywords are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
Source or Reference Control Aspect Keywords (bolded) or Prompts and Model Output
ISIS- The reinforcements come four days after ISISSource:Hundreds of additional Iraqi troops are being began attacking Baiji oil refinery.sent to reinforce colleagues who are trying to fend offISIS’attempt to overrun Iraq's largest oil refinery,a Hasd Al-Shaabi - The reinforcements come fromkey paramilitary force said Tuesday. The reinforcements Entity Camp Speicher,a fortified Iraqi base near Tikrit. Theycome four days after ISIS began attacking northern Iraq's include two federal police regiments,an Iraqi militaryBaiji oil refinery,a key strategic resource that has long quick reaction force battalion and a regiment from Hasdbeen a target because the facility refines much of the fuel Al-Shaabi.
Baiji oil refinery,a key strategic resource that has longsourcet
been a target because the facility refines much of the fuelfinesmuc
used by Iraqis domestically. The additional troops came(Length bucket O) Iraqi troops ISIS oil refinery l comefrom Camp Speicher,a fortified Iraqi base near the cityof Tikrit,according to the media office of the Hasd Al- days attacking Baiji refinery丨base Tikrit-The re-Shaabimilitia.Thereinforcements include two federal Length inforcements come four days after ISIS began attackingIraq's Baiji oil refinery. The additional troops came frompolice regiments,an Iraqi military quick reaction forcebattalion and a regiment from Hasd Al-Shaabi. [ignoring Camp Speicher,a fortified Iraqi base near Tikrit.
from Camp Speicher
ofTikrit,acc
110 tokens] The refinery is 40 kilometers (25 miles) from[Q:Where did the additional troops come from? A:]Tikrit. QA -CampSpeicher nearthecityofTikrit.
Reference: multiple sclerosis is a degenerative condition [the main contributions of this paper are :(1)]-weof the central nervous system that affects nearly 2.5 mil- propose a regularization- based data analysis pipeline forlion of individuals in terms of their [ignoring 6O tokens]. the prediction of the transition point between relapsing -in this work we resort to regularized machine learning remitting and secondary-progressive forms of multiplemethods for binary classification and multiple output re- Contribution sclerosis ;(2)we test the performance of the proposedgression we propose a pipeline that can be used to predict pipeline on a data set collected from patients currentlythe disease progression from patient reported measures . enrolled in an ongoing funded project ;(3)we discussthe obtained model is tested on a data set collected from the potential role of patient reported outcome measures (an ongoing clinical research project . _proms _)in the study of the disease evolution .
in this work we resort to regularized machine learningmethods for binary classification and multiple output re- Contribution sclerosis ;(2)we test the performance of the proposed
testthep
the disease progression from patient reported measures .
the obtained model is tested on a data set collected from
Reference:an implantable intraocular pressure sensorsystem has a sealed geometric shape with an interal pres-sure at a first value.the sealed geometric shape hasa firstlight permitting surface and a second flexible surface .a [the purpose of the present invention is]-to providepair of photocels is located in the sealed geometric shape Purpose an intraocular pressure measuring system that is small.alight shield is coupled to the second flexible surface . enough to be implanted in the eye of a patientwhen the second flexible surface is deflected,a light mea-surement by the pair of photocells indicates an intraocu-lar pressure condition .
+ +# 2.5 SUMMARIZATION: INFERENCE WITH KEYWORDS AND PROMPTS + +Prompts are pre-defined text sequences used as the target prefix to constrain decoding. They have been utilized to perform multi-purpose text generation with a single unified model (Radford et al., 2019; Brown et al., 2020). In the CTRLsum framework, prompts are a kind of control token sequence, and we always use such tokens as both the target prefix and keywords (ablation results on using prompts as keywords or prefix alone can be found in Appendix C). We find that using prompts as keywords besides prefix helps focus on prompt-related content and mitigate the over-generation issue of vanilla summarization models, as we will show in $\ S 4 . 4$ . To the best of our knowledge, we are the first to evaluate such a prompt-based control method for summarization systems. + +Summarizing Contributions. Existing datasets about scientific papers such as arXiv (Cohan et al., 2018) collect paper abstracts as the summaries, which often include extra background context and lack detailed contribution descriptions for the associated paper. In many cases, readers would benefit from an explicit list of contributions in order to understand the novelty and value of the paper. For these cases, we propose using control tokens – “the main contributions of this paper are:(1)”. This prompt then triggers generation of a summary focused on contributions. + +Summarizing Invention Purpose. Patent article summaries in existing datasets such as BIGPATENT (Sharma et al., 2019) can be over-complicated, often covering core method details. Yet for a non-technical reader it would be preferred to provide a one-sentence summary that states the purpose of the invention while ignoring technical details. To apply CTRLsum in this scenario, we use the control tokens, “the purpose of the present invention is”. This triggers a concise summary focused on patent purpose. + +Question-guided summarization. Human summarization can be constrained by questions (Krys-´ cinski et al., 2019) that require answers to be found in the summary. This points to an important ´ connection between summarization and reading comprehension that we further explore. We hypothesize that a summarization model can directly answer some questions about the article if guided properly. This suggests the possibility of subsuming reading comprehension as a form of summarization. To verify this hypothesis, we use the control tokens $^ { 6 6 } \mathrm { Q }$ : question text? A:” to trigger reading comprehension behaviour. + +We note that prompts- and keywords-based control are complementary in practice – while prompts could theoretically achieve any type of control, empirically they often do not work well for many aspects and the model is very sensitive to the precise wording of the prompt. For example, we found that using prompts such as “a summary focused on [entity] is:” or “a short summary is:” does not work as well as explicitly using keywords for entity or length control (details can be found in Appendix C). + +# 3 RELATED WORK + +Previous work on controllable summarization often collects control codes such as entity or length as supervision to train the model conditioned on both the code and article together (Fan et al., 2018; Liu et al., 2018). These methods do not generalize for controlling aspects of the summarization that were not seen during training. Recently Saito et al. (2020a) use the number of word prototypes to control summary length in a similar way to how we use keywords. Interactive summarization provides a way for users to continuously control the information that is included in the summary (Bornstein et al., 1999; Leuski et al., 2003). More broadly, controllable text generation has been studied for styles (Hu et al., 2017; Fu et al., 2018; He et al., 2020b), topics (Tang et al., 2019; Huang et al., 2019), and templates (Guu et al., 2018; Wiseman et al., 2018; He et al., 2020a). + +Keyword-guided text generation has been applied in other contexts with different motivations. Gehrmann et al. (2018) utilize copying words at test time to mask copying operations in a summarization task. Li et al. (2018) and Saito et al. (2020b) use keywords as extra input to improve the uncontrolled summarization performance. Wang et al. (2016), Mou et al. (2016), and Yao et al. (2019) use textual input to plan poetry, dialogue, and stories respectively. Lexically-constrained decoding specifies certain lexicons as hard constraints in the target text (Hokamp & Liu, 2017; Post & Vilar, 2018). Prefix-constrained decoding was used in machine translation (Knowles & Koehn, 2016; Wuebker et al., 2016) and also to demonstrate the multi-task ability present in large pretrained models (McCann et al., 2018; Radford et al., 2019; Keskar et al., 2019; Brown et al., 2020). + +# 4 EXPERIMENTS + +Our experiments below are designed to (1) test the control efficacy of CTRLsum on five different aspects, and (2) examine the performance of CTRLsum in a traditional summarization setting without external control signals. Also, extensive model output examples can be found in Appendix E. + +# 4.1 EXPERIMENTAL DETAILS + +We perform experiments on three distinct-domain summarization datasets: CNN/Dailymail (CNNDM) news articles (Hermann et al., 2015), arXiv scientific papers (Cohan et al., 2018), and BIGPATENT patent articles (Sharma et al., 2019). For all datasets the source documents are truncated to 1024 tokens and the target summaries are truncated to 256 tokens following (Zhang et al., 2019). The conditional distribution $p ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ in CTRLsum is our fine-tuned version of the pretrained BARTLARGE model (Lewis et al., 2019), which achieves state-of-the-art performance on several summarization benchmarks. The automatic keyword tagger at test time is based on the pretrained BERTLARGE model (Devlin et al., 2018) fine-tuned as described in $\ S 2 . 2$ . Our summarization model implementation is based on the fairseq toolkit (Ott et al., 2019) and the automatic keyword extraction model is based on the HuggingFace Transformers library (Wolf et al., 2019). Complete setup and training details can be found in Appendix A.1. + +Table 2: Summarization performance with oracle entity or length signals from the reference summary. “CTRLsum (automatic)” represents our model using automatic keywords in an uncontrolled setting. LengthCode is a length-control baseline. Both BART and LengthCode numbers are from our runs. + +
ModelCNNDMarXiv
ROUGE-1/2/LBERTScoreROUGE-1/2/LBERTScore
BART(Lewis et al., 2019)44.24/21.25/41.060.33645.16/17.36/40.550.164
CTRLsum (automatic)45.65/22.35/42.500.36346.91/18.02/42.140.169
LengthCode (Fan et al.,2018)43.44/21.10/40.350.34645.91/17.33/41.380.147
CTRLsum (oracle entity)48.75/25.98/45.420.422
CTRLsum (oracle length)46.26/22.60/43.100.36547.58/18.33/42.790.173
+ +Table 3: Entity control results on CNNDM. Success rate is the fraction of decoded summaries that actually mention the given entity, while factual correctness is the fraction of summaries that are judged as factually correct by human annotators. The BART numbers are in terms of unconstrained generated summaries. EntityCode numbers are directly from (Fan et al., 2018), which is obtained with a weaker convolutional seq2seq architecture and requires entity annotations at training time. + +
ModelSuccess Rate (%)Factual Correctness
Lead-3Full-articleImportantUnimportant
BART (Lewis et al., 2019)61.429.098.0
EntityCode (Fan et al.,2018)61.233.81
CTRLsum97.694.899.0100.0
+ +For evaluation, we measure commonly used ROUGE scores (Lin, 2004) and the recently proposed BERTScore (Zhang et al., 2020) when ground-truth is available. For control-related evaluation where we often do not have reference summaries, we (1) collect ground-truth summaries when possible, (2) examine whether summaries respect the control signal, or (3) resort to human evaluation. + +# 4.2 ENTITY CONTROL + +Setup. We first simulate user preference by providing the model with oracle entities extracted from the ground-truth target. Then we compare it to the model using automatic keywords in a uncontrolled setting to show the effect of oracle entities. To examine whether the decoded summaries respect entity change, we sample 100 documents and repeatedly acquire every entity in the document to generate summaries, following Fan et al. (2018). Then we compute Success Rate, the fraction of requested entity actually occurring in the output summaries. The results are reported in separation of whether the entity is from leading 3 sentences or from the full article. To test if the summaries from different entity input are factually consistent with the document, we sample another 100 documents, and for each we randomly sample one “important” entity that appears in the reference, and one “unimportant” entity that occurs neither in the reference nor the leading three source sentences to produce summaries. For each (article, summary) pair we ask 3 annotators from Amazon Mechanical Turk to make a binary decision as to whether the summary can be entailed from the article. We then take the majority vote as the result and report the fraction of factually correct summaries. We evaluate on CNNDM only since many examples in arXiv and BIGPATENT do not have identifiable entities. + +Results. In Table 2 we observe that the use of oracle entities helps boost the ROUGE-2 score by 3.6 points compared with using automatic keywords, which means CTRLsum is able to take advantage of the given entities. Table 3 shows the Success Rate and factual correctness evaluations. We include the numbers from Fan et al. (2018) (EntityCode) for reference point. We note that their numbers come from a convolutional seq2seq architecture (see Appendix B for ablation analysis on this) and their method utilizes entity annotations during training time, thus is not very comparable to CTRLsum. Remarkably, our model achieves a high success rate for both lead-3 and full-article entities reaching around $9 5 \%$ . Yet other systems struggle to include the given entities especially for the ones that do not occur in the beginning of the article. Factual correctness scores from human annotators suggest that CTRLsum is able to generate factually consistent summaries no matter whether the entity of interest is important or not, comparable to the unconstrained BART baseline. + +Table 5: F1 scores on the dev set of NewsQA and SQuAD. GPT2 results are from our runs. The BART baseline and GPT2 use prompts while CTRLsum use the same trigger as both keywords and prompts. + +
ModelCNNDMarXiv
MAD↓PCC个MAD↓PCC↑
BART1.200.001.080.00
CTRLsum (automatic)1.250.000.980.00
LengthCode (Fan et al.,2018)1.17-0.021.060.00
CTRLsum (+length)0.870.530.690.48
+ +Table 4: Length control performance. MAD measures the deviation of output length from reference length, while PCC represents the correlation between given length signal and the actual output length. + +
ModelNewsQASQuAD v1.1
Supervised
SpanBERT(Joshi et al.,2020)73.094.6
MatchLSTM(Wang & Jiang,2017)49.670.0
Zero-Shot
GPT2-Large (774M params, w/o fine-tuning)24.923.5
BART (406M params,w/o fine-tuning)8.215.8
BART (406M params,fine-tuned on CNNDM)32.641.7
CTRLsum (406M params, trained on CNNDM)48.259.6
+ +# 4.3 LENGTH CONTROL + +Setup. Similar to entity control, we first examine the effect of oracle length signal from the reference to simulate user preference. In addition to ROUGE and BERTScore, we measure the length distance between the decoded summary and the reference following (Liu et al., 2018). Specifically, we compute the mean of absolute deviation (MAD) of the actual length bucket code $l _ { \mathrm { s y s } }$ of the decoded summary from the ground-truth control code $l _ { \mathrm { r e f } }$ , as $\begin{array} { r } { \frac { 1 } { N } \sum _ { n } ^ { N } | l _ { \mathrm { s y s } } ^ { ( n ) } - l _ { \mathrm { r e f } } ^ { ( n ) } | } \end{array}$ . To assess the summary variations as length signals change, we further sample 1000 documents and decode 5 different-length summaries for each document. Then we report the Pearson Correlation Coefficient (PCC) between the input bucket code and actual bucket code. Experiments are conducted on CNNDM and arXiv. + +Results. In Table 2 CTRLsum with oracle length signals only presents relatively small gains over the automatic CTRLsum baseline. This implies that oracle lengths only convey limited additional information to help generate the reference summary. We also run the LengthCode baseline (Fan et al., 2018) based on BART, where the ground-truth length bucket code is prepended to the article at both training at test time. However, LengthCode fails to consistently improve over BART with oracle length signals. Moreover, we find that the BART model fine-tuned with LengthCode method almost ignores the length signal with PCC close to 0, as shown in Table 4. This is not very surprising since length code would be less useful when the summarizers grow stronger, which can already learn a good length predictor implicitly. In contrast, CTRLsum with length-guided keywords achieves high positive PCC between control signal and actual output length, and is able to reduce the length deviation MAD compared to automatic baselines. + +# 4.4 CONTRIBUTION AND PURPOSE SUMMARIZATION + +Contribution Summarization Setup. There is no existing dataset to evaluate contribution summarization of scientific papers, bringing challenges to our evaluation. However, researchers often summarize the bullet contributions of their paper in the Introduction section, which inspire us to extract such contribution claims as the reference summary. Therefore, we resort to the entire arXiv database,2 and download all the papers whose first submission time is within the first six months of $2 0 1 9 ^ { 3 }$ that gives us 67K papers. We extract the Introduction section and bullet contributions with regular expression and filter out the ones that fail. The contributions are used as the reference and the Introduction section after removing the contribution claims is used as the source article – we aim to predict contributions from the rest of the introduction section. This procedure leads to 1018 test examples. We test the model trained on arXiv. + +Purpose Summarization Setup. To collect a test dataset that features one-sentence invention purpose summaries, we sample 1000 test examples from BIGPATENT and present their reference summaries to human annotators from Amazon Mechanical Turk. For each example we ask one annotator to select the sentence that convey the purpose of the invention. We also provide the option for annotators that the invention purpose cannot be identified. After filtering out the invalid examples, we collect 763 examples as our test data. + +Table 6: Summarization performance on contributions of papers and purpose of inventions. The BART baseline uses prompts while CTRLsum use the same trigger as both keywords and prompts. + +
ModelContributionPatent Purpose
ROUGE-1/2/LBERTScore (P/R/F1)ROUGE-1/2/LBERTScore (P/R/F1)
BART (prompt)43.84/17.46/25.890.119/0.142/0.13029.05/11.80/22.500.016/0.236/0.107
CTRLsum (prompt+keyword)43.88/18.17/27.790.179/0.098/0.13833.64/11.37/24.240.180/0.152/0.165
+ +Table 7: Uncontrolled summarization performance. Automatic keywords are from the sequence tagger, while oracle keywords are obtained utilizing the gold summaries. We report the oracle performance for a reference point. The BART results are from our runs. BS denotes BERTScore. + +
ModelCNNDMarXivBIGPATENT
ROUGE-1/2/LBSROUGE-1/2/LBSROUGE-1/2/LBS
CTRLsum (Oracle Keywords)64.65/40.42/60.920.55556.08/25.31/50.230.26855.19/26.62/47.100.291
BART (Lewis et al., 2019)44.24/21.25/41.060.33645.16/17.36/40.550.16445.83/19.53/39.470.187
PEGASUS (Zhang et al., 2019)44.17/21.47/41.1144.70/17.27/25.8053.63/33.16/42.251
CTRLsum (Automatic Keywords)45.65/22.35/42.500.36346.91/18.02/42.140.16945.80/18.68/39.060.188
+ +Results. Table 6 shows results of contribution summarization on scientific papers and invention purpose summarization on patent filings. Through using the prompt text as both the decoder prefix and keywords, CTRLsum outperforms the BART baseline in most cases. We further report the precision (P) and recall (R) scores in BERTScore besides F1. We observe that the BART baseline tends to over-generate a full summary with low precision scores while CTRLsum is able to focus on keywords-related content. + +# 4.5 QUESTION-GUIDED SUMMARIZATION + +Setup. We directly test question-guided summarization on reading comprehension benchmarks in a zero-shot setting. Specifically, we evaluate the CNNDM summarization models on in-domain NewsQA (Trischler et al., 2017) and out-of-domain SQuAD 1.1 (Rajpurkar et al., 2016) respectively. We note that some NewsQA test articles are present in the CNNDM summarization training dataset, yet we think it is still a reasonable unsupervised setting since our model never sees questions or answers during training. In addition to comparing with the vanilla BART model, we also include the zero-shot performance from GPT2 language models (Radford et al., 2019) (without fine-tuning) as a reference point. We omit the largest GPT2 model with 1.5B parameters since it cannot be evaluated in our single GPU device due to memory limits. We report F1 scores on the two benchmarks. + +Results. BART is pretrained with a denoising task to predict the denoised version of the source, and performs poorly on zero-shot reading comprehension out of box, as shown in Table 5. Interestingly, however, BART fine-tuned on a summarization task – without seeing any question-answer pairs in the training data – is able to improve the F1 scores by 24.4 and 25.9 points on NewsQA and SQuAD respectively. Moreover, CTRLsum equipped with question keywords is able to further boost the performance by 15.6 and 17.9 points, approaching the supervised MatchLSTM (Wang & Jiang, 2017) score on NewsQA. Such results suggest that summarization might be a suitable transfer task for abstractive reading comprehension, which we leave for future work to explore. + +# 4.6 AUTOMATIC SUMMARIZATION + +Table 7 shows the uncontrolled summarization performance without any user input, where our method uses the automatically extracted keywords as described in $\ S 2 . 2$ . On CNNDM and arXiv datasets CTRLsum outperforms the strong BART and PEGASUS baselines by a large margin, leading to new state-of-the-art performance on CNNDM. It also performs comparably to the BART baseline on BIGPATENT in terms of BERTScore, though with an inferior ROUGE-2 score. Yet there is a big performance gap between BART-based models and PEGASUS on BIGPATENT. The reasons might be different dataset processing,4 sub-optimal learning schedule, or inherent difference between BART and PEGASUS. + +Table 8: Human evaluation scores (scale 1-5, higher is better) on entity control and purpose control experiments. Control accuracy (CA) and control relevance (CR) are reported. A score significantly different (according to the Welch Two Sample t-test, with $\mathsf { p } < 0 . 0 5$ ) than CTRLsum is denoted by $^ *$ . + +
ModelImportant Entity CA CRUnimportant Entity CA CRPurpose CA CR
CTRLsum3.54.24.04.04.03.7
BART3.83.7*1.3*1.2*4.03.0*
+ +Table 9: Human evaluation scores (scale 1-5, higher is better) of uncontrolled summarization performance. Evaluation Dimensions from left to right are: factual consistency (FAC), relevance (REL), fluency (FLU), coherence (COH). A score significantly different (according to the Welch Two Sample t-test, with $\mathsf { p } < 0 . 0 5 ,$ ) than CTRLsum (Automatic Keyword) is denoted by $^ *$ . + +
ModelCNNDM FAC/REL/FLU/COHarXiv FAC/REL/FLU/COHBIGPATENT FAC/REL/FLU/COH
CTRLsum (Automatic Keyword)4.6/4.6/4.1/4.14.1/4.3/4.1/4.14.2/4.2/4.0/4.1
BART4.6/4.7/4.2/4.14.1/4.1*/3.9/4.04.2/4.3/4.1/4.0
CTRLsum (Oracle Keyword)4.6/4.7/4.1/4.14.2/4.3/4.0/4.14.2/4.2/4.2*/4.1
+ +# 4.7 HUMAN EVALUATION + +In this section we present human evaluation results for both controlled and uncontrolled summarization. Full experiment details can be found in Appendix A.2. + +Controlled Summarization. We present further human evaluation results to evaluate “control” directly by informing annotators the intended control signal. We conduct experiments on entity and purpose control. Specifically, we inform the annotators our intent (to obtain summaries focused on a specific entity or purpose of patent), then we ask them to provide scores in scale 1-5 over two dimensions: (1) Control Accuracy (CA): whether the summary contains accurate main information with respect to the intent, and (2) Control Relevance (CR): how the summary is relevant to the control intent overall – a summary that contains redundant contents that are unrelated to the intent will be penalized. Results including significance tests are shown in Table 8. The control accuracy for important entity control and purpose control are comparable between BART and CTRLsum without significant difference ( $\mathbf { \bar { p } }$ -value $> 0 . 0 5 $ ), while CTRLsum shows significantly better control relevance overall by focusing on the desired information. Also, the unconstrained BART are unable to generate unimportant-entity-related summaries and thus suffers from poor scores on both dimensions. + +Uncontrolled Summarization. We follow (Grusky et al., 2018; Fabbri et al., 2020) to ask human annotators from Amazon Mechanical Turk to score summaries (scale 1-5) over four dimensions: (1) Factual Consistency (FAC): the summary should only contain statements that can be entailed by the source document, (2) Relevance (REL): the summary should only contain important information of the source document, (3) Fluency (FLU): each sentence in the summary should be fluent, and (4) Coherence (COH): the summary should be well-structured and well-organized. Results including significance tests are present in Table 9. The quality of summaries from all systems on all dimensions is generally good with a score mostly higher than 4.0. However, most scores do not show significant difference from CTRLsum (Automatic Keyword) with large p-values, despite their very different similarities against the reference summaries in terms of ROUGE/BERTScore (e.g. CTRLsum with oracle keywords). This implies that the summary quality from different systems powered by strong pretrained models like BART has become difficult to be clearly distinguished by non-expert MTurkers. We also note that non-expert human judgement for summarization may be unreliable and exhibit poor correlation with expert judgement (Gillick & Liu, 2010; Fabbri et al., 2020). + +# 5 CONCLUSION + +In this paper we propose a generic framework to perform multi-aspect controllable summarization. The model is conditioned on keywords to predict summaries during training. At inference time the control tokens, in the form of keywords or prompts, enable users to interact with models in a very flexible way. Experiments on five different control aspects demonstrate the efficacy of our method. + +# REFERENCES + +Jeremy J Bornstein, Douglass R Cutting, John D Hatton, and Daniel E Rose. Interactive document summarization, 1999. US Patent 5,867,164. + +Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. + +Jianpeng Cheng and Mirella Lapata. Neural summarization by extracting sentences and words. In Proceedings of ACL, 2016. + +Arman Cohan, Franck Dernoncourt, Doo Soon Kim, Trung Bui, Seokhwan Kim, Walter Chang, and Nazli Goharian. A discourse-aware attention model for abstractive summarization of long documents. In Proceedings of NAACL (Short Papers), 2018. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. + +Alexander R Fabbri, Wojciech Krysci ´ nski, Bryan McCann, Caiming Xiong, Richard Socher, ´ and Dragomir Radev. Summeval: Re-evaluating summarization evaluation. arXiv preprint arXiv:2007.12626, 2020. + +Angela Fan, David Grangier, and Michael Auli. Controllable abstractive summarization. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation, 2018. + +Zhenxin Fu, Xiaoye Tan, Nanyun Peng, Dongyan Zhao, and Rui Yan. Style transfer in text: Exploration and evaluation. 2018. + +Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. In Proceedings of ICML, 2017. + +Sebastian Gehrmann, Yuntian Deng, and Alexander M Rush. Bottom-up abstractive summarization. In Proceedings of EMNLP, 2018. + +Dan Gillick and Yang Liu. Non-expert evaluation of summarization systems is risky. In Proceedings of the NAACL HLT 2010 Workshop on Creating Speech and Language Data with Amazon’s Mechanical Turk, 2010. + +Max Grusky, Mor Naaman, and Yoav Artzi. Newsroom: A dataset of 1.3 million summaries with diverse extractive strategies. In NAACL, 2018. + +Kelvin Guu, Tatsunori B Hashimoto, Yonatan Oren, and Percy Liang. Generating sentences by editing prototypes. Transactions of the Association for Computational Linguistics, 6:437–450, 2018. + +Junxian He, Taylor Berg-Kirkpatrick, and Graham Neubig. Learning sparse prototypes for text generation. In Proceedings of NeurIPS, 2020a. + +Junxian He, Xinyi Wang, Graham Neubig, and Taylor Berg-Kirkpatrick. A probabilistic formulation of unsupervised text style transfer. In Proceedings of ICLR, 2020b. + +Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Proceedings of NeurIPS, 2015. + +Chris Hokamp and Qun Liu. Lexically constrained decoding for sequence generation using grid beam search. In Proceedings of ACL, 2017. + +Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P Xing. Toward controlled generation of text. In Proceedings of ICML, 2017. + +Qiuyuan Huang, Zhe Gan, Asli Celikyilmaz, Dapeng Wu, Jianfeng Wang, and Xiaodong He. Hierarchically structured reinforcement learning for topically coherent visual story generation. In Proceedings of AAAI, 2019. + +Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. Spanbert: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics, 8:64–77, 2020. + +Nitish Shirish Keskar, Bryan McCann, Lav R Varshney, Caiming Xiong, and Richard Socher. Ctrl: A conditional transformer language model for controllable generation. arXiv preprint arXiv:1909.05858, 2019. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of ICLR, 2015. + +Rebecca Knowles and Philipp Koehn. Neural interactive translation prediction. In Proceedings of the Association for Machine Translation in the Americas, pp. 107–120, 2016. + +Wojciech Krysci ´ nski, Nitish Shirish Keskar, Bryan McCann, Caiming Xiong, and Richard Socher. ´ Neural text summarization: A critical evaluation. In Proceedings of EMNLP, 2019. + +Anton Leuski, Chin-Yew Lin, and Eduard Hovy. ineats: interactive multi-document summarization. In Proceedings of ACL, 2003. + +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019. + +Chenliang Li, Weiran Xu, Si Li, and Sheng Gao. Guiding generation for abstractive text summarization based on key information guide network. In NAACL (Short Papers), 2018. + +Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, 2004. + +Yizhu Liu, Zhiyi Luo, and Kenny Zhu. Controlling length in abstractive summarization using a convolutional neural network. In Proceedings of EMNLP, 2018. + +Bryan McCann, Nitish Shirish Keskar, Caiming Xiong, and Richard Socher. The natural language decathlon: Multitask learning as question answering. arXiv preprint arXiv:1806.08730, 2018. + +Rada Mihalcea and Paul Tarau. TextRank: Bringing order into text. In Proceedings of EMNLP, 2004. + +Lili Mou, Yiping Song, Rui Yan, Ge Li, Lu Zhang, and Zhi Jin. Sequence to backward and forward sequences: A content-introducing approach to generative short-text conversation. In Proceedings of COLING, 2016. + +Ramesh Nallapati, Feifei Zhai, and Bowen Zhou. SummaRuNNer: a recurrent neural network based sequence model for extractive summarization of documents. In Proceedings of AAAI, 2017. + +Shashi Narayan, Shay B Cohen, and Mirella Lapata. Ranking sentences for extractive summarization with reinforcement learning. In Proceedings of NAACL, 2018. + +Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan $\mathrm { N g }$ , David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL (Demo Paper), 2019. + +Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. In Proceedings of ICLR, 2018. + +Matt Post and David Vilar. Fast lexically constrained decoding with dynamic beam allocation for neural machine translation. In Proceedings of NAACL, 2018. + +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8):9, 2019. + +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proceedings of EMNLP, 2016. + +Ellen Riloff and Wendy Lehnert. Information extraction as a basis for high-precision text classification. ACM Transactions on Information Systems (TOIS), 12(3):296–333, 1994. + +Alexander M Rush, Sumit Chopra, and Jason Weston. A neural attention model for abstractive sentence summarization. In Proceedings of EMNLP, 2015. + +Itsumi Saito, Kyosuke Nishida, Kosuke Nishida, Atsushi Otsuka, Hisako Asano, Junji Tomita, Hiroyuki Shindo, and Yuji Matsumoto. Length-controllable abstractive summarization by guiding with summary prototype. arXiv preprint arXiv:2001.07331, 2020a. + +Itsumi Saito, Kyosuke Nishida, Kosuke Nishida, and Junji Tomita. Abstractive summarization with combination of pre-trained sequence-to-sequence and saliency models. arXiv preprint arXiv:2003.13028, 2020b. + +Abigail See, Peter J Liu, and Christopher D Manning. Get to the point: Summarization with pointer-generator networks. In Proceedings of ACL, 2017. + +Eva Sharma, Chen Li, and Lu Wang. BIGPATENT: A large-scale dataset for abstractive and coherent summarization. In Proceedings of ACL, 2019. + +Jianheng Tang, Tiancheng Zhao, Chenyan Xiong, Xiaodan Liang, Eric Xing, and Zhiting Hu. Targetguided open-domain conversation. In Proceedings of ACL, 2019. + +Adam Trischler, Tong Wang, Xingdi Yuan, Justin Harris, Alessandro Sordoni, Philip Bachman, and Kaheer Suleman. Newsqa: A machine comprehension dataset. In Proceedings of the 2nd Workshop on Representation Learning for NLP, 2017. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of NeurIPS, 2017. + +Daisy Zhe Wang, Wei He, Hua Wu, Haiyang Wu, Wei Li, Haifeng Wang, and Enhong Chen. Chinese poetry generation with planning based neural network. In Proceedings of COLING, 2016. + +Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. In Proceedings of ICLR, 2017. + +Sam Wiseman, Stuart M Shieber, and Alexander M Rush. Learning neural templates for text generation. In Proceedings of EMNLP, 2018. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Huggingface’s transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771, 2019. + +Joern Wuebker, Spence Green, John DeNero, Saša Hasan, and Minh-Thang Luong. Models and inference for prefix-constrained machine translation. In Proceedings of ACL, 2016. + +Lili Yao, Nanyun Peng, Ralph Weischedel, Kevin Knight, Dongyan Zhao, and Rui Yan. Plan-andwrite: Towards better automatic storytelling. In Proceedings of AAAI, 2019. + +Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter J Liu. Pegasus: Pre-training with extracted gap-sentences for abstractive summarization. arXiv preprint arXiv:1912.08777, 2019. + +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. BERTScore: Evaluating text generation with bert. In Proceedings of ICLR, 2020. + +# A EXPERIMENTAL SETUP DETAILS + +# A.1 GENERAL SETUP + +In this section we include additional experimental details left out in the main content due to space limitations. We fine-tune the pretrained BARTLARGE model in all our experiments. Specifically we use the bart.large checkpoint from fairseq (Ott et al., 2019). For all BART-based summarization models, we fine-tune with learning rate 3e-5 and a polynomial learning rate decay schedule, the optimizer is Adam (Kingma & Ba, 2015) and batch size is 64. Our optimization scheme and hyperparameters follow the BART fine-tuning instructions in fairseq examples. We train the summarization models with $2 0 \mathrm { k }$ steps on CNNDM, 50k steps on arXiv, and $3 0 0 \mathrm { k }$ steps on BIGPATENT. We train the BERT tagger with learning rate 5e-5, Adam optimizer, and batch size of 128 on all datasets. Similar to summarization models, the tagger is trained with 20k, 50k, and $3 0 0 \mathrm { k }$ steps on CNNDM, arXiv, and BIGPATENT respectively. Also, we adopt a sliding window approach so that the BERT-based tagger is able to handle sequences that are longer than 512 tokens. For both ROUGE and BERTScore evaluation, we report the F1 measure. We report the rescaled BERTScore, and the hash code is roberta-large_L17_no-idf_version $= 0$ .3.6(hug_tran $s { = } 3 \ldots 0 \ldots 2$ )-rescaled. + +As mentioned in $\ S 2 . 2$ , we need three hyperparameters for automatic keywords extraction during inference – the number of pre-selected sentences $n _ { s }$ , the selection probability threshold $\epsilon$ , and the maximum number of keywords $m _ { \mathrm { m a x } }$ . We select these hyperparameters for each dataset based on the uncontrolled summarization ROUGE-2 score on validation dataset. The summarization performance is robust to these hyperparameters in a reasonable range, as shown in Appendix D. Specifically, we use $\{ n _ { s } = 1 0 , \epsilon = \bar { 0 } . 2 \bar { 5 } , m _ { \mathrm { m a x } } = 3 0 \}$ for CNNDM, $\bar { \{ n _ { s } = 1 0 , \epsilon = 0 . \bar { 1 5 } } $ , $m _ { \operatorname* { m a x } } = 4 0 \}$ for arXiv, and $\{ n _ { s } = 5 , \epsilon = 0 . 1 5 , m _ { \mathrm { m a x } } = 3 0 \}$ . + +Invention Purpose Summarization. In the experiment of summarizing invention purpose on patent articles (§4.4). We examined whether the model would possibly copy source sentences through matching the prompts, we search strings in the form of “the purpose of [some words or phrases] is” among 763 test examples, and only 3 test articles are identified. This means the models are not generating by exactly matching prompts most of the time. + +# A.2 HUMAN EVALUATION SETUP + +Here we include details about human evaluation experiments in $\ S 4 . 7$ + +Controlled Summarization. For controlled summarization, we sample 100 examples for each task, and summaries of each example from all systems are presented together to the human annotator to be scored. For CNNDM we provide article and summaries, while for BIGPATENT we provide reference and summaries using the reference summary as a surrogate for the source article. This is because the source patent documents are very long and hard to be read by non-expert humans. We did not evaluate contribution summarization since it is unrealistic to ask humans to judge contributions of many scientific papers from various domains. We tried to hire workers from Amazon Mechanical Turk first, but we failed to obtain reliable results from them – they often ignored the given user intent and tended to score the text as uncontrolled summaries (reflected by very poor scores on unimportant-entity summaries because these summaries do not contain the main information of the article), even though we instructed them that the control signal is critical. Therefore, we ask two independent human annotators through personal correspondence from the authors of this paper. One of the annotator is a PhD researcher on physics, and the other is a law graduate on intellectual property in the United States. They are able to follow the given control intent and considered more reliable than the MTurkers. We take the average of two annotators as the score for each example, and average over all examples to obtain the final score. + +Uncontrolled Summarization. For uncontrolled summarization, we sample 100 examples for each dataset, and hire 3 independent workers from Amazon Mechanical Turk to conduct evaluation. For CNNDM we provide article and summaries, while for arXiv and BIGPATENT we provide reference and summaries using the reference summary as a surrogate for the source article. This is because the source patent documents or scientific papers are very long and hard to be read by non-expert humans. Summaries of each example from all systems are presented together to the human annotator to be scored. The median score of 3 workers is taken for each example, and average over all examples is reported. + +# B ABLATION ANALYSIS OF ENTITY CONTROL + +In Table 3 we observe that CTRLsum achieves a very high success rate $( \sim 9 5 \%$ ) of entity control, compared to previous work (Fan et al., 2018) which can only succeed $6 1 . 2 \%$ and $3 3 . 8 \%$ of the time on lead-3 and full-article entities respectively. We perform ablation analysis to understand the important gradients that contribute to the success of CTRLsum. We train CTRLsum with another two architectures in addition to BART: (1) convolutional seq2seq (Gehring et al., 2017) with the same hyperparameters as in (Fan et al., 2018), and (2) transformer seq2seq with the same hyperparameters as the base model in (Vaswani et al., 2017). Note that the transformer model is trained from scratch without pretraining. Results are shown in Table 10. CTRLsum parameterized with a weaker convolutional seq2seq architecture fails to depend on the keywords well with an over 40-point success rate drop, yet the success rate of transformer seq2seq without pretraining only drops around 5 points. This implies that the transformer seq2seq architecture is critical for CTRLsum to depend on the keywords well, while pretraining can further improves it.5 + +Table 10: Entity control results on CNNDM. Success rate is the fraction of decoded summaries that actually mention the given entity. + +
ModelSuccess Rate (%) Lead-3Full-article
BART (Lewis et al.,2019)61.429.0
Fan et al. (2018)61.233.8
CTRLsum (Conv Seq2Seq)50.123.3
CTRLsum (Transformer Seq2Seq)92.688.3
CTRLsum (BART)97.694.8
+ +# C ABLATION ANALYSIS ON KEYWORDS AND PROMPTS + +In the controlling aspects we studied CTRLsum uses control tokens either as keywords alone (entity and length), or as keywords and prompts together (contribution, purpose, QA). Here we present further results when control tokens are used as prompts, keywords, or both for entity control, contribution control, and NewsQA tasks. Specifically for entity control, we use the control tokens $^ { 6 6 } \mathrm { { \hat { d } } }$ summary focused on [entity] is:” for “prompt” and “prompt $^ +$ keyword” variants.6 In this case success rate is computed excluding the prompt text. The control tokens for other settings are the same as previous experiments. Results are shown in Table 11, where keywords and prompts are of different importance for different tasks and are complementary in general. For example, using prompts to control entities turns out to be difficult with a very low success rate – we find that the system fails to understand the prompt and produce summaries appropriately in most cases. However, prompts contribute the most to contribution summarization with comparable performance with using prompts and keywords together, while removing prompts and using keywords alone suffers from drastic performance drop to trigger the contribution. For NewsQA task, prompts and keywords demonstrate mixing effectiveness – using either of them alone experiences over 20 F1 points loss compared to using them together. + +Table 11: Ablation analysis on the role of keyword and prompt respectively. Entity success rate refers to the full article entity success rate. + +
ModelEntity Success Rate (%ContributionNewsQA F1
ROUGE-1/2/LBERTScore
CTRLsum (keyword)94.839.96/12.74/22.680.08815.5
CTRLsum (prompt)17.643.82/18.12/27.640.13326.3
CTRLsum (prompt + keyword)12.643.88/18.17/27.790.13848.2
+ +# D ROBUSTNESS ANALYSIS OF KEYWORDS EXTRACTION HYPERPARAMETERS + +Table 12 shows the ROUGE-2 scores of uncontrolled summarization on the validation set with different keywords extraction hyperparameters. We use more fine-grained stride size to iterate the $m _ { \mathrm { m a x } }$ hyperparameter for CNNDM since its source articles are usually shorter than arXiv and BIGPATENT. As observed, the automatic summarization performance is relatively robust to these hyperparameters in a reasonable range. + +Table 12: ROUGE-2 scores of uncontrolled summarization on the validation set with different keywords extraction hyperparameters. + +
ModelCNNDMarXivBIGPATENT
∈= 0.10,ng = 5,mmax = 2522.8211
∈= 0.10,ns = 5,mmax = 3022.7117.8118.60
∈= 0.10,ns = 5,mmax = 3522.541
∈= 0.10,ns = 5,mmax = 40117.9618.35
∈ = 0.10,ns = 10,mmax = 2522.83
∈= 0.10,ns = 10,mmax = 3022.6717.9918.61
∈= 0.10,ng=10,mmax =3522.4411
∈= 0.10,ng = 10,mmax = 4018.0318.04
∈= 0.15,ng = 5,mmax = 2522.8511
∈= 0.15,ns = 5,mmax = 3022.7917.8018.79
∈=0.15,ns=5,mmax= 3522.7111
∈ = 0.15,ns= 5,mmax = 40117.9518.76
∈= 0.15,ns = 10,mmax = 2522.85
∈= 0.15,ng= 10,mmax=3022.7717.9918.76
∈= 0.15,ns = 10,mmax = 3522.41
∈= 0.15,ns = 10,mmax = 4018.0518.62
∈=0.20,ns=5,mmax =2522.8611
∈= 0.20,ns = 5,mmax = 3022.8717.7118.77
∈= 0.20,ns=5,mmax =3522.8911
∈= 0.20,ns = 5,mmax = 4017.8818.71
∈= 0.20,ns = 10,mmax = 2522.8711
∈= 0.20,ng= 10,mmax =3022.8517.8818.77
∈= 0.20,ns = 10,mmax = 3522.841
∈= 0.20,ng = 10,mmx =40117.9818.73
∈= 0.25,ns = 5,mmax = 2522.84
∈= 0.25,ns= 5,mmax = 3022.8817.5718.67
∈= 0.25,ng= 5,mmax = 3522.9111
∈= 0.25,ns = 5,mmax = 4017.7118.66
∈= 0.25,ns = 10,mmax = 2522.9011
∈= 0.25,ns=10,mmax = 3022.9517.7618.72
∈= 0.25,ng = 10,mmax = 3522.9511
∈= 0.25,ng=10,mmax =4017.8418.70
∈= 0.30,ng = 5,mmax = 2522.581
∈=0.30,ns= 5,mmax =3022.6217.2418.53
∈= 0.30,ng = 5,mmax = 3522.63
∈ = 0.30,ng = 5,mmax = 40117.3218.52
∈ = 0.30,ns = 10,mmax=25 22.6511
∈= 0.30,ns = 10,mmax = 3022.7017.3818.55
∈ = 0.30,ng= 10,mmax=35 22.7011
∈= 0.30,ng = 10,mmax= 40 117.4418.55
+ +# E RANDOM OUTPUT EXAMPLES + +In this section, we randomly sample test examples and show the source aticle, reference summary, and the model output from CTRLsum for each control aspect. + +# E.1 ENTITY CONTROL + +For entity control, we randomly sample 3 articles from CNNDM and for each article we randomly select 5 entites as keywords to show the model output. + +Table 13: Random Entity Control Examples + +
ArticleAmericanson the United States’no-fly list willnow be privyto information about why they have been banned from commercial flights and be given the opportunity to dispute their status,according to court documents filed by the Justice Department this week.The revised policy comes in response to a June ruling bya federal judge that said the old process Was in violation of the Fifth Amendment's guarantee of due process.The decision was part of an American Civil Liberties Union lawsuit brought on behalf of 13 Americans on the list.But the ACLUisn't satisfied with the government's new policy,outlined in documents filedMonday in federalcourts in Oregon (PDF)and Virginia(PDF)."After years of fighting in court for complete secrecy and losing,it's good that the governmentis finally now going to tellpeople of their status on theNoFlyList,"said Hina Shamsi, directorof the ACLUNational Security Projectand the lead atorneyonthecase,ina statement."Unfortunately, we've found that te government's new redress processfals far short ofconstitutional requirements because it denies our clients meaningful notice,evidence,and a hearing.The government had an opportunity to come up with a fair processbut failed,so we're challenging it incourt again."Peopleon the no-flylist,managed by the FBI's Terrorist Screening Center,are prohibited from boarding a commercial flight for travel into orout of the United States.The numberof people on the list is classified.An official with knowledgeofthe government's figures told CNN in 2012 thatthe list contained about 21,OOO names,including about 5O0 Americans.Before the change,American citizens and permanent residents who inquired with the government about being denied aircraft boarding received aleter that neitherconfirmed nor denied their inclusionon the no-flylist.Now,they'l be made aware of their status if they apply for redress,with an option to request further information."The U.S. government is making enhancements to the Department of Homeland Security Traveler Redress Inquiry Program (DHS TRIP)to provide additional transparency and proces for U.S.citizens and lawful permanent residents who have been denied boarding onacommercial aircraft because theyare on the NoFly List,"the Department of Homeland Securitysaid in a statement.Incases in which travelers included on the list request to receive or submit more information about their status,the government willprovide asecond,more detailed response, identifying "specific criterionunder which the individual has been placed on the No FlyList,"according to the court documents.An unclassified summary of that information willbe provided "to the extent feasible, consistent with the national security and law enforcement interests at stake,"court papers said.Those who appear on the no-fly list willthen have further opportunity to dispute their status in writing,with supporting materials or exhibits,and willreceive afinal written decision from the Transportation Security Administration.
Reference Summaryto dispute their status before a judge. Americans on the no-fly list willnow get info about why they've been banned from flights.ACLU says the policy still denies“meaningful notice,evidence,and a hearing"
CTRLsumthe Fifth Amendment's:The new policy is inresponse to a June ruling that said the old process was in violation of the Fifth Amendment's guarantee of due process. Civil Liberties Union:The American Civil Liberties Union says it's not satisfied with the govern- ment's new policy. the Transportation Security Administration:The Transportation Security Administration will pro-
vide travelers with more information about their status.A June ruling had called for passengers on the list to be given the opportunity to dispute their status before a judge. Virginia: The ACLU is challenging the new policy in federal courts in Oregon and Virginia. FBI:People on the no-fly list,managed by the FBI's Terrorist Screening Center,are prohibited from boarding commercial flights.The ACLU isn't satisfied with the government's new policy.
+ +Table 14: Random Entity Control Examples + +
ArticlePoint guard Stephen Curry nearly single-handedly outscored New Orleans with11 first-quarter points as the Wariors built a15-point lead and rolled to victory in Game One of their Western Conference first-round series. Game Two in the best-of-seven series is scheduled for Monday night in Oakland.Golden State,the top seed in the West,picked up right where it leftoff in the regular season,recordinga19th straight home winand 40th in 42 games this year.Stephen Curry scored a stunning 34 points for the Golden State Warriors in there play-off game.The Warriors did itby takinga 25-point lead into the finalminute of the third quarter,then holding on. 'We missed a lotof free throws,which made it alotcloser than it needed to be,coach Steve Kerr said.But in the playoffs you've just gotto getitdone somehow.We'reup 1-O.That’s where we want to be.'Curry led the Warriors with 34 points,hitting 13of25 shotsand fourthree-pointers.Allfive Golden State starters scored in double figures.Guard Klay Thompson complemented Curry with 21 points,while power forward Draymond Green (15 points,12 rebounds)and center Andrew Bogut (12 points,14 rebounds)recorded double-doubles. The point guard has been in spectacular formas he looks to lead the Warriors to the NBA glory.Currycelebrates after scoring athree-pointeron his way to scoring 1 first quarter points.New Orleans power forward Anthony Davis scored a game-high 35 points,2O in the fourth quarter.Healso blocked four shotsand grabbed seven rebounds.Smallforward Quincy Pondexter,assigned to cover Curry most of the game,added 2O points for thePelicans..Visiting Washington outscored Toronto11-4 in the overtime in winning the opener of their first-round playoff series.Washington traveled to Toronto and came away with the victory with aconfident overtime performance.Forward Paul Pierce started the overtime with a three-pointer and scored 2O points to lead the Wizards,who leta15-point lead slipaway in the fourth quarter before winning.Guard Bradley Beal added 16 points for Washington and forward Nene contributed 12 points and 13 rebounds.Forward Amir Johnson
Reference Summary(left) top-scored in the clash with 2O points as the Wizards secured an important play-off win. Stephen Curry scored 34 points for Golden State against New Orleans.The Californian-based team defeated the Pelicans 1O6-99.Washington Wizards outscored the Toronto Raptors 11-4 inovertime.Paul Pierce led the scoring with 2O points for the Wizards.
CTRLsumStephen Curry:Stephen Curry scored 34 points as Golden State Warriors beat New Orleans Pelicans. Washington Wizards beat Toronto Raptors in overtime in play-off game. Oakland:Stephen Curry scored 34 points for the Golden State Warriors.Game Two in the best-of- seven series is scheduled for Monday night in Oakland. Steve Kerr:Stephen Curry scored 34 points as the Warriors beat the Pelicans.Coach Steve Kerr said:‘We missed a lot of free throws,which made it a lot closer than it needed to be' Klay Thompson: Stephen Curry scored 34 points as the Warriors beat the Pelicans.Klay Thompson and Draymond Green also scored in double figures .
+ +Table 15: Random Entity Control Examples + +
burst into laughteras soonas she spoted it.Itdid,however,provean immediate hit with apairof policesniffer dogs who wagged their tailsastheygaveitathorough snifingdown..Theartwork,whichhas been givenpride of place in the shopping mal's atrium,was commissionedby UKTVto mark celebrate itsscreening of the third series of Sherlock.It took a crew of eight people to complete the sculpture,which took over 250 man hours to create and weighs 40kg.Does it look like me? Benedict Cumberbatch strikes a pose with James Corden duringIt's the ultimate treat for BenedictCumberbatch fans and stands an imposing 6fttall- just like the man himself. But shoppers atLondon's Westfield StratfordCity shopping centre looked more thanalitlesurprised to discover achocolate sculpture of Benedict Cumberbatch in their midst.One lady was spoted cautiously approaching the edibleartwork before quickly backing of,while anothercouldn't quite hide their smile of surprise. Scrolldown for video.Finishing touches:The sculpture is readiedforits big unveiling at Westfield Stratford Cityshopping centre.Oh dear:Reaction to the sculpture was mixed, with some shoppers bursting into laughter. Even less impressed was the shopper who stood stony-faced in front of the creation forseveral moments,while another
ArticleHilarious:Alady bursts into laughter after spoting the 6ft homage to MrCumberbatch.Notamused:A shopper looks thoroughlyunimpressed as she contemplates the artwork.Luckily for Cumberbatch, who usually enjoys a considerably more complimentaryresponse to projects he's involved in, the piece willonlybe inresidence temporarily.The38-year-oldactor,who iscurrentlyexpecting his first child with wifeSophie Hunter,37,isn't theonly famous face to have found himself the subject of an edible artwork..In the run up to the release of 50 Shades of Grey,bakers created not one but two 6ft gateaux paying homage to Jamie Dornan.One depicted the actor inthe grey suit beloved of his 5O Shades character Christian Grey,whilethe other showed himtopless and came complete with an edible six-pack.Award-winning:Both Jennifer Lawrence and her cake alter-ego have won awards.Homage:The cake,which triumphed ata show last November,was inspiredby the Hunger Games . Actress Jennifer Lawrence has also been immortalised incake,with bakerLara Clarke creating a sweet treat designed to resemble the24-year-old's Hunger Games alter-ego,Katniss Everdeen.Theconfection, which was baked ahead of the releaseof Mockingjay Part One in November,met with the approval of Lawrence herself, who,whenasked about it,saidMs Clarke was ‘incrediblytalented'.OtherA-listers toget theculinary treatment include Kevin Bacon,whose likeness was made from bacon,and Taylor Swift who featured on a cake.The Duke and Duchess of Cambridge were turned into a tasty-looking pizza,while President Barack Obama had his likenesssculpted from butter.Immortalised:The Duke and Duchess of Cambridge have been turned into pizza in the past.ribute: Kevin Bacon has a bacon sculpture to his name while Jamie Dornan has ben made into a cake. A 6ft chocolate sculpture of Benedict Cumberbatch has been unveiled.Toothsome statue has been placed inside
Reference SummaryaLondon shopping centre.But shoppers reactions to the creations were decidedly unenthusiastic.One woman glared at it while others just looked thoroughlybafled.Itdid manage to win the approval of pair of police sniffer dogs.It weighs 40kg and took eight people 250 man hours to create .Other celebrities to get culinary tributes include JenniferLawrence.Her 6ft cake wonan award-and the 24-year-old's approval.Actor Kevin Bacon has also been immortalised - in bacon . Westfield: The sculpture was unveiled at London's Westfield Stratford City shopping centre.
CTRLsumJames Corden:Benedict Cumberbatch is not the only famous face to be immortalised in chocolate. JenniferLawrence and James Corden have also been turned into cakes . Sophie Hunter:Actor,38,is expecting his first child with wife Sophie Hunter. Jamie Dornan:Shoppers at London's Westfield Stratford City shopping centre looked bafled by the sculpture.Other famous faces to be immortalised in edible art include Jamie Dornan and Jennifer Lawrence. Hunger Games:The sculpture was commissoned by UKTV to mark the screening of Sherlock.It follows in the footsteps of other A-listers such as Jamie Dornan and Jennifer Lawrence,who have been immortalised in cakes.Lawrence's Hunger Games cake won an award at a show last year .
+ +The entity control experiments in this paper only consider one entity as the control signal, here we show examples inputting paired entities. Specifically, we are interested in the output when one of the paired entities is important and the other is unimportant. Therefore, we sample 3 articles from CNNDM and for each article we randomly select one important entity and one unimportant entity as paired keywords to show the model output. We repeat this sampling five times for each article to obtain five different summaries. + +Table 16: Random Paired Entity Control Examples + +
Aformer U.S.Army enlistee who postedon Facebook about "theadrenaline rush"of dying in jihad was arrested ArticleFridayand charged with trying to detonateacar bombatFortRiley military base in Kansas,authorities said. A second man,who allgedly knew about the bomb plot but didn't callauthorities,was charged with failing to report a felony.John T.Booker Jr.of Topeka,an American citizen also known as Mohammed Abdullah Hassan,was taken into custody near Manhattan,Kansas,inavan that contained what he thought was abomb, the criminal complaint said.The "bomb"had actually been put together by two confidential informants with nonexplosive materials,the complaint said.Fort Riley's security was never breached and no people were in danger,the U.S.Justice Department said ina press release.Bookerenlisted in the Army last year and was due to ship out to basic training April7,2O14,said Army spokesman Wayne Hall.The criminal complaint said theFBIquestioned him March 24,2014 about comments posted on Facebook,such as,"Getting ready to be killed in jihad is a HUGE adrenaline rush.Iam so nervous.NOT because I'm scare to die but Iam eager to meetmy lord."Booker waived his Miranda rights and told the agents he enlisted to commit an insider attack against American soldiers like Maj.Nidal Hassan had doneatFort Hood,Texas,thecomplaint said.Hassan opened fire in a building in November 2O09,killing 13 people and wounding more than 30.His enlistment was terminated March24,2014,at the requestof Army Criminal Investigation Command,Hallsaid.Bookerbegan communicating with aconfidential informant laterin2O14,thecomplaint said,and often talked about his plans to engage inviolent jihad in supportof ISIS.He and the informant watched ISIS videos together, the complaint said,and Booker talked about how he wanted to go to Iraq and turn his weapon on American soldiers when orderedto shoot the enemy.On March9,Booker said he believed ISIS wanted him tocommit a truck bombing in the United States and thought a good target would be nearbyFort Riley,alarge Army base that's home to the lst Infantry Division,known as "The Big Red One."Booker said "that detonating a suicide bomb is his No.l aspiration because he couldn't be captured,all evidence would be destroyed and he would be guaranteed to hit his target,"thecriminal complaint said.He madea video with aFortRileyairfield inthebackground and said ISIS was coming to kill American soldiers,both abroad and in the United States,the complaint said. Bookeracquired components forabomb and rented astorage locker to store the components,the complaint said. The plan was forconfidential informants to buildabomb and for Booker todrive to FortRiley anddetonate it,thecomplaint said.But the bomb was built with "inert"parts and would never explode,the complaint said. On Friday,the informants and Booker drove to what Booker thought was a little-used utility gate near Fort Riley,thecomplaint said.While Booker was making final connections on the "bomb,"the FBI arrested him,the complaint said.He was charged with one count of attempting to use a weapon of massdestruction,one count of attempting to damage property by means of an explosiveand one count of attmpting to provide material support to the Islamic State ofIraq,adesignatedforeign terrorist organization.Ifconvicted,hecould face lifeinprison. AlexanderE.Blair,28,of Topeka was taken into custodyFridayand charged with failing to reportafelony.The FBI said agents interviewed Blair after Booker'sarrest.Blair said he shared some of Booker's views,Knewof his plans to detonate a vehicle bomb atFortRileyand loaned himmoney to rent storage space,according to the FBI's criminal complaint.He said he thought Booker would carry out his plan but did not contact authorities, the complaint said.If convicted, Blair faces a maximum of three years in prison.
Reference SummaryAlexander Blair,28,of Topeka accused of knowing about bomb plotbut not contacting authorities.Fort Riley's security was never breached and the device was "inert"and notathreat,authorities say.John T.Booker Jr.,20, of Topeka had acquired bomb parts and made a propaganda video,the Justice Department says.
CTRLsumFortRiley ISIS: John T.Booker Jr.is charged with trying to detonate acar bombatFortRiley.Asecond man, who allegedly knew about thebomb plotbut didn'tcall authorities,ischarged.Booker said he believed ISIS Wanted him to commit a truck bombing in the United States. JohnT.BookerJr.FBI:John T.BookerJr.enlisted in theArmy last year and was due to_ship out to basic training April7,2014.TheFBIquestioned him March 24,2014 about comments posted on Facebook. JohnT.BookerJr.Infantry Division:John T.Booker Jr.enlisted inthe Army last year and was dueto ship out to basic training April7,2O14.He planned to detonate acar bomb atFort Riley,a large Army
+ +Table 17: Random Paired Entity Control Examples + +
goal forSpain’s Under 2O side back in 2Oo9 shows.Herrera hits the back of the net while representing Spain's Article Under 2O side against Tahiti.The former Athletic Bilbao joined the Red Devils forf29million in the summer due to his vision and creativity inmidfield..Louis van Gaal heaped praiseon the 25-year-old's shooting ability after Saturday's Premier League encounterat Old Traord,by stating:'Hehas a very good kicking technique and he should be more composed,'Van Gaal said to MUTV.'Isaidto him'you have to control the ball before youshoot'.'Isaid that to himagaininyesterday'strainingsesson,and then Ikissed himathalf-time because he had controlled theballfor the first time in his lifeand then he shot.’.Herrera's eyes were also shut forAnder Herrera has caught the eye in recent weeks after cementing a spot in Manchester United's starting line-up but it appears he does not actually have a clear sight at goal. Herrera netted abrace against Aston Villa on Saturday afternoon without actually looking at Brad Guzan's goal as his eyes appeared to be shut when making contact with the ball.In fact,six of Herrera's seven goals have been scored without him even having to glimpse at either the ballor the opposition’s net..Manchester United star Ander Herrera scores his side's opening goal against Aston Villa with hiseyes shut.The Spanish midfielder appears to have his eyes closed as he strikes at Brad Guzan's goal.Aston Villaand England midfielderFabian Delph attempts to block Herrera's left-footed shot.His eyes were wide open when he struck an impressive first-time shot against Yeovil in the third round of the FA Cup back in January..However his double against Aston Vill and his goals against Queens Park Rangers,Leicester,Preston and Swansea allcame without Manchester United's summer signing having to make eyecontact with the ball.Herrera appears to have a historyof shooting with his eyes closedas the image of his
Reference Summaryhands of Premier League strugglers Leicester. Ander Herrera has scored seven goals for Man United since joining in June.Herrera's eyes have been shut when striking the ballfor six of his goals.His superb strike against Yeovil Town has been only goal with eyes open. Herrera netted a brace in Manchester United's 3-1 win over Aston Villa .
CTRLsumAnder Herrera Van Gaal: Ander Herrra has scored six of his seven goals without looking at the ball .Louis van Gaal has praised the Spanish midfielder's shooting ability . Yeovil Town Swansea City:Ander Herrera scored his side's opening goal against Aston Villa with his eyes shut.The25-year-old hasalso scored without looking at eitherthe ball orthe opposition's netin games against QPR,Leicester City,Swansea and Yeovil Town .
Manchester United Queens Park Rangers:Ander Herrera appeared to have his eyes closed as he scored againstAston Villaon Saturday.The25-year-old hasscored sixof hisseven goals without looking at the ball Herrera also netted with his eyes open in Manchester United's 4-O win over Queens Park Rangers.
Aston Villa MUTV:Ander Herrera scored a brace against Aston Villa on Saturday.But the Spanish midfielder appeared to have his eyes closed.Louis van Gaal told MUTV that Herrera should be 'more composed’. Herrera Athletic Bilbao:Ander Herrera has scored six of his seven goals with his eyes closed.The
+ +Table 18: Random Paired Entity Control Examples + +
ArticleA husband accused of trying to murder his cheating wife was ready to let her have sex with another man once a month as longasshe stayed with him,histrial heardyesterday.Aclose friend toldhow JosephO'Riordan, 74,had confided inhimabout theextraordinary plan for his 47-year-old wife Mandy.O'Riordan,acouncillor and former nightclub owner,stabbed her eight times in a jealous rage after finding out she had been having an affair with a postman..Extraordinary deal: Joseph O'Riordan stabbed his wife of ten years Amanda(left) with a seven inch kitchen knife eight times -yesterday Brighton Crown Court heard he was considering allowing her to have afirs.She suffered life-threatening injuries afterbeing knifed inthe torso,chest,arms and back. The jury was also shown dramatic footage of the moment police arived at the couple's home to be greeted by a ‘calm'O'Riordan opening the door.The revelation of his proposal for keeping his wife of ten years came from Alfred Harrs.He told how ORiordan had confided fivedays before the attack that he believed she was having an affair. O'Riordan was ‘choked up and emotional’ when he said:‘Ithink Amanda is playing away. She's geting her nails and hair done more regularly,she's been ona diet and doesn't want sex..Asking fora suit: O'Riordan sent his wife this leterfrom his prisoncell.The following day,added Mr Harris,the menmet for a pub lunch in O'Riordan's home villge of Polegate,East Sussex.‘I saw Joe and he told me that Amanda had been seeing someone else-a guy who drove a van.Joe said he loved Amandato bitsand if she wanted to have sex with someone else once a month that would be okay as long as she stayed with him.'.In a statement read to Brighton Crown Court,Mr Haris also described thecouple as‘loving andclose'..He was‘so shocked'to leam thatO'Riordan had atacked his wifeat their flatonaresidential care home estate.The jury saw images of four police officers,one of whom was wearing a lapel camera,arriving shortly before 1Opm last October 22 after racing to the scene..PCDave Catt said they drew their ‘incapacitating’sprays fearing the knifeman would be still holding his weapon.They were greeted byO'Riordan wearing a blood-spattered lightblue shirtand holding a cordless phone on which he had phoned for an ambulance.Mr Catt said O'Riordan admitted:‘Ifound out that she was having anafairandIlostit..Mrs O'Riordan was moaning and lying onabed,holding atowel to her stomach with a deep chest wound and serious wounds to her hand and back.Paramedics arrived moments laterand took her to hospital.Jurors looked attwo screensas images of herhusband'sarrest and subsequent detention at a police station were shown. Growing suspicion: Giving evidence yesterday Alfred Harrs-a friend of the couple for more than six years-told how O'Riordan had confided in him that he believed his wife was having an affir. Yesterday,jurors at Brighton Crown Court (above) were shown dramatic footage of the moment police arrived at thecouple'shome to be greeted bya‘calm'MrO'Riordan opening the door.PC Stuart Kenway told how,as O'Riordan hadopened the door,he‘appeared calmand composed and the situation was surreal’ as he then said:‘She is in the bedroom-do you want the knife? Offcers were directed toa7in blade with a black handle which was in the kitchen.Dr Stephen Drage,an intensive care consultant with Brighton and Sussex University Hospitals,told the jury how seriously Mrs O'Riordan was hurt.‘Itis quite clearshe was bleeding to death,he said.‘She underwent ife-saving surgery which took six hours..O'Riordan denies attempted murder.
Reference SummaryJoseph O'Riordan,73,stabbed wife eight times after discovering her affair.She was left with life-threatening injuries to her torso,chest,arms and back.Yesterday Brighton Crown Court heard about deal he was ready to offer her.He had told friend about the idea while in the pub just days before stabbing. Joseph O'RiordanAlfred Harris: Joseph ORiordan,74,isaccused of stabbing wife Mandy,47,eight times.
CTRLsumFriend Alfred Harris told how he had told him about the extraordinary plan. Brighton Crown Court Stephen Drage:Joseph O'Riordan,74,accused of stabbing wife Mandy,47, eight times.Brighton Crown Court heard he was considering allwing her to have affairs.Dr Stephen Drage,an intensive care consultant,told jury how she was 'clearly hurt' Joseph O'Riordan Catt:Joseph O'Riordan,74,is accused of stabbing wife Mandy,47,eight times. PC Dave Catt said he 'lost it'when he found out about the affair. Stuart Kenway Joseph O'Riordan:Joseph O'Riordan,74,is accused of stabbing wife Mandy,47, eight times.PC Stuart Kenway told how he'appeared calm and composed'. Brighton Crown Court Amanda:Joseph O'Riordan,74,is accused of stabbing wife Amanda,47, eight times.He denies attempted murder at Brighton Crown Court.
+ +# E.3 LENGTH CONTROL + +For length control, we randomly sample 3 test articles from CNNDM and for each article we generate five different-length summaries. + +Table 19: Random Length Control Examples. Control tokens are bolded. + +
Article comeback,released a statement saying they were "saddened"byLynch's decision."We weresaddened to read David Lynch's statement today since we believed we were working towards solutions with David and his reps onthe few remaining deal points,"read the statement."Showtime also loves the world of Twin Peaks and we continue to holdout hope that wecanbring it back inallits glorywithbothofits extraordinary creators,DavidFilm director David Lynch has confirmed he willno longer directthe revival of "Twin Peaks"-acult 1990s televisionshowthat was settoreturn in2Ol6.The offbeatTVseries,createdbyLynchand MarkFrost,featured a quirkyFBIagent who went to the Pacific Northwest town of Twin Peaks to investigate the mysterious murder of ahigh school girl named Laura Palmer.The groundbreaking series is considered one of the most influential shows in television history.Lynch broke the news about his departure in aseries of tweets,saying thatthe show's third season willcontinue without him.He said he felt the network was not ofering enough money to produce theshow "the way it needed to be done."Lynch also wrote that he had personally called the actors over the weekend to let them know he would no longer be directing.Showtime Network,which willair the nine-episode
Reference Summaryyear. Actor Kyle MacLachlan,who played thecofee-obsessedFBIagent Dale Cooper in the original series,had confirmed he would reprise the lead role for the new season. David Lynch says he won't be directing new episodes of Twin Peaks.Showtime“saddened"over decision, which involved a dispute over money.
CTRLsum(Length bucket O) director David Lynch longer direct revival Twin Peaks return 2016丨season丨Showtime: Film director David Lynch willno longer direct the revival of “Twin Peaks” Showtime announced they would produce a third season in October last year. The show was set to return in 2016. (Length bucket 1) director David Lynch longer direct revival Twin Peaks set return 2O16丨season | Showtime Network saddened:Film director David Lynch willno longer direct the revival of “Twin Peaks" Showtime Network saytheyare “saddened"bythe decision.The show was setto return forathird season in 2016. (Length bucket 2)director David Lynch confrmed longer direct revival Twin Peaks set return 2016|series 丨season continue丨 Showtime Network saddened: Film director David Lynch has confirmed he will no longer direct the revival of“Twin Peaks”The series was set to return in 2O16.Lynch broke the news about his departure in a series of tweets.He said the show's third season willcontinue without him.Showtime Network said they were“saddened”by Lynch's decision. (Length bucket 3)director David Lynch confirmed longer direct revival Twin Peaks 199Os set re- turn 2016 丨series 丨season continue丨Showtime Network saddened decision: SFilm director David Lynch has confirmed he will no longer direct the revival of“Twin Peaks"The 199Os TVseries was set to return in 2016. Lynch broke the news about his departure in a series of tweets.The show's third season willcontinue without him.Showtime Network said they were “saddened”by Lynch's decision. (Length bucket 4) director David Lynch confrmed longer direct revival Twin Peaks cult 1990s set return 2016 丨 series Mark Frost FBI agent murder 丨tweets season continue 丨 Showtime Network statement saddened decision丨Kyle:Film director David Lynch has confirmed he willno longer direct the revival of "Twin Peaks"The cult 199Os TV series,created by Lynch and Mark Frost,Was setto return in 2016. Lynch brokethe news about his departure in aseries of tweets,saying thattheshow's third season willcontinue without him.Showtime Network,which willair the nine-episode comeback,released a statement saying they were“saddened"byLynch'sdecision.Actor Kyle MacLachlan,who played the coffe-obsessed FBIagentDale
+ +Table 20: Random Length Control Examples. Control tokens are bolded. + +
Washington(CNN)An Iranian military observation aircraft flew within 5O yards of an armedU.S.Navy helicopter
Articleoverthe Persian Gulf this month,sparking concern that top Iranian commanders might not be in full control of local forces,CNN has learned.The incident,which has not been publicly disclosed,troubled U.S.military ofcials because the unsafe maneuver could have triggered a serious incident.It also surprised U.S.commanders because in recent months Iranian forces have conducted exercises and operations in the region in a professional manner,one U.S.militaryofficial told CNN."We think this might have been locallyordered,"the official said. The incident took place as the U.S.and other world powers meet with Iran in Switzerland to negotiate a deal limiting Tehran's nuclear program.At the same time,Iran has been active in supporting proxies in several hotspots inthe Persian Gulf and neighboring regions.The Navy MH-6OR armed helicopter was flying from the deck of the USSCarl Vinson on aroutine patrol ininternationalairspace,the oficial said.An unarmed Iranian observation Y-12 aircraft approached.The Iranian aircraft made two passes at the helicopter,coming within 50 yards,before thehelicoptermovedoff,according totheofficial.Theoficialsaid the helicopterdeliberately broke off and flew away ina 'predictable'manner so the Iranians could not misinterpret anyU.S.intentions.The Navy helicopter was in radio contact with the ship during the encounter,but there was no contact between the two aircraft and no shots were fired.The Navycrew took photos of the incident but the military is not releasing them.The U.S.administration is considering a potential demarche protest against Iran,the oficial said.CNN has reached out to Iranian offcials but has not received a response.This type of Iranian observation aircraft generally operates over the Gulf several times a month.But after the recent incident, U.S.naval intellgence did not see itagain for two weeks,leading to theconclusion that the incident may have been ordered bya local commander who was then reprimanded by higher-ups.The Pentagon has noted for the last several years that most encounters with the Iranian military atseaorinairareconducted professionall,but that some misions run by Iranian Revolutionary Guard Corps forces have been too aggressive against U.S.forces in the area. The U.S. military'sconcern has been that one of these incidents could escalate into a military encounter.This incident "might have beenbuoonery"the official said,but there isalways arisk from suchactions.The incident comes as the Navy patrols the Gulf of Adento watch for Iranian ships the U.S.believes are trying to bring weapons to
Reference Summaryresupply the Houthi rebels in Yemen.The Navy would share such inteligence with Saudi Arabia,a second U.S. official told CNN. Iranian plane came within 5O yards of U.S.Navy Sea Hawk copter.Navy copter was on patrol in international airspace.U.S.offcial think Iranian plane may have been under orders of local commander.
(Length bucket O)Iranian military aircraft flew 50 yards armed U.S.Navy helicopter Gulf commanders: An Iranianmilitary observation aircraft flew within 5O yards of an armed U.S.Navy helicopter over the Persian Gulf this month.The incident,which has not been publicly disclosed, has sparked concern that top Iranian commanders might not be in full control of local forces.
CTRLsum(Length bucket 1) Iranian military observation aircraft flew 5O yards armed U.S.Navy helicopter Gulf Iranian commanders forces:An Iranian military observation aircraft flew within 5O yards of an armed U.S.Navy helicopter over the Persian Gulf.The incident sparked concern that top Iranian commanders might not be in full control of local forces. (Length bucket 2) Iranian military observation aircraft few 50 yards armed U.S.Navy helicopter Persian Gulf Iranian commanders control forces 丨incident:An Iranian military observation aircraft flew
within 5O yards of an armed U.S.Navy helicopter over the Persian Gulf.The incident sparked concern that top Iranian commanders might not be in full control of local forces. (Length bucket 3)Iranian military observation aircraft flew 5O yards armed U.S.Navy helicopter Persian Gulf Iranian commanders control forces 丨incident|Iran丨protest:An Iranian military observation aircraft flew within 5O yards of an armed U.S.Navy helicopter over the Persian Gulf.The incident sparked concern that top Iranian commanders might not be in fullcontrol of local forces.Iran has been active in
protest against Iran. comes as the Navy patrols the Gulf of Aden to watch for Iranian ships.The administration is considering asupporting proxies in several hotspots in theregion.The U.s.administration is considering a potential demarche (Length bucket 4) Iranian military observation aircraft flew 5O yards armed U.S.Navy helicopter Persian Gulf Iranian commanderscontrol local forces |incident officials 丨offcial丨ordered丨Iran丨USS | considering demarche protest|Navy Aden: An Iranian military observation aircraft flew within 5O yards of an armed U.S.Navy helicopter over the Persian Gulf.The Navy MH-6OR armed helicopter was flying from the deck of the USS Carl Vinsonon aroutine patrol in international airspace.The incident sparked concern that top Iraniancommanders might not be in full control of local forces."We think this might have been locally ordered,"the official said.CNN has reached outto Iranian officials but has not received a response.Incident
+ +Table 21: Random Length Control Examples. Control tokens are bolded. + +
It's asight thatdraws giggles and curious stares from tourists and other first-timers-anunusualfestival where revellers carry gigantic phalluses through the streets of a Japanese city. But for the residents of Kawasaki, who
Articlelug erotic shapes of alldifferent sizes,this odd tradition is nota joke.Shinto Kanamara Matsuri started asa small traditionbuthas grownintoapopularatourist atraction,with participants praying toagodoffertilitychild birth and protection from sexually transmitted infections.Participants carry a gigantic phallus through the streets of Kawasaki,Japan during the Shinto Kanamara Matsuri festival.The sight of thre large phalluses being paraded through neighbourhoods in the city south of Tokyo draws giggles from tourists.Shinto Kanamara Matsuri,the Festival of the SteelPhallus,started asa smalltradition but has grown intoa popular a tourist attraction.Known as theFestivalof the Steel Phallus,itis held every spring atthe phallus-shaped Kanayama Shrine.Festivalgoers parade through the streets with three giant phalluses,while spectators lick lolles or snack onsausages or vegetables shapedas male and female genitalia.Rainy weather didn'truin the moodat this year's festival, which hada massive collection of foreigners,according to Japanese website RocketNews24.They watched as groups of locals carried three heavy phalluses modelled after a mikoshi portable shrine,which is commonly used in Shinto festivals.Residents of Kawasaki carry phalluses of alldiferent sizes while participating ina tradition that began nearly4O years ago.Participants pray toa god who is said tohelp with fertility,child birth and protection from sexually transmitted infections.Rainy weather didn’truin the mood atthis year's festival,whichattracted thousands of spectators from Japan and abroad. Spectators can buy lolies,sausages and vegetables shaped as male and female genitalia while watching the unusual parade.The three mikoshi carried through the streets for hours are the Kanamara Boat Mikoshi (talland black),the Elizabeth Mikoshi (big and pink)and the Kanamara Big Mikoshi (squat and wooden),RocketNews24 reported.In addition to the parade there are performances and music,and the festival itself raises money and awarenessfor HIV research. The festival started nearly 40 years ago,and the Kanayama Shrine was once a popular place for prostitutes to pray for protection from sexually transmited infections.Today,people visit the shrine to pray for everything from fertilityand business prosperity to wedded blissand good health.In addition to the parade there are performances and music,and the festival itself raises money and awareness for HIV research.The Kanayama Shrine was once apopular place for prostitutes to pray for protection from sexually transmitted infections.Today,people visit the shrine to pray for
Reference Summaryeverything from fertilityand business prosperity to wedded bliss and good health.Groups of locals carred three heavy phalluses modelled after a mikoshi portable shrine,which is commonly used in Shinto festivals. Shinto Kanamara Matsuri started as a smalltradition but has grown into a popular tourist attraction. Known as the Festival of the SteelPhallus,participants praytoa god of fertilityand protection from infections.Rainy
CTRLsumweather didn't ruin the mood at this year's festival,which attracted a large crowd of holidaymakers . (Length bucket O) Shinto Kanamara Matsuri started tradition god fertility child birth protection infections 丨Steel: Shinto Kanamara Matsuri,the Festival of the Steel Phallus,started as a smalltradition. Participants pray to a god of fertility,child birth and protection from sexually transmitted infections. (Length bucket 1) Shinto Kanamara Matsuri started tradition praying god fertility child birth pro- tectionsexually infections丨Festival Steel: Shinto Kanamara Matsuri,the Festival of the Steel Phallus,started
as a small tradition.Participants pray toagod offertility,child birth and protection fromsexually transmited infections. (Length bucket 2) Shinto Kanamara Matsuri started tradition popular tourist_praying god fertility child birth protection sexually infections |Festival Steel Phallus: Shinto Kanamara Matsuri,the Festival of the Steel Phallus,started asa small tradition but has grown intoa populara tourist atraction.Participants pray
to a god of fertility,child birth and protection from sexually transmitted infections. (Length bucket 3) Shinto Kanamara Matsuri started tradition popular tourist attraction praying god fertility child birth protection sexually transmited infections丨Festival Steel Phallus:Shinto Kanamara Matsuri, the Festival of the Steel Phallus,startedas a small tradition but has grown into apopular a
tourist attraction.Participants pray to agod of fertility,child birth and protection from sexually transmited infections. (Length bucket 4)phalluses丨 Shinto Kanamara Matsuri started small tradition grown_popular tourist attraction praying god fertility child birth protectionsexually transmitted infections丨Kawasaki Japan Matsuri festival丨Tokyo丨Festival SteelPhallus 丨40:Shinto Kanamara Matsuri startedas asmall tradition4O years ago.It has grown intoapopular tourist atraction in Kawasaki,Japan.TheFestivalof the Steel Phallus is held every spring at the Kanayama Shrine.Participants carry three phalluses through neighbourhoods
+ +# E.4 CONTRIBUTION SUMMARIZATION ON SCIENTIFIC PAPERS + +Here we show three random examples from the arXiv test set. Note that this is the test set from (Cohan et al., 2018) instead of the contribution test data collected by us, because we want to show the difference between reference summaries (i.e. the paper abstract) in existing standard paper summarization dataset and our output contribution summaries. We truncate the source articles since they are too long to display. + +Table 22: Random Contribution Summarization Examples. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
Article decrease of synaptic current depresses the feedback of sodium ionic current which is responsible for the initiation of the spike.for simplicity we willrefer to the transitionsas spike death.in neuronal networks,synaptic input of a neuron is te accumulation of the currents received from all presynaptic neurons .when the coherence of firingtime of neurons is enhanced by the excitatory interaction,the synaptic input of neurons transforms from the fluctuating waveform into the pulse shape like the signal produced byonesynapse .if synaptic efficacy is high,the input signal can induce spike death of the neuron .then spike death disorders the adjustment of thesynchronization of neural activity appears in different parts of the mammalian cerebral cortex @xcite,and underlies different neural processes in both normaland anomalous brain functions @xcite.it has been suggested that synchronization plays a vitalrole in information processing in the brain,e.g.,processing information from diferent sensory systems to form acoherent and unified perception of the external world @xcite.on the other hand,synchronization has been detected in pathological conditions such as parkinson s disease @ xcite.and epileptic seizures have long been considered resulting from excessive synchronized brain activity @xcite,though some recent studies suggest that this picture may be an over - simplification @ xcite .therefore understanding the mechanisms of synchronization maybe acritical step in elucidating how neural systems work @xcite.it has stimulated a great dealoftheoreticaland numerical works,suchas the studieson the efectsofthe topological properties of underlying networks @ xcite and the dynamical properties of synaptic coupling @ xcite .it was recently shown that the response time of synaptic couplings influences the stability of synchronized oscillation in the nonlocally coupled hodgkin - huxley(hh)equations @xcite .if the response time of synaptic coupling is slower,synchronized activityof the systems is instable for excitatory coupling.however,the underlying dynamical mechanism of the influence is not clear.in experimental studies @xcite,it has been suggested thatthe generationof prolonged epileptiform neuronal synchronization is favored by lower efficacyof synaptic transmission.the numerical studies @xcite in adetailedcomputationalmodelrevealed that seizure-likeactivity occurs when the excitatory synapses are weakened,and the results were confirmed experimentally in mouse neocortical slices .according to the common accepted assumption that synchronization of neuronal activity underlies seizures,the dynamical mechanism of synchronization may be useful for understanding the way the biological neural system works.inthis work,we numerically investigated the dynamical mechanismunderlying theinfluenceofsynaptic efcacyon firing synchronization in hh neuron networks.todo this,we first studied the dynamics of the response of hh neuron to excitatory synaptic current.when the efcacy of synapse is low ,namely,strength is weak and duration is short,the limit cycle is stable to the perturbation of the synaptic current.when synaptic efcacy is high,synaptic current can induce the transition of the neurons from limit cycle to fixed point or transient state.the transition is determined by dynamics of neuron s ionic channel.the
Reference Summarysec.the response of a hh neuron to synaptic current was investigated in sec .the influence of the dynamics of neurons on firing synchrony was shown in sec . we investigated the influence of efficacy of synaptic interaction on firing synchronization in excitatory neuronal networks.we found spike death phenomena,namely,the state of neurons transits from limit cycle to fixed point or transient state.the phenomena occur under the perturbation of excitatory synaptic interaction that has a high eficacy.we showed that the decrease of synaptic current results in spike death through depressing the fedback of sodium ionic current.in the networks with spike death property the degree of synchronization is lowerand unsensitive to the heterogeneity of neurons.the mechanism of the influence is that the transition of
CTRLsumneuron state disrupts the adjustment of the rhythm of neuron oscillation and prevents further increase of firing synchronization. [the main contributions of this paper are :(1)]: we investigated the dynamical mechanism underlying the influence of synaptic efficacy on firing synchrony in hodgkin- huxley neuron networks;(2)we found that the dynamics of synaptic current plays an important role in determining the stabilityoffring synchronization.
+ +Table 23: Random Contribution Summarization Examples. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
forces close to a sample surface .the most common method to measure these surface forces is atomic force microscopy(afm)@xcite .historically,the first force measurements were static measurements for which theforthe understanding of surface reactions and the characterization of materials it is desirable to measure local
Articleforce is presented asa scalar functionof the static tip-sample separation,the so-called force curve@ xcite.this representation is sufficient forconservative forces but the total tip-surface force may also contain contributions from dissipative forces .since dissipative forces depend on probe velocity and past trajectory,dynamic force spectroscopy methods are required for their measurement.moreover,the visualization of disipative forces as a functio of position is valid only for aspecific probe trajectory and simple forcecurves can not capture the full character of the interaction .despite the development ofseveral dynamic methods @ xcite surface forces are stil usually treated as functionsof the probe position only and represented by simple force curves.here,we present a comprehensive framework forthe representation and analysis of complex surface forces as they are measured by dynamic afm.we concentrate on the most common modes of dynamic afm :amplitude- modulated afm( am-afm)and frequency- modulated afm(fm- afm),which can be considered as narrow frequency band methods @ xcite .we explore the fundamental limit of force reconstruction with narrow band dynamic afm at fixed probe height and show how minimal assumptions allow for a quantitative reconstruction of the tip- surface interaction.atthe heart of the afm apparatus is a micro -cantilever with a sharp tip.the cantilever is firmlyclamped atone end and the tip is located atthe other end which can move freely.it is assumed that surface forces only acton the tip whereas therest of the cantilever does not experience significant surface forces .in dynamic afm anadditional external drive force is applied to maintain an oscillatory motion.thus,the dynamics are governed by the force between tip and surface,the external drive force and the properties of the cantilever beam.since the cantilever is athre dimensional continuum object its motion is usually described by the amplitudes of diferent oscilation eigenmodes.ingeneral,these modes can cause the cantilever to bend in all directions in space.however,the cantileveris positioned such thatthe softestflexural modes bend the beam in a plane orthogonal to the surface plane.we restrict ourselves to the case where only these flexural modes are excited by the drive force.due to this experimental configuration the cantilever is much more susceptible to the component of the tip- surface force which is orthogonal to the surface plane .this component of the force is typically the most dominant component and the influence of lateral force components is considered negligible.in this case the cantilever acts as a mechanical projector which reacts only toone component of a three dimensional force vector field.the deflection @ xmathO of acantileverof length @xmathl orthogonal to surface is described by aone dimensional euler- bernouli equation@ xcite @xmath2 where @ xmath3 is the young s modulus ,@xmath4 is the second moment of area,@xmath5 is the mass per unit length of the cantilever,@xmath6 is the position coordinate along the cantilever beam and @xmath7is the time variable .the force term @xmath8 includes the surface forces acting as a point-like load at position @xmath9 ,the external drive force and the hydrodynamic damping due to the surrounding medium@ xcite .
Reference Summaryin atomic force microscopy(afm)tip-surface interactions areusuallyconsidered as functions of the tip position only,so -called force curves.however,tip - surface interactions often depend on the tip velocity and the past tip trajectory.here,we introduce a compact and general description of these interactions appropriate to dynamic afm where the measurement of force is restricted to a narrow frequency band.we represent the tip - surfaceinteraction in terms of a force disk in the phase space of position and velocity.determination of the amplitude dependence of tip-surface forces atafixed static probe height alows fora comprehensive treatment of conservative and disspative interactions .we illuminate the fundamental limitations of force reconstruction with narrow band dynamic afm and we show how the amplitude dependence of the fourier component of theforce at the tiposcilation frequency,gives qualitative insight into the detailed nature of the tip-surface interaction .with minimal assumptions this amplitude dependence force spectroscopy allows for a quantitative reconstruction of the effective conservative tip-surface force as wellas a position -dependent damping factor .we demonstrate this reconstruction on simulated intermodulation afm data._keywords_:atomic force microscopy,measurement of force,mechanical resonators,mems /nems,disspation,intermodulation
CTRLsum[the main contributions of this paper are :(1)]: a comprehensive framework for the representation and analysis of complex surface forces as they are measured by dynamic atomic force microscopy(afm);(2)a study of the fundamental limitofforce reconstruction with narrow band dynamic afm at fixed probe height and show how minimal assumptions allow for a quantitative reconstruction of the tip - surface interaction .
+ +Table 24: Random Contribution Summarization Examples. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
Articlein this paper we discussthe mathematical aspects of the problems originating in the solution of nonlinear systems of hyperbolic partial diffrential equations.these equations describe alarge variety of physical phenomena, such as,gasdynamics,magnetohydrodynamics(mhd ),shallow water equations,elasticity equations,etc. being nonlinear,these systems usuall require numerical methods for their solution .presence of discontinuous solutions motivates the necessity of the development of reliable numerical methods based on the fundamental mathematical properties of hyperbolic systems .although such methods are rather welldeveloped for the euler gasdynamic equations in the conservation law form,their extension to morecomplicated hyperbolic systems is not straightforward.it requires a mathematical justificationof the solution uniqueness ,a formulation of the selection principles forrelevant solutions,and,finaly,an investigationoftheir physical validity.mostof high - resolution methods for gasdynamic equations use the exact or some of the approximate self- similar riemann problem solutions to determine fluxes through the computational cellsurfaces.similar methods are expected to bedeveloped for various types of hyperbolic systems.in this case we must construct the elementary self-similar solution using only admissible discontinuities (entropy consistent,evolutionary,etc.).basicall the choice of the solution must be made on the basis of the structure of the solution of the extended problem @xcite .all mentioned above makes very important the study of discontinuous solutions behavior under vanishing viscosity and dispersion to create a properbackground for the development of high -resolution numerical methods for hyperbolic systems more complicated than the euler equations of gasdynamics .we discuss several analytical and numerical solutions in the mentioned fields which illustrate the complexity of the selection problem and outline the methods of its solution.tvd upwind and symmetric diffrencing schemes have recently become very efficient toolfor solving complex multi -shocked gasdynamic flows.this is due to their robustnes for strong shock wave calculations.the extension of these schemes to the equations of the ideal magnetohydrodynamics is not simple.first,the exact solution @xciteofthemhd riemann problem is too multivariant to beused in regular calculations.second,several different approximate solvers @xcite,@xcite,@xcite,@xcite,@xcite,@xcite ,and @ xcite applied to mhd equations are now at the stageof investigation and comparison.this investigation requiresi)determination of a proper slope limiting method in the parameter interpolation procedure necessary to obtain nonoscilatory schemes of the order of accuracy higher than one ;ii)development of an efficient entropycorrection method necessary to exclude rarefaction shocks;and,finally,ii)solutionof the problemof excluding the origin of nonevolutionary solutions in ideal mhd calculations .the system of governing equations fora mhd flow of an ideal,infinitely conducting,perfect plasma in the cartesian coordinatesystem @xmatho, @xmath1,@xmath2 with the use of the conventional notations reads (one fluid approximation): @ xmath3 where @xmath4 is the vector of conservative variables and @xmath5,@xmath6,and @xmath7 are the flux vectors.we introduced here the source term @xmath8 in the form @xmath9 this form of the system can be used to satisfy the divergence -free condition by convecting away the magnetic charge from the computational region @xcite .otherwise,any other well - known method can be used to eliminate the magnetic charge .to determine a numerical flux @ xmath1O normal to thecomputational cell boundary(@xmathl1 is a unit outward vector normal to the cell surface )onecan use the formulas based on the solutionof the linearized problem @xmath12.]]here @xmath13and @xmath14are the matrices formed by the rightand by the left eigenvectors,
Reference Summaryrespectively,of the frozen jacobian matrix @xmath15 thematrix @xmath16 isa diagonal matrixconsistingof the frozen jacobian matrix eigenvalue moduli .the superscripts @ xmath17and @xmath18 denote the values at the right- and at the left - hand side of the cell boundary . a number of physical phenomena are described by nonlinear hyperbolic equations .presence of discontinuous solutions motivates the necessity of development of reliable numerical methods based on the fundamental mathematical properties of hyperbolic systems .construction of such methods for systems more complicated than the euler gas dynamic equations requires the investigation of existence and uniqueness of the self- similar solutions to be used in the development of discontinuity -capturing high -resolution numerical methods .this frequently necessitates the study of the behavior of discontinuities under vanishing viscosity and dispersion.we
CTRLsumdiscuss these problems in the application to the magnetohydrodynamic equations,nonlinear waves in elastic media,and electromagnetic wave propagation inmagnetics. [the main contributions of this paper are :(1)]: the mathematical aspects of the problems originating in the solution of nonlinear systems of hyperbolic partial differential equations ;(2)the studyof discontinuous solutions behavior under vanishing viscosity and dispersion to create a proper background for the development of high -resolution numerical methods for hyperbola systems more complicated than the euler equations of gasdynamics ;and(3)solution of the problemof excluding the origin of nonevolutionary solutions in ideal magnetohydrodynamics calculations .
+ +Here we show three random examples from the BIGPATENT test set. Note that this is the test set from origial BIGPATENT, because we want to show the difference between reference summaries in existing standard dataset and our output purpose summaries. We truncate the source articles since they are too long to display. + +Table 25: Random Invention Purpose Summarization Examples. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
referring to the drawings and,inparticular to figl therein illustrated isa priorart surgical support mesh 10 .mesh 10 may be manufactured from monofilament or multifilament yarns .prior art mesh 1O,as shown ,includes multifilament horizontally- extending yarns 12 and multifilament vertically-extending yarns 14 woven together to form asupport trelis.the useof multifilament yarns,such as yarns12 and 14,provides a mesh having greater pliability and suppleness than the use of monofilament yarns .these characteristics result from both the smaler diameter of the individual filaments and the interstitial spaces or voids that are located
betwee such filaments.in particular,the flexibilityofaflament(or fiber)generaly increasesas its diameter decreases.because the solid cross-sectional area of the filaments of a multifilament yarn is lessthan the cross - sectional areaofa monofilament yarn of equivalent diameter,the multifilament yarn willhave a greater degree Articleofflexibilityand pliabilitythan thatof the monofilament yarn.as shown in figla,each of multifilament yarns 12 and14 is composed ofa pluralityof filaments16 that are intermingledor bundled together to form the yarn. interstitial spaces 18,which are pockets of air,areformed between adjacent filamentsofthe yarn.although these voids contribute to the softness and pliabilityof the formed mesh,theyalso provide a natural breeding ground for bacteria orother infectious material.surgical mesh is,of course,thoroughly sterilized prior to implantation .nevertheless,surgeons typically prefer the use of monofilament - designed mesh to minimize any risk of infection.asaresult,the advantages associated with multifilament-designed mesh(i.e.,softness and pliability which result in better assimilation of the mesh into the body)are typically sacrificed .it has been discovered herein that a surgical support mesh having both the softnessand pliabilityofa multifilament- designed mesh and the infection resistance of a monofilament -designed mesh may be produced .particularly, it has been discovered that a support trellis formed of multifilament yarn wherein the interstitial voids located betweenadjacent flaments are enclosed within an infection-impervious matrix exhibits the desired resistance to harboring of infectious mater without significant lossof flexibility.particularly,the matrix,which completely encloses the interstitial voids between the filamentsof the yarn,provides an effective barrer to the passage of infectious mater between the interior and exterior of the yarn .accordingly,any voids remaining in the yarn after encapsulation of such yarn are enclosed(and thereby sealed)within the resultant matrix .a first embodimentof the present invention is shown in fig2.particularly,this first embodiment includes asupport trelis 20 formed of multifilament yarns 22 and 24 which overlap at cross -over junctions 25.subsequent to formingofthe trelis,such trelis is encapsulated withina matrix 26,which is preferablyaflexible material that continuously surrounds the exterior of the yarns thereby enclosing interstitialvoids 27located between flaments 28(see fig2a).inone embodiment,the matrix is formed from a polymeric resin.as shown in fig2a,the resin can be applied to the yarn in such a manner as to not alow the resin to substantially penetrate into the yarn . particularly,the penetration of the resin can be controled through the application procedure,e.g.,quantityof resin applied and/or encapsulating time .in such an embodiment,the interstitial spaces are enclosed(rather than filled)within thecontinuous matrix.however,itiscontemplated thattheresincan bealowed to penetrate intothe yarn,thereby substantially filing the void space located therein.inanother embodiment ofthe present invention,individual yarns 29,asshown in fig3are encapsulated within matrix 3O prior to forming of the support trellis .fig3 a shows a compressd yarn 29 which provides atrelis having a reduced thickness .as a result of the encapsulation,interstitial voids 32remaining inthe yarn are enclosed(and thereby sealed)within
the matrix. Reference Summary folded for delivery .asoft and pliable surgical support mesh exhibiting increased resistance to inhabitation of infectious matter.the mesh includes a support trelis formed of multifilament yarns wherein the interstitial voids located between the filaments of said yarns are enclosed within an infection -impervious matrix.the meshes may be designed to be extremely thin yet retain the requisite strength for repairing soft tissue,which allows foralow profile when
CTRLsum[the purpose of the present invention is]: to provide asurgical mesh thatis resistant to the growth of bacteria andother infectious matter.this is accomplished by encapsulating the interstitial spaces located between the filaments of the yarn within a matrix.
+ +Table 26: Random Invention Purpose Summarization Examples. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
Article precisely guide movements of the printing units 6in the tower.as shown in fig1 and2,the position of each of the printing units 6along the webs 4and fixed spindles12 canbecontrolled by the operator to allow acce to a desired partof a printing unit 6.for example,in figl the operator has moved the print unit 6bof tower 2b into a position where a printing plate of the print unit 6b can be most easily accessed.after the printing plate has been accessed,the operator can move the print unit 6b intoa diferent position so that inker units in an upper part of the printing unit 6bcan be easily accessd.two or more printing units 6in tower2can alsobe moved as a group.for example,if the operator wants to access the plate cylinder of the printing unit 6 mof tower 2 b shown in figl hecan simply move the two printing units 6y,6mupwardly together until the top surface 28of the printing unit6y contacts the bottom surface 3Oof the printing unit 6b.thereafter,the operator can move thegroup of printing units 6b,6yand6mupwards into the positionshown in tower 2coffigl where the plate cylinderof the printing unit 6 mcan beeasily accessed.although figland2show four printing units 6for eachfiglshows a multicolor web fed rotary printing press1 in accordance with the invention.the press1 includes four tower arrangements 2a,2b,2cand2dfor printing asinglecolor ora multicolorimage on the webs 4a,4 b,4cand4d.the webs 4a,4b,4cand4d travel inasubstantially lineardirection through eachof the towers 2a-2d.for example,the web can travel alongasubstantially vertical path,as shown in fig1.alternatively, as those skilled in theart willappreciate,the web path can be in a substantially horizontal direction,or in a substantially linearpath atany desired angle relative to the vertical direction shown.the towers2a-2d each include four printing units 6c,6m,6yand 6b for respectively printing an image incyan,magenta,yellow andblack on both sides of each web 4a-4d.othercolors besides cyan,magenta,yellow and black can be used .the webs 4can be,for example,between 12O and 160O millimeters wide.each of the printing units 6 c,6m,6 yand 6bin a tower can be moved along arespective web 4 by a lifting and positioning system 8 shown in fig2.the lifting and positioning system 8 includes aspindle drive 1O,which has a fixed spindle 12 spanning arange 14 over which the printing units 6c,6 m,6 y and 6bcan be moved .each of the printing units 6c,6m,6 yand6b includesa ball screw16,which is rotatably supported inahousing 18.the ball screw l6canbe rotatedby amotor 2Oas shown in fig2.fig shows one set of aspindle drive 1O,fixed spindle 12,ball screws 16,and motors 2O,but preferably each tower2 is provided with several sets,one setforeach cornerof the print unit housing 18.the motors 2Oare controlled bya motor control unit 22,which receives commands from aremote control 24.by pressing a buton on the remote control 24,an operator can control the rotation of the motors 2O and thereby the movement direction and position of each printing unit 6b,6 y, 6 mand 6c in atower2.rail systems(not shown )fixed to a side frame of each tower 2 can also be used to
Reference Summarytower 2,diferent numbers of printing units canbe used for each tower.fig1 shows that the lower three printing units 6of the tower 2bare beneath an operating floor 26.preferably at least twoof the printing units can be lowered beneath theoperating floor26,and a printing pressin accordance with the invention canbe configured so that all ofthe printing units in atowercan be lowered beneath an operating floor.theoperating floorcan be a floor of a print shop,or can be an elevated platform . the present invention is directed to amulticolor web fed rotary printing press having printing units that can be moved along alinear section of a web by a positioning mechanism to allow easy access to each of the printing units.the easy access to the printing units significantly reduces maintenance costs and downtime of the press . in addition,the invention provides a printing pres that has a reduced overall size and alows the printing units
CTRLsumto be arranged in a nested formation during printing operations.this nested formation reduces fanout and paper waste.the linear web section can be oriented vertically or horizontally . [the purpose of the present invention is]: to provide a web fed rotary printing pressthat allws an operator to access a desired part of a printing unit more easily than in the past .
+ +Table 27: Random Invention Purpose Summarization Examples. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
constructionof the porting within the port plate 54 is moreclearly ilustrated in fig3and willbe discused more Article fully below.it is recognizedthat the portingilustrated in fig3couldbe made within the head portion 46 without departing from the essence of the subject invention.arotating group 56 is disposed within the body portion 48 and includes abarel 58 having a plurality of cylinderbores 59 defined therein spaced fromone another around anaxis ofrotation6Oof the barrel 58.eachofthecylinderbores 59 isoriented withinthe barrel 58 paralll with theaxis of rotation 6O.apluralityof piston assemblies 62 are operatively associated with the barrel 58 and each one of the pluralityof piston assemblies 62 includes a piston 64 slideably disposed in the respective ones of the pluralityofcylinder bores 59.each one of the pluralityof pistonassemblies 62 also has ashoe 66 pivotably attached toone end of each piston 64 in aconventional manner.the barrel 58 has an end surface 68 that is in mating,sealing contact with the port plate 54 to provide communication between the cylinder bores 58 andreferring now to the drawings and more particularlyto fg1-3,a fluid system1O is ilustratedand includes a variable displacement axial piston pump12 that receives fluid froma tank 14 viaa conduit16and delivers pressurized fluid viaasupply conduit 18 to a fluid control valve 2Oand selectively through work conduits 22 ,24 to a fluid actuator 26.in the subject arrangement,the variable displacement axial piston pump l2 is a unidirectional pump that rotates in acounterclockwise direction as driven by a power input shaft27.the fluid system10 also includes first and second pressure sensors 28,30 respectively connected to the tank conduit 16 and the supplyconduit18.the pressure sensors 28,30 are operative to sense the pressure in the respective lines and deliveranelectrical signal toacontroller32 through electrical lines 34,36.aposition sensor 40is mounted on the variable displacement axial piston pump 12 and operative to sense the displacement of the pump and deliverasignal representative thereofto the controler 32 viaan electrical line 42.various other components could beused in the subjectfluid system 1O without departing from the essence of the subject invention .for example,several control valves 2O and associated fluid actuators 26could be used.likewise,other sensors of various types and styles could be used .the variable displacement axial piston pump 12 includes a housing 44 having ahead portion 46and abody portion 48.the head portion 46 defines an inlet port passge 5O that is connected to the conduit 16and an outlet port passage 52 that is connected to the supply conduit18 .in the subject arrangement,aport plate 54 is disposed between the head portion 46and the body portion 48.the
more clearly ilustrated.forexplanation purposesonly,the“27O”degree position illustrated in fig3relates to a position on the right side of the drawing offigland the“O”degree position illustrated in fig3 relates to a position on the right side of thedrawing offig2.an arcuate slot72 is defined in the port plate 54and provides communication between the pluralityof closed chambers 7Oand the inlet port passage 50.a pluralityof slots 74 aredefined in the port plate 54 circumferentially spaced from the arcuate slot72and provides communication between the plurality of closed chambers 7O and the outlet port passage 52 . a variable displacement axial piston pump is typically used to receive fluid from a tank and supply pressurized fluid through acontrol valve to move an actuator.the present variable displacement axial piston pump has a swashplate arrangement that is capable of being angled in two different directions to control the pressure transitions between the low pressure inlet port passage and the higher pressure outlet port passage as cylinder
Reference Summarybores in a barrel of a rotating group rotate through trapped volume regions situated between inlet and outlet port passages of the axial piston pump .movement of the swashplate arrangement in two diffrent directions provides smooth pressure transitions and increases the operating efficiency of the variable displacement axial piston pump .
CTRLsum[the purpose of the present invention is]: to provide a variable displacement axial piston pump that is capable of delivering a variable amount of pressurized fluid in response to a change in the displacement of the pump.
+ +# E.6 QUESTION-GUIDED SUMMARIZATION + +We randomly sample 3 articles from NewsQA and show five questions and answers from CTRLsum for each article. We also show the gold answers to these questions. + +Table 28: Random Examples on Question-guided summarization. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
ArticleTEHRAN,Iran (CNN)-Iran's parliament speaker has criticized U.S.President-electBarack Obama for saying that Iran's development of a nuclear weapon is unacceptable.Iranian President Mahmoud Ahmadinejad has outlined where he thinks U.S.policy needs to change.AliLarijani said Saturday that Obama should apply his campaign message of change to U.S.dealings with Iran."Obama must know thatthe change that he talks about is not simply a superficial changing of colors or tactics,"Larijani said incomments carried bythe semi-official Mehr News Agency."What is expected isachange in strategy,nottherepetitionof objections to Iran's nuclear program,which willbe taking a step in the wrong direction."In his first post-election news conferenceFriday afternoon,Obama reiterated that he believes a nuclear-armed Iran would be "unacceptable."He also said he would help mount an international effortto prevent it from happening.Larijani said thatU.S.behavior toward Iran "will notchange so simply"butthat Obama's election showed internal conditions in the United States have shifted.Headded that Iran does not mind if the United States provides other Persian Gulf countries with nuclear technology,but "you should know that you cannot prevent the Islamic Republic [from reaching its goals in the nuclear field],"according to the news agency.Obama cautioned Friday that it had only beenafew days since the election and that he was not inoffce."Obviously,how we approach and deal with a country like Iran is not something that we should simplydo ina knee-jerk fashion.Ithink we've gotto think it through,"Obama said."ButIhave to reiterate once again that weonly have one president ata time.AndIwant tobe very careful that weare sending the right signals to the world as a whole thatIamnot the president,andIwon'tbe until January 2Oth."Larijani was speaking two days after Iranian President Mahmoud Ahmadinejad congratulated Obama,the frst time an Iranian leader has ofered such wishes toa U.S.president-elect since the 1979 Islamic Revolution. One analyst said the welcome was a gesture from the hard-line president that he is open to a more conciliatory relationship with the United States.Ahmadinejad said Tehran "welcomes basic and fair changes in U.S.policiesand conducts,"according to the state-run Islamic Republic News Agency on Thursday.Relations betweenthe United States and Iran have historically beenchillyand have been further strained in recent years over Iran's nuclear program.Tehran insists that the program exists for peaceful purposes,butthe United States and other Western nations are concerned by Iran's refusal to halt uranium enrichment activities.CNN's Shirzad Bozorgmehr contributed to this report.
CTRLsum[Q:Iran criticizes who?A:]:U.S.President-elect Barack Obama. Gold Answer: U.S.President-elect Barack Obama [Q:What are US and Iran relations tensioned about?A:]: Iran's nuclear program. Gold Answer: nuclear program. [Q: Who said Obama should apply campaign message?A:]: Ali Larijani, Iran’s parliament speaker. Gold Answer: Ali Larijani [Q:What should Obama apply according to speaker?A:]: Change in strategy,not the repetition of objections. Gold Answer: his campaign message of change [Q: What kind of weapons are being discussed? A:]: Nuclear weapons. GoldAnswer:nuclear
+ +Table 29: Random Examples on Question-guided summarization. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
ArticleEditor's note:The staff at CNN.com has recently been intrigued by the journalism of VICE,an independent media company and website based in Brooklyn,New York.VBS.TV is Vice's broadband television network. The reports,which are produced solelyby VICE,reflect a transparent approach to journalism,where viewers are taken along on every step of the reporting process.We believe this unique reporting approach is worthy of sharing with our CNN.com readers.Brooklyn,New York(VBS.TV)-Whenever someone at our ofice bitches about being overworked,our stock response is "Beats digging ditches."While the express intention of the statement is usually not-so-supportive,we think it'sa healthy reminder that at theend of the day,we are allbasically professional e-mailers and should be thankful for such.The wildland firefighters who work for Grayback Forestry in Medford,Oregon,have no such motivationaladages because their job is actually digging ditches.Around active forest fires.On the sides of mountains.You can't even bitch at these guys for having cushy government pensions to fall back on when they get older,because they're allprivate-sector contractors.Which means if they aren'tout fighting forest fires or doing preventative forestry on unburned woods (basicall extreme landscaping),they are losing money.They are the hardest working men in the tree business.Southern Oregon in the summer is atinderbox.Last yearthe state recorded some 56O wild fires,the majority of which occurred in the seemingly endless sea of trees running across its bottom from the Cascades to thePacific Coast.Humidity is next to nonexistent,which is extremely pleasant,but means that evenan errant spark from achainsaw or the proverbial cigarette buttout thecar window can set the entire regionablaze. Flying into the Rogue Valley,there is evidence of past wild fires is everywhere:From the miles-long scarof the 2002 "Biscuit"fire stretching pastthe horizon,to the smaller pockets of charred trees crowding the edge of towns to the blue Wilderness-Firefighter-ribbon bumper stickers flying past onthe I-5to the elaborate wildfire and firefighter shrinesatalocal bar.See more ofOregon Fire Linesat VBS.TVThere are very few places firemen aren'trevered aslocal heroes,but the wildernessfirefightersof Oregon go past people simply risking their lives to help others into a crazy superhero realm where their work regularly prevents entire settlements from being destroyed.They're literallythe guardians of theircommunities.Incidentally,their work isalso very beneficial forthe forest.We spent afew days following acrew of Grayback forest-firefighters walk up the sides of what most people would considera cliff,to chop down underbrush in preparation for acontrolled burn.This is what they like tocall"project work"-the light stuff theydobetween fires.The work is the hardestand leastrewarding work we have ever tried todo.Unless you consider12-hour-plus shifts of backbreaking labor,virtually zero outside recognition,and occasional accusations of being shils forthe timber industry rewards.Which we do not. This piece was originally produced in August 2010.
+ +Table 30: Random Examples on Question-guided summarization. Control tokens are bolded. “[]” denote that the tokens are used as both keywords and prompts. + +
WASHINGTON(CNN)-The nation's largest publicly owned utility company may be vulnerable to cyber
Articleattacks,according toanew report.In 2OO7 President Bush visited the Browns Ferry Nuclear Plant,operated bythe Tennessee Valley Authority.The Tennessee Valley Authority, which supplies power to almost 9million Americans,"has not full implemented appropriate security practices to protect the control systems used to operate its critical infrastructures,"leaving them "vulnerable to disruption,"the Government Accountability Offce found.Simply put, that means a skilled hacker could disrupt the system and cause a blackout. Rep. James Langevin,aRhode Island Democrat,fears the problem is much larger than justthe TVA."If they are not secure,Idon't have agreat deal ofconfidence that the restof our critical infrastructure on the electric grid is secure,"hesaid.The TVAoperates 52 nuclear,hydroelectricand fossil-fuel facilities inthe southeastern United States.Among the government watchdog agency findings:·The TVA's firewals have been bypassed or are inadequately configured·Passwords are not effective·Servers and work stations lack key patches and effective virus protection·Intrusion-detection systems are not adequate·Some locations lack enough physical security around control systems.The GAO recommends 73 steps to correct the problems in its report to Congress.In September, CNN first aired dramatic footage of a government experiment demonstrating that a cyber attack could destroy electrical equipment.The experiment,dubbed "Aurora,"causeda generator to fall apartand grind toahaltafteracomputeratack on itscontrolsystem.The test was conducted byscientists at the Idaho National Laboratory.In October,the North American Electric Reliability Corp.told Congress that75 percentof utilities hadtaken steps tomitigate the Aurora vulnerability,butLangevin saidit now appears that Congress was misled. Acongressional audit of the electric reliability corporation's claimcast doubt on the assertion that most utilities were taking steps to fix the problem."Itappears that they just made those numbers up,"Langevin said."It is not acceptable.It isoutrageous."He said the result is there is now no clear pictureof how vulnerable utilities are to cyber attacks.The electric reliability corporation-a nongovernmental group that oversees the power system and comprises members of the industry and some consumers-told CNN it regrets the confusion.Experts told CNN that Cooper Industries is the only manufacturer of hardware that can close the Aurora vulnerability.The company estimated it would need to sellabout 1O,ooo devices to fix the problem nationwide.It has sold just over100,it told CNN.Langevin said the federal government may need new powers to require utilities to take corrective actions to closecybersecurity gaps,and he willpress to give those powers to the Federal Energy Regulatory Commission.The congressman is chairingan Emerging Threats,Cybersecurity,and Science and Technology subcommittee hearing Wednesdayafternoon.Representatives of the TVA,the GAO,the federal
CTRLsumcommission and the electric reliability corporation are to appear before the subcommittee. [Q:Are cyber attacks a real threat? A:]: Yes. Gold Answer: skilled hacker could disrupt the system and cause a blackout. [Q: What steps are being taken to access vulnerabilities? A:]: The GAO recommends 73 steps. Gold Answer: 73
Q: What percentage of utilities were fixed to combat attacks? A:]: 75 percent. Gold Answer: 75 percent [Q:Who can disrupt the Tennessee Valley Authority?A:]:A skilled hacker. Gold Answer: skilled hacker [Q: What was Congress told? A:]: Nothing.
\ No newline at end of file diff --git a/md/train/p5rMPjrcCZq/p5rMPjrcCZq.md b/md/train/p5rMPjrcCZq/p5rMPjrcCZq.md new file mode 100644 index 0000000000000000000000000000000000000000..36260eea1b54de29dcdb7ae295423a758cb9cf35 --- /dev/null +++ b/md/train/p5rMPjrcCZq/p5rMPjrcCZq.md @@ -0,0 +1,341 @@ +# Only Train Once: A One-Shot Neural Network Training And Pruning Framework + +Tianyi Chen∗Microsofttiachen@microsoft.com + +Bo Ji National University of Singapore jibo@comp.nus.edu.sg + +Tianyu Ding Johns Hopkins University tding1@jhu.edu + +Biyi Fang Microsoft bif@microsoft.com + +Guanyi Wang Georgia Institute of Technology gwang93@gatech.edu + +Zhihui Zhu University of Denver zhihui.zhu@du.edu + +Luming Liang Microsoft lulian@microsoft.com + +Yixin Shi Microsoft yixshi@microsoft.com + +Sheng Yi Microsoft shengyi@microsoft.com + +Xiao Tu Microsoft xiaotu@microsoft.com + +# Abstract + +Structured pruning is a commonly used technique in deploying deep neural networks (DNNs) onto resource-constrained devices. However, the existing pruning methods are usually heuristic, task-specified, and require an extra fine-tuning procedure. To overcome these limitations, we propose a framework that compresses DNNs into slimmer architectures with competitive performances and significant FLOPs reductions by Only-Train-Once (OTO). OTO contains two keys: $( i )$ we partition the parameters of DNNs into zero-invariant groups, enabling us to prune zero groups without affecting the output; and $( i i )$ to promote zero groups, we then formulate a structured-sparsity optimization problem and propose a novel optimization algorithm, Half-Space Stochastic Projected Gradient (HSPG), to solve it, which outperforms the standard proximal methods on group sparsity exploration and maintains comparable convergence. To demonstrate the effectiveness of OTO, we train and compress full models simultaneously from scratch without finetuning for inference speedup and parameter reduction, and achieve state-of-the-art results on VGG16 for CIFAR10, ResNet50 for CIFAR10 and Bert for SQuAD and competitive result on ResNet50 for ImageNet. The source code is available at https://github.com/tianyic/only_train_once. + +# 1 Introduction + +Deep neural networks (DNNs) have been shown to be effective in various real applications (51; 28). It is widely acknowledged that large-scale DNN models not only learn faster but also outperform their slimmer counterparts. However, such heavy models pose a great challenge to the deployment stage due to their resource-consuming nature. In addressing this issue, many model compression techniques (5; 11) are proposed in the past decade that aim at compressing those large and complex models into slimmer and simpler ones while suffering negligible loss in performance. + +![](images/5122d4a224e0d94e46fc150d904c85791df8f37ce1b8e1861ab9a123843fa33e.jpg) +Figure 1: Overview of OTO. Without loss of generality, we illustrate OTO on a model with only vanilla convolutional layers, and for simplicity we only show Layeri with $m$ 3D filters and their biases. The key to its success is twofold: $( i )$ identify and partition the parameters of the model into zero-invariant groups (ZIGs); and $( i i )$ solve the structured-sparsity regularization problem using HSPG. Finally, we obtain the compressed model by directly pruning the zero groups, i.e., $\mathrm { Z I G } _ { m }$ . + +Pruning methods as one of the main categories of model compression, focus on identifying and pruning redundant structures via various mechanisms to achieve a slimmer architecture, and thus improve the interpretability of a DNN model (26; 11; 65). For example, (32; 33) adopt fine-grained pruning via $\ell _ { 1 }$ or $\ell _ { 2 }$ regularization, which prune the small-weight connections based on some hard threshold. (36; 57; 60) measure the importance of filters to accelerate the networks by removing insignificant feature maps. (37; 7) utilize reinforcement learning agent to predict compression action. + +Nevertheless, many of the existing pruning methods $( i )$ often rely on criteria based on heuristics or empirical cues, e.g., magnitude of a connection weight and importance score of a filter, to identify redundant parameters, which may cause divergence during optimization; $( i i )$ thus require complex multi-stage pipelines that involve either a retraining or fine-tuning procedure to regain the accuracy during constructing a slimmer model, which is time-consuming; and $( i i i )$ are specific to certain architectures or applications, and are consequently less applicable to various downstream scenarios. Recently, there have been a few efforts (14; 58; 8) to directly train the network with sparsity inducing regularizers, which provide generality and convergence guarantee. However, these approaches focus on either merely the individual sparsity of the parameters or the group sparsity of the filters, and thus cannot directly remove those zero components (still require subsequent fine-tuning) since the zeros are entangled with other commonly used components, e.g., bias, batch normalization or skip connection. Furthermore, the optimization algorithms used in (14; 58) lack sufficient capability to explore (group) sparsity in DNNs effectively and require a post-processing step to yield exact zeros. + +In this paper, we overcome the above limitations of existing pruning methods by proposing a one-shot neural network pruning framework, with which we are able to train a full heavy model from scratch only once, and obtain a slim architecture without fine-tuning while maintain high performance. As shown in Figure 1, the key to its success is twofold: $( i )$ we identify and partition the parameters of DNNs into zero-invariant groups (ZIGs), enabling us to prune redundant structures according to zero groups without affecting the output of the network; and $( i i )$ to promote zero groups, we formulate the pruning task as a structured-sparsity optimization problem and propose a novel optimization method, Half-Space Stochastic Projected Gradient (HSPG), to solve it, which outperforms the standard proximal methods on sparsity exploration and maintains comparable convergence. We highlight that both zero-invariant group partition and the novel optimization algorithm in promoting zero group lead to achieve one-shot neural network training and pruning regardless of its architecture. + +Our main contributions are summarized as follows. + +• One-Shot Training and Pruning. We propose OTO, a training and pruning framework that compresses a full neural network with competitive performance by Only-Train-Once, thereby one-shot. OTO dramatically simplifies the complex multi-stage training pipelines of the existing pruning approaches, fits various architectures and applications, and hence is generic and efficient. + +• Zero-Invariant Group. We define zero-invariant groups for neural networks. If a network is partitioned into ZIGs, it allows us to prune the zero groups without affecting the output, which results in one-shot pruning. Such property is applicable to various popular structures from plain fully connected layers to sophisticated ones such as residual blocks and multi-head attention. + +• Novel Structured-Sparsity Optimization Algorithm. We propose Half-Space Stochastic Projected Gradient (HSPG), a method that solves structured-sparsity inducing regularization problem. We show and analyze the superiority of HSPG in promoting zero groups of networks than the standard proximal methods and the competitive objective convergence in practice. The fact that ZIG and HSPG are designed agnostic to networks makes OTO generic to various applications. + +• Experimental Results. We train and compress full models simultaneously from scratch without fine-tuning for inference speedup and parameter reduction, and achieve state-of-the-art results on compression benchmark VGG for CIFAR10, ResNet50 for CIFAR10/ImageNet, Bert for SQuAD. + +# 2 Related Work + +Structured pruning focuses on identifying and pruning the redundant structures in a full model to achieve slimmer architectures for efficient model inference and storage (26; 32), where there have been numerous efforts dedicated. For CNN compression, the general procedure can be largely summarized as: (i) train a full model; (ii) identify and prune the redundant structures to build a slimmer model based on various criteria, including (structured) sparsity (58; 85; 14; 56; 102; 27; 102; 62; 91), Bayesian pruning (101; 65; 59; 81), ranking importance (54; 60; 41; 36; 57; 100), reinforcement learning (37; 7), adversarial robustness (76), scientific control (79), lottery ticket (23; 24; 72), joint quantization learning (80; 90), etc.; (iii) retrain or iteratively fine-tune the slimmer model to regain the accuracy regression during pruning. These methods cannot avoid the extra and usually timeconsuming fine-tuning step because the identified redundant structures, even parametrized with zeros, actually contribute to the model output, thereby additional fine-tuning step is an absolute necessity. + +For pruning Bert (82), knowledge distillation (40) and LayerDropout (21) shorten Bert by reducing the number of layers directly. Other methods (29; 75; 30) build slimmer Berts in the manner of individual sparsity, but require specially designed data structure for storage and computing library to take advantage of sparse data (31; 10), and typically cannot achieve inference speedup against the highly optimized library (16) for dense model due to the discontiguous memory allocation (9). + +The structured sparsity for weight pruning is the most relevant to the algorithm described in this paper. The existing structure learning works (58; 85; 14; 56; 102) have the respective disadvantages: (i) multiple trainings during the whole procedure since their group partition cannot isolate the impact of pruned structures to the model output; and (ii) heuristic post-processing to generate zero groups as the standard proximal methods (19; 87; 88; 12) and ADMM (100; 58; 4) defective on the sparsity exploration for deep learning (8), which may deteriorate the performance of the model significantly. + +Avoiding fine-tuning step during the whole pruning procedure is receiving more and more attentions because of its efficiency. In particular, SNIP (52) and GraSP (83) identify redundancy via salience scores at the initialization stage to construct pruned structures, then train the pruned models by the standard optimizers. SCP (48) isolates the impact of batch normalization, while lacks the consideration of more general DNN architectures. + +# 3 OTO + +In essence, OTO frames the network training and pruning as a structure learning problem. Given a full model $\mathcal { M }$ , OTO trains and compresses it simultaneously from scratch without fine-tuning, and achieves significant reduction in both FLOPs and parameters. Particularly, as stated in Algorithm 1, the trainable parameters of $\mathcal { M }$ are firstly partitioned into a ZIG set $\mathcal { G }$ (Section 3.1). We then construct and solve a structured-sparsity inducing optimization problem (Section 3.2) by proposed stochastic optimizer (HSPG) to seek a highly group-sparse solution $\pmb { x } _ { \mathrm { H S P G } } ^ { * }$ (Section 3.3). Lastly, we obtain a compressed model $\mathcal { M } ^ { \ast }$ by directly pruning these zero groups (Section 3.4). + +# Algorithm 1 Outline of OTO. + +1: Input: Full model $\mathcal { M }$ (no need to be pretrained). +2: Construct $\mathfrak { s }$ : Partition the trainable parameters of $\mathcal { M }$ into a ZIG set $\mathcal { G }$ . +3: Train: Train the model $\mathcal { M }$ using HSPG (Algorithm. 2) to obtain a group-sparse solution $\pmb { x } _ { \mathrm { H S P G } } ^ { * }$ +4: Prune: Construct a slimmer model architecture M∗ by directly pruning zero groups of x∗HSPG. +5: Output: Compressed model $\mathcal { M } ^ { * }$ . + +# 3.1 Zero-Invariant Group + +The root cause of the existing methods having multi-stage training pipeline is that despite the pruned structure (e.g., 3D filter) being zeros, its associated structures (e.g., non-zero bias) still contribute to its corresponding output to the next layer (e.g., feature map). As a result, the model accuracy regresses, hence an extra step of fine-tuning is necessary. OTO avoids the necessity by partitioning the parameters of DNNs into a set of so-called zero-invariant groups (ZIGs) $\mathcal { G }$ defined as follows. + +Definition 1 (Zero-Invariant Groups (ZIGs)). For a layer-wise DNN, we partition its entire trainable parameters into disjoint groups $\mathcal { G } = \{ g \}$ . Then we call $\mathcal { G }$ zero-invariant groups (ZIGs) if each group $g \in { \mathcal { G } }$ is zero-invariant in the sense that all of the parameters in g being zeros results in its corresponding output to the next layer to be zeros as well. + +In effect, if and only if a DNN model is partitioned into a ZIG set $\mathcal { G }$ and one or more of its element $g$ are parameterized by zeros, the entire corresponding structures contribute none to the model outputs and hence can be pruned directly. Such partition is applicable to various structures of DNN models. Without loss of generality, we define and describe ZIG partition for three most popular structures: $( i )$ Conv-BN, (ii) Residual Block, and (iii) Fully Connected and Multi-Head Attention Layer. + +![](images/48438b786fc8e5517c936cd74cdfcff453877ce179a009c1570ac4ad34def872.jpg) + +(a) Conv-BN. $m$ denotes the number of channels in $\mathcal { O } ^ { l }$ (b) Residual block. $m$ denotes the number of output channels of the residual block. + +![](images/1b19210349c474bcb83508a0ecf6aedba3777bbbd3f3c4350f9684d6129d0442.jpg) + +![](images/a7c596082ec3463774fc5aac6315fb6292578b380ad98913bea369bca6c1dff5.jpg) +Figure 2: Zero-invariant group partition for three popular structures. + +(c) Fully connected layer (Left). Multi-head attention layer (Right). $m$ denotes the length of output vector. + +ZIG of Conv-BN. Convolutional layer (Conv) followed by batch-normalization layer (BN) is extensively used in DNN models. Figure 2a shows the ZIG partition for Conv-BN. The 4D filter tensor $\kappa ^ { l }$ is flattened into a filter matrix $\hat { \kappa } ^ { l }$ . During the forward pass, the input tensor $\boldsymbol { \mathcal { Z } ^ { l } }$ is transformed into the output tensor $\mathcal { O } ^ { l }$ of Conv and then into the input tensor of the $( l ^ { \bullet } + 1 ) ^ { t h }$ layer $\pmb { \mathcal { T } } ^ { l + 1 }$ by + +$$ +\mathcal { O } ^ { l } \mathcal { T } ^ { l } \otimes \hat { \mathcal { K } } ^ { l } + b ^ { l } , \ \mathcal { Z } ^ { l + 1 } \frac { a ( \mathcal { O } ^ { l } ) - \mu ^ { l } } { \sigma ^ { l } } \odot \gamma ^ { l } + \beta ^ { l } , +$$ + +where denoted by $\otimes$ the convolutional operation, $\odot$ the element-wise multiplication and $a ( \cdot )$ the activation function. BN is parameterized by mean $\mu ^ { l }$ , standard deviation $\sigma ^ { l }$ , weight $\gamma ^ { l }$ and bias $\beta ^ { l }$ respectively. The activation function needs to be zero-invariant, i.e., $a ( \mathbf { 0 } ) = \mathbf { 0 }$ , where most instances satisfy, e.g., ReLU (25), PReLU (34), GELU (39) and LeakyReLU (89). Hence, each row of the flattened filter matrix $\hat { \kappa } ^ { l }$ and its bias $b ^ { l }$ belong to one ZIG because they being zeros results in their corresponding channel of $\mathcal { O } ^ { l }$ (i.e., feature map) to be zeros as well. Subsequently, $\gamma ^ { l }$ and $\beta ^ { l }$ of this corresponding channel in BN are also included into this ZIG to avoid the value shift (zero to non-zero) during normalization. Note that grouping these four sets of parameters channel-wisely makes Conv-BN zero-invariant regardless of the value of $\mu ^ { l }$ and $\sigma ^ { l }$ , and hence they are excluded from the ZIG. For illustration, each ZIG is highlighted in the same color (e.g., $g _ { 1 } ^ { l }$ in blue). + +ZIG of Residual Block. The residual block adds another layer of challenge because its output tensor is the summation of the outputs of two Conv-BNs. Figure 2b shows the ZIG partition for the residual block. As illustrated, before propagated to Conv3, the outputs of Conv1-BN1 and Conv2-BN2 are summarized and hence share the same dimension. As such, to make residual block zero-invariant, we group the four sets of parameters channel-wisely of both Conv1-BN1 and Conv2-BN2 into ZIGs, i.e., each row of ${ \hat { \kappa } } ^ { 1 }$ , $b ^ { \hat { 1 } }$ , $\gamma ^ { 1 }$ , $\beta ^ { 1 }$ of Conv1-BN1 and each row of ${ \hat { \kappa } } ^ { 2 }$ , $b ^ { 2 }$ , $\gamma ^ { 2 }$ , $\beta ^ { 2 }$ of Conv2-BN2. In Appendix A.1, we describe the zero-invariant group partition of ResNet50 in greater detail. + +ZIG of Fully Connected and Multi-Head Attention Layer. Figure 2c shows the ZIG partition for fully connected and multi-head attention layer. Particularly, we partition each row of weight matrix and its associated bias into a ZIG, and therefore any input element is turned to zero if that ZIG is parameterized with zeros, making the fully connected layer zero-invariant. Multi-head attention layer is the key building block of the transformer architectures (82). Its trainable parameters contain a weight matrix and bias vector, consisting of the sub-matrix and sub-vector of each head (we use two heads as an example). We form ZIG by grouping each row of every sub-matrix and sub-vector, i.e., each row of $w _ { h _ { 1 } }$ , $\boldsymbol { b } _ { h _ { 1 } }$ , $w _ { h _ { 2 } }$ and $b _ { h _ { 2 } }$ of $h _ { 1 }$ and $h _ { 2 }$ , respectively. + +Automatic ZIG Partition. Based on the above illustrating examples, we provide prescribed ZIG partition for the tested DNNs in Section 4. Furthermore, given an arbitrary DNN architecture, the procedure of partitioning variables into ZIGs could be automatically proceeded, wherein the key would be identifying the connections among various layers, then performing corresponding group partition. We will leave the automatic ZIG partition for arbitrary DNNs as future work. + +# 3.2 Structured-Sparsity Regularization + +We now formulate a structured-sparsity regularization problem over the ZIG set $\mathcal { G }$ for the trainable parameters of the full model $\mathcal { M }$ as follows + +$$ +\operatorname* { m i n i m i z e } _ { \pmb { x } \in \mathbb { R } ^ { n } } \psi ( \pmb { x } ) : = f ( \pmb { x } ) + \lambda r ( \pmb { x } ) , \ r ( \pmb { x } ) : = \sum _ { g \in \mathcal { G } } \| [ \pmb { x } ] _ { g } \| , +$$ + +where $\lambda > 0$ is a weighting coefficient, $f ( { \pmb x } )$ is a task-specific loss function, and $r ( { \pmb x } )$ is an augmented structured-sparsity inducing regularization term encoding the topological structure of $\mathcal { M }$ over $\mathcal { G }$ . A larger $\lambda$ typically results in a higher group sparsity while sacrifices more on the bias of model estimation. We aim at computing a local optimum to achieve both low loss and high group sparsity. + +To induce group sparsity onto the solution of (2), there exist several candidates for $r ( { \pmb x } )$ , including mixed $\ell _ { 1 } / \ell _ { p }$ norm $( p > 1 )$ (1; 20) and group Minmax Concave Penalty (MCP) (96). Among these candidates, the mixed $\ell _ { 1 } / \ell _ { 2 }$ norm as defined in (2) is arguably the most popular choice in classical machine learning applications (1; 92), where $\lVert \cdot \rVert$ is the $\ell _ { 2 }$ -norm, and each component $g \in { \mathcal { G } }$ indexes a group of variables. In this paper, we will demonstrate the effectiveness of OTO by selecting $r ( { \pmb x } )$ as the mixed $\ell _ { 1 } / \ell _ { 2 }$ norm. We highlight OTO is applicable for other group sparsity regularizers as well. + +# 3.3 Half-Space Stochastic Projected Gradient (HSPG) + +To solve the non-smooth regularization problem as (2) in deep learning applications, the standard proximal method and the ADMM lack capability to effectively identify group sparsity; see the discussions later in this Section. Therefore, we propose a novel stochastic optimization algorithm so-called Half-Space Stochastic Projected Gradient (HSPG) to enhance the group sparsity exploration more effectively than the classical methods while maintain a similar convergence property. + +Outline. We state the outline of HSPG in Algorithm 2. It contains two stages: Initialization Stage and Group-Sparsity Stage. The first Initialization Stage employs Stochastic Gradient Descent (SGD) step to search for a good but usually non-sparse solution estimate. Then the second stage proceeds Half-Space step started with the non-sparse iterate to effectively exploit the group sparsity within a sequence of reduced spaces and converges to the group-sparse solutions. Half-Space step performs SGD update on free non-zero variables along with a novel projection operator so-called Half-Space Projection, which significantly outperforms the standard proximal operators on sparsity exploration. + +Initialization Stage. The Initialization Stage performs the vanilla SGD to find a good initial point for the subsequent Group-Sparsity Stage. At $k ^ { \mathit { \hat { t } h } }$ iteration, a stochastic gradient of $f$ , e.g., based on a mini-batch, is generated denoted as $\boldsymbol { \nabla } \tilde { f }$ . Since the group sparsity inducing regularizer $r ( { \pmb x } )$ in the form as (2) is non-smooth, we select a subgradient $\zeta ( \pmb { x } _ { k } )$ from its subdifferential $\partial r ( \pmb { x } _ { k } )$ to form a stochastic subgradient of $\psi ( \pmb { x } _ { k } )$ as $\nu ( { \pmb x } _ { k } ) : = \nabla \tilde { f } ( { \pmb x } _ { k } ) + \lambda \zeta ( { \pmb x } _ { k } )$ . We then compute the next iterate as $\pmb { x } _ { k + 1 } : = \pmb { x } _ { k } - \alpha _ { k } \nu ( \pmb { x } _ { k } )$ by subgradient descent update. + +![](images/67e7cbd3ef90c0abd50772be2db874a17a3bcb8ba70ef573ad987a889fefe45a.jpg) +Figure 3: Illustration of Half-Space Step with projection in (6), where $\mathcal { G } = \{ \{ 1 , 2 \} \}$ . + +Group-Sparsity Stage. The Group-Sparsity Stage is designed to effectively determine the groups of zero variables and capitalize convergence characteristic, which is in sharp contrast to other heuristic aggressive weight pruning methods that typically lack theoretical guarantees (55; 60). The intuition of Half-Space Step is to project $[ \boldsymbol { x } _ { k } ] _ { g }$ to zero only if $- [ { \pmb x } _ { k } ] _ { g }$ serves as a descent step to $\psi ( \pmb { x } _ { k } )$ , i.e., $- [ { \pmb x } _ { k } ] _ { g } ^ { \top } [ \nabla \psi ( { \pmb x } _ { k } ) ) ] _ { g } < 0$ , hence updating $[ { \pmb x } _ { k + 1 } ] _ { g } [ { \pmb x } _ { k } ] _ { g } - [ { \pmb x } _ { k } ] _ { g } = 0$ still results in some progress to the optimality. In particular, we first define the following index sets for any $\pmb { x } \in \mathbb { R } ^ { n }$ : + +$$ +\begin{array} { r } { \mathcal { Z } ^ { 0 } ( \pmb { x } ) : = \{ g : g \in \mathcal { G } , [ \pmb { x } ] _ { g } = 0 \} \mathrm { a n d } \mathcal { Z } ^ { \neq 0 } ( \pmb { x } ) : = \{ g : g \in \mathcal { G } , [ \pmb { x } ] _ { g } \neq 0 \} , } \end{array} +$$ + +where $\mathcal { T } ^ { 0 } ( { \pmb x } )$ represents the indices of groups of zero variables at $_ { \textbf { \em x } }$ , and $\scriptstyle { \mathcal { T } } ^ { \neq 0 } ( { \pmb x } )$ indexes the groups of nonzero variables at $_ { \textbf { \em x } }$ . To proceed, we further define an artificial set that $_ { \textbf { \em x } }$ lies in: + +$$ +\begin{array} { r } { S ( { \boldsymbol x } ) : = \{ \mathbf 0 \} \bigcup \big \{ z \in \mathbb R ^ { n } : [ z ] _ { g } = \mathbf 0 \mathrm { ~ i f ~ } g \in \mathcal { X } ^ { 0 } ( { \boldsymbol x } ) , \mathrm { a n d ~ } [ z ] _ { g } ^ { \top } [ { \boldsymbol x } ] _ { g } \geq \epsilon \| [ { \boldsymbol x } ] _ { g } \| ^ { 2 } \mathrm { ~ i f ~ } g \in \mathcal { X } ^ { \neq 0 } ( { \boldsymbol x } ) \big \} , } \end{array} +$$ + +which consists of half-spaces and the origin. Here the parameter $\epsilon \geq 0$ controls how aggressively we promote group sparsity, and is typically fixed as zero in practice. Hence, $\pmb { x } \in S _ { k } : = \pmb { S } ( \pmb { x } _ { k } )$ only if: (i) $[ { \pmb x } ] _ { g }$ lies in the upper half-space for all $g \in { \mathcal { T } } ^ { \neq 0 } ( { \pmb x } _ { k } )$ for some prescribed $\epsilon \in [ 0 , 1 )$ as shown in Figure 3a; and (ii) $[ { \pmb x } ] _ { g }$ equals to zero for all $g \in \mathcal { T } ^ { 0 } ( { \pmb x } _ { k } )$ . Intuitively, $\scriptstyle { S _ { k } }$ establishes the region where important structures inhabit, thereby redundant structures vanish if falling outside. + +Ideally, the Initialization Stage has produced reasonably well but typically non-sparse iterate $\scriptstyle { \mathbf { { \mathit { x } } } } _ { k }$ nearby a group-sparse solution $\pmb { x } ^ { * }$ of problem (2), , i.e., the optimal distance $\| \pmb { x } _ { k } - \pmb { x } ^ { * } \|$ is sufficiently small. As seen in Appendix B, it further indicates that the group-sparse optimal solution $\pmb { x } ^ { * }$ inhabits $S _ { k }$ , and $S _ { k }$ has already covered the group-support of $\pmb { x } ^ { * }$ , i.e., $\mathcal { T } ^ { \neq 0 } ( { \pmb x } ^ { * } ) \subseteq \mathbb { Z } ^ { \neq 0 } ( { \pmb x } _ { k } ^ { * } )$ . Our goal now becomes minimizing $\psi ( { \pmb x } )$ over $\boldsymbol { S } _ { k }$ to identify the remaining zero groups, i.e., $\mathcal { T } ^ { 0 } ( \dot { \pmb { x } ^ { * } } ) / \mathcal { Z } ^ { 0 } ( \pmb { x } _ { k } )$ , which is formulated as the following problem: + +# Algorithm 2 Outline of HSPG for solving (2). + +1: Input: $\pmb { x } _ { 0 } \in \mathbb { R } ^ { n }$ , $\alpha _ { 0 } > 0 , \epsilon \in [ 0 , 1 )$ , and $N \in \mathbb { Z } ^ { + }$ . +2: Output: a group-sparse solution $\pmb { x } _ { \mathrm { H S P G } } ^ { * }$ from $\{ \boldsymbol { x } _ { k } \}$ . +3: for $k = 0 , 1 , 2 , \ldots$ . do +4: Compute a stochastic subgradient $\nu ( \pmb { x } _ { k } )$ of $\psi ( \pmb { x } _ { k } )$ . +5: if $k < N$ then +6: Subgradient Descent Update: +7: Set ${ \pmb x } _ { k + 1 } { \pmb x } _ { k } - \alpha _ { k } { \pmb \nu } ( { \pmb x } _ { k } )$ . +8: else +9: Half-Space Update: +10: Set a trial iterate $\tilde { \pmb { x } } _ { k + 1 }$ as +$\begin{array} { r l } & { [ \tilde { \pmb { x } } _ { k + 1 } ] _ { \mathcal { T } ^ { \neq 0 } ( { \pmb x } _ { k } ) } [ { \pmb x } _ { k } - \alpha _ { k } \nu ( { \pmb x } _ { k } ) ] _ { \mathcal { T } ^ { \neq 0 } ( { \pmb x } _ { k } ) } } \\ & { [ \tilde { \pmb { x } } _ { k + 1 } ] _ { \mathcal { T } ^ { 0 } ( { \pmb x } _ { k } ) } \mathbf { 0 } . } \end{array}$ +11: for each group $g$ in $\mathcal { G }$ do +12: $[ \pmb { x } _ { k + 1 } ] _ { g } [ \mathrm { P r o j } _ { S _ { k } } ^ { H S } ( \tilde { \pmb { x } } _ { k + 1 } ) ] _ { g } .$ . +13: Update $\alpha _ { k + 1 }$ . + +$$ +{ \underset { \pmb { x } \in S _ { k } } { \mathrm { m i n i m i z e } } } \psi ( \pmb { x } ) = f ( \pmb { x } ) + \lambda r ( \pmb { x } ) . +$$ + +The next iterate $\scriptstyle { \pmb { x } } _ { k + 1 }$ is computed as an solution estimate of problem (5). + +Particularly, in Algorithm 2, $[ { \pmb x } _ { k + 1 } ] _ { { \mathcal { T } } ^ { 0 } ( { \pmb x } _ { k } ) } \equiv { \bf 0 }$ will not be updated, and only the entries in $\scriptstyle { \mathcal { T } } ^ { \neq 0 } ( { \pmb x } _ { k } )$ are free to move. Hence $\psi ( { \pmb x } )$ is smooth on $\scriptstyle { S _ { k } }$ , and (5) is a reduced space optimization problem. A standard way to solve problem (5) would be the stochastic gradient descent equipped with Euclidean projection (68). However, such a projected method rarely produces zero (group) variables, as the dense Euclidean projected point $\hat { \pmb x } _ { E } \neq { \bf 0 }$ illustrated in Figure 3a. To address, we introduce a novel half-space projection operator to effectively project an entire group of variables to zeros. + +As line 4 and 9-12 in Algorithm 2, we first approximate the (sub)gradient of $\psi$ on the free variables by $[ \nu ( \pmb { x } _ { k } ) ] _ { \pmb { \mathbb { T } } ^ { \neq 0 } ( \pmb { x } _ { k } ) }$ , then employ gradient descent over $\scriptstyle { \mathcal { T } } ^ { \neq 0 } ( { \pmb x } _ { k } )$ to compute a trial point $\widetilde { \pmb { x } } _ { k + 1 }$ which is passed into a fresh half-space projection operator $\mathrm { P r o j } _ { S _ { k } } ^ { H S } ( \cdot )$ defined as + +$$ +\begin{array} { r } { \left[ \mathrm { P r o j } _ { { \mathcal S } _ { k } } ^ { H S } ( z ) \right] _ { g } : = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f } [ z ] _ { g } ^ { \top } [ \pmb { x } _ { k } ] _ { g } < \epsilon \left\| [ \pmb { x } _ { k } ] _ { g } \right\| ^ { 2 } , } \\ { [ z ] _ { g } } & { \mathrm { o t h e r w i s e } . } \end{array} \right. } \end{array} +$$ + +The above projector of form (6) is not the standard one in Euclidean sense2, and it has two advantages: $( i )$ the actual search direction $d _ { k } : = ( \mathrm { P r o j } _ { S _ { k } } ^ { H S } ( \tilde { \pmb { x } } _ { k + 1 } ) - \pmb { x } _ { k } ) / \alpha _ { k }$ performs as a descent direction to $\psi ( \pmb { x } _ { k } )$ , i.e., $[ \mathbf { \mathop { d } } _ { k } ] _ { g } ^ { \top } [ \nu ( \mathbf { \mathop { x } } _ { k } ) ) ] _ { g } < 0$ as $\theta < 9 0 ^ { \circ }$ in Figure 3a, hence the progress to the optimum is made via the sufficient decrease property drawn as Lemma 1 in Appendix B; then $( i i )$ it effectively projects entire groups of variables to zero if the inner product of corresponding entries is sufficiently small. In contrast, the Euclidean projection operator is far away effective to promote group sparsity. + +Superiority of HSPG on Group Sparsity Identification. We now intuitively illustrate the strength of HSPG on group sparsity exploration. In fact, the half-space projection (6) is a more effective sparsity promotion mechanism compared to the standard proximal methods. Particularly, it benefits from a much larger projection region to map a reference point $\hat { \pmb { x } } _ { k + 1 } : = \pmb { x } _ { k } - \alpha _ { k } \nabla \tilde { f } ( \pmb { x } _ { k } )$ or its variants to zero. As the 2D case described in Figure 3b, the projection regions of the state-of-the-art Prox-SG (19), Prox-SVRG (88), Prox-Spider (97) and SAGA (12) for (2) are $\ell _ { 2 }$ -balls with radius as $\alpha _ { k } \lambda$ . In deep learning applications, the step size $\alpha _ { k }$ is usually selected around $1 0 ^ { - 3 }$ to $1 0 ^ { - 4 }$ or even smaller for convergence. Together with the common setting of $\lambda \ll 1$ , their projection regions would vanish rapidly, resulting in the difficulties to produce group sparsity. As a sharp contrast, even though $\alpha _ { k } \lambda$ is near zero, the projection region of HSPG $\{ \pmb { x } : \pmb { x } _ { k } ^ { \top } \pmb { x } < ( \dot { \alpha _ { k } } \lambda + \epsilon \| \pmb { x } _ { k } \| ) \| \pmb { x } _ { k } \| \}$ (seen in Appendix B) is still an open half-space which contains those $\ell _ { 2 }$ balls as well as RDA (87)’s if $\epsilon$ is large enough. Conversely, vanilla ADMM alone lacks the mechanism to project a group of variables to zero, unless equips with extra post-processing step (100; 58). In Appendix B, we further reveal that HSPG still maintains the convergence to the optimality as drawn in Theorem 1. Moreover, we numerically demonstrate the superiority of HSPG in the sense of optimization in Appendix C. + +# 3.4 Pruning Without Fine-Tuning + +The group-sparse solution $\pmb { x } _ { \mathrm { H S P G } } ^ { * }$ over ZIGs to the full model $\mathcal { M }$ is leveraged to construct the slimmer model $\mathcal { M } ^ { * }$ . Particularly, we prune the redundant structures identified as zero groups $\mathcal { T } ^ { 0 }$ and retain non-zero groups $\mathcal { T } ^ { \neq 0 }$ in $\pmb { x } _ { \mathrm { H S P G } } ^ { * }$ . Because the parameters of full model are partitioned into ZIGs, the pruned structures contribute none to the model output. Therefore, given the same input, the slimmer model $\mathcal { M } ^ { * }$ computes the identical output as the full model $\mathcal { M }$ parameterized with $\pmb { x } _ { \mathrm { H S P G } } ^ { * }$ . + +# 4 Experiment + +In this section, we numerically demonstrate the effectiveness of OTO by one-shot training and pruning without fine-tuning on several benchmark compression tasks for CNNs, i.e., VGG16 (77) for CIFAR10 (49) and ResNet50 (35) for CIFAR10 (49) and ImagetNet (ILSVRC2012) (15). We also verify the scalibility of OTO onto Bert (82) evaluated on SQuAD (69). All datasets are free to academic usage and do not contain personally identifiable information or offensive content. CIFAR10 is under the MIT license, consisting of 50,000 training and 10,000 test images from 10 classes. ImagetNet is a large-scale dataset without license and contains about 1.2 million and 50,000 images in training and validation sets from 1,000 classes. SQuAD is under the CC BY-SA 4.0 license with about 100,000 question/answer pairs splitted into train/dev/test sets as $( 8 0 / 1 0 / 1 0 \%$ ). We conduct all experiments on a Nvidia RTX8000 GPU and provide implementation details in Appendix A. + +Table 1: VGG16 and VGG16-BN for CIFAR10. Convolutional layers are in bold. + +
MethodBNArchitectureFLOPs#of ParamsTop-1 Acc.
BaselineX64-64-128-128-256-256-256-512-512-512-512-512-512-512-512100%100%91.6%
SBP (65)X47-50-91-115-227-160-50-72-51-12-34-39-20-20-27231.1%5.9%91.0%
BC (59)51-62-125-128-228-129-38-13-9-6-5-6-6-6-2038.5%5.4%91.0%
RBC (101)43-62-120-120-182-113-40-12-20-11-6-9-10-10-2232.3%3.9%90.5%
RBP (101)50-63-123-108-104-57-23-14-9-8-6-7-11-11-1228.6%2.6%91.0%
OTOxxxx21-45-82-110-109-68-37-13-9-7-3-5-8-170-34416.3%2.5%91.0%
Baseline64-64-128-128-256-256-256-512-512-512-512-512-512-512-512100%100%93.2%
EC (55)32-64-128-128-256-256-256-256-256-256-256-256-256-512-51265.8%37.0%93.1%
Hinge (56)60.9%20.0%93.6%
SCP(48)33.8%7.0%93.8%
OTO22-56-93-123-182-125-95-45-27-21-10-13-19-244-39226.8%5.5%93.3%
+ +# 4.1 Deep Convolutional Neural Network + +The results on CNN experiments are summarized in Table 1, 2 and 4. In particular, we compare OTO to its state-of-the-art counterparts by Top-1/5 accuracy, remaining FLOPs and parameters against the corresponding baseline (full model). We report the numbers of other methods based on the corresponding literature and leave as ‘-’ if not reported. The best pruning results are marked as bold. + +VGG16 for CIFAR10. We consider the standard VGG16 and the version with batch normalization layer after each convolutional layer, referred to as VGG16-BN. OTO partitions the parameters into ZIGs following Section 3.1, then trains and prunes the model via HSPG, and finally constructs the slimmer model without fine-tuning. For VGG16, as shown in Table 1, the pruned architecture of OTO indicates that OTO identifies similar redundancy of the intermediate and late convolutional layers compared to other methods, but significantly more of the early convolutional layers. As a result, OTO achieves $8 3 . 7 \%$ $( 1 - 1 6 . 3 \% )$ FLOPs reduction and $9 7 . 5 \%$ $( \dot { 1 } - 2 . 5 \% )$ parameter reduction with the best Top-1 accuracy, which outperforms other state-of-the-arts significantly. For VGG16-BN, among all, OTO reduces FLOPs and parameters to the lowest $2 6 . 8 \%$ and $5 . 5 \%$ , respectively. EC (55) and Hinge (56) achieve the same level of Top-1 accuracy as OTO, but are substantially outperformed when it comes to FLOPs and parameter reduction. We further present the FLOPs reductions per layer of OTO in Table 7 of Appendix A.4. + +ResNet50 for CIFAR10. Since OTO is able to automatically learn a slimmer model of high performance, we compare it with two state-of-the-art automatic neural network compression frameworks, i.e., AMC (37) and ANNC (90). AMC trains a reinforcement learning agent to predict compression action for each layer environment. ANNC jointly proceeds pruning and quantization within energy + +Table 2: ResNet50 for CIFAR10. + +
MethodFLOPs#of ParamsTop-1 Acc.
Baseline100%100%93.5%
AMC (37)160.0%93.6%
ANNC (90)=50.0%95.0%
PruneTrain (61)30.0%193.1%
N2NSkip (78)110.0%94.4%
OTO12.8%8.8%94.4%
+ +constraint. We conduct OTO on their shared experiment, i.e., ResNet50 on CIFAR10. ResNet50 includes both the standard convolutional layers and the layers with residual connections, which are partitioned into ZIGs following Section 3.1. We report the results in Table 2 along with other competitors from (61; 78). Based on the results, all methods achieve competitive validation accuracies, where most of them are even higher than the baseline reported in (37). OTO outperforms AMC, ANNC without quantization, PruneTrain and N2NSkip by using only $1 2 . 8 \%$ FLOPs and $8 . 8 \%$ parameters. Note that no FLOPs reduction is reported in (37) and (90). Finally, we highlight that OTO is flexible to incorporate quantization as the two techniques are complementary and will leave to future work. + +Ablation Study on Switching Parameter $N$ . We provide ablation study regarding the impact the switch (parameterized as $N$ ) between the initialization stage and the groupsparsity stage in Algorithm 1. In theory, as shown in Theorem 1 of Ap + +Table 3: OTO Under Different Switchings $( N = T , 2 T , 3 T )$ for VGG16, VGG16-BN and ResNet50 on CIFAR10 + +
BackendFLOPs#of ParamsTop-1 Acc.
VGG1617.0% ± 1.4%2.6% ± 0.4%90.9%± 0.3%
VGG16-BN25.4%±1.1%5.0%± 0.5%93.3% ±0.2%
ResNet5012.9% ± 1.5%8.5% ± 1.0%94.2% ± 0.2%
+ +pendix B.4, the projection stage should start when the iterate falls nearby a group sparse local minimizer. In practice, we relax it to start the group sparsity stage once the iterate falling into some stationary status regarding the validation accuracy. As described in Appendix A.2, throughout all experiments, we periodically decay the learning rate per fixed number of epochs parameterized as $T$ . + +At the end of each $T$ epochs, we then proceed a statistical test similar to (98) but on the validation accuracy and find that the validation accuracy falls into stationarity near the late epochs of each period. Therefore, in our pruning experiments, we switch to the group-sparsity stage right after the first $T$ epochs. Table 3 describes the performance of OTO under varying switching parameters, from which we observe that OTO is not largely sensitive to the switching parameter if the group-sparsity stage starts after some stationary condition has been numerically satisfied. + +ResNet50 for ImageNet. We now evaluate OTO on ResNet50 for ImageNet. As shown in Table 4, OTO prunes $6 4 . 5 \% ( 1 \textrm { -- }$ $3 5 . 5 \%$ ) parameters to achieve $6 5 . 5 \% ( 1 - 3 4 . 5 \% )$ FLOPs reduction with only $1 . { \dot { 4 } } \% / 0 . 8 \%$ Top1/5 accuracy regression compared to the baseline. OTO consistently outperforms the majority of counterparts especially on the FLOPs reduction and the parameter reduction. We note that Hinge (56) prunes CNNs via structured-sparsity optimization by employing standard stochastic proximal gradient method. It + +Table 4: ResNet50 for ImageNet. + +
MethodFLOPs#ofParamsTop-1 Acc.Top-5 Acc.
Baseline100%100%76.1%92.9%
DDS-26 (43)57.0%61.2%71.8%91.9%
CP (38)66.7%172.3%90.8%
ThiNet-50 (45)44.2%48.3%71.0%90.0%
RBP (101)43.5%48.0%71.1%90.0%
RRBP (101)45.4%173.0%91.0%
SFP (36)41.8%=74.6%92.1%
Hinge (56)46.6%74.7%
GBN-50 (94)44.9%46.6%75.2%92.4%
GBN-60 (94)59.5%68.2%76.2%92.8%
Group-HS (2e-5) (91)32.4%=75.2%92.5%
Group-HS (1e-5) (91)52.9%76.4%93.1%
ResRep (18)45.5%76.2%92.9%
SCP (48)45.7%74.2%92.0%
OTO34.5%35.5%74.7%92.1%
OTO*34.5%35.5%75.1%92.5%
+ +requires several trainings including fine-tuning the pruned model, because it partitions the parameters into non-ZIGs and relies on an empirical truncation mechanism to generate zero groups due to the weakness of proximal operator in deep learning applications (8). In contrast, OTO only trains and prunes the full model from scratch once and obtains better pruning results. The comparison between OTO and Hinge stand as evidence of the superiority of OTO due to ZIGs and HSPG. Furthermore, if with more training efforts, OTO reaches higher Top-1/5 accuracy marked as ∗ in Table 4 and becomes more competitive to stronger competitors, such as GBN (94), Group-HS (91) and ResRep (48). + +Representation of Deep Features of ImageNet. It is widely acknowledged that deep neural architectures could be treated as non-linear feature representation extractors. Therefore, we further study the feature representation extracted by OTO to demonstrate its generalizability to other visual applications besides image classification. Figure 4 shows the clustering results of ImageNet validation images using the deep feature extracted by both the baseline ResNet50 and the pruned ResNet50 by OTO. Specifically, we extract the deep features over the validation samples in ImageNet, i.e., the tensors fed into the fully connected layer, and project them onto a 2-dimensional space via PCA (47). For illustration, following the hierarchy of ImageNet (3), two sets of five classes are randomly selected3. We observe that the deep features of the pruned ResNet50 by OTO remain structured in the sense that distinct classes are well separated from each other. Over all 1000-class ImageNet validation images, OTO achieves $4 8 . 2 \%$ clustering accuracy compared to $4 2 . 5 \%$ of the baseline ResNet50 using $\mathbf { k }$ -means. Both observations indicate that with only $3 5 . 5 \%$ parameters and $3 4 . 5 \%$ FLOPs, the pruned ResNet50 is still able to extract highly discriminative deep features. We argue that during model compression, OTO not only achieves parameter and FLOPs reduction, but also preserves the ability of capturing perceptual properties (99). This is especially important in training and compressing models for many vision tasks, e.g., object detection (70; 71), frame interpolation (2; 17; 67) and video synthesis (84; 50). We leave the application of OTO to broader tasks to future work. + +# 4.2 Large-Scale Transformer + +We show the scalability of OTO by pruning the large-scale transformer Bert (82), evaluated on SQuAD, a question-answering benchmark (69). Bert mainly includes embedding layers, fully connected layers and multi-head attention layers. The fully connected layers and the multi-head attention layers are partitioned into ZIGs following Section 3.1. For fair comparisons, we follow the prior Bert compression works (14; 75) and do not prune the embedding layers. + +![](images/149863a9ad5e7f572f51efc22421bbc22dc4300af2734f2794e3c3e99cb4ad35.jpg) +Figure 4: Clustering results of ImageNet validation images using deep features extracted by full ResNet50 (left of a and b) and pruned ResetNet50 by OTO (right of a and b). The points are visualized by projecting deep features onto a two-dimensional space via PCA. + +To the best of our knowledge, OTO is the first work that compresses Bert by exploring group sparsity on individual layers and achieves significant parameter reduction and inference speedup4. In contrast, the existing works (29; 75; 30) prune individual parameters instead, i.e., the generated sparsity is not structured. Hence, the computed models typically do not have inference speedup (75), unless are executed by specialized hardware and sparse computing library (31; 10). As + +Table 5: Pruning Bert on SQuAD + +
Method#ofParamsExactF1-scoreSpeedUp
Baseline100%81.0%88.3%
MaP (75)10.0%67.7%78.5%1×*
MvP (75)10.0%71.9%81.7%1×*
ProxSSI (14)83.4%t72.3%82.0%
OTO91.0%75.0%84.1%1.1×
OTO76.2%72.3%82.1%1.2×
OTO66.7%71.9%82.0%1.3×
OTO53.3%71.4%81.5%1.5×
OTO40.0%70.9%81.1%1.8×
+ +\* Based on the statement in the official git repository of (75). † Approximate value based on the group sparsity reported in (14). + +shown in Table 5, under different group sparsity upper bound constraints, OTO reduces $9 \%$ t o $60 \%$ parameters and achieves up to $1 . 8 \times$ inference speedup based on the average model execution time 5. In comparison, despite that the pruned model contains $1 0 \%$ parameters, MaP and MvP (75) do not have any inference speedup. On the other hand, the structured sparsity on Bert is studied in (14) (referred to as ProxSSI), where an adaptive proximal method is proposed to yield group-sparse solution. Nonetheless, ProxSSI optimizes over non-ZIGs and relies on proximal operator to identify group sparsity. Therefore, the groups even parameterized with zeros have to be retained in the model rather than pruned. As a consequence, ProxSSI is not competitive to OTO on parameter reduction, and there is no reported inference speedup. Note that all the pruning methods achieve comparable exact match rate and F1-score. + +# 5 Conclusion And Future Work + +We propose OTO, a one-shot deep neural networks (DNNs) training and pruning framework, that compresses full DNNs into slimmer architectures with competitive performances and significant FLOPs and parameter reduction without fine-tuning. OTO contains two fundamentals: (i) partitions the trainable parameters of DNNs into zero-invariant groups (ZIGs), thereby pruning zero groups does not affect the model output, and (ii) trains by a novel optimizer, Half-Space Stochastic Projected Gradient (HSPG), which outperforms proximal methods on group sparsity exploration and maintains comparable convergence. We numerically demonstrate OTO on benchmark experiments, i.e., VGG16 for CIFAR10, ResNet50 for CIFAR10/ImageNet and Bert for SQuAD, and achieve state-of-theart pruning results. We leave automatically generating ZIGs for arbitrary DNNs, incorporating quantization and applying OTO to other tasks to future work. + +# References + +sparsity through convex optimization. Statistical Science, 27(4):450–468, 2012. [2] Wenbo Bao, Wei-Sheng Lai, Chao Ma, Xiaoyun Zhang, Zhiyong Gao, and Ming-Hsuan Yang. Depth-aware video frame interpolation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3703–3712, 2019. [3] Mike Bostock. Imagenet hierarchy. https://observablehq.com/@mbostock/ imagenet-hierarchy. +[4] Stephen Boyd, Neal Parikh, and Eric Chu. Distributed optimization and statistical learning via the alternating direction method of multipliers. Now Publishers Inc, 2011. [5] Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In ˇ Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 535–541, 2006. +[6] Chih-Chung Chang and Chih-Jen Lin. Libsvm: A library for support vector machines. ACM transactions on intelligent systems and technology (TIST), 2(3):1–27, 2011. +[7] Jianda Chen, Shangyu Chen, and Sinno Jialin Pan. Storage efficient and dynamic flexible runtime channel pruning via deep reinforcement learning. 2019. [8] Tianyi Chen, Tianyu Ding, Bo Ji, Guanyi Wang, Yixin Shi, Sheng Yi, Xiao Tu, and Zhihui Zhu. Orthant based proximal stochastic gradient method for ell_1-regularized optimization. arXiv preprint arXiv:2004.03639, 2020. [9] Tianyi Chen, Yixin Shi, and Sheng Yi. Spatially sparse convolutional neural networks for inking applications, Sept. 17 2020. US Patent App. 16/355,702. +[10] Xuhao Chen. Escoin: Efficient sparse convolutional neural network inference on gpus. arXiv preprint arXiv:1802.10280, 2018. +[11] Yu Cheng, Duo Wang, Pan Zhou, and Tao Zhang. A survey of model compression and acceleration for deep neural networks. arXiv preprint arXiv:1710.09282, 2017. +[12] Aaron Defazio, Francis Bach, and Simon Lacoste-Julien. Saga: A fast incremental gradient method with support for non-strongly convex composite objectives. In Advances in neural information processing systems, pages 1646–1654, 2014. +[13] Aaron Defazio and Léon Bottou. On the ineffectiveness of variance reduced optimization for deep learning. In Advances in Neural Information Processing Systems, 2019. +[14] Tristan Deleu and Yoshua Bengio. Structured sparsity inducing adaptive optimizers for deep learning. arXiv preprint arXiv:2102.03869, 2021. +[15] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A largescale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009. +[16] ONNX Runtime developers. Onnx runtime. https://onnxruntime.ai/, 2021. +[17] Tianyu Ding, Luming Liang, Zhihui Zhu, and Ilya Zharkov. Cdfi: Compression-driven network design for frame interpolation. arXiv preprint arXiv:2103.10559, 2021. +[18] Xiaohan Ding, Tianxiang Hao, Jianchao Tan, Ji Liu, Jungong Han, Yuchen Guo, and Guiguang Ding. Lossless cnn channel pruning via decoupling remembering and forgetting. Proceedings of the IEEE International Conference on Computer Vision, 2021. +[19] John Duchi and Yoram Singer. Efficient online and batch learning using forward backward splitting. Journal of Machine Learning Research, 10(Dec):2899–2934, 2009. +[20] Marwa El Halabi, Francis Bach, and Volkan Cevher. Combinatorial penalties: Which structures are preserved by convex relaxations? In International Conference on Artificial Intelligence and Statistics, pages 1551–1560. PMLR, 2018. +[21] Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019. +[22] Cong Fang, Chris Junchi Li, Zhouchen Lin, and Tong Zhang. Spider: Near-optimal nonconvex optimization via stochastic path-integrated differential estimator. In Advances in Neural Information Processing Systems, pages 689–699, 2018. +[23] Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. arXiv preprint arXiv:1803.03635, 2018. +[24] Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M Roy, and Michael Carbin. Stabilizing the lottery ticket hypothesis. arXiv preprint arXiv:1903.01611, 2019. +[25] Kunihiko Fukushima. Visual feature extraction by a multilayered network of analog threshold elements. IEEE Transactions on Systems Science and Cybernetics, 5(4):322–333, 1969. +[26] Trevor Gale, Erich Elsen, and Sara Hooker. The state of sparsity in deep neural networks. arXiv preprint arXiv:1902.09574, 2019. +[27] Shang-Hua Gao, Yong-Qiang Tan, Ming-Ming Cheng, Chengze Lu, Yunpeng Chen, and Shuicheng Yan. Highly efficient salient object detection with 100k parameters. In European Conference on Computer Vision, pages 702–721. Springer, 2020. +[28] Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT press Cambridge, 2016. +[29] Mitchell A Gordon, Kevin Duh, and Nicholas Andrews. Compressing bert: Studying the effects of weight pruning on transfer learning. arXiv preprint arXiv:2002.08307, 2020. +[30] Fu-Ming Guo, Sijia Liu, Finlay S Mungall, Xue Lin, and Yanzhi Wang. Reweighted proximal pruning for large-scale language representation. arXiv preprint arXiv:1909.12486, 2019. +[31] Song Han, Xingyu Liu, Huizi Mao, Jing Pu, Ardavan Pedram, Mark A Horowitz, and William J Dally. Eie: Efficient inference engine on compressed deep neural network. ACM SIGARCH Computer Architecture News, 44(3):243–254, 2016. +[32] Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015. +[33] Song Han, Jeff Pool, John Tran, and William J Dally. Learning both weights and connections for efficient neural networks. arXiv preprint arXiv:1506.02626, 2015. +[34] 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, pages 1026–1034, 2015. +[35] 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, 2016. +[36] Yang He, Guoliang Kang, Xuanyi Dong, Yanwei Fu, and Yi Yang. Soft filter pruning for accelerating deep convolutional neural networks. arXiv preprint arXiv:1808.06866, 2018. +[37] Yihui He, Ji Lin, Zhijian Liu, Hanrui Wang, Li-Jia Li, and Song Han. Amc: Automl for model compression and acceleration on mobile devices. In Proceedings of the European Conference on Computer Vision (ECCV), pages 784–800, 2018. +[38] Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017. +[39] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. +[40] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. +[41] Hengyuan Hu, Rui Peng, Yu-Wing Tai, and Chi-Keung Tang. Network trimming: A data-driven neuron pruning approach towards efficient deep architectures. arXiv preprint arXiv:1607.03250, 2016. +[42] Junzhou Huang, Tong Zhang, and Dimitris Metaxas. Learning with structured sparsity. Journal of Machine Learning Research, 12(Nov):3371–3412, 2011. +[43] Zehao Huang and Naiyan Wang. Data-driven sparse structure selection for deep neural networks. In Proceedings of the European conference on computer vision (ECCV), pages 304–320, 2018. +[44] Rodolphe Jenatton, Guillaume Obozinski, and Francis Bach. Structured sparse principal component analysis. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 366–373, 2010. +[45] Jianxin Wu Jian-Hao Luo and Weiyao Lin. Thinet: A filter level pruning method for deep neural network compression. In ICCV, pages 5058–5066, 2017. +[46] Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In Advances in neural information processing systems, pages 315–323, 2013. +[47] Ian Jolliffe. Principal Component Analysis, pages 1094–1096. Springer Berlin Heidelberg, Berlin, Heidelberg, 2011. +[48] Minsoo Kang and Bohyung Han. Operation-aware soft channel pruning using differentiable masks. In International Conference on Machine Learning, pages 5122–5131. PMLR, 2020. +[49] A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Master’s thesis, Department of Computer Science, University of Toronto, 2009. +[50] Vivek Kwatra, Arno Schödl, Irfan Essa, Greg Turk, and Aaron Bobick. Graphcut textures: Image and video synthesis using graph cuts. Acm transactions on graphics (tog), 22(3):277– 286, 2003. +[51] Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436–444, 2015. +[52] Namhoon Lee, Thalaiyasingam Ajanthan, and Philip HS Torr. Snip: Single-shot network pruning based on connection sensitivity. arXiv preprint arXiv:1810.02340, 2018. +[53] Sangkyun Lee and Stephen J Wright. Manifold identification in dual averaging for regularized stochastic online learning. The Journal of Machine Learning Research, 13(1):1705–1744, 2012. +[54] Bailin Li, Bowen Wu, Jiang Su, and Guangrun Wang. Eagleeye: Fast sub-net evaluation for efficient neural network pruning. In European Conference on Computer Vision, pages 639–654. Springer, 2020. +[55] Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016. +[56] Yawei Li, Shuhang Gu, Christoph Mayer, Luc Van Gool, and Radu Timofte. Group sparsity: The hinge between filter pruning and decomposition for network compression. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8018–8027, 2020. +[57] Yuchao Li, Shaohui Lin, Baochang Zhang, Jianzhuang Liu, David Doermann, Yongjian Wu, Feiyue Huang, and Rongrong Ji. Exploiting kernel sparsity and entropy for interpretable cnn compression. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2800–2809, 2019. +[58] Shaohui Lin, Rongrong Ji, Yuchao Li, Cheng Deng, and Xuelong Li. Toward compact convnets via structure-sparsity regularized filter pruning. IEEE transactions on neural networks and learning systems, 31(2):574–588, 2019. +[59] Christos Louizos, Karen Ullrich, and Max Welling. Bayesian compression for deep learning. In Advances in neural information processing systems, pages 3288–3298, 2017. +[60] Jian-Hao Luo, Jianxin Wu, and Weiyao Lin. Thinet: A filter level pruning method for deep neural network compression. In Proceedings of the IEEE international conference on computer vision, pages 5058–5066, 2017. +[61] Sangkug Lym, Esha Choukse, Siavash Zangeneh, Wei Wen, Sujay Sanghavi, and Mattan Erez. Prunetrain: fast neural network training by dynamic sparse model reconfiguration. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, pages 1–13, 2019. +[62] Fanxu Meng, Hao Cheng, Ke Li, Huixiang Luo, Xiaowei Guo, Guangming Lu, and Xing Sun. Pruning filter in filter. arXiv preprint arXiv:2009.14410, 2020. +[63] Michael Mitzenmacher. Probability and computing-randomized algorithms and probabilistic analysis. JOURNAL-OPERATIONAL RESEARCH SOCIETY, 56(12):1454, 2005. +[64] Eugene Ndiaye, Olivier Fercoq, Alexandre Gramfort, and Joseph Salmon. Gap safe screening rules for sparsity enforcing penalties. The Journal of Machine Learning Research, 18(1):4671– 4703, 2017. +[65] Kirill Neklyudov, Dmitry Molchanov, Arsenii Ashukha, and Dmitry P Vetrov. Structured bayesian pruning via log-normal multiplicative noise. In Advances in Neural Information Processing Systems, pages 6775–6784, 2017. +[66] Yurii Nesterov. Primal-dual subgradient methods for convex problems. Mathematical programming, 2009. +[67] Simon Niklaus, Long Mai, and Feng Liu. Video frame interpolation via adaptive separable convolution. In Proceedings of the IEEE International Conference on Computer Vision, pages 261–270, 2017. +[68] Jorge Nocedal and Stephen Wright. Numerical optimization. Springer Science & Business Media, 2006. +[69] Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016. +[70] Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 779–788, 2016. +[71] 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, pages 91–99, 2015. +[72] Alex Renda, Jonathan Frankle, and Michael Carbin. Comparing rewinding and fine-tuning in neural network pruning. arXiv preprint arXiv:2003.02389, 2020. +[73] Volker Roth and Bernd Fischer. The group-lasso for generalized linear models: uniqueness of solutions and efficient algorithms. In Proceedings of the 25th international conference on Machine learning, pages 848–855, 2008. an exponential convergence _rate for finite training sets. In Advances in neural information processing systems, pages 2663–2671, 2012. +[75] Victor Sanh, Thomas Wolf, and Alexander M Rush. Movement pruning: Adaptive sparsity by fine-tuning. arXiv preprint arXiv:2005.07683, 2020. +[76] Vikash Sehwag, Shiqi Wang, Prateek Mittal, and Suman Jana. Hydra: Pruning adversarially robust neural networks. Advances in Neural Information Processing Systems (NeurIPS), 7, 2020. +[77] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. +[78] Arvind Subramaniam and Avinash Sharma. N2nskip: Learning highly sparse networks using neuron-to-neuron skip connections. In BMVC, 2020. +[79] Yehui Tang, Yunhe Wang, Yixing Xu, Dacheng Tao, Chunjing Xu, Chao Xu, and Chang Xu. Scop: Scientific control for reliable neural network pruning. arXiv preprint arXiv:2010.10732, 2020. +[80] Frederick Tung and Greg Mori. Clip-q: Deep network compression learning by in-parallel pruning-quantization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018. +[81] Mart van Baalen, Christos Louizos, Markus Nagel, Rana Ali Amjad, Ying Wang, Tijmen Blankevoort, and Max Welling. Bayesian bits: Unifying quantization and pruning. arXiv preprint arXiv:2005.07093, 2020. +[82] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. +[83] Chaoqi Wang, Guodong Zhang, and Roger Grosse. Picking winning tickets before training by preserving gradient flow. arXiv preprint arXiv:2002.07376, 2020. +[84] Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Guilin Liu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Video-to-video synthesis. arXiv preprint arXiv:1808.06601, 2018. +[85] Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. arXiv preprint arXiv:1608.03665, 2016. +[86] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017. +[87] Lin Xiao. Dual averaging methods for regularized stochastic learning and online optimization. Journal of Machine Learning Research, 11(Oct):2543–2596, 2010. +[88] Lin Xiao and Tong Zhang. A proximal stochastic gradient method with progressive variance reduction. SIAM Journal on Optimization, 24(4):2057–2075, 2014. +[89] Bing Xu, Naiyan Wang, Tianqi Chen, and Mu Li. Empirical evaluation of rectified activations in convolutional network. arXiv preprint arXiv:1505.00853, 2015. +[90] Haichuan Yang, Shupeng Gui, Yuhao Zhu, and Ji Liu. Automatic neural network compression by sparsity-quantization joint learning: A constrained optimization-based approach. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2178–2188, 2020. +[91] Huanrui Yang, Wei Wen, and Hai Li. Deephoyer: Learning sparser neural network with differentiable scale-invariant sparsity measures. arXiv preprint arXiv:1908.09979, 2019. +[92] Haiqin Yang, Zenglin Xu, Irwin King, and Michael R Lyu. Online learning for group lasso. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pages 1191–1198, 2010. +[93] Minghan Yang, Andre Milzarek, Zaiwen Wen, and Tong Zhang. A stochastic extra-step quasinewton method for nonsmooth nonconvex optimization. arXiv preprint arXiv:1910.09373, 2019. +[94] Zhonghui You, Kun Yan, Jinmian Ye, Meng Ma, and Ping Wang. Gate decorator: Global filter pruning method for accelerating deep convolutional neural networks. arXiv preprint arXiv:1909.08174, 2019. +[95] Ming Yuan and Yi Lin. Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68(1):49–67, 2006. +[96] Cun-Hui Zhang et al. Nearly unbiased variable selection under minimax concave penalty. The Annals of statistics, 38(2):894–942, 2010. +[97] Junyu Zhang and Lin Xiao. Multi-level composite stochastic optimization via nested variance reduction. arXiv preprint arXiv:1908.11468, 2019. [98] Pengchuan Zhang, Hunter Lang, Qiang Liu, and Lin Xiao. Statistical adaptive stochastic gradient methods. arXiv preprint arXiv:2002.10597, 2020. [99] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 586–595, 2018. +[100] Tianyun Zhang, Shaokai Ye, Kaiqi Zhang, Jian Tang, Wujie Wen, Makan Fardad, and Yanzhi Wang. A systematic dnn weight pruning framework using alternating direction method of multipliers. In Proceedings of the European Conference on Computer Vision (ECCV), pages 184–199, 2018. +[101] Yuefu Zhou, Ya Zhang, Yanfeng Wang, and Qi Tian. Accelerate cnn via recursive bayesian pruning. In Proceedings of the IEEE International Conference on Computer Vision, pages 3306–3315, 2019. +[102] Tao Zhuang, Zhixuan Zhang, Yuheng Huang, Xiaoyi Zeng, Kai Shuang, and Xiang Li. Neuronlevel structured pruning using polarization regularizer. Advances in Neural Information Processing Systems, 33, 2020. \ No newline at end of file diff --git a/md/train/ppv5yqhpNyE/ppv5yqhpNyE.md b/md/train/ppv5yqhpNyE/ppv5yqhpNyE.md new file mode 100644 index 0000000000000000000000000000000000000000..b28bd82edb591455a4e465dccd13ce83de7989e2 --- /dev/null +++ b/md/train/ppv5yqhpNyE/ppv5yqhpNyE.md @@ -0,0 +1,289 @@ +# EditGAN: High-Precision Semantic Image Editing + +Huan Ling1,2,3,∗ Karsten Kreis1,∗ Daiqing Li 1 + +Seung Wook Kim1,2,3 Antonio Torralba4 Sanja Fidler1,2,3 + +1NVIDIA 2University of Toronto 3Vector Institute 4MIT + +{huling,kkreis,daiqingl,seungwookk,sfidler}@nvidia.com, torralba@mit.edu + +# Abstract + +Generative adversarial networks (GANs) have recently found applications in image editing. However, most GAN-based image editing methods often require large-scale datasets with semantic segmentation annotations for training, only provide high level control, or merely interpolate between different images. Here, we propose EditGAN, a novel method for high-quality, high-precision semantic image editing, allowing users to edit images by modifying their highly detailed part segmentation masks, e.g., drawing a new mask for the headlight of a car. EditGAN builds on a GAN framework that jointly models images and their semantic segmentations [1, 2], requiring only a handful of labeled examples – making it a scalable tool for editing. Specifically, we embed an image into the GAN’s latent space and perform conditional latent code optimization according to the segmentation edit, which effectively also modifies the image. To amortize optimization, we find “editing vectors” in latent space that realize the edits. The framework allows us to learn an arbitrary number of editing vectors, which can then be directly applied on other images at interactive rates. We experimentally show that EditGAN can manipulate images with an unprecedented level of detail and freedom, while preserving full image quality.We can also easily combine multiple edits and perform plausible edits beyond EditGAN’s training data. We demonstrate EditGAN on a wide variety of image types and quantitatively outperform several previous editing methods on standard editing benchmark tasks. Project page: https://nv-tlabs.github.io/editGAN. + +# 1 Introduction + +AI-driven photo and image editing has the potential to streamline the workflow of photographers and content creators and to enable new levels of creativity and digital artistry [3]. AI-based image editing tools have already found their way into consumer software in the form of neural photo editing filters, and the deep learning + +![](images/782f0d95cf6c1f39f92812cd3e25c760b0d31805d8af630f0f9c23dfff5334ad.jpg) +Figure 1: High-precision semantic image editing with EditGAN. + +research community is actively developing further techniques. A particularly promising line of research uses generative adversarial networks (GANs) [4, 5, 6, 7, 8] and either embeds images into the GAN’s latent space or works directly with GAN-generated images. Careful modifications of the latent embeddings then translate to desired changes in generated output, allowing, for example, to coherently change facial expressions in portraits [9, 10, 11, 12, 13, 14, 15, 16], change viewpoint or shapes and textures of cars [17], or to interpolate between different images in a semantically meaningful manner [18, 19, 20, 21]. + +![](images/c899d3cd93c67236587887acfd6de43587f4198a2a8293fb1b4b06e06d566106.jpg) +Figure 2: (1) EditGAN builds on a GAN framework that jointly models images and their semantic segmentations. (2 & 3) Users can modify segmentation masks, based on which we perform optimization in the GAN’s latent space to realize the edit. (4) Users can perform editing simply by applying previously learnt editing vectors and manipulate images at interactive rates. + +Most GAN-based image editing methods fall into few categories. Some works rely on GANs conditioning on class labels or pixel-wise semantic segmentation annotations [19, 10, 22, 11], where different conditionings lead to modifications in the output, while others use auxiliary attribute classifiers [23, 15] to guide synthesis and edit images. However, training such conditional GANs or external classifiers requires large labeled datasets. Therefore, these methods are currently limited to image types for which large annotated datasets are available, like portraits [10]. Furthermore, even if annotations are available, most techniques offer only limited editing control, since these annotations usually consist only of high-level global attributes or relatively coarse pixel-wise segmentations. Another line of work focuses on mixing and interpolating features from different images [18, 19, 20, 21], thereby requiring reference images as editing targets and usually also not offering fine control. Other approaches carefully analyze and dissect GANs’ latent spaces, finding disentangled latent variables suitable for editing [24, 25, 12, 13, 14, 26, 27], or control the GANs’ network parameters [25, 28, 16]. Usually, these methods do not enable detailed editing and are often slow. + +In this work, we are addressing these limitations and propose EditGAN, a novel GAN-based image editing framework that enables high-precision semantic image editing by allowing users to modify detailed object part segmentations. EditGAN builds on a recently proposed GAN that jointly models both images and their semantic segmentations based on the same underlying latent code [1, 2], and requires as few as 16 labeled examples – allowing it to scale to many object classes and choices of part labels. We achieve editing by modifying the segmentation mask according to a desired edit and optimizing the latent code to be consistent with the new segmentation, thus effectively changing the RGB image. To achieve efficiency, we learn editing vectors in latent space that realize the edits, and that can be directly applied on other images, without any or only few additional optimization steps. We can thus pre-train a library of interesting edits that a user can directly utilize in an interactive tool. + +We apply EditGAN on a wide range of images, including images of cars, cats, birds, and human faces, demonstrating unprecedented high-precision editing. We perform quantitative comparisons to multiple baselines and outperform them in metrics such as identity preservation, quality preservation, and target attribute accuracy, while requiring orders of magnitude less annotated training data. EditGAN is the first GAN-driven image editing framework, which simultaneously (i) offers very highprecision editing, (ii) requires only very little annotated training data (and does not rely on external classifiers), (iii) can be run interactively in real time, (iv) allows for straightforward compositionality of multiple edits, (v) and works on real embedded, GAN-generated, and even out-of-domain images. + +# 2 Related Work + +Image Editing and Manipulation. Image Editing has a long history in computer vision and graphics, as well as machine learning [29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 18, 11, 28, 41, 42, 16]. Recently, deep generative models [4, 43, 44], in particular modern GANs [6, 45, 7, 46, 8], received much attention as a promising tool for efficient image editing, as it was found that latent space manipulations often lead to interpretable and predictable changes in output [47, 24, 48, 49, 26, 27, 50]. + +GAN-based image editing methods can be broadly sorted into a number of categories. (i) One line of work relies on the careful dissection of the GAN’s latent space, aiming to find interpretable and disentangled latent variables, which can be leveraged for image editing, in a fully unsupervised manner [47, 24, 25, 12, 13, 14, 48, 49, 26, 27, 50, 51]. Although powerful, these approaches usually do not result in any high-precision editing capabilities. The editing vectors we are learning in EditGAN would be too hard to find independently without segmentation-based guidance. (ii) Other works utilize GANs that condition on class or pixel-wise semantic segmentation labels to control synthesis and achieve editing [9, 52, 46, 19, 10, 22, 11]. Hence, these works usually rely on large annotated datasets, which are often not available, and even if available, the possible editing operations are tied to whatever labels are available. This stands in stark contrast to EditGAN, which can be trained in a semi-supervised fashion with very little labeled data and where an arbitrary number of high-precision edits can be learnt. (iii) Furthermore, auxiliary attribute classifiers have been used for image manipulation [23, 15], thereby still relying on annotated data and usually only providing high-level control. (iv) Image editing is often explored in the context of “interpolating” between a target and different reference image in sophisticated ways, for example by replacing certain features in a given image with features from a reference images [18, 19, 20, 21]. From the general image editing perspective, the requirement of reference images limits the broad applicability of these techniques and prevents the user from performing specific, detailed edits for which potentially no reference images are available. (v) Recently, different works proposed to directly operate in the parameter space of the GAN instead of the latent space to realize different edits [25, 28, 16]. For example, [25, 28] essentially specialize the generator network for certain images at test time to aid image embedding or “rewrite” the network to achieve desired semantic changes in output. The drawback is that such specializations prevent the model from being used in real-time on different images and with different edits. [16] proposed an approach that more directly analyses the parameter space of a GAN and treats it as a latent space in which to apply edits. However, the method still merely discovers edits in the network’s parameter space, rather than actively defining them like we do. It remains unclear whether their method can combine multiple such edits, as we can, considering that they change the GAN parameters themselves. (vi) Finally, another line of research targets primarily very high-level image and photo stylization and global appearance modifications [37, 53, 54, 55, 52, 56, 46, 57, 41]. + +Generally, most works only do relatively high-level and not the detailed, high-precision editing, which EditGAN targets. Hence, we consider EditGAN as complementary to this body of work. + +GANs and Latent Space Image Embedding. EditGAN builds on top of DatasetGAN [1] and SemanticGAN [2], which proposed to jointly model images and their semantic segmentations using shared latent codes. However, these works leveraged this model design only for semi-supervised learning, not for editing. EditGAN also relies on an encoder, together with optimization, to embed new images to be edited into the GAN’s latent space. This task in itself has been studied extensively in different contexts before, and we are building on these works. Previous papers studied encoder-based methods [58, 59, 60, 61, 62], used primarily optimization-based techniques [63, 64, 65, 66, 67, 68, 69, 26], and developed hybrid approaches [63, 24, 25, 70, 71]. + +Finally, a concurrent paper [72] shares similarities with DatasetGAN [1], on which our method builds, and explores an editing approach related to our EditGAN as one of its applications. However, our editing approach is methodologically different and leverages editing vectors, and also demonstrates significantly more diverse and stronger experimental results. Furthermore, [73] shares some highlevel ideas with EditGAN; however, it leverages the CLIP [74] model and targets text-driven editing. + +# 3 High-Precision Semantic Image Editing with EditGAN + +# 3.1 Background + +EditGAN’s image generation component is StyleGAN2 [7, 8], currently the state-of-the-art GAN for image synthesis. The StyleGAN2 generator maps latent codes $\mathbf { z } \in { \mathcal { Z } }$ , drawn from a multivariate Normal distribution, into realistic images. A latent code $\mathbf { z }$ is first transformed into an intermediate code $\mathbf { w } \in \mathcal { W }$ by a non-linear mapping function and then further transformed into $K + 1$ vectors, $\mathbf { w } ^ { 0 } , . . . , \mathbf { w } ^ { K }$ , through learned affine transformations. These transformed latent codes are fed into synthesis blocks, whose outputs are deep feature maps. + +Deep generative models such as StyleGAN2, which are trained to synthesize highly realistic images, acquire a semantic understanding of the modeled images in their high-dimensional feature space. Recently, DatasetGAN [1] and SemanticGAN [2] built on this insight to learn a joint distribution $p ( \mathbf { x } , \mathbf { y } )$ over images $\mathbf { x }$ and pixel-wise semantic segmentation labels y, while requiring only a handful of labeled examples. EditGAN utilizes this joint distribution $p ( \mathbf { x } , \mathbf { y } )$ to perform high-precision semantic image editing of real and synthesized images. + +Both methods [1, 2] model $p ( \mathbf { x } , \mathbf { y } )$ by adding an additional segmentation branch to the image generator, which is a pre-trained StyleGAN [1]. We follow DatasetGAN [1], which applies a simple three-layer multi-layer perceptron classifier on the layer-wise concatenated and appropriately upsampled feature maps. This classifier operates on the concatenated feature maps in a per-pixel fashion and predicts the segmentation label of each pixel. + +# 3.2 Segmentation Training and Inference by Embedding Images into GAN’s Latent Space + +To both train the segmentation branch and perform segmentation on a new image, we embed an image into the GAN’s latent space using an encoder and optimization. To this end, we build on previous works [66, 62, 2] and train an encoder that embeds images into $\mathcal { W } ^ { + }$ space, which is defined as $\mathcal { W }$ but where the w’s are modeled independently [66, 62]. Our objectives to train this encoder consist of standard pixel-wise L2 and perceptual LPIPS reconstruction losses using both the real training data as well as samples from the GAN itself. For the GAN samples, we also explicitly regularize the encoder with the known underlying latent codes. In practice, we use the encoder to initialize images’ latent space embeddings and then iteratively refine the latent code $\mathbf { w } ^ { + }$ via optimization, again using standard reconstruction objectives. + +In that way, we embed the annotated images $\mathbf { x }$ from a dataset labeled with semantic segmentations into latent space, and train the segmentation branch of the generator using standard supervised learning objectives, i.e., the cross entropy loss. We keep the image generator’s weights frozen and only backpropagate the loss to the segmentation branch [1]. After training the segmentation branch, we can formally define a generator $\bar { \tilde { G } } : \mathcal { W } ^ { + } \mathcal { X } , \mathcal { Y }$ that models the joint distribution $p ( \mathbf { x } , \mathbf { y } )$ of images $\mathbf { x }$ and semantic segmentations y. Details about encoder and segmentation branch training as well as optimization for image embedding can be found in the Appendix. + +# 3.3 Finding Semantics in Latent Space via Segmentation Editing + +The key idea of EditGAN lies in leveraging the joint distribution $p ( \mathbf { x } , \mathbf { y } )$ of images and semantic segmentations for high-precision image editing. Given a new image $\mathbf { x }$ to be edited, we can embed it into EditGAN’s $\mathcal { W } ^ { + }$ latent space, as described above (alternatively, we can also sample images from the model itself and use those). The segmentation branch will then generate the corresponding segmentation $\mathbf { y }$ , since segmentations and RGB im + +![](images/fb823d3601a32de596c1cacd81969ca423dc943ff186a4849f28d8fb75c7fe52.jpg) +Figure 3: We modify semantic segmentations and optimize the shared latent code for consistency with the new segmentation within the editing region, and with the RGB appearance outside the editing region. Corresponding gradients are backpropagated through the shared generator. The result is a latent space editing vector $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ . + +ages share the same latent codes $\mathbf { w } ^ { + }$ . Using simple interactive digital painting or labeling tools, we can now manually modify the segmentation according to a desired edit. We denote the edited segmentation mask by $\mathbf { y } _ { \mathrm { e d i t e d } }$ . Starting from the embedding $\mathbf { w } ^ { + }$ of the unedited image x and segmentation $\mathbf { y }$ , we can then perform optimization within $\mathcal { W } ^ { + }$ to find a new $\mathbf { w } _ { \mathrm { e d i t e d } } ^ { + } = \mathbf { w } ^ { + } + \delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ consistent with the new segmentation $\mathbf { y } _ { \mathrm { e d i t e d } }$ , while allowing the RGB output $\mathbf { x }$ to change within the editing region. + +Formally, we are seeking an editing vector $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + } \in \mathcal { W } ^ { + }$ such that $( \mathbf { x } _ { \mathrm { e d i t e d } } , \mathbf { y } _ { \mathrm { e d i t e d } } ) = \tilde { G } ( \mathbf { w } ^ { + } + \delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + } )$ where $\tilde { G }$ denotes the fixed generator that synthesizes both images and segmentations. Defining $( \mathbf { x } ^ { \prime } , \mathbf { y } ^ { \prime } ) = \tilde { G } ( \mathbf { w } ^ { + } + \delta \mathbf { w } ^ { + } )$ , we perform optimization to approximate $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ by $\delta \mathbf { w } ^ { + }$ . The region of interest $r$ within which we expect the image to change due to the edit is formally given by + +$$ +r = \left\{ p : c _ { p } ^ { \mathbf { y } } \in Q _ { \mathrm { e d i t } } \right\} \cup \left\{ p : c _ { p } ^ { \mathbf { y } _ { \mathrm { e d i t e d } } } \in Q _ { \mathrm { e d i t } } \right\} +$$ + +which means that $r$ is defined by all pixels $p$ whose part segmentation labels $c _ { p } ^ { \{ \mathbf { y } , \mathbf { y } _ { \mathrm { e d i t e d } } \} }$ according to either the initial segmentation $\mathbf { y }$ or the edited one $\mathbf { y } _ { \mathrm { e d i t e d } }$ are within an edit-specific pre-specified list + +$Q _ { \mathrm { e d i t } }$ of part labels relevant for the edit. For example, when modifying the wheel in a photo of a car $Q _ { \mathrm { e d i t } }$ would contain all part labels related to the wheels, such as tire, spoke, and wheelhub (see Fig. 3). We use a further buffer of 5 pixels to give the GAN freedom in modeling the transition between the edited and non-edited area. In practice, $r$ acts as a binary pixel-wise mask (see Eqs. 2 and 3 below). + +Note that $\mathbf { x } _ { \mathrm { e d i t e d } }$ is not available during optimization. After all, $\mathbf { x } _ { \mathrm { e d i t e d } }$ is the edited image we are ultimately intested in. It emerges indirectly when optimizing for the segmentation modification, since images and segmentations are closely tied together in the joint distribution $p ( \mathbf { x } , \mathbf { y } )$ modeled by $\tilde { G }$ We further define $\mathbf { x } ^ { \prime } = \tilde { G } ^ { \mathbf { x } } ( \mathbf { w } ^ { + } + \delta \mathbf { w } ^ { + } )$ as $\tilde { G }$ ’s image generation and $\mathbf { y } ^ { \prime } = \tilde { G } ^ { \mathbf { y } } ( \mathbf { w } ^ { + } + \delta \mathbf { w } ^ { + } )$ as $\tilde { G }$ ’s segmentation generation branch. + +To find $\delta \mathbf { w } ^ { + }$ , approximating $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ , we use the following losses as minimization targets: + +$$ +\begin{array} { r l } & { \mathcal { L } _ { \mathrm { R G B } } ( \delta \mathbf { w } ^ { + } ) = L _ { \mathrm { L P I P S } } ( \tilde { G } ^ { \mathbf { x } } ( \mathbf { w } ^ { + } + \delta \mathbf { w } ^ { + } ) \odot ( 1 - r ) , \ \mathbf { x } \odot ( 1 - r ) ) } \\ & { \qquad + L _ { L 2 } ( \tilde { G } ^ { \mathbf { x } } ( \mathbf { w } ^ { + } + \delta \mathbf { w } ^ { + } ) \odot ( 1 - r ) , \ \mathbf { x } \odot ( 1 - r ) ) } \end{array} +$$ + +$$ +\begin{array} { r } { \mathcal { L } _ { \mathrm { C E } } \big ( \delta \mathbf { w } ^ { + } \big ) = H \big ( \tilde { G } ^ { \mathbf { y } } \big ( \mathbf { w } ^ { + } + \delta \mathbf { w } ^ { + } \big ) \odot r , \ \mathbf { y } _ { \mathrm { e d i t e d } } \odot r \big ) } \end{array} +$$ + +where $H$ denotes the pixel-wise cross-entropy, $L _ { \mathrm { L P I P S } }$ loss is based on the Learned Perceptual Image Patch Similarity (LPIPS) distance [75], and $L _ { L 2 }$ is a regular pixel-wise L2 loss. $\mathcal { L } _ { \mathrm { R G B } } ( \delta \mathbf { \bar { w } } ^ { + } )$ ensures that the image appearance does not change outside the region of interest, while $\mathcal { L } _ { \mathrm { C E } } ( \delta \mathbf { w } ^ { + } )$ ensures that the target segmentation $\mathbf { y } _ { \mathrm { e d i t e d } }$ is enforced within the editing region (see visualization in Fig. 3). When editing human faces, we also apply the identity loss [62]: + +$$ +\begin{array} { r } { \mathcal { L } _ { \mathrm { I D } } ( \delta \mathbf { w } ^ { + } ) = \langle R ( \tilde { G } ^ { \mathbf { x } } ( \mathbf { w } ^ { + } + \delta \mathbf { w } ^ { + } ) ) , R ( \mathbf { x } ) \rangle } \end{array} +$$ + +with $R$ denoting the pretrained ArcFace feature extraction network [76] and $\langle \cdot , \cdot \rangle$ cosine-similiarity. The final objective function for optimization then becomes: + +$$ +\begin{array} { r } { \mathcal { L } _ { \mathrm { e d i t i n g } } ( \delta \mathbf { w } ^ { + } ) = \lambda _ { 1 } ^ { \mathrm { e d i t i n g } } \mathcal { L } _ { \mathrm { R G B } } ( \delta \mathbf { w } ^ { + } ) + \lambda _ { 2 } ^ { \mathrm { e d t i n g } } \mathcal { L } _ { \mathrm { C E } } ( \delta \mathbf { w } ^ { + } ) + \lambda _ { 3 } ^ { \mathrm { e d t i n g } } \mathcal { L } _ { \mathrm { I D } } ( \delta \mathbf { w } ^ { + } ) } \end{array} +$$ + +with hyperparameters $\lambda _ { 1 , \dots , 3 } ^ { \mathrm { e d i t i n g } }$ . The only “learnable” variable is the editing vector $\delta \mathbf { w } ^ { + }$ ; all neural networks are kept fixed. After optimizing $\delta \mathbf { w } ^ { + }$ with the objective function, we can use $\delta \mathbf { w } ^ { + } \approx \delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ Note that there is a certain amount of ambiguity in how the segmentation modification is realized in RGB output. We rely on the GAN generator, trained to synthesize realistic images, to modify the RGB values in the editing region in a plausible way consistent with the segmentation edit. + +# 3.4 Different Ways of Editing during Inference + +The latent space editing vectors $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ obtained by optimization as described are semantically meaningful and often disentangled with other attributes. Therefore, for new images $\mathbf { x }$ to be edited, we can embed the images into the $\mathcal { W } ^ { + }$ latent space and the same editing operations can be directly performed by applying the previously learnt $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ as $( \mathbf { x } ^ { \prime } , \mathbf { y } ^ { \prime } ) = G ( \mathbf { w } ^ { + } + s _ { \mathrm { e d i t } } \delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + } )$ without doing any optimization from scratch again. In other words, the learnt editing vectors $\bar { \delta } \bar { \mathbf { w } } ^ { + }$ amortize the iterative optimization that was necessary to achieve the edit initially. For well-disentangled editing operations, $\mathbf { x } ^ { \prime }$ can be used directly as the edited image $\mathbf { x } _ { \mathrm { e d i t e d } }$ . Note that we introduced $s _ { \mathrm { e d i t } }$ , a scalar editing coefficient, which effectively scales and controls the editing magnitude during inference. For $s _ { \mathrm { e d i t } } = 0$ , we do not do any editing at all, while for $s _ { \mathrm { e d i t } } > 1$ we manipulate the images with an effectively larger editing operation in latent space, leading to exaggerated effects. + +Unfortunately, disentanglement is not always perfect and the editing vectors $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ do not always translate perfectly to other images. We can remove editing artifacts in other regions of the image by a few additional optimization steps at test time. Specifically, we can use the exact same minimization obas s as above, using the initial prediction . This assumes that the editing vector $\mathbf { y } ^ { \prime }$ , obtained after applying the editing vector ll induces a plausible segmentation chang $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ $\mathbf { y } _ { \mathrm { e d i t e d } }$ +applied on other images and that artifacts only arise in RGB output. The RGB objective $\mathcal { L } _ { \mathrm { { R G B } } }$ then removes these editing artifacts outside the editing region, while $\mathcal { L } _ { \mathrm { C E } }$ ensures that the modified segmentation stays as predicted by the editing vector. + +Summarizing, we can perform image editing with EditGAN in three different modes: + +• Real-time Editing with Editing Vectors. For localized, well-disentangled edits we perform editing purely by applying previously learnt editing vectors with varying scales $s _ { \mathrm { e d i t } }$ and manipulate images at interactive rates. + +![](images/742a614d56b78b2c1585a7e070b2c2ba2262df73e8b0ab63e51925ccf624d04e.jpg) +Figure 4: Examples of segmentation-driven edits with EditGAN. Results are based on editing with editing vectors and 30 steps self-supervised refinement. Blue boxes: Original images. Orange boxes: Zoom-in views. + +• Vector-based Editing with Self-Supervised Refinement. For localized edits that are not perfectly disentangled with other parts of the image, we can remove editing artifacts by additional optimization at test time, while initializing the edit using the learnt editing vectors. • Optimization-based Editing. Image-specific and very large edits do not transfer to other images via editing vectors. For such operations, we perform optimization from scratch. + +# 4 Experiments + +We extensively evaluate EditGAN on images across four different categories: Cars ( $3 8 4 \times 5 1 2$ spatial resolution), Birds $( 5 1 2 \times 5 1 2 )$ , Cats $( 2 5 6 \times 2 5 6 )$ , and Faces $( 1 0 2 4 \times 1 0 2 4 )$ . + +Implementation We train our segmentation branch as described in Sec. 3.2 using 16, 16, 30, and 30 image-mask pairs as labeled training data for Faces, Cars, Birds, and Cats, respectively. We utilize very highly-detailed part segmentations from [1]. The annotation scheme for faces is shown in Fig. 7, all others are presented in the Appendix. When editing is done purely optimization-based or when learning the editing vectors, we always perform 100 steps of optimization using Adam [77]. For Car, Cat, and Faces, we use real images from DatasetGAN’s test set that were not part of GAN training to demonstrate editing functionality. These images are first embedded into EditGAN’s latent space via an encoder and optimization as described in Sec. 3.2. For Birds, we show editing on GAN-generated images. Model details and hyperparameters are provided in the Appendix. + +# 4.1 Qualitative Results + +In-Domain Results In Fig. 4, we demonstrate our EditGAN framework when applying previously learnt editing vectors $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ on novel images and refining with 30 steps of optimization. Our editing operations preserve high image quality and are well disentangled for all classes. We also show the ability to combine multiple different edits in Fig. 5. To the best of our knowledge, no previous methods can perform as complex and high-precision edits as we do, while preserving image quality and subject identity. In Fig. 8, we demonstrate that we can even perform extremely high-precision edits, such as rotating a car’s wheel spoke or dilating pupils. EditGAN can edit semantic parts of objects that consist of only few pixels. At the same time, we can use EditGAN to perform large-scale modifications, too: In Fig. 9, we present how we can remove the entire roof of a car or convert it to a station wagon-like vehicle, simply by modifying the segmentation mask accordingly and optimizing. It is worth noting that several of our editing operations generate plausible manipulated images unlike those appearing in the GAN training data. For example, the training data does not include cats with overly large eyes or ears. Nevertheless, we achieve such edits in a high-quality manner. + +![](images/af4bf814241ab3da1430ddc5310405757b5f5cc1f2f6882f1581f9a97675afad.jpg) +Figure 5: We combine multiple edits. Results are based on editing with editing vectors and 30 steps selfsupervised refinement. Blue boxes: Original images. Edits in detail: Second row, first person: open eyes, add hair, add mustache. Second person: smile, look left. Third row, first car: remove mirror, remove door handle, shrink wheels. Second car: remove license plate, enlarge wheels. Third row, bird: longer beak, bigger belly, head up. Third row, cat: open mouth, bigger ear, bigger eyes. + +The edits in Figs. 4, 5 and 8 are based on learnt editing vectors with self-supervised refinement. However, without such refinement usually only very minor artifacts occur, as shown in Fig. 10, hence allowing for real-time high-precision semantic image editing (discussed in detail below). + +Out-of-Domain Results We demonstrate the generalization capability of EditGAN to out-ofdomain data on the MetFaces [8] data set. We use our EditGAN model trained on FFHQ [8], and create editing vectors $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ using in-domain real faces. We then embed out-of-domain MetFaces partraits (with 100 steps optimization) and apply the editing vectors with 30 steps self-supervised refinement. The results are shown in Fig. 6. We find that our editing operations seamlessly translate even to such far out-of-domain examples. + +# 4.2 Quantitative Results + +To quantitatively measure EditGAN’s image editing capabilities, we use the smile edit benchmark introduced by MaskGAN [10]. Faces with neutral expressions are converted into smiling faces and performance is measured by three metrics: a. Semantic Correctness: Using a pre-trained smile attribute classifier, we measure whether the faces show smiling expressions after editing. b. Distribution-level Image Quality: Frechet Inception Distance (FID) [78, 79] and Kernel Inception Distance (KID) [80] are calculated between 400 edited test images and the CelebA-HD test dataset. c. + +![](images/a61605ec5f7b2608b329439b051ff89b4dd3b4fd77ff0d41e5416083b44f10ec.jpg) +Figure 6: We combine multiple edits on out-of-domain images. Results are based on editing with editing vectors and 30 steps self-supervised refinement. Edits in detail: First row, first example: look left, frown. Second example: smile, look right. Second row, first example: open eyes, lift eyebrow. Second example: open eyes. + +Identity Preservation: Using the pretrained ArcFace feature extraction network [76], we measure whether the subjects’ identity is maintained when applying the edit. Specifically, we report cosinesimiliarity between original and edited images. Further details can be found in the Appendix. + +For our EditGAN, we simply learn a smiling editing vector $\delta \mathbf { w } _ { \mathrm { e d i t } } ^ { + }$ using a hold-out neutral expression face image. We embed it into EditGAN, infer its pixel-wise segmentation labels, and manually modify the segmentation towards a smile. Then we perform optimization in latent space, as described above, to learn the editing vector. For the results in Tab. 1, it is applied with unit scale $s _ { \mathrm { e d i t } } { = } 1$ on new images. We do + +
MetricAnnot.#Mask #Attribute Annot.Attribute Acc.(%)↑FID↓KID↓ID Score ↑
MaskGAN [10]30.00077.346.84 0.0200.4611
LocalEditing [18]-26.041.260.0120.5823
LocalEditing - Encoding4Editing [81]--41.7548.280.0160.6603
InterFaceGAN [13]-30.00083.539.420.0100.7295
EditGAN (ours)16-91.541.740.0130.7047
EditGAN+30 (ours)16-85.840.830.0120.7452
StyleGAN2 Distillation [82]-30.00098.345.09 0.0130.7823
+ +Table 1: Quantitative comparisons to multiple baselines on the smile edit benchmark. + +not use the identity loss (Eq. 4) in this experiment, since identity preservation is already a target metric itself. We compare our method with three strong baselines: (i) $M a s k G A N ^ { 2 }$ [10]: It takes non-smiling images, their segmentation masks, and a target smiling segmentation mask as inputs. Note that training MaskGAN requires large annotated datasets, in contrast to us. We also compare to (ii) LocalEditing3 [18]: It clusters GAN features to achieve local editing and relies on reference images, in this case images of faces with smiling expressions. Another baseline we use is (iii) InterFace $G A N ^ { 4 }$ [13]: Similar to EditGAN, InterFaceGAN aims at finding editing vectors in latent space. However, it uses auxiliary attribute classifiers, relies on large annotated datasets, and can generally not achieve the fine editing control of our EditGAN. Finally, we compare to (iv) StyleGAN2 Distillation5 [82], which creates an alternative approach that does not require real image embeddings and also relies on an editing-vector model to create a training dataset. + +Results are reported in Tab. 1. Using 1, $8 7 5 \times$ less training labels, we outperform MaskGAN on all three metrics. We similarly obtain significantly stronger results than LocalEditing. In our observation, LocalEditing does not work well on real image embeddings. We further exploit a better encoder [81] for the LocalEditing baseline, which leads to a significant improvement in attribute accuracy and ID score, but slightly worse FID & KID scores. We find that EditGAN outperforms InterFaceGAN on identity preservation and attribute classification accuracy, while InterFaceGAN reaches slightly better FID & KID scores (for the results in Tab. 1, the latent space edits learnt by InterfaceGAN are also applied with unit scale, like for EditGAN). In Fig. 11, we report a more detailed comparison to InterFaceGAN, where we apply the smile editing vectors with different scale coefficients from zero to two. As shown, when the editing vector scale is small, the identity score is high while the smiling attribute score is low, since the modification of the original images is minimal. We find that our realtime editing with editing vectors is on-par with InterFaceGAN. When we perform self-supervised refinement at test time, EditGAN outperforms InterFaceGAN. In Tab. 1, we also compare with StyleGAN2 Distillation [82], which achieves strong performance. However, StyleGAN2 Distillation relies on pre-trained classifiers, like InterfaceGAN, and only enables relatively high-level editing of image attributes for which large-scale annotations exit. Moreover, it distills edits into separate Pixel2PixelHD networks, such that a new network needs to be trained for each edit, limiting broad, user-interactive applicability. Hence, we consider StyleGAN2 Distillation orthogonal to our EditGAN. + +![](images/82aed2cce7459a336ae87233a9042f1ee642601d6b485bb205aecab5ad27d17e.jpg) +Figure 7: Face part labeling schema [1]. + +![](images/ec5e57176ee9dd96a0c35e7e44b1e68c3c05f10a2598c6a27b653ace1bbfbc45.jpg) +Figure 8: High-precision editing with EditGAN for extreme details. Left: We rotate Rotate Wheel Spoke Change pupil Sizethe spoke. Right: We modify pupil size. Results are based on editing with editing vectors and 30 steps self-supervised refinement. + +![](images/40b140c5ee1e246522137b6ac9a2945eff98f726b22711f6d4416174a8e77e7b.jpg) +Figure 9: Pure optimization-based editing. We demonstrate large-scale semantic edits that do not transfer seamlessly to other images via editing vectors. Hence, we perform optimization from scratch. + +![](images/a1abbd5adb6d1505d2819a994d24a10e48d6a51e57149c772524e86d426ec6f8.jpg) +Figure 10: Left: We apply learnt editing vectors with varying scales (see 5 markers in FID plots) both without (top row for each class) and with (bottom row for each class) additional 30-step self-supervised refinement to correct artifacts. Red boxes denote original images. For each class, the leftmost image is the one used to learn the editing vector, with the editing result next to it and orginal and modified segmentations below. Right: Visual quality after editing with different scales as measured by FID with and without refinement. + +Running Time We carefully measure the run time of our editing on an NVIDIA Tesla V100 GPU. Conditional optimization, given an edited segmentation mask, with 30 (60) optimization steps takes 11.4 (18.9) seconds. This operation provides us the editing vector. Application of editing vectors is almost instantaneous, taking only 0.4 seconds, therefore allowing for complex real-time interactive editing. A 10 (30) step self-supervised refinement would add an additional 4.2 (9.5) seconds. + +# 4.3 Ablation Studies: Self-Supervised Refinement and Editing Vector Scale + +Fig. 11 also contains a quantitative ablation study on the number of additional optimization steps done when initializing an edit with a learnt editing vector and refining with additional optimization. Generally, the more refinement steps we perform, the better the performance our model can achieve. As shown in Fig. 11, we find that further optimization can indeed slightly improve performance. Specifically, here we improve the trade-off between maintaining identity and achieving the desired semantic operation when performing editing with different scalings $s _ { \mathrm { e d i t } }$ of the editing vector. However, performing many steps of optimization leads to a run-time vs. performance trade-off, and our results suggest that the improvement beyond 30 additional optimization steps becomes marginal. + +In Fig. 10, we analyze the editing vector scale and self-supervised refinement visually and with respect to perceptual metrics. As highlighted in the zoom-in areas, small artifacts can appear due to imperfect disentanglement in latent space when applying editing operations with large scales. Self-supervised refinement successfully cleans these editing errors up. We also apply the same edit with different scales on 400 test images and measure FID with respect to 10,000 data from GAN training, inspired by the analyses in [16]. We can clearly see that image quality degrades as measured by FID, the stronger the edit is applied. We also observe small improvements with the iterative refinement on this metric, although the difference is small. Further details are in the Appendix. We conclude that for most editing operations, real-time editing without iterative refinement already performs very well. However, to clean up artifacts and maintain highest image quality possible, self-supervised refinement with a couple of additional optimization steps is always available. + +Additional experiments are presented in the Appendix. + +# 5 Conclusions + +Limitations Like all GAN-based image editing methods, EditGAN is limited to images that can be modeled by the GAN. This makes EditGAN’s application on, for instance, photos of vivid city scenes challenging. Although most of our high-precision edits readily transfer to other images via learnt editing vectors, we also encountered challenging edits that required iterative optimization on each example. Future research therefore includes speeding up the optimization for such edits as well as building better generative models with more disentangled latent spaces. + +![](images/690211948c1cfdaeb4947e26111732183937f423e3528f4344ff12d15a1cbf6a.jpg) +Figure 11: InterFaceGAN’s and EditGAN’s performance on the smile edit benchmark for different editing vector scalings (scale increases from top-left points towards bottomright points; see main text and Appendix for details). For EditGAN, we optionally add 10, 30 or 60 additional optimization steps. + +Summary We propose EditGAN, a novel method for high-precision, high-quality semantic image editing. It relies on a GAN that jointly models RGB images and their pixel-wise semantic segmentations and that requires only very few annotated data for training. Editing is achieved by performing optimization in latent space while conditioning on edited segmentation masks. This optimization can be amortized into editing vectors in latent space, which can be applied on other images directly, allowing for real-time interactive editing without any or only little further optimization. We demonstrate a broad variety of editing operations on different kinds of images, achieving an unprecedented level of flexibility and freedom in terms of editing, while preserving high image quality. + +# 6 Broader Impact + +Where previous generative modeling-based image editing methods offer only limited high-level editing capabilities, our method provides users unprecedented high-precision semantic editing possibilities. Our proposed techniques can be used for artistic purposes and creative expression and benefit designers, photographers, and content creators [3]. AI-driven image editing tools like ours promise to democratize high-quality image editing. Related methods have already found their way into everyday applications in the form of neural photo editing filters. On a larger scale, the ability to synthesize data with specific attributes can be leveraged in training and finetuning machine learning models. + +At the same time, more precise photo editing also offers opportunities for advanced photo manipulation for nefarious purposes. The recent progress of generative models and AI-driven photo editing has profound implications on image authenticity and beyond, which is an area of active debate [83]. As one potential way to tackle these challenges, methods for automatically validating real images and detecting manipulated or fake images are being developed by the research community [84, 85]. Furthermore, generative models like ours are usually only as good as the data they were trained on. Therefore, biases in the underlying datasets are still present in the synthesized images and preserved even when applying our proposed editing methods. It is therefore important to be aware of such biases in the underlying data and counteract them, for example by actively collecting more representative data or by using bias correction methods, an area of active research [86, 87, 88, 89]. + +# Funding Statement + +This work was funded by NVIDIA. Huan Ling and Seung Wook Kim acknowledge additional revenue in the form of student scholarships from University of Toronto and the Vector Institute, which are not in direct support of this work. + +# References + +[1] Yuxuan Zhang, Huan Ling, Jun Gao, Kangxue Yin, Jean-Francois Lafleche, Adela Barriuso, Antonio Torralba, and Sanja Fidler. Datasetgan: Efficient labeled data factory with minimal human effort. arXiv preprint arXiv:2104.06490, 2021. +[2] Daiqing Li, Junlin Yang, Karsten Kreis, Antonio Torralba, and Sanja Fidler. Semantic segmentation with generative models: Semi-supervised learning and strong out-of-domain generalization. arXiv preprint arXiv:2104.05833, 2021. +[3] J. Bailey. The tools of generative art, from flash to neural networks. Art in America, 2020. +[4] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014. +[5] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015. +[6] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017. +[7] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4401–4410, 2019. +[8] Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8110–8119, 2020. +[9] Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. Stargan: Unified generative adversarial networks for multi-domain image-to-image translation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018. +[10] Cheng-Han Lee, Ziwei Liu, Lingyun Wu, and Ping Luo. Maskgan: Towards diverse and interactive facial image manipulation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020. +[11] Rongliang Wu, Gongjie Zhang, Shijian Lu, and Tao Chen. Cascade ef-gan: Progressive facial expression editing with local focuses. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020. +[12] Yujun Shen, Jinjin Gu, Xiaoou Tang, and Bolei Zhou. Interpreting the latent space of gans for semantic face editing. In CVPR, 2020. +[13] Yujun Shen, Ceyuan Yang, Xiaoou Tang, and Bolei Zhou. Interfacegan: Interpreting the disentangled face representation learned by gans. TPAMI, 2020. +[14] Yazeed Alharbi and Peter Wonka. Disentangled image generation through structured noise injection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020. +[15] Xianxu Hou, Xiaokang Zhang, Linlin Shen, Zhihui Lai, and Jun Wan. Guidedstyle: Attribute knowledge guided style manipulation for semantic face editing. arXiv preprint arXiv:2012.11856, 2020. +[16] Anton Cherepkov, Andrey Voynov, and Artem Babenko. Navigating the gan parameter space for semantic image editing. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021. +[17] Yuxuan Zhang, Wenzheng Chen, Huan Ling, Jun Gao, Yinan Zhang, Antonio Torralba, and Sanja Fidler. Image gans meet differentiable rendering for inverse graphics and interpretable 3d neural rendering. arXiv preprint arXiv:2010.09125, 2020. +[18] Edo Collins, Raja Bala, Bob Price, and Sabine Süsstrunk. Editing in style: Uncovering the local semantics of GANs. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020. +[19] Peihao Zhu, Rameen Abdal, Yipeng Qin, and Peter Wonka. Sean: Image synthesis with semantic regionadaptive normalization. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020. +[20] Kathleen M Lewis, Srivatsan Varadharajan, and Ira Kemelmacher-Shlizerman. Vogue: Try-on by stylegan interpolation optimization. arXiv preprint arXiv:2101.02285, 2021. +[21] Hyunsu Kim, Yunjey Choi, Junho Kim, Sungjoo Yoo, and Youngjung Uh. Exploiting spatial dimensions of latent in gan for real-time image editing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021. +[22] Shu-Yu Chen, Wanchao Su, Lin Gao, Shihong Xia, and Hongbo Fu. Deepfacedrawing: Deep generation of face images from sketches. ACM Trans. Graph., 39(4), 2020. +[23] Z. He, W. Zuo, M. Kan, S. Shan, and X. Chen. Attgan: Facial attribute editing by only changing what you want. IEEE Transactions on Image Processing, 28(11):5464–5478, Nov 2019. +[24] David Bau, Jun-Yan Zhu, Hendrik Strobelt, Bolei Zhou, Joshua B. Tenenbaum, William T. Freeman, and Antonio Torralba. Gan dissection: Visualizing and understanding generative adversarial networks. In Proceedings of the International Conference on Learning Representations (ICLR), 2019. +[25] David Bau, Hendrik Strobelt, William Peebles, Jonas Wulff, Bolei Zhou, Jun-Yan Zhu, and Antonio Torralba. Semantic photo manipulation with a generative image prior. ACM Trans. Graph., 38(4), 2019. +[26] Antoine Plumerault, Hervé Le Borgne, and Céline Hudelot. Controlling generative models with continuous factors of variations. In International Conference on Learning Representations, 2020. +[27] Erik Härkönen, Aaron Hertzmann, Jaakko Lehtinen, and Sylvain Paris. Ganspace: Discovering interpretable gan controls. In Proc. NeurIPS, 2020. +[28] David Bau, Steven Liu, Tongzhou Wang, Jun-Yan Zhu, and Antonio Torralba. Rewriting a deep generative model. In Proceedings of the European Conference on Computer Vision (ECCV), 2020. +[29] George Wolberg. Digital Image Warping. IEEE Computer Society Press, Washington, DC, USA, 1st edition, 1994. +[30] Alexei A. Efros and William T. Freeman. Image quilting for texture synthesis and transfer. SIGGRAPH ’01, page 341–346, New York, NY, USA, 2001. Association for Computing Machinery. +[31] Aaron Hertzmann, Charles E. Jacobs, Nuria Oliver, Brian Curless, and David H. Salesin. Image analogies. In Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH ’01, page 327–340, New York, NY, USA, 2001. Association for Computing Machinery. +[32] E. Reinhard, M. Adhikhmin, B. Gooch, and P. Shirley. Color transfer between images. IEEE Computer Graphics and Applications, 21(5):34–41, 2001. +[33] Patrick Pérez, Michel Gangnet, and Andrew Blake. Poisson image editing. SIGGRAPH ’03, page 313–318, New York, NY, USA, 2003. Association for Computing Machinery. +[34] Scott Schaefer, Travis McPhail, and Joe Warren. Image deformation using moving least squares. ACM Trans. Graph., 25(3):533–540, 2006. +[35] Connelly Barnes, Eli Shechtman, Adam Finkelstein, and Dan B Goldman. Patchmatch: A randomized correspondence algorithm for structural image editing. ACM Trans. Graph., 28(3), 2009. +[36] Michael W. Tao, Micah K. Johnson, and Sylvain Paris. Error-tolerant image compositing. In ECCV, 2010. +[37] Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. +[38] Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pages 2223–2232, 2017. +[39] Tiziano Portenier, Qiyang Hu, Attila Szabó, Siavash Arjomand Bigdeli, Paolo Favaro, and Matthias Zwicker. Faceshop: Deep sketch-based face image editing. ACM Trans. Graph., 37(4), 2018. +[40] Huan Ling, David Acuna, Karsten Kreis, Seung Wook Kim, and Sanja Fidler. Variational amodal object completion. Advances in Neural Information Processing Systems, 2020. +[41] Taesung Park, Jun-Yan Zhu, Oliver Wang, Jingwan Lu, Eli Shechtman, Alexei A. Efros, and Richard Zhang. Swapping autoencoder for deep image manipulation. In Advances in Neural Information Processing Systems, 2020. +[42] Seung Wook Kim, Jonah Philion, Antonio Torralba, and Sanja Fidler. DriveGAN: Towards a Controllable High-Quality Neural Simulation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021. +[43] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In The International Conference on Learning Representations (ICLR), 2014. +[44] Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pages 1278–1286, 2014. +[45] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2019. +[46] Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatiallyadaptive normalization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2337–2346, 2019. +[47] Lore Goetschalckx, Alex Andonian, Aude Oliva, and Phillip Isola. Ganalyze: Toward visual definitions of cognitive image properties. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), October 2019. +[48] Ali Jahanian\*, Lucy Chai\*, and Phillip Isola. On the "steerability" of generative adversarial networks. In International Conference on Learning Representations, 2020. +[49] Andrey Voynov and Artem Babenko. Unsupervised discovery of interpretable directions in the gan latent space. In International Conference on Machine Learning, pages 9786–9796. PMLR, 2020. +[50] Binxu Wang and Carlos R Ponce. A geometric analysis of deep generative image models and its applications. In International Conference on Learning Representations, 2021. +[51] Yujun Shen and Bolei Zhou. Closed-form factorization of latent semantics in gans. In CVPR, 2021. +[52] Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 8798–8807, 2018. +[53] Fujun Luan, Sylvain Paris, Eli Shechtman, and Kavita Bala. Deep photo style transfer. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017. +[54] Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In Advances in neural information processing systems, pages 700–708, 2017. +[55] Yijun Li, Ming-Yu Liu, Xueting Li, Ming-Hsuan Yang, and Jan Kautz. A closed-form solution to photorealistic image stylization. In Proceedings of the European Conference on Computer Vision (ECCV), 2018. +[56] H. Kazemi, S. Iranmanesh, and N. Nasrabadi. Style and content disentanglement in generative adversarial networks. In 2019 IEEE Winter Conference on Applications of Computer Vision (WACV), pages 848–856, Los Alamitos, CA, USA, jan 2019. IEEE Computer Society. +[57] Jaejun Yoo, Youngjung Uh, Sanghyuk Chun, Byeongkyu Kang, and Jung-Woo Ha. Photorealistic style transfer via wavelet transforms. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), 2019. +[58] Guim Perarnau, Joost van de Weijer, Bogdan Raducanu, and Jose M. Álvarez. Invertible conditional gans for image editing. arXiv preprint arXiv:1611.06355, 2016. +[59] Jeff Donahue, Philipp Krähenbühl, and Trevor Darrell. Adversarial feature learning. arXiv preprint arXiv:1605.09782, 2016. +[60] Andrew Brock, Theodore Lim, James M. Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. +[61] Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martín Arjovsky, Olivier Mastropietro, and Aaron C. Courville. Adversarially learned inference. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. +[62] Elad Richardson, Yuval Alaluf, Or Patashnik, Yotam Nitzan, Yaniv Azar, Stav Shapiro, and Daniel CohenOr. Encoding in style: a stylegan encoder for image-to-image translation. arXiv preprint arXiv:2008.00951, 2020. +[63] Jun-Yan Zhu, Philipp Krähenbühl, Eli Shechtman, and Alexei A Efros. Generative visual manipulation on the natural image manifold. In European conference on computer vision, pages 597–613. Springer, 2016. +[64] R. A. Yeh, C. Chen, T. Y. Lim, A. G. Schwing, M. Hasegawa-Johnson, and M. N. Do. Semantic image inpainting with deep generative models. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 6882–6890, 2017. +[65] Zachary C. Lipton and Subarna Tripathi. Precise recovery of latent vectors from generative adversarial networks. arXiv preprint arXiv:1702.04782, 2017. +[66] Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE International Conference on Computer Vision, pages 4432–4441, 2019. +[67] Minyoung Huh, Richard Zhang, Jun-Yan Zhu, Sylvain Paris, and Aaron Hertzmann. Transforming and projecting images into class-conditional generative networks. arXiv preprint arXiv:2005.01703, 2020. +[68] A. Creswell and A. A. Bharath. Inverting the generator of a generative adversarial network. IEEE Transactions on Neural Networks and Learning Systems, 30(7):1967–1974, 2019. +[69] A. Raj, Y. Li, and Y. Bresler. Gan-based projector for faster recovery with convergence guarantees in linear inverse problems. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 5601–5610, 2019. +[70] D. Bau, J. Zhu, J. Wulff, W. Peebles, B. Zhou, H. Strobelt, and A. Torralba. Seeing what a gan cannot generate. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 4501–4510, 2019. +[71] Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. In-domain gan inversion for real image editing. arXiv preprint arXiv:2004.00049, 2020. +[72] Jianjin Xu and Changxi Zheng. Linear semantics in generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9351–9360, 2021. +[73] David Bau, Alex Andonian, Audrey Cui, YeonHwan Park, Ali Jahanian, Aude Oliva, and Antonio Torralba. Paint by word. arXiv preprint arXiv:2103.10951, 2021. +[74] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020, 2021. +[75] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 586–595, 2018. +[76] Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4690–4699, 2019. +[77] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +[78] Maximilian Seitzer. pytorch-fid: FID Score for PyTorch. https://github.com/mseitzer/ pytorch-fid, August 2020. Version 0.1.1. +[79] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30, pages 6626–6637. Curran Associates, Inc., 2017. +[80] Mikołaj Binkowski, Danica J. Sutherland, Michael Arbel, and Arthur Gretton. Demystifying MMD GANs.´ In International Conference on Learning Representations, 2018. +[81] Omer Tov, Yuval Alaluf, Yotam Nitzan, Or Patashnik, and Daniel Cohen-Or. Designing an encoder for stylegan image manipulation. ACM Transactions on Graphics (TOG), 40(4):1–14, 2021. +[82] Yuri Viazovetskyi, Vladimir Ivashkin, and Evgeny Kashin. Stylegan2 distillation for feed-forward image manipulation. In European Conference on Computer Vision, pages 170–186. Springer, 2020. +[83] Cristian Vaccari and Andrew Chadwick. Deepfakes and disinformation: Exploring the impact of synthetic political video on deception, uncertainty, and trust in news. Social Media $^ +$ Society, 6(1):2056305120903408, 2020. +[84] Thanh Thi Nguyen, Quoc Viet Hung Nguyen, Cuong M. Nguyen, Dung Nguyen, Duc Thanh Nguyen, and Saeid Nahavandi. Deep learning for deepfakes creation and detection: A survey. arXiv preprint arXiv:1909.11573, 2021. +[85] Yisroel Mirsky and Wenke Lee. The creation and detection of deepfakes: A survey. ACM Comput. Surv., 54(1), 2021. +[86] Aditya Grover, Jiaming Song, Ashish Kapoor, Kenneth Tran, Alekh Agarwal, Eric J Horvitz, and Stefano Ermon. Bias correction of learned generative models using likelihood-free importance weighting. In Advances in Neural Information Processing Systems, 2019. +[87] Kristy Choi, Aditya Grover, Trisha Singh, Rui Shu, and Stefano Ermon. Fair generative modeling via weak supervision. In Proceedings of the 37th International Conference on Machine Learning, 2020. +[88] Ning Yu, Ke Li, Peng Zhou, Jitendra Malik, Larry Davis, and Mario Fritz. Inclusive GAN: improving data and minority coverage in generative models. In Computer Vision - ECCV 2020 - 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XXII, 2020. +[89] Jinhee Lee, Haeri Kim, Youngkyu Hong, and Hye Won Chung. Self-diagnosing gan: Diagnosing underrepresented samples in generative adversarial networks. arXiv preprint arXiv:2102.12033, 2021. \ No newline at end of file diff --git a/md/train/r16Vyf-0-/r16Vyf-0-.md b/md/train/r16Vyf-0-/r16Vyf-0-.md new file mode 100644 index 0000000000000000000000000000000000000000..0f4410f1379d9be6437c14f5828365bd509d2748 --- /dev/null +++ b/md/train/r16Vyf-0-/r16Vyf-0-.md @@ -0,0 +1,218 @@ +# IMAGE TRANSFORMER + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Image generation has been successfully cast as an autoregressive sequence generation or transformation problem. Recent work has shown that self-attention is an effective way of modeling textual sequences. In this work, we generalize a recently proposed model architecture based on self-attention, the Transformer, to a sequence modeling formulation of image generation with a tractable likelihood. By restricting the self-attention mechanism to attend to local neighborhoods we significantly increase the size of images the model can process in practice, despite maintaining significantly larger receptive fields per layer than typical convolutional neural networks. We propose another extension of self-attention allowing it to efficiently take advantage of the two-dimensional nature of images. + +While conceptually simple, our generative models trained on two image data sets are competitive with or significantly outperform the current state of the art in autoregressive image generation on two different data sets, CIFAR-10 and ImageNet. We also present results on image super-resolution with a large magnification ratio, applying an encoder-decoder configuration of our architecture. In a human evaluation study, we show that our super-resolution models improve significantly over previously published autoregressive super-resolution models. Images they generate fool human observers three times more often than the previous state of the art. + +![](images/933cd96f1e90f14dae74623d4f819500d8268efe9acbe2ae014122f6fc11d3c3.jpg) +Table 1: Three outputs of a CelebA super-resolution model followed by three image completions by a conditional CIFAR-10 model, with input, model output and the original from left to right + +# 1 INTRODUCTION + +Recent advances in modeling the distribution of natural images with neural networks allow them to generate increasingly natural-looking images. + +Some models, such as the PixelRNN and PixelCNN (van den Oord et al., 2016), have a tractable likelihood. Beyond licensing the comparatively simple and stable training regime of directly maximizing log-likelihood, this enables the straightforward application of these models in problems such as image compression (van den Oord & Schrauwen, 2014) and probabilistic planning and exploration (Bellemare et al., 2016). + +The likelihood is made tractable by modeling the joint distribution of the pixels in the image as the product of conditional distributions (Larochelle & Murray, 2011; Theis & Bethge, 2015). Having thus turned the problem into a sequence modeling problem, the state of the art approaches apply recurrent or convolutional neural networks, predicting each next pixel given all previously generated pixels (van den Oord et al., 2016). Training recurrent neural networks to sequentially predict each pixel of even a small image is computationally very challenging. Thus, models based on much more parallelizable convolutional neural networks such as the PixelCNN have recently received much more attention, and have now surpassed the PixelRNN in quality PixelCNN. + +One disadvantage of CNNs compared to RNNs is their typically fairly limited receptive field. This can adversely affect their ability to model long-range phenomena common in images, such as symmetry and occlusion, especially with a small number of layers. Growing the receptive field has been shown to improve quality significantly (Salimans et al.). Doing so, however, like deepening the network, comes at a significant cost in number of parameters and consequently computational performance and can make training such models more challenging. + +In this work we aim to find a better balance in the trade-off between the virtually unlimited receptive field of the necessarily sequential PixelRNN and the limited receptive field of the much more parallelizable PixelCNN and its various extensions. + +We adopt similar factorizations of the joint pixel distribution as previous work. Following recent work on modeling text (Vaswani et al., 2017), however, we propose eschewing recurrent and convolutional networks in favor of the Image Transformer, a model based entirely on a self-attention mechanism (Cheng et al., 2016; Parikh et al., 2016). The specific, locally restricted form of multihead self-attention we propose could also be interpreted as a sparsely parameterized form of gated convolution, allowing for significantly larger receptive fields than CNNs at the same number of parameters. + +Despite comparatively low resource requirements for training, the Image Transformer attains a new state of the art in modeling images from the standard ImageNet data set, as measured by loglikelihood. Our experiments indicate that increasing the size of the receptive field plays a significant role in this improvement. + +Many applications of image density models require conditioning on additional information of various kinds: from images in enhancement or reconstruction tasks such as super-resolution, in-painting and denoising to text when synthesizing images from natural language descriptions (Mansimov et al., 2015). In visual planning tasks, conditional image generation models could predict future frames of video conditioned on previous frames and taken actions. + +In this work we hence also evaluate two different methods of performing conditional image generation with the Image Transformer. In image-class conditional generation we condition on an embedding of one of a small number of image classes. In super-resolution with high magnification ratio, we condition on a very low-resolution image, employing the Image Transformer in an encoder-decoder configuration (Kalchbrenner & Blunsom, 2013). In comparison to recent work on autoregressive super-resolution (Dahl et al., 2017), a human evaluation study found images generated by our models look convincingly natural significantly more often. + +# 2 BACKGROUND + +There is a broad variety of types of image generation models in the literature. This work is most strongly inspired by autoregressive models such as fully visible belief networks and NADE (Bengio & Bengio, 2000; Larochelle & Murray, 2011) in that we also factor the joint probability of the image pixels into conditional distributions. Following PixelRNN (van den Oord et al., 2016), we also model the color channels of the output pixels as discrete values generated from a multinomial distribution, implemented using a simple softmax layer. + +The current state of the art in modeling images in the CIFAR-10 data set was achieved by the PixelCNN++, modeling the output pixel distribution with a discretized logistic mixture likelihood, conditioning on whole pixels instead of color channels and changes to the architecture (Salimans et al.). Most of these modifications can also be applied to our model which we plan to evaluate in future work. + +Another, currently wildly popular direction of research in image generation is training models with an adversarial loss (Goodfellow et al., 2014). Typically, in this regime a generator network is trained in opposition to a discriminator network trying to determine if a given image is real or generated. In contrast to the often blurry images generated by networks trained with likelihood-based losses, such generative adversarial networks (GANs) have been shown to generate sharper images with realistic high-frequency detail in generation and image super-resolution tasks (Zhang et al., 2016; Ledig et al., 2016). + +![](images/5cd909220d9c30121e12d3674ad75e559de12f50afbc9499627061dc1ff9e094.jpg) +Figure 1: A slice of one layer of the Image Transformer, recomputing the representation $q ^ { \prime }$ of a single channel of one pixel $q$ by attending to a memory of previously generated pixels $m _ { 1 } , m _ { 2 } , . . . .$ We apply a two-layer feed-forward neural network to the weighted average produced by the selfattention mechanism, perform layer normalization and sum the result with a residual connection. The position encodings $p _ { q } , p _ { 1 } , . . .$ are added only in the first layer. + +While very promising, GANs have various drawbacks. They are notoriously unstable (Radford et al., 2015), motivating a large number of methods attempting to make their training more robust (Metz et al., 2016; Berthelot et al., 2017). Another common issue is that of mode collapse, where generated images fail to reflect the diversity in the training set (Metz et al., 2016). + +A related problem is that GANs do not readily offer a probabilistic interpretation of their outputs, making it very challenging to measure the degree to which the models capture diversity. In contrast to models with a tractable likelihood, it also complicates optimizing model design, as objectively comparing different parameterizations or hyperparameter choices in this setting is considerably more difficult than comparing log-probabilities assigned to a validation set. + +# 3 MODEL ARCHITECTURE + +# 3.1 IMAGE REPRESENTATION AND 2D POSITIONAL INFORMATION + +We treat both the input and predicted pixel RGB intensities as categorical variables rather than real numbers. Each input pixel’s channel is encoded using a channel-specific set of 256 $d$ -dimensional embedding vectors of the channel intensity values $0 - 2 5 5$ . For output intensities, we share a single, separate set of 256 $d$ -dimensional embeddings across channels. + +We then combine the width and channels dimensions, yielding, for an image of width $w$ and height $h$ , a 3-dimensional tensor with shape $[ h , w \cdot 3 , d ]$ . + +To each pixel representation, we add a $d$ -dimensional encoding of the coordinates of that pixel. Following Vaswani et al. (2017), the encoding consists of sine and cosine functions of the coordinates, with different frequencies across different dimensions. Since we need to represent two coordinates, we use $d / 2$ of the dimensions to encode the row number and the other $d / 2$ of the dimensions to encode the the column and color channel. + +The resulting tensor forms the input to our 2D local attention models (Section 3.3). For 1D local attention (Section 3.3) and the input to our super-resolution models we flatten this tensor in rasterscan order, similar to previous work (van den Oord et al., 2016). This yields a $[ h \cdot w \cdot 3 , d ]$ tensor. + +# 3.2 SELF-ATTENTION + +Like the Transformer (Vaswani et al., 2017), the Image Transformer uses stacks of self-attention and position-wise feed-forward layers. Before we describe how we scale self-attention from sentences to images, which contain many more positions, we give a brief description of the self-attention layer. + +Each self-attention layer computes a new $d$ -dimensional representation for each position, that is each channel of each pixel. To recompute the representation for a given position, it first compares the position’s current representation to other positions’ representations, obtaining an attention distribution over the other positions. This distribution is then used to weight the contribution of the other postions’ representations to the next representation for the position at hand. + +Equation 1 and Figure1 fully describe all operations performed in every layer, independently for each position, with the exception of multi-head attention. For a detailed description of multi-head self-attention the reader is referred to (Vaswani et al., 2017). + +$$ +q ^ { \prime } = q + \mathrm { d r o p o u t } ( \mathrm { l a y e r n o r m } ( \mathrm { F F N N } ( \mathrm { s o f t m a x } \left( \frac { W _ { q } q ( M W _ { k } ) ^ { T } } { \sqrt { d } } \right) M W _ { v } ) ) ) +$$ + +In more detail, following previous work, we call the current representation of the pixel’s channel, or position, to be recomputed the query $q$ . The other positions whose representations will be used in computing a new representation for $q$ are $m _ { 1 } , m _ { 2 } , . . .$ which together comprise the columns of the memory matrix $M$ . Note that $M$ can also contain $q$ . We first transform $q$ and $M$ linearly by learned matrices $W _ { q }$ and $W _ { k }$ , respectively. + +The self-attention mechanism then compares $q$ to each of the pixel’s channel representations in the memory with a dot-product, scaled by $1 / { \sqrt { d } }$ . We apply the softmax function to the resulting compatibility scores, treating the obtained vector as attention distribution over the pixel channels in the memory. After applying another linear transformation $W _ { v }$ to the memory $M$ , we compute a weighted average of the transformed memory, weighted by the attention distribution. In the decoders of our different models we mask the outputs of the comparisons appropriately so that the model cannot attend to positions in the memory that have not been generated, yet. + +To the resulting vector we then apply a single-layer fully-connected feed-forward neural network with rectified linear activation followed by another linear transformation. The learned parameters of these are shared across all positions but different from layer to layer. Lastly, we perform layer normalization followed by dropout (Ba et al., 2016; Srivastava et al., 2014). + +The entire self-attention operation can be implemented using highly optimized matrix multiplication code and executed in parallel for all pixels’ channels. + +# 3.3 LOCAL SELF-ATTENTION + +The number of positions included in the memory $l _ { m }$ , or the number of columns of $M$ , has tremendous impact on the scalability of the self-attention mechanism, which has a time complexity in $O ( h \cdot w \cdot l _ { m } \cdot d )$ . + +The encoders of our super-resolution models operate on $8 \times 8$ pixel images and it is computationally feasible to attend to all of their 192 positions. The decoders in our experiments, however, produce $3 2 \times 3 2$ pixel images with 3072 positions, rendering attending to all positions impractical. + +Inspired by convolutional neural networks we address this by adopting a notion of locality, restricting the positions in the memory matrix $M$ to a local neighborhood around the query position. Changing this neighborhood per query position, however, would prohibit packing most of the computation necessary for self-attention into two matrix multiplications - one for computing the pairwise comparisons and another for generating the weighted averages. To avoid this, we partition the image into query blocks and associate each of these with a larger memory block that also contains the query block. For all queries from a given query block, the model attends to the same memory matrix, comprised of all positions from the memory block. + +![](images/30d100ecf3d3faac2c41810886ac2e9a3dbc045b98fcd9aa30107d53e7149da6.jpg) +Figure 2: The two different conditional factorizations used in our experiments, with 1D and 2D local attention on the left and right, respectively. In both, the image is partitioned into non-overlapping query blocks, each associated with a memory block covering a superset of the query block pixels. In every self-attention layer, each position in a query block attends to all positions in the memory block. The pixel marked as $q$ is the last that was generated. All channels of pixels in the memory and query blocks shown in white have masked attention weights and do not contribute to the next representations of positions in the query block. While the effective receptive field size in this figure is the same for both schemes, in 2D attention the memory block contains a more evenly balanced number of pixels next to and above the query block, respectively. + +The self-attention is then computed for all query blocks in parallel, while the feed-forward networks and layer normalizations are computed in parallel for all positions. + +In our experiments we use two different schemes for choosing query blocks and their associated memory block neighborhoods, resulting in two different factorizations of the joint pixel distribution into conditional distributions. Both are illustrated in Figure 2. + +1D Local Attention To compute self-attention on raster-scanned linearized images, we partition the length into non-overlapping query blocks $Q$ of length $l _ { q }$ , padding with zeroes if necessary. While contiguous in the linearized image, these blocks can be discontiguous in image coordinate space. For each query block we build the memory block $M$ from the same positions as $Q$ and an additional $l _ { m }$ positions from pixels that have been generated before, which can result in overlapping memory blocks. + +2D Local Attention In 2D local attention models, we partition the image into query blocks rectangular and contiguous in the original image space. We generate the image one query block after another, ordering the blocks in raster-scan order. Within each block, we generate individual positions, or pixel channels, again in raster-scan order. + +As illustrated in the right half of Figure 2, we generate the blocks outlined in grey lines left-to-right and top-to-bottom. We use 2-dimensional query blocks of a size $l _ { q }$ specified by height and width $l _ { q } = w _ { q } \cdot h _ { q }$ , and memory blocks extending the query block to the top, left and right by $h _ { m }$ , $w _ { m }$ and again $w _ { m }$ pixels, respectively. + +In both 1D and 2D local attention, we mask attention weights in the query and memory blocks such that positions that have not yet been generated are ignored. + +As can be seen in Figure 2, 2D local attention balances horizontal and vertical conditioning context much more evenly. We believe this might have an increasingly positive effect on quality with growing image size as the conditioning information in 1D local attention becomes increasingly dominated by pixels next to a given position as opposed to above it. + +![](images/052cf9c161ffc2890ecee2f98b4787434b04583a172ac30cba715d69854538f9.jpg) +Table 2: Conditional image generations for all CIFAR-10 categories. Images on the left are from a model that achieves 3.03 bits/dim on the test set. Images on the right are from our best nonaveraged model with 2.99 bits/dim. Both models are able to generate convincing cars, trucks, and ships. Generated horses, planes, and birds also look reasonable. + +# 4 INFERENCE + +Across all of the presented experiments, we sample from the various models with a tempered softmax (Dahl et al., 2017). We adjust the concentration of the distribution we sample from with a temperature $\tau > 0$ by which we divide the logits for the channel intensities. + +We tuned $\tau$ between 0.8 and 1.0, observing the highest perceptual quality in unconditioned and classconditional image generation with $\tau = 1 . 0$ . For super-resolution we present results for different temperatures in Table 4. + +# 5 EXPERIMENTS + +For all of our experiments we optimize with Adam (Kingma & Ba, 2015), and vary the learning rate as specified in Vaswani et al. (2017). We train our models on both p100 and k40 GPUs, with batch sizes ranging from 1 to 4 per GPU. + +Table 3: Negative log-likelihoods on the CIFAR-10 test and ImageNet validation sets. The Image Transformer outperforms all models but PixelC $\mathrm { N N } { + } { + }$ , achieving a new state of the art on ImageNet. Larger memory blocks significantly improve its performance. + +
Model TypeMemory Block SizeNLL
CIFAR-10 (Test)ImageNet (Validation)
Pixel CNN3.141
RowPixel RNN3.003.86
Gated Pixel CNN3.033.83
Pixel CNN++=2.92=
Image Transformer 1D local84.06
163.47
643.13
2562.993.78
with checkpoint averaging2562.983.77
+ +# 5.1 GENERATIVE IMAGE MODELING + +Our unconditioned and class-conditioned image generation models both use 1D local attention, with $l _ { q } = 2 5 6$ and a total memory size of 512. On CIFAR-10 our best class-conditioned model (2.99 bits/dim) uses 8 self-attention and feed-forward layers, $d = 1 0 2 4$ , 16 attention heads, 2048 dimensions in the feed-forward layers, and a dropout of 0.3. Our smaller CIFAR-10 models (3.03 bits/dim) have $d = 5 1 2$ , 1024 dimensions in the feed-forward layers, 8 attention heads and use dropout $= ~ 0 . 1$ . Our state of the art ImageNet unconditioned generation model is significantly larger, with 12 self-attention and feed-forward layers, $d = 1 0 2 4$ , 4096-dimensional feed-forward layers, 16 attention heads, and dropout $= 0 . 1$ . + +As Table 3 shows, our models improve over various previously proposed models including the PixelRNN and the gated PixelCNN. On ImageNet we establish a new state of the art of 3.78, which we can improve to 3.77 by averaging the last ten checkpoints. + +While the Pixel $\mathrm { C N N + + }$ achieved significantly better log-likelihoods on CIFAR-10 (Salimans et al.), we expect that many of the modifications in the PixelCNN++ carry over to the Image Transformer. We further believe our curated images for various classes to be of reasonable perceptual quality. + +# 5.2 CONDITIONING ON IMAGE CLASS + +We represent the image classes as learned $d$ -dimensional embeddings per class and simply add the respective embedding to the input representation of every input position together with the positional encodings. + +We trained the class-conditioned Image Transformer on CIFAR-10 and ImageNet data sets, achieving very similar log-likelihoods as in unconditioned generation. The perceptual quality of generated images, however, is significantly higher than that of our unconditioned models. We present some samples in Table 2. + +# 5.3 IMAGE SUPER-RESOLUTION + +Super-resolution is the process of recovering a high resolution image from a low resolution image while generating realistic and plausible details. Following (Dahl et al., 2017), in our experimental setup we enlarge an $8 \times 8$ pixel image four-fold to $3 2 \times 3 2$ , a process that is massively underspecified: the model has to generate aspects such as texture of hair, makeup, skin and sometimes even gender that cannot possibly be recovered from the source image. + +Here, we use the Image Transformer in an encoder-decoder configuration, connecting the encoder and decoder through an attention mechanism (Vaswani et al., 2017). Since the input is an $8 \times 8$ image, it is practical to use 1D attention with only one query and one memory block, each covering the entire image. We further use model dimension $d = 5 1 2$ , 1024 hidden units in the position-wise feed-forward network, 4 encoder layers and 12 decoder layers. We train end-to-end, maximizing likelihood. + +Table 4: Negative log-likelihood and human eval performance for the Image Transformer on CelebA. The fraction of humans fooled is significantly better than the previous state of the art. 2D local attention outperforms 1D local attention in the human evaluation. + +
Model TypeNLL%Fooled
T=n/a T = 1.0T = 0.9T = 0.8
ResNet4.0
srez GAN (Garcia, 2016)8.510.2
PixelRecursive (Dahl et al., 2017)1 1 2.7411.0 21.5 ± 4.010.4 30.1 ± 3.532.5± 3.0
ImageTransformer 1D local attention2.7936.9 ± 2.532.5 ± 2.5
ImageTransformer 2D local attention31.25 ± 3.5
+ +For both of the following data sets, we resized the image to $8 \times 8$ pixels for the input and $3 2 \times 3 2$ pixels for the label using TensorFlow’s area interpolation method. + +CelebA We trained on the standard CelebA data set of celebrity faces with cropped boundaries. Existing automated metrics like pSNR, SSIM and MS-SSIM have been shown to not correlate with perceptual image quality (Dahl et al., 2017). Instead, we conducted a human evaluation study on Amazon Mechanical Turk. Each worker is required to make a binary choice when shown one generated and one real image. Following (Dahl et al., 2017), we show 50 pairs of images, selected randomly, to 50 workers each. In our method, workers choose images from our model up to $3 6 . 9 \%$ of the time, a significant improvement over previous models. Sampling temperature of 0.9 and 2D local attention maximized perceptual quality as measured by this evaluation. + +CIFAR-10 We also trained a super-resolution model on the CIFAR-10 data set. Our model reached a negative log-likelihood of 2.76 using 1D local attention and 2.78 using 2D local attention on the test set. As seen in Figure 5.3, our model commonly generates plausible looking objects even though the input images seem to barely show any discernible structure beyond coarse shapes. + +# 6 CONCLUSION + +In this work we demonstrate that models based on self-attention can operate effectively on modalities other than text, and through local self-attention scale to significantly larger structures than sentences. With fewer layers, its larger receptive fields allow the Image Transformer to improve over the state of the art in unconditional, probabilistic image modeling of comparatively complex images from ImageNet as well as super-resolution. + +We further hope to have provided additional evidence that even in the light of generative adversarial networks, autoregressive generation of images is very much a promising area for further research - as is using network architectures such as the Image Transformer in GANs. + +In future work we would like to explore a broader variety of conditioning information including free-form text, as previously proposed (Mansimov et al., 2015), and tasks combining modalities such as language-driven editing of images. + +Fundamentally, we aim to move beyond still images to video (Kalchbrenner et al., 2016) and towards applications of such models in more model-based reinforcement learning approaches. + +# REFERENCES + +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. + +![](images/baa79a37c4412859d26e807eaa90433f219ba47d3e938f4a44353c3b66598d75.jpg) +Table 5: Images from our 1D and 2D local attention super-resolution models trained on CelebA, sampled with different temperatures. 2D local attention with $\tau = 0 . 9$ scored highest in our human evaluation study. + +Marc G. Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi ´ Munos. Unifying count-based exploration and intrinsic motivation. CoRR, abs/1606.01868, 2016. URL http://arxiv.org/abs/1606.01868. + +Yoshua Bengio and Samy Bengio. Modeling high-dimensional discrete data with multi-layer neural networks. In ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 12, pp. 400– 406. MIT Press, 2000. + +David Berthelot, Tom Schumm, and Luke Metz. BEGAN: boundary equilibrium generative adversarial networks. CoRR, abs/1703.10717, 2017. URL http://arxiv.org/abs/1703. 10717. + +Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. arXiv preprint arXiv:1601.06733, 2016. + +Ryan Dahl, Mohammad Norouzi, and Jonathan Shlens. Pixel recursive super resolution. 2017. URL https://arxiv.org/abs/1702.00783. + +David Garcia. srez: Adversarial super resolution. https://github.com/david-gpu/srez, 2016. URL https://github.com/david-gpu/srez. + +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets, 2014. + +![](images/2002f7f4507016c8198313277a443b14bf6c2b5b4e0abea1e589c7e4656632c3.jpg) +Table 6: On the left are image completions from our best conditional generation model, where we sample the second half. On the right are samples from our four-fold super-resolution model trained on CIFAR-10. Our images look realistic and plausible, show good diversity among the completion samples and observe the outputs carry surprising details for coarse inputs in super-resolution. + +Nal Kalchbrenner and Phil Blunsom. Recurrent continuous translation models. In Proceedings EMNLP 2013, pp. 1700–1709, 2013. URL http://nal.co/papers/ KalchbrennerBlunsom_EMNLP13. +Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex ¨ Graves, and Koray Kavukcuoglu. Video pixel networks. CoRR, abs/1610.00527, 2016. URL http://arxiv.org/abs/1610.00527. +Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. +Hugo Larochelle and Iain Murray. The neural autoregressive distribution estimator. In The Proceedings of the 14th International Conference on Artificial Intelligence and Statistics, volume 15 of JMLR: W&CP, pp. 29–37, 2011. +Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, and Wenzhe Shi. Photo-realistic single image super-resolution using a generative adversarial network. arXiv:1609.04802, 2016. +Elman Mansimov, Emilio Parisotto, Lei Jimmy Ba, and Ruslan Salakhutdinov. Generating images from captions with attention. CoRR, abs/1511.02793, 2015. URL http://arxiv.org/abs/ 1511.02793. +Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. CoRR, abs/1611.02163, 2016. URL http://arxiv.org/abs/1611.02163. +Ankur Parikh, Oscar Tckstrm, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention model. In Empirical Methods in Natural Language Processing, 2016. URL https://arxiv.org/ pdf/1606.01933.pdf. +Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015. URL http:// arxiv.org/abs/1511.06434. +Tim Salimans, Andrej Karpathy, Xi Chen, Diederik P. Kingma, and Yaroslav Bulatov. Pixelcnn++: A pixelcnn implementation with discretized logistic mixture likelihood and other modifications. under review at ICLR 2017. + +Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1):1929–1958, 2014. + +Lucas Theis and Matthias Bethge. Generative image modeling using spatial lstms. In Proceedings of the 28th International Conference on Neural Information Processing Systems - Volume 2, NIPS’15, pp. 1927–1935, Cambridge, MA, USA, 2015. MIT Press. URL http: //dl.acm.org/citation.cfm?id $= .$ 2969442.2969455. + +Aaron van den Oord and Benjamin Schrauwen. The student-t mixture as a natural image patch prior ¨ with application to image compression. Journal of Machine Learning Research, 15:2061–2086, 2014. URL http://jmlr.org/papers/v15/vandenoord14a.html. + +Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. ¨ ICML, 2016. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. 2017. URL http://arxiv. org/abs/1706.03762. + +Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaolei Huang, Xiaogang Wang, and Dimitris N. Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. CoRR, abs/1612.03242, 2016. URL http://arxiv.org/abs/1612. 03242. + +# A CELEBA SUPERRESOLUTION + +Image pairs comparing ratings of generated images by the Local 2D ImageTransformer model and the original images. On the left side are images where the raters prefer the generated image over the original ones. On the right side, raters prefer the original over generated image. + +Original $>$ Local 2D + +![](images/4c0fb41edebe5d4f9f1098457036167255c1ab790ee8a40df12ecbff4c7b31bb.jpg) + +![](images/5e5b4af4b2317eca0df66797096e3fd154bc144d9e643b34e10daddc833f3798.jpg) \ No newline at end of file diff --git a/md/train/r1gelyrtwH/r1gelyrtwH.md b/md/train/r1gelyrtwH/r1gelyrtwH.md new file mode 100644 index 0000000000000000000000000000000000000000..5563a71de1eb0572d291dcc11438d3edfb12be95 --- /dev/null +++ b/md/train/r1gelyrtwH/r1gelyrtwH.md @@ -0,0 +1,376 @@ +# PHYSICS-AWARE DIFFERENCE GRAPH NETWORKS FOR SPARSELY-OBSERVED DYNAMICS + +Sungyong Seo∗, Chuizheng Meng∗, Yan Liu + +Department of Computer Science +University of Southern California +{sungyons,chuizhem,yanliu.cs}@usc.edu + +# ABSTRACT + +Sparsely available data points cause numerical error on finite differences which hinders us from modeling the dynamics of physical systems. The discretization error becomes even larger when the sparse data are irregularly distributed or defined on an unstructured grid, making it hard to build deep learning models to handle physics-governing observations on the unstructured grid. In this paper, we propose a novel architecture, Physics-aware Difference Graph Networks (PA-DGN), which exploits neighboring information to learn finite differences inspired by physics equations. PA-DGN leverages data-driven end-to-end learning to discover underlying dynamical relations between the spatial and temporal differences in given sequential observations. We demonstrate the superiority of PA-DGN in the approximation of directional derivatives and the prediction of graph signals on the synthetic data and the real-world climate observations from weather stations. + +# 1 INTRODUCTION + +Modeling real world phenomena, such as climate observations, traffic flow, physics and chemistry simulation (Li et al., 2018; Geng et al., 2019; Long et al., 2018; de Bezenac et al., 2018; SanchezGonzalez et al., 2018; Gilmer et al., 2017), is important but extremely challenging. While deep learning has achieved remarkable successes in prediction tasks by learning latent representations from data-rich applications such as image recognition (Krizhevsky et al., 2012), text understanding (Wu et al., 2016), and speech recognition (Hinton et al., 2012), we confront many challenging scenarios in modeling natural phenomena with deep neural networks when only a limited number of observations are available. Particularly, the sparsely available data points cause substantial numerical error when we utilize existing finite difference operators and the limitation requires a more principled way to redesign deep learning models. + +While many methods have been proposed to model physics-simulated observations using deep learning, many of them are designed under the assumption that input is on a continuous domain. For example, Raissi et al. (2017a;b) proposed physics-informed neural networks (PINNs) to learn nonlinear relations between input (spatial- and temporal-coordinates $( { \pmb x } , t ) )$ and output simulated with a given partial differential equation (PDE). Since Raissi et al. (2017a;b) use the coordinates as input and compute derivatives based on the coordinates to represent the equation, the setting is only valid when the data are densely observed over spatial and temporal space. + +Prior knowledge related to physics equations has been combined with data-driven models for various purposes. Chen et al. (2015) proposed a nonlinear diffusion process for image restoration and de Bezenac et al. (2018) incorporated the transport physics (advection-diffusion equation) with deep neural networks for forecasting sea surface temperature by extracting the motion field. Lutter et al. (2019) introduced deep Lagrangian networks specialized to learn Lagrangian mechanics with learnable parameters. Seo & Liu (2019) proposed a physics-informed regularizer to impose dataspecific physics equations. In common, the methods in Chen et al. (2015); de Bezenac et al. (2018); Lutter et al. (2019) are not efficiently applicable to sparsely discretized input as only a small number of data points are available and continuous properties on given space are not easily recovered. It is unsuitable to directly use continuous differential operators to provide local behaviors because it is hard to approximate the continuous derivatives precisely with the sparse points (Shewchuk, 2002; Amenta & Kil, 2004; Luo et al., 2009). Furthermore, they are only applicable when the specific physics equations are explicitly given and still hard to be generalized to incorporate other types of equations. + +As another direction to modeling physics-simulated data, Long et al. (2018) proposed PDE-Net which uncovers the underlying hidden PDEs and predicts the dynamics of complex systems. Ruthotto & Haber (2018) derived new CNNs: parabolic and hyperbolic CNNs based on ResNet (He et al., 2016) architecture motivated by PDE theory. While Long et al. (2018); Ruthotto & Haber (2018) are flexible to uncover hidden physics from the constrained kernels, it is still restrictive to a regular grid where the proposed constraints on the learnable filters are easily defined. + +The topic of reasoning physical dynamics of discrete objects has been actively studied (SanchezGonzalez et al., 2018; Battaglia et al., 2016; Chang et al., 2016) as the appearance of graph-based neural networks (Kipf & Welling, 2017; Santoro et al., 2017; Gilmer et al., 2017). Although these models can handle sparsely located data points without explicitly given physics equations, they are purely data-driven so that the physics-inspired inductive bias for exploiting finite differences is not considered at all. In contrast, our method consists of physics-aware modules allowing efficiently leveraging the inductive bias to learn spatiotemporal data from the physics system. + +In this paper, we propose physics-aware difference graph networks (PA-DGN) whose architecture is motivated to leverage differences of sparsely available data from the physical systems. The differences are particularly important since most of the physics-related dynamic equations (e.g., Navier–Stokes equations) handle differences of physical quantities in spatial and temporal space instead of using the quantities directly. Inspired by the property, we first propose spatial difference layer (SDL) to efficiently learn the local representations by aggregating neighboring information in the sparse data points. The layer is based on graph networks (GN) as it easily leverages structural features to learn the localized representations and share the parameters for computing the localized features. Then, the layer is followed by recurrent graph networks (RGN) to predict the temporal difference which is another core component of physics-related dynamic equations. PA-DGN is applicable to various tasks and we provide two representative tasks; the approximation of directional derivatives and the prediction of graph signals. + +Our contributions are: + +• We tackle a limitation of the sparsely discretized data which cause numerical error when we model the physical system by proposing spatial difference layer (SDL) for efficiently exploiting neighboring information under the limitation of sparsely observable points. +• We combine SDL with recurrent graph networks to build PA-DGN which automatically learns the underlying spatiotemporal dynamics in graph signals. +• We verify that PA-DGN is effective in approximating directional derivatives and predicting graph signals in synthetic data. Then, we conduct exhaustive experiments to predict climate observations from land-based weather stations and demonstrate that PA-DGN outperforms other baselines. + +# 2 PHYSICS-AWARE DIFFERENCE GRAPH NETWORK + +In this section, we introduce the building module used to learn spatial differences of graph signals and describe how the module is used to predict signals in the physics system. + +# 2.1 DIFFERENCE OPERATORS ON GRAPH + +As approximation of derivatives in continuous domain, difference operators have been used as a core role to compute numerical solutions of (continuous) differential equations. Since it is hard to derive closed-form expressions of derivatives in real-world data, the difference operators have been considered as alternative tools to describe and solve PDEs in practice. The operators are especially important for physics-related data (e.g., meteorological observations) because the governing rules behind the observations are mostly differential equations. + +![](images/c729f07d57a78bf799f70079991ad77dbfac4589faed989f6fb73a67b408728f.jpg) +Figure 1: Examples of difference operators applied to graph signal. Filters used for the processing are (b) $\textstyle \sum _ { j } ( f _ { i } - f _ { j } )$ (c) $\textstyle \sum _ { j } ( 1 . 1 f _ { i } { \bar { - } } f _ { j } )$ , (d) $f _ { j } - 0 . 5 f _ { i }$ . + +Graph signals Given a graph $\mathcal { G } = ( \mathbb { V } , \mathbb { E } )$ where $\mathbb { V }$ is a set of vertices $\mathbb { V } = \{ 1 , \ldots , N _ { v } \}$ and $\mathbb { E }$ is a set of edges $\mathbb { E } \subseteq \bar { \{ ( i , j ) | i , j \in \mathbb { V } \} }$ $\mathbf { \left| \mathbb { E } \right| } = N _ { e } )$ , graph signals on all nodes at time $t$ are $f ( t ) = \{ f _ { i } ( t ) \mid \bar { i } \in \mathbb { V } \}$ where $f _ { i } : \mathbb { V } \to \mathbb { R }$ . Graph signals on edges can also be defined similarly, $F ( t ) = \{ F _ { i j } ( t ) \mid ( i , j ) \in \mathbb { E } \}$ where $F _ { i j } : \mathbb { E } \mathbb { R }$ . Both signals can be multidimensional. + +Gradient on graph The gradient $( \nabla )$ of a function on nodes of a graph is represented by finite difference + +$$ +\begin{array} { r } { \nabla : L ^ { 2 } ( \mathbb { V } ) \to L ^ { 2 } ( \mathbb { E } ) , \qquad ( \nabla f ) _ { i j } = \left( f _ { j } - f _ { i } \right) \quad \mathrm { i f } \ ( i , j ) \in \mathbb { E } \mathrm { ~ a n d ~ } 0 \mathrm { ~ o t h e r w i s e } , } \end{array} +$$ + +where $L ^ { 2 } ( \mathbb { V } )$ and $L ^ { 2 } ( \mathbb { E } )$ denote Hilbert spaces for node/edge functions, respectively. The gradients on a graph provide finite differences of graph signals and they become edge $( i , j )$ features. + +Laplace-Beltrami operator Laplace-Beltrami operator (or Laplacian, $\Delta$ ) in graph domain is defined as + +$$ +\Delta : L ^ { 2 } ( \mathbb { V } ) \to L ^ { 2 } ( \mathbb { V } ) , \qquad ( \Delta f ) _ { i } = \sum _ { j : ( i , j ) \in \mathbb { E } } ( f _ { i } - f _ { j } ) \quad \forall i , j \in \mathbb { V } +$$ + +This operator is usually regarded as a matrix form in other literature, $\pmb { { \cal L } } = \pmb { { \cal D } } - \pmb { { \cal A } }$ where $\pmb { A }$ is an adjacency matrix and $\begin{array} { r } { \dot { D } = \mathrm { d i a g } ( \sum _ { j : j \neq i } A _ { i j } ) } \end{array}$ is a degree matrix. + +# 2.2 DIFFERENCE OPERATORS ON TRIANGULATED MESH + +According to Crane (2018), the gradient and Laplacian operators on the triangulated mesh can be discretized by incorporating the coordinates of nodes. To obtain the gradient operator, the per-face gradient of each triangular face is calculated first. Then, the gradient on each node is the area-weighted average of all its neighboring faces, and the gradient on edge $( i , j )$ is defined as the dot product between the per-node gradient and the direction vector $e _ { i j }$ . The Laplacian operator can be discretized with Finite Element Method (FEM): + +$$ +( \Delta f ) _ { i } = \frac { 1 } { 2 } \sum _ { j : ( i , j ) \in \mathbb { E } } \left( \cot \alpha _ { j } + \cot \beta _ { j } \right) \left( f _ { j } - f _ { i } \right) , +$$ + +where node $j$ belongs to node $i$ ’s immediate neighbors $( j \in \mathbb { N } _ { i } )$ and $( \alpha _ { j } , \beta _ { j } )$ are two opposing angles of the edge $( i , j )$ . + +# 2.3 SPATIAL DIFFERENCE LAYER + +While the difference operators are generalized in Riemannian manifolds (Lai et al., 2013; Lim, 2015), there exist numerical error compared to those in continuous space and the error can be larger when the nodes are spatially far from neighboring nodes because the connected nodes $( j \in \mathbb { N } _ { i } )$ ) of $i \cdot$ -th node fail to represent local features around the node. Furthermore, the error is even larger if available data points are sparsely distributed (e.g., sensor-based observations). In other words, the difference operators are unlikely to discover meaningful spatial variations behind the sparse observations since they are highly limited to immediate neighboring information only. To mitigate the limitation, we propose spatial difference layer (SDL) which consists of a set of parameters to define learnable difference operators as a form of gradient and Laplacian to fully utilize neighboring information: + +![](images/877d4826df123901cdca612fd7715d80895076ebabfe7e3ae1d04828fbea9bce.jpg) +Figure 2: Physics-aware Difference Graph Networks for graph signal prediction. Blue boxes have learnable parameters and all parameters are trained through end-to-end learning. The nodes/edges can be multidimensional. + +$$ +( ^ { w } \nabla f ) _ { i j } = w _ { i j } ^ { ( g _ { 1 } ) } ( f _ { j } - w _ { i j } ^ { ( g _ { 2 } ) } f _ { i } ) , \qquad ( ^ { w } \Delta f ) _ { i } = \sum _ { j : ( i , j ) \in \mathbb { R } } w _ { i j } ^ { ( l _ { 1 } ) } ( f _ { i } - w _ { i j } ^ { ( l _ { 2 } ) } f _ { j } ) +$$ + +where $w _ { i j }$ are the parameters tuning the difference operators along with the corresponding edge direction $e _ { i j }$ . The two forms (Eq 1) are associated with edge and node features, respectively. The superscript in $^ w \nabla$ and $w _ { \Delta }$ denotes that the difference operators are functions of the learnable parameters $w$ . $w _ { i j } ^ { ( g ) }$ and w(l)ij are obtained by integrating local information as follow: + +$$ +w _ { i j } = g ( \{ f _ { k } , F _ { m n } | k , ( m , n ) \in h \mathrm { - h o p ~ n e i g h b o r h o o d ~ o f ~ e d g e ~ } ( i , j ) \} ) +$$ + +While the standard difference operators consider two connected nodes only $\mathit { i }$ and $j$ ) for each edge $( i , j )$ , Eq 2 uses a larger view $h$ -hop) to represent the differences between $i$ and $j$ nodes. Since graph networks (GN) (Battaglia et al., 2018) are efficient networks to aggregate neighboring information, we use GN for $g ( \cdot )$ function and $w _ { i j }$ are edge features of output of GN. Eq 2 can be viewed as a higher-order difference equation because nodes/edges which are multi-hop apart are considered. + +$w _ { i j }$ has a similar role of parameters in convolution kernels of CNNs. For example, while the standard gradient operator can be regarded as an example of simple edge-detecting filters, the operator can be a sharpening filter if w(g1)ij and $\begin{array} { r } { w _ { i j } ^ { ( g _ { 2 } ) } = \bar { \frac { | \mathbb { N } _ { i } | + 1 } { | \mathbb { N } _ { i } | } } } \end{array}$ for $i$ node and the operators over each edge are summed. In other words, by modulating $w _ { i j }$ , it is readily extended to conventional kernels including edge detection or sharpening filters and even further complicated kernels. On top of $w _ { i j }$ , the difference forms in Eq 1 make an optimizing process for learnable parameters based on the differences instead of the values intentionally. $\mathrm { E q } 1$ thus naturally provides the physics-inspired inductive bias which is particularly effective for modeling physics-related observations. Furthermore, it is easily possible to increase the number of channels for w(g)ij and w(l)ij to be more expressive. Figure 1 illustrates how the exemplary filters convolve the given graph signals. + +# 2.4 RECURRENT GRAPH NETWORKS + +Difference graph Once the modulated spatial differences $( ^ { w } \nabla f ( t ) , ^ { w } \Delta f ( t ) )$ are obtained, they are concatenated with the current signals $f ( t )$ to construct node-wise $\left( z _ { i } \right)$ and edge-wise $( z _ { i j } )$ features and the graph is called a difference graph. The difference graph includes all information to describe spatial variations. + +Recurrent graph networks Given a snapshot $( f ( t ) , F ( t ) )$ of a sequence of graph signals, one difference graph is obtained and is used to predict next graph signals. While a non-linear layer can be used to combine the learned spatial differences to predict the next signals, it is limited to discover spatial relations only among the features in the difference graph. Since many equations describing physics-related phenomena are non-static (e.g., Navier–Stokes equations), we adopt recurrent graph networks (RGN) (Sanchez-Gonzalez et al., 2018) with a graph state $\mathcal { G } _ { h }$ as input to combine the spatial differences with temporal variations. RGN returns a graph state $( \mathcal { G } _ { h } ^ { * } = ( h ^ { * ( v ) } , h ^ { * ( e ) } ) )$ and next graph signal $z _ { i } ^ { * }$ and $z _ { i j } ^ { * }$ . The update rule is described as follow: + +1. $( \boldsymbol { z } _ { i j } ^ { * } , \pmb { h } ^ { * ( e ) } ) \phi ^ { e } ( \boldsymbol { z } _ { i j } , \boldsymbol { z } _ { i } , \boldsymbol { z } _ { j } , \boldsymbol { h } ^ { ( e ) } )$ for all $( i , j ) \in \mathbb { E }$ pairs, 2. $( z _ { i } ^ { * } , h ^ { * ( v ) } ) \gets \phi ^ { v } ( z _ { i } , \bar { z } _ { i } ^ { \prime } , h ^ { ( v ) } )$ for all $i \in \mathbb { V }$ , $\bar { z } _ { i } ^ { \prime }$ is an aggregated edge attribute related to the node $i$ , + +where $\phi ^ { e } , \phi ^ { v }$ are edge and node update functions, respectively, and they can be any recurrent unit. +Finally, the prediction is made through a decoder by feeding the graph signal, $z _ { i } ^ { * }$ and $z _ { i j } ^ { * }$ . + +Learning objective Let $\hat { f }$ and $\hat { F }$ denote predictions of the target node/edge signals. PA-DGN is trained by minimizing the following objective: + +$$ +\mathcal { L } = \sum _ { i \in \mathbb { V } } \vert \vert f _ { i } - \hat { f } _ { i } \vert \vert ^ { 2 } + \sum _ { ( i , j ) \in \mathbb { E } } \vert \vert F _ { i j } - \hat { F } _ { i j } \vert \vert ^ { 2 } . +$$ + +For multistep predictions, $\mathcal { L }$ is summed over all predicting steps. If only one type (node or edge) of signal is given, the corresponding term in Eq 3 is used to optimize the parameters in SDL and RGN simultaneously. + +# 3 EFFECTIVENESS OF SPATIAL DIFFERENCE LAYER + +To investigate if the proposed spatial difference forms (Eq 1) can be beneficial to learning physicsrelated patterns, we use SDL on two different tasks: (1) approximate directional derivatives and (2) predict synthetic graph signals. + +# 3.1 APPROXIMATION OF DIRECTIONAL DERIVATIVES + +As we claimed in Section 2.3, the standard difference forms (gradient and Laplacian) on a graph can cause significant numerical error easily because they are susceptible to a distance of two points and variations of a given function. To evaluate the applicability of the proposed SDL, we train SDL to approximate directional derivatives on a graph. First, we define a synthetic function and its gradients on 2D space and sample 200 points $( x _ { i } , y _ { i } )$ . Then, we construct a graph on the sampled points by using $k$ -NN algorithm $( k = 4$ ). With the known gradient $\begin{array} { r } { \bigg ( \nabla f = ( \frac { \partial f } { \partial x } , \frac { \partial f } { \partial y } ) \bigg ) } \end{array}$ at each point (a node in the graph), we can compute directional derivatives by projecting $\nabla f$ to a connected edge $e _ { i j }$ (See Figure 3). We compare against four baselines: (1) the finite gradient (FinGrad) (2) multilayer perceptron (MLP) (3) graph networks (GN) (4) a different form of $\mathrm { E q } 1$ (One-w). For the finite gradient $( ( f _ { j } - f _ { i } ) / | | x _ { j } - x _ { i } | | )$ , there is no learnable parameter and it only uses two points. For MLP, we feed $( f _ { i } , f _ { j } , \pmb { x } _ { i } , \pmb { x } _ { j } )$ as input to see whether learnable parameters can benefit the approximation or not. For GN, we use distances of two connected points as edge features and function values on the points as node features. The edge feature output of GN is used as a prediction for the directional derivative on the edge. Finally, we modify the proposed form as $( \overset { w } { \nabla { f } } ) _ { i j } = w _ { i j } f _ { j } - f _ { i }$ . GN and the modified form are used to verify the effectiveness of Eq 1. Note that we define two synthetic functions (Figure 4) which have different property; (1) monotonically increasing from a center and (2) periodically varying. + +![](images/067e3e5946fdec6e962b58900cdfdb1a2cc8877584c427fc82ba89e26a60dbda.jpg) +Figure 3: Directional derivative on graph + +Table 1: Mean squared error $( 1 0 ^ { - 2 } )$ for approximation of directional derivatives. + +
FunctionsFinGradMLPGNOne-wSDL
fi(x,y)=0.1x² +0.5y²6.42±0.472.12±0.321.05±0.421.41±0.440.97±0.39
f2(x,y)= sin(x) +cos(y)5.90±0.042.29±0.772.17±0.346.73±1.171.26±0.05
+ +![](images/9fac30ff5be81be8490024894820601036be32ed3ceb7491f1ab6ed14988804d.jpg) +Figure 4: Gradients and graph structure of sampled points. Left: the synthetic function is $f _ { 1 } ( x , y ) =$ $0 . \check { 1 } x ^ { 2 } + 0 . 5 y ^ { 2 }$ . Right: the synthetic function is $f _ { 2 } ( x , y ) = \sin ( x ) + \cos ( y )$ . + +Approximation accuracy As shown in Table 1, the proposed spatial difference layer outperforms others by a large margin. As expected, FinGrad provides the largest error since it only considers two points without learnable parameters. It is found that the learnable parameters can significantly benefit to approximate the directional derivatives even if input is the same (FinGrad vs. MLP). Note that utilizing neighboring information (GN, One-w, SDL) is generally helpful to learn spatial variations properly. However, simply training parameters in GN is not sufficient and explicitly defining difference, which is important to understand spatial variations, provides more robust inductive bias. One important thing we found is that One-w is not effective as much as GN and it can be even worse than FinGrad. It is because of its limited degree of freedom. As implied in the form $( \nabla _ { w } f ) _ { i j } = w _ { i j } * f _ { j } - f _ { i }$ , only one $w _ { i j }$ adjusts the relative difference between $f _ { i }$ and $f _ { j }$ , and this is not enough to learn whole possible linear combinations of $f _ { i }$ and $f _ { j }$ . The unstable performance supports that the form of SDL is not ad-hoc but more rigorously designed. + +# 3.2 GRAPH SIGNAL PREDICTION + +We evaluate PA-DGN on the synthetic data sampled from the simulation of specific convectiondiffusion equations, to provide if the proposed model can predict next signals of the simulated dynamics from observations on discrete nodes only. For the simulated dynamics, we use an equation slightly modified based on the one in Long et al. (2018). + +$$ +\frac { d f _ { i } ( t ) } { d t } = a ( i ) ( \nabla f ) _ { \hat { x } } + b ( i ) ( \nabla f ) _ { \hat { y } } + c ( i ) \Delta f , \qquad f _ { i } ( 0 ) = f _ { o } ( i ) , +$$ + +where the index $i$ points the $i$ -th node whose coordinate is $( x _ { i } , y _ { i } )$ in the 2D space $( [ 0 , 2 \pi ] \times [ 0 , 2 \pi ] )$ and $\hat { x }$ and $\hat { y }$ indicate $x$ - and $y$ -direction in the space. $a ( i ) = 0 . 5 ( \cos ( y _ { i } ) + x _ { i } ( 2 \pi - \bar { x _ { i } } ) \sin ( x _ { i } ) \bar { ) } + 0 . \bar { 6 }$ $b ( i ) = 2 ( \cos ( y _ { i } ) + \sin ( x _ { i } ) ) + 0 . 8 _ { }$ , and $\begin{array} { r } { c ( i ) = 0 . 5 \left( 1 - \frac { \sqrt { ( x _ { i } - \pi ) ^ { 2 } + ( y _ { i } - \pi ) ^ { 2 } } } { \sqrt { 2 } \pi } \right) } \end{array}$ . Then, we uniformly sample 250 points in the above 2D space. The task is to predict signal values of all points in the future $M$ steps given observed values of the first $N$ steps. For our experiments, we choose $N = 5$ and $M = 1 5$ . Since there is no a priori graph structure on sampled points, we construct a graph with $k$ -NN algorithm $ { [ k = 4 ] }$ ) using the Euclidean distance. Figure 5 shows the dynamics and the graph structure of sampled points. + +To evaluate the effect of the proposed SDL on the above prediction task, we cascade SDL and a linear regression model as our prediction model since the dynamics follows a linear partial differential equation. We compare its performance with four baselines: (1) vector auto-regressor (VAR); (2) multilayer perceptron (MLP); (3) StandardOP: the standard approximation of differential operators in Section 2.1 followed by a linear regressor; (4) MeshOP: similar to StandardOP but use the discretization on triangulated mesh in Section 2.2 for differential operators. + +Table 2: Mean absolute error $( 1 0 ^ { - 2 } )$ for graph signal prediction. + +
VARMLPStandardOPMeshOPSDL
16.84±0.4115.75±0.5311.99±0.2912.82±0.0610.87±0.98
+ +Prediction Performance Table 2 shows the prediction performance of different models measured with mean absolute error. The prediction model with our proposed spatial differential layer outperforms other baselines. All models incorporating any form of spatial difference operators (StandardOP, + +![](images/44d4bb29f77c07af9c69d1563184127ca0bf654c6929bccc6caaf555c37c827b.jpg) +Figure 5: Synthetic dynamics and graph structure of sampled points. + +MeshOP and SDL) outperform those without spatial difference operators (VAR and MLP), showing that introducing spatial differences information inspired by the intrinsic dynamics helps prediction. However, in cases where points with observable signal are sparse in the space, spatial difference operators derived with fixed rules can be inaccurate and sub-optimal for prediction since the locally linear assumption which they are based on no longer holds. Our proposed SDL, to the contrary, is capable of bridging the gap between approximated difference operators and accurate ones by introducing learnable coefficients utilizing neighboring information, and thus improves the prediction performance. + +# 4 PREDICTION: GRAPH SIGNALS ON LAND-BASED WEATHER SENSORS + +We evaluate the proposed model on the task of predicting climate observations (Temperature) from the land-based weather stations located in the United States. + +# 4.1 EXPERIMENTAL SET-UP + +Data and task We sample the weather stations located in the United States from the Online Climate Data Directory of the National Oceanic and Atmospheric Administration (NOAA) and choose the stations which have actively measured meteorological observations during 2015. We choose two geographically close but meteorologically diverse groups of stations: the Western and Southeastern states. We use $k$ -Nearest Neighbor (NN) algorithm $k = 4$ ) to generate graph structures and the final adjacency matrix is $A = \bar { ( } A _ { k } + A _ { k } ^ { \top } ) / 2$ to make it symmetric where $A _ { k }$ is the output adjacency matrix from $k$ -NN algorithm. + +Figure 6 shows the distributions of the land-based weather stations and their connectivity. Since the stations are not synchronized and have different timestamps for the observations, we aggregate the time series hourly. The 1-year sequential data are split into the train set (8 months), the validation set (2 months), and the test set (2 months), respectively. + +Our main task is to predict the next graph signals based on the current and past graph signals. All methods we evaluate are trained through the objective (Eq 3) with the Adam optimizer and we use scheduled sampling (Bengio et al., 2015) for the models with recurrent modules. We evaluate PA-DGN and other baselines on two prediction tasks, (1) 1-step and (2) multistep-ahead predictions. Furthermore, we demonstrate the ablation study that provides how much the spatial derivatives from our proposed SDL are important signals to predict the graph dynamics. + +![](images/a27f4d0228aea93218bb3e8d15df642d05e54640be82b0c45bea4364b2457316.jpg) +Figure 6: Weather stations in (left) western (right) southeastern states in the United States and $k$ -NN graph. + +# 4.2 GRAPH SIGNAL PREDICTIONS + +We compare against the widely used baselines (VAR, MLP, and GRU) for 1-step and multistep prediction. Then, we use RGN (Sanchez-Gonzalez et al., 2018) to examine how much the graph structure is beneficial. Finally, we evaluate PA-DGN to verify if the proposed architecture (Eq 1) is able to reduce prediction loss. Experiment results for the prediction task are summarized in Table 3. + +Overall, RGN and PA-DGN are better than other baselines and it implies that the graph structure provides useful inductive bias for the task. It is intuitive as the meteorological observations are continuously changing over the space and time and thus, the observations at the $i$ -th station are strongly related to those of its neighboring stations. + +PA-DGN outperforms RGN and the discrepancy comes from the fact that the spatial derivatives (Eq 1) we feed in PA-DGN are beneficial and this finding is expected because the meteorological signals at a certain point are a function of not only its previous signal but also the relative differences between neighbor signals and itself. Knowing the relative differences among local observations is particularly essential to understand physics-related dynamics. For example, Diffusion equation, which describes how physical quantities (e.g., heat) are transported through space over time, is also a function of relative differences of the quantities ( $\begin{array} { r } { \frac { d f } { d t } = D \bar { \Delta } f ) } \end{array}$ rather than values of the neighbor signals. In other words, spatial differences are physics-aware features and it is desired to leverage the features as input to learn dynamics related to physical phenomena. + +Table 3: Graph signal prediction results (MAE) on multistep predictions. In each row, we report the average with standard deviations from all baselines and PA-DGN. One step is 1-hour time interval. + +
RegionMethod1-step6-step12-step
WestVAR0.1241 ± 0.02340.4295 ± 0.10040.4820 ± 0.1298
MLP0.1040 ± 0.00030.3742 ± 0.02380.4998 ± 0.0637
GRU0.0913 ± 0.00470.1871 ± 0.01020.2707 ± 0.0006
RGN0.0871 ± 0.00330.1708 ± 0.00240.2666 ± 0.0252
RGN(StandardOP)0.0860 ± 0.00180.1674 ± 0.00190.2504 ± 0.0107
RGN(MeshOP)0.0840 ± 0.00150.2119 ± 0.00180.4305 ± 0.0177
PA-DGN0.0840 ± 0.00040.1614 ± 0.00420.2439 ± 0.0163
SouthEastVAR0.0889 ± 0.00250.2250 ± 0.00130.3062 ± 0.0032
MLP0.0722 ± 0.00120.1797 ± 0.00860.2514 ± 0.0154
GRU0.0751 ± 0.00370.1724 ± 0.01300.2446 ± 0.0241
RGN0.0790 ± 0.01130.1815 ± 0.02390.2548 ± 0.0210
RGN(StandardOP)0.0942 ± 0.01210.2135 ± 0.01870.2902 ± 0.0348
RGN(MeshOP)0.0905 ± 0.00120.2052 ± 0.00120.2602 ± 0.0062
PA-DGN0.0721 ± 0.00020.1664 ± 0.00110.2408 ± 0.0056
+ +# 4.3 CONTRIBUTION OF SPATIAL DERIVATIVES + +We further investigate if the modulated spatial derivatives $( \mathrm { E q ~ 1 } )$ ) are effectively advantageous compared to the spatial derivatives defined in Riemannian manifolds. First, RGN without any spatial derivatives is assessed for the prediction tasks on Western and Southeastern states graph signals. Note that this model does not use any extra features but the graph signal, $f ( t )$ . Secondly, we add (1) StandardOP, the discrete spatial differences (Gradient and Laplacian) in Section 2.1 and (2) MeshOP, the triangular mesh approximation of differential operators in Section 2.2 separately as additional signals to RGN. Finally, we incorporate with RGN our proposed Spatial Difference Layer. + +Table 3 shows the contribution of each component. As expected, PA-DGN provides much higher drops in MAE $3 . 5 6 \%$ , $5 . 5 0 \%$ , $8 . 5 1 \%$ and $8 . 7 3 \%$ , $8 . 3 2 \%$ , $5 . 4 9 \%$ on two datasets, respectively) compared to RGN without derivatives and the results demonstrate that the derivatives, namely, relative differences from neighbor signals are effectively useful. However, neither RGN with StandardOP nor with MeshOP can consistently outperform RGN. We also found that PA-DGN consistently shows positive effects on the prediction error compared to the fixed derivatives. This finding is a piece of evidence to support that the parameters modulating spatial derivatives in our proposed Spacial Difference Layer are properly inferred to optimize the networks and to improve the prediction performance. + +# 5 CONCLUSION + +In this paper, we introduce a novel architecture (PA-DGN) that approximates spatial derivatives to use them to represent PDEs which have a prominent role for physics-aware modeling. PA-DGN + +effectively learns the modulated derivatives for predictions and the derivatives can be used to discover hidden physics describing interactions between temporal and spatial derivatives. + +# ACKNOWLEDGEMENTS + +This work is supported in part by NSF Research Grant IIS-1254206 and MINERVA grant N00014-17- 1-2281, granted to co-author Yan Liu in her academic role at the University of Southern California. The views and conclusions are those of the authors and should not be interpreted as representing the official policies of the funding agency, or the U.S. Government. Last but not least, we appreciate anonymous reviewers for your thorough comments and suggestions. + +# REFERENCES + +Nina Amenta and Yong Joo Kil. Defining point-set surfaces. In ACM Transactions on Graphics (TOG), volume 23, pp. 264–270. ACM, 2004. + +Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in neural information processing systems, pp. 4502–4510, 2016. + +Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018. + +Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 1171–1179, 2015. + +Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua B Tenenbaum. A compositional object-based approach to learning physical dynamics. arXiv preprint arXiv:1612.00341, 2016. + +Yunjin Chen, Wei Yu, and Thomas Pock. On learning optimized reaction diffusion processes for effective image restoration. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5261–5269, 2015. + +Keenan Crane. Discrete differential geometry: An applied introduction. Notices of the AMS, Communication, 2018. + +Emmanuel de Bezenac, Arthur Pajot, and Patrick Gallinari. Deep learning for physical processes: Incorporating prior scientific knowledge. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id ${ . } = { }$ By4HsfWAZ. + +Xu Geng, Yaguang Li, Leye Wang, Lingyu Zhang, Qiang Yang, Jieping Ye, and Yan Liu. Spatiotemporal multi-graph convolution network for ride-hailing demand forecasting. In 2019 AAAI Conference on Artificial Intelligence (AAAI’19), 2019. + +Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1263–1272. JMLR. org, 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. + +Geoffrey Hinton, Li Deng, Dong Yu, George E Dahl, Abdel-rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal processing magazine, 29(6):82–97, 2012. + +Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017. + +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. + +Rongjie Lai, Jiang Liang, and Hongkai Zhao. A local mesh method for solving pdes on point clouds. Inverse Problems & Imaging, 7(3), 2013. + +Yaguang Li, Rose Yu, Cyrus Shahabi, and Yan Liu. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ SJiHXGWAZ. + +Lek-Heng Lim. Hodge laplacians on graphs. arXiv preprint arXiv:1507.05379, 2015. + +Zichao Long, Yiping Lu, Xianzhong Ma, and Bin Dong. Pde-net: Learning pdes from data. International Conference on Machine Learning, 2018. + +Chuanjiang Luo, Issam Safa, and Yusu Wang. Approximating gradients for meshes and point clouds via diffusion metric. In Computer Graphics Forum, volume 28, pp. 1497–1508. Wiley Online Library, 2009. + +Michael Lutter, Christian Ritter, and Jan Peters. Deep lagrangian networks: Using physics as model prior for deep learning. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BklHpjCqKm. + +Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Physics informed deep learning (part i): Data-driven solutions of nonlinear partial differential equations. arXiv preprint arXiv:1711.10561, 2017a. + +Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Physics informed deep learning (part ii): Data-driven discovery of nonlinear partial differential equations. arXiv preprint arXiv:1711.10566, 2017b. + +Lars Ruthotto and Eldad Haber. Deep neural networks motivated by partial differential equations. arXiv preprint arXiv:1804.04272, 2018. + +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. International Conference on Machine Learning, 2018. + +Adam Santoro, David Raposo, David G Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. In Advances in neural information processing systems, pp. 4967–4976, 2017. + +Sungyong Seo and Yan Liu. Differentiable physics-informed graph networks. arXiv preprint arXiv:1902.02950, 2019. + +Jonathan Richard Shewchuk. What is a good linear finite element? interpolation, conditioning, anisotropy, and quality measures (preprint). University of California at Berkeley, 73:137, 2002. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. + +# A APPENDIX + +# A.1 SIMULATED DATA + +For the simulated dynamics, we discretize the following partial differential equation similar to the one in Long et al. (2018) to simulate the corresponding linear variable-coefficient convection-diffusion equation on graphs. + +In a continuous space, we define the linear variable-coefficient convection-diffusion equation as: + +$$ +\begin{array} { r } { \left\{ \begin{array} { l l } { \frac { \partial f } { \partial t } } & { = a ( x , y ) f _ { x } + b ( x , y ) f _ { y } + c ( x , y ) \Delta f } \\ { \dot { f } \rvert _ { t = 0 } } & { = f _ { 0 } ( x , y ) } \\ { \textrm { \scriptsize 1 } \Omega = [ 0 , 2 \pi ] \times [ 0 , 2 \pi ] , ( t , x , y ) \in [ 0 , 0 . 2 ] \times \Omega , a ( x , y ) = 0 . 5 \big ( \cos ( y ) + x ( 2 \pi - x ) \sin ( x ) \big ) + } \\ { b ( x , y ) = 2 ( \cos ( y ) + \sin ( x ) ) + 0 . 8 , c ( x , y ) = 0 . 5 \bigg ( 1 - \frac { \sqrt { ( x _ { i } - \pi ) ^ { 2 } + ( y _ { i } - \pi ) ^ { 2 } } } { \sqrt { 2 \pi } } \bigg ) . } \end{array} \right. } \end{array} +$$ + +We follow the setting of initialization in Long et al. (2018): + +$$ +f _ { 0 } ( x , y ) = \sum _ { | k | , | l | \leq N } \lambda _ { k , l } \cos ( k x + l y ) + \gamma _ { k , l } \sin ( k x + l y ) +$$ + +, where $\begin{array} { r } { N = 9 , \lambda _ { k , l } , \gamma _ { k , l } \sim \mathcal { N } \left( 0 , \frac { 1 } { 5 0 } \right) } \end{array}$ , and $k$ and $l$ are chosen randomly. + +We use spatial difference operators to approximate spatial derivatives: + +$$ +\left\{ \begin{array} { r l } { f _ { x } ( x _ { i } , y _ { i } ) } & { { } = \displaystyle \frac { 1 } { 2 s } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } - s , y _ { i } ) ) - \displaystyle \frac { 1 } { 2 s } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } + s , y _ { i } ) ) } \\ { f _ { y } ( x _ { i } , y _ { i } ) } & { { } = \displaystyle \frac { 1 } { 2 s } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } , y _ { i } - s ) ) - \displaystyle \frac { 1 } { 2 s } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } , y _ { i } + s ) ) } \\ { f _ { x x } ( x _ { i } , y _ { i } ) } & { { } = \displaystyle \frac { 1 } { s ^ { 2 } } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } - s , y _ { i } ) ) + \displaystyle \frac { 1 } { s ^ { 2 } } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } + s , y _ { i } ) ) } \\ { f _ { y y } ( x _ { i } , y _ { i } ) } & { { } = \displaystyle \frac { 1 } { s ^ { 2 } } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } , y _ { i } - s ) ) + \displaystyle \frac { 1 } { s ^ { 2 } } ( f ( x _ { i } , y _ { i } ) - f ( x _ { i } , y _ { i } + s ) ) } \end{array} \right. +$$ + +, where $s$ is the spatial grid size for discretization. + +Then we rewrite (5) with difference operators defined on graphs: + +$$ +\left\{ \begin{array} { l l } { \frac { \partial f } { \partial t } = a ( i ) ( \nabla f ) _ { \hat { x } } + b ( i ) ( \nabla f ) _ { \hat { y } } + c ( i ) ( ( \Delta f ) _ { \hat { x } \hat { x } } + ( \Delta f ) _ { \hat { y } \hat { y } } ) } \\ { f _ { i } ( 0 ) = f _ { o } ( i ) } \end{array} \right. +$$ + +, where + +$$ +\begin{array} { r } { a ( i ) ( x _ { j } , y _ { j } ) = \left\{ \begin{array} { l l } { \displaystyle \frac { a ( x _ { i } , y _ { i } ) } { 2 s } } & { \mathrm { i f ~ } x _ { i } = x _ { j } + s , y _ { i } = y _ { j } } \\ { - \displaystyle \frac { a ( x _ { i } , y _ { i } ) } { 2 s } } & { \mathrm { i f ~ } x _ { i } = x _ { j } - s , y _ { i } = y _ { j } } \\ { \displaystyle \frac { b ( x _ { i } , y _ { i } ) } { 2 s } } & { \mathrm { i f ~ } x _ { i } = x _ { j } , y _ { i } = y _ { j } + s } \\ { - \displaystyle \frac { b ( x _ { i } , y _ { i } ) } { 2 s } } & { \mathrm { i f ~ } x _ { i } = x _ { j } , y _ { i } = y _ { j } - s } \end{array} \right. } \\ { c ( i ) ( x _ { j } , y _ { j } ) = \frac { c } { s ^ { 2 } } } \end{array} +$$ + +Then we replace the gradient w.r.t time in (8) with temporal discretization: + +$$ +\left\{ \begin{array} { l l } { f ( t + 1 ) = \Delta t ( a ( i ) ( \nabla f ) _ { \hat { x } } + b ( i ) ( \nabla f ) _ { \hat { y } } + c ( i ) ( ( \Delta f ) _ { \hat { x } \hat { x } } + ( \Delta f ) _ { \hat { y } \hat { y } } ) ) + f ( t ) } \\ { f _ { i } ( 0 ) = f _ { o } ( i ) } \end{array} \right. +$$ + +, where $\Delta t$ is the time step in temporal discretization. + +Equation (12) is used for simulating the dynamics described by the equation (5). Then, we uniformly sample 250 points in the above 2D space and choose their corresponding time series of $u$ as the dataset used in our synthetic experiments. We generate 1000 sessions on a $5 0 \times 5 0$ regular mesh with time step size $\Delta t = 0 . 0 1$ . 700 sessions are used for training, 150 for validation and 150 for test. + +# A.2 EXPERIMENT SETTINGS + +Here we provide additional details for models we used in this work, including model architecture settings and hyper-parameter settings. + +# A.2.1 MODEL SETTINGS + +Unless mentioned otherwise, all models use a hidden dimension of size 64. + +• VAR: A vector autoregression model with 2 lags. Input is the concatenated features of previous 2 frames. The weights are shared among all nodes in the graph. +• MLP: A multilayer perceptron model with 2 hidden layers. Input is the concatenated features of previous 2 frames. The weights are shared among all nodes in the graph. GRU: A Gated Recurrent Unit network with 2 hidden layers. Input is the concatenated features of previous 2 frames. The weights are shared among all nodes in the graph. RGN: A recurrent graph neural network model with 2 GN blocks. Each GN block has an edge update block and a node update block, both of which use a 2-layer GRU cell as the update function. We set its hidden dimension to 73 so that it has the same number of learnable parameters as our proposed model PA-DGN. RGN(StandardOP): Similar to RGN, but use the output of difference operators in Section 2.1 as extra input features. We set its hidden dimension to 73. RGN(MeshOP): Similar to RGN(StandardOP), but the extra input features are calculated using opeartors in Section 2.2. We set its hidden dimension to 73. PA-DGN: Our proposed model. The spatial derivative layer uses a message passing neural network (MPNN) with 2 GN blocks using 2-layer MLPs as update functions. The forward network part uses a recurrent graph neural network with 2 recurrent GN blocks using 2-layer GRU cells as update functions. + +The numbers of learnable parameters of all models are listed as follows: + +Table 4: Numbers of learnable parameters. + +
ModelVARMLPGRURGNRGN(StandardOP)RGN(MeshOP)PA-DGN
#Params34,41737,889345,876341,057342,152340,001
+ +# A.2.2 TRAINING SETTINGS + +The number of evaluation runs We performed 3 times for every experiment in this paper to report the mean and standard deviations. + +Length of prediction For experiments on synthetic data, all models take first 5 frames as input and predict the following 15 frames. For experiments on NOAA datasets, all models take first 12 frames as input and predict the following 12 frames. + +Training hyper-parameters We use Adam optimizer with learning rate 1e-3, batch size 8, and weight decay of 5e-4. All experiments are trained for a maximum of 2000 epochs with early stopping. All experiments are trained using inverse sigmoid scheduled sampling with the coefficient $k = 1 0 7$ + +Environments All experiments are implemented with Python3.6 and PyTorch 1.1.0, and are run with NVIDIA GTX 1080 Ti GPUs. + +# A.3 EFFECT OF DIFFERENT GRAPH STRUCTURES + +In this section, we evaluate the effect of 2 different graph structures on baselines and our models: (1) k-NN: a graph constructed with $k$ -NN algorithm $k = 4 ,$ ; (2) TriMesh: a graph generated with Delaunay Triangulation. All graphs use the Euclidean distance. + +Table 5: Mean absolute error $( 1 0 ^ { - 2 } )$ ) for graph signal prediction on the synthetic dataset. + +
VARMLPStandardOPMeshOPSDL
k-NNTriMeshk-NNTriMeshk-NNTriMesh
17.3016.2712.0012.2912.8712.8211.0412.40
+ +Table 6: Graph signal prediction results (MAE) on multistep predictions. In each row, we report the average with standard deviations from all baselines and PA-DGN. One step is 1 hour time interval. + +
RegionMethodGraph1-step6-step12-step
WestVAR MLP0.1241 ± 0.02340.4295 ± 0.10040.4820 ± 0.1298
GRU10.1040 ± 0.0003 0.0913 ± 0.00470.3742 ± 0.0238 0.1871 ± 0.01020.4998 ± 0.0637 0.2707 ± 0.0006
RGNk-NN TriMesh0.0871 ± 0.00330.1708 ± 0.00240.2666 ± 0.0252
RGN (StandardOP)k-NN TriMesh0.0897 ± 0.0030 0.0860 ± 0.00180.1723 ± 0.0116 0.1674 ± 0.00190.2800 ± 0.0414 0.2504 ± 0.0107
RGNk-NN0.0842 ± 0.0011 0.0840 ± 0.00150.1715 ± 0.0027 0.2119 ± 0.00180.2517 ± 0.0369 0.4305 ± 0.0177
(MeshOP)TriMesh k-NN0.0846 ± 0.0017 0.0840 ± 0.00040.2090 ± 0.00770.4051 ± 0.0457
PA-DGN VARTriMesh0.0849 ± 0.00120.1614 ± 0.0042 0.1610 ± 0.00290.2439 ± 0.0163 0.2473 ± 0.0162
SouthEastMLP GRU0.0889 ± 0.0025 0.0722 ± 0.00120.2250 ± 0.0013 0.1797 ± 0.00860.3062 ± 0.0032 0.2514 ± 0.0154
RGN= k-NN0.0751 ± 0.0037 0.0790 ± 0.01130.1724 ± 0.0130 0.1815 ± 0.02390.2446 ± 0.0241 0.2548 ± 0.0210
RGN (StandardOP)TriMesh k-NN0.0932 ± 0.0105 0.0942 ± 0.01210.2076 ± 0.0200 0.2135 ± 0.01870.2854 ± 0.0211 0.2902 ± 0.0348
RGN (MeshOP)TriMesh0.0868 ± 0.01320.1885 ± 0.03050.2568 ± 0.0328
k-NN0.0913 ± 0.00160.2069 ± 0.00310.2649 ± 0.0092
TriMesh k-NN0.0877 ± 0.0020 0.0721 ± 0.00020.2043 ± 0.00260.2579 ± 0.0057
PA-DGNTriMesh0.0876 ± 0.00960.1664 ± 0.0011 0.2002 ± 0.01630.2408 ± 0.0056 0.2623 ± 0.0180
+ +Table 5 and Table 6 show the effect of different graph structures on the synthetic dataset used in Section 3.2 and the real-world dataset in Section 4.2 separately. We find that for different models the effect of graph structures is not homogeneous. For RGN and PA-DGN, $k$ -NN graph is more beneficial to the prediction performance than TriMesh graph, because these two models rely more on neighboring information and a $k$ -NN graph incorporates it better than a Delaunay Triangulation graph. However, switching from TriMesh graph to $k$ -NN graph is harmful to the prediction accuracy of RGN(MeshOP) since Delaunay Triangulation is a well-defined method for generating triangulated mesh in contrast to $k$ -NN graphs. Given the various effect of graph structures on different models, our proposed PA-DGN under $k$ -NN graphs always outperforms other baselines using any graph structure. + +![](images/00af0c99e444548cf3f703e615283468f9daffee0b6b915718fed2d1cc52a107.jpg) +Figure 7: MAE across the nodes. + +# A.4 THE DISTRIBUTION OF PREDICTION ERROR ACROSS NODES + +Figure 7 provides the distribution of MAEs across the nodes of PA-DGN applied to the graph signal prediction task of the west coast region of the real-world dataset in Section 4.2. As shown in the figure, nodes with the highest prediction error for short-term prediction are gathered in the inner part where the observable nodes are sparse, while for long-term prediction nodes in the area with a limited number of observable points no longer have the largest MAE. This implies that PA-DGN can utilize neighboring information efficiently even under the limitation of sparsely observable points. + +# A.5 EVALUATION ON NEMO SEA SURFACE TEMPERATURE (SST) DATASET + +We tested our proposed method and baselines on the NEMO sea surface temperature (SST) dataset1. We first download the data in the area between $5 0 \mathrm { N } ^ { \circ } – 6 5 \mathrm { N } ^ { \circ }$ and $7 5 \mathrm { W } ^ { \circ } \ – 1 0 \mathrm { W } ^ { \circ }$ starting from 2016-01- 01 to 2017-12-31, then we crop the $[ 0 , 5 5 0 ] \times [ 1 0 0 , 6 5 0 ]$ square from the area and sample 250 points from the square as our chosen dataset. We divide the data into 24 sequences, each lasting 30 days, and truncate the tail. All models use the first 5-day SST as input and predict the SST in the following 15 and 25 days. We use the data in 2016 for training all models and the left for testing. + +For StandardOP, MeshOP and SDL, we test both options using linear regression and using RGN for the prediction part and report the best result. The results in Table 7 show that all methods incorporating spatial differences gain improvement on prediction and that our proposed learnable SDL outperforms all other baselines. + +Table 7: Mean absolute error $( 1 0 ^ { - 2 } )$ for SST graph signal prediction. + +
VARMLPGRURGUStandardOPMeshOPSDL
15-step15.12315.05815.10115.17214.75614.60714.382
25-step19.53319.47319.52219.70518.98318.97718.434
+ +# A.6 EVALUATION ON DATASETS WITH DIFFERENT SPARSITY + +We changed the number of nodes to control the sparsity of data. As shown in Table 8, our proposed model outperforms others under various settings of sparsity on the synthetic experiment in Section 3.2. + +Table 8: Mean absolute error $( 1 0 ^ { - 2 } )$ ) for graph signal prediction with different sparsity. + +
#NodesVARMLPStandardOPMeshOPSDL
2500.17300.16270.12000.12870.1104
1500.18680.17290.14950.15760.1482
1000.17230.15890.16290.16960.1465
+ +Furthermore, we sampled 400 points and trained SDL as described in Section 3.1, and resampled fewer points (350,300,250,200) to evaluate if SDL generalizes less sparse setting. As Table 9 shows, MSE increases when fewer sample points are used. However, SDL is able to provide much more accurate gradients even if it is trained under a new graph with different properties. Thus, the results support that SDL is able to generalize the c setting. + +Table 9: Mean squared error $( 1 0 ^ { - 2 } )$ for approximations of directional derivatives of function $f _ { 2 } ( x , y ) = \sin \left( x \right) + \cos \left( y \right)$ with different sparsity. + +
Method350 Nodes300 Nodes250 Nodes200 Nodes
FinGrad2.88 ± 0.113.42 ± 0.143.96 ± 0.174.99 ± 0.31
SDL1.03 ± 0.091.14 ± 0.121.40 ± 0.101.76 ± 0.10
\ No newline at end of file diff --git a/md/train/r1iuQjxCZ/r1iuQjxCZ.md b/md/train/r1iuQjxCZ/r1iuQjxCZ.md new file mode 100644 index 0000000000000000000000000000000000000000..256456aacce8edd26ce8e17769f9b03def3297d0 --- /dev/null +++ b/md/train/r1iuQjxCZ/r1iuQjxCZ.md @@ -0,0 +1,266 @@ +# ON THE IMPORTANCE OF SINGLE DIRECTIONS FORGENERALIZATION + +Ari S. Morcos1, David G.T. Barrett, Neil C. Rabinowitz, & Matthew Botvinick +DeepMind +London, UK +{arimorcos,barrettdavid,ncr,botvinick}@google.com + +# ABSTRACT + +Despite their ability to memorize large datasets, deep neural networks often achieve good generalization performance. However, the differences between the learned solutions of networks which generalize and those which do not remain unclear. Additionally, the tuning properties of single directions (defined as the activation of a single unit or some linear combination of units in response to some input) have been highlighted, but their importance has not been evaluated. Here, we connect these lines of inquiry to demonstrate that a network’s reliance on single directions is a good predictor of its generalization performance, across networks trained on datasets with different fractions of corrupted labels, across ensembles of networks trained on datasets with unmodified labels, across different hyperparameters, and over the course of training. While dropout only regularizes this quantity up to a point, batch normalization implicitly discourages single direction reliance, in part by decreasing the class selectivity of individual units. Finally, we find that class selectivity is a poor predictor of task importance, suggesting not only that networks which generalize well minimize their dependence on individual units by reducing their selectivity, but also that individually selective units may not be necessary for strong network performance. + +# 1 INTRODUCTION + +Recent work has demonstrated that deep neural networks (DNNs) are capable of memorizing extremely large datasets such as ImageNet (Zhang et al., 2017). Despite this capability, DNNs in practice achieve low generalization error on tasks ranging from image classification (He et al., 2015) to language translation (Wu et al., 2016). These observations raise a key question: why do some networks generalize while others do not? + +Answers to these questions have taken a variety of forms. A variety of studies have related generalization performance to the flatness of minima and PAC-Bayes bounds (Hochreiter & Schmidhuber, 1997, Keskar et al., 2017, Neyshabur et al., 2017, Dziugaite & Roy, 2017), though recent work has demonstrated that sharp minima can also generalize (Dinh et al., 2017). Others have focused on the information content stored in network weights (Achille & Soatto, 2017), while still others have demonstrated that stochastic gradient descent itself encourages generalization (Bousquet & Elisseeff, 2002, Smith & Le, 2017, Wilson et al., 2017). + +Here, we use ablation analyses to measure the reliance of trained networks on single directions. We define a single direction in activation space as the activation of a single unit or feature map or some linear combination of units in response to some input. We find that networks which memorize the training set are substantially more dependent on single directions than those which do not, and that this difference is preserved even across sets of networks with identical topology trained on identical data, but with different generalization performance. Moreover, we found that as networks begin to overfit, they become more reliant on single directions, suggesting that this metric could be used as a signal for early stopping. + +We also show that networks trained with batch normalization are more robust to cumulative ablations than networks trained without batch normalization and that batch normalization decreases the class selectivity of individual feature maps, suggesting an alternative mechanism by which batch normalization may encourage good generalization performance. Finally, we show that, despite the focus on selective single units in the analysis of DNNs (and in neuroscience; Le et al., 2011, Zhou et al., 2014, Radford et al., 2017, Britten et al., 1992), the class selectivity of single units is a poor predictor of their importance to the network’s output. + +# 2 APPROACH + +In this study, we will use a set of perturbation analyses to examine the relationship between a network’s generalization performance and its reliance upon single directions in activation space. We will then use a neuroscience-inspired measure of class selectivity to compare the selectivity of individual directions across networks with variable generalization performance and examine the relationship between class selectivity and importance. + +# 2.1 SUMMARY OF MODELS AND DATASETS ANALYZED + +We analyzed three models: a 2-hidden layer MLP trained on MNIST, an 11-layer convolutional network trained on CIFAR-10, and a 50-layer residual network trained on ImageNet. In all experiments, ReLU nonlinearities were applied to all layers but the output. Unless otherwise noted, batch normalization was used for all convolutional networks (Ioffe & Szegedy, 2015). For the ImageNet ResNet, top-5 accuracy was used in all cases. + +Partially corrupted labels As in Zhang et al. (2017), we used datasets with differing fractions of randomized labels to ensure varying degrees of memorization. To create these datasets, a given fraction of labels was randomly shuffled and assigned to images, such that the distribution of labels was maintained, but any true patterns were broken. + +# 2.2 PERTURBATION ANALYSES + +Ablations We measured the importance of a single direction to the network’s computation by asking how the network’s performance degrades once the influence of that direction was removed. To remove a coordinate-aligned single direction , we clamped the activity of that direction to a fixed value (i.e., ablating the direction). Ablations were performed either on single units in MLPs or an entire feature map in convolutional networks. For brevity, we will refer to both of these as ‘units.’ Critically, all ablations were performed in activation space, rather than weight space. + +More generally, to evaluate a network’s reliance upon sets of single directions, we asked how the network’s performance degrades as the influence of increasing subsets of single directions was removed by clamping them to a fixed value (analogous to removing increasingly large subspaces within activation space). This analysis generates curves of accuracy as a function of the number of directions ablated: the more reliant a network is on low-dimensional activation subspaces, the more quickly the accuracy will drop as single directions are ablated. + +Interestingly, we found that clamping the activation of a unit to the empirical mean activation across the training or testing set was more damaging to the network’s performance than clamping the activation to zero (see Appendix A.1). We therefore clamped activity to zero for all ablation experiments. + +Addition of noise As the above analyses perturb units individually, they only measure the influence of coordinate-aligned single directions. To test networks’ reliance upon random single directions, we added Gaussian noise to all units with zero mean and progressively increasing variance. To scale the variance appropriately for each unit, the variance of the noise added was normalized by the empirical variance of the unit’s activations across the training set. + +# 2.3 QUANTIFYING CLASS SELECTIVITY + +To quantify the class selectivity of individual units, we used a metric inspired by the selectivity indices commonly used in systems neuroscience (De Valois et al., 1982, Britten et al., 1992, Freedman + +![](images/a93c0ebf1a390c0cf5ad45b33fe3198080cf0f272471a8bb39c454c841f9daf2.jpg) +Figure 1: Memorizing networks are more sensitive to cumulative ablations. Networks were trained on MNIST (2-hidden layer MLP, a), CIFAR-10 (11-layer convolutional network, b), and ImageNet (50-layer ResNet, c). In a, all units in all layers were ablated, while in $\mathbf { b }$ and c, only feature maps in the last three layers were ablated. Error bars represent standard deviation across 10 random orderings of units to ablate. + +& Assad, 2006). The class-conditional mean activity was first calculated across the test set, and the selectivity index was then calculated as follows: + +$$ +s e l e c t i v i t y = \frac { \mu _ { m a x } - \mu _ { - m a x } } { \mu _ { m a x } + \mu _ { - m a x } } +$$ + +with $\mu _ { m a x }$ representing the highest class-conditional mean activity and $\mu _ { - m a x }$ representing the mean activity across all other classes. For convolutional feature maps, activity was first averaged across all elements of the feature map. This metric varies from 0 to 1, with 0 meaning that a unit’s average activity was identical for all classes, and 1 meaning that a unit was only active for inputs of a single class. + +We note that this metric is not a perfect measure of information content in single units; for example, a unit with a little information about every class would have a low class selectivity index. However, it does measure the discriminability of classes along a given direction. The selectivity index also identifies units with the same class tuning properties which have been highlighted in the analysis of DNNs (Le et al., 2011, Zeiler & Fergus, 2014, Coates et al., 2012, Zhou et al., 2014, Radford et al., 2017). However, in addition to class selectivity, we replicate all of our results using mutual information, which, in contrast to class selectivity, should highlight units with information about multiple classes, and we find qualitively similar outcomes (Appendix A.5). We also note that while a class can be viewed as a highly abstract feature, implying that our results may generalize to feature selectivity, we do not examine feature selectivity in this work. + +# 3 EXPERIMENTS + +# 3.1 GENERALIZATION + +Here, we provide a rough intuition for why a network’s reliance upon single directions might be related to generalization performance. Consider two networks trained on a large, labeled dataset with some underlying structure. One of the networks simply memorizes the labels for each input example and will, by definition, generalize poorly (‘memorizing network’) while the other learns the structure present in the data and generalizes well (‘structure-finding network’). The minimal description length of the model should be larger for the memorizing network than for the structurefinding network. As a result, the memorizing network should use more of its capacity than the structure-finding network, and by extension, more single directions. Therefore, if a random single direction is perturbed, the probability that this perturbation will interfere with the representation of the data should be higher for the memorizing network than for the structure-finding network2. + +![](images/949033f95c022851d484f8bc418e885392d6012b7514264f6519fcceab445624.jpg) +Figure 2: Memorizing networks are more sensitive to random noise. Networks were trained on MNIST (2-hidden layer MLP, a), and CIFAR-10 (11-layer convolutional network, b). Noise was scaled by the empirical variance of each unit on the training set. Error bars represent standard deviation across 10 runs. X-axis is on a log scale. + +![](images/f4bf607c533d1828075bf68682cdde535b180760b76edf808ab6bf96796d7e95.jpg) +Figure 3: Networks which generalize poorly are more reliant on single directions. 200 networks with identical topology were trained on unmodified CIFAR-10. a, Cumulative ablation curves for the best and worst 5 networks by generalization error. Error bars represent standard deviation across 5 models and 10 random orderings of feature maps per model. b, Area under cumulative ablation curve (normalized) as a function of generalization error. + +To test whether memorization leads to greater reliance on single directions, we trained a variety of network types on datasets with differing fractions of randomized labels and evaluated their performance as progressively larger fractions of units were ablated (see Sections 2.2 and 2.1). By definition, these curves must begin at the network’s training accuracy (approximately 1 for all networks tested) and fall to chance levels when all directions have been ablated. To rule out variance due to the specific order of unit ablation, all experiments were performed with mutliple random ablation orderings of units. As many of the models were trained on datasets with corrupted labels and, by definition, cannot generalize, training accuracy was used to evaluate model performance. Consistent with our intuition, we found that networks trained on varying fractions of corrupted labels were significantly more sensitive to cumulative ablations than those trained on datasets comprised of true labels, though curves were not always perfectly ordered by the fraction of corrupted labels (Fig. 1). + +We next asked whether this effect was present if networks were perturbed along random bases. To test this, we added noise to each unit (see Section 2.2). Again, we found that networks trained on corrupted labels were substantially and consistently more sensitive to noise added along random bases than those trained on true labels (Fig. 2). + +The above results apply to networks which are forced to memorize at least a portion of the training set – there is no other way to solve the task. However, it is unclear whether these results would apply to networks trained on uncorrupted data. In other words, do the solutions found by networks with the same topology and data, but different generalization performance exhibit differing reliance upon single directions? To test this, we trained 200 networks on CIFAR-10, and evaluated their generalization error and reliance on single directions. All networks had the same topology and were trained on the same dataset (unmodified CIFAR-10). Individual networks only differed in their random initialization (drawn from identical distributions), the data order used during training, and their learning rate3. We found that the 5 networks with the best generalization performance were more robust to the ablation of single directions than the 5 networks with the worst generalization performance (Fig. 3a). To quantify this further, we measured the area under the ablation curve for each of the 200 networks and plotted it as a function of generalization error (Fig. 3b). Interestingly, networks appeared to undergo a discrete regime shift in their reliance upon single directions; however, this effect might have been caused by degeneracy in the set of solutions found by the optimization procedure, and we note that there was also a negative correlation present within clusters (e.g., top left cluster). These results demonstrate that the relationship between generalization performance and single direction reliance is not merely a side-effect of training with corrupted labels, but is instead present even among sets networks with identical training data. + +# RELIANCE ON SINGLE DIRECTIONS AS A SIGNAL FOR MODEL SELECTIO + +This relationship raises an intriguing question: can single direction reliance be used to estimate generalization performance without the need for a held-out test set? And if so, might it be used as a signal for early stopping or hyperpameter selection? As a proof-of-principle experiment for early stopping, we trained an MLP on MNIST and measured the area under the cumulative ablation curve (AUC) over the course of training along with the train and test loss. Interestingly, we found that the point in training at which the AUC began to drop was the same point that the train and test loss started to diverge (Fig. 4a). Furthermore, we found that AUC and test loss were negatively correlated (Spearman’s correlation: -0.728; Fig. 4b). + +As a proof-of-principle experiment for hyperparameter selection, we trained 192 CIFAR-10 models with different hyperparemeter settings (96 hyperparameters with 2 repeats each; see Appendix A.2). We found that AUC and test accuracy were highly correlated (Spearman’s correlation: 0.914; Fig. 4c), and by performing random subselections of 48 hyperparameter settings, AUC selected one of the top 1, 5, and 10 settings $13 \%$ , $83 \%$ , and $98 \%$ of the time, respectively, with an average difference in test accuracy between the best model selected by AUC and the optimal model of only $1 \pm 1 . 1 \%$ (mean $\pm$ std). These results suggest that single direction reliance may serve as a good proxy for hyperparameter selection and early stopping, but further work will be necessary to evaluate whether these results hold in more complicated datasets. + +# 3.3 RELATIONSHIP TO DROPOUT AND BATCH NORMALIZATION + +Dropout Our experiments are reminiscent of using dropout at training time, and upon first inspection, dropout may appear to discourage networks’ reliance on single directions (Srivastava et al., 2014). However, while dropout encourages networks to be robust to cumulative ablations up until the dropout fraction used in training, it should not discourage reliance on single directions past that point. Given enough capacity, a memorizing network could effectively guard against dropout by merely copying the information stored in a given direction to several other directions. However, the network will only be encouraged to make the minimum number of copies necessary to guard against the dropout fraction used in training, and no more. In such a case, the network would be robust to dropout so long as all redundant directions were not simultaneously removed, yet still be highly reliant on single directions past the dropout fraction used in training. + +To test whether this intuition holds, we trained MLPs on MNIST with dropout probabilities $\in \{ 0 . 1 , 0 . 2 , 0 . 3 \}$ on both corrupted and unmodified labels. Consistent with the observation in Arpit et al. (2017), we found that networks with dropout trained on randomized labels required more epochs to converge and converged to worse solutions at higher dropout probabilities, suggesting that dropout does indeed discourage memorization. However, while networks trained on both corrupted and unmodified labels exhibited minimal loss in training accuracy as single directions were removed up to the dropout fraction used in training, past this point, networks trained on randomized labels were much more sensitive to cumulative ablations than those trained on unmodified labels (Fig. 5a). Interestingly, networks trained on unmodified labels with different dropout fractions were all similarly robust to cumulative ablations. These results suggest that while dropout may serve as an effective regularizer to prevent memorization of randomized labels, it does not prevent over-reliance on single directions past the dropout fraction used in training. + +![](images/e630f13744068d5a9819364a26a21f47860a41e455b9625b44c345c7e001c3a0.jpg) +Figure 4: Single direction reliance as a signal for hyperparameter selection and early stopping. a, Train (blue) and test (purple) loss, along with the normalized area under the cumulative ablation curve (AUC; green) over the course of training for an MNIST MLP. Loss y-axis has been cropped to make train/test divergence visible. b, AUC and test loss for a CIFAR-10 ConvNet are negatively correlated over the course of training. c, AUC and test accuracy are positively corrleated across a hyperparameter sweep (96 hyperparameters with 2 repeats for each). + +![](images/48e679ad047be60cae394e8e5585ec293d894c5539856988264ccf1800f3de48.jpg) +Figure 5: Impact of regularizers on networks’ reliance upon single directions. a, Cumulative ablation curves for MLPs trained on unmodified and fully corrupted MNIST with dropout fractions $\in \{ 0 . 1 , 0 . 2 , 0 . 3 \}$ . Colored dashed lines indicate number of units ablated equivalent to the dropout fraction used in training. Note that curves for networks trained on corrupted MNIST begin to drop soon past the dropout fraction with which they were trained. b, Cumulative ablation curves for networks trained on CIFAR-10 with and without batch normalization. Error bars represent standard deviation across 4 model instances and 10 random orderings of feature maps per model. + +Batch normalization In contrast to dropout, batch normalization does appear to discourage reliance upon single directions. To test this, we trained convolutional networks on CIFAR-10 with and without batch normalization and measured their robustness to cumulative ablation of single directions. Networks trained with batch normalization were consistently and substantially more robust to these ablations than those trained without batch normalization (Fig. 5b). This result suggests that in addition to reducing covariate shift, as has been proposed previously (Ioffe & Szegedy, 2015), batch normalization also implicitly discourages reliance upon single directions. + +![](images/e8bd8b657b69ad0253b2a2b78e4473406fde003af58e1f3f7c30adf743c40263.jpg) +Figure 6: Batch normalization decreases class selectivity and increases mutual information. Distributions of class selectivity (a) and mutual information (b) for networks trained with (blue) and without batch normalization (purple). Each distribution comprises 4 model instances trained on uncorrupted CIFAR-10. + +# 3.4 RELATIONSHIP BETWEEN CLASS SELECTIVITY AND IMPORTANCE + +Our results thus far suggest that networks which are less reliant on single directions exhibit better generalization performance. This result may appear counter-intuitive in light of extensive past work in both neuroscience and deep learning which highlights single units or feature maps which are selective for particular features or classes (Le et al., 2011, Zeiler & Fergus, 2014, Coates et al., 2012, Zhou et al., 2014, Radford et al., 2017). Here, we will test whether the class selectivity of single directions is related to the importance of these directions to the network’s output. + +First, we asked whether batch normalization, which we found to discourage reliance on single directions, also influences the distribution of information about class across single directions. We used the selectivity index described above (see Section 2.3) to quantify the discriminability between classes based on the activations of single feature maps across networks trained with and without batch normalization. Interestingly, we found that while networks trained without batch normalization exhibited a large fraction of feature maps with high class selectivity4, the class selectivity of feature maps in networks trained with batch normalization was substantially lower (Fig. 6a). In contrast, we found that batch normalization increases the mutual information present in feature maps (Fig. 6b). These results suggest that batch normalization actually discourages the presence of feature maps with concentrated class information and rather encourages the presence of feature maps with information about multiple classes, raising the question of whether or not such highly selective feature maps are actually beneficial. + +We next asked whether the class selectivity of a given unit was predictive of the impact on the network’s loss of ablating said unit. Since these experiments were performed on networks trained on unmodified labels, test loss was used to measure network impact. For MLPs trained on MNIST, we found that there was a slight, but minor correlation (Spearman’s correlation: 0.095) between a unit’s class selectivity and the impact of its ablation, and that many highly selective units had minimal impact when ablated (Fig. 7a). By analyzing convolutional networks trained on CIFAR-10 and ImageNet, we again found that, across layers, the ablation of highly selective feature maps was no more impactful than the ablation of non-selective feature maps (Figs. 7b and 7d). In fact, in the CIFAR-10 networks, there was actually a negative correlation between class selectivity and feature map importance (Spearman’s correlation: -0.428, Fig. 7b). To test whether this relationship was depth-dependent, we calculated the correlation between class selectivity and importance separately for each layer, and found that the vast majority of the negative correlation was driven by early layers, while later layers exhibited no relationship between class selectivity and importance (Figs. 7c and 7e). Interestingly, in all three networks, ablations in early layers were more impactful than ablations in later layers, consistent with theoretical observations (Raghu et al., 2016). Additionally, we performed all of the above experiments with mutual information in place of class selectivity, and found qualitatively similar results (Appendix A.5). + +![](images/c44713ba46d153d855c244e6ab58121e96f6c770d30eb8f0a174a1162809c77f.jpg) +Figure 7: Selective and non-selective directions are similarly important. Impact of ablation as a function of class selectivity for MNIST MLP (a), CIFAR-10 convolutional network $\left( \mathbf { b - c } \right)$ , and ImageNet ResNet (d-e). c and e show regression lines for each layer separately. + +As a final test, we compared the class selectivity to the $L ^ { 1 }$ -norm of the filter weights, a metric which has been found to be a successful predictor of feature map importance in the model pruning literature (Li et al., 2017). Consistent with our previous observations, we found that class selectivity was largely unrelated to the $L ^ { 1 }$ -norm of the filter weights, and if anything, the two were negatively correlated (Fig. A3, see Appendix A.4 for details). Taken together, these results suggest that class selectivity is not a good predictor of importance, and imply that class selectivity may actually be detrimental to network performance. Further work will be necessary to examine whether class and/or feature selectivity is harmful or helpful to network performance. + +# 4 RELATED WORK + +Much of this work was directly inspired by Zhang et al. (2017), and we replicate their results using partially corrupted labels on CIFAR-10 and ImageNet. By demonstrating that memorizing networks are more reliant on single directions, we also provide an answer to one of the questions they posed: is there an empirical difference between networks which memorize and those which generalize? + +Our work is also related to work linking generalization and the sharpness of minima (Hochreiter & Schmidhuber, 1997, Keskar et al., 2017, Neyshabur et al., 2017). These studies argue that flat minima generalize better than sharp minima (though Dinh et al. (2017) recently found that sharp minima can also generalize well). This is consistent with our work, as flat minima should correspond to solutions in which perturbations along single directions have little impact on the network output. + +Another approach to generalization has been to contextualize it in information theory. For example, Achille & Soatto (2017) demonstrated that networks trained on randomized labels store more information in their weights than those trained on unmodfied labels. This notion is also related to Shwartz-Ziv & Tishby (2017), which argues that during training, networks proceed first through a loss minimization phase followed by a compression phase. Here again, our work is consistent, as networks with more information stored in their weights (i.e., less compressed networks) should be more reliant upon single directions than compressed networks. + +More recently, Arpit et al. (2017) analyzed a variety of properties of networks trained on partially corrupted labels, relating performance and time-to-convergence to capacity. They also demonstrated that dropout, when properly tuned, can serve as an effective regularizer to prevent memorization. However, we found that while dropout may discourage memorization, it does not discourage reliance on single directions past the dropout probability. + +We found that class selectivity is a poor predictor of unit importance. This observation is consistent with a variety of recent studies in neuroscience. In one line of work, the benefits of neural systems which are robust to coordinate-aligned noise have been explored (Barrett et al. (2016), Montijn et al. (2016)). Another set of studies have demonstrated the presence of neurons with multiplexed information about many stimuli and have shown that task information can be decoded with high accuracy from populations of these neurons with low individual class selectivity (Averbeck et al. (2006), Rigotti et al. (2013), Mante et al. (2013), Raposo et al. (2014), Morcos & Harvey (2016), Zylberberg (2017)). + +Perturbation analyses have been performed for a variety of purposes. In the model pruning literature, many studies have removed units with the goal of generating smaller models with similar performance (Li et al., 2017, Anwar et al., 2015, Molchanov et al., 2017), and recent work has explored methods for discovering maximally important directions (Raghu et al. (2017)). Recently, Cheney et al. (2017) used cumulative ablations to measure network robustness, though the relationship to generalization was not explored. A variety of studies within deep learning have highlighted single units which are selective for features or classes (Le et al., 2011, Zeiler & Fergus, 2014, Coates et al., 2012, Zhou et al., 2014, Radford et al., 2017, Agrawal et al., 2014). Additionally, Agrawal et al. (2014) analyzed the minimum number of sufficient feature maps (sorted by a measure of selectivity) to achieve a given accuracy. However, none of the above studies has tested the relationship between a unit’s class selectivity or information content and its necessity to the network’s output. + +Bau et al. (2017) have quantified a related metric, concept selectivity, across layers and networks, finding that units get more concept-selective with depth, which is consistent with our own observations regarding class selectivity (see Appendix A.3). However, they also observed a correlation between the number of concept-selective units and performance on the action40 dataset across networks and architectures. It is difficult to compare these results directly, as the data used are substantially different as is the method of evaluating selectivity. Nevertheless, we note that Bau et al. (2017) measured the absolute number of concept-selective units across networks with different total numbers of units and depths. The relationship between the number of concept-selective units and network performance may therefore arise as a result of a larger number of total units (if a fixed fraction of units is concept-selective) and increased depth (we both observed that selectivity increases with depth). + +# 5 DISCUSSION AND FUTURE WORK + +In this work, we have taken an empirical approach to understand what differentiates neural networks which generalize from those which do not. Our experiments demonstrate that generalization capability is related to a network’s reliance on single directions, both in networks trained on corrupted and uncorrupted data, and over the course of training for a single network. They also show that batch normalization, a highly successful regularizer, seems to implicitly discourage reliance on single directions. + +One clear extension of this work is to use these observations to construct a regularizer which more directly penalizes reliance on single directions. As it happens, the most obvious candidate to regularize single direction reliance is dropout (or its variants), which, as we have shown, does not appear to regularize for single direction reliance past the dropout fraction used in training (Section 3.3). Interestingly, these results suggest that one is able to predict a network’s generalization performance without inspecting a held-out validation or test set. This observation could be used in several interesting ways. First, in situations where labeled training data is sparse, testing networks’ reliance on single directions may provide a mechanism to assess generalization performance without sacrificing training data to be used as a validation set. Second, by using computationally cheap empirical measures of single direction reliance, such as evaluating performance at a single ablation point or sparsely sampling the ablation curve, this metric could be used as a signal for early-stopping or hyperparameter selection. We have shown that this metric is viable in simple datasets (Section 3.2), but further work will be necessary to evaluate viability in more complicated datasets. + +Another interesting direction for further research would be to evaluate the relationship between single direction reliance and generalization performance across different generalization regimes. In this work, we evaluate generalization in which train and test data are drawn from the same distribution, but a more stringent form of generalization is one in which the test set is drawn from a unique, but overlapping distribution with the train set. The extent to which single direction reliance depends on the overlap between the train and test distributions is also worth exploring in future research. + +This work makes a potentially surprising observation about the role of individually selective units in DNNs. We found not only that the class selectivity of single directions is largely uncorrelated with their ultimate importance to the network’s output, but also that batch normalization decreases the class selectivity of individual feature maps. This result suggests that highly class selective units may actually be harmful to network performance. In addition, it implies than methods for understanding neural networks based on analyzing highly selective single units, or finding optimal inputs for single units, such as activation maximization (Erhan et al., 2009) may be misleading. Importantly, as we have not measured feature selectivity, it is unclear whether these results will generalize to featureselective directions. Further work will be necessary to clarify all of these points. + +# ACKNOWLEDGMENTS + +We would like to thank Chiyuan Zhang, Ben Poole, Sam Ritter, Avraham Ruderman, and Adam Santoro for critical feedback and helpful discussions. + +# REFERENCES + +Alessandro Achille and Stefano Soatto. On the Emergence of Invariance and Disentangling in Deep Representations. pp. 1–17, 2017. URL http://arxiv.org/abs/1706.01350. + +Pulkit Agrawal, Ross B Girshick, and Jitendra Malik. Analyzing the Performance of Multilayer Neural Networks for Object Recognition. Eccv, 2014. + +Guillaume Alain and Yoshua Bengio. Understanding intermediate layers using linear classifier probes. (2003):1–11, 2016. URL http://arxiv.org/abs/1610.01644. + +Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Structured Pruning of Deep Convolutional Neural Networks. 2015. + +Devansh Arpit, Stanisław Jastrze¸bski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S. Kanwal, Tegan Maharaj, Asja Fischer, Aaron Courville, Yoshua Bengio, and Simon Lacoste-Julien. A Closer Look at Memorization in Deep Networks. 2017. ISSN 1938-7228. URL http://arxiv.org/abs/1706.05394. + +Bruno B Averbeck, Peter E Latham, and Alexandre Pouget. Neural correlations, population coding and computation. Nature reviews. Neuroscience, 7(5):358–366, May 2006. ISSN 1471-003X. doi: 10.1038/nrn1888. URL http://dx.doi.org/10.1038/nrn1888. + +David G.T. Barrett, Sophie Deneve, and Christian K. Machens. Optimal compensation for neuron \` loss. eLife, 5(DECEMBER2016), 2016. ISSN 2050084X. doi: 10.7554/eLife.12454. + +David Bau, Bolei Zhou, Aditya Khosla, Aude Oliva, and Antonio Torralba. Network Dissection: Quantifying Interpretability of Deep Visual Representations. 2017. doi: 10.1109/CVPR.2017. 354. URL http://arxiv.org/abs/1704.05796. + +Olivier Bousquet and Andre Elisseeff. Stability and generalization. ´ Journal of machine learning research: JMLR, 2(Mar):499–526, 2002. ISSN 1532-4435. URL http://www.jmlr.org/ papers/volume2/bousquet02a/bousquet02a.pdf. + +Kenneth H Britten, Michael N Shadlen, William T Newsome, and J Anthony Movshon. The analysis of visual motion: a comparison of neuronal and psychophysical performance. Journal of Neuroscience, 12(12):4745–4765, 1992. + +Nicholas Cheney, Martin Schrimpf, and Gabriel Kreiman. On the robustness of convolutional neural networks to internal architecture and weight perturbations. March 2017. URL http://arxiv. org/abs/1703.08245. + +Adam Coates, Andrej Karpathy, and Andrew Y Ng. Emergence of Object-Selective Features in Unsupervised Feature Learning. Nips’2012, pp. 1–9, 2012. ISSN 10495258. doi: 10.1002/elps.200900118. URL http://www.stanford.edu/{˜}acoates/papers/ coateskarpathyng{_}nips2012.pdf. + +Russell L De Valois, E William Yund, and Norva Hepler. The orientation and direction selectivity of cells in macaque visual cortex. Vision research, 22(5):531–544, 1982. + +Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp Minima Can Generalize For Deep Nets. 2017. + +Gintare Karolina Dziugaite and Daniel M. Roy. Computing Nonvacuous Generalization Bounds for Deep (Stochastic) Neural Networks with Many More Parameters than Training Data. 2017. URL http://arxiv.org/abs/1703.11008. + +Dumitru Erhan, Yoshua Bengio, Aaron Courville, and Pascal Vincent. Visualizing Higher-Layer Features of a Deep Network Technical Report. pp. 1–13, 2009. + +David J Freedman and John a Assad. Experience-dependent representation of visual categories in parietal cortex. Nature, 443(7107):85–8, sep 2006. ISSN 1476-4687. doi: 10.1038/nature05078. URL http://www.ncbi.nlm.nih.gov/pubmed/16936716. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. Arxiv.Org, 7(3):171–180, 2015. ISSN 1664-1078. doi: 10.3389/fpsyg.2013.00124. + +Sepp Hochreiter and Jurgen Schmidhuber. Flat Minima. ¨ Neural Comput, 9(1), 1997. + +Sergey Ioffe and Christian Szegedy. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. Arxiv, 2015. URL http://arxiv.org/abs/1502. 03167. + +Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikahail Smelyanskiy, and Ping Tak Peter Tang. On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima. In ICLR, pp. 1–16, 2017. + +Quoc V Le, Marc’Aurelio Ranzato, Rajat Monga, Matthieu Devin, Kai Chen, Greg S Corrado, Jeff Dean, and Andrew Y Ng. Building high-level features using large scale unsupervised learning. International Conference in Machine Learning, 2011. ISSN 10535888. doi: 10.1109/MSP.2011. 940881. + +Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient ConvNets. (2016):1–10, 2017. + +Valerio Mante, David Sussillo, Krishna V Shenoy, and William T Newsome. Context-dependent computation by recurrent dynamics in prefrontal cortex. Nature, 503(7474):78–84, November 2013. ISSN 0028-0836, 1476-4687. doi: 10.1038/nature12742. URL http://dx.doi.org/ 10.1038/nature12742. + +Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning Convolutional Neural Networks for Resource Efficient Inference. ICLR, (2015):1–17, 2017. + +Jorrit S. Montijn, Guido T. Meijer, Carien S. Lansink, and Cyriel M A Pennartz. Population-Level Neural Codes Are Robust to Single-Neuron Variability from a Multidimensional Coding Perspective. Cell Reports, 16(9):2486–2498, 2016. ISSN 22111247. doi: 10.1016/j.celrep.2016.07.065. URL http://dx.doi.org/10.1016/j.celrep.2016.07.065. + +Ari S Morcos and Christopher D Harvey. History-dependent variability in population dynamics during evidence accumulation in cortex. Nature neuroscience, 19(12):nn.4403, October 2016. ISSN 1097-6256. doi: 10.1038/nn.4403. URL http://www.nature.com/articles/ nn.4403. + +Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nathan Srebro. Exploring Generalization in Deep Learning. 2017. URL https://arxiv.org/abs/1706.08947. + +Alec Radford, Rafal Jozefowicz, and Ilya Sutskever. Learning to Generate Reviews and Discovering Sentiment. 2017. URL http://arxiv.org/abs/1704.01444. + +Maithra Raghu, Ben Poole, Jon Kleinberg, Surya Ganguli, and Jascha Sohl-Dickstein. On the Expressive Power of Deep Neural Networks. 2016. URL http://arxiv.org/abs/1606. 05336. + +Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. SVCCA: Singular Vector Canonical Correlation Analysis for Deep Understanding and Improvement. pp. 1–16, 2017. URL http://arxiv.org/abs/1706.05806. + +David Raposo, Matthew T Kaufman, and Anne K Churchland. A category-free neural population supports evolving demands during decision-making. Nature neuroscience, 17(12):1784–1792, November 2014. ISSN 1097-6256. doi: 10.1038/nn.3865. URL http://www.nature. com/doifinder/10.1038/nn.3865. + +Mattia Rigotti, Omri Barak, Melissa R Warden, Xiao-Jing Wang, Nathaniel D Daw, Earl K Miller, and Stefano Fusi. The importance of mixed selectivity in complex cognitive tasks. Nature, 497 (7451):585–590, 2013. ISSN 0028-0836. doi: 10.1038/nature12160. URL http://dx.doi. org/10.1038/nature12160. + +Ravid Shwartz-Ziv and Naftali Tishby. Opening the Black Box of Deep Neural Networks via Information. arXiv, pp. 1–19, 2017. URL http://arxiv.org/abs/1703.00810. + +Samuel L. Smith and Quoc V. Le. Understanding Generalization and Stochastic Gradient Descent. pp. 1–11, 2017. URL http://arxiv.org/abs/1710.06451. + +Nitish Srivastava, Geoffrey E. 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:1929–1958, 2014. ISSN 15337928. + +Ashia C. Wilson, Rebecca Roelofs, Mitchell Stern, Nathan Srebro, and Benjamin Recht. The Marginal Value of Adaptive Gradient Methods in Machine Learning. pp. 1–14, 2017. URL http://arxiv.org/abs/1705.08292. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. + +Matthew Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. Computer VisionECCV 2014, 8689:818–833, 2014. ISSN 978-3-319-10589-5. doi: 10.1007/ 978-3-319-10590-1 53. URL http://link.springer.com/chapter/10.1007/ 978-3-319-10590-1{_}53. + +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. 2017. URL http://arxiv.org/abs/ 1611.03530. + +Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Object Detectors Emerge in Deep Scene CNNs. 2014. URL http://arxiv.org/abs/1412.6856. + +Joel Zylberberg. Untuned but not irrelevant: The role of untuned neurons in sensory information coding. bioRxiv, pp. 134379, September 2017. doi: 10.1101/134379. URL https://www. biorxiv.org/content/early/2017/09/21/134379. + +# A APPENDIX + +# A.1 COMPARISON OF ABLATION METHODS + +To remove the influence of a given direction, its value should be fixed or otherwise modified such that it is no longer dependent on the input. However, the choice of such a fixed value can have a substantial impact. For example, if its value were clamped to one which is highly unlikely given its distribution of activations across the training set, network performance would likely suffer drastically. Here, we compare two methods for ablating directions: ablating to zero and ablating to the empirical mean over the training set. Using convolutional networks trained on CIFAR-10, we performed cumulative ablations, either ablating to zero or to the feature map’s mean (means were calculated independently for each element of the feature map), and found that ablations to zero were significantly less damaging than ablations to the feature map’s mean (Fig. A1). Interestingly, this corresponds to the ablation strategies generally used in the model pruning literature (Li et al., 2017, Anwar et al., 2015, Molchanov et al., 2017). + +![](images/06a0f56a14a21b2bc3f5078f8a2ff460fb530bb1724d02c8c181bf36a4133911.jpg) +Figure A1: Ablation to zero vs. ablation to the empirical feature map mean. + +# A.2 TRAINING DETAILS + +MNIST MLPs For class selectivity, generalization, early stopping, and dropout experiments, each layer contained 128, 512, 2048 and 2048 units, respectively. All networks were trained for 640 epochs, with the exception of dropout networks which were trained for 5000 epochs. + +CIFAR-10 ConvNets Convolutional networks were all trained on CIFAR-10 for 100 epochs. Layer sizes were: 64, 64, 128, 128, 128, 256, 256, 256, 512, 512, 512, with strides of 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, respectively. All kernels were 3x3. For the hyperparameter sweep used in Section 3.2, learning rate and batch size were evaluated using a grid search. + +ImageNet ResNet 50-layer residual networks (He et al., 2015) were trained on ImageNet using distributed training with 32 workers and a batch size of 32 for 200,000 steps. Blocks were structured as follows (stride, filter sizes, output channels): (1x1, 64, 64, 256) x 2, (2x2, 64, 64, 256), (1x1, 128, 128, 512) x 3, (2x2, 128, 128, 512), (1x1, 256, 256, 1024) x 5, (2x2, 256, 256, 1024), (1x1, 512, 512, 2048) x 3. For training with partially corrupted labels, we did not use any data augmentation, as it would have dramatically increasing the effective training set size, and hence prevented memorization. + +![](images/0fde811b003c5ef081949f04fe05133bf68bde284c2bfc72d7d09643cba1759e.jpg) +Figure A2: Class selectivity increases with depth. Class selectivity distributions as a function of depth for CIFAR-10 (a) and ImageNet (b). + +![](images/4eee150277e1c24cbaa2e7ad157b25c24c8360d1b44912042f6864167700b136.jpg) +Figure A3: Class selectivity is uncorrelated with $L ^ { 1 }$ -norm. Relationship between class selectivity and the $L ^ { 1 }$ -norm of the filter weights for CIFAR-10 (a) and ImageNet (b). + +# A.3 DEPTH-DEPENDENCE OF CLASS SELECTIVITY + +Here, we evaluate the distribution of class selectivity as a function of depth. In both networks trained on CIFAR-10 (Fig. A2a) and ImageNet (Fig. A2b), selectivity increased as a function of depth. This result is consistent with Bau et al. (2017), who show that concept-selectivity increases with depth. It is also consistent with Alain & Bengio (2016), who show depth increases the linear decodability of class information (though they evaluate linear decodability based on an entire layer rather than a single unit). + +# A.4 RELATIONSHIP BETWEEN CLASS SELECTIVITY AND THE FILTER WEIGHT $L ^ { 1 }$ -NORM + +Importantly, our results on the lack of relationship between class selectivity and importance do not suggest that there are not directions which are more or less important to the network’s output, nor do they suggest that these directions are not predictable; they merely suggest that class selectivity is not a good predictor of importance. As a final test of this, we compared class selectivity to the + +$L ^ { 1 }$ -norm of the filter weights, a metric which has been found to be a strongly correlated with the impact of removing a filter in the model pruning literature (Li et al., 2017). Since the $L ^ { 1 }$ -norm of the filter weights is predictive of impact of a feature map’s removal, if class selectivity is also a good predictor, the two metrics should be correlated. In the ImageNet network, we found that there was no correlation between the $L ^ { 1 }$ -norm of the filter weights and the class selectivity (Fig. A3a), while in the CIFAR-10 network, we found there was actually a negative correlation (Fig. A3b). + +![](images/ffc27ac44b22250926b583131d757efc24535f11cabc27d607942146e176bc3f.jpg) +A.5 RELATIONSHIP BETWEEN MUTUAL INFORMATION AND IMPORTANCE +Figure A4: Mutual information is not a good predictor of unit importance. Impact of ablation as a function of mutual information for MNIST MLP (a), CIFAR-10 convolutional network $\left( \mathbf { b - c } \right)$ , and ImageNet ResNet (d-e). c and e show regression lines for each layer separately. + +To examine whether mutual information, which, in contrast to class selectivity, highlights units with information about multiple classes, is a good predictor of importance, we performed the same experiments as in Section 3.4 with mutual information in place of class selectivity. We found, that while the results were a little less consistent (e.g., there appears to be some relationship in very early and very late layers in CIFAR-10), mutual information was generally a poor predictor of unit importance (Fig. A4). \ No newline at end of file diff --git a/md/train/r1xMH1BtvB/r1xMH1BtvB.md b/md/train/r1xMH1BtvB/r1xMH1BtvB.md new file mode 100644 index 0000000000000000000000000000000000000000..93ffc000599be45f8f6686ccadd6a8737fbf2906 --- /dev/null +++ b/md/train/r1xMH1BtvB/r1xMH1BtvB.md @@ -0,0 +1,354 @@ +# ELECTRA: PRE-TRAINING TEXT ENCODERS AS DISCRIMINATORS RATHER THAN GENERATORS + +Kevin Clark +Stanford University +kevclark@cs.stanford.edu + +Minh-Thang Luong Google Brain thangluong@google.com + +Quoc V. Le Google Brain qvl@google.com + +Christopher D. Manning Stanford University & CIFAR Fellow manning@cs.stanford.edu + +# ABSTRACT + +Masked language modeling (MLM) pre-training methods such as BERT corrupt the input by replacing some tokens with [MASK] and then train a model to reconstruct the original tokens. While they produce good results when transferred to downstream NLP tasks, they generally require large amounts of compute to be effective. As an alternative, we propose a more sample-efficient pre-training task called replaced token detection. Instead of masking the input, our approach corrupts it by replacing some tokens with plausible alternatives sampled from a small generator network. Then, instead of training a model that predicts the original identities of the corrupted tokens, we train a discriminative model that predicts whether each token in the corrupted input was replaced by a generator sample or not. Thorough experiments demonstrate this new pre-training task is more efficient than MLM because the task is defined over all input tokens rather than just the small subset that was masked out. As a result, the contextual representations learned by our approach substantially outperform the ones learned by BERT given the same model size, data, and compute. The gains are particularly strong for small models; for example, we train a model on one GPU for 4 days that outperforms GPT (trained using 30x more compute) on the GLUE natural language understanding benchmark. Our approach also works well at scale, where it performs comparably to RoBERTa and XLNet while using less than 1/4 of their compute and outperforms them when using the same amount of compute. + +# 1 INTRODUCTION + +Current state-of-the-art representation learning methods for language can be viewed as learning denoising autoencoders (Vincent et al., 2008). They select a small subset of the unlabeled input sequence (typically $15 \%$ ), mask the identities of those tokens (e.g., BERT; Devlin et al. (2019)) or attention to those tokens (e.g., XLNet; Yang et al. (2019)), and then train the network to recover the original input. While more effective than conventional language-model pre-training due to learning bidirectional representations, these masked language modeling (MLM) approaches incur a substantial compute cost because the network only learns from $15 \%$ of the tokens per example. + +As an alternative, we propose replaced token detection, a pre-training task in which the model learns to distinguish real input tokens from plausible but synthetically generated replacements. Instead of masking, our method corrupts the input by replacing some tokens with samples from a proposal distribution, which is typically the output of a small masked language model. This corruption procedure solves a mismatch in BERT (although not in XLNet) where the network sees artificial [MASK] tokens during pre-training but not when being fine-tuned on downstream tasks. We then pre-train the network as a discriminator that predicts for every token whether it is an original or a replacement. In contrast, MLM trains the network as a generator that predicts the original identities of the corrupted tokens. A key advantage of our discriminative task is that the model learns from all input tokens instead of just the small masked-out subset, making it more computationally efficient. Although our approach is reminiscent of training the discriminator of a GAN, our method is not adversarial in that the generator producing corrupted tokens is trained with maximum likelihood due to the difficulty of applying GANs to text (Caccia et al., 2018). + +![](images/17e83e2d1d0efcf2faa352e4d5e03a58f6447a6fbbb1fac435dd2c6ccf577c70.jpg) +Figure 1: Replaced token detection pre-training consistently outperforms masked language model pre-training given the same compute budget. The left figure is a zoomed-in view of the dashed box. + +We call our approach ELECTRA1 for “Efficiently Learning an Encoder that Classifies Token Replacements Accurately.” As in prior work, we apply it to pre-train Transformer text encoders (Vaswani et al., 2017) that can be fine-tuned on downstream tasks. Through a series of ablations, we show that learning from all input positions causes ELECTRA to train much faster than BERT. We also show ELECTRA achieves higher accuracy on downstream tasks when fully trained. + +Most current pre-training methods require large amounts of compute to be effective, raising concerns about their cost and accessibility. Since pre-training with more compute almost always results in better downstream accuracies, we argue an important consideration for pre-training methods should be compute efficiency as well as absolute downstream performance. From this viewpoint, we train ELECTRA models of various sizes and evaluate their downstream performance vs. their compute requirement. In particular, we run experiments on the GLUE natural language understanding benchmark (Wang et al., 2019) and SQuAD question answering benchmark (Rajpurkar et al., 2016). ELECTRA substantially outperforms MLM-based methods such as BERT and XLNet given the same model size, data, and compute (see Figure 1). For example, we build an ELECTRA-Small model that can be trained on 1 GPU in 4 days.2 ELECTRA-Small outperforms a comparably small BERT model by 5 points on GLUE, and even outperforms the much larger GPT model (Radford et al., 2018). Our approach also works well at large scale, where we train an ELECTRA-Large model that performs comparably to RoBERTa (Liu et al., 2019) and XLNet (Yang et al., 2019), despite having fewer parameters and using 1/4 of the compute for training. Training ELECTRA-Large further results in an even stronger model that outperforms ALBERT (Lan et al., 2019) on GLUE and sets a new state-of-the-art for SQuAD 2.0. Taken together, our results indicate that the discriminative task of distinguishing real data from challenging negative samples is more compute-efficient and parameter-efficient than existing generative approaches for language representation learning. + +# 2 METHOD + +We first describe the replaced token detection pre-training task; see Figure 2 for an overview. We suggest and evaluate several modeling improvements for this method in Section 3.2. + +![](images/ec4962b7b0a85077d4ee78022b72dab94781abbb3eb1a85a5bb970d3fd155061.jpg) +Figure 2: An overview of replaced token detection. The generator can be any model that produces an output distribution over tokens, but we usually use a small masked language model that is trained jointly with the discriminator. Although the models are structured like in a GAN, we train the generator with maximum likelihood rather than adversarially due to the difficulty of applying GANs to text. After pre-training, we throw out the generator and only fine-tune the discriminator (the ELECTRA model) on downstream tasks. + +Our approach trains two neural networks, a generator $G$ and a discriminator $D$ . Each one primarily consists of an encoder (e.g., a Transformer network) that maps a sequence on input tokens ${ \textbf { \em x } } =$ $[ x _ { 1 } , . . . , x _ { n } ]$ into a sequence of contextualized vector representations $h ( \bar { \pmb { x } } ) = [ h _ { 1 } , . . . , \bar { h } _ { n } ]$ . For a given position $t$ , (in our case only positions where $x _ { t } = \mathrm { [ M A S K ] } .$ ), the generator outputs a probability for generating a particular token $x _ { t }$ with a softmax layer: + +$$ +p _ { G } ( x _ { t } | \boldsymbol { x } ) = \exp \left( { e ( x _ { t } ) ^ { T } h _ { G } ( \boldsymbol { x } ) _ { t } } \right) / \sum _ { \boldsymbol { x } ^ { \prime } } \exp \left( { e ( \boldsymbol { x } ^ { \prime } ) ^ { T } h _ { G } ( \boldsymbol { x } ) _ { t } } \right) +$$ + +where $e$ denotes token embeddings. For a given position $t$ , the discriminator predicts whether the token $x _ { t }$ is “real,” i.e., that it comes from the data rather than the generator distribution, with a sigmoid output layer: + +$$ +D ( \pmb { x } , t ) = \mathrm { s i g m o i d } ( \boldsymbol { w } ^ { T } h _ { D } ( \pmb { x } ) _ { t } ) +$$ + +The generator is trained to perform masked language modeling (MLM). Given an input ${ \textbf { \em x } } =$ $[ x _ { 1 } , x _ { 2 } , . . . , x _ { n } ]$ , MLM first select a random set of positions (integers between 1 and $n$ ) to mask out $\pmb { m } = [ m _ { 1 } , . . . , m _ { k } ]$ .3 The tokens in the selected positions are replaced with a [MASK] token: we denote this as $\pmb { x } ^ { \mathrm { m a s k e d } } = \mathrm { R E P L A C E } ( \pmb { x } , \pmb { m } , [ \mathrm { M A S K } ] )$ . The generator then learns to predict the original identities of the masked-out tokens. The discriminator is trained to distinguish tokens in the data from tokens that have been replaced by generator samples. More specifically, we create a corrupted example $\pmb { x } ^ { \mathrm { c o r r u p t } }$ by replacing the masked-out tokens with generator samples and train the discriminator to predict which tokens in $\pmb { x } ^ { \mathrm { c o r r u p t } }$ match the original input $_ { \textbf { \em x } }$ . Formally, model inputs are constructed according to + +$$ +\begin{array} { r l r l } & { m _ { i } \sim \mathrm { u n i f } \{ 1 , n \} \mathrm { f o r } i = 1 \mathrm { t o } k } & { \qquad } & { x ^ { \mathrm { m a s k e d } } = \mathrm { R E P L A C E } ( { \pmb x } , { \pmb m } , [ \mathrm { M a S K } ] ) } \\ & { \hat { x } _ { i } \sim p _ { G } ( x _ { i } | { \pmb x } ^ { \mathrm { m a s k e d } } ) \mathrm { f o r } i \in { \pmb m } } & & { x ^ { \mathrm { c o r u p t } } = \mathrm { R E P L A C E } ( { \pmb x } , { \pmb m } , \hat { { \boldsymbol x } } ) } \end{array} +$$ + +and the loss functions are + +$$ +\begin{array} { r l } & { \mathcal { L } _ { \mathrm { M I M } } ( { \pmb x } , \theta _ { G } ) = \mathbb { E } \left( \displaystyle \sum _ { i \in m } - \log p _ { G } ( x _ { i } | { \pmb x } ^ { \mathrm { m a x i e d } } ) \right) } \\ & { \mathcal { L } _ { \mathrm { D i s c } } ( { \pmb x } , \theta _ { D } ) = \mathbb { E } \left( \displaystyle \sum _ { t = 1 } ^ { n } - \mathbb { 1 } ( x _ { t } ^ { \mathrm { c o r m p t } } = x _ { t } ) \log D ( x ^ { \mathrm { c o r m p t } } , t ) - \mathbb { 1 } ( x _ { t } ^ { \mathrm { c o r m p t } } \not = x _ { t } ) \log ( 1 - D ( x ^ { \mathrm { c o r m p t } } , t ) ) \right) } \end{array} +$$ + +Although similar to the training objective of a GAN, there are several key differences. First, if the generator happens to generate the correct token, that token is considered “real” instead of “fake”; we found this formulation to moderately improve results on downstream tasks. More importantly, the generator is trained with maximum likelihood rather than being trained adversarially to fool the discriminator. Adversarially training the generator is challenging because it is impossible to backpropagate through sampling from the generator. Although we experimented circumventing this issue by using reinforcement learning to train the generator (see Appendix F), this performed worse than maximum-likelihood training. Lastly, we do not supply the generator with a noise vector as input, as is typical with a GAN. + +We minimize the combined loss + +$$ +\operatorname* { m i n } _ { \theta _ { G } , \theta _ { D } } \sum _ { \pmb { x } \in \mathcal { X } } \mathcal { L } _ { \mathrm { M L M } } ( \pmb { x } , \theta _ { G } ) + \lambda \mathcal { L } _ { \mathrm { D i s c } } ( \pmb { x } , \theta _ { D } ) +$$ + +over a large corpus $\mathcal { X }$ of raw text. We approximate the expectations in the losses with a single sample. We don’t back-propagate the discriminator loss through the generator (indeed, we can’t because of the sampling step). After pre-training, we throw out the generator and fine-tune the discriminator on downstream tasks. + +# 3 EXPERIMENTS + +# 3.1 EXPERIMENTAL SETUP + +We evaluate on the General Language Understanding Evaluation (GLUE) benchmark (Wang et al., 2019) and Stanford Question Answering (SQuAD) dataset (Rajpurkar et al., 2016). GLUE contains a variety of tasks covering textual entailment (RTE and MNLI) question-answer entailment (QNLI), paraphrase (MRPC), question paraphrase (QQP), textual similarity (STS), sentiment (SST), and linguistic acceptability (CoLA). See Appendix C for more details on the GLUE tasks. Our evaluation metrics are Spearman correlation for STS, Matthews correlation for CoLA, and accuracy for the other GLUE tasks; we generally report the average score over all tasks. For SQuAD, we evaluate on versions 1.1, in which models select the span of text answering a question, and 2.0, in which some questions are unanswerable by the passage. We use the standard evaluation metrics of Exact-Match (EM) and F1 scores. For most experiments we pre-train on the same data as BERT, which consists of 3.3 Billion tokens from Wikipedia and BooksCorpus (Zhu et al., 2015). However, for our Large model we pre-trained on the data used for XLNet (Yang et al., 2019), which extends the BERT dataset to 33B tokens by including data from ClueWeb (Callan et al., 2009), CommonCrawl, and Gigaword (Parker et al., 2011). All of the pre-training and evaluation is on English data, although we think it would be interesting to apply our methods to multilingual data in the future. + +Our model architecture and most hyperparameters are the same as BERT’s. For fine-tuning on GLUE, we add simple linear classifiers on top of ELECTRA. For SQuAD, we add the questionanswering module from XLNet on top of ELECTRA, which is slightly more sophisticated than BERT’s in that it jointly rather than independently predicts the start and end positions and has a “answerability” classifier added for SQuAD 2.0. Some of our evaluation datasets are small, which means accuracies of fine-tuned models can vary substantially depending on the random seed. We therefore report the median of 10 fine-tuning runs from the same pre-trained checkpoint for each result. Unless stated otherwise, results are on the dev set. See the appendix for further training details and hyperparameter values. + +# 3.2 MODEL EXTENSIONS + +We improve our method by proposing and evaluating several extensions to the model. Unless stated otherwise, these experiments use the same model size and training data as BERT-Base. + +Weight Sharing We propose improving the efficiency of the pre-training by sharing weights between the generator and discriminator. If the generator and discriminator are the same size, all of the transformer weights can be tied. However, we found it to be more efficient to have a small generator, in which case we only share the embeddings (both the token and positional embeddings) of the generator and discriminator. In this case we use embeddings the size of the discriminator’s hidden states.4 The “input” and “output” token embeddings of the generator are always tied as in BERT. + +We compare the weight tying strategies when the generator is the same size as the discriminator. We train these models for $5 0 0 \mathrm { k }$ steps. GLUE scores are 83.6 for no weight tying, 84.3 for tying token embeddings, and 84.4 for tying all weights. We hypothesize that ELECTRA benefits from tied token embeddings because masked language modeling is particularly effective at learning these representations: while the discriminator only updates tokens that are present in the input or are sampled by the generator, the generator’s softmax over the vocabulary densely updates all token embeddings. On the other hand, tying all encoder weights caused little improvement while incurring the significant disadvantage of requiring the generator and discriminator to be the same size. Based on these findings, we use tied embeddings for further experiments in this paper. + +![](images/718fc297af29885ddc86928924f33b39a87c8084be421e6b6526bd94da613782.jpg) +Figure 3: Left: GLUE scores for different generator/discriminator sizes (number of hidden units). Interestingly, having a generator smaller than the discriminator improves results. Right: Comparison of different training algorithms. As our focus is on efficiency, the $\mathbf { X }$ -axis shows FLOPs rather than train steps (e.g., ELECTRA is trained for fewer steps than BERT because it includes the generator). + +Smaller Generators If the generator and discriminator are the same size, training ELECTRA would take around twice as much compute per step as training only with masked language modeling. We suggest using a smaller generator to reduce this factor. Specifically, we make models smaller by decreasing the layer sizes while keeping the other hyperparameters constant. We also explore using an extremely simple “unigram” generator that samples fake tokens according their frequency in the train corpus. GLUE scores for differently-sized generators and discriminators are shown in the left of Figure 3. All models are trained for $5 0 0 \mathrm { k }$ steps, which puts the smaller generators at a disadvantage in terms of compute because they require less compute per training step. Nevertheless, we find that models work best with generators 1/4-1/2 the size of the discriminator. We speculate that having too strong of a generator may pose a too-challenging task for the discriminator, preventing it from learning as effectively. In particular, the discriminator may have to use many of its parameters modeling the generator rather than the actual data distribution. Further experiments in this paper use the best generator size found for the given discriminator size. + +Training Algorithms Lastly, we explore other training algorithms for ELECTRA, although these did not end up improving results. The proposed training objective jointly trains the generator and discriminator. We experiment with instead using the following two-stage training procedure: + +1. Train only the generator with ${ \mathcal { L } } _ { \mathrm { M L M } }$ for $n$ steps. 2. Initialize the weights of the discriminator with the weights of the generator. Then train the discriminator with $\mathcal { L } _ { \mathrm { D i s c } }$ for $n$ steps, keeping the generator’s weights frozen. + +Note that the weight initialization in this procedure requires having the same size for the generator and discriminator. We found that without the weight initialization the discriminator would sometimes fail to learn at all beyond the majority class, perhaps because the generator started so far ahead of the discriminator. Joint training on the other hand naturally provides a curriculum for the discriminator where the generator starts off weak but gets better throughout training. We also explored training the generator adversarially as in a GAN, using reinforcement learning to accommodate the discrete operations of sampling from the generator. See Appendix F for details. + +Results are shown in the right of Figure 3. During two-stage training, downstream task performance notably improves after the switch from the generative to the discriminative objective, but does not end up outscoring joint training. Although still outperforming BERT, we found adversarial training to underperform maximum-likelihood training. Further analysis suggests the gap is caused by two + +
ModelTrain/Infer FLOPsSpeedupParamsTrain Time+HardwareGLUE
ELMo3.3e18 /2.6e1019x /1.2x96M14d on 3 GTX 1080 GPUs71.2
GPT4.0e19 / 3.0e101.6x / 0.97x117M25d on 8 P6000 GPUs78.8
BERT-Small1.4e18 /3.7e945x/8x14M4d on 1V100 GPU75.1
BERT-Base6.4e19/2.9e101x/1x110M4d on 16 TPUv3s82.2
ELECTRA-Small1.4e18 /3.7e945x/8x14M4d on 1 V100 GPU79.9
50% trained7.1e17 /3.7e990x/8x14M2d on1 V100 GPU79.0
25% trained3.6e17 /3.7e9181x/8x14M1d on 1 V100 GPU77.7
12.5% trained1.8e17/3.7e9361x /8x14M12h on 1 V100 GPU76.0
6.25% trained8.9e16 /3.7e9722x /8x14M6h on 1 V100 GPU74.1
ELECTRA-Base6.4e19 /2.9e101x/1x110M4d on 16 TPUv3s85.1
+ +Table 1: Comparison of small models on the GLUE dev set. BERT-Small/Base are our implementation and use the same hyperparameters as ELECTRA-Small/Base. Infer FLOPs assumes single length-128 input. Training times should be taken with a grain of salt as they are for different hardware and with sometimes un-optimized code. ELECTRA performs well even when trained on a single GPU, scoring 5 GLUE points higher than a comparable BERT model and even outscoring the much larger GPT model. + +problems with adversarial training. First, the adversarial generator is simply worse at masked language modeling; it achieves $58 \%$ accuracy at masked language modeling compared to $65 \%$ accuracy for an MLE-trained one. We believe the worse accuracy is mainly due to the poor sample efficiency of reinforcement learning when working in the large action space of generating text. Secondly, the adversarially trained generator produces a low-entropy output distribution where most of the probability mass is on a single token, which means there is not much diversity in the generator samples. Both of these problems have been observed in GANs for text in prior work (Caccia et al., 2018). + +# 3.3 SMALL MODELS + +As a goal of this work is to improve the efficiency of pre-training, we develop a small model that can be quickly trained on a single GPU. Starting with the BERT-Base hyperparameters, we shortened the sequence length (from 512 to 128), reduced the batch size (from 256 to 128), reduced the model’s hidden dimension size (from 768 to 256), and used smaller token embeddings (from 768 to 128). To provide a fair comparison, we also train a BERT-Small model using the same hyperparameters. We train BERT-Small for 1.5M steps, so it uses the same training FLOPs as ELECTRA-Small, which was trained for 1M steps.5 In addition to BERT, we compare against two less resource-intensive pre-training methods based on language modeling: ELMo (Peters et al., 2018) and GPT (Radford et al., 2018).6 We also show results for a base-sized ELECTRA model comparable to BERT-Base. + +Results are shown in Table 1. See Appendix D for additional results, including stronger small-sized and base-sized models trained with more compute. ELECTRA-Small performs remarkably well given its size, achieving a higher GLUE score than other methods using substantially more compute and parameters. For example, it scores 5 points higher than a comparable BERT-Small model and even outperforms the much larger GPT model. ELECTRA-Small is trained mostly to convergence, with models trained for even less time (as little as 6 hours) still achieving reasonable performance. While small models distilled from larger pre-trained transformers can also achieve good GLUE scores (Sun et al., 2019b; Jiao et al., 2019), these models require first expending substantial compute to pre-train the larger teacher model. The results also demonstrate the strength of ELECTRA at a moderate size; our base-sized ELECTRA model substantially outperforms BERT-Base and even outperforms BERT-Large (which gets 84.0 GLUE score). We hope ELECTRA’s ability to achieve strong results with relatively little compute will broaden the accessibility of developing and applying pre-trained models in NLP. + +Table 2: Comparison of large models on the GLUE dev set. ELECTRA and RoBERTa are shown for different numbers of pre-training steps, indicated by the numbers after the dashes. ELECTRA performs comparably to XLNet and RoBERTa when using less than 1/4 of their pre-training compute and outperforms them when given a similar amount of pre-training compute. BERT dev results are from Clark et al. (2019). + +
ModelTrain FLOPs ParamsCoLASSTMRPCSTSQQPMNLIQNLIRTEAvg.
BERT1.9e20 (0.27x)335M60.693.288.090.091.386.692.370.484.0
RoBERTa-100K6.4e20 (0.90x)356M66.195.691.492.292.089.394.082.787.9
RoBERTa-500K3.2e21 (4.5x)356M68.096.490.992.192.290.294.786.688.9
XLNet3.9e21 (5.4x)360M69.097.090.892.292.390.894.985.989.1
BERT (ours)7.1e20 (1x)335M67.095.989.191.291.589.693.579.587.2
ELECTRA-400K7.1e20 (1x)335M69.396.0 90.692.192.490.594.586.889.0
ELECTRA-1.75M3.1e21 (4.4x)335M69.196.990.892.692.490.995.088.089.5
+ +Table 3: GLUE test-set results for large models. Models in this table incorporate additional tricks such as ensembling to improve scores (see Appendix B for details). Some models do not have QNLI scores because they treat QNLI as a ranking task, which has recently been disallowed by the GLUE benchmark. To compare against these models, we report the average score excluding QNLI (Avg.\*) in addition to the GLUE leaderboard score (Score). “ELECTRA” and “RoBERTa” refer to the fully-trained ELECTRA-1.75M and RoBERTa-500K models. + +
ModelTrain FLOPs CoLASSTMRPCSTSQQPMNLIQNLI RTEWNLI Avg.*Score
BERT1.9e20 (0.06x)60.594.985.486.589.386.792.770.1 65.179.880.5
RoBERTa3.2e21 (1.02x)67.896.7 89.891.990.290.895.488.289.088.188.1
ALBERT3.1e22 (10x)69.197.1 91.292.0 90.591.3189.291.889.01
XLNet3.9e21 (1.26x) 70.297.1 90.592.6 90.490.9188.592.589.11
ELECTRA3.1e21 (1x)71.797.1 90.792.5 90.891.395.889.892.589.589.4
+ +# 3.4 LARGE MODELS + +We train big ELECTRA models to measure the effectiveness of the replaced token detection pretraining task at the large scale of current state-of-the-art pre-trained Transformers. Our ELECTRALarge models are the same size as BERT-Large but are trained for much longer. In particular, we train a model for $4 0 0 \mathrm { k }$ steps (ELECTRA-400K; roughly 1/4 the pre-training compute of RoBERTa) and one for 1.75M steps (ELECTRA-1.75M; similar compute to RoBERTa). We use a batch size 2048 and the XLNet pre-training data. We note that although the XLNet data is similar to the data used to train RoBERTa, the comparison is not entirely direct. As a baseline, we trained our own BERT-Large model using the same hyperparameters and training time as ELECTRA-400K. + +Results on the GLUE dev set are shown in Table 2. ELECTRA-400K performs comparably to RoBERTa and XLNet. However, it took less than 1/4 of the compute to train ELECTRA-400K as it did to train RoBERTa and XLNet, demonstrating that ELECTRA’s sample-efficiency gains hold at large scale. Training ELECTRA for longer (ELECTRA-1.75M) results in a model that outscores them on most GLUE tasks while still requiring less pre-training compute. Surprisingly, our baseline BERT model scores notably worse than RoBERTa-100K, suggesting our models may benefit from more hyperparameter tuning or using the RoBERTa training data. ELECTRA’s gains hold on the GLUE test set (see Table 3), although these comparisons are less apples-to-apples due to the additional tricks employed by the models (see Appendix B). + +Results on SQuAD are shown in Table 4. Consistent, with the GLUE results, ELECTRA scores better than masked-language-modeling-based methods given the same compute resources. For example, ELECTRA-400K outperforms RoBERTa-100k and our BERT baseline, which use similar amounts of pre-training compute. ELECTRA-400K also performs comparably to RoBERTa-500K despite using less than 1/4th of the compute. Unsurprisingly, training ELECTRA longer improves results further: ELECTRA-1.75M scores higher than previous models on the SQuAD 2.0 benchmark. ELECTRA-Base also yields strong results, scoring substantially better than BERT-Base and XLNet-Base, and even surpassing BERT-Large according to most metrics. ELECTRA generally performs better at SQuAD 2.0 than 1.1. Perhaps replaced token detection, in which the model distinguishes real tokens from plausible fakes, is particularly transferable to the answerability classification of SQuAD 2.0, in which the model must distinguish answerable questions from fake unanswerable questions. + +Table 4: Results on the SQuAD for non-ensemble models. + +
ModelTrain FLOPsParamsSQuAD 1.1 dev SQuAD 2.0 dev SQuAD 2.0 test
EMF1EMF1EMF1
BERT-Base6.4e19 (0.09x)110M80.888.51111
BERT1.9e20 (0.27x)335M84.190.979.081.880.083.0
SpanBERT7.1e20 (1x)335M88.894.685.788.785.788.7
XLNet-Base6.6e19 (0.09x)117M81.378.5
XLNet3.9e21 (5.4x)360M89.795.187.990.687.990.7
RoBERTa-100K6.4e20 (0.90x)356M94.087.7
RoBERTa-500K3.2e21 (4.5x)356M88.994.686.589.486.889.8
ALBERT3.1e22 (44x)235M89.394.887.490.288.190.9
BERT (ours)7.1e20 (1x)335M88.093.784.787.511
ELECTRA-Base6.4e19 (0.09x)110M84.590.880.583.311
ELECTRA-400K7.1e20 (1x)335M88.794.286.989.611
ELECTRA-1.75M3.1e21 (4.4x)335M89.794.988.090.688.791.4
+ +# 3.5 EFFICIENCY ANALYSIS + +We have suggested that posing the training objective over a small subset of tokens makes masked language modeling inefficient. However, it isn’t entirely obvious that this is the case. After all, the model still receives a large number of input tokens even though it predicts only a small number of masked tokens. To better understand where the gains from ELECTRA are coming from, we compare a series of other pre-training objectives that are designed to be a set of “stepping stones” between BERT and ELECTRA. + +• ELECTRA $15 \%$ : This model is identical to ELECTRA except the discriminator loss only comes from the $15 \%$ of the tokens that were masked out of the input. In other words, the sum in the discriminator loss $\mathcal { L } _ { \mathrm { D i s c } }$ is over $i \in m$ instead of from 1 to $n$ .7 • Replace MLM: This objective is the same as masked language modeling except instead of replacing masked-out tokens with [MASK], they are replaced with tokens from a generator model. This objective tests to what extent ELECTRA’s gains come from solving the discrepancy of exposing the model to [MASK] tokens during pre-training but not fine-tuning. All-Tokens MLM: Like in Replace MLM, masked tokens are replaced with generator samples. Furthermore, the model predicts the identity of all tokens in the input, not just ones that were masked out. We found it improved results to train this model with an explicit copy mechanism that outputs a copy probability $D$ for each token using a sigmoid layer. The model’s output distribution puts $D$ weight on the input token plus $1 - D$ times the output of the MLM softmax. This model is essentially a combination of BERT and ELECTRA. Note that without generator replacements, the model would trivially learn to make predictions from the vocabulary for [MASK] tokens and copy the input for other ones. + +Results are shown in Table 5. First, we find that ELECTRA is greatly benefiting from having a loss defined over all input tokens rather than just a subset: ELECTRA $15 \%$ performs much worse than ELECTRA. Secondly, we find that BERT performance is being slightly harmed from the pre-train fine-tune mismatch from [MASK] tokens, as Replace MLM slightly outperforms BERT. We note that BERT (including our implementation) already includes a trick to help with the pre-train/finetune discrepancy: masked tokens are replaced with a random token $10 \%$ of the time and are kept the same $10 \%$ of the time. However, our results suggest these simple heuristics are insufficient to fully solve the issue. Lastly, we find that All-Tokens MLM, the generative model that makes predictions over all tokens instead of a subset, closes most of the gap between BERT and ELECTRA. In total, these results suggest a large amount of ELECTRA’s improvement can be attributed to learning from all tokens and a smaller amount can be attributed to alleviating the pre-train fine-tune mismatch. + +Table 5: Compute-efficiency experiments (see text for details). + +
ModelELECTRAAll-Tokens MLMReplace MLMELECTRA15%BERT
GLUE score85.084.382.482.482.2
+ +![](images/363cbe93149c1143a30f9a380461435b22f5c38f19b24721396c0a75bddba398.jpg) +Figure 4: Left and Center: Comparison of BERT and ELECTRA for different model sizes. Right: A small ELECTRA model converges to higher downstream accuracy than BERT, showing the improvement comes from more than just faster training. + +The improvement of ELECTRA over All-Tokens MLM suggests that the ELECTRA’s gains come from more than just faster training. We study this further by comparing BERT to ELECTRA for various model sizes (see Figure 4, left). We find that the gains from ELECTRA grow larger as the models get smaller. The small models are trained fully to convergence (see Figure 4, right), showing that ELECTRA achieves higher downstream accuracy than BERT when fully trained. We speculate that ELECTRA is more parameter-efficient than BERT because it does not have to model the full distribution of possible tokens at each position, but we believe more analysis is needed to completely explain ELECTRA’s parameter efficiency. + +# 4 RELATED WORK + +Self-Supervised Pre-training for NLP Self-supervised learning has been used to learn word representations (Collobert et al., 2011; Pennington et al., 2014) and more recently contextual representations of words though objectives such as language modeling (Dai & Le, 2015; Peters et al., 2018; Howard & Ruder, 2018). BERT (Devlin et al., 2019) pre-trains a large Transformer (Vaswani et al., 2017) at the masked-language modeling task. There have been numerous extensions to BERT. For example, MASS (Song et al., 2019) and UniLM (Dong et al., 2019) extend BERT to generation tasks by adding auto-regressive generative training objectives. ERNIE (Sun et al., 2019a) and SpanBERT (Joshi et al., 2019) mask out contiguous sequences of token for improved span representations. This idea may be complementary to ELECTRA; we think it would be interesting to make ELECTRA’s generator auto-regressive and add a “replaced span detection” task. Instead of masking out input tokens, XLNet (Yang et al., 2019) masks attention weights such that the input sequence is autoregressively generated in a random order. However, this method suffers from the same inefficiencies as BERT because XLNet only generates $15 \%$ of the input tokens in this way. Like ELECTRA, XLNet may alleviate BERT’s pretrain-finetune discrepancy by not requiring [MASK] tokens, although this isn’t entirely clear because XLNet uses two “streams” of attention during pre-training but only one for fine-tuning. Recently, models such as TinyBERT (Jiao et al., 2019) and MobileBERT (Sun et al., 2019b) show that BERT can effectively be distilled down to a smaller model. In contrast, we focus more on pre-training speed rather than inference speed, so we train ELECTRA-Small from scratch. + +Generative Adversarial Networks GANs (Goodfellow et al., 2014) are effective at generating high-quality synthetic data. Radford et al. (2016) propose using the discriminator of a GAN in downstream tasks, which is similar to our method. GANs have been applied to text data (Yu et al., 2017; Zhang et al., 2017), although state-of-the-art approaches still lag behind standard maximumlikelihood training (Caccia et al., 2018; Tevet et al., 2018). Although we do not use adversarial learning, our generator is particularly reminiscent of MaskGAN (Fedus et al., 2018), which trains the generator to fill in tokens deleted from the input. + +Contrastive Learning Broadly, contrastive learning methods distinguish observed data points from fictitious negative samples. They have been applied to many modalities including text (Smith & Eisner, 2005), images (Chopra et al., 2005), and video (Wang & Gupta, 2015; Sermanet et al., 2017) data. Common approaches learn embedding spaces where related data points are similar (Saunshi et al., 2019) or models that rank real data points over negative samples (Collobert et al., 2011; Bordes et al., 2013). ELECTRA is particularly related to Noise-Contrastive Estimation (NCE) (Gutmann & Hyvarinen, 2010), which also trains a binary classifier to distinguish real and fake data points. ¨ + +Word2Vec (Mikolov et al., 2013), one of the earliest pre-training methods for NLP, uses contrastive learning. In fact, ELECTRA can be viewed as a massively scaled-up version of Continuous Bagof-Words (CBOW) with Negative Sampling. CBOW also predicts an input token given surrounding context and negative sampling rephrases the learning task as a binary classification task on whether the input token comes from the data or proposal distribution. However, CBOW uses a bag-ofvectors encoder rather than a transformer and a simple proposal distribution derived from unigram token frequencies instead of a learned generator. + +# 5 CONCLUSION + +We have proposed replaced token detection, a new self-supervised task for language representation learning. The key idea is training a text encoder to distinguish input tokens from high-quality negative samples produced by an small generator network. Compared to masked language modeling, our pre-training objective is more compute-efficient and results in better performance on downstream tasks. It works well even when using relatively small amounts of compute, which we hope will make developing and applying pre-trained text encoders more accessible to researchers and practitioners with less access to computing resources. We also hope more future work on NLP pre-training will consider efficiency as well as absolute performance, and follow our effort in reporting compute usage and parameter counts along with evaluation metrics. + +# ACKNOWLEDGEMENTS + +We thank Allen Nie, Prajit Ramachandran, audiences at the CIFAR LMB meeting and U. de Montreal, and the anonymous reviewers for their thoughtful comments and suggestions. We thank ´ Matt Peters for answering our questions about ELMo, Alec Radford for answers about GPT, Naman Goyal and Myle Ott for answers about RoBERTa, Zihang Dai for answers about XLNet, Zhenzhong Lan for answers about ALBERT, and Danqi Chen and Mandar Joshi for answers about SpanBERT. Kevin is supported by a Google PhD Fellowship. + +# REFERENCES + +Antoine Bordes, Nicolas Usunier, Alberto Garc´ıa-Duran, Jason Weston, and Oksana Yakhnenko. ´ Translating embeddings for modeling multi-relational data. In NeurIPS, 2013. + +Avishek Joey Bose, Huan Ling, and Yanshuai Cao. Adversarial contrastive estimation. In ACL, 2018. + +Massimo Caccia, Lucas Caccia, William Fedus, Hugo Larochelle, Joelle Pineau, and Laurent Charlin. Language GANs falling short. arXiv preprint arXiv:1811.02549, 2018. + +Jamie Callan, Mark Hoy, Changkuk Yoo, and Le Zhao. Clueweb09 data set, 2009. URL https: //lemurproject.org/clueweb09.php/. + +Daniel M. Cer, Mona T. Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. Semeval- ˜ 2017 task 1: Semantic textual similarity multilingual and crosslingual focused evaluation. In SemEval@ACL, 2017. +Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. CVPR, 2005. +Kevin Clark, Minh-Thang Luong, Urvashi Khandelwal, Christopher D. Manning, and Quoc V. Le. BAM! Born-again multi-task networks for natural language understanding. In ACL, 2019. +Ronan Collobert, Jason Weston, Leon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel P. ´ Kuksa. Natural language processing (almost) from scratch. JMLR, 2011. +Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In NeurIPS, 2015. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019. +William B. Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In IWP@IJCNLP, 2005. +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. Unified language model pre-training for natural language understanding and generation. In NeurIPS, 2019. +William Fedus, Ian J. Goodfellow, and Andrew M. Dai. MaskGAN: Better text generation via filling in the . In ICLR, 2018. +Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and William B. Dolan. The third pascal recognizing textual entailment challenge. In ACL-PASCAL@ACL, 2007. +Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In NeurIPS, 2014. +Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In AISTATS, 2010. +Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In ACL, 2018. +Shankar Iyer, Nikhil Dandekar, and Kornl Csernai. First Quora dataset release: Question pairs, 2017. URL https://data.quora.com/ First-Quora-Dataset-Release-Question-Pairs. +Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019. +Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. SpanBERT: Improving pre-training by representing and predicting spans. arXiv preprint arXiv:1907.10529, 2019. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. ALBERT: A lite bert for self-supervised learning of language representations. arXiv preprint arXiv:1909.11942, 2019. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized BERT pretraining approach. arXiv preprint arXiv:1907.11692, 2019. +Tomas Mikolov, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. In ICLR Workshop Papers, 2013. +Robert Parker, David Graff, Junbo Kong, Ke Chen, and Kazuaki Maeda. English gigaword, fifth edition. Technical report, Linguistic Data Consortium, Philadelphia, 2011. + +Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In EMNLP, 2014. + +Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In NAACL-HLT, 2018. + +Jason Phang, Thibault Fevry, and Samuel R Bowman. Sentence encoders on STILTs: Supplemen- ´ tary training on intermediate labeled-data tasks. arXiv preprint arXiv:1811.01088, 2018. + +Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016. + +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. https://blog.openai.com/language-unsupervised, 2018. + +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy S. Liang. Squad: 100, $0 0 0 +$ questions for machine comprehension of text. In EMNLP, 2016. + +Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. In ICML, 2019. + +Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, and Sergey Levine. Time-contrastive networks: Self-supervised learning from video. ICRA, 2017. + +Noah A. Smith and Jason Eisner. Contrastive estimation: Training log-linear models on unlabeled data. In ACL, 2005. + +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Y. $\mathrm { N g }$ and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In EMNLP, 2013. + +Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and Tie-Yan Liu. MASS: Masked sequence to sequence pre-training for language generation. In ICML, 2019. + +Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Xuyi Chen, Han Zhang, Xin Tian, Danxiang Zhu, Hao Tian, and Hua Wu. Ernie: Enhanced representation through knowledge integration. arXiv preprint arXiv:1904.09223, 2019a. + +Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. MobileBERT: Task-agnostic compression of bert for resource limited devices, 2019b. URL https: //openreview.net/forum?id $=$ SJxjVaNKwB. + +Guy Tevet, Gavriel Habib, Vered Shwartz, and Jonathan Berant. Evaluating text gans as language models. In NAACL-HLT, 2018. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017. + +Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In ICML, 2008. + +Alex Wang, Amapreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2019. + +Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. ICCV, 2015. + +Alex Warstadt, Amanpreet Singh, and Samuel R. Bowman. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471, 2018. + +Adina Williams, Nikita Nangia, and Samuel R. Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL-HLT, 2018. + +Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3-4):229–256, 1992. + +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. XLNet: Generalized autoregressive pretraining for language understanding. In NeurIPS, 2019. + +Lantao Yu, Weinan Zhang, Jun Wang, and Yingrui Yu. SeqGAN: Sequence generative adversarial nets with policy gradient. In AAAI, 2017. + +Yizhe Zhang, Zhe Gan, Kai Fan, Zhi Chen, Ricardo Henao, Dinghan Shen, and Lawrence Carin. Adversarial feature matching for text generation. In ICML, 2017. + +Yukun Zhu, Ryan Kiros, Richard S. Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. ICCV, 2015. + +# A PRE-TRAINING DETAILS + +The following details apply to both our ELECTRA models and BERT baselines. We mostly use the same hyperparameters as BERT. We set $\lambda$ , the weight for the discriminator objective in the loss to 50.8 We use dynamic token masking with the masked positions decided on-the-fly instead of during preprocessing. Also, we did not use the next sentence prediction objective proposed in the original BERT paper, as recent work has suggested it does not improve scores (Yang et al., 2019; Liu et al., 2019). For our ELECTRA-Large model, we used a higher mask percent (25 instead of 15) because we noticed the generator was achieving high accuracy with $15 \%$ masking, resulting in very few replaced tokens. We searched for the best learning rate for the Base and Small models out of [1e-4, 2e-4, 3e-4, 5e-4] and selected $\lambda$ out of [1, 10, 20, 50, 100] in early experiments. Otherwise we did no hyperparameter tuning beyond the experiments in Section 3.2. The full set of hyperparameters are listed in Table 6. + +# B FINE-TUNING DETAILS + +For Large-sized models, we used the hyperparameters from Clark et al. (2019) for the most part. However, after noticing that RoBERTa (Liu et al., 2019) uses more training epochs (up to 10 rather than 3) we searched for the best number of train epochs out of [10, 3] for each task. For SQuAD, we decreased the number of train epochs to 2 to be consistent with BERT and RoBERTa. For Basesized models we searched for a learning rate out of [3e-5, 5e-5, 1e-4, 1.5e-4] and the layer-wise learning-rate decay out of [0.9, 0.8, 0.7], but otherwise used the same hyperparameters as for Large models. We found the small models benefit from a larger learning rate and searched for the best one out of [1e-4, 2e-4, 3e-4, 5e-3]. With the exception of number of train epochs, we used the same hyperparameters for all tasks. In contrast, previous research on GLUE such as BERT, XLNet, and RoBERTa separately searched for the best hyperparameters for each task. We expect our results would improve slightly if we performed the same sort of additional hyperparameter search. The full set of hyperparameters is listed in Table 7. + +Following BERT, we do not show results on the WNLI GLUE task for the dev set results, as it is difficult to beat even the majority classifier using a standard fine-tuning-as-classifier approach. For the GLUE test set results, we apply the standard tricks used by many of the GLUE leaderboard submissions including RoBERTa (Liu et al., 2019), XLNet (Yang et al., 2019), and ALBERT (Lan et al., 2019). Specifically: + +• For RTE and STS we use intermediate task training (Phang et al., 2018), starting from an ELECTRA checkpoint that has been fine-tuned on MNLI. For RTE, we found it helpful to combine this with a lower learning rate of 2e-5. + +Table 6: Pre-train hyperparameters. We also train an ELECTRA-Large model for 1.75M steps (other hyperparameters are identical). + +
HyperparameterSmallBaseLarge
Number of layers121224
Hidden Size2567681024
FFN inner hidden size102430724096
Attention heads41216
Attention head size646464
Embedding Size1287681024
Generator Size (multiplier for hidden-size, FFN-size,and num-attention-heads)1/41/31/4
Mask percent151525
Learning Rate DecayLinearLinearLinear
Warmup steps100001000010000
Learning Rate5e-42e-42e-4
Adam e1e-61e-61e-6
Adam β10.90.90.9
Adam β20.9990.9990.999
Attention Dropout0.10.10.1
Dropout0.10.10.1
Weight Decay0.010.010.01
Batch Size128
Train Steps (BERT/ELECTRA)1.45M/1M256 1M/766K2048 464K/400K
+ +Table 7: Fine-tune hyperparameters + +
HyperparameterGLUE Value
Learning Rate3e-4 for Small, 1e-4 for Base,5e-5 for Large
Adam e1e-6
Adam β10.9
Adam β20.999
Layerwise LR decay0.8 for Base/Small, O.9 for Large
Learning rate decayLinear
Warmup fraction0.1
Attention Dropout0.1
Dropout0.1
Weight Decay0
Batch Size32
Train Epochs10 for RTE and STS,2for SQuAD,3 for other tasks
+ +• For WNLI, we follow the trick described in Liu et al. (2019) where we extract candidate antecedents for the pronoun using rules and train a model to score the correct antecedent highly. However, different from Liu et al. (2019), the scoring function is not based on MLM probabilities. Instead, we fine-tune ELECTRA’s discriminator so it assigns high scores to the tokens of the correct antecedent when the correct antecedent replaces the pronoun. For example, if the Winograd schema is “the trophy could not fit in the suitcase because it was too big,” we train the discriminator so it gives a high score to “trophy” in “the trophy could not fit in the suitcase because the trophy was too big” but a low score to “suitcase” in “the trophy could not fit in the suitcase because the suitcase was too big.” • For each task we ensemble the best 10 of 30 models fine-tuned with different random seeds but initialized from the same pre-trained checkpoint. + +While these tricks do improve scores, they make having clear scientific comparisons more difficult because they require extra work to implement, require lots of compute, and make results less applesto-apples because different papers implement the tricks differently. We therefore also report results for ELECTRA-1.75M with the only trick being dev-set model selection (best of 10 models), which is the setting BERT used to report results, in Table 8. + +For our SQuAD 2.0 test set submission, we fine-tuned 20 models from the same pre-trained checkpoint and submitted the one with the best dev set score. + +# C DETAILS ABOUT GLUE + +We provide further details about the GLUE benchmark tasks below + +• CoLA: Corpus of Linguistic Acceptability (Warstadt et al., 2018). The task is to determine whether a given sentence is grammatical or not. The dataset contains $8 . 5 \mathrm { k }$ train examples from books and journal articles on linguistic theory. +SST: Stanford Sentiment Treebank (Socher et al., 2013). The tasks is to determine if the sentence is positive or negative in sentiment. The dataset contains $6 7 \mathrm { k }$ train examples from movie reviews. +• MRPC: Microsoft Research Paraphrase Corpus (Dolan & Brockett, 2005). The task is to +predict whether two sentences are semantically equivalent or not. The dataset contains $3 . 7 \mathrm { k }$ train examples from online news sources. +• STS: Semantic Textual Similarity (Cer et al., 2017). The tasks is to predict how semantically similar two sentences are on a 1-5 scale. The dataset contains $5 . 8 \mathrm { k }$ train examples drawn from new headlines, video and image captions, and natural language inference data. +QQP: Quora Question Pairs (Iyer et al., 2017). The task is to determine whether a pair of questions are semantically equivalent. The dataset contains $3 6 4 \mathrm { k }$ train examples from the community question-answering website Quora. +• MNLI: Multi-genre Natural Language Inference (Williams et al., 2018). Given a premise sentence and a hypothesis sentence, the task is to predict whether the premise entails the hypothesis, contradicts the hypothesis, or neither. The dataset contains $3 9 3 \mathrm { k }$ train examples drawn from ten different sources. +• QNLI: Question Natural Language Inference; constructed from SQuAD (Rajpurkar et al., 2016). The task is to predict whether a context sentence contains the answer to a question sentence. The dataset contains $1 0 8 \mathrm { k }$ train examples from Wikipedia. +RTE: Recognizing Textual Entailment (Giampiccolo et al., 2007). Given a premise sentence and a hypothesis sentence, the task is to predict whether the premise entails the hypothesis or not. The dataset contains $2 . 5 \mathrm { k }$ train examples from a series of annual textual entailment challenges. + +# D FURTHER RESULTS ON GLUE + +We report results for ELECTRA-Base and ELECTRA-Small on the GLUE test set in Table 8. Furthermore, we push the limits of base-sized and small-sized models by training them on the XLNet data instead of wikibooks and for much longer (4e6 train steps); these models are called ELECTRA-Base $^ { + + }$ and ELECTRA-Smal $^ { + + }$ in the table. For ELECTRA-Small $^ { + + }$ we also increased the sequence length to 512; otherwise the hyperparameters are the same as the ones listed in Table 6. Lastly, the table contains results for ELECTRA-1.75M without the tricks described in Appendix B. Consistent with dev-set results in the paper, ELECTRA-Base outperforms BERT-Large while ELECTRA-Small outperforms GPT in terms of average score. Unsurprisingly, the $^ { + + }$ models perform even better. The small model scores are even close to TinyBERT (Jiao et al., 2019) and MobileBERT (Sun et al., 2019b). These models learn from BERT-Base using sophisticated distillation procedures. Our ELECTRA models, on the other hand, are trained from scratch. Given the success of distilling BERT, we believe it would be possible to build even stronger small pre-trained models by distilling ELECTRA. ELECTRA appears to be particularly effective at CoLA. In CoLA the goal is to distinguish linguistically acceptable sentences from ungrammatical ones, which fairly closely matches ELECTRA’s pre-training task of identifying fake tokens, perhaps explaining ELECTRA’s strength at the task. + +
ModelTrain FLOPsParams CoLA SST MRPC STSQQP MNLI QNLI RTEAvg.
TinyBERT6.4e19+ (45x+)14.5M51.193.1 82.683.789.1 84.690.470.080.6
MobileBERT6.4e19+ (45x+)25.3M51.192.6 84.584.888.3 84.391.670.481.0
GPT4.0e19 (29x)117M45.491.3 75.780.088.5 82.188.156.075.9
BERT-Base6.4e19 (45x)110M52.193.5 84.885.889.2 84.690.566.480.9
BERT-Large1.9e20 (135x)335M60.594.9 85.486.589.3 86.792.770.183.3
SpanBERT7.1e20 (507x)335M64.394.8 87.989.989.5 87.794.379.085.9
ELECTRA-Small1.4e18 (1x)14M54.689.1 83.780.388.0 79.787.760.878.0
ELECTRA-Small++3.3e19 (18x)14M55.691.1 84.984.688.0 81.688.363.679.7
ELECTRA-Base6.4e19 (45x)110M59.793.4 86.787.789.1 85.892.773.183.5
ELECTRA-Base++3.3e20 (182x)110M64.696.0 88.190.289.5 88.593.175.285.7
ELECTRA-1.75M3.1e21 (2200x)330M68.196.7 89.291.7 90.490.795.586.188.6
+ +Table 8: Results for models on the GLUE test set. Only models with single-task finetuning (no ensembling, task-specific tricks, etc.) are shown. + +# E COUNTING FLOPS + +We chose to measure compute usage in terms of floating point operations (FLOPs) because it is a measure agnostic to the particular hardware, low-level optimizations, etc. However, it is worth noting that in some cases abstracting away hardware details is a drawback because hardware-centered optimizations can be key parts of a model’s design, such as the speedup ALBERT (Lan et al., 2019) gets by tying weights and thus reducing communication overhead between TPU workers. We used TensorFlow’s FLOP-counting capabilities9 and checked the results with by-hand computation. We made the following assumptions: + +• An “operation” is a mathematical operation, not a machine instruction. For example, an exp is one op like an add, even though in practice the exp might be slower. We believe this assumption does not substantially change compute estimates because matrix-multiplies dominate the compute for most models. Similarly, we count matrix-multiplies as $2 * m * n$ FLOPs instead of $m * n$ as one might if considering fused multiply-add operations. The backwards pass takes the same number of FLOPs as the forward pass. This assumption is not exactly right (e.g., for softmax cross entropy loss the backward pass is faster), but importantly, the forward/backward pass FLOPs really are the same for matrix-multiplies, which is most of the compute anyway. We assume “dense” embedding lookups (i.e., multiplication by a one-hot vector). In practice, sparse embedding lookups are much slower than constant time; on some hardware accelerators dense operations are actually faster than sparse lookups. + +# F ADVERSARIAL TRAINING + +Here we detail attempts to adversarially train the generator instead of using maximum likelihood. In particular we train the generator $G$ to maximize the discriminator loss $\mathcal { L } _ { \mathrm { D i s c } }$ . As our discriminator isn’t precisely the same as the discriminator of a GAN (see the discussion in Section 2), this method is really an instance of Adversarial Contrastive Estimation (Bose et al., 2018) rather than Generative Adversarial Training. It is not possible to adversarially train the generator by back-propagating through the discriminator (e.g., as in a GAN trained on images) due to the discrete sampling from the generator, so we use reinforcement learning instead. + +Our generator is different from most text generation models in that it is non-autogregressive: predictions are made independently. In other words, rather than taking a sequence of actions where each action generates a token, the generator takes a single giant action of generating all tokens simultaneously, where the probability for the action factorizes as the product of generator probabilities for each token. To deal with this enormous action space, we make the following simplifying assumption: that the discriminator’s prediction $D ( \pmb { x } ^ { \mathrm { c o r r u p t } } , t )$ depends only on the token $x _ { t }$ and the non-replaced tokens $\{ x _ { i } : i \notin m \}$ , i.e., it does not depend on other generated tokens $\{ \hat { x } _ { i } : i \in m \land i \neq t \}$ . This isn’t too bad of an assumption because a relatively small number of tokens are replaced, and it greatly simplifies credit assignment when using reinforcement learning. Notationally, we show this assumption by (in a slight abuse of notation) by writing $D ( \hat { x } _ { t } | \pmb { x } ^ { \mathrm { m a s \bar { k } e d } } )$ for the discriminator predicting whether the generated token $\hat { x } _ { t }$ equals the original token $x _ { t }$ given the masked context $\bar { \boldsymbol { x } } ^ { \mathrm { m a s k e d } }$ . A useful consequence of this assumption is that the discriminator score for non-replaced tokens $( D ( x _ { t } | x ^ { \mathrm { m a s k e d } } )$ for $t \not \in m ,$ ) is independent of $p _ { G }$ because we are assuming it does not depend on any replaced token. Therefore these tokens can be ignored when training $G$ to maximize $\bar { \mathcal { L } } _ { \mathrm { D i s c } }$ . During training we seek to find + +$$ +\underset { \theta _ { G } } { \arg \operatorname* { m a x } } \mathcal { L } _ { \mathrm { D i s c } } = \underset { \theta _ { G } } { \arg \operatorname* { m a x } } \ \underset { { \boldsymbol x } , m , \hat { \boldsymbol x } } { \mathbb { E } } \left( \sum _ { t = 1 } ^ { n } - { \mathbb { I } } ( x _ { t } ^ { \mathrm { c o r u p t } } = x _ { t } ) \log D ( { \boldsymbol x } ^ { \mathrm { c o r u p t } } , t ) - \right. +$$ + +Using the simplifying assumption, we approximate the above by finding the argmax of + +$$ +\begin{array} { r l } & { \quad \underset { x , m , \hat { x } } { \mathbb { E } } \left( \displaystyle \sum _ { t \in m } - \mathbb { 1 } \left( \hat { x } _ { t } = x _ { t } \right) \log D ( \hat { x } | x ^ { \mathrm { m a s k e d } } ) - \mathbb { 1 } \big ( \hat { x } _ { t } \neq x _ { t } \big ) \log \big ( 1 - D ( \hat { x } | x ^ { \mathrm { m a s k e d } } ) \big ) \right) } \\ & { = \underset { x , m } { \mathbb { E } } \displaystyle \sum _ { t \in m } \sum _ { \hat { x } _ { t } \sim p _ { G } } \mathbb { E } \left( \hat { x } _ { t } , x \right) } \end{array} +$$ + +In short, the simplifying assumption allows us to decompose the loss over the individual generated tokens. We cannot directly find arg $\operatorname* { m a x } _ { \theta _ { G } }$ using gradient ascent because it is impossible to backpropagate through discrete sampling of $\hat { x }$ . Instead, we use policy gradient reinforcement learning (Williams, 1992). In particular, we use the REINFORCE gradient + +$$ +\nabla _ { \theta _ { G } } \mathcal { L } _ { \mathrm { D i s c } } \approx \underset { x , m } { \mathbb { E } } \sum _ { t \in m } \underset { \dot { x } _ { t } \sim p _ { G } } { \mathbb { E } } \nabla _ { \theta _ { g } } \log p _ { G } ( \hat { x } _ { t } | x ^ { \mathrm { m a s k e d } } ) [ R ( \hat { x } _ { t } , x ) - b ( x ^ { \mathrm { m a s k e d } } , t ) ] +$$ + +Where $b$ is a learned baseline implemented as $b ( \pmb { x } ^ { \mathrm { m a s k e d } } , t ) \ = \ - \log \mathrm { s i g m o i d } ( \omega ^ { T } h _ { G } ( \pmb { x } ^ { \mathrm { m a s k e d } } ) _ { t } )$ where $h _ { G } ( \pmb { x } ^ { \mathrm { m a s k e d } } )$ are the outputs of the generator’s Transformer encoder. The baseline is trained with cross-entropy loss to match the reward for the corresponding position. We approximate the expectations with a single sample and learn $\theta _ { G }$ with gradient ascent. Despite receiving no explicit feedback about which generated tokens are correct, we found the adversarial training resulted in a fairly accurate generator (for a 256-hidden-size generator, the adversarially trained one achieves $58 \%$ accuracy at masked language modeling while the same sized MLE generator gets $65 \%$ ). However, using this generator did not improve over the MLE-trained one on downstream tasks (see the right of Figure 3 in the main paper). + +# G EVALUATING ELECTRA AS A MASKED LANGUAGE MODEL + +This sections details some initial experiments in evaluating ELECTRA as a masked language model. Using slightly different notation from the main paper, given a context $c$ consisting of a text sequence with one token $x$ masked-out, the discriminator loss can be written as + +$$ +\begin{array} { l l } { \dot { \mathrm { \tiny ~ \cdot p i s c } } = - \displaystyle \sum _ { x \in \mathrm { v o c a b } } \Big ( ( 1 - p _ { \mathrm { m a s k } } ) p _ { \mathrm { d a t a } } ( x | c ) \log D ( x , c ) + } & { \mathrm { / / u n m a s k e d ~ t o k e n } } \\ { ~ } \\ { p _ { \mathrm { m a s k } } p _ { \mathrm { d a t a } } ( x | c ) p _ { G } ( x | c ) \log D ( x , c ) + } & { \mathrm { / / g e n e r a t o r ~ s a m p l e s ~ c o r r e c t ~ t o k e n } } \\ { p _ { \mathrm { m a s k } } ( 1 - p _ { \mathrm { d a t a } } ( x | c ) ) p _ { G } ( x | c ) \log ( 1 - D ( x , c ) ) \Big ) } & { \mathrm { / / g e n e r a t o r ~ s a m p l e s ~ i n c o r r e c t ~ t o k e n } . } \end{array} +$$ + +Finding the critical points of this loss with respect to $D$ shows that for a fixed generator the optimal discriminator is + +$$ +D ( x , c ) = p _ { \mathrm { d a t a } } ( x | c ) ( a + p _ { G } ( x | c ) ) / ( a p _ { \mathrm { d a t a } } ( x | c ) + p _ { G } ( x | c ) ) +$$ + +which means + +$$ +p _ { \mathrm { d a t a } } ( x | c ) = D ( x , c ) p _ { G } ( x | c ) / ( a ( 1 - D ( x , c ) ) + p _ { G } ( x | c ) ) +$$ + +where $a ~ = ~ ( 1 ~ - ~ p _ { \mathrm { m a s k } } ) / p _ { \mathrm { m a s k } }$ is the number of unmasked tokens for every masked token. We can use this expression to evaluate ELECTRA as a masked language model by selecting $\mathrm { a r g m a x } _ { x \in \mathrm { v o c a b } } D ( x , \bar { c } ) p _ { G } ( x | c ) / ( a ( 1 - D ( x , c ) ) + p _ { G } ( x | c ) )$ as the model’s prediction for a given context. In practice, selecting over the whole vocabulary is very expensive, so we instead take the argmax over the top 100 predictions from the generator.10 Using this method, we compared ELECTRA-Base and BERT-Base on the Wikipedia+BooksCorpus dataset. We found that BERT slightly outperformed ELECTRA at masked language modeling $7 7 . 9 \%$ vs $7 5 . 5 \%$ accuracy). It is possible that the assumption of an optimal discriminator, which is certainly far from correct, is harming ELECTRA’s accuracy under this evaluation scheme. However, perhaps it is not too surprising that a model like BERT that is trained specifically for generation performs better at generation while a model with a discriminative objective like ELECTRA is better at being fine-tuned on discriminative tasks. We think comparisons of BERT’s and ELECTRA’s MLM predictions might be an interesting way to uncover more about the differences between ELECTRA and BERT encoders in future work. + +# H NEGATIVE RESULTS + +We briefly describe a few ideas that did not look promising in our initial experiments: + +• We initially attempted to make BERT more efficient by strategically masking-out tokens (e.g., masking our rarer tokens more frequently, or training a model to guess which tokens BERT would struggle to predict if they were masked out). This resulted in fairly minor speedups over regular BERT. +• Given that ELECTRA seemed to benefit (up to a certain point) from having a weaker generator (see Section 3.2), we explored raising the temperature of the generator’s output softmax or disallowing the generator from sampling the correct token. Neither of these improved results. +• We tried adding a sentence-level contrastive objective. For this task, we kept $20 \%$ of input sentences unchanged rather than noising them with the generator. We then added a prediction head to the model that predicted if the entire input was corrupted or not. Surprisingly, this slightly decreased scores on downstream tasks. \ No newline at end of file diff --git a/md/train/rJ8uNptgl/rJ8uNptgl.md b/md/train/rJ8uNptgl/rJ8uNptgl.md new file mode 100644 index 0000000000000000000000000000000000000000..c694fb7e4465e32819187759d9098667b1e59262 --- /dev/null +++ b/md/train/rJ8uNptgl/rJ8uNptgl.md @@ -0,0 +1,391 @@ +# TOWARDS THE LIMIT OF NETWORK QUANTIZATION + +Yoojin Choi, Mostafa El-Khamy, and Jungwon Lee Samsung US R&D Center, San Diego, CA 92121, USA {yoojin.c,mostafa.e,jungwon2.lee}@samsung.com + +# ABSTRACT + +Network quantization is one of network compression techniques to reduce the redundancy of deep neural networks. It reduces the number of distinct network parameter values by quantization in order to save the storage for them. In this paper, we design network quantization schemes that minimize the performance loss due to quantization given a compression ratio constraint. We analyze the quantitative relation of quantization errors to the neural network loss function and identify that the Hessian-weighted distortion measure is locally the right objective function for the optimization of network quantization. As a result, Hessian-weighted $\mathbf { k }$ -means clustering is proposed for clustering network parameters to quantize. When optimal variable-length binary codes, e.g., Huffman codes, are employed for further compression, we derive that the network quantization problem can be related to the entropy-constrained scalar quantization (ECSQ) problem in information theory and consequently propose two solutions of ECSQ for network quantization, i.e., uniform quantization and an iterative solution similar to Lloyd’s algorithm. Finally, using the simple uniform quantization followed by Huffman coding, we show from our experiments that the compression ratios of 51.25, 22.17 and 40.65 are achievable for LeNet, 32-layer ResNet and AlexNet, respectively. + +# 1 INTRODUCTION + +Deep neural networks have emerged to be the state-of-the-art in the field of machine learning for image classification, object detection, speech recognition, natural language processing, and machine translation (LeCun et al., 2015). The substantial progress of neural networks however comes with high cost of computations and hardware resources resulting from a large number of parameters. For example, Krizhevsky et al. (2012) came up with a deep convolutional neural network consisting of 61 million parameters and won the ImageNet competition in 2012. It is followed by deeper neural networks with even larger numbers of parameters, e.g., Simonyan & Zisserman (2014). + +The large sizes of deep neural networks make it difficult to deploy them on resource-limited devices, e.g., mobile or portable devices, and network compression is of great interest in recent years to reduce computational cost and memory requirements for deep neural networks. Our interest in this paper is mainly on curtailing the size of the storage (memory) for network parameters (weights and biases). In particular, we focus on the network size compression by reducing the number of distinct network parameters by quantization. + +Besides network quantization, network pruning has been studied for network compression to remove redundant parameters permanently from neural networks (Mozer & Smolensky, 1989; LeCun et al., 1989; Hassibi & Stork, 1993; Han et al., 2015b; Lebedev & Lempitsky, 2016; Wen et al., 2016). Matrix/tensor factorization and low-rank approximation have been investigated as well to find more efficient representations of neural networks with a smaller number of parameters and consequently to save computations (Sainath et al., 2013; Xue et al., 2013; Jaderberg et al., 2014; Lebedev et al., 2014; Yang et al., 2015; Liu et al., 2015; Kim et al., 2015; Tai et al., 2015; Novikov et al., 2015). Moreover, similar to network quantization, low-precision network implementation has been examined in Vanhoucke et al. (2011); Courbariaux et al. (2014); Anwar et al. (2015); Gupta et al. (2015); Lin et al. (2015a). Some extremes of low-precision neural networks consisting of binary or ternary parameters can be found in Courbariaux et al. (2015); Lin et al. (2015b); Rastegari et al. (2016). We note that these are different types of network compression techniques, which can be employed on top of each other. + +The most related work to our investigation in this paper can be found in Gong et al. (2014); Han et al. (2015a), where a conventional quantization method using k-means clustering is employed for network quantization. This conventional approach however is proposed with little consideration for the impact of quantization errors on the neural network performance loss and no effort to optimize the quantization procedure for a given compression ratio constraint. In this paper, we reveal the suboptimality of this conventional method and newly design quantization schemes for neural networks. In particular, we formulate an optimization problem to minimize the network performance loss due to quantization given a compression ratio constraint and find efficient quantization methods for neural networks. + +The main contribution of the paper can be summarized as follows: + +• It is derived that the performance loss due to quantization in neural networks can be quantified approximately by the Hessian-weighted distortion measure. Then, Hessian-weighted $\mathbf { k }$ -means clustering is proposed for network quantization to minimize the performance loss. It is identified that the optimization problem for network quantization provided a compression ratio constraint can be reduced to an entropy-constrained scalar quantization (ECSQ) problem when optimal variable-length binary coding is employed after quantization. Two efficient heuristic solutions for ECSQ are proposed for network quantization, i.e., uniform quantization and an iterative solution similar to Lloyd’s algorithm. • As an alternative of Hessian, it is proposed to utilize some function (e.g., square root) of the second moment estimates of gradients when the Adam (Kingma & Ba, 2014) stochastic gradient decent (SGD) optimizer is used in training. The advantage of using this alternative is that it is computed while training and can be obtained at the end of training at no additional cost. • It is shown how the proposed network quantization schemes can be applied for quantizing network parameters of all layers together at once, rather than layer-by-layer network quantization in Gong et al. (2014); Han et al. (2015a). This follows from our investigation that Hessian-weighting can handle the different impact of quantization errors properly not only within layers but also across layers. Moreover, quantizing network parameters of all layers together, one can even avoid layer-by-layer compression rate optimization. + +The rest of the paper is organized as follows. In Section 2, we define the network quantization problem and review the conventional quantization method using $\mathbf { k }$ -means clustering. Section 3 discusses Hessian-weighted network quantization. Our entropy-constrained network quantization schemes follow in Section 4. Finally, experiment results and conclusion can be found in Section 5 and Section 6, respectively. + +# 2 NETWORK QUANTIZATION + +We consider a neural network that is already trained, pruned if employed and fine-tuned before quantization. If no network pruning is employed, all parameters in a network are subject to quantization. For pruned networks, our focus is on quantization of unpruned parameters. + +The goal of network quantization is to quantize (unpruned) network parameters in order to reduce the size of the storage for them while minimizing the performance degradation due to quantization. For network quantization, network parameters are grouped into clusters. Parameters in the same cluster share their quantized value, which is the representative value (i.e., cluster center) of the cluster they belong to. After quantization, lossless binary coding follows to encode quantized parameters into binary codewords to store instead of actual parameter values. Either fixed-length binary coding or variable-length binary coding, e.g., Huffman coding, can be employed to this end. + +# 2.1 COMPRESSION RATIO + +Suppose that we have total $N$ parameters in a neural network. Before quantization, each parameter is assumed to be of $b$ bits. For quantization, we partition the network parameters into $k$ clusters. Let $\mathcal { C } _ { i }$ be the set of network parameters in cluster $i$ and let $b _ { i }$ be the number of bits of the codeword assigned to the network parameters in cluster $i$ for $1 \leq i \leq k$ . For a lookup table to decode quantized values from their binary encoded codewords, we store $k$ binary codewords $b _ { i }$ bits for $1 \leq i \leq k$ ) and corresponding quantized values ( $b$ bits for each). The compression ratio is then given by + +$$ +{ \mathrm { C o m p r e s s i o n ~ r a t i o } } = { \frac { N b } { \sum _ { i = 1 } ^ { k } ( | { \mathcal { C } } _ { i } | + 1 ) b _ { i } + k b } } . +$$ + +Observe in (1) that the compression ratio depends not only on the number of clusters but also on the sizes of the clusters and the lengths of the binary codewords assigned to them, in particular, when a variable-length code is used for encoding quantized values. For fixed-length codes, however, all codewords are of the same length, i.e., $b _ { i } = \lceil \log _ { 2 } k \rceil$ for all $1 \leq i \leq k$ , and thus the compression ratio is reduced to only a function of the number of clusters, i.e., $k$ , assuming that $N$ and $b$ are given. + +# 2.2 K-MEANS CLUSTERING + +Provided network parameters $\{ w _ { i } \} _ { i = 1 } ^ { N }$ to quantize, $\mathbf { k }$ -means clustering partitions them into $k$ disjoint sets (clusters), denoted by $\mathcal { C } _ { 1 } , \mathcal { C } _ { 2 } , \ldots , \mathcal { C } _ { k }$ , while minimizing the mean square quantization error (MSQE) as follows: + +$$ +\operatorname * { a r g m i n } _ { \mathcal { C } _ { 1 } , \mathcal { C } _ { 2 } , \ldots , \mathcal { C } _ { k } } \sum _ { i = 1 } ^ { k } \sum _ { w \in \mathcal { C } _ { i } } | w - c _ { i } | ^ { 2 } , \mathrm { ~ w h e r e ~ } c _ { i } = \frac { 1 } { | \mathcal { C } _ { i } | } \sum _ { w \in \mathcal { C } _ { i } } w . +$$ + +We observe two issues with employing $\mathbf { k }$ -means clustering for network quantization. + +• First, although $\mathbf { k }$ -means clustering minimizes the MSQE, it does not imply that $\mathbf { k }$ -means clustering minimizes the performance loss due to quantization as well in neural networks. K-means clustering treats quantization errors from all network parameters with equal importance. However, quantization errors from some network parameters may degrade the performance more significantly that the others. Thus, for minimizing the loss due to quantization in neural networks, one needs to take this dissimilarity into account. Second, $\mathbf { k }$ -means clustering does not consider any compression ratio constraint. It simply minimizes its distortion measure for a given number of clusters, i.e., for $k$ clusters. This is however suboptimal when variable-length coding follows since the compression ratio depends not only on the number of clusters but also on the sizes of the clusters and assigned codeword lengths to them, which are determined by the binary coding scheme employed after clustering. Therefore, for the optimization of network quantization given a compression ratio constraint, one need to take the impact of binary coding into account, i.e., we need to solve the quantization problem under the actual compression ratio constraint imposed by the specific binary coding scheme employed after clustering. + +# 3 HESSIAN-WEIGHTED NETWORK QUANTIZATION + +In this section, we analyze the impact of quantization errors on the neural network loss function and derive that the Hessian-weighted distortion measure is a relevant objective function for network quantization in order to minimize the quantization loss locally. Moreover, from this analysis, we propose Hessian-weighted $\mathbf { k }$ -means clustering for network quantization to minimize the performance loss due to quantization in neural networks. + +# 3.1 NETWORK MODEL + +We consider a general non-linear neural network that yields output $\mathbf { y } = f ( \mathbf { x } ; \mathbf { w } )$ from input x, where $\mathbf { w } = [ w _ { 1 } ~ \cdots ~ \bar { w } _ { N } ] ^ { T }$ is the vector consisting of all trainable network parameters in the network; $N$ is the total number of trainable parameters in the network. A loss function $l o s s ( \mathbf { y } , \hat { \mathbf { y } } )$ is defined as the objective function that we aim to minimize in average, where $\hat { \mathbf { y } } = \hat { \mathbf { y } } ( \mathbf { x } )$ is the expected (groundtruth) output for input $\mathbf { x }$ . Cross entropy or mean square error are typical examples of a loss function. Given a training data set $\mathcal { X } _ { \mathrm { t r a i n } }$ , we optimize network parameters by solving the following problem, e.g., approximately by using a stochastic gradient descent (SGD) method with mini-batches: + +$$ +\hat { \mathbf { w } } = \operatorname * { a r g m i n } _ { \mathbf { w } } L ( \mathcal { X } _ { \mathrm { t r a i n } } ; \mathbf { w } ) , \quad \mathrm { w h e r e } \quad L ( \mathcal { X } ; \mathbf { w } ) = \frac { 1 } { | \mathcal { X } | } \sum _ { \mathbf { x } \in \mathcal { X } } l o s s ( f ( \mathbf { x } ; \mathbf { w } ) , \hat { \mathbf { y } } ( \mathbf { x } ) ) . +$$ + +# 3.2 HESSIAN-WEIGHTED QUANTIZATION ERROR + +The average loss function $L ( \mathcal { X } ; { \mathbf w } )$ can be expanded by Taylor series with respect to w as follows: + +$$ +\delta L ( \mathcal { X } ; \mathbf { w } ) = \mathbf { g } ( \mathbf { w } ) ^ { T } \delta \mathbf { w } + \frac { 1 } { 2 } \delta \mathbf { w } ^ { T } \mathbf { H } ( \mathbf { w } ) \delta \mathbf { w } + O ( \| \delta \mathbf { w } \| ^ { 3 } ) , +$$ + +where + +$$ +\mathbf { g } ( \mathbf { w } ) = \frac { \partial L ( \boldsymbol { \chi } ; \mathbf { w } ) } { \partial \mathbf { w } } , ~ \mathbf { H } ( \mathbf { w } ) = \frac { \partial ^ { 2 } L ( \boldsymbol { \chi } ; \mathbf { w } ) } { \partial \mathbf { w } ^ { 2 } } ; +$$ + +the square matrix $\mathbf { H } ( \mathbf { w } )$ consisting of second-order partial derivatives is called as Hessian matrix or Hessian. Assume that the loss function has reached to one of its local minima, at $\mathbf { w } = \hat { \mathbf { w } }$ , after training. At local minima, gradients are all zero, i.e., we have $\mathbf { g } ( \hat { \mathbf { w } } ) = \mathbf { 0 }$ , and thus the first term in the right-hand side of (3) can be neglected at $\mathbf { w } = \hat { \mathbf { w } }$ . The third term in the right-hand side of (3) is also ignored under the assumption that the average loss function is approximately quadratic at the local minimum $\mathbf { w } = \hat { \mathbf { w } }$ . Finally, for simplicity, we approximate the Hessian matrix as a diagonal matrix by setting its off-diagonal terms to be zero. Then, it follows from (3) that + +$$ +\delta L ( \mathcal { X } ; \hat { \mathbf { w } } ) \approx \frac { 1 } { 2 } \sum _ { i = 1 } ^ { N } h _ { i i } ( \hat { \mathbf { w } } ) | \delta \hat { w } _ { i } | ^ { 2 } , +$$ + +where $h _ { i i } ( \hat { \mathbf { w } } )$ is the second-order partial derivative of the average loss function with respect to $w _ { i }$ evaluated at $\mathbf { w } = \hat { \mathbf { w } }$ , which is the $i$ -th diagonal element of the Hessian matrix $\mathbf { H } ( \hat { \mathbf { w } } )$ . + +Now, we connect (4) with the problem of network quantization by treating $\delta \hat { w } _ { i }$ as the quantization error of network parameter $w _ { i }$ at its local optimum $w _ { i } = \hat { w } _ { i }$ , i.e., + +$$ +\delta { \hat { w } } _ { i } = { \bar { w } } _ { i } - { \hat { w } } _ { i } , +$$ + +where $\bar { w } _ { i }$ is a quantized value of $\hat { w } _ { i }$ . Finally, combining (4) and (5), we derive that the local impact of quantization on the average loss function at $\mathbf { w } = \hat { \mathbf { w } }$ can be quantified approximately as follows: + +$$ +\delta L ( \mathcal { X } ; \hat { \mathbf { w } } ) \approx \frac { 1 } { 2 } \sum _ { i = 1 } ^ { N } h _ { i i } ( \hat { \mathbf { w } } ) | \hat { w } _ { i } - \bar { w } _ { i } | ^ { 2 } . +$$ + +At a local minimum, the diagonal elements of Hessian, i.e., $h _ { i i } ( \hat { \mathbf { w } } )$ ’s, are all non-negative and thus the summation in (6) is always additive, implying that the average loss function either increases or stays the same. Therefore, the performance degradation due to quantization of a neural network can be measured approximately by the Hessian-weighted distortion as shown in (6). Further discussion on the Hessian-weighted distortion measure can be found in Appendix A.1. + +# 3.3 HESSIAN-WEIGHTED K-MEANS CLUSTERING + +For notational simplicity, we use $w _ { i } \equiv \hat { w } _ { i }$ and $h _ { i i } \equiv h _ { i i } ( \hat { \mathbf { w } } )$ from now on. The optimal clustering that minimizes the Hessian-weighted distortion measure is given by + +$$ +\underset { \mathcal { C } _ { 1 } , \mathcal { C } _ { 2 } , . . . , \mathcal { C } _ { k } } { \mathrm { a r g m i n } } \sum _ { j = 1 } ^ { k } \sum _ { w _ { i } \in \mathcal { C } _ { j } } h _ { i i } | w _ { i } - c _ { j } | ^ { 2 } , \mathrm { ~ w h e r e ~ } c _ { j } = \frac { \sum _ { w _ { i } \in \mathcal { C } _ { j } } h _ { i i } w _ { i } } { \sum _ { w _ { i } \in \mathcal { C } _ { j } } h _ { i i } } . +$$ + +We call this as Hessian-weighted $\mathbf { k }$ -means clustering. Observe in (7) that we give a larger penalty for a network parameter in defining the distortion measure for clustering when its second-order partial derivative is larger, in order to avoid a large deviation from its original value, since the impact on the loss function due to quantization is expected to be larger for that parameter. + +Hessian-weighted $\mathbf { k }$ -means clustering is locally optimal in minimizing the quantization loss when fixed-length binary coding follows, where the compression ratio solely depends on the number of clusters as shown in Section 2.1. Similar to the conventional $\mathbf { k }$ -means clustering, solving this optimization is not easy, but Lloyd’s algorithm is still applicable as an efficient heuristic solution for this problem if Hessian-weighted means are used as cluster centers instead of non-weighted regular means. + +# 3.4 HESSIAN COMPUTATION + +For obtaining Hessian, one needs to evaluate the second-order partial derivative of the average loss function with respect to each of network parameters, i.e., we need to calculate + +$$ +h _ { i i } ( \hat { \mathbf { w } } ) = \frac { \partial ^ { 2 } L ( \mathcal { X } ; \mathbf { w } ) } { \partial w _ { i } ^ { 2 } } \bigg | _ { \mathbf { w } = \hat { \mathbf { w } } } = \frac { 1 } { | \mathcal { X } | } \frac { \partial ^ { 2 } } { \partial w _ { i } ^ { 2 } } \sum _ { \mathbf { x } \in \mathcal { X } } l o s s ( f ( \mathbf { x } ; \mathbf { w } ) , \hat { \mathbf { y } } ( \mathbf { x } ) ) \bigg | _ { \mathbf { w } = \hat { \mathbf { w } } } . +$$ + +Recall that we are interested in only the diagonal elements of Hessian. An efficient way of computing the diagonal of Hessian is presented in Le Cun (1987); Becker & Le Cun (1988) and it is based on the back propagation method that is similar to the back propagation algorithm used for computing first-order partial derivatives (gradients). That is, computing the diagonal of Hessian is of the same order of complexity as computing gradients. + +Hessian computation and our network quantization are performed after completing network training. For the data set $\mathcal { X }$ used to compute Hessian in (8), we can either reuse a training data set or use some other data set, e.g., validation data set. We observed from our experiments that even using a small subset of the training or validation data set is sufficient to yield good approximation of Hessian for network quantization. + +# 3.5 ALTERNATIVE OF HESSIAN + +Although there is an efficient way to obtain the diagonal of Hessian as discussed in the previous subsection, Hessian computation is not free. In order to avoid this additional Hessian computation, we propose to use an alternative metric instead of Hessian. In particular, we consider neural networks trained with the Adam SGD optimizer (Kingma & Ba, 2014) and propose to use some function (e.g., square root) of the second moment estimates of gradients as an alternative of Hessian. + +The Adam algorithm computes adaptive learning rates for individual network parameters from the first and second moment estimates of gradients. We compare the Adam method to Newton’s optimization method using Hessian and notice that the second moment estimates of gradients in the Adam method act like the Hessian in Newton’s method. This observation leads us to use some function (e.g., square root) of the second moment estimates of gradients as an alternative of Hessian. + +The advantage of using the second moment estimates from the Adam method is that they are computed while training and we can obtain them at the end of training at no additional cost. It makes Hessian-weighting more feasible for deep neural networks, which have millions of parameters. We note that similar quantities can be found and used for other SGD optimization methods using adaptive learning rates, e.g., AdaGrad (Duchi et al., 2011), Adadelta (Zeiler, 2012) and RMSProp (Tieleman & Hinton, 2012). + +# 3.6 QUANTIZATION OF ALL LAYERS + +We propose quantizing the network parameters of all layers in a neural network together at once by taking Hessian-weight into account. Layer-by-layer quantization was examined in the previous work (Gong et al., 2014; Han et al., 2015a). However, e.g., in Han et al. (2015a), a larger number of bits (a larger number of clusters) are assigned to convolutional layers than fully-connected layers, which implies that they heuristically treat convolutional layers more importantly. This follows from the fact that the impact of quantization errors on the performance varies significantly across layers; some layers, e.g., convolutional layers, may be more important than the others. This concern is exactly what we can address by Hessian-weighting. + +Hessian-weighting properly handles the different impact of quantization errors not only within layers but also across layers and thus it can be employed for quantizing all layers of a network together. The impact of quantization errors may vary more substantially across layers than within layers. Thus, Hessian-weighting may show more benefit in deeper neural networks. We note that Hessianweighting can still provide gain even for layer-by-layer quantization since it can address the different impact of the quantization errors of network parameters within each layer as well. + +Recent neural networks are getting deeper, e.g., see Szegedy et al. (2015a;b); He et al. (2015). For such deep neural networks, quantizing network parameters of all layers together is even more advantageous since we can avoid layer-by-layer compression rate optimization. Optimizing compression ratios jointly across all individual layers (to maximize the overall compression ratio for a network) requires exponential time complexity with respect to the number of layers. This is because the total number of possible combinations of compression ratios for individual layers increases exponentially as the number of layers increases. + +# 4 ENTROPY-CONSTRAINED NETWORK QUANTIZATION + +In this section, we investigate how to solve the network quantization problem under a constraint on the compression ratio. In designing network quantization schemes, we not only want to minimize the performance loss but also want to maximize the compression ratio. In Section 3, we explored how to quantify and minimize the loss due to quantization. In this section, we investigate how to take the compression ratio into account properly in the optimization of network quantization. + +# 4.1 ENTROPY CODING + +After quantizing network parameters by clustering, lossless data compression by variable-length binary coding can be followed for compressing quantized values. There is a set of optimal codes that achieve the minimum average codeword length for a given source. Entropy is the theoretical limit of the average codeword length per symbol that we can achieve by lossless data compression, proved by Shannon (see, e.g., Cover & Thomas (2012, Section 5.3)). It is known that optimal codes achieve this limit with some overhead less than 1 bit when only integer-length codewords are allowed. So optimal coding is also called as entropy coding. Huffman coding is one of entropy coding schemes commonly used when the source distribution is provided (see, e.g., Cover & Thomas (2012, Section 5.6)), or can be estimated. + +# 4.2 ENTROPY-CONSTRAINED SCALAR QUANTIZATION (ECSQ) + +Considering a compression ratio constraint in network quantization, we need to solve the clustering problem in (2) or (7) under the compression ratio constraint given by + +$$ +\mathrm { C o m p r e s s i o n \ r a t i o } = \frac { b } { \bar { b } + ( \sum _ { i = 1 } ^ { k } b _ { i } + k b ) / N } > C , \mathrm { w h e r e } \bar { b } = \frac { 1 } { N } \sum _ { i = 1 } ^ { k } | { \mathcal C } _ { i } | b _ { i } , +$$ + +which follows from (1). This optimization problem is too complex to solve for any arbitrary variablelength binary code since the average codeword length $\bar { b }$ can be arbitrary. However, we identify that it can be simplified if optimal codes, e.g., Huffman codes, are assumed to be used. In particular, optimal coding closely achieves the lower limit of the average source code length, i.e., entropy, and then we approximately have + +$$ +\bar { b } \approx H = - \sum _ { i = 1 } ^ { k } p _ { i } \log _ { 2 } p _ { i } , +$$ + +where $H$ is the entropy of the quantized network parameters after clustering (i.e., source), given that $p _ { i } = | \mathcal { C } _ { i } | / N$ is the ratio of the number of network parameters in cluster $\mathcal { C } _ { i }$ to the number of all network parameters (i.e., source distribution). Moreover, assuming that $N \gg k$ , we have + +$$ +{ \frac { 1 } { N } } \left( \sum _ { i = 1 } ^ { k } b _ { i } + k b \right) \approx 0 , +$$ + +in (9). From (10) and (11), the constraint in (9) can be altered to an entropy constraint given by + +$$ +H = - \sum _ { i = 1 } ^ { k } p _ { i } \log _ { 2 } p _ { i } < R , +$$ + +where $R \approx b / C$ . In summary, assuming that optimal coding is employed after clustering, one can approximately replace a compression ratio constraint with an entropy constraint for the clustering output. The network quantization problem is then translated into a quantization problem with an entropy constraint, which is called as entropy-constrained scalar quantization (ECSQ) in information theory. Two efficient heuristic solutions for ECSQ are proposed for network quantization in the following subsections, i.e., uniform quantization and an iterative solution similar to Lloyd’s algorithm for $\mathbf { k }$ -means clustering. + +# 4.3 UNIFORM QUANTIZATION + +It is shown in Gish & Pierce (1968) that the uniform quantizer is asymptotically optimal in minimizing the mean square quantization error for any random source with a reasonably smooth density function as the resolution becomes infinite, i.e., as the number of clusters $k \infty$ . This asymptotic result leads us to come up with a very simple but efficient network quantization scheme as follows: + +1. We first set uniformly spaced thresholds and divide network parameters into clusters. 2. After determining clusters, their quantized values (cluster centers) are obtained by taking the mean of network parameters in each cluster. + +Note that one can use Hessian-weighted mean instead of non-weighted mean in computing cluster centers in the second step above in order to take the benefit of Hessian-weighting. A performance comparison of uniform quantization with non-weighted mean and uniform quantization with Hessian-weighted mean can be found in Appendix A.2. + +Although uniform quantization is a straightforward method, it has never been shown before in the literature that it is actually one of the most efficient quantization schemes for neural networks when optimal variable-length coding, e.g., Huffman coding, follows. We note that uniform quantization is not always good; it is inefficient for fixed-length coding, which is also first shown in this paper. + +# 4.4 ITERATIVE ALGORITHM TO SOLVE ECSQ + +Another scheme proposed to solve the ECSQ problem for network quantization is an iterative algorithm, which is similar to Lloyd’s algorithm for k-means clustering. Although this iterative solution is more complicated than the uniform quantization in Section 4.3, it finds a local optimum for a given discrete source. An iterative algorithm to solve the general ECSQ problem is provided in Chou et al. (1989). We derive a similar iterative algorithm to solve the ECSQ problem for network quantization. The main difference from the method in Chou et al. (1989) is that we minimize the Hessian-weighted distortion measure instead of the non-weighted regular distortion measure for optimal quantization. The detailed algorithm and further discussion can be found in Appendix A.3. + +# 5 EXPERIMENTS + +This section presents our experiment results for the proposed network quantization schemes in three exemplary convolutional neural networks: (a) LeNet (LeCun et al., 1998) for the MNIST data set, (b) ResNet (He et al., 2015) for the CIFAR-10 data set, and (c) AlexNet (Krizhevsky et al., 2012) for the ImageNet ILSVRC-2012 data set. Our experiments can be summarized as follows: + +• We employ the proposed network quantization methods to quantize all of network parameters in a network together at once, as discussed in Section 3.6. We evaluate the performance of the proposed network quantization methods with and without network pruning. For a pruned model, we need to store not only the values of unpruned parameters but also their respective indexes (locations) in the original model. For the index information, we compute index differences between unpruned network parameters in the original model and further compress them by Huffman coding as in Han et al. (2015a). For Hessian computation, 50,000 samples of the training set are reused. We also evaluate the performance when Hessian is computed with 1,000 samples only. • Finally, we evaluate the performance of our network quantization schemes using Hessian when its alternative is used instead, as discussed in Section 3.5. To this end, we retrain the considered neural networks with the Adam SGD optimizer and obtain the second moment estimates of gradients at the end of training. Then, we use the square roots of the second moment estimates instead of Hessian and evaluate the performance. + +# 5.1 EXPERIMENT MODELS + +First, we evaluate our network quantization schemes for the MNIST data set with a simplified version of LeNet5 (LeCun et al., 1998), consisting of two convolutional layers and two fully-connected + +![](images/0f02110779a331f89eeb3818d8dbeb7701d7362e4161826728462a4771c35568.jpg) +Figure 1: Accuracy versus average codeword length per network parameter after network quantization for 32-layer ResNet. + +layers followed by a soft-max layer. It has total 431,080 parameters and achieves $9 9 . 2 5 \%$ accuracy. +For a pruned model, we prune $91 \%$ of the original network parameters and fine-tune the rest. + +Second, we experiment our network quantization schemes for the CIFAR-10 data set (Krizhevsky, 2009) with a pre-trained 32-layer ResNet (He et al., 2015). The 32-layer ResNet consists of 464,154 parameters in total and achieves $9 2 . 5 8 \%$ accuracy. For a pruned model, we prune $80 \%$ of the original network parameters and fine-tune the rest. + +Third, we evaluate our network quantization schemes with AlexNet (Krizhevsky et al., 2012) for the ImageNet ILSVRC-2012 data set (Russakovsky et al., 2015). We obtain a pre-trained AlexNet Caffe model, which achieves $5 7 . 1 6 \%$ top-1 accuracy. For a pruned model, we prune $89 \%$ parameters and fine-tune the rest. In fine-tuning, the Adam SGD optimizer is used in order to avoid the computation of Hessian by utilizing its alternative (see Section 3.5). However, the pruned model does not recover the original accuracy after fine-tuning with the Adam method; the top-1 accuracy recovered after pruning and fine-tuning is $5 6 . 0 0 \%$ . We are able to find a better pruned model achieving the original accuracy by pruning and retraining iteratively (Han et al., 2015b), which is however not used here. + +# 5.2 EXPERIMENT RESULTS + +We first present the quantization results without pruning for 32-layer ResNet in Figure 1, where the accuracy of 32-layer ResNet is plotted against the average codeword length per network parameter after quantization. When fixed-length coding is employed, the proposed Hessian-weighted $\mathbf { k }$ -means clustering method performs the best, as expected. Observe that Hessian-weighted k-means clustering yields better accuracy than others even after fine-tuning. On the other hand, when Huffman coding is employed, uniform quantization and the iterative algorithm for ECSQ outperform Hessian-weighted $\mathbf { k }$ -means clustering and $\mathbf { k }$ -means clustering. However, these two ECSQ solutions underperform Hessian-weighted $\mathbf { k }$ -means clustering and even k-means clustering when fixed-length coding is employed since they are optimized for optimal variable-length coding. + +![](images/aa4bb651d105cb01aae732df71e9e8bbcb93abbb14511240683c400c0b09510e.jpg) +Figure 2: Accuracy versus average codeword length per network parameter after network quantization, Huffman coding and fine-tuning for LeNet and 32-layer ResNet when Hessian is computed with 50,000 or 1,000 samples and when the square roots of the second moment estimates of gradients are used instead of Hessian as an alternative. + +Figure 2 shows the performance of Hessian-weighted k-means clustering when Hessian is computed with a small number of samples (1,000 samples). Observe that even using the Hessian computed with a small number of samples yields almost the same performance. We also show the performance of Hessian-weighted k-means clustering when an alternative of Hessian is used instead of Hessian as explained in Section 3.5. In particular, the square roots of the second moment estimates of gradients are used instead of Hessian, and using this alternative provides similar performance to using Hessian. + +In Table 1, we summarize the compression ratios that we can achieve with different network quantization methods for pruned models. The original network parameters are 32-bit float numbers. Using the simple uniform quantization followed by Huffman coding, we achieve the compression ratios of 51.25, 22.17 and 40.65 (i.e., the compressed model sizes are $1 . 9 5 \%$ , $4 . 5 1 \%$ and $2 . 4 6 \%$ of the original model sizes) for LeNet, 32-layer ResNet and AlexNet, respectively, at no or marginal performance loss. Observe that the loss in the compressed AlexNet is mainly due to pruning. Here, we also compare our network quantization results to the ones in Han et al. (2015a). Note that layer-bylayer quantization with $\mathbf { k }$ -means clustering is evaluated in Han et al. (2015a) while our quantization schemes including $\mathbf { k }$ -means clustering are employed to quantize network parameters of all layers together at once (see Section 3.6). + +# 6 CONCLUSION + +This paper investigates the quantization problem of network parameters in deep neural networks. We identify the suboptimality of the conventional quantization method using $\mathbf { k }$ -means clustering and newly design network quantization schemes so that they can minimize the performance loss due to quantization given a compression ratio constraint. In particular, we analytically show that Hessian can be used as a measure of the importance of network parameters and propose to minimize Hessianweighted quantization errors in average for clustering network parameters to quantize. Hessianweighting is beneficial in quantizing all of the network parameters together at once since it can handle the different impact of quantization errors properly not only within layers but also across layers. Furthermore, we make a connection from the network quantization problem to the entropyconstrained data compression problem in information theory and push the compression ratio to the limit that information theory provides. Two efficient heuristic solutions are presented to this end, i.e., uniform quantization and an iterative solution for ECSQ. Our experiment results show that the proposed network quantization schemes provide considerable gain over the conventional method using $\mathbf { k }$ -means clustering, in particular for large and deep neural networks. + +# REFERENCES + +Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Fixed point optimization of deep convolutional neural networks for object recognition. In IEEE International Conference on Acoustics, Speech + +Table 1: Summary of network quantization results with Huffman coding for pruned models. + +
Accuracy %Compression ratio
LeNetOriginal model99.25-
Pruned model99.2710.13
Pruning + Quantization all layers + Huffman codingk-means Hessian-weighted k-means99.2744.58
99.2747.16
Uniform quantization99.2851.25
Iterative ECSQ Deep compression (Han et al.,2015a)99.27 99.2649.01 39.00
ResNetOriginal model92.58-
Pruned model Pruning + Quantization all layersk-means92.584.52
92.6418.25
Hessian-weighted k-means92.6720.51
+ Huffman codingUniform quantization92.6822.17
Iterative ECSQ92.7321.01
Deep compression (Han et al.,2015a) Original modelN/AN/A
AlexNetPruned modelk-means57.16 56.001 7.91
56.1230.53
Pruning + Quantization all layers + Huffman codingAlt-Hessian-weighted k-means Uniform quantization56.0433.71
56.2040.65
Deep compression (Han et al., 2015a)57.2235.00
+ +and Signal Processing, pp. 1131–1135, 2015. + +Sue Becker and Yann Le Cun. Improving the convergence of back-propagation learning with second order methods. In Proceedings of the Connectionist Models Summer School, pp. 29–37. San Matteo, CA: Morgan Kaufmann, 1988. + +Philip A Chou, Tom Lookabaugh, and Robert M Gray. Entropy-constrained vector quantization. IEEE Transactions on Acoustics, Speech, and Signal Processing, 37(1):31–42, 1989. + +Matthieu Courbariaux, Jean-Pierre David, and Yoshua Bengio. Training deep neural networks with low precision multiplications. arXiv preprint arXiv:1412.7024, 2014. + +Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In Advances in Neural Information Processing Systems, pp. 3123–3131, 2015. + +Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012. + +John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011. + +Herbert Gish and John Pierce. Asymptotically efficient quantizing. IEEE Transactions on Information Theory, 14(5):676–683, 1968. + +Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. Compressing deep convolutional networks using vector quantization. arXiv preprint arXiv:1412.6115, 2014. + +Suyog Gupta, Ankur Agrawal, Kailash Gopalakrishnan, and Pritish Narayanan. Deep learning with limited numerical precision. In Proceedings of the 32nd International Conference on Machine Learning, pp. 1737–1746, 2015. + +Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015a. + +Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems, pp. 1135–1143, 2015b. + +Babak Hassibi and David G Stork. Second order derivatives for network pruning: Optimal brain surgeon. In Advances in Neural Information Processing Systems, pp. 164–171, 1993. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015. + +Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up convolutional neural networks with low rank expansions. In Proceedings of the British Machine Vision Conference, 2014. + +Yong-Deok Kim, Eunhyeok Park, Sungjoo Yoo, Taelim Choi, Lu Yang, and Dongjun Shin. Compression of deep convolutional neural networks for fast and low power mobile applications. arXiv preprint arXiv:1511.06530, 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. 2009. + +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 Le Cun. Modeles connexionnistes de l’apprentissage \` . PhD thesis, Paris 6, 1987. + +Vadim Lebedev and Victor Lempitsky. Fast convnets using group-wise brain damage. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2554–2564, 2016. + +Vadim Lebedev, Yaroslav Ganin, Maksim Rakhuba, Ivan Oseledets, and Victor Lempitsky. Speeding-up convolutional neural networks using fine-tuned CP-decomposition. arXiv preprint arXiv:1412.6553, 2014. + +Yann LeCun, John S Denker, Sara A Solla, Richard E Howard, and Lawrence D Jackel. Optimal brain damage. In Advances in Neural Information Processing Systems, pp. 598–605, 1989. + +Yann LeCun, L´eon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. + +Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015. + +Darryl D Lin, Sachin S Talathi, and V Sreekanth Annapureddy. Fixed point quantization of deep convolutional networks. arXiv preprint arXiv:1511.06393, 2015a. + +Zhouhan Lin, Matthieu Courbariaux, Roland Memisevic, and Yoshua Bengio. Neural networks with few multiplications. arXiv preprint arXiv:1510.03009, 2015b. + +Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Pensky. Sparse convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 806–814, 2015. + +Michael C Mozer and Paul Smolensky. Skeletonization: A technique for trimming the fat from a network via relevance assessment. In Advances in Neural Information Processing Systems, pp. 107–115, 1989. + +Alexander Novikov, Dmitrii Podoprikhin, Anton Osokin, and Dmitry P Vetrov. Tensorizing neural networks. In Advances in Neural Information Processing Systems, pp. 442–450, 2015. + +Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. XNOR-Net: Imagenet classification using binary convolutional neural networks. arXiv preprint arXiv:1603.05279, 2016. + +Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015. + +Tara N Sainath, Brian Kingsbury, Vikas Sindhwani, Ebru Arisoy, and Bhuvana Ramabhadran. Lowrank matrix factorization for deep neural network training with high-dimensional output targets. In IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 6655–6659, 2013. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. + +Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–9, 2015a. + +Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. arXiv preprint arXiv:1512.00567, 2015b. + +Cheng Tai, Tong Xiao, Xiaogang Wang, et al. Convolutional neural networks with low-rank regularization. arXiv preprint arXiv:1511.06067, 2015. + +Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 4(2), 2012. + +Vincent Vanhoucke, Andrew Senior, and Mark Z Mao. Improving the speed of neural networks on CPUs. In Deep Learning and Unsupervised Feature Learning Workshop, NIPS, 2011. + +Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2074–2082, 2016. + +Jian Xue, Jinyu Li, and Yifan Gong. Restructuring of deep neural network acoustic models with singular value decomposition. In INTERSPEECH, pp. 2365–2369, 2013. + +Zichao Yang, Marcin Moczulski, Misha Denil, Nando de Freitas, Alex Smola, Le Song, and Ziyu Wang. Deep fried convnets. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1476–1483, 2015. + +Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012. + +# A APPENDIX + +# A.1 FURTHER DISCUSSION ON THE HESSIAN-WEIGHTED QUANTIZATION ERROR + +The diagonal approximation for Hessian simplifies the optimization problem as well as its solution for network quantization. This simplification comes with some performance loss. We conjecture that the loss due to this approximation is small. The reason is that the contributions from off-diagonal terms are not always additive and their summation may end up with a small value. However, diagonal terms are all non-negative and therefore their contributions are always additive. We do not verify this conjecture in this paper since solving the problem without diagonal approximation is too complex; we even need to compute the whole Hessian matrix, which is also too costly. + +Observe that the relation of the Hessian-weighted distortion measure to the quantization loss holds for any model for which the objective function can be approximated as a quadratic function with respect to the parameters to quantize in the model. Hence, the quantization methods proposed in this paper to minimize the Hessian-weighted distortion measure are not specific to neural networks but are generally applicable to quantization of parameters of any model whose objective function is locally quadratic with respect to its parameters approximately. + +Finally, we do not consider the interactions between quantization and retraining in our formulation in Section 3.2. We analyze the expected loss due to quantization assuming no further retraining and focus on finding optimal network quantization schemes that minimize the performance loss. In our experiments, however, we further fine-tune the quantized values (cluster centers) so that we can recover the loss due to quantization and improve the performance. + +# A.2 EXPERIMENT RESULTS FOR UNIFORM QUANTIZATION + +We compare uniform quantization with non-weighted mean and uniform quantization with Hessianweighted mean in Figure 3, which shows that uniform quantization with Hessian-weighted mean slightly outperforms uniform quantization with non-weighted mean. + +![](images/71d3f9dc398040954824911ecd91549b4c8c773c75021d93c434abcf1a0e7041.jpg) +Figure 3: Accuracy versus average codeword length per network parameter after network quantization, Huffman coding and fine-tuning for 32-layer ResNet when uniform quantization with nonweighted mean and uniform quantization with Hessian-weighted mean are used. + +# A.3 FURTHER DISCUSSION ON THE ITERATIVE ALGORITHM FOR ECSQ + +In order to solve the ECSQ problem for network quantization, we define a Lagrangian cost function: + +$$ +J _ { \lambda } ( \mathcal { C } _ { 1 } , \mathcal { C } _ { 2 } , \ldots , \mathcal { C } _ { k } ) = D + \lambda H = \frac { 1 } { N } \sum _ { j = 1 } ^ { k } \sum _ { w _ { i } \in \mathcal { C } _ { j } } \underbrace { ( h _ { i i } | w _ { i } - c _ { j } | ^ { 2 } - \lambda \log _ { 2 } p _ { j } ) } _ { = d _ { \lambda } ( i , j ) } , +$$ + +where + +$$ +D = \frac { 1 } { N } \sum _ { j = 1 } ^ { k } \sum _ { w _ { i } \in \mathcal { C } _ { j } } h _ { i i } | w _ { i } - c _ { j } | ^ { 2 } , ~ H = - \sum _ { j = 1 } ^ { k } p _ { j } \log _ { 2 } p _ { j } . +$$ + +# Algorithm 1 Iterative solution for entropy-constrained network quantization + +Initialization: $n \gets 0$ + +clusters: $c _ { 1 } ^ { ( 0 ) } , \ldots , c _ { k } ^ { ( 0 ) }$ + +Initialize the proportions of $k$ 1 kclusters (set all of them to be the same initially): $p _ { 1 } ^ { ( 0 ) } , \ldots , p _ { k } ^ { ( 0 ) }$ repeat + +# Assignment: + +for all network parameters $i = 1 N$ do + +Assign $w _ { i }$ to the cluster $j$ that minimizes the individual Lagrangian cost as follows: + +$$ +\mathcal { C } _ { l } ^ { ( n + 1 ) } \gets \mathcal { C } _ { l } ^ { ( n + 1 ) } \cup \{ w _ { i } \} \quad \mathrm { f o r } \ l = \arg \operatorname* { m i n } _ { j } \left\{ h _ { i i } | w _ { i } - c _ { j } ^ { ( n ) } | ^ { 2 } - \lambda \log _ { 2 } p _ { j } ^ { ( n ) } \right\} +$$ + +end for + +Update: + +for all clusters $j = 1 k$ do + +Update the cluster center and the proportion of cluster $j$ : + +$$ +c _ { j } ^ { ( n + 1 ) } \gets \frac { \sum _ { w _ { i } \in \mathcal { C } _ { j } ^ { ( n + 1 ) } } h _ { i i } w _ { i } } { \sum _ { w _ { i } \in \mathcal { C } _ { j } ^ { ( n + 1 ) } } h _ { i i } } \mathrm { a n d } p _ { j } ^ { ( n + 1 ) } \gets \frac { | \mathcal { C } _ { j } ^ { ( n + 1 ) } | } { N } +$$ + +# end for + +$n \gets n + 1$ until Lagrangian cost function $J _ { \lambda }$ decreases less than some threshold + +The entropy-constrained network quantization problem is then reduced to find $k$ partitions (clusters) $\mathcal { C } _ { 1 } , \mathcal { C } _ { 2 } , \ldots , \mathcal { C } _ { k }$ that minimize the Lagrangian cost function as follows: + +$$ +\operatorname * { a r g m i n } _ { \mathcal { C } _ { 1 } , \mathcal { C } _ { 2 } , \ldots , \mathcal { C } _ { k } } J _ { \lambda } ( \mathcal { C } _ { 1 } , \mathcal { C } _ { 2 } , \ldots , \mathcal { C } _ { k } ) . +$$ + +A heuristic iterative algorithm to solve this method of Lagrange multipliers for network quantization is presented in Algorithm 1. It is similar to Lloyd’s algorithm for $\mathbf { k }$ -means clustering. The key difference is how to partition network parameters at the assignment step. In Lloyd’s algorithm, the Euclidean distance (quantization error) is minimized. For ECSQ, the individual Lagrangian cost function, i.e., $d _ { \lambda } ( i , j )$ in (12), is minimized instead, which includes both quantization error and expected codeword length after entropy coding. \ No newline at end of file diff --git a/md/train/rJgqMRVYvr/rJgqMRVYvr.md b/md/train/rJgqMRVYvr/rJgqMRVYvr.md new file mode 100644 index 0000000000000000000000000000000000000000..afb7ba83f5af12ae6001d8b45e9358f8506274e3 --- /dev/null +++ b/md/train/rJgqMRVYvr/rJgqMRVYvr.md @@ -0,0 +1,319 @@ +# DIFFERENTIALLY PRIVATE META-LEARNING + +Jeffrey Li, Mikhail Khodak, Sebastian Caldas +Carnegie Mellon University +jwl3@cs.cmu.edu + +Ameet Talwalkar Carnegie Mellon University & Determined AI + +# ABSTRACT + +Parameter-transfer is a well-known and versatile approach for meta-learning, with applications including few-shot learning, federated learning, and reinforcement learning. However, parameter-transfer algorithms often require sharing models that have been trained on the samples from specific tasks, thus leaving the task-owners susceptible to breaches of privacy. We conduct the first formal study of privacy in this setting and formalize the notion of task-global differential privacy as a practical relaxation of more commonly studied threat models. We then propose a new differentially private algorithm for gradient-based parameter transfer that not only satisfies this privacy requirement but also retains provable transfer learning guarantees in convex settings. Empirically, we apply our analysis to the problems of federated learning with personalization and few-shot classification, showing that allowing the relaxation to task-global privacy from the more commonly studied notion of local privacy leads to dramatically increased performance in recurrent neural language modeling and image classification. + +# 1 INTRODUCTION + +The field of meta-learning offers promising directions for improving the performance and adaptability of machine learning methods. At a high level, the key assumption leveraged by these approaches is that the sharing of knowledge gained from individual learning tasks can help catalyze the learning of similar unseen tasks. However, the collaborative nature of this process, in which task-specific information must be sent to and used by a meta-learner, also introduces inherent data privacy risks. + +In this work, we focus on a popular and flexible meta-learning approach, parameter transfer via gradient-based meta-learning (GBML). This set of methods, which includes well-known algorithms such as MAML (Finn et al., 2017) and Reptile (Nichol et al., 2018), tries to learn a common initialization $\phi$ over a set of tasks $t = 1 , \dots , T$ such that a high-performance model can be learned in only a few gradient-steps on new tasks. Notably, information flows constantly between training tasks and the meta-learner as learning progresses; to make iterative updates, the meta-learner obtains feedback on the current $\phi$ by having task-specific models ${ \bar { \theta } } _ { t }$ trained with it. + +Meanwhile, in many settings amenable to meta-learning, it is crucial to ensure that sensitive information in each task’s dataset stays private. Examples of this include learning models for word prediction on cell phone data (McMahan et al., 2018), clinical predictions using hospital records (Zhang et al., 2019), and fraud detectors for competing credit card companies (Stolfo et al., 1997). In such cases, each data-owner can benefit from information learned from other tasks, but each also desires, or is legally required, to keep their raw data private. Thus, it is not sufficient to learn a well-performing $\phi$ ; it is equally imperative to ensure that a task’s sensitive information is not obtainable by anyone else. + +While parameter transfer algorithms can move towards this goal by peforming task-specific optimization locally, thus preventing direct access to private data, this provision is far from fail-safe in terms of privacy. A wealth of work has shown in the single-task setting that it is possible for an adversary with only access to the model to learn detailed information about the training set, such as the presence or absence of specific records (Shokri et al., 2017) or the identities of sensitive features given other covariates (Fredrikson et al., 2015). Furthermore, Carlini et al. (2018) showed that deep neural networks can effectively memorize user-unique training examples, which can be recovered even after only a single epoch of training. As such, in parameter-transfer methods, the meta-learner or any downstream participant can potentially recover data from a previous task. + +However, despite these serious risks, privacy-preserving meta-learning has remained largely an unstudied problem. Our work aims to address this issue by applying differential privacy (DP), a well-established definition of privacy with rich theoretical guarantees and consistent empirical success at preventing leakages of data (Carlini et al., 2018; Fredrikson et al., 2015; Jayaraman and Evans, 2019). Crucially, although there are various threat models and degrees of DP one could consider in the meta-learning setting (as we outline in Section 2), we balance the well-documented trade-off between privacy and model utility by formalizing and focusing on a setting that we call task-global DP. This setting provides a strong privacy guarantee for each task-owner that sharing $\widehat { \theta } _ { t }$ with the meta-learner will not reliably reveal anything about specific training examples to any downstream agent. It also allows us to use the framework of Khodak et al. (2019a) to provide a DP GBML algorithm that enjoys provable learning guarantees in convex settings. + +Finally, we show an application of our work by drawing connections to federated learning (FL) (Li et al., 2019). While standard methods for FL, such as FedAvg (McMahan et al., 2017), have inspired many works also concerning DP in a multi-user setup (Agarwal et al., 2018; Bhowmick et al., 2019; Geyer et al., 2018; McMahan et al., 2018; Truex et al., 2019), we are the first to consider task-global DP as a useful variation on standard DP settings. Moreover, these works fundamentally differ from ours in that they do not consider a task-based notion of learnability, instead focusing on the global federated learning problem to learn a single global model. That being said, a federated setting involving per-user personalization (Chen et al., 2018; Smith et al., 2017) is a natural meta-learning application. + +More specifically, our main contributions are: + +1. We are the first to provide a taxonomy for the different notions of DP possible for meta-learning. In particular, we formalize on a variant we call task-global DP, showing and arguing that it adds a useful option to commonly studied settings in terms of trading privacy and accuracy. +2. We propose the first DP GBML algorithm, which we construct to satisfy this privacy setting. Further, we show a straightforward extension for obtaining a group $D P$ version of our setting to protect multiple samples simultaneously. +3. While our privacy guarantees hold generally, we also prove learning-theoretic results in convex settings. Our learning guarantees scale with task-similarity, as measured by the closeness of the task-specific optimal parameters (Denevi et al., 2019; Khodak et al., 2019b). +4. We show that our algorithm, along with its theoretical guarantees, naturally carries over to federated learning with personalization. Compared to previous notions of privacy considered in works for DP federated learning (Agarwal et al., 2018; Bhowmick et al., 2019; Geyer et al., 2018; McMahan et al., 2018; Truex et al., 2019), we are, to the best of our knowledge, the first to simultaneously provide both privacy and learning guarantees. +5. Empirically, we demonstrate that our proposed privacy setting allows for strong performance on federated language-modeling and few-shot image classification tasks. For the former, we achieve close to the performance of non-private models and significantly improve upon the performance of models trained with local-DP guarantees, a previously studied notion that also provides protections against the meta-learner. Our setting reasonably relaxes this latter notion but can achieve roughly 1.7–2.3 times the accuracy on a modified version of the Shakespeare dataset (Caldas et al., 2018) and 1.6–1.7 times the accuracy on a modified version of Wiki-3029 (Arora et al., 2019) across various privacy budgets. For image-classification, we show that we show that we can still retain significant benefits of meta-learning while applying task-global DP on Omniglot (Lake et al., 2011) and Mini-ImageNet (Ravi and Larochelle, 2017). + +# 1.1 RELATED WORK + +DP Algorithms in Federated Learning Settings. Works most similar to ours focus on providing DP for federated learning. Specifically, Geyer et al. (2018) and McMahan et al. (2018) apply update clipping and the Gaussian Mechanism to achieve user-level global DP federated learning algorithms for language modeling and image classification tasks respectively. Their methods are shown to only suffer minor drops in accuracy compared to non-private training but they do not consider protections to inferences made by the meta-learner. Alternatively, Bhowmick et al. (2019) does achieve such protection by applying a theoretically rate-optimal local DP mechanism on the ${ \bar { \theta } } _ { t }$ ’s users send to the meta-learner. However, they sidestep hard minimax rates (Duchi et al., 2018) by assuming the central server has limited side-information and allowing for a large privacy budget. In this work, though we achieve a relaxation of the privacy of Bhowmick et al. (2019), we do not restrict the adversary’s power. Finally, Truex et al. (2019) does consider a setting that coincides with task-global DP, but they focus primarily on the added benefits of applying MPC (see below) rather than studying the merits of the setting in comparison to other potential settings. + +Secure Multiparty Computation (MPC). MPC is a cryptographic technique that allows parties to calculate a function of their inputs while also maintaining the privacy of each individual inputs. In GBML, sets of model updates may come in a batch from multiple tasks, and hence MPC can securely aggregate the batch before it is seen by the meta-learner. Though MPC itself gives no DP guarantees against future inference, it can combined with DP to increase privacy. This approach has been studied in the federated setting, e.g. by Agarwal et al. (2018), who apply MPC in the same difficult setting of Bhowmick et al. (2019), and Truex et al. (2019), who apply MPC similarly to a setting analogous to ours. On the other hand, MPC also comes with additional practical challenges such as peer-to-peer communication costs, drop outs, and vulnerability to collaborating participants. As such, combined with its applicability to multiple settings, including ours, we consider MPC to be an orthogonal direction. + +# 2 PRIVACY IN A META-LEARNING CONTEXT + +In this section, we first formalize the meta-learning setting that we consider. We then describe the various threat models that arise in the GBML setup, before presenting the different DP notions that can be achieved. Finally, we highlight the specific model and type of DP that we analyze. + +# 2.1 PARAMETER TRANSFER META-LEARNING + +In parameter transfer meta-learning, we assume that there is a set of learning tasks $t = 1 , \dots , T$ , each with its corresponding disjoint training set $D _ { t }$ . Each $D _ { t }$ contains $m _ { t }$ training examples $\{ z _ { t , i } \} _ { i = 1 } ^ { m _ { t } }$ where each $\boldsymbol { z } _ { t , i } \in \mathcal { X } \times \mathcal { Y }$ . The goal within each task is to learn a function $f _ { \hat { \theta } _ { t } } : \mathcal { X } \xrightarrow { } \mathcal { V }$ parameterized by $\widehat { \theta } _ { t } \in \Theta \subset \mathbb { R } ^ { d }$ that performs “well,” generally in the sense that it has low within-task population risk in the distributional setting. The meta-learner’s goal is to learn an initialization $\phi \in \Theta$ that leads to a well-performing $\widehat { \theta } _ { t }$ within-task. In GBML this $\phi$ is learned via an iterative process that alternates between the following two steps: (1) a within-task procedure where a batch of task-owners $B$ receives the current $\phi$ and each $t \in B$ uses $\phi$ as an initialization for running a within-task optimization procedure, obtaining $\bar { \theta } _ { t } ( D _ { t } , \phi )$ ; (2) a meta-level procedure where the meta-learner receives these model updates $\{ { \bar { \theta } } _ { t } \} _ { t \in B }$ and aggregates them to determine an updated $\phi$ . Note that we do not assume $\widehat { \theta } _ { t } = \bar { \theta } _ { t }$ , as the updates shared for the meta-learning procedure can be obtained from a different procedure than the refined model used for downstream within-task inference. This is especially the case when concerning the addition of noise for DP as part of the meta-learning procedure. + +# 2.2 THREAT MODELS FOR GBML + +As in any privacy endeavor, before discussing particular mechanisms, a key specification must be made in terms of what threat model is being considered. In particular, it must be specified both (1) who the potential adversaries are and (2) what information needs to be protected. + +Potential adversaries. For a single task-owner, adversaries may be either solely recipients of $\phi$ (i.e. other task-owners) or recipients of either $\phi$ or ${ \bar { \theta } } _ { t }$ (i.e. also the meta-learner). In the latter case, we consider only a honest-but-curious meta-learner, who does not deviate from the agreed upon algorithm but may try to make inferences from ${ \bar { \theta } } _ { t }$ . In both cases, concern is placed not only about these other participants’ intentions, but also their own security against access by malicious outsiders. + +Data to be protected. A system can choose either to protect information contained in single records $z _ { t , i }$ one-at-a-time or to protect entire datasets $D _ { t }$ simultaneously. This distinction between record-level and task-level privacy can be practically important. Multiple $z _ { t , i }$ within $D _ { t }$ may reveal the same secret (e.g., a cell-phone user has sent their SSN multiple times), or the entire distribution of $D _ { t }$ could reveal sensitive information (e.g., a user has sent all messages in a foreign language). In these cases, record-level privacy may not be sufficient. However, given that privacy and utility are often at odds, we often seek the weakest notion of privacy needed in order to best preserve utility. + +![](images/1af50ef442ecb2263b0ad5b33eec347594b127d79b6e088e27c64606c511143e.jpg) +Figure 1: Summary of the privacy protections guaranteed by local and global DP at the different levels of the meta-learning problem (with our notion in blue). On the right, we show what each specification would mean in two practical federated scenarios: mobile users and hospital networks. + +In related work, focus has primarily been placed on task-level protections. However, such approaches usually fall into two extremes, either obtaining strong learning but having to trust the meta-learner (McMahan et al., 2018; Geyer et al., 2018) or trusting nobody but also obtaining low performance (Bhowmick et al., 2019). In response, we try to bridge the gap between these threat models by considering a model that makes a relaxation from task-level to record-level privacy but retains protections for each task-owner against all other parties. This relaxation can be reasonably justified in practical situations, as while task-level guarantees are strictly stronger, they may also be unnecessary. In particular, record-level guarantees are likely to be sufficient whenever single records each pertain to different individuals. For example, for hospitals, what we care about is providing privacy to the individual patients and not aggregate hospital information. For cell-phones, if one can bound the number of texts that could reveal the same sensitive information, then a straightforward extension of our setting and methods, which protects up to $k$ records simultaneously, could also be sufficient. + +# 2.3 DIFFERENTIAL PRIVACY (DP) IN A SINGLE-TASK SETTING + +In terms of actually achieving privacy guarantees for machine learning, a de-facto standard has been to apply DP, a provision which strongly limits what one can infer about the examples a given model was trained on. Assuming a training set $D = \{ z _ { 1 } , \dots , z _ { m } \}$ , two common types of DP are considered. + +Differential Privacy (Global DP). A randomized mechanism $\mathcal { M }$ is $( \varepsilon , \delta )$ -differentially private if for all measurable $S \subseteq { \mathrm { R a n g e } } ( { \mathcal { M } } )$ and for all datasets $D , D ^ { \prime }$ that differ by at most one element: + +$$ +\mathbb { P } [ \mathcal { M } ( D ) \in \mathcal { S } ] \leq e ^ { \varepsilon } \mathbb { P } [ \mathcal { M } ( D ^ { \prime } ) \in \mathcal { S } ] + \delta +$$ + +If this holds for $D , D ^ { \prime }$ differing by at most $k$ elements, then $( \varepsilon , \delta ) \ k$ -group $D P$ is achieved. + +Local Differential Privacy. A randomized mechanism $\mathcal { M }$ is $( \varepsilon , \delta )$ -locally differentially private if for any two possible training examples $z , z ^ { \prime } \in \mathcal { X } \times \mathcal { Y }$ and measurable $S \subseteq \mathcal { X } \times \mathcal { Y }$ : + +$$ +\mathbb { P } [ \mathcal { M } ( z ) \in \mathcal { S } ] \leq e ^ { \varepsilon } \mathbb { P } [ \mathcal { M } ( z ^ { \prime } ) \in \mathcal { S } ] + \delta +$$ + +Global DP guarantees the difficulty of inferring the presence of a specific record in the training set by observing $\mathcal { M } ( D )$ . It assumes a trusted aggregator running $\mathcal { M }$ gets direct access to $D$ and privatizes the final output. Meanwhile, local DP assumes more strictly that the aggregator also cannot be trusted, thus requiring a random mechanism to be applied individually on each $z$ before training. However, it generally results in worse model performance, suffering from hard minimax rates (Duchi et al., 2018). + +Table 1: Broad categorization of the DP settings considered by our work in meta-learning and notable past works in the federated setting. Note that by using a de-centralized method for aggregation, Agarwal et al. (2018) can still protect against the meta-learner from making inferences on any individual $\widehat { \theta } _ { t }$ with what is only effectively a global DP mechanism. + +
Previous WorkNotion of DPPrivacy for ΦPrivacy for θt
McMahan et al. (2018)GlobalTask-level1
Geyer et al. (2018)GlobalTask-level=
Bhowmick et al. (2019)Local, GlobalTask-levelTask-level
Agarwal et al. (2018)Global + MPCTask-levelTask-level
Truex et al. (2019)Task-Global + MPCRecord-levelRecord-level
Our workTask-GlobalRecord-levelRecord-level
+ +# 2.4 DIFFERENTIAL PRIVACY FOR A GBML SETTING + +In meta-learning, there exists a hierarchy of agents and statistical queries, so we cannot as simply define global and local DP. Here, both the meta-level sub-procedure, $\{ \bar { \theta } _ { t } \} _ { t \in B } \phi$ , and the withintask sub-procedure, $\{ z _ { t , i } \} _ { i = 1 } ^ { m _ { t } } \to \bar { \theta } _ { t }$ , can be considered individual queries and a DP algorithm can implement either to be DP. Further, for each query, the procedure may be altered to satisfy either local DP or global DP. Thus, there are four fundamental options that follow from standard DP definitions. + +(1) Global $D P$ : Releasing $\phi$ will at no point compromise information regarding any specific ${ \bar { \theta } } _ { t }$ . +(2) Local $D P$ : Additionally, each ${ \bar { \theta } } _ { t }$ is protected from being revealed to the meta-learner. +(3) Task-Global $D P$ : Releasing ${ \bar { \theta } } _ { t }$ will at no point compromise any specific $z _ { t , i }$ . +(4) Task-Local $D P$ : Additionally, each $z _ { t , i }$ is protected from being revealed to task-owner. + +To form analogies to single-task DP, the examples in the meta-level procedure are the model updates and the aggregator is the meta-learner. For the within-task procedure, the examples are actually the individual records and the aggregator is the task-owner. As such, (1) is implemented by the metalearner, (2) and (3) are implemented by the task-owner, and (4) is implemented by record-owners. By immunity to post-processing, the guarantees for (3) and (4) also automatically apply to the release of any future iteration of $\phi$ , thus protecting against future task-owners as well. Meanwhile, though (1) and (2) by definition protect the identities of individual ${ \bar { \theta } } _ { t }$ , they actually satisfy a task-level threat model by doing so. Intuitively, not being able to reliably infer anything about ${ \bar { \theta } } _ { t }$ implies that nothing can be inferred about the $D _ { t }$ that was used to generate it. + +Using the terminology we introduce in Section 2.4, previous works for DP in federated settings can be categorized as in Table 1. While these works do not assume a multi-task setting, we can still naturally use the terms global/local and task-global/task-local to analogously refer to releasing the global model (by the central server in the case without MPC) and user-specific updates (by users’ devices) respectively. + +# 3 DIFFERENTIALLY PRIVATE PARAMETER-TRANSFER + +# 3.1 ALGORITHM + +We now present our DP GBML method, which is written out in its online (regret) form in Algorithm 1. Here, we observe that both within-task optimization and meta-optimization are done using some form of gradient descent. The key difference between this algorithm and traditional GBML is that since task-learners must send back privatized model updates, each now applies an DP gradient descent procedure to learn ${ \bar { \theta } } _ { t }$ when called. However, at meta-test time the task-learner will run a non-private descent algorithm to obtain the parameter $\widehat { \theta } _ { t }$ used for inference, as this parameter may remain locally. To obtain learning-theoretic guarantees, we use a variant of Algorithm 1 in which the DP algorithm is an SGD procedure (Bassily et al., 2019, Algorithm 1) that adds a properly scaled Gaussian noise vector at each iteration. + +Algorithm 1: Online version of our $( \varepsilon , \delta )$ -meta-private parameter-transfer algorithm. + +Meta-learner picks first meta-initialization $\phi _ { 1 } \in \Theta$ . for task $t \in [ T ]$ do + +Meta-learner sends meta-initialization $\phi _ { t }$ to task $t$ . +Task-learner runs OGD starting from $\theta _ { t , 1 } = \phi _ { t }$ on losses $\{ \ell _ { t , i } \} _ { i = 1 } ^ { m }$ to obtain $\widehat { \theta } _ { t }$ . +Task-learner $t$ runs $( \varepsilon , \delta )$ -DP algorithm (noisy-SGD) on losses $\{ \ell _ { t , i } \} _ { i = 1 } ^ { m }$ to get ${ \bar { \theta } } _ { t }$ . +Task-learner sends ${ \bar { \theta } } _ { t }$ to meta-learner. +Meta-learner constructs loss $\begin{array} { r } { \ell _ { t } ( \phi ) = \frac 1 2 \| \bar { \theta } _ { t } - \phi _ { t } \| _ { 2 } ^ { 2 } } \end{array}$ . +Meta-learner updates meta-initialization $\phi _ { t + 1 }$ using an OCO algorithm on $\ell _ { 1 } , \ldots , \ell _ { t }$ . + +Result: Meta-initialization $\begin{array} { r } { { \hat { \phi } } = { \frac { 1 } { T } } \sum _ { t = 1 } ^ { T } \phi _ { t } } \end{array}$ to use on test tasks. + +# 3.2 PRIVACY GUARANTEES + +We run a certified $( \varepsilon , \delta )$ -DP version of SGD (Bassily et al., 2019, Algorithm 1) within each task. Therefore, this guarantees that the contribution of each task-owner, a $\bar { \theta } _ { t }$ trained on their data, carries global DP guarantees with respect to the meta-learner. Additionally, since DP is preserved under post-processing, the release of any future calculation stemming from ${ \bar { \theta } } _ { t }$ also carries the same DP guarantee. + +# 3.3 LEARNING GUARANTEES + +Our learning result follows the setup of Baxter (2000), who formalized the LTL problem as using task-distribution samples $\mathcal { P } _ { 1 } , . . . , \mathcal { P } _ { T } \sim \mathcal { Q }$ from some meta-distribution $\mathcal { Q }$ and samples indexed by $i = 1 , \ldots , m$ from those tasks to improve performance when a new task $\mathcal { P }$ is sampled from $\mathcal { Q }$ and we draw $m$ samples from it. In the setting of parameter-transfer meta-learning we are learning functions parameterized by real-valued vectors $\overline { { \theta } } \in \dot { \Theta } \subset \mathbb { R } ^ { d }$ , so our goal will follow that of Denevi et al. (2019) and Khodak et al. (2019b) in seeking bounds on the transfer-risk – the distributional performance of a learned parameter on a new task from $\mathcal { Q }$ – that improve with task similarity. + +The specific task-similarity metric we consider is the average deviation of the risk-minimizing parameters of tasks sampled from the distribution $\mathcal { Q }$ are close together. This will be measured in-terms of the following quantity: $\begin{array} { r } { V ^ { 2 } = \operatorname* { m i n } _ { \phi \in \Theta } \frac { 1 } { 2 } \mathbb { E } _ { \mathcal { P } \sim \mathcal { Q } } \| \theta _ { \mathcal { P } } - \phi \| _ { 2 } ^ { 2 } } \end{array}$ , for $\theta _ { P } \in \arg \operatorname* { m i n } _ { \theta \in \Theta } \ell _ { \mathcal { P } } ( \theta )$ a risk-minimizer of task-distribution $\mathcal { P }$ . This quantity is roughly the variance of risk-minimizing task-parameters and is a standard quantifier of improvement due to meta-learning (Denevi et al., 2019; Khodak et al., 2019b). For example, Denevi et al. (2019) show excess transfer-risk guarantees of the form $\begin{array} { r } { \mathcal { O } \left( \frac { V } { \sqrt { m } } + \sqrt { \frac { \log T } { T } } \right) } \end{array}$ when $T$ tasks with $m$ samples are drawn from the distribution. This guarantee ensures that as we see more tasks our transfer risk becomes roughly $V / \sqrt { m }$ , which if the tasks are similar, i.e. $V$ is small, implies that LTL improves over single-task learning. + +In Algorithm 1, each user $t$ obtains a within-task parameter ${ \bar { \theta } } _ { t }$ by running (non-private) OGD on a sequence of losses $\ell _ { t , 1 } , \ldots , \ell _ { t , m }$ and averaging the iterates. The regret of this procedure, when averaged across the users, implies a bound on the expected excess transfer risk of new task from $\mathcal { Q }$ when running OGD from a learned initialization (Cesa-Bianchi et al., 2004). Thus our goal is to bound this regret in terms of $V$ ; here we follow the Average Regret-Upper-Bound Analysis (ARUBA) framework of Khodak et al. (2019b) and treat meta-update procedure itself as an online algorithm optimizing a bound on the performance measure (regret) of each within-task algorithm. As OGD’s regret depends on the squared distance $\frac { 1 } { 2 } \| \theta _ { t } ^ { * } - \phi _ { t } \| _ { 2 } ^ { 2 }$ of the optimal parameter from the initialization $\phi _ { t }$ , with no privacy concerns one could simply update $\phi _ { t }$ using $\begin{array} { r } { \theta _ { t } ^ { * } \in \arg \operatorname* { m i n } _ { \theta \in \Theta } \sum _ { i = 1 } ^ { m } \ell _ { t , i } ( \theta ) } \end{array}$ to recover guarantees similar to those in Denevi et al. (2019) and Khodak et al. (2019b). + +However, this approach requires sending $\theta _ { t } ^ { * }$ to the meta-learner, which is not private; instead in Algorithm 1 we send $\widehat { \theta } _ { t }$ , which is the output of noisy SGD. To apply ARUBA, we need an additional assumption – that the losses satisfy the following quadratic growth (QG) property: for some $\alpha > 0$ , + +$$ +\frac { \alpha } { 2 } \| \theta - \theta _ { \mathcal { P } } \| _ { 2 } ^ { 2 } \le \ell _ { \mathcal { P } } ( \theta ) - \ell _ { \mathcal { P } } ( \theta _ { \mathcal { P } } ) \quad \forall \theta \in \Theta +$$ + +Here $\theta _ { \mathcal { P } }$ is the risk minimizer of $\ell _ { \mathcal { P } }$ . This assumption, which Khodak et al. (2019a) shows is reasonable in settings such as logistic regression, amounts to a statistical non-degeneracy assumption on the parameter-space – that parameters far away from the risk-minimizer do not have low-risk. Note that assuming the population risk is QG is significantly weaker than assuming strong convexity of the empirical risk, which previous work (Finn et al., 2019) has assumed to hold for task losses but does not hold for applicable cases such as few-shot least-squares or logistic regression if the number of task-samples is smaller than the data-dimension. + +We are now able to state our main theoretical result, a proof of which is given in Appendix A. The result follows from a bound on the task-averaged regret across all tasks of a simple online meta-learning procedure that treats the update ${ \bar { \theta } } _ { t }$ sent by each task as an approximation of the optimal parameter in hindsight $\theta _ { t } ^ { * }$ . Since this parameter determines regret on that task, by reducing the metaupdate procedure to OCO on this sequence of functions in a manner similar to (Khodak et al., 2019a), we are able to show a task-similarity-dependent bound. Following this the statistical guarantee stems from a nested online-to-batch conversion, a standard procedure to convert low-regret online-learning algorithms to low-risk distribution-learning algorithms (Cesa-Bianchi et al., 2004). + +Theorem 3.1. Suppose $\mathcal { Q }$ is a distribution over task-distributions $\mathcal { P }$ over $G$ -Lipschtz, $\beta$ -stronglysmooth, $^ { l }$ -bounded convex loss functions $\ell : \Theta \mapsto \mathbb { R }$ over parameter space $\Theta$ with diameter $D$ for $\begin{array} { r } { \beta \leq \frac { G } { D } \operatorname* { m i n } \left( \sqrt { \frac { m } { 2 } } , \frac { \varepsilon m } { 2 \sqrt { 2 d \log \frac { 1 } { \delta } } } \right) } \end{array}$ and let each $\mathcal { P }$ satisfy the quadratic growth property (1). Suppose the distribution $\mathcal { P } _ { t }$ of each task is sampled i.i.d. from $\mathcal { Q }$ and we run Algorithm 1 with the $( \varepsilon , \delta )$ -DP procedure of Bassily et al. (2019, Algorithm $I$ ) to obtain ${ \bar { \theta } } _ { t }$ as the average iterate for the meta-update step, using $n \geq 1$ steps and learning rate $\frac { \gamma } { G \sqrt { n } } f o r \gamma > 0$ . Letting $\begin{array} { r } { V ^ { 2 } = \operatorname* { m i n } _ { \phi \in \Theta } \frac { 1 } { 2 } \mathbb { E } _ { \mathcal { P } \sim \mathcal { Q } } \| \theta _ { \mathcal { P } } - \phi \| _ { 2 } ^ { 2 } } \end{array}$ , there exist settings of $n , \gamma , \eta$ such that we have the following bound on the expected transfer risk when a new task $\mathcal { P }$ is sampled from $\mathcal { Q }$ , m samples are drawn i.i.d. from $\mathcal { P }$ , and we run $O G D$ with learning rate $\eta$ starting from $\begin{array} { r } { { \hat { \phi } } = { \frac { 1 } { T } } \sum _ { t = 1 } ^ { T } \phi _ { t } } \end{array}$ and use the average $\hat { \theta }$ of the resulting iterates as the learned parameter: + +$$ +\mathbb { E } \underset { \mathcal { P } \sim \mathcal { Q } \ : \ell \sim \mathcal { P } } { \mathbb { E } } \ell ( \hat { \theta } ) \leq \underset { \mathcal { P } \sim \mathcal { Q } \ : \ell \sim \mathcal { P } } { \mathbb { E } } \ell ( \theta ^ { * } ) + \tilde { \mathcal { O } } \left( \frac { V } { \sqrt { m } } + \frac { \alpha D ^ { 2 } } { T } + \frac { 1 } { \alpha } \operatorname* { m a x } \left( \frac { d \log \frac { 1 } { \delta } } { \varepsilon ^ { 2 } m ^ { 2 } } , \frac { 1 } { m } \right) \right) +$$ + +Here $\theta ^ { * }$ is any element of $\Theta$ and the outer expectation is taken over $\ell _ { t , i } \sim \mathcal { P } _ { t } \sim \mathcal { Q }$ and the randomness of the within-task $D P$ mechanism. Note that this procedure is $( \varepsilon , \delta )$ -DP. + +Theorem 3.1 shows that one can usefully run a DP-algorithm as the within-task method in meta-√ learning and still obtain improvement due to task-similarity. Specifically, the standard term of $1 / \sqrt { m }$ is multiplied by $V$ , which is small if the tasks are related via the closeness of their risk minimizers. Thus we can use meta-learning to improve within-task performance relative to single-task learning. We also obtain a very fast convergence of $\tilde { \mathcal { O } } ( 1 / T )$ in the number of tasks. However, we do gain some $O ( 1 / m )$ terms due to the quadratic growth approximation and the privacy mechanism. Note that the assumption that both the functions and its gradients are Lipschitz-continuous are standard and required by the noisy SGD procedure of Bassily et al. (2019). + +This theorem also gives us a relatively straightforward extension if the desire is to provide $( \varepsilon , \delta )$ - group-DP. Since any privacy mechanism that provides $( \varepsilon , \delta )$ -DP also provides $( k \varepsilon , k e ^ { ( k - 1 ) \epsilon } \delta )$ -DP guarantees for groups of size $k$ (Dwork and Roth, 2014), we immediately have the following corollary. + +Corollary 3.1. Under the same assumptions and setting as Theorem 3.1, achieving $( \varepsilon , \delta )$ -group $D P$ is possible with the same guarantee except replacing $\frac { d \log { \frac { 1 } { \delta } } } { \varepsilon ^ { 2 } }$ wit h k 3 d $\begin{array} { r } { \frac { k ^ { 3 } d } { \varepsilon } + \frac { k ^ { 2 } d } { \varepsilon } \left[ \frac { 1 } { \varepsilon } \log \frac { k } { \delta } - 1 \right] } \end{array}$ + +For constant $k$ , this allows us to enjoy the stronger guarantee while maintaining largely the same learning rates. This is a useful result given that in some settings, it may be desired to simultaneously protect small groups of size $k < < m _ { t }$ , such as protecting entire families for hospital records. + +# 4 EMPIRICAL RESULTS + +We present results that show it is possible to learn useful deep models in federated scenarios while still preserving privacy against all other participants. Specifically, we evaluate the performance of models that have been trained with a task-global DP algorithm in comparison to models that have been trained both non-privately and with local DP algorithms. We evaluate performance on federated language modeling and few-shot image classification, applying a practical batched variant of Algorithm 1. + +![](images/6bf7b551960969d39cb4270213f258dac4ce3fbf1628fb1f4cb2c1861206e1cf.jpg) +Figure 2: Performance of different versions of Reptile on a next-word-prediction task for two federated datasets. We report the test accuracy on unseen tasks and repeat each experiment 10 times. Solid lines correspond to means, colored bands indicate 1 standard deviation, and dotted lines are for comparing final accuracies (private algorithms can only be trained until privacy budget is met). + +Datasets: We train a LSTM-RNN for next word prediction on two federated datasets: (1) The Shakespeare dataset as preprocessed by (Caldas et al., 2018), and (2) a dataset constructed from 3, 000 Wikipedia articles drawn from the Wiki-3029 dataset (Arora et al., 2019), where each article is used as a different task. For each dataset, we set a fixed number of tokens per task, discard tasks with fewer tokens than the specified, and discard samples from those tasks with more. We set the number of tokens per task to 800 for Shakespeare and to 1, 600 for Wikipedia, divide tokens into sequences of length 10, and we refer to these modified datasets as Shakespeare-800 and Wiki-1600. + +For few-shot image classification, we use the Omniglot (Lake et al., 2011) and Mini-ImageNet (Ravi and Larochelle, 2017) datasets, both with 5-shot-5-way test tasks. As has been done for non-private Reptile (Nichol et al., 2018), we use more training shots at meta-training (trying $m = 1 0 , 2 0 , 3 0$ for Omniglot and $m = 1 5$ , 30, 45 for Mini-ImageNet) than at meta-test time. Though tasks could be sampled indefinitely, we set a fixed budget of tasks at $T = 1 0 ^ { 6 }$ to reflect to a setting in which a finite number of training tasks constrains our learning and privacy trade-off. For both local and task-global DP, the more tasks that can be grouped in a meta-batch means that less total noise can be added at each round. However, this also means fewer iterations can be taken. We note that for the smallest values of $m$ , this setting is enough for non-private training to essentially achieve the reported final accuracies from Nichol et al. (2018). + +Meta Learning Algorithm. We study the performance of our method when applied to the batched version of Reptile (Nichol et al., 2018) (which, in our setup, reduces to personalized Federated Averaging when the meta-learning rate is set to 1.0). For the language modelling tasks, we tune various configurations of task batch size for all methods. We also allow for multiple visits per client, though at the cost of more added noise per iteration for the private methods. Additionally, for language modeling, we implement gradient clipping and exponential decay on the meta learning rate. For Omniglot and Mini-ImageNet, we use largely the same parameters as Nichol et al. (2018) but we tune the parameters most directly related to privacy: the $L _ { 2 }$ clipping threshold, the Adam Learning Rate at meta-training time, the meta-batch size, and the within-task batch size. We defer a more complete discussion of hyperparameter tuning to Appendix B. + +![](images/980bb10fd82738ffbdd39b856bb0072baf7ab0596be743b1d9753fed73b6ca3d.jpg) +Figure 3: Performance of task-global DP Reptile on 5-shot-5-way Omniglot and Mini-ImageNet. $1 0 ^ { \overline { { 5 } } }$ sampled test- tasks were used for evaluation and experiments were repeated 3 times. We do not show a line for Local DP since all hyperparameter settings tried for Local DP resulted in worse performance than the “No Meta-Learning" baseline, whose performance can always be recovered. + +Privacy Considerations. For the task-global DP models, we set on each task and we implement DP-SGD (for language model $\delta = 1 0 ^ { - 3 } < \frac { 1 } { m ^ { 1 . 1 } }$ by conventionm (for imageclassification) within-task using the tools provided by TensorFlow Privacy1, using the RDP accountant to track our privacy budgets. Although these algorithms differ from the one presented in Section 3, they still let us realistically explore the efficacy of considering task-global privacy. For the language modeling datasets, we try three different privacy budgets (as determined relative to each other by successively doubling the amount of noise added when the goal is to take 1 full gradient step per task) and make sure that all training tasks are sampled without replacement with a fixed batch size until all are seen. This is necessary since multiple visits to a single client results in degradation of the privacy guarantee for that client. We instead aim to provide the same guarantee for each client. For local-DP, though this notion of DP is stronger, we explore the same privacy budgets so as to obtain guarantees that are of the same confidence. Here, we essentially run the DP-FedAvg algorithm from (McMahan et al., 2018) with some key changes. First, to get local DP instead of global, we add Gaussian noise to each clipped set of model updates before returning them to the central server instead of after aggregation. Second, while additional gradient steps within-task do not increase the amount of noise required, we do again iterate through tasks without replacement. Unlike for global DP, we cannot hope to have any privacy boosts due to sub-sampling if the meta-learner knows who it is communicating with. + +Results. Figure 2 shows the performance of both the non-private and task-global private versions of Reptile (Nichol et al., 2018) for the language modelling tasks across three different privacy budgets. As expected, neither private algorithm reaches the same accuracy of the non-private version of the algorithm. Nonetheless, the task-global version still comes within $7 8 \%$ , $8 8 \%$ , and $9 2 \%$ of the nonprivate accuracy for Shakespeare-800 and within $7 2 \%$ , $8 2 \%$ , and $8 3 \%$ for Wiki-1600. Meanwhile achieving local DP results in only about $5 5 \%$ and $5 0 \%$ of the non-private accuracy on both datasets for the most generous privacy budget. In practice, these differences can be toggled by further changing the privacy budget or continuing to trade off more training iterations for larger noise multipliers. + +We display results for few-shot image classification on Omniglot and Mini-ImageNet in Figure 3. In this setting, not applying meta-learning results in meta-test accuracies of around $6 2 \%$ and $3 6 \%$ , respectively. Thus, while performance is indeed lower than non-private learning, applying task-global DP does result in meta-learning benefits for test-time tasks. In settings where privacy is a concern, this increase in performance is still significantly advantageous for the “task-owners”– test-time tasks (who hold less data). On average, they are able to obtain better models and are still guaranteed privacy at a single-digit $\varepsilon$ . Intuitively, larger training-task datasets make it easier to apply privacy within-task, and in accordance with our learning guarantees, adding training shots indeed closes the gap in performance between task-global DP Reptile and non-private Reptile. In comparison, applying local-DP for a similar hyperparameter range consistently decreases performance at test-time. However, the no-meta-learning baseline is a theoretical lower bound for local-DP, as one could set the clipping threshold or meta-learning rate close to 0 to recover the effects of no meta-learning. + +# 5 CONCLUSIONS + +In this work, we have outlined and studied the issue of privacy in the context of meta-learning. Focusing on the class of gradient-based parameter-transfer methods, we used differential privacy to address the privacy risks posed to task-owners by sharing task-specific models with a central meta-learner. To do so, we formalized and considered the notion of task-global differential privacy, which guarantees that individual examples from the tasks are protected from all downstream agents (and particularly the meta-learner). Working in this privacy model, we developed a differentially private algorithm that guarantees both this protection as well as learning-theoretic results in the convex setting. Finally, we demonstrate how this notion of privacy can translate into useful deep learning models for non-convex language modelling and image-classification tasks. + +# ACKNOWLEDGMENTS + +This work was supported in part by DARPA FA875017C0141, the National Science Foundation grants IIS1618714, IIS1705121, and IIS1838017, an Okawa Grant, a Google Faculty Award, an Amazon Web Services Award, a JP Morgan A.I. Research Faculty Award, and a Carnegie Bosch Institute Research Award. 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 DARPA, the National Science Foundation, or any other funding agency. + +# REFERENCES + +Naman Agarwal, Ananda Theertha Suresh, Felix Xinnan X Yu, Sanjiv Kumar, and Brendan McMahan. cpsgd: Communication-efficient and differentially-private distributed sgd. In Advances in Neural Information Processing Systems 31, pages 7564–7575. Curran Associates, Inc., 2018. + +Sanjeev Arora, Hrishikesh Khandeparkar, Mikhail Khodak, Nikunj Saunshi, and Orestis Plevrakis. A theoretical analysis of contrastive unsupervised representation learning. In Proceedings of the 36th International Conference on Machine Learning, 2019. + +Raef Bassily, Vitaly Feldman, Kunal Talwar, and Abhradeep Thakurta. Private stochastic convex optimization with optimal rates. arXiv, 2019. URL https://arxiv.org/abs/1908.09970. + +Jonathan Baxter. A model of inductive bias learning. Journal of Artificial Intelligence Research, 12: 149–198, 2000. + +Abhishek Bhowmick, John Duchi, Julien Freudiger, Gaurav Kapoor, and Ryan Rogers. Protection against reconstruction and its applications in private federated learning, 2019. https://arxiv. org/abs/1812.00984. + +Sebastian Caldas, Peter Wu, Tian Li, Jakub Konecný, H. Brendan McMahan, Virginia Smith, and Ameet Talwalkar. LEAF: A benchmark for federated settings, 2018. URL http://arxiv. org/abs/1812.01097. +Nicholas Carlini, Chang Liu, Jernej Kos, Úlfar Erlingsson, and Dawn Song. The secret sharer: Measuring unintended neural network memorization & extracting secrets, 2018. URL http: //arxiv.org/abs/1802.08232. +Nicoló Cesa-Bianchi, Alex Conconi, and Claudio Gentile. On the generalization ability of on-line learning algorithms. IEEE Transactions on Information Theory, 50(9):2050–2057, 2004. +Fei Chen, Zhenhua Dong, Zhenguo Li, and Xiuqiang He. Federated meta-learning for recommendation. CoRR, abs/1802.07876, 2018. URL http://arxiv.org/abs/1802.07876. +Giulia Denevi, Carlo Ciliberto, Riccardo Grazzi, and Massimiliano Pontil. Learning-to-learn stochastic gradient descent with biased regularization, 2019. URL http://arxiv.org/abs/1903. 10399. +John Duchi, Martin Wainwright, and Michael Jordan. Minimax optimal procedures for locally private estimation. In Journal of the American Statistical Association. 2018. +Cynthia Dwork and Aaron Roth. The algorithmic foundations of differential privacy. Foundations and Trends in Theoretical Computer Science, 9(3&4):211–407, 2014. doi: 10.1561/0400000042. +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, 2017. +Chelsea Finn, Aravind Rajeswaran, Sham M. Kakade, and Sergey Levine. Online meta-learning. In Proceedings of the 36th International Conference on Machine Learning, 2019. +Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security, pages 1322–1333, 2015. +Robin C. Geyer, Tassilo J. Klein, and Moin Nabi. Differentially private federated learning: A client level perspective, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SkVRTj0cYQ. +Bargav Jayaraman and David Evans. When relaxations go bad: "differentially-private" machine learning, 2019. URL http://arxiv.org/abs/1902.08874. +Mikhail Khodak, Maria-Florina Balcan, and Ameet Talwalkar. Provable guarantees for gradient-based meta-learning. In Proceedings of the 36th International Conference on Machine Learning, 2019a. +Mikhail Khodak, Maria-Florina Balcan, and Ameet Talwalkar. Adaptive gradient-based meta-learning methods. In Advances in Neural Information Processing Systems, 2019b. To Appear. +Brenden M. Lake, Ruslan Salakhutdinov, Jason Gross, and Joshua B. Tenenbaum. One shot learning of simple visual concepts. In CogSci, 2011. +Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated learning: Challenges, methods, and future directions, 2019. URL http://arxiv.org/abs/1908.07873. +H Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, pages 1273–1282, 2017. +H. Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. Learning differentially private language models. In ICLR, 2018. +Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. CoRR, abs/1803.02999, 2018. URL http://arxiv.org/abs/1803.02999. +Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In Proceedings of the 5th International Conference on Learning Representations, 2017. +Shai Shalev-Shwartz and Shai Ben-David. Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press, 2014. +Reza Shokri, Marco Stronati, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In Proceedings of 2017 IEEE Symposium on Security and Privacy, pages 3–18, 2017. +Virginia Smith, Chao-Kai Chiang, Maziar Sanjabi, and Ameet Talwalkar. Federated multi-task learning. In Advances in Neural Information Processing Systems 31, 2017. +Salvatore J. Stolfo, David W. Fan, Wenke Lee, Andreas L. Prodromidis, and Philip K. Chan. Credit card fraud detection using meta-learning: Issues and initial results 1. In Working notes of AAAI Workshop on AI Approaches to Fraud Detection and Risk Management., 1997. +Stacey Truex, Nathalie Baracaldo, Ali Anwar, Thomas Steinke, Heiko Ludwig, and Rui Zhang. A hybrid approach to privacy-preserving federated learning, 2019. URL http://arxiv.org/ abs/1812.03224. +Xi Sheryl Zhang, Fengyi Tang, Hiroko Dodge, Jiayu Zhou, and Fei Wang. Metapred: Metalearning for clinical risk prediction with limited patient electronic health records, 2019. URL https://arxiv.org/abs/1905.03218. + +# A PROOFS OF LEARNING GUARANTEES + +Setting A.1. We assume that at each time-step t an adversary chooses a task-distribution $\mathcal { P } _ { t }$ over loss-functions on $\Theta \subset \mathbb { R } ^ { d }$ and samples m loss functions $\ell _ { t , i }$ for $i \in [ m ]$ . At each time-step $t$ the tasklearner receives a parameter $\phi _ { t }$ from the meta-learner, runs online gradient descent with step-size $\eta > 0$ starting from $\phi _ { t }$ , and uses the average iterate $\widehat { \theta } _ { t }$ as its learned parameter. The task-learner also runs Algorithm $I$ of Bassily et al. (2019) for $\begin{array} { r } { n = \operatorname* { m i n } \left\{ \frac { m } { 8 } , \frac { \varepsilon ^ { 2 } m ^ { 2 } } { 3 2 d \log \frac { 1 } { \delta } } \right\} } \end{array}$ steps with learning rate $\frac { \gamma } { G \sqrt { n } } > 0$ on these loss functions and sends the result ${ \bar { \theta } } _ { t }$ to the meta-learner. The meta-learner updates $\phi _ { t + 1 } = ( 1 - 1 / t ) \phi _ { t } + \bar { \theta } _ { t } / t$ . We assume all loss functions are $G$ -Lipschitz w.r.t. $\| \cdot \| _ { 2 }$ and $\beta$ -strongly-smooth w.r.t. $\| \cdot \| _ { 2 }$ for some $\begin{array} { r } { \beta \leq \frac { G } { D } \operatorname* { m i n } \left\{ \sqrt { \frac { m } { 2 } } , \frac { \varepsilon n } { 2 \sqrt { 2 d \log \frac { 1 } { \delta } } } \right\} } \end{array}$ , where $D$ is the diameter of $\Theta$ . For each distribution $\mathcal { P } _ { t }$ let $\ell _ { t } ( \theta ) = \mathbb { E } _ { \ell \sim \mathcal { P } _ { t } } ( \theta )$ be its population risk, $\begin{array} { r } { \hat { \ell } _ { t } ( \theta ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \ell _ { t , i } ( \theta ) b e } \end{array}$ its empirical risk, and $\theta _ { t } ^ { * } \in \arg \operatorname* { m i n } _ { \theta \in \Theta } \ell _ { t } ( \theta )$ be the closest population risk minimizer to ${ \bar { \theta } } _ { t }$ . + +Lemma A.1. In Setting A.1 we have + +$$ +\mathbb { E } \ell _ { t } ( \hat { \theta } _ { t } ) - \ell _ { t } ( \theta _ { t } ^ { * } ) \leq 5 G \left( \frac { \| \phi _ { t } - \theta _ { t } ^ { * } \| _ { 2 } ^ { 2 } } { \gamma } + \gamma \right) \operatorname* { m a x } \left\{ \frac { \sqrt { d \log \frac { 1 } { \delta } } } { \varepsilon m } , \frac { 1 } { \sqrt { m } } \right\} +$$ + +Proof. Similarly to Lemma 3.3 in Bassily et al. (2019), applying standard OGD analysis (e.g. Lemmas 14.1 and 14.9 of Shalev-Shwartz and Ben-David (2014)) to noisy gradient vectors and taking expectations yields + +$$ +\mathbb { E } \left( \hat { \ell } _ { t } ( \hat { \theta } _ { t } ) - \hat { \ell } _ { t } ( \theta _ { t } ^ { * } ) \right) \leq \frac { \| \phi _ { t } - \theta _ { t } ^ { * } \| _ { 2 } ^ { 2 } } { 2 \eta n } + \frac { \eta G ^ { 2 } } { 2 } + \eta \sigma ^ { 2 } d +$$ + +where $n$ is the number of steps in noisy SGD and $\sigma ^ { 2 }$ is the variance of the noise added at each step. As in the proof of Theorem 3.2 of Bassily et al. (2019), substituting $\begin{array} { r } { \sigma ^ { 2 } = \frac { 8 n G ^ { 2 } \log \frac { 1 } { \delta } } { m ^ { 2 } \varepsilon ^ { 2 } } } \end{array}$ and applying the stability result in Lemma 3.4 of the same paper yields + +$$ +\mathbb { E } \ell _ { t } ( \hat { \theta } _ { t } ) - \ell _ { t } ( \theta _ { t } ^ { * } ) \leq \frac { \| \phi _ { t } - \theta _ { t } ^ { * } \| _ { 2 } ^ { 2 } } { 2 \eta n } + \frac { \eta G ^ { 2 } } { 2 } \left( \frac { 1 6 n d \log \frac { 1 } { \delta } } { m ^ { 2 } \varepsilon ^ { 2 } } + 1 \right) + \frac { \eta G ^ { 2 } n } { m } +$$ + +Substituting $\begin{array} { r } { n = \operatorname* { m i n } \left\{ \frac { m } { 8 } , \frac { \varepsilon ^ { 2 } m ^ { 2 } } { 3 2 d \log \frac { 1 } { \delta } } \right\} } \end{array}$ and $\begin{array} { r } { \eta = \frac { \gamma } { G \sqrt { n } } } \end{array}$ yields the result. + +Lemma A.2. In Setting A.1, fix some $\phi ^ { * } \in \Theta$ and define $\begin{array} { r } { \bar { V } ^ { 2 } = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } \| \phi ^ { * } - \theta _ { t } ^ { * } \| _ { 2 } ^ { 2 } } \end{array}$ . Then for $\begin{array} { r } { \gamma = \frac { 1 2 0 G } { \alpha } \operatorname* { m a x } \left\{ \frac { \sqrt { d \log \frac { 1 } { \delta } } } { \varepsilon m } , \frac { 1 } { \sqrt { m } } \right\} } \end{array}$ we have + +$$ +\mathbb { E } \sum _ { t = 1 } ^ { T } \frac { \| \phi _ { t } - \theta _ { t } ^ { * } \| _ { 2 } ^ { 2 } } { 2 \eta m } \leq \frac { D ^ { 2 } ( 1 + \log T ) + 4 \hat { V } ^ { 2 } T } { 2 \eta m } + \frac { 7 2 0 0 G ^ { 2 } } { \alpha ^ { 2 } \eta m } \operatorname* { m a x } \left\{ \frac { d \log \frac { 1 } { \delta } } { \varepsilon ^ { 2 } m ^ { 2 } } , \frac { 1 } { m } \right\} T +$$ + +Proof. We first bound the left-hand side without the denominator as + +$$ +\begin{array} { r l } { \varepsilon _ { \perp } \ge \frac { \varepsilon _ { \perp } } { \varepsilon _ { \perp } } \ge \frac { 1 } { \varepsilon _ { \perp } } \ge } & { \varepsilon _ { \perp } } \\ & { = 1 } \\ & { \le 2 \kappa \sum _ { i = 1 } ^ { \nu } \| \partial _ { i } - \partial _ { i } \xi \| ^ { 2 } + \| \partial _ { i } - \theta _ { i } \| ^ { 2 } } \\ & { \le D ^ { \perp } ( 1 - \log { \varepsilon _ { \perp } } ) + 2 \sum _ { i = 1 } ^ { \nu } \| \phi - \varepsilon _ { \perp } \| ^ { 2 } + \| \partial _ { i } - \partial _ { i } \xi \| ^ { 2 } } \\ & { \le D ^ { \perp } ( 1 - \log { \varepsilon _ { \perp } } ) + 2 \sum _ { i = 1 } ^ { \nu } \| \phi - \varepsilon _ { \perp } \| ^ { 2 } + \| \partial _ { i } - \partial _ { i } \xi \| ^ { 2 } } \\ & { \le p ^ { 2 } \varepsilon _ { \perp } ^ { 2 } + 1 - \log { \varepsilon _ { \perp } } ) + 2 \sum _ { i = 1 } ^ { \nu } 2 \| \phi - \varepsilon _ { \perp } \| ^ { 2 } + \| \partial _ { i } - \partial _ { i } \xi \| ^ { 2 } } \\ & { = p ^ { 2 } \varepsilon _ { \perp } ^ { 2 } ( 1 - \log { \varepsilon _ { \perp } } ) + 4 \kappa ^ { 2 } T ^ { 2 } + 4 \| \partial _ { i } ^ { 2 } \sum _ { i = 1 } ^ { \nu } \| \hat { \varepsilon } _ { i } - \partial _ { i } \xi \| ^ { 2 } } \\ & { = D ^ { \perp } ( 1 - \log { \varepsilon _ { \perp } } ) + 4 \kappa ^ { 2 } T ^ { 2 } + 4 \| \partial _ { i } ^ { 2 } \sum _ { i = 1 } ^ { \nu } 2 \hat { \varepsilon } _ { \perp } \phi _ { i } ^ { 2 } - \varepsilon _ { \perp } ( | \partial _ { i } \xi | ^ { 2 } ) } \\ & { \le D ^ { \perp } ( 1 - \log { \varepsilon _ { \perp } } ) + 4 \kappa ^ { 2 } T ^ { 2 } + \frac { 1 } { \omega _ { \perp } } \sum _ { i = 1 } ^ { \nu } 2 \hat { \varepsilon } _ { \perp } ( \rho _ { i } ) - 6 \hat { \varepsilon } ( | \hat { \varepsilon } _ { \perp } - \hat { \varepsilon } _ { \perp } | ^ { 2 } ) } \\ & \le D ^ { \perp } ( 1 - \ \end{array} +$$ + +where in the last step we applied Lemma A.1. Substituting $\begin{array} { r } { \gamma = \frac { 1 2 0 G } { \alpha } \operatorname* { m a x } \left\{ \frac { \sqrt { d \log \frac { 1 } { \delta } } } { \varepsilon m } , \frac { 1 } { \sqrt { m } } \right\} } \end{array}$ yields + +$$ +\mathbb { E } \sum _ { t = 1 } ^ { T } \| \phi _ { t } - \theta _ { t } ^ { * } \| _ { 2 } ^ { 2 } \leq D ^ { 2 } ( 1 + \log T ) + 4 { \bar { V } } ^ { 2 } T + \frac { 1 4 4 0 0 G ^ { 2 } } { \alpha ^ { 2 } } \operatorname* { m a x } \left\{ \frac { d \log \frac { 1 } { \delta } } { \varepsilon ^ { 2 } m ^ { 2 } } , \frac { 1 } { m } \right\} T +$$ + +The result follows by dividing by 2ηm. + +Theorem A.1. In Setting A.1, suppose all distributions $\mathcal { P } _ { t }$ were drawn i.i.d. from some metadistribution $\mathcal { Q }$ and we used $\begin{array} { r } { \gamma = \frac { 1 2 0 G } { \alpha } \operatorname* { m a x } \left\{ \frac { \sqrt { d \log \frac { 1 } { \delta } } } { \varepsilon m } , \frac { 1 } { G \sqrt { m } } \right\} } \end{array}$ . Suppose we draw another taskdistribution $\mathcal { P } \sim \mathcal { Q }$ with population risk $\ell _ { \mathcal { P } }$ and minimizer $\theta _ { \mathcal { P } }$ , set $\begin{array} { r } { \hat { \phi } = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \phi _ { t } } \end{array}$ , and run OGD with learning rate $\begin{array} { r } { \eta = \frac { V + \frac { 1 } { \alpha \sqrt { m } } } { \sqrt { m } } } \end{array}$ starting from $\hat { \phi }$ on m samples from $\mathcal { P }$ . Then the average iterate $\hat { \theta }$ satisfies + +$$ +\mathbb { E } ( \ell _ { \mathcal { P } } ( \hat { \theta } ) - \ell _ { \mathcal { P } } ( \theta ^ { * } ) ) \le \frac { 7 G V } { 2 \sqrt { m } } + \frac { 7 2 0 1 G } { \alpha } \operatorname* { m a x } \left\{ \frac { d \log \frac { 1 } { \delta } } { \varepsilon ^ { 2 } m ^ { 2 } } , \frac { 1 } { m } \right\} + \frac { \alpha G D ^ { 2 } } { 2 T } ( 1 + \log T ) +$$ + +for $\begin{array} { r } { V ^ { 2 } = \operatorname* { m i n } _ { \phi \in \Theta } \mathbb { E } _ { \mathcal { P } \sim \mathcal { Q } } \operatorname* { m a x } _ { \theta _ { \mathcal { P } } } \| \phi - \theta _ { \mathcal { P } } \| _ { 2 } ^ { 2 } . } \end{array}$ + +Proof. Applying online-to-batch conversion (e.g. Proposition A.1 in Khodak et al. (2019b)) twice and substituting Lemma A.2 yields + +$$ +\begin{array} { r l } & { \mathbb { E } ( \ell _ { \mathcal { P } } ( \hat { \theta } ) - \ell _ { \mathcal { P } } ( \theta ^ { * } ) ) } \\ & { \qquad \le \mathbb { E } \frac { \| \hat { \phi } - \theta ^ { * } \| _ { 2 } ^ { 2 } } { 2 \eta m } + \eta G ^ { 2 } } \\ & { \qquad \le \mathbb { E } \frac { \| \hat { \phi } ^ { * } - \theta ^ { * } \| _ { 2 } ^ { 2 } } { 2 \eta m } + \eta G ^ { 2 } + \frac { 1 } { 2 \eta m T } \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } \| \phi _ { t } - \theta _ { t } ^ { * } \| _ { 2 } ^ { 2 } } \\ & { \qquad \le \mathbb { E } \frac { \| \hat { \phi } ^ { * } - \theta ^ { * } \| _ { 2 } ^ { 2 } } { 2 \eta m } + \eta G ^ { 2 } + \frac { D ^ { 2 } \frac { 1 + \log T } { T } } { 2 \eta m } + 4 \mathbb { E } \bar { V } ^ { 2 } + \frac { 7 2 0 0 G ^ { 2 } } { \alpha ^ { 2 } \eta m } \operatorname* { m a x } \left\{ \frac { d \log \frac { 1 } { \delta } } { \varepsilon ^ { 2 } m ^ { 2 } } , \frac { 1 } { m } \right\} } \\ & { \qquad = \frac { 5 V ^ { 2 } } { 2 \eta m } + \eta G ^ { 2 } + \frac { 7 2 0 0 G ^ { 2 } } { \alpha ^ { 2 } \eta m } \operatorname* { m a x } \left\{ \frac { d \log \frac { 1 } { \delta } } { \varepsilon ^ { 2 } m ^ { 2 } } , \frac { 1 } { m } \right\} + \frac { D ^ { 2 } } { 2 \eta m T } ( 1 + \log T ) } \end{array} +$$ + +where we have applied $\mathbb { E } \bar { V } ^ { 2 } \le V ^ { 2 }$ . Substituting $\begin{array} { r } { \eta = \frac { V + \frac { 1 } { \alpha \sqrt { m } } } { G \sqrt { m } } } \end{array}$ yields the result. + +# B EXPERIMENT DETAILS + +Datasets: We train a next word predictor for two federated datasets: (1) The Shakespeare dataset as preprocessed by (Caldas et al., 2018), and (2) a dataset constructed from Wikipedia articles, where each article is used as a different task. For each dataset, we set a fixed number of tokens per task, discard tasks with less tokens than the specified, and discard samples from those tasks with more. For Shakespeare, we set the number of tokens per task to 800 tokens, leaving 279 tasks for meta-training, 31 for meta-validation, and 35 for meta-testing. For Wikipedia, we set the number of tokens to 1, 600, which corresponds to having 2, 179 tasks for meta-training, 243 for meta-validation, and 606 for meta-testing. For the meta-validation and meta-test tasks, $7 5 \%$ of the tokens are used for local training, and the remaining $2 5 \%$ for local testing. + +For the few-shot image classification experiments, we follow the standard set-up by splitting labels into training and testing and forming training tasks by randomly drawing labels from the training set. At evaluation time, we draw from the test set. + +Model Structure: Our model first maps each token to an embedding of dimension 200 before passing it through an LSTM of two layers of 200 units each. The LSTM emits an output embedding, which is scored against all items of the vocabulary via dot product followed by a softmax. We build the vocabulary from the tokens in the meta-training set and fix its length to 10, 000. We use a sequence length of 10 for the LSTM and, just as (McMahan et al., 2018), we evaluate using AccuracyTop1 (i.e., we only consider the predicted word to which the model assigned the highest probability) and consider all predictions of the unknown token as incorrect. For Omniglot and Mini-ImageNet, we use the architectures from Nichol et al. (2018) to also match the ones from Finn et al. (2017). We evaluate in the standard transductive setting. + +Hyperparameters: For the language-modeling experiments, we tune the hyperparameters on the set of meta-validation tasks. For both datasets and all versions of the meta-learning algorithm, we tune hyperparameters in a two step process. We first tune all the parameters that are not related to refinement: the meta learning rate, the local (within-task) meta-training learning rate, the maximum gradient norm, and the decay constant. Then, we use the configuration with the best accuracy pre-refinement and then tune the refinement parameters: the refine learning rate, refine batch size, and refine epochs. + +All other hyperparameters are kept fixed for the sake of comparison: full batch steps were taken on within-task data, with the maximum number of microbatches used for the task-global DP model. The parameter search spaces from which we sample are given in Tables 2, 3, 4 while Tables 5 and 6 contain our final choices. Note that the space for Local DP, especially in terms of the clipping threshold, is distinctively different from the others, as we did not find that searching through ranges similar to those for non-private and task-global DP led to learning high-quality meta-initializations. + +For Omniglot, we largely based our hyperparameters on the choices of Nichol et al. (2018) for 5-way classification. We vary $m$ , the number of training shots, but we continue to take 5 SGD steps of expected size $m$ within task and we leave the test-time SGD procedure exactly the same. However, we do tune for privacy clipping thresholds $\{ 0 . 0 1 , 0 . 0 2 5 , 0 . 0 5 , 0 . 1 , 0 . 2 , 0 . 3 , 0 . 4 , 0 . 5 \}$ , Adam Learning Rates for meta-training tasks $\left\{ 1 0 ^ { - 4 } , 5 \times \mathrm { i } 0 ^ { - 4 } , 1 0 ^ { - 3 } , 5 \times 1 0 ^ { - 3 } \right\}$ , and meta-batch sizes of $\{ 5 , 1 5 , \bar { 2 5 } , 5 0 \}$ . + +For Mini-ImageNet, we perform a similar search except we also double the inner batch size to $2 m$ (trading off less privacy amplification due to subsampling). We continue to tune for privacy clipping thresholds $\{ 0 . 0 1 , \dot { 0 } . 0 2 \dot { 5 } , 0 . 0 5 , 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 , 1 . 1 , 1 . 3 , 1 . 5 \}$ , Adam Learning Rates $\{ 1 \bar { 0 } ^ { - 4 } , \bar { 5 } \times 1 0 ^ { - 4 } , 1 0 ^ { \dot { - } 3 } , 5 \times 1 0 ^ { - 3 } \}$ , and meta-batch sizes of $\{ 5 , 1 5 , 2 5 , 5 0 \}$ . + +Table 2: Hyperparameter Search Space for Non-Private Training + +
Shakespeare-800Wiki-1600
VisitsPerTask{1,2,3,4,5,6,7,8,9}{1,2,3}
Tasks Per Round{5,10}{5,10}
Within-Task Steps{1,3,5,7,9}{1,3,5,7,9}
Meta LR{1,√2,2,2√2,4,4√2,8,8√2}{1,√2,2,2√2,4,4√2,8,8√2}
Meta Decay Rate Within-Task LR{0,0.001,0.005,0.01,0.025,0.05,0.1}{0,0.001,0.005,0.01,0.025,0.05}
{1,√2,2,2√2,4,4√2,8}{1,√2,2,2√2,4,4√2,8}
{0.4,0.5,0.6,0.7, 0.8, 0.9, 1.0}{0.3, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}
Refine LR Refine Batch Size{0.1, 0.15,0.3,0.5,0.7, 0.8}{0.1,0.15, 0.3,0.5, 0.7, 0.8}
{10,20,30,60}{10,20,30,60,120}
Refine Epochs{1,2,3}{1,2,3}
+ +Table 3: Hyperparameter Search Space for Task-Global DP Training + +
Shakespeare-800Wiki-1600
VisitsPerTask{1,2,3}{1,2}
TasksPerRound{5,10}{5,10}
Within-Task Steps11
MetaLR{1,√2,2,2√2,4,4√2,8,8√2}{1,√2,2,2√2,4,4√2,8,8√2}
Meta Decay Rate{0,0.001,0.005,0.01, 0.025, 0.05,0.1}{0,0.001,0.005,0.01, 0.025, 0.05}
Within-Task LR{1,√2,2√2,4,4√2,8}{1,√2,2√2,4,4√2,8}
L2 Clipping{0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}{0.3, 0.4, 0.5, 0.6, 0.7, 0.8,0.9,1.0}
Refine LR{0.1,0.15,0.3,0.5,0.7, 0.8}{0.1,0.15,0.3,0.5,0.7, 0.8}
Refine Batch Size{10,20,30,60}{10,20,30,60,120}
Refine Epochs{1,2,3}{1,2,3}
+ +Table 4: Hyperparameter Search Space for Local-DP Training + +
Shakespeare-800Wiki-1600
VisitsPerTask{1,2,3}{1,2}
Tasks Per Round{5,10,20}{10,20,40,80}
Within-Task Steps{1,2,3}{1,2,3}
Meta LR{1,√2,2,2√2,4,4√2,8,8√2}{1,√2,2,2√2,4,4√2,8,8√2}
Meta Decay Rate{0,0.001,0.005,0.01,0.025,0.05,0.1}{0,0.001,0.005,0.01,0.025,0.05}
Within-Task LR{1,√2,2√2,4,4√2,8}{1,√2,2√2,4,4√2,8}
L2 Clipping{0.005,0.01,0.025,0.05,0.1,0.25,0.5}{0.005,0.01,0.025,0.05,0.1,0.25}
Refine LR{0.1,0.15,0.3,0.5,0.7,0.8}{0.1,0.15,0.3,0.5, 0.7, 0.8}
Refine Batch Size{10,20,30,60}{10,20,30,60,120}
Refine Epochs{1,2,3}{1,2,3}
+ +Table 5: Final Hyperparameters for Shakespeare-800 + +
Non- privateT-G £= 22.5T-G £=9.2T-G ε= 4.5Local ε= 22.5Local £=9.2Local ε= 4.5
Visits Per Task7221221
Tasks Per Round555520520
Within-Task Steps5111412
Meta LR88√288√24√24√24
Meta Decay Rate0.010.010.010.050.100
Within-Task LR22√2224√24√21
L2 Clipping0.50.60.50.40.10.010.01
RefineLR0.150.50.10.30.80.80.5
Refine Batch Size30106030101010
Refine Epochs1113333
+ +Table 6: Final Hyperparameters for Wiki-800 + +
Non- privateT-G £= 22.5T-G £=9.2T-G ε= 4.5Local £= 22.5Local £=9.2Local £= 4.5
VisitsPerTask2111111
Tasks Per Round5101020202020
Within-Task Steps3111222
Meta LR2√22√24484√28
Meta Decay Rate0.00100.0010.0050.0050.0250
Within-Task LR284√282√22√22√2
L2 Clipping10.80.70.80.0250.050.005
Refine LR0.10.80.50.70.80.80.8
Refine Batch Size10106010101010
Refine Epochs1222223
\ No newline at end of file diff --git a/md/train/rJlHIo09KQ/rJlHIo09KQ.md b/md/train/rJlHIo09KQ/rJlHIo09KQ.md new file mode 100644 index 0000000000000000000000000000000000000000..73c42a5a4dc17d98816568f361db8c749913b66e --- /dev/null +++ b/md/train/rJlHIo09KQ/rJlHIo09KQ.md @@ -0,0 +1,348 @@ +# GRADIENT-BASED TRAINING OF SLOW FEATUREANALYSIS BY DIFFERENTIABLE APPROXIMATEWHITENING + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +We propose Power Slow Feature Analysis, a gradient-based method to extract temporally slow features from a high-dimensional input stream that varies on a faster time-scale, as a variant of Slow Feature Analysis (SFA). While displaying performance comparable to hierarchical extensions to the SFA algorithm, such as Hierarchical Slow Feature Analysis, for a small number of output-features, our algorithm allows fully differentiable end-to-end training of arbitrary differentiable approximators (e.g., deep neural networks). We provide experimental evidence that PowerSFA is able to extract meaningful and informative low-dimensional features in the case of (a) synthetic low-dimensional data, (b) visual data, and also for (c) a general dataset for which symmetric non-temporal relations between points can be defined. + +# 1 INTRODUCTION + +Finding meaningful representations in data is a core challenge in modern machine learning as the performance in many goal-directed frameworks, such as reinforcement learning or supervised learning, is strongly influenced by the quality of the former. Usually, features are either domain specific or acquired through learning. Most currently successful approaches for either deep supervised learning (Goodfellow et al. (2016)) or reinforcement learning (Sutton & Barto (1998)) rely on a training signal, i.e., a classification label or reward, to provide sufficient indication which features of the input data should be extracted to increase performance. However, in most real-world scenarios labels have to be provided by expert knowledge and reward signals are sparse. In unsupervised representation learning, one tries to find and apply a principle by which to extract meaning from data without assuming the availability of any goal-driven metrics. + +Examples for such principles are based on reconstruction error in principal component analysis or autoencoder networks (Bourlard & Kamp (1988)), statistical dependence of extracted features in independent component analysis (Comon (1994)), indistinguishability of synthetically generated data from samples of the input distribution in generative adversarial nets (Goodfellow et al. (2014)). Further examples include: fitting the probability distribution of input data with variational autoencoders (Kingma & Welling (2013)), neighborhood preservation used in locally linear embedding (LLE, Roweis & Saul (2000)), Laplacian eigenmaps (LEM, Belkin & Niyogi (2003)), as well as temporal coherence as used in slow feature analysis, (SFA, Wiskott & Sejnowski (2002)) or regularized slowness optimization (Bengio & Bergstra (2009)). Temporal coherence is the focus of this work and has been shown to provide a useful proxy for extracting underlying causes from time-series data such as position, head direction, identity of spatial view similar to those observed in rodent brains (Franzius et al. (2007)) from ego-visual data. The principle has also been successfully applied to determining object configuration (identity, position, angle) from a tabletop view of moving objects (Franzius et al. (2011)) in the form of SFA. A graph-based generalization of SFA has been used to achieve (at that time) state-of-the-art age estimation results on the MORPH dataset in Escalante-B. (2017). + +We propose a variant of SFA that approximately enforces the same constraints while being differentiable and thus allows training by gradient-descent-derived methods. This makes it possible to leverage the representational power of complex models, such as deep neural networks, and useful ideas from that domain (dropout, batch normalization, activation regularization) to extract slow and informative features from data. To demonstrate the applicability of this approach, we provide three distinct experimental evaluations. + +# 2 RELATED WORK + +# 2.1 SLOWNESS-BASED METHODS + +While the original proposal of SFA by Wiskott & Sejnowski (2002) uses non-linear basis functions as a method to introduce non-linearity to the otherwise linear model, this classical approach has two limitations: (a) The basis functions are fixed and thus have to be chosen beforehand by expert knowledge or trial-and-error, and $\mathbf { ( b ) }$ as the resulting model is shallow, its expressivity tends to scale unfavorably in the dimension of the expansion (Raghu et al. (2016)) compared to hierarchical extensions discussed later. In the case of polynomial expansion, expanding to degree $d$ on $e$ -dimensional input data results in $\textstyle { \binom { d + e } { d } }$ -dimensional expanded data, e.g., quadratically expanding grayscale images of $1 8 0 \times 9 0$ pixels results in an output dimension $> 1 3 1 \cdot 1 0 ^ { 6 }$ . Extracting a single feature with a linear model would thus require 5.7-times more parameters than the modern and powerful Xception network (Chollet (2016)). + +An alternative approach to increase expressivity using expansions is to apply low-degree nonlinearities repeatedly in a receptive-field fashion, interlacing them with projection steps. This has been done in Hierarchical SFA (HSFA, Franzius et al. (2007) and Escalante-B. & Wiskott (2016)) and deep architectures in general. But while the latter are typically trained in an end-to-end fashion by variants of stochastic gradient-descent, HSFA is trained in a layer-wise procedure, solving the linear SFA problem consecutively for each layer as closed-form solution and thereby assuming that globally slow features can be composed of decreasingly local slow features. Escalante-B. & Wiskott (2016) shows that this assumption can be partially relaxed by adding information by-passes to the model. Compared to HSFA, our method allows directly modifying parameters in different layers to optimize a global slowness objective. + +Our algorithm is in line with recent work harnessing the temporal coherence prior by Bengio et al. (2013) in deep, self-supervised feature learning. This can be done by having a slowness term in the loss function. To avoid the trivial, constant solution, another term is usually added. For example, a reconstruction loss in an auto-encoder (Goroshin et al. (2015a)) or one-step latent code prediction (Goroshin et al. (2015b)). Deep temporal coherence has also been considered via the lens of similarity metric learning, for example by optimizing a contrastive loss (Jayaraman & Grauman (2016), Mobahi et al. (2009)) or a triplet loss (Jansen et al. (2017), Wang & Gupta (2015)). These metric learning approaches manage to avoid degenerate solutions by pushing points away from each other (in feature space) that are not temporal neighbors. Our work differs from these approaches as we seek to directly approximate the optimization problem as originally stated by Wiskott & Sejnowski (2002) in a deep learning setting, automatically handling the constant solution and ensuring that different features code for different information. + +# 2.2 GRAPH-BASED METHODS + +SFA has been generalized to graph-based SFA (GSFA, Escalante-B. & Wiskott (2013)) and generalized SFA (Sprekeler (2011)). The former adapts only the objective function, while the latter additionally generalizes the constraints to D-orthogonality $\mathbf { D }$ being the degree matrix of an underlying graph). Following generalized SFA, standard SFA can be shown to be a special case of Laplacian Eigenmaps. + +Spectral Inference Networks (SpIN, Pfau et al. (2018)) utilize this connection to successfully derive a gradient-based SFA training as a special case. They are based on correcting a biased gradient when directly optimizing the Rayleigh-Quotient with respect to the model’s parameters. The constraints are implicitly enforced through the loss function as opposed to directly whitening the output. Similar to our work, SpINs allow for employing any architecture to find these embeddings. However, the whitening proposed in this paper is applicable to any loss function as it is part of the model architecture and not inherently a part of the optimized objective. + +The generalization of PowerSFA proposed in section 6.3 is close to GSFA, assuming regularity (or rather: ignoring non-regularity) in the graph for the orthogonality constraint. + +SpectralNets (SN, Shaham et al. (2018)) are another closely related approach in which a differentiable approximator is trained to learn spectral embeddings used in subsequent $k$ -means clustering. Opposed to PowerSFA and SpINs, they split a single optimization step into two parts: an ortho-normalization step based on explicitly calculating the Cholesky decomposition of the batch covariance matrix to set and freeze the weights of a linear output layer, followed by a stochastic optimization step. While this can be considered end-to-end depending on the paradigm, Shaham et al. (2018) do not indicate if and how this can be implemented as fully differentiable architecture. + +# 2.3 OTHER RELATED APPROACHES + +In section 6.3 we consider a generalization of PowerSFA’s loss similar to GSFA and apply it to the NORB dataset (LeCun et al. (2004)). We thereby loosely follow the experimental procedure in Hadsell et al. (2006). The authors use a siamese neural network architecture (Bromley et al. (1993)) for optimizing pair-wise distances of embedded points to reflect similarity and dissimilarity structure of the data. In particular, they do not enforce orthogonality of the embeddings but rely on the optimization procedure to maximize informativeness. + +# 3 SLOW FEATURE ANALYSIS + +Slow Feature Analysis (SFA) is based on the hypothesis that interesting high-dimensional streams of data that vary quickly in time, are typically caused by a low number of underlying factors that vary comparably slow. Therefore, slowness can be used as a proxy criterion by which to extract meaningful representations of these low-dimensional underlying causes, even in the absence of labels. + +There is strong evidence in favor of this hypothesis, as it has been shown that features extracted by SFA tend to encode highly relevant information about the data-generating environments, e.g., slow features encode and disentangle object identity, rotation, and position in visual tasks (Franzius et al. (2011)) as well as agent position and orientation from visual first-person recordings of random movement similar to place cells in rodents, or head-direction cells in primates (Franzius et al. (2007)). + +The notion of extracting slow features from a time-series dataset has been formalized as a sequential optimization problem. Given a time-series $\{ x _ { t } \} _ { t = 0 \ldots \tau }$ with $\boldsymbol { x } _ { t } \in \mathbb { R } ^ { d }$ , sequentially find continuous functions $g _ { i } : \dot { \mathbb { R } ^ { d } } \mathbb { R }$ with: + +$$ +\begin{array} { r l } { \underset { g _ { i } } { \operatorname* { m i n } } } & { \left. ( g _ { i } ( x _ { t + 1 } ) - g _ { i } ( x _ { t } ) ) ^ { 2 } \right. _ { t } } \\ { \mathrm { s . t . } } & { \left. g _ { i } ( x _ { t } ) \right. _ { t } = 0 , } \\ & { \left. g _ { i } ( x _ { t } ) ^ { 2 } \right. _ { t } = 1 , } \\ & { \left. g _ { i } ( x _ { t } ) g _ { j } ( x _ { t } ) \right. _ { t } = 0 , \forall j < i } \end{array} +$$ + +where $\langle \cdot \rangle _ { t }$ is the time-average. The constraints ensure that each of the extracted features is informative (decorrelated to all others, equation (1d)) and non-trivial (unit variance, equation (1c)). Originally, solutions to SFA directly were only proposed for the space of affine functions $g _ { i } \in \mathcal G$ , for which a closed-form solution exists, and in a kernelized version that requires strong regularization. + +# 4 (APPROXIMATE) WHITENING + +The standard implementation of linear SFA (Zito et al. (2008)) is based on computing the closedform solution to a generalized eigenvalue problem (Berkes & Wiskott (2005)). Another approach is to first whiten the time-series data, followed by a projection onto the minor components of the difference time-series {x˙ t = xt+1 − xt}t=0...τ−1. + +Whitened data has three important properties: (a) it is mean-free (constraint (1b)), (b) has unit variance if projected onto an arbitrary unit vector (constraint (1c)), and (c) projections onto orthonormal vectors are decorrelated (constraint (1d)). + +For a dataset $\tilde { \mathbf { X } } \in \mathbb { R } ^ { d \times N }$ with $N$ and $d$ being size and dimension of the dataset, respectively, the corresponding whitened dataset is defined as + +$$ +\begin{array} { r } { \mathbf { X } = \mathbf { W } \tilde { \mathbf { X } } } \end{array} +$$ + +with $\mathbf { W } = \mathbf { D } ^ { - \frac { 1 } { 2 } } \mathbf { U } ^ { T }$ and $\mathbf { C } = { \mathbf { U } } { \mathbf { D } } { \mathbf { U } } ^ { T } \in \mathbb { R } ^ { d \times d }$ being the whitening matrix and the canonical eigendecomposition of the covariance matrix, respectively. U’s columns contain the eigenvectors of $\mathbf { C }$ and $\mathbf { D }$ contains the corresponding eigenvalues on its diagonal. As $\mathbf { C }$ is typically assumed to be positive definite, $\mathbf { D } ^ { - \frac { 1 } { 2 } }$ is well-defined. + +One widely used method to extract eigenvector/-value pairs is power iteration. Starting from a random vector $u _ { 0 } \in _ { R } \mathbb { R } ^ { d }$ , repeatedly applying: + +$$ +u _ { i + 1 } = \frac { \mathbf { C } \mathbf { u } _ { i } } { \| \mathbf { C } \mathbf { u } _ { i } \| } +$$ + +converges to the eigenvector $u$ corresponding to the largest (absolute) eigenvalue $\lambda$ . The eigenvalue can then be extracted as + +$$ +\lambda = \| \mathbf C \mathbf u \| +$$ + +and the spectral component corresponding to this eigenvector can be removed as + +$$ +\mathbf { C } \gets \mathbf { C } - \lambda \mathbf { u } \mathbf { u } ^ { T } . +$$ + +Repeating the procedure converges to the eigenvector corresponding to the next largest eigenvalue and so on. We use a previously fixed number of iterations for this method as experiments have shown that approximate whitening is enough to take meaningful optimization steps. In practice, a relatively small number of iterations results in acceptable whitening for most non-degenerate cases. + +Data: covariance matrix $\mathbf { C }$ , number of iterations $N _ { \mathrm { i t e r } }$ , data dimension $d$ +Result: whitening matrix W +$\mathbf { W } \gets \{ 0 \} ^ { d \times d }$ +for $i = 0 ; i < d ; i + + { \bf d o }$ Sample $\mathbf { r } \sim U [ - 1 , 1 ] ^ { d }$ for $j = 0 ; j < N _ { i t e r } ; j + + { \bf d o }$ r ← CrkCrk end $\begin{array} { r l } & { \lambda \Vert \mathbf { C r } \Vert } \\ & { \mathbf { C } \mathbf { C } - \lambda \mathbf { r r } ^ { T } } \\ & { \mathbf { w } _ { i \cdot } = \frac { 1 } { \sqrt { \lambda } } \mathbf { r } ^ { T } } \end{array}$ +end +return W Algorithm 1: Constructing W by power iteration + +Note that in algorithm 1 each operation is differentiable with respect to C. + +# 5 GRADIENT-BASED SLOW FEATURE ANALYSIS + +The key idea for gradient-based SFA is that a whitening layer can be applied to any differentiable architecture (such as deep neural networks) to enforce outputs that approximately obey the SFA constraints while the architecture stays differentiable. As such, it can be trained using gradientdescent-like training procedures, allowing for hierarchical architectures, where every parameter is modified iteratively towards optimizing a global slowness objective, as opposed to assuming a localto-global slowness as in HSFA. To formalize, if + +$$ +\begin{array} { r l } { \tilde { g } _ { \theta } : \ } & { { } \mathbb { R } ^ { N \times d } \mathbb { R } ^ { N \times e } } \end{array} +$$ + +is a differentiable function approximator, such as a neural network, parameterized by $\theta$ and + +$$ +\begin{array} { r l } { \mathcal { W } : } & { { } \mathbb { R } ^ { N \times e } \mathbb { R } ^ { N \times e } } \end{array} +$$ + +denotes the approximate whitening procedure, then + +$$ +g _ { \theta } = \mathcal { W } \circ \tilde { g } _ { \theta } : \quad \mathbb { R } ^ { N \times d } \to \mathbb { R } ^ { N \times e } +$$ + +is an approximator whose outputs approximately obey the SFA constraints. + +It is straightforward to define a general loss function as + +$$ +L _ { \theta } ( { \bf X } ) = \frac { 1 } { N } \sum _ { i } \sum _ { j } w _ { i j } \| g _ { i } - g _ { j } \| ^ { 2 } +$$ + +with $g _ { i }$ being the $i$ -th row of $g _ { \boldsymbol { \theta } } ( \mathbf { X } )$ and $w _ { i j }$ being the strength of the connection between two points $x _ { i }$ and $x _ { j }$ similar to weights in spectral graph embeddings (cf. Sprekeler (2011) and Escalante-B. & Wiskott (2013)). + +For optimizing slowness, we define the weight as + +$$ +w _ { i j } = \delta _ { i , j + 1 } +$$ + +with $\delta$ being the Kronecker delta. This connects consecutive steps in the time-series and disconnects the others 1. + +The approximator can then be trained to minimize eq. 2 by following the negative gradient estimate of $L$ with respect to $\theta$ , $- \nabla _ { \theta } L$ for (mini-)batches of data, as common in a common in gradientbased training. In our experiments, we used the ADAM optimizer (Kingma & Ba (2014)) with Nesterov-accelerated momentum (Dozat (2015)) to train the approximator. Learning rate and additional hyperparameters were left at default values as implemented in the popular Keras-package (Chollet et al. (2015)). + +# 6 EXPERIMENTS + +# 6.1 SYNTHETIC TRIGONOMETRIC DATA + +To show the general feasibility of this approach, we first show that PowerSFA finds near-optimal solutions in the linear case for synthetic data. Standard SFA is a linear method that relies on (a) non-linear basis function expansion and $\mathbf { ( b ) }$ hierarchical processing to induce non-linearity. This means that PowerSFA could hypothetically be used a similar fashion (even though a gradient-based approach allows for more complex models in a natural way). + +The data is generated by trigonometric polynomials of degree $N$ as: + +$$ +\mathbf { x } ( t ) = \varepsilon _ { t } + \sum _ { n = 1 } ^ { N } \alpha _ { n } \cos \left( n t \right) + \beta _ { n } \sin \left( n t \right) +$$ + +with $\mathbf { x } , \pmb { \varepsilon } , \pmb { \alpha } , \pmb { \beta } \in \mathbb { R } ^ { D }$ , coefficients $\alpha _ { i n } , \beta _ { i n } \sim \mathcal { N } ( 0 , 1 )$ . A noise term $\varepsilon _ { i t } \sim \mathcal { N } ( 0 , 0 . 0 1 )$ is added to avoid numerical instabilities in the implementation of closed-form SFA, as singular covariance matrices can cause the underlying eigendecomposition to break. + +emented a temand dimension -size of . The da $\frac { 2 \pi } { 1 0 0 }$ , and generate s whitened wit $T = 5 0 0 0$ teps with maximum degree. $N = 3 0$ $D = 1 0 0$ $N _ { \mathrm { i t e r } } = 6 0$ + +Figure 1 shows the extracted features for different variants of SFA. If the slowness loss is optimized without any constraints on the output features, the optimal solution is to collapse all signals to a constant $\Delta = 0 ,$ ), while if unit variance is enforced, only the features with slowness very close to the smallest $\Delta$ are extracted multiple times and thus the representation becomes highly redundant. When using the approximate whitening, the quality of the solutions is comparable to the closed form solution gained by solving a generalized eigenvalue problem. The ordering was achieved for representational purposes by weighting the output features with a monotonically decreasing weight. In Figure 2, the covariance matrices of the extracted signals are visualized. + +![](images/9f2661dd1afe4966f7dc640ab9badb69420052b00e0a570dfc7c2f83a480bbe1.jpg) +Figure 1: First five features (100 steps) learned by a linear model in different settings. From left to right: (1) only slowness loss optimized, no constraints, (2) slowness loss with enforced unit variance, (3) slowness loss with enforced whitening, (4) closed form solution. The $\Delta$ -values indicate slowness (lower is slower). + +![](images/30be3dcafc3e6ab5c7cc36305fa480eec5326c24dd14654683d8ecf9154f981b.jpg) +Figure 2: Covariance matrices for five outputs in different settings. (1) slowness loss without constraints leads to nearly constant signals with (co)variances close to zero, (2) unit variance enforced leads to highly correlated output signals, (3) & (4) (approximate) whitening and the closed form solution show fully decorrelated output signals (identity covariance). + +Note that it is not a sensible approach to use PowerSFA to optimize a linear model for such lowdimensional data as the closed-form solution is easily attainable. For this reason, this experiment should be understood as a proof-of-concept and a general demonstration of applicability rather than a recommendation for a use-case. + +A very low number of iterations will render the optimization unstable resulting in fast output signals. There seems to be no continuous trade-off between correlation and slowness mediated by the number of iterations. Thus, it is recommended to find a setting for $N _ { \mathrm { i t e r } }$ that allows for stable optimization. Appendix A contains a small hyper-parameter study, illustrating that behavior for the linear case. + +To provide evidence on how gradient-based SFA can improve on solutions found by closed-form SFA, we encapsulate the original signal in a non-linear distortion: + +$$ +\mathbf { u } ( t ) = \cos ( e ^ { \mathbf { x } ( t ) } ) +$$ + +This makes it impossible to extract slow signals by linearly unmixing the original components. To make the extraction more difficult, the maximum degree was increased to $N = 3 0 0$ and the temporal step-size was decreased to $\frac { 2 \pi } { 1 0 ^ { 5 } }$ to reduce temporal aliasing of very fast input components. Consequently, we increased $T$ to $1 0 ^ { 5 }$ and $N _ { \mathrm { i t e r } }$ to 100. + +When applying closed-form SFA to non-linear problems, it is common to apply multiple low-degree polynomial expansions interlaced with linear SFA steps, to reduce the dimensionality, in a greedy layer-wise training. We use an architecture with three quadratic expansion layers (normalized to unit norm to avoid exploding gradients), and compare (a) closed-form training and (b) gradientbased training. We repeat the comparison for a multi-layer perceptron with tanh activation, since polynomial expansion functions are uncommon in gradient-trained models. Both architectures are provided in Appendix B. Table 1 shows the average output slowness, once for the raw output from the network (with small residue correlations possible due to whitening approximation error) and once with closed-form whitening applied to precisely enforce the constraints for the most meaningful comparison. + +
Quadratic expansionClosed-formGradient-based
Slowness3.435:10-1 ±3.54:10-39.744·10-2 ± 1.67:10-2
Slowness (additional whitening)3.435:10-1 ±3.54:10-39.743·10-2 ± 1.67: 10-2
+ +Table 1: Average slowness of 5 output features over 5 runs extracted by greedy layer-wise training and gradient-based training from non-linearly distorted trigonometric polynomials. Results for three-layer quadratic expansion network and neural network with tanh activation. + +
Neural network (tanh)Closed-formGradient-based
Slowness8.562:10-1 ±6.79:10-32.755·10-1 ±9.891·10-2
Slowness (additional whitening)8.562:10-1 ±6.79:10-32.755·10-1 ±9.891·10-2
+ +The results show that gradient-based training can improve slowness in multi-layer architectures compared to greedy layer-wise SFA. Note that increasing the output dimension of the dimensionality reduction steps (or dropping them altogether) in the quadratic expansion network will, unsurprisingly, lead to improved performance and ultimately to convergence to similar minima in both networks. However, this performance increase comes at the cost of high memory requirements and is usually not applicable in high-dimensional non-synthetic problems. + +# 6.2 POSE ESTIMATION FROM VISUAL DATA + +![](images/fa09e067b5a17e430324090ac424a299817b4cb8f9b1e53c25be49193321a7c2.jpg) +Figure 3: Three samples from the anvil-dataset in different $x , y$ positions and rotational angle $\Phi$ + +SFA can be used to extract slowly varying underlying causes from high-dimensional data, such as object position, identity, and rotation from visual simulations. In Franzius et al. (2011), textured three-dimensional fish-objects that change in $x$ - and $y$ -position as well as in-depth rotation $\phi$ have been used and it has been shown that HSFA features encode position and angle well. Since the code used to generate the stimulus data was outdated and could not be executed anymore, we reimplemented a similar scenario with a 3D model of an anvil (Figure 3, Pino4et (2016)) using the random walk procedure described in Franzius et al. (2011) to generate the configurations. + +![](images/c40a1421e2f49e02d53f211f91ae113888e6e307334294f5e48a8d7d9849ed25.jpg) +Figure 4: Spread of the predicted $x$ - and $y$ -position of the anvil-dataset for a trained network (4a) and a randomly initialized network (4b). RMSE for the trained network on unseen data are $9 \%$ and $8 \%$ for $x \cdot$ - and $y$ - position respectively. RMSE for the random network on unseen data are $2 1 \%$ and $2 1 \%$ . + +A current limitation of our model (cf. section 7) is that it does not scale well in the number of output features, rendering the relatively high number of 512 output features used by Franzius et al. (2011) infeasible. We used an output dimension of 10 with a comparable architecture that replaces quadratic expansion by ELU-nonlinearities (a Keras-summary is given in Appendix C). Due to the low number of output features, we were not able to successfully extract the rotational angle $\Phi$ . + +In line with the original publication, we computed linear regression to predict $c o s ( \pi x )$ and $c o s ( \pi y )$ and used the inverse transformation to extract the object position. The results are shown in Figure 4 and are comparable to those presented by Franzius et al. (2011) as they were able to achieve a RMSE of $9 \%$ for $x$ -position and $7 \%$ for $y$ -position. + +# 6.3 NORB + +While gradient-based SFA is the main contribution of this work, previous work on generalizing SFA (Sprekeler (2011)) has shown that the SFA optimization problem is strongly related to a special case of the problem solved by a more general spectral embedding method, i.e., Laplacian Eigenmaps (Belkin & Niyogi (2003)), or, with small differences, graph-based SFA (Escalante-B. & Wiskott (2013)). For this reason, we defined a more general loss function in equation 2. + +![](images/0ad6898c7bb85f39d6a06c714e07964d99b7cd068df375f094560633db02485b.jpg) +Figure 5: The embedded object from the NORB dataset. Samples differ in azimuth, elevation and lighting. + +In fact, weights $w _ { i j }$ can be defined between any two points $x _ { i }$ and $x _ { j }$ of a given dataset, not just consecutive ones, thus allowing to optimize neighborhood-respecting embeddings for general graphs. This is similar (but not fully equivalent) to spectral embeddings on graph data, as used in algorithms such as Laplacian eigenmaps. Our approach exhibits four significant differences: + +1. It does not find ordered features, but a rotation of an optimal embedding, +2. the found solution should be assumed to be only locally optimal (or a saddle point), + +3. it does ignore the graph (ir)regularity when enforcing the orthogonality constraint, and + +4. it allows a natural and scalable way to embed unseen points. + +Computing an out-of-sample embedding requires the same forward-pass through the differentiable architecture as the training embeddings. In particular, its complexity does not scale with the number of observed points used for training as is usually the case in other approximations, such as Nyström approximation (Williams & Seeger (2001)). + +We demonstrate the usefulness of such an approach by embedding an object of the NORB dataset, a collection of photographs of toys taken at different elevations, azimuths, and under different lighting conditions with the MobileNet architecture (Sandler et al. (2018)) scaled with $\alpha = 0 . 5$ and a depth multiplier of 2 in the Keras implementation. Following Hadsell et al. (2006), we embedded photographs of a toy plane (Figure 5) in 972 configurations (18 azimuths $\times ~ 6$ lighting conditions $\times ~ 9$ elevations angles) that were randomly split into a train- and test-set of sizes 660 and 312 respectively and the connection weights $w _ { i j }$ were chosen as 1 if $x _ { i }$ and $x _ { j }$ differed only in one step either in rotation (i.e., one azimuth) or elevation (i.e., one level) and 0 otherwise. The weights were independent of lighting condition. + +![](images/02e852d3071d26f8c1d6cbc54992611d6e89af767c6a4ea5e80c600876107f49.jpg) +Figure 6: Cylindrical embedding of NORB plane with azimuth colored. 6a and 6b show the embedded training data from the front and the side of the cylinder respectively, while 6c and 6d show the test data for the same configuration. Circumference of the cylinder encodes the rotation of the plane. + +![](images/06ae454a58f922984f33d82e1e529b70b8004286f14ed3968b209de6bbf65c55.jpg) +Figure 7: Cylindrical embedding of NORB plane with elevation colored. 7a and 7b show the embedded training data from the front and the side of the cylinder respectively, while 7c and 7d show the test data for the same configuration. Height on the cylinder encodes the photograph’s elevation angle. + +Figures 6 and 7 show the three-dimensional embedding that was found in this setting. The data was embedded in a cylindrical shape in which the circumference encodes the rotation angle of the embedded object, and the length along the cylinder encodes the elevation configuration of the object for the train-set and in the out-of-sample case of the test-set. Hadsell et al. (2006) found a similar cylindrical encoding, however, their results exhibit a more clean-cut embedding. We assume that this is due to DrLIM’s maximization of distance for dissimilar samples that our model does not implement. + +# 7 DISCUSSION + +We propose a new way of extracting informative slow features from quickly varying inputs based on differentiable whitening of processed batches of the input data. To experimentally show the feasibility of the method, we trained a linear and two non-linear models to extract slowly varying output signals from synthetic time-series by gradient-descent, and find that the differentiable whitening ensures informativeness of the extracted features when optimizing a slowness loss function. Furthermore, the features corresponded to those found by closed-form SFA. 2 + +To show applicability to visual time-series data, we trained a convolutional neural network on an input stream of an object randomly rotating in-depth and moving in a 2-dimensional plane. Gradientbased SFA preserves the position of the object in a low-dimensional representation, as does a hierarchical version of closed-form SFA. The rotation was not extracted successfully due to computational constraints in the naive implementation for a large number of output features (cf. 7). + +One experiment was conducted on a non-time-series image dataset on which symmetric similarity relations between the data are defined. We show that a generalization of gradient-based SFA in the spirit of graph-based SFA is able to extract a low-dimensional representation that preserves and disentangles the configuration parameters used to define the similarity, in this case, azimuth and elevation of a photographed toy. This representation generalizes well to previously unseen configurations of the object. + +While the algorithm is still in a prototypical state, the proof-of-concept results presented in this paper show promise for gradient-based SFA by differentiable whitening to extract meaningful representations for goal-oriented learning while leveraging the expressive power of modern architectures, such as convolutional neural networks. In particular, differentiable whitening ensures non-redundancy of the output features. + +More research has to be dedicated to explore the computational limitations of this method and possibly lower the complexity for a larger number of output features. Furthermore, closed-form SFA has a strong theoretical framework describing the optimal responses in an idealized setting. At this point, we are unclear how well this framework translates to the proposed method of slowness extraction as the used models typically suffer from local optima when being iteratively trained. + +One limitation of PowerSFA is that it currently does not scale favorably in the number of output features $e$ . We see two main reasons for this: the necessary batch size to get a meaningful estimate of the batch-covariance estimate and its calculation. The latter is due to the complexity of a naive $\mathbb { R } ^ { e \times N _ { \mathrm { b a t c h } } }$ · $\mathbb { R } ^ { N _ { \mathrm { b a t c h } } \times e }$ matrix-multiplication being $\mathcal { O } ( N _ { \mathrm { b a t c h } } e ^ { 2 } )$ , while the former is due to the whitening procedure expecting a covariance matrix of full rank and thus $N _ { \mathrm { b a t c h } } \ge e$ samples. + +To reduce the lower bound on the batch-size at batch $t$ , a convex mixture with the covariance matrix of the previous batch might be applicable: + +$$ +\mathbf { C } _ { t } = ( 1 - \gamma ) \mathbf { C } _ { \theta } + \gamma \mathbf { C } _ { t - 1 } +$$ + +Note, that only the current batch’s covariance matrix $\mathbf { C } _ { \theta }$ is considered parameter-dependent and allows to propagate a gradient for training. Thus, large values for $\gamma$ might cause a significant bias in the gradient-estimate. This has not been used to generate the proof-of-concept results for this paper. + +# REFERENCES + +Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps for dimensionality reduction and data representation. Neural Comput., 15(6):1373–1396, June 2003. ISSN 0899-7667. doi: 10.1162/ 089976603321780317. + +Yoshua Bengio and James S. Bergstra. Slow, decorrelated features for pretraining complex celllike networks. In Y. Bengio, D. Schuurmans, J. D. Lafferty, C. K. I. Williams, and A. Culotta (eds.), Advances in Neural Information Processing Systems 22, pp. 99–107. Curran Associates, Inc., 2009. + +Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013. + +Pietro Berkes and Laurenz Wiskott. Slow feature analysis yields a rich repertoire of complex cell properties. Journal of Vision, 5(6), 2005. + +H. Bourlard and Y. Kamp. Auto-association by multilayer perceptrons and singular value decomposition. Biological Cybernetics, 59(4):291–294, Sep 1988. ISSN 1432-0770. doi: 10.1007/BF00332918. + +Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Säckinger, and Roopak Shah. Signature verification using a "siamese" time delay neural network. In Proceedings of the 6th International Conference on Neural Information Processing Systems, NIPS’93, pp. 737–744, San Francisco, CA, USA, 1993. Morgan Kaufmann Publishers Inc. + +Francois Chollet. Xception: Deep learning with depthwise separable convolutions. CoRR, abs/1610.02357, 2016. + +Francois Chollet et al. Keras. https://github.com/fchollet/keras, 2015. + +Pierre Comon. Independent component analysis, a new concept? Signal Processing, 36(3):287 – 314, 1994. ISSN 0165-1684. doi: https://doi.org/10.1016/0165-1684(94)90029-9. Higher Order Statistics. + +Timothy Dozat. Incorporating nesterov momentum into adam. http://cs229.stanford.edu/proj2015/054_report.pdf, 2015. + +Alberto N. Escalante-B. Extensions of Hierarchical Slow Feature Analysis for Efficient Classification and Regression on High-Dimensional Data. PhD thesis, Ruhr-University Bochum, 2017. + +Alberto N. Escalante-B. and Laurenz Wiskott. How to solve classification and regression problems on high-dimensional data with a supervised extension of slow feature analysis. J. Mach. Learn. Res., 14(1):3683–3719, December 2013. ISSN 1532-4435. + +Alberto N. Escalante-B. and Laurenz Wiskott. Improved graph-based SFA: information preservation complements the slowness principle. CoRR, abs/1601.03945, 2016. + +Mathias Franzius, Henning Sprekeler, and Laurenz Wiskott. Slowness and sparseness lead to place, head-direction, and spatial-view cells. PLOS Computational Biology, 3(8):1–18, 08 2007. doi: 10.1371/journal.pcbi.0030166. + +Mathias Franzius, Niko Wilbert, and Laurenz Wiskott. Invariant object recognition and pose estimation with slow feature analysis. Neural Computation, 23(9):2289–2323, 2011. doi: 10.1162/NECO\_a\_00171. PMID: 21671784. + +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2672–2680. Curran Associates, Inc., 2014. + +Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http://www.deeplearningbook.org. + +Ross Goroshin, Joan Bruna, Jonathan Tompson, David Eigen, and Yann LeCun. Unsupervised feature learning from temporal data. arXiv preprint arXiv:1504.02518, 2015a. + +Ross Goroshin, Michael F Mathieu, and Yann LeCun. Learning to linearize under uncertainty. In Advances in Neural Information Processing Systems, pp. 1234–1242, 2015b. + +Raia Hadsell, Sumit Chopra, and Yann Lecun. Dimensionality reduction by learning an invariant mapping. In In Proc. Computer Vision and Pattern Recognition Conference (CVPR’06. IEEE Press, 2006. + +Aren Jansen, Manoj Plakal, Ratheet Pandya, Daniel PW Ellis, Shawn Hershey, Jiayang Liu, R Channing Moore, and Rif A Saurous. Unsupervised learning of semantic audio representations. arXiv preprint arXiv:1711.02209, 2017. + +Dinesh Jayaraman and Kristen Grauman. Slow and steady feature analysis: higher order temporal coherence in video. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3852–3861, 2016. + +D. P Kingma and M. Welling. Auto-Encoding Variational Bayes. ArXiv e-prints, December 2013. + +Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. + +Yann LeCun, Fu Jie Huang, and Léon Bottou. Learning methods for generic object recognition with invariance to pose and lighting. In Proceedings of the 2004 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR’04, pp. 97–104, Washington, DC, USA, 2004. IEEE Computer Society. + +Hossein Mobahi, Ronan Collobert, and Jason Weston. Deep learning from temporal coherence in video. In Proceedings of the 26th Annual International Conference on Machine Learning, pp. 737–744. ACM, 2009. + +D. Pfau, S. Petersen, A. Agarwal, D. Barrett, and K. Stachenfeld. Spectral Inference Networks: Unifying Spectral Methods With Deep Learning. ArXiv e-prints, June 2018. + +Pino4et. Anvil lowpoly. https://www.turbosquid.com/FullPreview/Index.cfm/ID/1067450, 2016. [Online, Royalty Free 3D Object]. + +M. Raghu, B. Poole, J. Kleinberg, S. Ganguli, and J. Sohl-Dickstein. On the Expressive Power of Deep Neural Networks. ArXiv e-prints, June 2016. + +Sam T. Roweis and Lawrence K. Saul. Nonlinear dimensionality reduction by locally linear embedding. SCIENCE, 290:2323–2326, 2000. + +Mark Sandler, Andrew G. Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Inverted residuals and linear bottlenecks: Mobile networks for classification, detection and segmentation. CoRR, abs/1801.04381, 2018. + +Uri Shaham, Kelly Stanton, Henry Li, Ronen Basri, Boaz Nadler, and Yuval Kluger. Spectralnet: Spectral clustering using deep neural networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ HJ_aoCyRZ. + +Henning Sprekeler. On the Relation of Slow Feature Analysis and Laplacian Eigenmaps. Neural Computation, 23(12):3287–3302, December 2011. ISSN 0899-7667. doi: 10.1162/neco\_a\ _00214. + +Richard S. Sutton and Andrew Barto. Reinforcement Learning: An Introduction. MIT Press, 1998. + +Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2794–2802, 2015. + +Christopher K. I. Williams and Matthias Seeger. Using the Nyström method to speed up kernel machines. In T. K. Leen, T. G. Dietterich, and V. Tresp (eds.), Advances in Neural Information Processing Systems 13, pp. 682–688. MIT Press, 2001. + +Laurenz Wiskott and Terrence Sejnowski. Slow feature analysis: unsupervised learning of invariances. Neural Computation, 14(4):715–770, 2002. doi: http://doi.org/10.1162/ 089976602317318938. + +T. Zito, N. Wilbert, L. Wiskott, and P. Berkes. Modular toolkit for data processing (mdp): a python data processing framework. Frontiers in Neuroinformatics, 2:8, 2008. doi: 10.3389/neuro.11. 008.2008. + +# Appendices + +![](images/5d1d7731e9cc6bf8ac7c8f7e86d1b0365d359caf8b11e5f94980192d3aeaf3dc.jpg) +Figure 8: The mean squared velocity (unnormalized $\Delta$ value) per feature for an increasing number of power iterations, averaged over 10 trials. For no power iterations, the velocity is close to 0, but for a too small positive number of power iterations the optimization becomes unstable and results in sub-optimal performance. + +![](images/33607e4352d46a86e29f2857a79825b015d9d8abcb85ea3fe150cadd9ed10d11.jpg) +Figure 9: The average covariance (auto-variances not included) for an increasing number of power iterations, averaged over 10 trials. Without whitening, the covariance is close to 1, but the features quickly become decorrelated when the number of iterations is increased. + +# B COMPARISON ARCHITECTURES (SYNTHETIC DATA) + +This appendix presents the architectures used for comparing greedy layer-wise with gradient-based end-to-end training of SFA. Both networks have been trained with both training methods. In the gradient-based setting, the Keras’s Nadam optimizer has been used with default hyperparameters and a whitening layer has been applied to the network output. + +
Quadratic expansion network
OperationOutput dimension
Input Layer100
Linear LayerQuadratic Expansion33594
Linear LayerQuadratic Expansion33594
Linear LayerQuadratic Expansion33594
Linear Layer5
+ +Table 2: A network with multiple quadratic expansions, each preceded by linear dimensionalityreduction. These kind of networks are typically used in closed-form SFA as they trade-off model expressivity with memory requirements. + +
Neural network(tanh)
OperationOutput dimension
Input Layer100
Linear LayerPointwise tanh100100
Linear LayerPointwise tanh100100
Linear LayerPointwise tanh100100
Linear Layer5
+ +Table 3: A simple multi-layer neural network using a tanh activation function to induce non-linearity. + +C KERAS DESCRIPTION (HSFA-LIKE ARCHITECTURE) + +
Layer (type)Output ShapeParam #
input_1(InputLayer)(None, 156,156,1)0
conv2d_1(Conv2D)(None, 147,147, 32)3232
activation_1(Activation)(None, 147,147, 32)0
dropout_1(Dropout)(None, 147,147, 32)0
conv2d_2(Conv2D)(None, 28,28, 32)102432
activation_2(Activation)(None, 28,28, 32)0
dropout_2(Dropout)(None, 28,28, 32)0
conv2d_3(Conv2D)(None, 25,25, 32)16416
activation_3(Activation)(None, 25,25, 32)0
dropout_3(Dropout)(None, 25,25, 32)0
conv2d_4 (Conv2D)(None, 11,11, 32)16416
activation_4(Activation)(None, 11,11, 32)0
dropout_4 (Dropout)(None,11,11, 32)0
conv2d_5(Conv2D)(None, 8,8,32)16416
activation_5(Activation)(None, 8,8, 32)0
dropout_5(Dropout)(None, 8,8, 32)0
conv2d_6 (Conv2D)(None,3,3,32)16416
activation_6(Activation)(None,3,3,32)0
dropout_6 (Dropout)(None, 3,3,32)0
flatten_ 1 (Flatten)(None, 288)0
dense_1 (Dense)(None, 10)2890
power_whitening_1(PowerWhit(None, 10)0
Total params: 174,218 Trainable params: 174,218 Non-trainable params:0
\ No newline at end of file diff --git a/md/train/rJo9n9Feg/rJo9n9Feg.md b/md/train/rJo9n9Feg/rJo9n9Feg.md new file mode 100644 index 0000000000000000000000000000000000000000..57da706b5614e29983dd66d72ca1599da3ebd7fb --- /dev/null +++ b/md/train/rJo9n9Feg/rJo9n9Feg.md @@ -0,0 +1,164 @@ +# CHESS GAME CONCEPTS EMERGE UNDER WEAK SUPERVISION: A CASE STUDY OF TIC-TAC-TOE + +Hao Zhao∗& Ming Lu +Department of Electronic Engineering +Tsinghua University +Beijing, China +{zhao-h13,lu-m13}@mails.tsinghua.edu.cn +Anbang Yao & Yurong Chen +Cognitive Computing Laboratory +Intel Labs China +Beijing, China +{anbang.yao,yurong.chen}@intel.com +Li Zhang +Department of Electronic Engineering +Tsinghua University +Beijing, China +{chinazhangli}@mail.tsinghua.edu.cn + +# ABSTRACT + +This paper explores the possibility of learning chess game concepts under weak supervision with convolutional neural networks, which is a topic that has not been visited to the best of our knowledge. We put this task in three different backgrounds: (1) deep reinforcement learning has shown an amazing capability to learn a mapping from visual inputs to most rewarding actions, without knowing the concepts of a video game. But how could we confirm that the network understands these concepts or it just does not? (2) cross-modal supervision for visual representation learning has drawn much attention recently. Is this methodology still applicable when it comes to the domain of game concepts and actions? (3) class activation mapping is widely recognized as a visualization technique to help us understand what a network has learnt. Is it possible for it to activate at non-salient regions? With the simplest chess game tic-tac-toe, we report interesting results as answers to those three questions mentioned above. All codes, pre-processed datasets and pre-trained models will be released. + +# 1 INTRODUCTION + +# 1.1 APPLICATION BACKGROUND + +Deep reinforcement learning (DRL) has drawn quite much attention since the publication of influential work Mnih et al. (2015). A convolutional neural network (CNN) is used to bridge the gap between video game screen frames and the most rewarding actions. An amazing feature of this kind of systems is that they do not need to know the concepts of these games (e.g. DRL learns to play Breakout without knowing there is a paddle or a ball in Fig 1a). However, how could we confirm that this network really understands these concepts or it just learns a mapping from patterns in the visual inputs to the best actions? This is the first question we are trying to answer here. + +Mnih et al. (2015) provides some unsupervised analysis results for visualization, showing that perceptually dissimilar frames may produce close rewards, yet this does not answer the question. We choose another visualization technique called class activation mapping as described in Zhou et al. (2016), which can reveal where the CNN’s attention is. However, directly applying it in tasks like Breakout still cannot answer the question. Imagine one modifies the network described in Mnih et al. (2015) into another version as Zhou et al. (2016) does. The CNN’s attention may be fixed on the ball but it is still not enough to support that the network understands the concept of a ball. + +![](images/212e02e9144ac3744d7cce5198efdf27e8ae3f48a5cf3f931abb6df3512a39f3.jpg) +Figure 1: We raise three questions from application, methodology and technique perspectives respectively and provide our answers with a case study of the simplest chess game tic-tac-toe. + +We propose to use a simple chess game called tic-tac-toe for case study. In order to answer the question, we propose a protocol as this: to place a piece where the CNN’s attention is, and examine whether it is the right move. Of course, the training has to be done under weak supervision, or say, without telling the network what exactly a right move is. We think if this experiment succeeds we can claim that the network figures out the concepts of: (1) a chess board grid; (2) the winning rule; (3) two sides. Detailed analysis about these three concepts are provided later. + +# 1.2 METHODOLOGY BACKGROUND + +There have been some works about representation learning with cross-modal supervision recently. Owens et al. (2016) clusters sound statistics into several categories, and uses them as labels to learn visual representation from images corresponding to these sounds. It quantitatively shows that visual representation learnt in this way is capable of handling challenging computer vision tasks and qualitatively shows that visual and sound representations are consistent (e.g. babies’ faces correspond to baby cry sound samples). Castrejon et al. (2016) goes even further by learning representations ´ across five modalities: RGB images, clip art pictures, sketches, texts and spatial texts. Gupta et al. (2016) learns depth image representation with mid-level features extracted from RGB images as supervision, and reports improved RGB-D object detection performance. + +What is the common point among these works? They generate weak supervision from one modality and use it to learn representation from another (e.g. to learn what a train looks like from what a train sounds like or to learn what a chair looks like in depth images from what a chair looks like in RGB images). During training phase, no concepts about a train or a chair are explicitly modeled. Although there are many other modalities not visited by this methodology, we think the basic ideas behind these works are same: an abstract concept like a train can be observed in different modalities and different representations can be connected. + +Here comes the question: is this methodology still applicable when it goes beyond the problem of learning representations from different observations of a same concept? Albanie & Vedaldi (2016) is an example, which tries to relate facial expressions with what happened in a TV show (e.g. if a character earns a lot of money, she will be very happy). Although in Albanie & Vedaldi (2016) what happened is explicitly defined, it still can be regarded as a weak supervision for what this expression is. + +Although with the same methodology, the problem studied in this paper addresses even higher semantics: to learn what to do under the weak supervision of what will happen (Fig 1b). This is substantially different from cross-modal supervision works mentioned above because there is no longer a certain abstract concept of object or attribute observed in different modalities. Instead, figuring out the relationship between what to do and what will happen needs a higher level of intelligence. + +# 1.3 TECHNIQUE BACKGROUND + +The core technique used in this paper is class activation mapping (CAM) as described in Zhou et al. (2016). So leaving out all the backgrounds about playing a chess game or cross-modal supervision, what do our experiments say more than its inventors’? We think we show that CAM can also activate at non-salient regions. CAM helps us to understand where contributes the most to a classification result. As Fig 1c shows, the heatmap reveals that the face contributes the most to the result that the network claims it as a person. + +As has already been shown by Krizhevsky et al. (2012), kernels of lower layers of a CNN capture gradients in an image. Existing CAM experiments tend to activate at salient regions, and this is very reasonable because there are more gradients and therefore more information (e.g. the face in Fig 1c). Here comes the question: could CAM activate at non-salient regions like the empty spaces on a chess board? Our answer is positive as the results (Fig 1d) show that in order to predict what will happen in the future, the CNN’s attention is fixed upon texture-free regions. + +Since we render chessboards as visual inputs without adding noise, those empty spaces are completely empty meaning that: (1) if we take out the activated patch in Fig 1d, all pixels in this patch have exactly the same value. (2) If we evaluate this patch with quantitative information metric like entropy, there is no information here. Thus the only reason why these regions are activated is that the network collects enough information from these regions’ receptive fields. We argue that this experiment (CAM can activate at non-salient regions) testifies (again) CNN’s ability to hierarchically collect information from visual inputs. + +# 1.4 WHAT THIS PAPER IS ABOUT + +After introducing those three backgrounds, we describe our work briefly as: to classify rendered tic-tac-toe chessboards with weak labels and to visualize that the CNN’s attention automatically reveals where the next piece should be placed. Learnt representation shows that: (1) the network knows some concepts of the game that it is not told of; (2) this level of supervision for representation learning is possible; (3) the technique of class activation mapping can activate at non-salient regions. + +# 2 RELATED WORKS + +# 2.1 CONCEPT LEARNING + +Concept learning has different meanings in different contexts, and how to confirm a concept is learnt remains an open question. In Jia et al. (2013), a concept is learnt if a generative model is learnt from a small number of positive samples. In Lake et al. (2015), a concept is learnt if a model learnt from only one instance can generalize to various tasks. Higgins et al. (2016) claims a concept is learnt when a model can predict unseen objects’ sizes and positions. To summarize, they evaluate whether a concept is learnt through a model’s generalization ability. In even earlier works like Zhu et al. (2010);Yang et al. (2010), concept learning means a object/attribute classification task dealing with appearance variations, in which a concept is actually already pre-defined. + +Unlike these works, we investigate the concepts of game rules instead of object/attribute. Unlike Jia et al. (2013);Lake et al. (2015);Higgins et al. (2016), we claim a concept is learnt through a novel testing protocol instead of generalization ability. Why generalization ability could show a concept is learnt? We think the reason is that a model understands a concept if it can use it in more cases. To this end, we argue that our protocol could also show a concept is learnt because the learnt representations in our experiments can be used to decide what to do though no rule about what need to be done is provided. + +# 2.2 CROSS-MODAL SUPERVISION + +The literature of cross-model supervision and the differences between this paper and existing ones are already covered in last section. Here we re-claim it briefly: Owens et al. (2016);Castrejon et al. ´ (2016);Gupta et al. (2016) learn representations across modalities because actually they are different observations of a same (object or attribute) concept. Whether this methodology is applicable for higher-level concepts like game rules remains an open question and we provide positive answers to this question. + +![](images/8892a56ef87396c0bedee70e871be9fad495f0c0c15b30f3151d2d2719a136dd.jpg) +Figure 2: 18 different types of chessboard states and corresponding labels. + +# 2.3 CLASS ACTIVATION MAPPING + +Before the technique of class activation mapping is introduced by Zhou et al. (2016), pioneering works like Simonyan et al. (2014);Zhou et al. (2015) have already shown CNN’s ability to localize objects with image-level labels. Although with different techniques, Simonyan et al. (2014);Zhou et al. (2015)’s activation visualization results also focus on salient regions. Unlike these works, we show that class activation mapping can activate at non-salient regions, or say more specifically, completely texture-free regions. Since the activated patch itself provides no information, all discriminative information comes from its context. This is another strong evidence to prove CNN’s capability to collect information from receptive fields, as a hierarchical visual model. + +# 3 EXPERIMENT I: GAME ENDS IN NEXT MOVE + +A tic-tac-toe chessboard is a $3 \times 3$ grid, and there are two players (black and white in our case). Due to duality, we generate all training samples assuming the black side takes the first move. The state space of tic-tac-toe is small consisting of totally $3 ^ { 9 } = 1 9 6 8 3$ combinations. Among them, many combinations are illegal such as the one in which all 9 pieces are black. We exhaustively search over the space according to a recursive simulation algorithm, in which: (1) the chessboard state is denoted by an integer smaller than 19683. (2) every state corresponds to a 9-d vector, with each element can take a value from this set $\{ 0$ -illegal, 1-black win, 2-white win, 4-tie, 5-uncertain}. We call this 9-d vector a state transfer vector, denoting what will happen if the next legal piece placement happens at according location. (3) generated transfer vectors can predict the existence of a critical move that will finish the game in advance. We will release this simulation code. + +After pruning out illegal states, we collect 4486 possible states in total. Among these samples, we further take out 1029 states that a certain side is going to win in the next move. We then transform these chessboard states into visual representations (gray-scale images at resolution (180, 180)). Each of these 1029 samples is assigned a label according to the state transfer vectors. There are totally 18 different labels illustrating 2 (sides) $\times 9$ (locations). As demonstrated by Fig 2, we randomly pick a sample for each label. As mentioned before black side takes the first move, thus if the numbers of black and white pieces are equal the next move will be black side’s and if there are one more black piece the next move will be white side’s. + +![](images/8f8d60a34b686f41449c3251b6fd487b761cb5d326e1b51c7d782dde4f49e98b.jpg) +Figure 3: Class activation mapping results on our dataset. + +Although the concepts of two sides and nine locations are coded into the labels, this kind of supervision is still weak supervision. Because what we are showing to the algorithm is just 18 abstract categories as Fig 2 shows. Could an algorithm figure out what it needs to do by observing these visual inputs? We think even for a human baby it is difficult because no concepts like this is a game or you need to find out how to win are provided. In the setting of deep reinforcement learning there is at least an objective of getting higher score to pursue. + +As mentioned before, the method we exploit is to train a classification network on this rendered dataset (Fig 2) and analyze learnt representations with the technique of class activation mapping. As Zhou et al. (2016) suggests, we add one global average pooling layer after the last convolutional layer of a pre-trained AlexNet model. All fully connected layers of the AlexNet model are discarded, and a new fully connected layer is added after the global average pooling layer. After the new classification network is fine-tuned on our dataset, a CAM visualization is generated by weighting the outputs of the last convolutional layer with parameters from the added fully connected layer. Our CAM implementation is built upon Marvin and it will be released. + +Due to the simplicity of this classification task, the top one classification accuracy is $100 \%$ (not surprisingly). Class activation mapping results are provided in Fig 3 and here we present the reasons why we claim concepts are learnt: (1) We provide 18 abstract categories, but in order to classify visual inputs into these 18 categories the network’s attention is roughly fixed upon chessboard grids. + +![](images/226e2c831d860a179e42335e7f0432775ef17d4bdb8ac894947b5e24c52ec26f.jpg) +Figure 4: Class activation mapping results after grid lines are added. + +This means the concept of grid emerges in the learnt representation. (2) If we place a piece at the most activated location in Fig 3, that will be the right (and legal) move to finish the game. On one hand, this means the concept of winning rule emerges in the learnt representation. On the other hand, this means this learnt concept can be used to deal with un-taught task (analogous to Jia et al. (2013);Lake et al. (2015);Higgins et al. (2016) who use generalization ability to illustrate that concepts are learnt). (3) As Fig 3cehijnpq show, both sides can win in the next move if we violate the take-turns rule. However, the network pays attention to the right location that is consistent to the rule. For example, in Fig 3j, it seems that placing a black piece at the left-top location will also end the game. However, this move will violate the rule because there are already more black pieces than white pieces meaning that this is the white side’s turn. This means that the concept of two sides emerges in learnt representation. + +Except for learnt concepts, we analyze what this experiment provides for the remaining two questions. To the second question: results in Fig 3 show that the methodology of generating labels from one modality (state transfer vectors in our case) to supervise another modality is still applicable. More importantly, we use images as inputs yet the learnt visual representations contain not only visual saliency information but also untold chess game concepts. To the third question: as Fig 3 shows, most activated regions are empty spaces on the chessboard. + +# 4 EXPERIMENT II: ADDING GRID LINES + +Since we claim complicated concepts emerge in learnt visual representations, a natural question will be: if the chessboard’s and pieces’ appearances are changed does this experiment still work? Thus we design this experiment by adding grid lines to the chessboards when rendering synthetic data (Fig 4). The intentions behind this design is three-folded: (1) in this case, the chessboard’s appearance is changed. (2) after these lines are added, the concept that there is a chessboard grid is actually implied. Still, we do not think these lines directly provide the concept of chessboard grid thus we use the word imply. Whether the network can figure out what these lines mean still remain uncertain. (3) those locations that are completely empty in Experiment I are no longer empty from the perspective of information (still empty from the perspective of game rule). + +![](images/5238a69f19c05ea5229faba22dda67bc64c677462955158ffe8170e6749eebed.jpg) +Figure 5: Class activation mapping results after piece appearance is changed. + +We train the same network on the newly rendered dataset with grid lines and calculate CAM results in the same way. The results are demonstrated by Fig 4. Generally speaking, the grid lines allow the network to better activate at the location of right move, making them stands out more on the heatmap. What does this mean to the three intentions mentioned in last paragraph? (1) Firstly, it shows that our experiment is robust to chess board appearance variance. (2) Secondly, after implying the concept that there is a chessboard grid, the network performs better at paying attention to the location of right move. Again we compare this phenomenon against how a human baby learns. Although not supported by phycological experiment, we think with a chessboard grid a human baby is more easy to figure out the game rule than without. (3) Thirdly, heatmap changes in Fig 4 is not surprising, because after adding those lines, the empty (from the perspective of game rule) regions contain more gradients for lower layers of a CNN to collect. However, again it supports that activating at non-salient regions is NOT trivial. + +# 5 EXPERIMENT III: PIECE APPEARANCE CHANGE + +In this experiment we change the appearance of the piece by: (1) replacing black boxes with white circles; (2) replacing white boxes with black crosses. Note that in this case the white side moves first. Again we train the same network and visualize with CAM. The results comparison is provided in Fig 6. Further we add grid lines to the cross/circle chessboard. + +# 6 EXPERIMENT IV: MODEL BEHAVIOR OVER TIME + +In order to further demonstrate the non-triviality of the model behaviors, we design this experiment. We train on the dataset in Experiment I with 1000 iterations and snap-shotted the parameters at 500th iteration. The classification accuracy is $100 \%$ at 1000th iteration and $5 3 . 1 3 \%$ at $5 0 0 \mathrm { { t h } }$ iteration. The + +![](images/a8f8adc772c519b2e57b717c8754a2ce124e23d0e0deb48f45376d388ad84535.jpg) +Figure 6: Class activation mapping results on true positive samples at 500 iterations (left, $5 3 . 1 3 \%$ accuracy) and 1000 iterations (right, $100 \%$ accuracy). + +![](images/01b182b4efe7c03df5fc6c15a4502eb08266f0fecea19c4505bd2b42f31fed7e.jpg) +Figure 7: We propose two quantitative evaluation protocols: (a) by selecting the most activated patch, we calculate how frequent the representation fire at the correct location; (b) we correlate the representation with an ideal activation map. + +CAM results are shown by Fig 5 in which all samples are true positives. We think it shows that there are two ways to achieve this classification task: (1) by paying attention to the visual patterns formed by the existing pieces; (2) by paying attention to where the next piece should be placed. This experiment shows that at an earlier stage of learning the model’s behavior is consistent to the first hypothesis and after the training is completely done the network can finally fire at correct location. + +# 7 QUANTITATIVE EVALUATION + +We propose two different quantitative evaluation protocols. The first one is representation accuracy (RAC), for which we select the most activated patch and examine whether it is the correct location to end the game. The second one is representation consistency (RCO), which correlates the normalized representation and a normalized ideal activation map. The quantitative comparisons are shown in Table 1, in which NAC stands for network classification accuracy. These results quantitatively support that: (1) learnt representation can be used to predict the right move at an over $70 \%$ accuracy. (2) adding grid lines (implying the concept of a chessboard) dramatically improves localization. + +# 8 CONCLUSION + +The core experiment in this paper is to train a classification CNN on rendered chessboard images under weak labels. After class activation mapping visualization, we analyse and interpret the results in three different backgrounds. Although simple, we argue that our results are enough to show that: (1) a CNN can automatically figure out complicated game rule concepts in this case. (2) cross-modal supervision for representation learning is still applicable in this case of higher-level semantics. (3) the technique of CAM can activate at non-salient regions, testifying CNN’s capability to collect information from context in an extreme case (only context has information). + +Table 1: Quantitative results. + +
ExperimentI originalII gridⅢ pieceⅢI piece+gridIV 500th
NAC (%)100.00100.00100.00100.0053.13
RAC (%)71.8297.2583.7799.0027.87
RCO (103)-8.096-5.115-7.751-4.9321-10.610
+ +# REFERENCES + +Samuel Albanie and Andrea Vedaldi. Learning grimaces by watching tv. In BMVC, 2016. + +Lluıs Castrejon, Yusuf Aytar, Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Learning ´ aligned cross-modal representations from weakly aligned data. In CVPR, 2016. + +Saurabh Gupta, Judy Hoffman, and Jitendra Malik. Cross modal distillation for supervision transfer. In CVPR, 2016. + +Irina Higgins, Loic Matthey, Xavier Glorot, Arka Pal, Benigno Uria, Charles Blundell, Shakir Mohamed, and Alexander Lerchner. Early visual concept learning with unsupervised deep learning. arXiv:1606.05579, 2016. + +Yangqing Jia, Joshua T Abbott, Joseph Austerweil, Thomas Griffiths, and Trevor Darrell. Visual concept learning: Combining machine vision and bayesian generalization on concept hierarchies. In NIPS, 2013. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, 2012. + +Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. In Science, 2015. + +Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. In Nature, 2015. + +Andrew Owens, Jiajun Wu, Josh H McDermott, William T Freeman, and Antonio Torralba. Ambient sound provides supervision for visual learning. In ECCV, 2016. + +Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. 2014. + +Jingjing Yang, Yuanning Li, Yonghong Tian, Ling-Yu Duan, and Wen Gao. Per-sample multiple kernel approach for visual concept learning. In Journal on Image and Video Processing, 2010. + +Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Object detectors emerge in deep scene cnns. In ICLR, 2015. + +Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In CVPR, 2016. + +Shiai Zhu, Gang Wang, Chong-Wah Ngo, and Yu-Gang Jiang. On the sampling of web images for learning visual concept classifiers. In Proceedings of the ACM International Conference on Image and Video Retrieval, 2010. \ No newline at end of file diff --git a/md/train/rkQu4Wb0Z/rkQu4Wb0Z.md b/md/train/rkQu4Wb0Z/rkQu4Wb0Z.md new file mode 100644 index 0000000000000000000000000000000000000000..9dc050fec6f60a63835edffe791e789ccbe7d93d --- /dev/null +++ b/md/train/rkQu4Wb0Z/rkQu4Wb0Z.md @@ -0,0 +1,273 @@ +# DNN REPRESENTATIONS AS CODEWORDS:MANIPULATING STATISTICAL PROPERTIES V I APENALTY REGULARIZATION + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Performance of Deep Neural Network (DNN) heavily depends on the characteristics of hidden layer representations. Unlike the codewords of channel coding, however, the representations of learning cannot be directly designed or controlled. Therefore, we develop a family of penalty regularizers where each one aims to affect one of the representation’s statistical properties such as sparsity, variance, or covariance. The regularizers are extended to perform class-wise regularization, and the extension is found to provide an outstanding shaping capability. A variety of statistical properties are investigated for ten different regularization strategies including dropout and batch normalization, and several interesting findings are reported. Using the family of regularizers, performance improvements are confirmed for MNIST, CIFAR-100, and CIFAR-10 classification problems. But more importantly, our results suggest that understanding how to manipulate statistical properties of representations can be an important step toward understanding DNN, and that the role and effect of DNN regularizers need to be reconsidered. + +# 1 INTRODUCTION + +With a Deep Neural Network (DNN), information contained in the input data $x$ is transformed into multiple representations over multiple layers. Performance of machine learning tasks is known to heavily depend on the choice of representations over $p ( x )$ , but $p ( x )$ is almost always unknown and the representations cannot be directly controlled to match an arbitrary design even if $p ( x )$ was known. As of today, the best that can be done is to indirectly affect the representations by adding constraints, modifying cost function, and tuning learning process, etc. + +In Shannon’s information theory, channel coding theory deals with the problem of reliably sending the maximum amount of information through a given channel $p ( y | x )$ (Cover & Thomas, 2012). Because the channel is known and fixed, coding becomes a design problem where one needs to design codebook, encoder, and decoder. Usually, the channel is used $n$ times in a sequence to send a codeword of length $n$ (expressed as $x ^ { n }$ ). A codebook is a collection of all codewords that can be chosen and sent to the channel, and each message $w$ with information of interest is mapped into one of the codewords during the design phase. + +Because channel coding is a design problem, the optimal solutions are well understood for some of the important applications such as Gaussian channel and Binary Symmetric Channel (BSC). Gaussian channel is the most important continuous alphabet channel problem. It assumes that the received signal $y ^ { n }$ is a noisy version of $x ^ { n }$ , where the noise is independent of $x$ and additive with an i.i.d. Gaussian distribution over the $n$ symbols. Surprisingly, when $n \to \infty$ , the optimal codebook turns out to be a collection of codewords that are generated by randomly drawing numbers from a Gaussian distribution. Then, a codeword’s $n$ symbols form an i.i.d. Gaussian distribution (for instance, see Chap. 9 of Cover & Thomas (2012)). BSC is one of the most popular discrete alphabet channel problems, and $x$ can take a value of 0 or 1. The received signal $y$ is a corrupted version of $x$ where it is flipped with a fixed probability. For BSC, Hamming code is a well-known solution where redundant bits are included in $x ^ { n }$ to resist the corruption (for instance, see Chap. 7 of Cover & Thomas (2012)). The correction capability is dependent on the minimum Hamming distance among all pairs of two different codewords. + +It would be helpful if the elegant channel coding theories can be applied to the design and control of DNN representation, but unfortunately the representation problem is clearly different from the channel coding problem. First of all, a learning problem does not have a fixed and known channel $p ( y ^ { n } | x ^ { n } )$ . Secondly, we can design and control the DNN model to use, but we do not have the luxury of explicitly designing codebook. Therefore, the representations can be formed in any way that is possible. + +Nonetheless, we can attempt to gain insights and ideas from the established coding theory. In this work, we first recognize that the optimal solution to Gaussian channel problem has i.i.d. Gaussian codewords. Although it is unclear if forcing representations of a layer to have an i.i.d. Gaussian property will be helpful, we experiment the idea by expanding known penalty regularization strategies to include L1, variance, and covariance. L1 and covariance (Cogswell et al., 2016) have been studied before (individually), but with our best knowledge, variance of a unit (neuron) and using a combination of them have not been considered in the literature. Secondly, we recognize that only a single codeword is assigned to a message (label for learning problems) for a well designed codebook. When this idea is applied to learning problems via penalty regularization, the penalty term needs to be applied per-class such that we can shape the codeword of each label. Note that almost all of the existing penalty regularization strategies have been applied to all classes together. Thirdly, we recognize that Gaussian codebook and Hamming codebook are fundamentally different. A Gaussian codebook uses continuous alphabets in an uncorrelated manner over $n$ symbols, but Hamming codebook uses only binary values (0 and 1). With the difference, it is inevitable for Gaussian code to utilize long codewords (very large $n$ ) and probabilistically guarantee pair-wise distance, while it is essential for Hamming code to utilize carefully designed vector-space structures (orthogonality, null space, etc.) using relatively short codewords. Because we are often interested in a relatively small number of neurons for representations, we consider a regularization strategy where each label’s activation for a unit is ‘hardened’ (by cw-VR regularizer that is introduced later) such that the representation vector is closer to a binary codeword than an i.i.d. Gaussian codeword. + +# 1.1 RELATED WORKS + +# Regularization + +The classical regularizers apply L2 (Hoerl & Kennard, 1970) and L1 (Tibshirani, 1996) penalties to the weights of models, and they are widely used for DNN as well. Wen et al. (2016) extended L1 regularizer by using group lasso to regularize the structures of DNN (i.e., filters, channels, filter shapes, and layer depth). Regularization has been applied to representations, too. Srivastava et al. (2014) devised dropout that randomly applies activation masking over the neurons. While dropout is applied in a multiplicative manner, Glorot et al. (2011) used L1 penalty regularization on the activations to encourage sparse representations. XCov proposed by Cheung et al. (2014) minimizes the covariance between autoencoding units and label encoding units of the same layer such that representations can be disentangled. DeCov, developed by Cogswell et al. (2016), is also a penalty regularizer and it minimizes the off-diagonals of a layer’s representation covariance matrix. DeCov reduces co-adaptation of units by encouraging units to be decorrelated. It is called CR (Covariance Regularizer) in this study for consistent naming. Statistics over mini-batch samples or in-layer activations have been used for regularization, too. Batch normalization proposed by Ioffe & Szegedy (2015) exploits mini-batch statistics to normalize activations. It was developed to accelerate training speed by preventing internal covariate shift, but it was also found to be a useful regularizer. In line with batch normalization, weight normalization, developed by Salimans & Kingma (2016), uses mini-batch statistics to normalize weight vectors. Layer normalization proposed by Ba et al. (2016) is a RNN version of batch normalization, where they compute the mean and variance used for normalization from all of the summed inputs to the neurons in a layer on a single training case. There are many other publications on DNN regularization techniques, but we still do not have a sufficient understanding on how they really work. A recent work by Zhang et al. (2016) shows that the traditional concept of controlling generalization error by regularizing the effective capacity cannot be applied to DNN. + +# Class-wise Learning + +True class information is available for supervised learning problems. Traditionally, the class information has been used only for evaluating the correctness of predictions and the relevant cost function terms. Some of the recent works, however, have adopted the class-wise concept in the learning algorithm itself. In those works, class information is used as a switch or for emphasizing the discriminative aspects over different classes. As an example, Li et al. (2008) proposed a kernel learning method using class-wise information to model the manifold structure. They modify locality preserving projection to be class dependent. Jiang et al. (2011) added label consistent regularizers for learning a discriminative dictionary. As for DNN, a recent work by Liao et al. (2016) used a clustering based regularization that encourages parsimonious representations. In their work, similar representations in sample, spatial, and channel dimensions are clustered and used for regularization such that similar representations are encouraged to become even more similar. While their work can be applied to unsupervised as well as supervised problems, our work utilizes a much simpler method of directly using class labels during training to avoid $\mathbf { k }$ -means like clustering. Another recent work by Belharbi et al. (2017) directly uses class labels to encourage similar representations per class as in our work. Their work, however, is based on sum of pair-wise distances among the mini-batch samples of the same labels, and therefore computationally more demanding. The cw-VR (classwise Variance Regularizer) and cw-CR (class-wise Covariance Regularizer) in this work are very simple penalty regularizers that were designed for the purpose of controlling statistical properties of representations. + +# 2 THREE STATISTICAL PROPERTIES AND CLASS-WISE REGULARIZATION + +For channel coding problems, we can characterize the statistical properties of optimal codewords as discussed in Section 1. Our goal is to make DNN representation vectors to have such statistical properties and analyze their effects. Because an explicit design and control of representation vector is not possible for the learning problems, we utilize penalty regularizers to manipulate the statistical properties instead. + +# 2.1 THREE STATISTICAL PROPERTIES + +Three of the most basic statistical properties are considered in this work - sparsity, variance, and covariance. Sparsity over layer $l$ ’s representation vector $\mathbf { h } _ { l }$ has been extensively studied in the literature. For variance, we are referring to the variance of a unit’s activation values over mini-batch samples. When the variance is forced to be very small, the activation value needs to be close to the sample mean for all labels, and therefore the unit loses its discriminative power over multiple labels. While this is undesirable, regularizing variance turns out to be meaningful because the cross-entropy cost function prevents the variance becoming zero, and a healthy compromise can be achieved between cross-entropy and variance terms. This is similar to the situation of classic weight regularization, where the weights actually never become zero by regularization. For covariance, we calculate pair-wise covariance over the unit activations of a layer. When covariance is evaluated to be large for a pair of units (neurons) in the same layer, it indicates that the two are strongly correlated. This is undesirable if we are pursuing i.i.d. property over unit activations, and having a regularizer to control the level of correlation can be useful. + +# 2.2 CLASS-WISE REGULARIZATION + +To pursue statistical properties for each class, we adopt the concept of class-wise learning. + +For instance, it is undesirable if the variance becomes exactly zero for a unit’s activation as mentioned above. Variance of zero for a class, however, can be desirable because it simply states that a consistent activation value will be observed over all samples with the same class label. Note that overall variance over all labels can be still large while class-wise variance is zero - as long as interclass difference exists, the overall variance will not be zero. We combine this concept of class-wise regularization to the three concepts of sparsity, variance, and covariance. Analytical formulations can be found in the following section. + +# 3 PENALTY LOSS FUNCTIONS + +In this section, we provide the model for calculating basic statistics and formulate the penalty loss functions that are used for regularization. + +# 3.1 BASIC STATISTICS + +For layer $l$ , the output activation vector of a linear filter followed by ReLU is defined as $\mathbf { h } _ { l } \ =$ $\mathrm { m a x } ( \bar { \mathbf { W } } _ { l } ^ { \top } \mathbf { h } _ { l - 1 } + \mathbf { b } _ { l } ^ { \top } , 0 )$ . Because we will be focusing on layer $l$ for most of the explanations, we drop the layer index and $\mathbf { h }$ is used to indicate $\mathbf { h } _ { l }$ instead. Then, $h _ { i }$ is the ith element of $\mathbf { h }$ (i.e. activation of $i$ th unit), and $w _ { k i }$ is the $( k , i )$ element of $\mathbf { W }$ . + +To use statistical properties of representations, we define mean of unit $i$ , $\mu _ { i }$ , and covariance between unit $i$ and unit $j , c _ { i , j }$ , using the $N$ samples in each mini-batch. + +$$ +\begin{array} { l } { \displaystyle \mu _ { i } = \frac { 1 } { N } \sum _ { n } h _ { i , n } } \\ { \displaystyle c _ { i , j } = \frac { 1 } { N } \sum _ { n } ( h _ { i , n } - \mu _ { i } ) ( h _ { j , n } - \mu _ { j } ) } \end{array} +$$ + +Here, $h _ { i , n }$ is the activation of unit $i$ for nth sample in the mini-batch. From equation (2), variance of $i$ unit can be written as below. + +$$ +\nu _ { i } = c _ { i , i } +$$ + +When class-wise statistics need to be considered, we choose a single label $m$ and evaluate mean, covariance, and variance using only the data samples with label $m$ in the mini-batch. + +$$ +\begin{array} { l } { \displaystyle \mu _ { i } ^ { m } = \frac { 1 } { \vert S _ { m } \vert } \sum _ { n \in S _ { m } } h _ { i , n } } \\ { \displaystyle c _ { i , j } ^ { m } = \frac { 1 } { \vert S _ { m } \vert } \sum _ { n \in S _ { m } } ( h _ { i , n } - \mu _ { i } ^ { m } ) ( h _ { j , n } - \mu _ { j } ^ { m } ) } \\ { \displaystyle \nu _ { i } ^ { m } = c _ { i , i } ^ { m } } \end{array} +$$ + +Here, $S _ { m }$ is the set containing indexes of the samples whose label is $m$ , and $| S _ { m } |$ is the cardinality of the set $S _ { m }$ . + +# 3.2 PENALTY LOSS FUNCTIONS + +Using the notations in Section 3.1, the loss functions and their derivatives can be derived and summarized as in Table 1. L1-weight and L2-weight are well-known, and they impose L1 and L2 penalties on the weights, respectively. The rest in the table apply penalties on the representation. L1-rep is similar to L1-weight, but the penalty is applied to the representation h. Obviously, L2 can also be applied to the representation, but it is excluded in this study because it tends to perform worse than L1 when applied to representation. VR (Variance Regularization) calculates variance of each unit’s activation over mini-batch dataset and uses the calculated value as the penalty. CR (Cross-covariance Regularization) uses off-diagonal terms of the mini-batch covariance matrix of activations as the penalty term. As mentioned earlier, CR in this work is the same as DeCov presented by Cogswell et al. (2016), but we use the term CR for the consistency of naming. As in DeCov, we subtract variance terms and consider cross-covariance terms only (see penalty loss function in Table 1). cw-VR and cw-CR are similar to VR and CR, respectively, except that the values are calculated for each class using the mini-batch samples with the same class label. cw-L1-rep can be defined, but its penalty loss function turns out to be the same as L1-rep’s loss function. Therefore, cw-L1-rep is excluded in this study. + +# Interpretation of derivatives + +While the penalty functions were chosen from the three distinct statistical properties and class-wise concept, their derivatives show that some of them are closely related. For the derivatives of VR and + +Table 1: Penalty loss functions of regularizers + +
Penalty loss functionDerivatives
ΩL1-weight =∑∑ |wkil ki0SL1-weight = sign(Wki) wki
ΩL2-weight =∑∑ wiL2-weight = 2Wki dwki
ki ΩL1-rep =∑∑IhinlSL1-rep = sign(hi,n) dhi,n
n i ΩvR =Mui0vR 2 (hin-μi) Ohi,n N
i =∑∑(ci,j)²-∑(ui)² ΩCR0ScR 2 £ Ci,j(hj,n-μj) Ohi,n N
i i -∑∑ Ωcw-VR uji 0Scw-VR 2 (hi,n- μm),n ∈ Sm Ohi,n |Sml
m i Ωcw-CR =∑(∑∑(ci,j)²-∑(ui)²)0Scw-CR 2 £ c(hjn-μ),n ∈ Sm dhi,n |Sml ji
+ +CR, it can be observed that they have similar structures. If VR’s derivative $\frac { \partial \Omega _ { V R } } { \partial h _ { i , n } }$ becomes zero for all $i$ , then CR’s derivative $\frac { \partial \Omega _ { C R } } { \partial h _ { i , n } }$ becomes zero as well. The vice versa does not hold, but the effects of VR and CR can be expected to be similar or at least related to each other for the learning process. In the same way, the relationship between cw-VR and cw-CR is the same as the relationship between VR and CR. Therefore, we can expect cw-VR and cw-CR to have similar effects, too. On the other hand, the derivative of L1-rep has a distinct formulation, and it can be expected to have a distinct effect on learning. + +There is another important effect that is not necessarily obvious from the derivative formulations. For L1-weight and L2-weight, the derivatives are dependent on the weights $w _ { k i }$ only, and they are independent of the activations $h _ { i , n }$ . Therefore, the weights need to become smaller to reduce the regularization penalty. For the other five representation regularizers, their derivatives are all dependent on activation $h _ { i , n }$ . So, a simple way to reduce the regularization penalties is to scale the activations to small values (instead of satisfying the balances among the terms in the equation to reach zero gradients and force the desired statistical properties). This scaling will not have any effect on prediction output as long as all the elements of $\bar { \mathbf { h } } ^ { l }$ are scaled together to $\alpha \mathbf { h } ^ { l }$ - the last softmax layer works as a normalization function for the output layer, and therefore the cross-entropy penalty term is not affected by such a scaling. This means that there is a chance for the learning algorithm to squash activations just so that representation regularization terms can be ignored. As we will see later, indeed activation squashing happens by learning, but the desired statistical properties are still sufficiently enforced. Nonetheless, it must be possible to design better penalty regularizers that are immune to activation squashing, and such regularizers might be much more effective for manipulating statistical properties of representations. + +# 4 EXPERIMENTS - MNIST + +In this section, we consider ten regularization strategies and compare them using the MNIST dataset (LeCun et al., 1998). We use a Multilayer Perceptron (MLP) with five hidden fully connected layers and an output layer. Each hidden layer has 100 units with Rectified Linear Unit (ReLU) activation function, and the output layer consists of 10 softmax units. All experiments (in this work) were carried out using TensorFlow 1.3. + +Table 2: Error performance of popular regularizers (MNIST) + +
LayerBaselinePenalty on weightImplicit method
L1-weightL2-weightDropoutBN
All3.06±0.152.90±0.082.96±0.094.08±0.062.69±0.06
+ +Table 3: Error performance of representation regularizers (MNIST) + +
LayerAll classesClass-wise
L1-repVRCRcw-VRcw-CR
Output2.61±0.042.67±0.152.62±0.072.56±0.022.55±0.08
Layer 52.61±0.112.70±0.032.67±0.042.63±0.052.61±0.06
Layer 42.75±0.052.89±0.112.69±0.132.67±0.122.71±0.04
Layer 33.35±0.083.16±0.093.11±0.133.22±0.063.22±0.06
Layer 23.40±0.113.15±0.213.01±0.103.14±0.103.24±0.11
Layer 14.31±0.142.98±0.093.13±0.093.25±0.043.14±0.03
+ +Table 4: Error performance of representation regularizers - multiple layers (MNIST) + +
L1-repVRCRcw-VRcw-CR
Output2.61±0.042.67±0.152.62±0.072.56±0.022.55±0.08
Output, 52.48±0.122.67±0.112.43±0.082.46±0.072.55±0.10
Output, 5, 42.78±0.112.58±0.062.80±0.122.53±0.072.48±0.07
Output, 5, 4, 32.79±0.102.78±0.082.83±0.142.80±0.102.72±0.04
Output, 5,4, 3, 23.19±0.102.91±0.132.77±0.072.90±0.102.75±0.07
All3.26±0.092.86±0.072.80±0.082.83±0.072.85±0.12
+ +# 4.1 PERFORMANCE RESULTS + +For each regularization term, the level of regularization was determined by tuning the penalty loss weight using a validation dataset and a grid search. Then, we trained each model five-times and calculated the test error performance as the average and one standard deviation over the five performance results. In Table 2 and Table 3, the results show that representation regularizers outperform the popular regularizers and that the representation strategies perform better when applied to upper layers of DNN. Interestingly, the best performance is achieved by applying representation regularization to the output layer as shown in Table 3. This might be because the regularizer directly affects only the regularizing layer and the layers below, or because manipulating statistical properties is more effective for the higher layer representations that have stronger or codeword-like structures. To better understand the effect of a layer, multiple layer results are shown in Table 4. The best performance is achieved when output layer is regularized together with one or two upper hidden layers. Among all the results in the three tables, CR performs best and achieves $2 . 4 3 \%$ of error. + +# 4.2 STATISTICAL PROPERTIES OF 10 REGULARIZATION STRATEGIES + +We use nine metrics to compare the statistical properties of the ten regularization strategies. Among the nine metrics, first seven of them are calculated by directly evaluating the penalty loss functions shown in Table 1. The raw evaluation values, however, are difficult to interpret because they have different scales. So, we normalize the metrics as following (see the raw evaluation values shown in Table 10 and Table 11). First, square-root is applied to L2-weight, VR, and CR because their units are quadratic, and square-root of square-root is applied to cw-VR and cw-CR because their units are quartic. Then, all the metrics of each regularizer are divided by the regularizer’s own $\sqrt { \Omega _ { L 2 - w e i g h t } }$ such that all are normalized with respect to its 2-norm weight values. Finally, all the metrics are normalized by baseline’s metrics and 100 is multiplied such that we can focus on the relative change in percentage compared to the baseline’s metrics. The remaining two metrics are the average number of activated classes per unit as the measure of sparsity and ratio of dead units, and they are explained in Appendix C. $\Omega _ { L 1 - w e i g h t }$ and $\Omega _ { L { 2 } - w e i g h t }$ are calculated from the weights of all layers excluding biases, and the others are calculated from layer 5’s activations using test dataset. + +Table 5: Evaluation of statistical properties (layer 5) - popular strategies + +
MetricBaselinePenalty on weightImplicit method
L1-weightL2-weightDropoutBN
ΩL1-weight (all)100.0088.0592.2599.1484.82
ΩL2-weight (all)100.00100.00100.00100.00100.00
ΩL1-rep100.00115.28110.2636.1116.94
ΩvR100.00113.97109.5861.1827.69
ΩcR100.00111.55107.5139.355.80
Ωcw-VR100.00114.08109.6872.9150.50
Ωcw-CR100.00112.68108.5578.4920.54
Aug_Act_Class5.245.545.354.602.48
Ratio_Dead_Unit14%5%9%0%1%
+ +Table 6: Evaluation of statistical properties (layer 5) - representation regularizers + +
MetricAll classesClass-wise
L1-repVRCRcw-VRcw-CR
ΩL1-weight (all)93.0896.4295.8386.8584.14
ΩL2-weight (all)100.00100.00100.00100.00100.00
ΩL1-rep1.079.169.733.415.49
ΩvR7.779.249.423.915.28
ΩCR0.330.640.630.150.27
Ωcw-VR19.8528.1229.6111.2514.27
Ωcw-CR3.696.797.151.662.37
Avg_Act_Class0.235.125.384.145.29
Ratio_Dead_Unit77%9%5%23%7%
+ +We can observe two distinct groups of regularizers by investigating Table 5 and Table 6. We can observe that the representation regularizers have much smaller values for the representation metrics. This is because the representation regularizers squash activations in the way described in Section 3.2. As mentioned in Section 3.2, VR and cw-VR are related to CR and cw-CR, respectively. We can see that their values of metrics are similar to each other. Despite this similarity of the five representation regularization, L1-rep and cw-VR have unique characteristics. L1-rep obviously enforces sparsity and causes much more dead units than the others. The regularizer cw-VR always shows the smallest metric values among four strategies (VR, CR, cw-VR, and cw-CR). This can be an evidence of the four regularizers’ close relationship. The metric values of dropout and batch normalization (BN) are located somewhere between baseline and representation regularizers. They cause similar effects on representation metrics as the representation regularizers, but much less effect are observed. It is also interesting to note that both dropout and BN have only $0 \sim 1 \%$ of dead units (neurons). Dropout and BN are implicit methods in the sense that they do not target any particular statistical property, but they certainly seem to have distinct effects compared to the other regularizers. + +# 4.3 VISUALIZATION OF REPRESENTATIONS + +Due to activation squashing, metrics of statistical properties can become misleading. Therefore, we visualize the representation of Layer 5 to more intuitively understand the statistical properties that are affected by the regularizers. Samples for three regularizers are shown in Figure 1 and Figure 2, and all figures for the ten regularizers are shown in appendix (Figure 3 and Figure 4). + +# Histogram of a single unit + +We first visualize the distribution of activation per unit in Figure 1 to observe sparsity and variance properties. Activation histograms were generated by using 10,000 test data, and each color corresponds to a different class. Since activations are generated as the output of ReLU activation function, many have zero value that can distort the histogram. We, therefore, excluded zeros from activations when drawing the histogram plots. In Figure 1(a), it can be seen that baseline has a large class-wise variance and inter-class overlaps. The histogram of cw-VR in (b), however, shows the effect of separating the classes because class-wise variance is significantly reduced. For each class, the activation is ‘hardened’. L1-rep in (c) can be confirmed to have only one class that is activated, and this confirms the sparsity. As described in Table 6, Avg Act Class of L1-rep is close to zero, so most of its histograms show very few active samples. + +![](images/eb2543fb65c0f8b3c3294b37a3bd7808d7ac7c0a603d8eb5c2a1b7bad22a2949.jpg) +Figure 1: Histogram of a sample nueron’s activation values over test dataset. The sample was chosen from $\mathbf { h } _ { 5 }$ . Compared to baseline, cw-VR clearly shows non-overlapping distributions for different labels. L1-rep shows a similar distribution shape as in the baseline, but only a single label is activated in this example. Best viewed in color. + +# Scatter plot of a pair of units + +To show the relationship between two representation units, we randomly chose two units from a representation vector $\mathbf { h } _ { 5 }$ and drew a scatter plot of their activation values for the test dataset. As shown in Figure 2, baseline shows a modest linearity, which is consistent with the high covariance value. Since CR in (b) reduces cross-covariance per unit, it can be seen that overall linearity is significantly reduced compared to the baseline and the randomly chosen pair of units becomes almost independent. In the same way, cw-CR has reduced class-wise cross-covariance. Furthermore, its class-wise variance is small and thus end up having small ball-shaped concentrations of points. + +![](images/ea64bbe4ead1da5e497615fc4db2dae317c28ae55693fc4472086360c1d21589.jpg) +Figure 2: Scatter plot of activation values of randomly chosen two units from $\mathbf { h } _ { 5 }$ . Compared to baseline, CR has clearly less correlation indicating less co-adaptation. cw-CR also shows low coadaptation, but it has smaller ball shapes per label because of the low class-wise variance. Best viewed in color. + +# 5 EXPERIMENTS - CIFAR-10/100 + +While performance improvement is not the primary focus of this work, we provide additional test results with performance evaluations and show that the representation regularizers are useful for pushing the accuracy performance to the next level. In particular, we provide additional test results for CIFAR-100 and CIFAR-10 datasets (Krizhevsky & Hinton, 2009). For CIFAR-100, we have chosen a toy CNN architecture to confirm performance improvement of representation regularizers. Concurrently using two of the regularizers is experimented as well. For CIFAR-10, we have tested representation regularizers using Residual Network (ResNet) that is known as one of the best performing deep neural networks for image data. + +Table 7: Error performance of regularizers (CIFAR-100) + +
RegularizerTrain errorTest error
BaselineNone25.5056.02
Penalty on weightL1-weight18.1655.99
L2-weight Dropout (fc)33.75 28.0254.93 55.28
Implicit methodDropout (all) 79.28 28.2880.08 55.33
BN (fc) BN (all) L1-rep 98.938.63 57.82 99.00
Penalty on representationSingleVR CR cw-VR27.02 53.66
33.24 22.8554.67 54.15
cW-CR VR+CR27.8453.78
13.8854.68
VR+cw-VR19.4356.12
VR+cw-CR
Combination28.5354.94
CR+cw-VR21.11
CR + cw-CR53.30
cw-VR+ cW-CR18.05 25.7754.75
98.9355.64
L1-rep + VR99.00
L1-rep + CR98.9399.00
L1-rep + cw-VR L1-rep + cw-CR98.93 98.9399.00 99.00
+ +# 5.1 COMBINING MULTIPLE STRATEGIES: CIFAR-100 + +We use a toy CNN network for experimenting with CIFAR-100. The CNN network consists of four convolution layers and a fully connected layer, all with 100 hidden units. ReLU is used as the activation function. The second, third, and fourth convolution layers are followed by a max pooling layer. The last 10,000 instances of 50,000 training data were used as the validation data. Using the validation data, validation performance was evaluated for the regularizer weight values of $\{ 0 . 1 , \bar { 0 } . 0 1$ , $0 . 0 0 1 , 0 . 0 0 0 1 \}$ . The best weight value was found for each regularizer, and the test performance was evaluated for the fixed weight values. For representation regularizers, regularization was applied to the fully connected layer. The performance results are shown in Table 7. From the table, it can be seen that the test error is improved from baseline $5 6 . 0 2 \%$ to $5 3 . 6 6 \%$ by using a single regularizer (VR) and to $5 3 . 3 0 \%$ by using two regularizers (CR and cw-VR). Therefore, $2 . 7 2 \%$ of improvement is achieved by the best performing regularizer combination. Aside from the performance improvement, it is interesting to observe that L1-rep consistently fails to train for the CIFAR-100 data. With 100 labels, too much sparsity might hurt the performance. This is a plausible hypothesis considering that we have only 100 neurons to encode 100 labels. A shared use of neurons over multiple classes might be a better direction to pursue. In general, the relationship between the number of labels and the desired statistical properties of representation remains a topic to be studied. + +# 5.2 PERFORMANCE IMPROVEMENT OF RESNET-32 + +ResNet was first proposed by He et al. (2016). ResNet consists of multiple basic blocks that are serially connected, and shortcut connections to force residuals to be calculated. We apply five regularization strategies without modifying the ResNet-32 architecture. Regularization was applied to the output layer only. Experimental results in Table 8 show that performance is improved over the state-of-the-art ResNet-32 model, and cw-VR shows the best performance. This indicates that representation regularizers are compatible with ResNet, and most likely also with other state-of-the-art models. + +Table 8: Error performance of regularizers on ResNet-32 (CIFAR-10) + +
ModelHe et al.Ours
ResNet-327.517.39
ResNet-32 +L1-rep ResNet-32 + VR ResNet-32+CR7.27
7.22
7.27
ResNet-32+cw-VR7.17
ResNet-32 + cw-CR7.21
+ +# 6 CONCLUSION + +In this work, we have investigated five different penalty regularizers for manipulating statistical properties of DNN representations. The regularizers were conceived by examining optimal codewords of well-known channel coding problems, and the three statistical properties of sparsity, variance, and covariance were integrated into the regularizers along with the concept of class-wise regularization. It was found that many statistical properties including cross-covariance, co-adaptation, per-class variance, average number of active class per-unit, and the ratio of dead units can be manipulated. Each regularizer, however, tended to manipulate multiple properties at the same time, making it difficult to manipulate each property individually. While manipulation was shown to be possible and helpful for improving the performance of all three DNN classification problems that were investigated, it is still unclear if any statistical property of representation is generally helpful when strengthened. Due to the complicated nature of learning process where back-propagation affects not only the signal of interest but also other signals and irrelevant noise, it still remains an open question on how to establish procedures that generally improve learning of any deep learning problems. + +The contributions of this work can be summarized as follow. First, a complete set of very simple regularizers for controlling sparsity, variance, and covariance of representations was presented. Among them, VR, cw-VR, and cw-CR have been designed and used for the first time and they work very well. The visualizations clearly show that the new regularizers are effective for manipulating statistical properties of representations in new ways. Secondly, by analyzing statistical properties in a quantitative way, we have shown that none of the popular regualrizers works in a distinct way. Even the well-known dropout does not control co-adaptation(covariance) only. In fact, sparsity and class-wise variance are affected together by dropout, and therefore it is difficult to claim if indeed reduction in co-adaptation is why dropout works well. Thirdly, we have provided partial results on which statistical properties can be helpful or harmful for different learning tasks (tasks with more labels, with more complexity, etc.). This part needs to be further investigated to see if general rules can be derived. + +# ACKNOWLEDGMENTS + +To be added. + +# REFERENCES + +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. + +Soufiane Belharbi, Clement Chatelain, Romain Herault, and Sebastien Adam. Neural networks regularization through invariant features learning. arXiv preprint arXiv:1709.01867, 2017. + +Brian Cheung, Jesse A Livezey, Arjun K Bansal, and Bruno A Olshausen. Discovering hidden factors of variation in deep networks. arXiv preprint arXiv:1412.6583, 2014. + +Michael Cogswell, Faruk Ahmed, Ross Girshick, Larry Zitnick, and Dhruv Batra. Reducing overfitting in deep networks by decorrelating representations. 2016. + +Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012. + +Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 315–323, 2011. + +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. + +Arthur E Hoerl and Robert W Kennard. Ridge regression: Biased estimation for nonorthogonal problems. Technometrics, 12(1):55–67, 1970. + +Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015. + +Zhuolin Jiang, Zhe Lin, and Larry S Davis. Learning a discriminative dictionary for sparse coding via label consistent $\mathbf { k }$ -svd. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pp. 1697–1704. IEEE, 2011. + +Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009. + +Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. + +Jun-Bao Li, Jeng-Shyang Pan, and Shu-Chuan Chu. Kernel class-wise locality preserving projection. Information Sciences, 178(7):1825–1835, 2008. + +Renjie Liao, Alex Schwing, Richard Zemel, and Raquel Urtasun. Learning deep parsimonious representations. In Advances in Neural Information Processing Systems, pp. 5076–5084, 2016. + +Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in Neural Information Processing Systems, pp. 901–909, 2016. + +Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of machine learning research, 15(1):1929–1958, 2014. + +Robert Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), pp. 267–288, 1996. + +Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2074–2082, 2016. + +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016. + +# APPENDIX + +A PERFORMANCE OF POPULAR REGULARIZERS WHEN APPLIED TO EACH LAYER + +Table 9: Error performance of popular regularizers - applied to each layer + +
LayerBaselinePenalty on weightImplicit method
L1-weightL2-weightDropoutBN
All3.06±0.152.90±0.082.96±0.094.08±0.062.69±0.06
Output3.02±0.152.96±0.062.99±0.182.97±0.08
Layer 52.98±0.052.99±0.132.80±0.083.04±0.09
Layer 42.98±0.082.98±0.092.67±0.052.84±0.15
Layer 33.04±0.093.03±0.182.67±0.162.94±0.13
Layer 22.91±0.052.76±0.162.70±0.082.84±0.16
Layer 12.93±0.052.52±0.103.07±0.072.58±0.07
+ +# B EVALUATION OF STATISTICAL PROPERTIES + +Table 10: Evaluation of statistical properties (raw) - popular regularizers + +
PropertyBaseline Penalty on weightImplicit method
L1-weightL2-weightDropoutBN
ΩL1-weight (all)9795.037504.608220.219461.529488.60
ΩL2-weight (all)607.46459.85502.71576.60792.24
ΩL1-rep3.24 × 1063.25 × 1063.25 × 1061.14 × 1066.27 ×105
SvR865.69851.24860.34307.6486.59
ScR58178.0054803.1055650.208551.84255.31
Ωcw-VR2398.032327.792377.46610.58265.46
Ωcw-CR63726.2058891.6060610.2021795.60193.26
+ +Table 11: Evaluation of statistical properties (raw) - representation regularizers + +
PropertyAll classesClass-wise
L1-repVRCRCw-VRCW-CR
ΩL1-weight (all)9975.629732.169826.069843.849772.89
ΩL2-weight (all)727.22645.03665.57813.20853.98
ΩL1-rep38183.203.06 × 1053.39 × 1051.28 × 1052.11 × 105
ΩvR6.267.858.431.783.40
ScR0.802.552.550.190.64
Ωcw-VR5.3416.9122.150.691.97
Ωcw-CR0.171.532.008.83 × 10-30.04
+ +# C METRICS + +# Activated class and dead unit + +ReLU’s output becomes positive when the input has a positive value. In this work, we say a class is activated for a nueron if the probability of the neuron’s output being positive is above a threshold for the given class. We use the entire test dataset to check the probability, and threshold value of 0.9 is used for the evaluations. If many classes are activated for a neuron, it indicates that the neuron is used for representations of many classes. On the other hand, if only a single class is activated for a neuron, it indicates that the neuron is used for representations of only one class and kept zero for all the other classes. When the number of activated class is zero for a neuron, it indicates that the neuron does not carry any information and may be ignored. Such a neuron is called a dead unit. The equations below show how to calculate if a class $m$ is activated for a nueron $i , I$ is an indicator function, and $N _ { u }$ is the number of units in the layer. + +$$ +N u m \_ A c t \_ I n C l a s s ( i , m ) = \sum _ { n \in S _ { m } } I ( h _ { i , n } > 0 ) +$$ + +$$ +A c t \_ C l a s s ( i , m ) = I ( \frac { N u m \_ A c t ( i , m ) } { | S _ { m } | } > t h r e s h o l d ) +$$ + +# Average number of activated classes + +The number of activated classes can be calculated for each unit. Then, the average number of activated classes can be calculated over all units in the same layer. When $A v g \_ A c t \_ C l a s s$ is large for a regularizer, it means the regularizer tends to encourage many units to be used for representations. If the value is small, it indicates the regularizer makes only a small number of units to be coded in positive values for the representation. + +$$ +N u m . A c t . C l a s s ( i ) = \sum _ { m } A c t . C l a s s ( i , m ) +$$ + +$$ +A v g \_ A c t \_ C l a s s = \frac { \sum _ { i } N u m \_ A c t \_ C l a s s ( i ) } { N _ { u } } +$$ + +# Ratio of dead units + +Typically, ’dead neuron’ is widely used to represent neurons that are not activated - output is zero all the time over all classes. To extend the concept of ‘activated class’, we define $A l l \_ C l a s s \_ D e a d ( i )$ and Ratio Dead Unit as below. When Ratio Dead Unit is large, it indicates many of the neurons can be removed without affecting the representation. + +$$ +A l l _ { - } C l a s s \_ D e a d ( i ) = I ( \sum _ { m } A c t _ { - } C l a s s ( i , m ) = 0 ) +$$ + +$$ +R a t i o \_ D e a d \_ U n i t = \frac { \sum _ { i } A l l \_ C l a s s \_ D e a d ( i ) } { N _ { u } } +$$ + +# D VISUALIZATION OF REPRESENTATIONS + +![](images/053eb86fb678a8b4506a3e09e3b816b26e3ed5e343ec393f23ad8dcd0ecbdf1d.jpg) +Figure 3: Histograms of activation values for 10 regularizers. Best viewed in color. + +![](images/04567555fb206395296c7deddc68624614892bcf1e4ffd56ab6b84b24d93cb5a.jpg) +Figure 4: Scatter plots of activation values of two units (neurons) for 10 regularizers. Best viewed in color. \ No newline at end of file diff --git a/md/train/rket4i0qtX/rket4i0qtX.md b/md/train/rket4i0qtX/rket4i0qtX.md new file mode 100644 index 0000000000000000000000000000000000000000..579a28b173d9acfa187be92168745847d5650987 --- /dev/null +++ b/md/train/rket4i0qtX/rket4i0qtX.md @@ -0,0 +1,245 @@ +# THE MEANING OF “MOST” FOR VISUAL QUESTION ANSWERING MODELS + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +The correct interpretation of quantifier statements in the context of a visual scene requires non-trivial inference mechanisms. For the example of “most”, we discuss two strategies which rely on fundamentally different cognitive concepts. Our aim is to identify what strategy deep learning models for visual question answering learn when trained on such questions. To this end, we carefully design data to replicate experiments from psycholinguistics where the same question was investigated for humans. Focusing on the FiLM visual question answering model, our experiments indicate that a form of approximate number system emerges whose performance declines with more difficult scenes as predicted by Weber’s law. Moreover, we identify confounding factors, like spatial arrangement of the scene, which impede the effectiveness of this system. + +# 1 INTRODUCTION + +Deep learning methods have been very successful in many natural language processing tasks, ranging from syntactic parsing to machine translation to image captioning. However, despite significantly raised performance scores on benchmark datasets, researchers increasingly worry about interpretability and indeed quality of model decisions. We see two distinct research endeavors here, one being more pragmatic, forward-oriented, and guided by the question “Can a system solve this task?”, the other being more analytic, reflective, and motivated by the question “How does a system solve this task?”. In other words, the former aspires to improve performance, while the latter aims to increase our understanding of deep learning models. + +By ‘understanding’ here we mean observing a reasoning mechanism that, if not resembling human behavior, at least is cognitively plausible. This is by no means necessary for practically solving a task, however, we highlight two reasons why being able to explain model behavior is nonetheless important: On the one hand, cognitive plausibility increases confidence in the abilities of a system – one is generally more willing to rely on a reasonable than an incomprehensible mechanism. On the other hand, pointing out systematic shortcomings inspires systematic improvements and hence can guide progress. Moreover, particularly in the case of a human-centered domain like natural language, ultimately, some degree of comparability to human performance is indispensable. + +In this paper we are inspired by experimental practice in psycholinguistics to shed light on the question of how deep learning models for visual question answering (VQA) learn to interpret statements involving the quantifier “most”. We follow Pietroski et al. (2009) in designing abstract visual scenes where we control the ratio of the objects quantified over and their spatial arrangement, to identify whether VQA models exhibit a preferred strategy of verifying whether “most” applies. Figure 1 illustrates how visual scenes can be configured to favor one over another mechanism. + +We want to emphasize the experimental approach and its difference to mainstream machine learning practice. For different interpretation strategies, conditions are identified that should or should not affect their performance, and test instances are designed accordingly. By comparing the accuracy of subjects on various instance types, predictions about a subject’s performance for these mechanisms can be verified and the most likely explanation identified. Note that our advocated evaluation methodology is entirely extrinsic and does not constrain the system in any way (like requiring attention maps) or require a specific framework (like being probabilistic). + +![](images/519cf8a0fd13367b45764328c0b9ce1dfae2b8c20a6d3c20b024044e747311e7.jpg) +“More than half the shapes are red shapes?” +Figure 1: Three spatial arrangements of objects which may or may not affect the performance of a mechanism for interpreting “most” statements. Going from left to right, a strategy based on pairing entities of each set and identifying the remainder gets more difficult, while a strategy based on comparing cardinalities does not. + +Psychology as a discipline has focused entirely on questions around how humans process situations and arrive at decisions, and consequently has the potential to inspire a lot of experiments (like ours) for investigating the same questions in the context of machine learning. Similar to psychology, we advocate the preference of an artificial experimentation environment which can be controlled in detail, over the importance of data originating from the real world, to arrive at more convincing and thus meaningful results. + +Artificial data has a history in deep learning of establishing new techniques – most prominently, LSTMs were introduced by showing their ability to handle various formal grammars (Gers & Schmidhuber, 2001) – and our higher-level goal with this paper is to demonstrate the potential for more informative evaluation of machine learning models in general. This is motivated by our belief that, in the long term, true progress can only be made if we do not just rely on the narrative of neural networks “learning to understand/solve” a task, but can actually confirm our theories experimentally. Taking inspiration from psychology seems particularly appropriate in the context of powerful deep learning models, which recently are not infrequently described by anthropomorphizing words like “understanding”, and compared to “human-level” performance. + +# 2 THE MEANING OF “MOST” + +In this section we will introduce the two mechanisms of interpreting “most”, discuss cognitive differences and implications, and introduce relevant cognitive concepts. + +# 2.1 GENERALIZED QUANTIFIERS AND “MOST” + +“Most” has a special status in linguistics due to the fact that it is the most prominent example of a quantifier whose semantics cannot be expressed in first-order logic, while other simple natural language quantifiers like “some”, “every” or $" n o '$ directly correspond to the quantifier primitives $\exists$ and $\forall$ (plus logical operators $\wedge$ , ∨ and $\neg$ ). This situation is not just a matter of introducing further appropriate primitives, but requires a fundamental extension of the logic system and its expressivity. + +In the following, by $x$ we denote an entity, $\pmb { A }$ and $\textbf { { B } }$ denote predicates (“square”, “red”), $A ( x )$ is true if and only if $x$ satisfies $\pmb { A }$ , and $\mathbb { S } _ { A } \stackrel { \cdot } { = } \{ x : A ( x ) \}$ is the corresponding set of entities satisfying this predicate (“squares”). Thus we can define the semantics of “some” and “every”: + +$$ +\operatorname { s o m e } / \mathrm { e v e r y } ( A , B ) \Leftrightarrow \exists / \forall x : A ( x ) \Rightarrow B ( x ) +$$ + +Importantly, these definitions do not involve the concept of set cardinality and indeed can be formulated without involving sets. This is not possible for “most”, which is commonly defined in one of the following ways: + +$$ +\begin{array} { r } { \operatorname* { m o s t } ( A , B ) \Leftrightarrow \vert \mathbb { S } _ { A \wedge B } \vert > 1 / 2 \cdot \vert A \vert } \\ { \Leftrightarrow \vert \mathbb { S } _ { A \wedge B } \vert > \vert \mathbb { S } _ { A \wedge - B } \vert } \end{array} +$$ + +This makes “most” an example of a generalized quantifier, and in fact all generalized quantifiers can be defined in terms of cardinalities, indicating the apparent importance of a cardinality concept to human cognition. + +# 2.2 ALTERNATIVE CHARACTERIZATION + +There is another way to define “most” which uses the fact that whether two sets are equinumerous can be determined without a concept of cardinality, based on the idea of a bijection: + +$$ +\begin{array} { c } { A B : \Leftrightarrow \forall x : [ A ( x ) \Leftrightarrow B ( x ) ] } \\ { \Leftrightarrow | \mathbb { S } _ { A } | = | \mathbb { S } _ { B } | } \end{array} +$$ + +The definition of equinumerosity can be generalized to “more than” (and, correspondingly, “less than”), which lets us define “most” as follows: + +$$ +\operatorname { m o s t } ( A , B ) \Leftrightarrow \exists \mathbb { S } \subset \mathbb { S } _ { A \land B } : \mathbb { S } \mathbb { S } _ { A \land \neg B } +$$ + +Although, at a first glance, this definition looks similar to the one above, it can be seen as suggesting a different algorithmic approach to interpreting “most”, as we will discuss below. + +# 2.3 TWO INTERPRETATION STRATEGIES + +The two characterizations of “most” are of course truth-conditionally equivalent, that is, every situation in which one of them holds, the other holds, and vice versa. In particular, if we are just interested in solving a task involving “most” statements, we can be agnostic about which definition our system prefers. Nevertheless, the subtle differences between these two characterizations suggest different algorithmic mechanisms of verifying or falsifying such statements, meaning that a system processes a visual scene differently to come to the (same) conclusion about a statement’s truth. + +# Characterization (2) represents the cardinality-based strategy of interpreting “most”: + +1. Estimate the number of entities satisfying both predicates (“red squares”) and the number satisfying one predicate but not the other (“non-red squares”). 2. Compare these number estimates and check whether the former is greater than the latter. + +We want to add that, actually, the two definitions in (2) already suggest a minor variation of this mechanism – see Hackl (2009) for a discussion on “most” versus “more than half”. However, we do not focus on this detail here, and assume the second variant in (2) to be ‘strictly’ simpler in the sense that both involve estimating and comparing cardinalities, but the first variant additionally involves the rather complex operation of halving one number estimate. + +Characterization (5) utilizes the concept of a bijection, which is a comparatively simple pairing mechanism and as such could be imagined to be a primitive cognitive operation. This gives us the pairing-based strategy of interpreting “most”: + +1. Successively match entities satisfying both predicates (“red squares”) uniquely with entities satisfying one predicate but not the other (“non-red squares”). 2. The remaining entities are all of one type, so pick one and check whether it is of the first type (“red square”). + +# 2.4 COGNITIVE IMPLICATIONS + +Finding evidence for one strategy over the other has substantial implications with respect to the ‘cognitive abilities’ of a neural network model. In particular, evidence for a cardinality-based processing of “most” suggests the existence of an approximate number system (ANS), which is able to simultaneously estimate the number of objects in two sets, and perform higher-level operations on the resulting number representations themselves, like the comparison operation here. Explicit counting would be an even more accurate mechanism here, but neither available to the subjects in the experiments of Pietroski et al. (2009) due to very short scene display time, nor likely to be learned by the ‘one-glance’ feed-forward-style neural network we evaluate in this work1. + +The ANS (see appendix in Lidz et al. (2011) for a summary) is an evolutionary comparatively old mechanism which is shared between many different species throughout the animal world. It emerges without explicit training and produces approximate representations of the number of objects of some type. They are approximate in the sense that their number judgment is not ‘sharp’, but resulting behavior exhibits variance – like interpreting “most” statements with a cardinality-based strategy, as described above. This variance follows Weber’s law which states that the discriminability of two quantities is a function of their ratio2. The precision of the ANS is thus usually indicated by a characteristic value called Weber fraction which relates quantity and variance. The ANS of a typical adult human is often reported to have a Weber fraction of 1.14 or, more tangibly, it can distinguish a ratio of 7:8 with $7 5 \%$ accuracy. Finding evidence for the emergence of a similar system in deep neural networks indicates that these models can indeed learn and utilize more abstract concepts (approximate numbers) than mere superficial pattern matching (“red squares” etc). + +Both mechanisms to interpret “most” suggest conditions in which they should perform well or badly. For the cardinality-based one, the difference in numbers of the two sets in question is expected to be essential: smaller differences, or greater numbers for the same absolute difference, require more accurate number estimations and hence make this comparison harder, according to Weber’s law. The pairing-based mechanism, on the other hand, is likely affected by the spatial arrangement of the objects in question: if the objects are more clustered within one set, pairing them with objects from the other set becomes harder. Importantly, these conditions are orthogonal, so each mechanism should not substantially be affected by the other condition, respectively. By constructing (artificial) scenes where one of the conditions dominates the configuration, and measuring the accuracy of being able to correctly interpret propositions involving “most”, the expected difficulties can be confirmed (or refuted) and thus indicate which mechanism is actually at work. + +Using this methodology, Pietroski et al. (2009) show that humans exhibit a default strategy of interpreting “most”, at least when only given $2 0 0 \mathrm { m s }$ to look at the scene and hence having to rely on an immediate subconscious judgment. This strategy is based on the approximate number system and the cardinality-based mechanism. Moreover, the behavior is shown to be sub-optimal in some situations where humans would, in principle, be able to perform better if deviating from their default strategy. Since machine learning models are trained by optimizing parameters for the task at hand, it is far from obvious whether they learn a similarly stable default mechanism, or instead follow a potentially superior adaptive strategy depending on the situation. While the latter is likely more efficient in solving at least a narrowly defined task, the former would instead suggest that the system is able to acquire and utilize core concepts like an approximate number system. + +We may speculate about the innate preference of modern network architectures for either of the strategies: Most of the visual processing is based on convolutions which, being an inherently local computation, we assume would favor the pairing-based strategy via locally matching and ‘cancelling out’ entities of the two predicates. On the other hand, the tensors resulting from the sequence of convolution operations are globally fused into a final embedding vector, which in turn would support the more globally aggregating cardinality-based strategy. However, the type of computations and representations learned by deep neural networks are poorly understood, making such speculations fallacious. We thus emphasize again that the higher-level motivation for this paper is to demonstrate how we need not rely on such speculative ‘narratives’, but can experimentally substantiate our claims. + +# 3 EXPERIMENTAL SETUP + +The setup in this paper closely resembles the psychological experiments conducted by Pietroski et al. (2009), but aimed at a state-of-the-art VQA model and its interpretation of “most”. + +• Exactly two squares are yellow. +• Exactly no square is red. +More than half the red shapes are squares. +• More than a third of the shapes are cyan. +• Less than half the shapes are green. +• Exactly all magenta shapes are squares. +• At most five shapes are magenta. +• At least one triangle is gray. + +![](images/b7831eb3292ea0d291005dfe3cd6dea5b33ab6904aa03d8e75b8d3d39e98c08b.jpg) + +![](images/53d50c1372a6d57ab37ab67c617cc4c17737075607b09eca25ab94c0e2fb8b22.jpg) +Figure 2: Two example images with four in-/correct captions each, taken from the Q-full dataset (all quantifier and number captions). + +# 3.1 TRAINING AND EVALUATION DATA + +We use the ShapeWorld framework (Kuhnle & Copestake, 2017) as starting point to generate appropriate data. ShapeWorld is a configurable generation system for abstract, visually grounded language data. A data point consists of an image, an accompanying caption, and an agreement value indicating whether the caption is true given the image. The underlying task, image caption agreement, essentially corresponds to yes/no questions and as such is a type of visual question answering. Internally, the system samples an abstract world description from which a semantic caption representation is extracted. Both are then turned into ‘natural’ (but still abstract) representations as image and natural language statement, respectively. The latter transformation is based on a semantic grammar formalism (see their paper for details). + +We use the pre-implemented quantifier captioner component, both in its unrestricted version and one with available quantifiers restricted to “more than half” and “less than half”3. The former contains various additional (generalized) quantifiers (“no”, “a/three quarter(s)”, “a/two third(s)”, “all”) and numbers (ranging from “zero” to “five”), each in combination with a comparing modifier (“less than”, “at most”, “exactly”, “at least”, “more than”, “not”). We refer to the unrestricted version as Q-full, the other one as Q-half. Figure 2 shows two images together with potential Q-full captions. + +We also use the default world generator to produce training data (up to 15 randomly positioned objects, as seen in figure 2). However, all of the pre-implemented generator modules are too generic for our evaluation purposes, since they do not allow to control attributes and positioning of objects to the desired degree. We thus implemented our own custom generator module with the following functionality to produce test data. + +Attribute contrast: For each instance, either the attribute ‘shape’ or ‘color’ is picked4, and subsequently two values for this attribute and one value for the other is randomly chosen. This means that the only relevant difference between objects in every image is either one of two shape or color values (for instance, red vs blue squares, or red squares vs circles). + +Contrast ratios: A list of valid ratios between the contrasted attributes can be specified, from which one will randomly be chosen per instance. For instance, a ratio of 2:3 means that there are $50 \%$ more objects with the second than the first attribute. We look at values close to 1:1, that is, 1:2, 2:3, 3:4, 4:5, etc. The increasing difficulty (for humans) resulting from closer ratios is illustrated in figure 3. Multiples of the smaller-valued ratios are also generated (e.g., 2:4 or 6:9), within the limit of up to 15 objects overall. + +Area-controlled: If this option is set, object sizes are not chosen uniformly across the entire valid range, but size ranges for the two contrasting object types are adapted to the given contrast ratio and size of the chosen shape(s), so that both attributes cover the same image area on average. This means that the more numerous attribute will generally be represented by smaller objects, and the difference in covered area between, for instance, squares and triangles is taken into account. + +![](images/687147eec990d42635eb5ad93cd1cd6969f03efed2811f813665a87c84a4e4ac.jpg) +Figure 3: From left to right, the ratio between the two attributes is increasingly balanced. + +While objects are still positioned randomly in the basic version of this new generator module, we define two modes which control this aspect as well. Figure 1 in the introduction illustrates the different modes. + +Partitioned positioning: An angle is randomly chosen for each image, and objects of the contrasting attributes are consistently placed either on one side or the other. + +Paired positioning: If there are objects of the contrasted attribute which are not yet paired, one of them is randomly chosen and the new object is placed next to it. + +The captions of these evaluation instances are always of the form “More/less than half the shapes are $X ^ { \prime \prime }$ . with $" X '$ being the attribute in question, for instance, “squares” or “red”. Note that this is an even more constrained captioner than the one used for Q-half, since the subject is always fully underspecified as “shape”. We also emphasize that, in contrast to this new evaluation generator module, the default generator configuration of the ‘quantification’ dataset pre-specified in ShapeWorld is used to generate the training instances in Q-half and Q-full. So these images generally contain many more than just two contrasted attributes, and ratios between attributes tend to be accordingly smaller. The examples in figure 2 are chosen to illustrate this fact: the second example contains a “half” statement with ratio 7:8, and the first contains one about a 0:4 ratio, while the image would also allow for a more ‘interesting’ 3:4 ratio (color of semicircles). + +While we generally try to stay close to the experimental setup of Pietroski et al. (2009), in the following we point out some differences. Most importantly, instead of just using yellow and blue dots, we use all eight shapes and seven colors that ShapeWorld provides. This increases the visual variety of the instances and thus encourages the system to actually learn the fact that shape and color are attributes that can be combined in any way, instead of just straightforward binary pattern matching. Note that the humans in the psychological experiments have learned language in even more complex situations, which we cannot hope to approximate here. Moreover, our data does not contain yes/no questions but true/false captions, and “most”-equivalent phrasings “more/less than half”. Since the model is trained from scratch on such data, this should not affect results. + +We do not implement their ‘column pairs mixed/sorted’ modes since they would require comparatively big and mostly empty images, hence require bigger networks and might cause practical learning problems due to sparseness, which we do not want to address here. In contrast, our ‘partitioned’ mode is more difficult than the ones investigated by Pietroski et al. (2009), at least for a pairing-based mechanism. + +We will publish the generator configurations and custom generator modules required to reproduce the datasets we used here on acceptance of the paper. + +# 3.2 MODEL + +We focus on the FiLM model (Perez et al., 2018) here since it exhibited close-to-perfect accuracy on the CLEVR dataset (Johnson et al., 2017a), a diagnostic dataset for VQA which also consists of abstract images. We interpret the ShapeWorld captions and agreement values as questions and answer, respectively. The image is processed using either a pre-trained CNN or a four-layer CNN trained from scratch on the task. The question is processed by a GRU. In a sequence of four residual blocks, the image information is processed with its features linearly modulated (scale, offset) conditioned on the processed question embedding. Finally, the classifier module produces the answer, true or false. We use the code made available by the authors of the FiLM model, without changing any parameters. The only aspect we adapt is the trainable four-layer CNN, which uses a kernel size of 3, batch normalization and a stride of 2 in the second and fourth layer. + +![](images/89879fb5ba739ee5c3a88c305f87f6a8627ded0560b33bfe649f2f3acf3a9d87.jpg) +Figure 4: Training performance (iterations in 1000). + +We considered investigating other models as well: The $\mathrm { P G + E E }$ model (Johnson et al., 2017b) is openly available and achieved very good performance on CLEVR, however, it relies on the ‘program tree’ provided by CLEVR, and while there exists a basic conversion of ShapeWorld caption models to CLEVR program trees, first, the CLEVR-specific modules do not cover quantifiers like “most” and, second, these program trees encode the interpretation strategy, which would defeat the purpose of our investigation to analyze precisely this mechanism as learned from data. The RelationNet architecture (Santoro et al., 2017) explicitly implements a pairing-based mechanism and hence we considered its evaluation less interesting than FiLM. For similar reasons, we did not focus on the VQA model of Zhang et al. (2018), whose architecture includes an explicit counting component. While our aim is to investigate the strategy for understanding “most” learned from data, it would be interesting to examine in both cases whether their architectural prior does indeed have the expected effect. Finally, we only learned about the MAC model (Hudson & Manning, 2018) after we started this project and so decided to leave it for future work, but we definitely consider it one of the most interesting candidate models to evaluate, since its architecture does not suggest an obvious preference for either strategy. + +# 3.3 TRAINING DETAILS + +The training set for both Q-full and Q-half consists of around $1 0 0 \mathrm { k }$ $2 5 \mathrm { x } 4 0 9 6 )$ images with 5 captions per image, so overall around 500k instances. The model is trained for 100k iterations with a batch size of 64. Training performance is measured on an additional validation set of 20k instances. Moreover, we produced 1024 instances for each of the overall 48 evaluation configurations, to investigate the trained model in more detail. + +# 4 RESULTS + +Training. We train two versions of the FiLM model, with CNN trained from scratch on the task: one on the Q-full dataset which contains all available quantifier and number caption types, the other on the Q-half dataset which is restricted to captions involving the quantifier “half” only. Performance of the system over the course of the $1 0 0 \mathrm { k }$ training iterations is shown in figure 4. The two models, referred to by Q-full and Q-half below, learn to solve the task quasi-perfectly, with a final accuracy of $9 8 . 9 \%$ and $9 9 . 4 \%$ respectively. Not surprisingly, the system trained on the more diverse Q-full training set takes longer to reach this level of performance, but nevertheless plateaus after around 70k iterations. + +For the sake of completeness, we also include the performance of other models in this figure, which failed to show clear improvement over the first $5 0 \mathrm { k }$ iterations. This includes the FiLM model with pre-trained instead of trainable CNN module (Q-full-pre, Q-half-pre), and an earlier trial on Q-half (Q-half-coll) where we did not constrain the data generation to not produce object collisions (the default in ShapeWorld is to allow up to $2 5 \%$ area overlap). We note, however, that we have not done any hyperparameter search which might alleviate these learning problems. + +Figure 5: Accuracy (in $\%$ ) of model trained on Q-full and Q-half for the various evaluation setups. + +
trainmodesize-controlledarea-controlled
all1:22:33:44:55:66:77:8all1:22:33:44:55:66:77:8
Q-fullrandompairedpart.9293891009910099999794 91888593100999793918682
96939088829399999691878480
9992908177728999989288827872
Q-halfrandompairedpart.2911001009893888887931001009792868582
10010010099969086847992100999687847976
9686 838380911009994898383
+ +Evaluation. Table 5 presents a detailed breakdown of system performance on the evaluation settings. Before discussing the results in detail, we want to reiterate three key differences between the evaluation data and the training data: + +• The visual scenes here do all exhibit close-to-balanced contrast ratios, while this is not the case for the training instances. +• The evaluation scenes only contain objects of two different attribute pairs, and consequently the numbers to compare are generally greater than in the training instances, where more attributes are likely present in a scene. Q-full contains not just statements involving “half” – in fact, a random sample of 100 images / 500 captions suggests that they constitute only around $8 \%$ of the dataset (and this includes combinations with modifiers beyond “more/less than”). + +Considering that, the relatively high accuracy on test instances throughout indicates a remarkable degree of generalization. + +More balanced ratios. The most consistent effect is that more balanced ratios of contrasted attributes cause performance to decrease. This is certainly affected by the tendency of the training data to not include many examples of almost balanced ratios. However, if this were the only reason, one would expect a much more sudden and less uniformly linear decrease. More importantly, since Q-full generally contains fewer “half” statements, the decline should be more pronounced here. We do not observe either of these effects, and thus conclude that both models may actually have developed an approximate number system. This is further discussed at the end of this section. + +Random vs paired vs partitioned. There is definitely a clear negative effect of the partitioned configuration on performance for the model trained on Q-full, which indicates that the learned mechanism is not robust to a high degree of per-attribute clustering. This does not indicate a preference for the pairing-based strategy, though, since both models perform best on the random configuration. While this suggests that there is neither a preference for the perfectly clustered partitioned nor for the perfectly mixed paired arrangement, we note that the effect is not strong, and that these instances are most similar to the random placement of objects in the training data, which might cause this effect. + +Size- vs area-controlled. The performance in both cases is comparable, showing that the models do not (solely) learn to rely on comparing the overall covered area, which would only work well in the size-controlled mode. Nevertheless, we note a tendency for area-controlled instances to be somewhat more difficult in random and paired mode, more so for Q-half, which suggests that the model(s) learn to use covered area as a feature to inform a correct decision in some cases. + +Q-full vs Q-half. There seems to be a tendency of the system trained on Q-full to perform marginally better, except for the partitioned mode discussed before. The fact that this model performs at least on a par with the one trained on Q-half, while only seeing a fraction of directly relevant training captions, indicates that the learning process is not ‘distracted’ by the variety of captions, and indeed might profit from it. + +Ratios and Weber fraction. We generated evaluation sets of even more balanced ratios (8:9, 9:10, 10:11, increasing the overall number of objects accordingly to 17/19/21), and in figure 6 plotted the accuracy of the Q-full model on increasingly balanced sets for all three spatial configuration modes, not controlling for area (which for greater numbers only has a negligible effect anyway). The figure also contains a diagram with accuracy plotted against ratio fraction, which is more common in the context of Weber’s law. The characteristic Weber fraction can be read off directly as the ratio at which a subject is able to distinguish two values with $7 5 \%$ accuracy. We observe around 1.11 for random/paired and 1.16 for partitioned, which corresponds to 9:10 and 6:7 as closest integer ratios. These values are in the same region as the average human Weber fraction, which is often reported as being 1.14, or 7:8. + +![](images/76fe8e687a29bca0dd010d7ae8e942658d2596c8cb334aeaf19eaa0d9b11dd61.jpg) +Figure 6: (Left) Q-full model performance for increasingly balanced ratios ( $\mathbf { \bar { X } }$ -axis: ratio as $\mathrm { n m } { + 1 }$ ). (Right) Performance as a function of actual ratio fraction $\mathrm { n } { + } 1 / \mathrm { n }$ , with Weber fractions $( 7 5 \% )$ highlighted and the corresponding idealized model Weber curves indicated. + +We emphasize that these curves align well with the trend predicted by Weber’s law, even for the ratios with more than 15 objects overall, where such situations have never been encountered during training. All this strongly suggests that the model learns a mechanism similar to an ANS, which is able to produce representations that can (at least) be utilized for identifying the more numerous set. It can in particular be concluded that the system does not actually learn to explicitly count, since we would then not expect to observe such fuzziness characteristic to an ANS. + +Moreover, since performance is affected somewhat by the partitioned and the area-controlled modes, the interpretation of “most” seems to be informed by other features as well. As we noted earlier, since the model is trained to optimize this task, an adaptive strategy is not unexpected. On the contrary, more surprising is the fact that an ANS-like system emerges as a dominating ‘backbone’ mechanism, with additional factors acting as less influential ‘secondary’ features. + +# 5 RELATED WORK + +Visual question answering (VQA) is the general task of answering questions about visual scenes. Since the introduction of the VQA Dataset (Antol et al., 2015), this dataset was widely used as evaluation benchmark for multimodal deep learning. It provides a shallow categorization of questions, including basic count questions, however, these categories are far too coarse for our purposes. + +Motivated by various problems with the VQA Dataset (Goyal et al., 2017; Agrawal et al., 2016), a range of artificial abstract datasets have been introduced recently. CLEVR (Johnson et al., 2017a) consists of rendered images of geometric objects and questions generated based on templates, covering some abilities like number or attribute comparison in more detail, but still in a fixed categorization. NLVR (Suhr et al., 2017) contains crowdsourced statements about abstract images, but does not sort them according to some criteria. Recently, the COG dataset (Yang et al., 2018) was introduced, which most explicitly focuses on replicating psychological experiments for deep learning models, hence most related to our work. However, their dataset does not contain any number or quantifier statements. + +There is some work on investigating deep neural networks which look at numerosity from a more psychologically inspired viewpoint. Stoianov & Zorzi (2012) find that visual numerosity emerges from unsupervised learning on abstract image data. Zhang et al. (2015) look at salient object subitizing in real-world images, formulated as a classification task over five classes ranging from $\cdot _ { 0 } \cdot \mathrm { \ }$ to $^ { \bullet } 4$ or more’. In a more general number-per-category classification setup, Chattopadhyay et al. (2017) investigate different methods of obtaining counts per object category, one of them inspired by subitizing. Moving beyond explicit number classification, Zhang et al. (2018) recently introduced a dedicated counting module for visual question answering. + +Other work looks at a similar classification task, but for proper quantifiers like “no”, “few”, “most”, “all”, first on abstract images of circles (Sorodoc et al., 2016), then on natural scenes (Sorodoc et al., 2018). Recently, Pezzelle et al. (2018) investigated a hierarchy of quantifier-related classification abilities, from comparatives via quantifiers like the ones above to fine-grained proportions. Wu et al. (2018), besides investigating precise numerosity via number classification as above, also look at approximate numerosity as binary greater/smaller decision, which closely corresponds to our experiments. However, their focus is on the subitizing ability, not the approximate number system, and their experiments follow a different methodology in that they already train models on specifically designed datasets, while we deliberately leverage such targeted data only for evaluation. + +On a methodological level, our proposal of inspiring experimental setup and evaluation practice for deep learning by cognitive psychology is in line with that of Ritter et al. (2017) and their shape bias investigation for modern vision architectures. + +# 6 CONCLUSION + +We identify two strategies of algorithmically interpreting “most” in a visual context, with different implications on cognitive concepts. Following experimental practice of similar investigations with humans in psycholinguistics, we design experiments and data to shed light on the question whether the state-of-the-art FiLM VQA model shows preference for one strategy over the other. Performance on various specifically designed instances does indeed indicate that a form of approximate number system is learned, which generalizes to more difficult scenes as predicted by Weber’s law. The results further suggest that additional features influence the interpretation process, which are affected by the spatial arrangement and relative size of objects in a scene. There are many opportunities for future work from here, from strengthening the finding of an approximate number system and further analyzing confounding factors, to investigating the relation to more explicit counting tasks, to extending the evaluation to other visual question answering models which also exhibit good performance on related tasks (Hudson & Manning, 2018; Zhang et al., 2018; Santoro et al., 2017). + +# REFERENCES + +Aishwarya Agrawal, Dhruv Batra, and Devi Parikh. Analyzing the behavior of visual question answering models. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, EMNLP 2016, pp. 1955–1960, 2016. +Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C. Lawrence Zitnick, and Devi Parikh. VQA: Visual question answering. In Proceedings of the IEEE International Conference on Computer Vision, ICCV 2015, 2015. +Prithvijit Chattopadhyay, Ramakrishna Vedantam, Ramprasaath R. Selvaraju, Dhruv Batra, and Devi Parikh. Counting everyday objects in everyday scenes. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, pp. 4428–4437, 2017. +Felix A. Gers and Jurgen Schmidhuber. LSTM recurrent networks learn simple context-free and ¨ context-sensitive languages. Transactions on Neural Networks, 12(6):1333–1340, 2001. +Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the V in VQA matter: Elevating the role of image understanding in Visual Question Answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, pp. 6325–6334, 2017. +Martin Hackl. On the grammar and processing of proportional quantifiers: most versus more than half. Natural Language Semantics, 17(1):63–98, 2009. +Drew A. Hudson and Christopher D. Manning. Compositional attention networks for machine reasoning. In Proceedings of the International Conference on Learning Representations, ICLR 2018, 2018. + +Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C. Lawrence Zitnick, and Ross Girshick. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, 2017a. + +Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Judy Hoffman, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Inferring and executing programs for visual reasoning. In Proceedings of the IEEE International Conference on Computer Vision, ICCV 2017, 2017b. + +Alexander Kuhnle and Ann Copestake. ShapeWorld - A new test methodology for multimodal language understanding. ArXiv e-prints 1704.04517, 2017. + +Jeffrey Lidz, Paul Pietroski, Justin Halberda, and Tim Hunter. Interface transparency and the psychosemantics of most. Natural Language Semantics, 19(3):227–256, 2011. + +Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron C. Courville. FiLM: Visual reasoning with a general conditioning layer. In AAAI, 2018. + +Sandro Pezzelle, Ionut-Teodor Sorodoc, and Raffaella Bernardi. Comparatives, quantifiers, proportions: A multi-task model for the learning of quantities from vision. In Proceedings of the Conference of the North American Chapter of the Association for Computational Linguistics, NAACL 2018, 2018. + +Paul Pietroski, Jeffrey Lidz, Tim Hunter, and Justin Halberda. The meaning of ’most’: Semantics, numerosity and psychology. Mind and Language, 24(5):554–585, 2009. + +Samuel Ritter, David G. T. Barrett, Adam Santoro, and Matt M. Botvinick. Cognitive psychology for deep neural networks: A shape bias case study. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, pp. 2940–2949, 2017. + +Adam Santoro, David Raposo, David G. T. Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy P. Lillicrap. A simple neural network module for relational reasoning. In Proceedings of the Annual Conference on Neural Information Processing Systems, NIPS 2017, pp. 4974–4983, 2017. + +Ionut Sorodoc, Angeliki Lazaridou, Gemma Boleda, Aurelie Herbelot, Sandro Pezzelle, and Raf- ´ faella Bernardi. “Look, some green circles!”: Learning to quantify from images. In Proceedings of the 5th Workshop on Vision and Language, Berlin, Germany, 2016. + +Ionut Sorodoc, Sandro Pezzelle, Aurelie Herbelot, Mariella Dimiccoli, and Raffaella Bernardi.´ Learning quantification from images: A structured neural architecture. Natural Language Engineering, pp. 130, 2018. + +Ivilin Stoianov and Marco Zorzi. Emergence of a ‘visual number sense’ in hierarchical generative models. Nature Neuroscience, 15(194):194–196, 2012. + +Alane Suhr, Mike Lewis, James Yeh, and Yoav Artzi. A corpus of natural language for visual reasoning. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, 2017. + +Xiaolin Wu, Xi Zhang, and Xiao Shu. On numerosity of deep convolutional neural networks. ArXiv e-prints 1802.05160, 2018. + +Guangyu Robert Yang, Igor Ganichev, Xiao-Jing Wang, Jonathon Shlens, and David Sussillo. A dataset and architecture for visual reasoning with a working memory. ArXiv e-prints 1803.06092, 2018. + +Jianming Zhang, Shuga Ma, Mehrnoosh Sameki, Stan Sclaroff, Margrit Betke, Zhe Lin, Xiaohui Shen, Brian Price, and Radom´ır Mech. Salient object subitizing. In ˇ Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2015, 2015. + +Yan Zhang, Jonathon Hare, and Adam Prugel-Bennett. Learning to count objects in natural im- ¨ ages for visual question answering. In Proceedings of the International Conference on Learning Representations, ICLR 2018, 2018. \ No newline at end of file diff --git a/md/train/rkgKBhA5Y7/rkgKBhA5Y7.md b/md/train/rkgKBhA5Y7/rkgKBhA5Y7.md new file mode 100644 index 0000000000000000000000000000000000000000..ca7a7ae2b394b0720971cd341073cc2cdd45cdc8 --- /dev/null +++ b/md/train/rkgKBhA5Y7/rkgKBhA5Y7.md @@ -0,0 +1,415 @@ +# THERE ARE MANY CONSISTENT EXPLANATIONS OF UNLABELED DATA: WHY YOU SHOULD AVERAGE + +Ben Athiwaratkun, Marc Finzi, Pavel Izmailov, Andrew Gordon Wilson {pa338, maf388, pi49, andrew}@cornell.edu Cornell University + +# Abstract + +Presently the most successful approaches to semi-supervised learning are based on consistency regularization, whereby a model is trained to be robust to small perturbations of its inputs and parameters. To understand consistency regularization, we conceptually explore how loss geometry interacts with training procedures. The consistency loss dramatically improves generalization performance over supervisedonly training; however, we show that SGD struggles to converge on the consistency loss and continues to make large steps that lead to changes in predictions on the test data. Motivated by these observations, we propose to train consistencybased methods with Stochastic Weight Averaging (SWA), a recent approach which averages weights along the trajectory of SGD with a modified learning rate schedule. We also propose fast-SWA, which further accelerates convergence by averaging multiple points within each cycle of a cyclical learning rate schedule. With weight averaging, we achieve the best known semi-supervised results on CIFAR-10 and CIFAR-100, over many different quantities of labeled training data. For example, we achieve $5 . 0 \%$ error on CIFAR-10 with only 4000 labels, compared to the previous best result in the literature of $6 . 3 \%$ . + +# 1 INTRODUCTION + +Recent advances in deep unsupervised learning, such as generative adversarial networks (GANs) (Goodfellow et al., 2014), have led to an explosion of interest in semi-supervised learning. Semisupervised methods make use of both unlabeled and labeled training data to improve performance over purely supervised methods. Semi-supervised learning is particularly valuable in applications such as medical imaging, where labeled data may be scarce and expensive (Oliver et al., 2018). + +Currently the best semi-supervised results are obtained by consistency-enforcing approaches (Bachman et al., 2014; Laine and Aila, 2017; Tarvainen and Valpola, 2017; Miyato et al., 2017; Park et al., 2017). These methods use unlabeled data to stabilize their predictions under input or weight perturbations. Consistency-enforcing methods can be used at scale with state-of-the-art architectures. For example, the recent Mean Teacher (Tarvainen and Valpola, 2017) model has been used with the Shake-Shake (Gastaldi, 2017) architecture and has achieved the best semi-supervised performance on the consequential CIFAR benchmarks. + +This paper is about conceptually understanding and improving consistency-based semi-supervised learning methods. Our approach can be used as a guide for exploring how loss geometry interacts with training procedures in general. We provide several novel observations about the training objective and optimization trajectories of the popular ⇧ (Laine and Aila, 2017) and Mean Teacher (Tarvainen and Valpola, 2017) consistency-based models. Inspired by these findings, we propose to improve SGD solutions via stochastic weight averaging (SWA) (Izmailov et al., 2018), a recent method that averages weights of the networks corresponding to different training epochs to obtain a single model with improved generalization. On a thorough empirical study we show that this procedure achieves the best known semi-supervised results on consequential benchmarks. In particular: + +We show in Section 3.1 that a simplified ⇧ model implicitly regularizes the norm of the Jacobian of the network outputs with respect to both its inputs and its weights, which in turn encourages flatter solutions. Both the reduced Jacobian norm and flatness of solutions have been related to generalization in the literature (Sokolic et al. ´ , 2017; Novak et al., 2018; Chaudhari et al., + +2016; Schmidhuber and Hochreiter, 1997; Keskar et al., 2017; Izmailov et al., 2018). Interpolating between the weights corresponding to different epochs of training we demonstrate that the solutions of ⇧ and Mean Teacher models are indeed flatter along these directions (Figure 1b). + +• In Section 3.2, we compare the training trajectories of the ⇧, Mean Teacher, and supervised models and find that the distances between the weights corresponding to different epochs are much larger for the consistency based models. The error curves of consistency models are also wider (Figure 1b), which can be explained by the flatness of the solutions discussed in section 3.1. Further we observe that the predictions of the SGD iterates can differ significantly between different iterations of SGD. + +• We observe that for consistency-based methods, SGD does not converge to a single point but continues to explore many solutions with high distances apart. Inspired by this observation, we propose to average the weights corresponding to SGD iterates, or ensemble the predictions of the models corresponding to these weights. Averaging weights of SGD iterates compensates for larger steps, stabilizes SGD trajectories and obtains a solution that is centered in a flat region of the loss (as a function of weights). Further, we show that the SGD iterates correspond to models with diverse predictions – using weight averaging or ensembling allows us to make use of the improved diversity and obtain a better solution compared to the SGD iterates. In Section 3.3 we demonstrate that both ensembling predictions and averaging weights of the networks corresponding to different training epochs significantly improve generalization performance and find that the improvement is much larger for the $\Pi$ and Mean Teacher models compared to supervised training. We find that averaging weights provides similar or improved accuracy compared to ensembling, while offering the computational benefits and convenience of working with a single model. Thus, we focus on weight averaging for the remainder of the paper. + +• Motivated by our observations in Section 3 we propose to apply Stochastic Weight Averaging (SWA) (Izmailov et al., 2018) to the $\Pi$ and Mean Teacher models. Based on our results in Section 3.3 we propose several modifications to SWA in Section 4. In particular, we propose fast-SWA, which (1) uses a learning rate schedule with longer cycles to increase the distance between the weights that are averaged and the diversity of the corresponding predictions; and (2) averages weights of multiple networks within each cycle (while SWA only averages weights corresponding to the lowest values of the learning rate within each cycle). In Section 5, we show that fast-SWA converges to a good solution much faster than SWA. + +• Applying weight averaging to the $\Pi$ and Mean Teacher models we improve the best reported results on CIFAR-10 for $1 k$ , $2 k$ , $4 k$ and $1 0 k$ labeled examples, as well as on CIFAR-100 with $1 0 k$ labeled examples. For example, we obtain $5 . 0 \%$ error on CIFAR-10 with only $4 k$ labels, improving the best result reported in the literature (Tarvainen and Valpola, 2017) by $1 . 3 \%$ . We also apply weight averaging to a state-of-the-art domain adaptation technique (French et al., 2018) closely related to the Mean Teacher model and improve the best reported results on domain adaptation from CIFAR-10 to STL from $1 9 . 9 \%$ to $1 6 . { \bar { 8 } } \%$ error. + +• We release our code at https://github.com/benathi/fastswa-semi-sup + +# 2 BACKGROUND + +# 2.1 CONSISTENCY BASED MODELS + +We briefly review semi-supervised learning with consistency-based models. This class of models encourages predictions to stay similar under small perturbations of inputs or network parameters. For instance, two different translations of the same image should result in similar predicted probabilities. The consistency of a model (student) can be measured against its own predictions (e.g. ⇧ model) or predictions of a different teacher network (e.g. Mean Teacher model). In both cases we will say a student network measures consistency against a teacher network. + +Consistency Loss In the semi-supervised setting, we have access to labeled data $\begin{array} { r l } { \mathcal { D } _ { L } } & { { } = } \end{array}$ $\{ ( x _ { i } ^ { L } , y _ { i } ^ { L } ) \} _ { i = 1 } ^ { \tilde { N } _ { L } }$ , and unlabeled data $\mathcal { D } _ { U } = \{ x _ { i } ^ { U } \} _ { i = 1 } ^ { N _ { U } }$ . + +Given two perturbed inputs $x ^ { \prime } , x ^ { \prime \prime }$ of $x$ and the perturbed weights $\boldsymbol { w } _ { f } ^ { \prime }$ and $\boldsymbol { w _ { g } ^ { \prime } }$ , the consistency loss penalizes the difference between the student’s predicted probablities $f ( x ^ { \prime } ; w _ { f } ^ { \prime } )$ and the teacher’s $g ( x ^ { \prime \prime } ; w _ { g } ^ { \prime } )$ . This loss is typically the Mean Squared Error or $\mathrm { K L }$ divergence: + +$$ +\ell _ { \mathrm { c o n s } } ^ { \mathrm { M S E } } ( w _ { f } , x ) = \| f ( x ^ { \prime } ; w _ { f } ^ { \prime } ) - g ( x ^ { \prime \prime } , w _ { g } ^ { \prime } ) \| ^ { 2 } \mathrm { o r } \ell _ { \mathrm { c o n s } } ^ { \mathrm { K L } } ( w _ { f } , x ) = \mathrm { K L } ( f ( x ^ { \prime } ; w _ { f } ^ { \prime } ) | | g ( x ^ { \prime \prime } , w _ { g } ^ { \prime } ) ) . +$$ + +The total loss used to train the model can be written as + +$$ +L ( w _ { f } ) = \underbrace { \sum _ { ( x , y ) \in \mathcal { D } _ { L } } \ell _ { \mathrm { C E } } ( w _ { f } , x , y ) } _ { L _ { \mathrm { C E } } } + \lambda \underbrace { \sum _ { x \in \mathcal { D } _ { L } \cup \mathcal { D } _ { U } } \ell _ { \mathrm { c o n s } } ( w _ { f } , x ) } _ { L _ { \mathrm { c o n s } } } , +$$ + +where for classification $L _ { \mathrm { C E } }$ is the cross entropy between the model predictions and supervised training labels. The parameter $\lambda > 0$ controls the relative importance of the consistency term in the overall loss. + +⇧ Model The $\Pi$ model, introduced in Laine and Aila (2017) and Sajjadi et al. (2016), uses the student model $f$ as its own teacher. The data (input) perturbations include random translations, crops, flips and additive Gaussian noise. Binary dropout (Srivastava et al., 2014) is used for weight perturbation. + +Mean Teacher Model The Mean Teacher model (MT) proposed in Tarvainen and Valpola (2017) uses the same data and weight perturbations as the $\Pi$ model; however, the teacher weights $w ^ { g }$ are the exponential moving average (EMA) of the student weights $w ^ { f }$ : $w _ { g } ^ { k } = \alpha \cdot w _ { g . } ^ { k - 1 } + ( \breve { 1 } - \alpha ) \cdot w _ { f } ^ { k }$ . The decay rate $\alpha$ is usually set between 0.9 and 0.999. The Mean Teacher model has the best known results on the CIFAR-10 semi-supervised learning benchmark (Tarvainen and Valpola, 2017). + +Other Consistency-Based Models Temporal Ensembling (TE) (Laine and Aila, 2017) uses an exponential moving average of the student outputs as the teacher outputs in the consistency term for training. Another approach, Virtual Adversarial Training (VAT) (Miyato et al., 2017), enforces the consistency between predictions on the original data inputs and the data perturbed in an adversarial direction $x ^ { \prime } = x + \epsilon r _ { \mathrm { a d v } }$ , where $\begin{array} { r } { r _ { \mathrm { a d v } } = \arg \operatorname* { m a x } _ { r : \| r \| = 1 } \mathbf { K L } [ f ( x , w ) \| f ( x + \xi r , w ) ] } \end{array}$ . + +# 3 UNDERSTANDING CONSISTENCY-ENFORCING MODELS + +In Section 3.1, we study a simplified version of the $\Pi$ model theoretically and show that it penalizes the norm of the Jacobian of the outputs with respect to inputs, as well as the eigenvalues of the Hessian, both of which have been related to generalization (Sokolic et al. ´ , 2017; Novak et al., 2018; Dinh et al., 2017a; Chaudhari et al., 2016). In Section 3.2 we empirically study the training trajectories of the ⇧ and MT models and compare them to the training trajectories in supervised learning. We show that even late in training consistency-based methods make large training steps, leading to significant changes in predictions on test. In Section 3.3 we show that averaging weights or ensembling predictions of the models proposed by SGD at different training epochs can lead to substantial gains in accuracy and that these gains are much larger for $\Pi$ and MT than for supervised training. + +# 3.1 SIMPLIFIED ⇧ MODEL PENALIZES LOCAL SHARPNESS + +Penalization of the input-output Jacobian norm. Consider a simple version of the $\Pi$ model, where we only apply small additive perturbations to the student inputs: $x ^ { \prime } = x + \epsilon z$ , $z \sim \mathcal { N } ( 0 , I )$ with $\epsilon \ll 1$ , and the teacher input is unchanged: $x ^ { \prime \prime } = x$ .1 Then the consistency loss $\ell _ { c o n s }$ (Eq. 1) becomes $\ell _ { c o n s } ( w , x , \epsilon ) = \| f ( w , x + \epsilon z ) - f ( w , x ) \| ^ { 2 }$ . Consider the estimator $\hat { Q } \ =$ $\begin{array} { r l } { } & { { } \operatorname* { l i m } _ { \epsilon \to 0 } \frac { 1 } { \epsilon ^ { 2 } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \ell _ { c o n s } ( w , x _ { i } , \epsilon ) } \end{array}$ . We show in Section A.5 that + +$$ +\mathbb { E } [ \hat { Q } ] = \mathbb { E } _ { x } [ \| J _ { x } \| _ { F } ^ { 2 } ] \quad \mathrm { a n d } \quad \mathrm { V a r } [ \hat { Q } ] = \frac { 1 } { m } \bigg ( \mathrm { V a r } [ \| J _ { x } \| _ { F } ^ { 2 } ] + 2 \mathbb { E } [ \| J _ { x } ^ { T } J _ { x } \| _ { F } ^ { 2 } ] \bigg ) , +$$ + +where $J _ { x }$ is the Jacobian of the network’s outputs with respect to its inputs evaluated at $x$ , $\| \cdot \| _ { F }$ represents Frobenius norm, and the expectation $\mathbb { E } _ { x }$ is taken over the distribution of labeled and unlabeled data. That is, $\hat { Q }$ is an unbiased estimator of $\mathbb { E } _ { x } [ \| J _ { x } \| _ { F } ^ { 2 } ]$ with variance controlled by the minibatch size $m$ . Therefore, the consistency loss implicitly penalizes $\mathbb { E } _ { x } [ \| J _ { x } \| _ { F } ^ { 2 } ]$ . + +The quantity $| | J _ { x } | | _ { F }$ has been related to generalization both theoretically (Sokolic et al. ´ , 2017) and empirically (Novak et al., 2018). For linear models $f ( x ) = W x$ , penalizing $| | J _ { x } | | _ { F }$ exactly corresponds to weight decay, also known as $L _ { 2 }$ regularization, since for linear models $J _ { x } = W$ , and $\| W \| _ { F } ^ { 2 } = \| \mathbf { v e c } ( W ) \| _ { 2 } ^ { 2 }$ . Penalizing $\mathbb { E } _ { x } [ \| J _ { x } \| _ { F } ^ { 2 } ]$ is also closely related to the graph based (manifold) regularization in Zhu et al. (2003) which uses the graph Laplacian to approximate $\mathbb { E } _ { x } [ \lVert \nabla _ { \mathcal { M } } f \rVert ^ { 2 } ]$ for nonlinear models, making use of the manifold structure of unlabeled data. + +Isotropic perturbations investigated in this simplified $\Pi$ model will not in general lie along the data manifold, and it would be more pertinent to enforce consistency to perturbations sampled from the space of natural images. In fact, we can interpret consistency with respect to standard data augmentations (which are used in practice) as penalizing the manifold Jacobian norm in the same manner as above. See Section A.5 for more details. + +Penalization of the Hessian’s eigenvalues. Now, instead of the input perturbation, consider the weight perturbation $w ^ { \prime } = w + \epsilon z$ . Similarly, the consistency loss is an unbiased estimator for $\mathbb { E } _ { x } [ \bar { | | } J _ { w } \bar { | | } _ { F } ^ { 2 } ]$ , where $J _ { w }$ is the Jacobian of the network outputs with respect to the weights $w$ . In Section A.6 we show that for the MSE loss, the expected trace of the Hessian of the loss $\mathbb { E } _ { x } [ \mathrm { t r } ( H ) ]$ can be decomposed into two terms, one of which is $\mathbb { E } _ { x } [ \| J _ { w } \| _ { F } ^ { 2 } ]$ . As minimizing the consistency loss of a simplified $\Pi$ model penalizes $\mathbb { E } _ { x } [ \lVert J _ { w } \rVert _ { F } ^ { 2 } ]$ , it also penalizes $\mathbb { E } _ { x } [ \mathrm { t r } ( H ) ]$ . As pointed out in Dinh et al. (2017a) and Chaudhari et al. (2016), the eigenvalues of $H$ encode the local information about sharpness of the loss for a given solution $w$ . Consequently, the quantity $\operatorname { t r } ( H )$ which is the sum of the Hessian eigenvalues is related to the notion of sharp and flat optima, which has recently gained attention as a proxy for generalization performance (see e.g. Schmidhuber and Hochreiter, 1997; Keskar et al., 2017; Izmailov et al., 2018). Thus, based on our analysis, the consistency loss in the simplified ⇧ model encourages flatter solutions. + +# 3.2 ANALYSIS OF SOLUTIONS ALONG SGD TRAJECTORIES + +In the previous section we have seen that in a simplified ⇧ model, the consistency loss encourages lower input-output Jacobian norm and Hessian’s eigenvalues, which are related to better generalization. In this section we analyze the properties of minimizing the consistency loss in a practical setting. Specifically, we explore the trajectories followed by SGD for the consistency-based models and compare them to the trajectories in supervised training. + +![](images/29efbaf1fbeefa11b529107b49212f2ff0277644d188104e61c19e56584ee44c.jpg) +Figure 1: (a): The evolution of the gradient norm for the consistency regularization term (Cons) and the cross-entropy term (CE) in the ⇧, MT, and standard supervised (CE only) models during training. $\mathbf { ( b ) }$ : Train and test errors along rays connecting two SGD solutions for each respective model. (c) and (d): Comparison of errors along rays connecting two SGD solutions, random rays, and adversarial rays for the $\Pi$ and supervised models. See Section A.1 for the analogous Mean Teacher model’s plot. + +We train our models on CIFAR-10 using $4 k$ labeled data for 180 epochs. The ⇧ and Mean Teacher models use $4 6 k$ data points as unlabeled data (see Sections A.8 and A.9 for details). First, in Figure 1a we visualize the evolution of norms of the gradients of the cross-entropy term $\Vert \nabla L _ { \mathrm { C E } } \Vert$ and consistency term $\| \nabla L _ { \mathrm { c o n s } } \|$ along the trajectories of the $\Pi$ , MT, and standard supervised models (using CE loss only). We observe that $\| \nabla L _ { \mathrm { C o n s } } \|$ remains high until the end of training and dominates the gradient $\Vert \nabla L _ { \mathrm { C E } } \Vert$ of the cross-entropy term for the $\Pi$ and MT models. Further, for both the $\Pi$ and MT models, $\left. \nabla L _ { \mathrm { C o n s } } \right.$ is much larger than in supervised training implying that the $\Pi$ and MT models are making substantially larger steps until the end of training. These larger steps suggest that rather than converging to a single minimizer, SGD continues to actively explore a large set of solutions when applied to consistency-based methods. + +For further understand this observation, we analyze the behavior of train and test errors in the region of weight space around the solutions of the $\Pi$ and Mean Teacher models. First, we consider the onedimensional rays $\phi ( t ) = t \cdot w _ { 1 8 0 } + ( 1 - t ) w _ { 1 7 0 }$ , $t \geq 0$ , connecting the weight vectors $w _ { 1 7 0 }$ and $w _ { 1 8 0 }$ corresponding to epochs 170 and 180 of training. We visualize the train and test errors (measured on the labeled data) as functions of the distance from the weights $w _ { 1 7 0 }$ in Figure 1b. We observe that the distance between the weight vectors $w _ { 1 7 0 }$ and $w _ { 1 8 0 }$ is much larger for the semi-supervised methods compared to supervised training, which is consistent with our observation that the gradient norms are larger which implies larger steps during optimization in the $\Pi$ and MT models. Further, we observe that the train and test error surfaces are much wider along the directions connecting $w _ { 1 7 0 }$ and $w _ { 1 8 0 }$ for the consistency-based methods compared to supervised training. One possible explanation for the increased width is the effect of the consistency loss on the Jacobian of the network and the eigenvalues of the Hessian of the loss discussed in Section 3.1. We also observe that the test errors of interpolated weights can be lower than errors of the two SGD solutions between which we interpolate. This error reduction is larger in the consistency models (Figure 1b). + +We also analyze the error surfaces along random and adversarial rays starting at the SGD solution $w _ { 1 8 0 }$ for each model. For the random rays we sample 5 random vectors $d$ from the unit sphere and calculate the average train and test errors of the network with weights $w _ { t _ { 1 } } + s d$ for $s \in [ 0 , 3 0 ]$ . With adversarial rays we evaluate the error along the directions of the fastest ascent of test or train loss $\begin{array} { r } { d _ { a d v } = \frac { \nabla L _ { C E } } { | | \nabla L _ { C E } | | } } \end{array}$ . We observe that while the solutions of the $\Pi$ and MT models are much wider than supervised training solutions along the SGD-SGD directions (Figure 1b), their widths along random and adversarial rays are comparable (Figure 1c, 1d) + +We analyze the error along SGD-SGD rays for two reasons. Firstly, in fast-SWA we are averaging solutions traversed by SGD, so the rays connecting SGD iterates serve as a proxy for the space we average over. Secondly, we are interested in evaluating the width of the solutions that we explore during training which we expect will be improved by the consistency training, as discussed in Section 3.1 and A.6. We expect width along random rays to be less meaningful because there are many directions in the parameter space that do not change the network outputs (Dinh et al., 2017b; GurAri et al., 2018; Sagun et al., 2017). However, by evaluating SGD-SGD rays, we can expect that these directions corresponds to meaningful changes to our model because individual SGD updates correspond to directions that change the predictions on the training set. Furthermore, we observe that different SGD iterates produce significantly different predictions on the test data. + +Neural networks in general are known to be resilient to noise, explaining why both MT, ⇧ and supervised models are flat along random directions (Arora et al., 2018). At the same time neural networks are susceptible to targeted perturbations (such as adversarial attacks). We hypothesize that we do not observe improved flatness for semi-supervised methods along adversarial rays because we do not choose our input or weight perturbations adversarially, but rather they are sampled from a predefined set of transformations. + +Additionally, we analyze whether the larger optimization steps for the $\Pi$ and MT models translate into higher diversity in predictions. We define diversity of a pair of models $w _ { 1 } , w _ { 2 }$ as Diversity $( w _ { 1 } , w _ { 2 } ) =$ $\begin{array} { r } { \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \mathbb { 1 } [ y _ { i } ^ { ( w _ { 1 } ) } \neq y _ { i } ^ { ( w _ { 2 } ) } ] } \end{array}$ , the fraction of test samples where the predicted labels between the two models differ. We found that for the $\Pi$ and MT models, the Diversity $( w _ { 1 7 0 } , w _ { 1 8 0 } )$ is $7 . 1 \%$ and $6 . 1 \%$ of the test data points respectively, which is much higher than $3 . 9 \%$ in supervised learning. The increased diversity in the predictions of the networks traversed by SGD supports our conjecture that for the $\Pi$ and MT models SGD struggles to converge to a single solution and continues to actively explore the set of plausible solutions until the end of training. + +# 3.3 ENSEMBLING AND WEIGHT AVERAGING + +In Section 3.2, we observed that the $\Pi$ and MT models continue taking large steps in the weight space at the end of training. Not only are the distances between weights larger, we observe these models to have higher diversity. In this setting, using the last SGD iterate to perform prediction is not ideal since many solutions explored by SGD are equally accurate but produce different predictions. + +Ensembling. In Section 3.2 we showed that the diversity in predictions is significantly larger for the $\Pi$ and Mean Teacher models compared to purely supervised learning. The diversity of these iterates suggests that we can achieve greater benefits from ensembling. We use the same CNN architecture and hyper-parameters as in Section 3.2 but extend the training time by doing 5 learning rate cycles of 30 epochs after the normal training ends at epoch 180 (see A.8 and A.9 for details). We sample random pairs of weights $w _ { 1 }$ , $w _ { 2 }$ from epochs 180, $^ { 1 8 3 , \dots , 3 3 0 }$ and measure the error reduction from ensembling these pairs of models, $\begin{array} { r } { C _ { \mathrm { e n s } } \equiv \frac { 1 } { 2 } \mathrm { E r r } ( w _ { 1 } ) + \frac { 1 } { 2 } \mathrm { E r r } ( w _ { 2 } ) - \mathrm { E r r } \left( \mathrm { E n s e m b l e } ( w _ { 1 } , w _ { 2 } ) \right) } \end{array}$ . In Figure 2c we visualize $C _ { \mathrm { e n s } }$ , against the diversity of the corresponding pair of models. We observe a strong correlation between the diversity in predictions of the constituent models and ensemble performance, and therefore $C _ { \mathrm { e n s } }$ is substantially larger for $\Pi$ and Mean Teacher models. As shown in Izmailov et al. (2018), ensembling can be well approximated by weight averaging if the weights are close by. + +Weight Averaging. First, we experiment on averaging random pairs of weights at the end of training and analyze the performance with respect to the weight distances. Using the the same pairs from above, we evaluate the performance of the model formed by averaging the pairs of weights, $\begin{array} { r } { C _ { a v g } ( w _ { 1 } , w _ { 2 } ) \equiv \frac { 1 } { 2 } \mathrm { E r r } ( w _ { 1 } ) + \frac { \hat { 1 } } { 2 } \mathrm { E r r } ( w _ { 2 } ) - \mathrm { E r r } \left( \frac { 1 } { 2 } w _ { 1 } + \frac { 1 } { 2 } w _ { 2 } \right) } \end{array}$ . Note that $C _ { a v g }$ is a proxy for convexity: if $C _ { a v g } ( w _ { 1 } , w _ { 2 } ) \geq 0$ for any pair of points $w _ { 1 }$ , $w _ { 2 }$ , then by Jensen’s inequality the error function is convex (see the left panel of Figure 2). While the error surfaces for neural networks are known to be highly non-convex, they may be approximately convex in the region traversed by SGD late into training (Goodfellow et al., 2015). In fact, in Figure 2b, we find that the error surface of the SGD trajectory is approximately convex due to $C _ { a v g } ( w _ { 1 } , w _ { 2 } )$ being mostly positive. Here we also observe that the distances between pairs of weights are much larger for the $\Pi$ and MT models than for the supervised training; and as a result, weight averaging achieves a larger gain for these models. + +In Section 3.2 we observed that for the $\Pi$ and Mean Teacher models SGD traverses a large flat region of the weight space late in training. Being very high-dimensional, this set has most of its volume concentrated near its boundary. Thus, we find SGD iterates at the periphery of this flat region (see Figure 2d). We can also explain this behavior via the argument of (Mandt et al., 2017). Under certain assumptions SGD iterates can be thought of as samples from a Gaussian distribution centered at the minimum of the loss, and samples from high-dimensional Gaussians are known to be concentrated on the surface of an ellipse and never be close to the mean. Averaging the SGD iterates (shown in red in Figure 2d) we can move towards the center (shown in blue) of the flat region, stabilizing the SGD trajectory and improving the width of the resulting solution, and consequently improving generalization. + +![](images/dfaa3df25410cdf64c013c726668759e2120f0be634d150a5324881264838c2d.jpg) +Figure 2: (a): Illustration of a convex and non-convex function and Jensen’s inequality. (b): Scatter plot of the decrease in error $C _ { \mathrm { a v g } }$ for weight averaging versus distance. (c): Scatter plot of the decrease in error $C _ { \mathrm { e n s } }$ for prediction ensembling versus diversity. (d): Train error surface (orange) and Test error surface (blue). The SGD solutions (red dots) around a locally flat minimum are far apart due to the flatness of the train surface (see Figure 1b) which leads to large error reduction of the SWA solution (blue dot). + +We observe that the improvement $C _ { \mathrm { a v g } }$ from weight averaging $( 1 . 2 \pm 0 . 2 \%$ over MT and $\Pi$ pairs) is on par or larger than the benefit $C _ { \mathrm { e n s } }$ of prediction ensembling $( 0 . 9 \pm 0 . 2 \% )$ The smaller gain from ensembling might be due to the dependency of the ensembled solutions, since they are from the same SGD run as opposed to independent restarts as in typical ensembling settings. For the rest of the paper, we focus attention on weight averaging because of its lower costs at test time and slightly higher performance compared to ensembling. + +![](images/51e63d83e7f246d913c18de2b9a2986e98ef9bd679b844a5db73d778d97c87ef.jpg) +Figure 3: Left: Cyclical cosine learning rate schedule and SWA and fast-SWA averaging strategies. Middle: Illustration of the solutions explored by the cyclical cosine annealing schedule on an error surface. Right: Illustration of SWA and fast-SWA averaging strategies. fast-SWA averages more points but the errors of the averaged points, as indicated by the heat color, are higher. + +# 4 SWA AND FAST-SWA + +In Section 3 we analyzed the training trajectories of the ⇧, MT, and supervised models. We observed that the $\Pi$ and MT models continue to actively explore the set of plausible solutions, producing diverse predictions on the test set even in the late stages of training. Further, in section 3.3 we have seen that averaging weights leads to significant gains in performance for the ⇧ and MT models. In particular these gains are much larger than in supervised setting. + +Stochastic Weight Averaging (SWA) (Izmailov et al., 2018) is a recent approach that is based on averaging weights traversed by SGD with a modified learning rate schedule. In Section 3 we analyzed averaging pairs of weights corresponding to different epochs of training and showed that it improves the test accuracy. Averaging multiple weights reinforces this effect, and SWA was shown to significantly improve generalization performance in supervised learning. Based on our results in section 3.3, we can expect even larger improvements in generalization when applying SWA to the ⇧ and MT models. + +SWA typically starts from a pre-trained model, and then averages points in weight space traversed by SGD with a constant or cyclical learning rate. We illustrate the cyclical cosine learning rate schedule in Figure 3 (left) and the SGD solutions explored in Figure 3 (middle). For the first $\ell \leq \ell _ { 0 }$ epochs the network is pre-trained using the cosine annealing schedule where the learning rate at epoch $i$ is set equal to $\eta ( \bar { i } ) = 0 . 5 \cdot \eta _ { 0 } ( 1 + \cos { ( \pi \cdot i / \ell _ { 0 } ) } )$ . After $\ell$ epochs, we use a cyclical schedule, repeating the learning rates from epochs $[ \ell - c , \ell ]$ , where $c$ is the cycle length. SWA collects the networks corresponding to the minimum values of the learning rate (shown in green in Figure 3, left) and averages their weights. The model with the averaged weights $w _ { \mathrm { S W A } }$ is then used to make predictions. We propose to apply SWA to the student network both for the $\Pi$ and Mean Teacher models. Note that the SWA weights do not interfere with training. + +Originally, Izmailov et al. (2018) proposed using cyclical learning rates with small cycle length for SWA. However, as we have seen in Section 3.3 (Figure 2, left) the benefits of averaging are the most prominent when the distance between the averaged points is large. Motivated by this observation, we instead use longer learning rate cycles $c$ . Moreover, SWA updates the average weights only once per cycle, which means that many additional training epochs are needed in order to collect enough weights for averaging. To overcome this limitation, we propose fast-SWA, a modification of SWA that averages networks corresponding to every $k < c$ epochs starting from epoch $\ell - c$ . We can also average multiple weights within a single epoch setting $k < 1$ . + +Notice that most of the models included in the fast-SWA average (shown in red in Figure 3, left) have higher errors than those included in the SWA average (shown in green in Figure 3, right) since they are obtained when the learning rate is high. It is our contention that including more models in the fast-SWA weight average can more than compensate for the larger errors of the individual models. + +Indeed, our experiments in Section 5 show that fast-SWA converges substantially faster than SWA and has lower performance variance. We analyze this result theoretically in Section A.7). + +# 5 EXPERIMENTS + +We evaluate the $\Pi$ and MT models (Section 4) on CIFAR-10 and CIFAR-100 with varying numbers of labeled examples. We show that fast-SWA and SWA improve the performance of the ⇧ and MT models, as we expect from our observations in Section 3. In fact, in many cases fast-SWA improves on the best results reported in the semi-supervised literature. We also demonstrate that the preposed fast-SWA obtains high performance much faster than SWA. We also evaluate SWA applied to a consistency-based domain adaptation model (French et al., 2018), closely related to the MT model, for adapting CIFAR-10 to STL. We improve the best reported test error rate for this task from $1 9 . 9 \%$ to $1 6 . 8 \%$ . + +We discuss the experimental setup in Section 5.1. We provide the results for CIFAR-10 and CIFAR100 datasets in Section 5.2 and 5.3. We summarize our results in comparison to the best previous results in Section 5.4. We show several additional results and detailed comparisons in Appendix A.2. We provide analysis of train and test error surfaces of fast-SWA solutions along the directions connecting fast-SWA and SGD in Section A.1. + +# 5.1 SETUP + +We evaluate the weight averaging methods SWA and fast-SWA on different network architectures and learning rate schedules. We are able to improve on the base models in all settings. In particular, we consider a 13-layer CNN and a 12-block (26-layer) Residual Network (He et al., 2015) with ShakeShake regularization (Gastaldi, 2017), which we refer to simply as CNN and Shake-Shake respectively (see Section A.8 for details on the architectures). For training all methods we use the stochastic gradient descent (SGD) optimizer with the cosine annealing learning rate described in Section 4. We use two learning rate schedules, the short schedule with $\ell = 1 8 0 , \ell _ { 0 } = 2 1 0 , c = 3 0$ , similar to the experiments in Tarvainen and Valpola (2017), and the long schedule with $\ell = 1 5 0 0 , \ell _ { 0 } = 1 8 0 0 , c =$ 200, similar to the experiments in Gastaldi (2017). We note that the long schedule improves the performance of the base models compared to the short schedule; however, SWA can still further improve the results. See Section A.9 of the Appendix for more details on other hyperparameters. We repeat each CNN experiment 3 times with different random seeds to estimate the standard deviations for the results in the Appendix. + +# 5.2 CIFAR-10 + +![](images/eb5408083dd88ccc9674053056855bb7c16df371ae47a83be9d487f6be8a39a3.jpg) +Figure 4: Prediction errors of $\Pi$ and MT models with and without fast-SWA. (a) CIFAR-10 with CNN (b) CIFAR-100 with CNN. $5 0 k +$ and $5 0 k + \ast$ correspond to $5 0 k { + } 5 0 0 k$ and $5 0 k { + } 2 3 7 k ^ { * }$ settings (c) CIFAR-10 with ResNet $^ +$ Shake-Shake using the short schedule (d) CIFAR-10 with ResNet $^ +$ Shake-Shake using the long schedule. + +We evaluate the proposed fast-SWA method using the $\Pi$ and MT models on the CIFAR-10 dataset (Krizhevsky). We use $5 0 k$ images for training with $1 k$ , $2 k$ , $4 k$ , $1 0 k$ and $5 0 k$ labels and report the top-1 errors on the test set $1 0 k$ images). We visualize the results for the CNN and Shake-Shake architectures in Figures 4a, 4c, and 4d. For all quantities of labeled data, fast-SWA substantially improves test accuracy in both architectures. Additionally, in Tables 2, 4 of the Appendix we provide a thorough comparison of different averaging strategies as well as results for VAT (Miyato et al., 2017), TE (Laine and Aila, 2016), and other baselines. + +Note that we applied fast-SWA for VAT as well which is another popular approach for semi-supervised learning. We found that the improvement on VAT is not drastic – our base implementation obtains $1 1 . 2 6 \%$ error where fast-SWA reduces it to $1 0 . 9 7 \%$ (see Table 2 in Section A.2). It is possible that the solutions explored by VAT are not as diverse as in $\Pi$ and MT models due to VAT loss function. Throughout the experiments, we focus on the $\Pi$ and MT models as they have been shown to scale to powerful networks such as Shake-Shake and obtained previous state-of-the-art performance. + +In Figure 5 (left), we visualize the test error as a function of iteration using the CNN. We observe that when the cyclical learning rate starts after epoch $\ell = 1 8 0$ , the base models drop in performance due to the sudden increase in learning rate (see Figure 3 left). However, fast-SWA continues to improve while collecting the weights corresponding to high learning rates for averaging. In general, we also find that the cyclical learning rate improves the base models beyond the usual cosine annealing schedule and increases the performance of fast-SWA as training progresses. Compared to SWA, we also observe that fast-SWA converges substantially faster, for instance, reducing the error to $1 0 . 5 \%$ at epoch 200 while SWA attains similar error at epoch 350 for CIFAR- $1 0 4 k$ labels (Figure 5 left). We provide additional plots in Section A.2 showing the convergence of the ⇧ and MT models in all label settings, where we observe similar trends that fast-SWA results in faster error reduction. + +We also find that the performance gains of fast-SWA over base models are higher for the ⇧ model compared to the MT model, which is consistent with the convexity observation in Section 3.3 and Figure 2. In the previous evaluations (see e.g. Oliver et al., 2018; Tarvainen and Valpola, 2017), the ⇧ model was shown to be inferior to the MT model. However, with weight averaging, fast-SWA reduces the gap between ⇧ and MT performance. Surprisingly, we find that the $\Pi$ model can outperform MT after applying fast-SWA with moderate to large numbers of labeled points. In particular, the ⇧+fast-SWA model outperforms MT+fast-SWA on CIFAR-10 with $4 k$ , $1 0 k$ , and $5 0 k$ labeled data points for the Shake-Shake architecture. + +![](images/c08cec894ffe7ef71ac77e04adc5b480c337f113ce5e7c425c3ca73b3f8996f6.jpg) +Figure 5: Prediction errors of base models and their weight averages (fast-SWA and SWA) for CNN on (left) CIFAR-10 with $4 k$ labels, (middle) CIFAR-100 with $1 0 k$ labels, and (right) CIFAR-100 $5 0 k$ labels and extra $5 0 0 k$ unlabeled data from Tiny Images (Torralba et al., 2008). + +5.3 CIFAR-100 AND EXTRA UNLABELED DATA + +We evaluate the $\Pi$ and MT models with fast-SWA on CIFAR-100. We train our models using 50000 images with $1 0 k$ and $5 0 k$ labels using the 13-layer CNN. We also analyze the effect of using the Tiny Images dataset (Torralba et al., 2008) as an additional source of unlabeled data. + +The Tiny Images dataset consists of 80 million images, mostly unlabeled, and contains CIFAR-100 as a subset. Following Laine and Aila (2016), we use two settings of unlabeled data, $5 0 k { + } 5 0 0 k$ and $5 0 k { + } 2 3 7 k ^ { * }$ where the $5 0 k$ images corresponds to CIFAR-100 images from the training set and the $+ 5 0 0 k$ or $+ 2 3 7 k ^ { * }$ images corresponds to additional $5 0 0 k$ or $2 3 7 k$ images from the Tiny Images dataset. For the $2 3 7 k ^ { * }$ setting, we select only the images that belong to the classes in CIFAR-100, corresponding to 237203 images. For the $5 0 0 k$ setting, we use a random set of $5 0 0 k$ images whose classes can be different from CIFAR-100. We visualize the results in Figure 4b, where we again observe that fast-SWA substantially improves performance for every configuration of the number of labeled and unlabeled data. In Figure 5 (middle, right) we show the errors of MT, SWA and fast-SWA as a function of iteration on CIFAR-100 for the $1 0 k$ and $5 0 k { + } 5 0 0 k$ label settings. Similar to the CIFAR-10 experiments, we observe that fast-SWA reduces the errors substantially faster than SWA. + +We provide detailed experimental results in Table 3 of the Appendix and include preliminary results using the Shake-Shake architecture in Table 5, Section A.2. + +# 5.4 ADVANCING STATE-OF-THE-ART + +We have shown that fast-SWA can significantly improve the performance of both the $\Pi$ and MT models. We provide a summary comparing our results with the previous best results in the literature in Table 1, using the 13-layer CNN and the Shake-Shake architecture that had been applied previously. We also provide detailed results the Appendix A.2. + +Table 1: Test errors against current state-of-the-art semi-supervised results. The previous best numbers are obtained from (Tarvainen and Valpola, 2017) 1, (Park et al., $2 0 1 7 ) ^ { 2 }$ , (Laine and Aila, $2 0 1 6 ) ^ { 3 }$ and (Luo et al., $2 0 1 8 ) ^ { 4 }$ . CNN denotes performance on the benchmark 13-layer CNN (see A.8). Rows marked † use the Shake-Shake architecture. The result marked ‡ are from $\Pi +$ fast-SWA, where the rest are based on $\mathbf { M T } +$ fast-SWA. The settings $5 0 k { + } 5 0 0 k$ and $5 0 k { + } 2 3 7 k ^ { * }$ use additional $5 0 0 k$ and $2 3 7 k$ unlabeled data from the Tiny Images dataset (Torralba et al., 2008) where ⇤ denotes that we use only the images that correspond to CIFAR-100 classes. + +
Dataset No. of ImagesCIFAR-10CIFAR-100
50k 1k50k 2k50k 4k50k 10k50k+500k 50k50k+237k* 50k
No. of Labels Previous Best CNN Ours CNN18.41413.6449.2238.65323.62323.793
Previous Best† Ourst15.5811.029.0533.6221.0420.98
6.65.76.281 5.028.019.317.7
+ +# 5.5 PRELIMINARY RESULTS ON DOMAIN ADAPTATION + +Domain adaptation problems involve learning using a source domain $X _ { s }$ equipped with labels $Y _ { s }$ and performing classification on the target domain $X _ { t }$ while having no access to the target labels at training time. A recent model by French et al. (2018) applies the consistency enforcing principle for domain adaptation and achieves state-of-the-art results on many datasets. Applying fast-SWA to this model on domain adaptation from CIFAR-10 to STL we were able to improve the best results reported in the literature from $1 9 . 9 \%$ to $1 6 . 8 \%$ . See Section A.10 for more details on the domain adaptation experiments. + +# 6 DISCUSSION + +Semi-supervised learning is crucial for reducing the dependency of deep learning on large labeled datasets. Recently, there have been great advances in semi-supervised learning, with consistency regularization models achieving the best known results. By analyzing solutions along the training trajectories for two of the most successful models in this class, the $\Pi$ and Mean Teacher models, we have seen that rather than converging to a single solution SGD continues to explore a diverse set of plausible solutions late into training. As a result, we can expect that averaging predictions or weights will lead to much larger gains in performance than for supervised training. Indeed, applying a variant of the recently proposed stochastic weight averaging (SWA) we advance the best known semi-supervised results on classification benchmarks. + +While not the focus of our paper, we have also shown that weight averaging has great promise in domain adaptation (French et al., 2018). We believe that application-specific analysis of the geometric properties of the training objective and optimization trajectories will further improve results over a wide range of application specific areas, including reinforcement learning with sparse rewards, generative adversarial networks (Yazıcı et al., 2018), or semi-supervised natural language processing. + +REFERENCES +S. Arora, R. Ge, B. Neyshabur, and Y. Zhang. Stronger generalization bounds for deep nets via a compression approach. In ICML, 2018. +H. Avron and S. Toledo. Randomized algorithms for estimating the trace of an implicit symmetric positive semi-definite matrix. Journal of the ACM, 58(2):1–34, Apr. 2011. ISSN 00045411. doi: 10.1145/1944345.1944349. +P. Bachman, O. Alsharif, and D. Precup. Learning with pseudo-ensembles. In Advances in Neural Information Processing Systems, pages 3365–3373, 2014. +P. Chaudhari, A. Choromanska, S. Soatto, Y. LeCun, C. Baldassi, C. Borgs, J. Chayes, L. Sagun, and R. Zecchina. Entropy-SGD: Biasing Gradient Descent Into Wide Valleys. arXiv:1611.01838 [cs, stat], Nov. 2016. arXiv: 1611.01838. +L. Dinh, R. Pascanu, S. Bengio, and Y. Bengio. Sharp Minima Can Generalize For Deep Nets. arXiv:1703.04933 [cs], Mar. 2017a. +L. Dinh, R. Pascanu, S. Bengio, and Y. Bengio. Sharp minima can generalize for deep nets. In ICML, 2017b. +G. French, M. Mackiewicz, and M. Fisher. Self-ensembling for visual domain adaptation. In International Conference on Learning Representations, 2018. +X. Gastaldi. Shake-shake regularization. CoRR, abs/1705.07485, 2017. +I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014. +I. Goodfellow, O. Vinyals, and A. Saxe. Qualitatively characterizing neural network optimization problems. International Conference on Learning Representations, 2015. +G. Gur-Ari, D. A. Roberts, and E. Dyer. Gradient descent happens in a tiny subspace. In CoRR, 2018. +K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. +P. Izmailov, D. Podoprikhin, T. Garipov, D. Vetrov, and A. G. Wilson. Averaging weights leads to wider optima and better generalization. arXiv preprint arXiv:1803.05407, 2018. +N. S. Keskar, D. Mudigere, J. Nocedal, M. Smelyanskiy, and P. T. P. Tang. On large-batch training for deep learning: Generalization gap and sharp minima. ICLR, 2017. +D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. ICLR, 2015. +A. Krizhevsky. Learning Multiple Layers of Features from Tiny Images. page 60. +S. Laine and T. Aila. Temporal Ensembling for Semi-Supervised Learning. arXiv:1610.02242 [cs], Oct. 2016. +S. Laine and T. Aila. Temporal ensembling for semi-supervised learning. International Conference on Learning Representations, 2017. +I. Loshchilov and F. Hutter. SGDR: stochastic gradient descent with restarts. CoRR, abs/1608.03983, 2016. +Y. Luo, J. Zhu, M. Li, Y. Ren, and B. Zhang. Smooth neighbors on teacher graphs for semi-supervised learning. In CVPR, 2018. +S. Mandt, M. D. Hoffman, and D. M. Blei. Stochastic gradient descent as approximate bayesian inference. arXiv preprint arXiv:1704.04289, 2017. +T. Miyato, S. Maeda, M. Koyama, and S. Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. CoRR, abs/1704.03976, 2017. +R. Novak, Y. Bahri, D. A. Abolafia, J. Pennington, and J. Sohl-Dickstein. Sensitivity and generalization in neural networks: an empirical study. ICLR, 2018. +A. Oliver, A. Odena, C. Raffel, E. D. Cubuk, and I. J. Goodfellow. Realistic evaluation of deep semi-supervised learning algorithms. ICLR Workshop, 2018. +S. Park, J.-K. Park, S.-J. Shin, and I.-C. Moon. Adversarial Dropout for Supervised and Semisupervised Learning. arXiv:1707.03631 [cs], July 2017. arXiv: 1707.03631. +L. Sagun, U. Evci, V. U. Güney, Y. Dauphin, and L. Bottou. Empirical analysis of the hessian of over-parametrized neural networks. CoRR, 2017. +M. Sajjadi, M. Javanmardi, and T. Tasdizen. Regularization With Stochastic Transformations and Perturbations for Deep Semi-Supervised Learning. arXiv:1606.04586 [cs], June 2016. arXiv: 1606.04586. +J. Schmidhuber and S. Hochreiter. Flat minima. Neural Computation, 1997. +R. Shu, H. Bui, H. Narui, and S. Ermon. A DIRT-t approach to unsupervised domain adaptation. In International Conference on Learning Representations, 2018. +J. Sokolic, R. Giryes, G. Sapiro, and M. R. Rodrigues. Robust large margin deep neural networks. ´ IEEE Transactions on Signal Processing, 65(16):4265–4280, 2017. +N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1): 1929–1958, 2014. +A. Tarvainen and H. Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NIPS, 2017. +A. Torralba, R. Fergus, and W. T. Freeman. 80 million tiny images: A large data set for nonparametric object and scene recognition. IEEE Trans. Pattern Anal. Mach. Intell., 30(11):1958–1970, 2008. +Y. Yazıcı, C.-S. Foo, S. Winkler, K.-H. Yap, G. Piliouras, and V. Chandrasekhar. The Unusual Effectiveness of Averaging in GAN Training. ArXiv, 2018. +X. Zhu, Z. Ghahramani, and J. Lafferty. Semi-Supervised Learning Using Gaussian Fields and Harmonic Functions. ICML, 2003. + +# A APPENDIX + +# A.1 ADDITIONAL PLOTS + +![](images/a1ca95b2a0626225a9995ea3afc7eaaef08f08755943c1c19859a575711fdfab.jpg) +Figure 6: All plots are a obtained using the 13-layer CNN on CIFAR-10 with $4 k$ labeled and $4 6 k$ unlabeled data points unless specified otherwise. Left: Test error as a function of distance along random rays for the $\Pi$ model with 0, $4 k$ , $1 0 k$ , $2 0 k$ or $4 6 k$ unlabeled data points, and standard fully supervised training which uses only the cross entropy loss. All methods use $4 k$ labeled examples. Middle: Train and test errors along rays connecting SGD solutions (showed with circles) to SWA solutions (showed with squares) for each respective model. Right: Comparison of train and test errors along rays connecting two SGD solutions, random rays, and adversarial rays for the Mean Teacher model. + +In this section we provide several additional plots visualizing the train and test error along different types of rays in the weight space. The left panel of Figure 6 shows how the behavior of test error changes as we add more unlabeled data points for the ⇧ model. We observe that the test accuracy improves monotonically, but also the solutions become narrower along random rays. + +The middle panel of Figure 6 visualizes the train and test error behavior along the directions connecting the fast-SWA solution (shown with squares) to one of the SGD iterates used to compute the average (shown with circles) for ⇧, MT and supervised training. Similarly to Izmailov et al. (2018) we observe that for all three methods fast-SWA finds a centered solution, while the SGD solution lies near the boundary of a wide flat region. Agreeing with our results in section 3.2 we observe that for $\Pi$ and Mean Teacher models the train and test error surfaces are much wider along the directions connecting the fast-SWA and SGD solutions than for supervised training. + +In the right panel of Figure 6 we show the behavior of train and test error surfaces along random rays, adversarial rays and directions connecting the SGD solutions from epochs 170 and 180 for the Mean Teacher model (see section 3.2). + +![](images/3488f816a32e2839f8de1167b57f7c40744f1a59a2e500325dd19f66ff935520.jpg) +Figure 7: (Left): The evolution of the gradient covariance trace in the $\Pi$ , MT, and supervised models during training. (Middle): Scatter plot of the decrease in error $C _ { a v g }$ for weight averaging versus diversity. (Right): Scatter plot of the distance between pairs of weights versus diversity in their predictions. + +In the left panel of Figure 7 we show the evolution of the trace of the gradient of the covariance of the loss + +$$ +\mathrm { t r } \cos ( \nabla _ { \boldsymbol { w } } L ( \boldsymbol { w } ) ) = \mathbb { E } \| \nabla _ { \boldsymbol { w } } L ( \boldsymbol { w } ) - \mathbb { E } \nabla _ { \boldsymbol { w } } L ( \boldsymbol { w } ) \| ^ { 2 } +$$ + +for the ⇧, MT and supevised training. We observe that the variance of the gradient is much larger for the ⇧ and Mean Teacher models compared to supervised training. + +In the middle and right panels of figure 7 we provide scatter plots of the improvement $C$ obtained from averaging weights against diversity and diversity against distance. We observe that diversity is highly correlated with the improvement $C$ coming from weight averaging. The correlation between distance and diversity is less prominent. + +# A.2 DETAILED RESULTS + +In this section we report detailed results for the $\Pi$ and Mean Teacher models and various baselines on CIFAR-10 and CIFAR-100 using the 13-layer CNN and Shake-Shake. + +The results using the 13-layer CNN are summarized in Tables 2 and 3 for CIFAR-10 and CIFAR-100 respectively. Tables 4 and 5 summarize the results using Shake-Shake on CIFAR-10 and CIFAR100. In the tables ⇧ EMA is the same method as $\Pi$ , where instead of SWA we apply Exponential Moving Averaging (EMA) for the student weights. We show that simply performing EMA for the student network in the ⇧ model without using it as a teacher (as in MT) typically results in a small improvement in the test error. + +Figures 8 and 9 show the performance of the $\Pi$ and Mean Teacher models as a function of the training epoch for CIFAR-10 and CIFAR-100 respectively for SWA and fast-SWA. + +Table 2: CIFAR-10 semi-supervised errors on test set with a 13-layer CNN. The epoch numbers are reported in parenthesis. The previous results shown in the first section of the table are obtained from Tarvainen and Valpola (2017) 1, Park et al. $( 2 0 1 7 ) ^ { 2 }$ , Laine and Aila $\left( 2 0 1 6 \right) ^ { 3 }$ , Miyato et al. $( 2 0 1 7 ) ^ { 4 }$ . + +
Number of labels1000200040001000050000
TE312.16 ± 0.315.60 ± 0.15
Supervised-onlyl46.43 ± 1.2133.94 ± 0.7320.66 ± 0.575.82 ± 0.15
27.36 ± 1.2018.02 ± 0.6013.20 ± 0.276.06 ± 0.15
MT121.55 ±1.4815.73 ± 0.3112.31 ± 0.285.94 ± 0.15
VAdD39.22 ± 0.104.40 ± 0.12
VAT + EntMin410.55
MT18.78 ± 0.3114.43 ± 0.2011.41 ± 0.278.74 ± 0.305.98 ± 0.21
MT+ fast-SWA (180)18.19 ± 0.3813.46 ± 0.3010.67 ± 0.188.06 ± 0.125.90 ± 0.03
MT + fast-SWA (240)17.81 ± 0.3713.00 ± 0.3110.34 ± 0.147.73 ± 0.105.55 ± 0.03
MT + SWA (240)18.38 ± 0.2913.86 ± 0.6410.95 ± 0.218.36 ± 0.505.75 ± 0.29
MT + fast-SWA (480)16.84 ± 0.6212.24 ± 0.319.86 ± 0.277.39 ± 0.145.14 ± 0.07
MT + SWA (480)17.48 ± 0.1313.09 ± 0.8010.30 ± 0.217.78 ± 0.495.31 ± 0.43
MT+ fast-SWA (1200)15.58 ± 0.1211.02 ± 0.239.05 ± 0.216.92 ± 0.074.73 ± 0.18
MT + SWA (1200)15.59 ± 0.7711.42 ± 0.339.38 ± 0.287.04 ± 0.115.11 ± 0.35
ⅡI21.85 ± 0.6916.10 ± 0.5112.64 ± 0.119.11 ± 0.216.79 ± 0.22
II EMA21.70 ± 0.5715.83 ± 0.5512.52 ± 0.169.06 ± 0.156.66 ± 0.20
II + fast-SWA (180)20.79 ± 0.3815.12 ± 0.4411.91 ± 0.068.83 ± 0.326.42 ± 0.09
II + fast-SWA (240)20.04 ± 0.4114.77 ± 0.1511.61 ± 0.068.45 ± 0.286.14 ± 0.11
II + SWA (240)21.37 ± 0.6415.38 ± 0.8512.05 ± 0.408.58 ± 0.416.36 ± 0.55
II + fast-SWA (480)19.11 ± 0.2913.88 ± 0.3010.91 ± 0.157.91 ± 0.215.53 ± 0.07
II + SWA (480)20.06 ± 0.6414.53 ± 0.8111.35 ± 0.428.04 ± 0.375.77 ± 0.51
II + fast-SWA (1200)17.23 ± 0.3412.61 ± 0.1810.07 ± 0.277.28 ± 0.234.72 ± 0.04
II + SWA (1200)17.70 ± 0.2512.59 ± 0.2910.73 ± 0.397.13 ± 0.234.99 ± 0.41
VAT
VAT+SWA11.99
11.16
VAT+ EntMin11.26
VAT + EntMin + SWA10.97
+ +Table 3: CIFAR-100 semi-supervised errors on test set. All models are trained on a 13-layer CNN. The epoch numbers are reported in parenthesis. The previous results shown in the first section of the table are obtained from (Laine and Aila, $2 0 1 6 ) ^ { 3 }$ . + +
Number of labels10k50k50k +500k50k+237k*
Supervised-only344.56 ± 0.3026.42 ± 0.17
II model339.19 ± 0.5426.32 ± 0.0425.79 ± 0.1725.43 ± 0.17
Temporal Ensembling338.65 ± 0.5126.30 ± 0.1523.62 ± 0.1723.79 ± 0.17
MT (180) MT + fast-SWA (180)35.96 ± 0.7723.37 ± 0.1623.18 ± 0.0623.18 ± 0.24
MT + SWA (240)34.54 ± 0.48 35.59 ± 1.4521.93 ± 0.16 23.17 ± 0.8621.04 ± 0.16 22.00 ± 0.2321.09 ± 0.12 21.59 ± 0.22
MT + fast-SWA (240)34.10 ± 0.3121.84 ± 0.1221.16 ± 0.2121.07 ± 0.21
MT + SWA (1200)34.90 ± 1.5122.58 ± 0.7921.47 ± 0.2921.27 ± 0.09
MT + fast-SWA (1200)21.52 ± 0.12
33.62 ± 0.5421.04 ± 0.0420.98 ± 0.36
I (180)38.13 ± 0.5224.13 ± 0.2024.26 ± 0.1524.10 ± 0.07
II + fast-SWA (180)35.59 ± 0.6222.08 ± 0.2121.40 ± 0.1921.28 ± 0.20
II + SWA (240)36.89 ± 1.5123.23 ± 0.7022.17 ± 0.1921.65 ± 0.13
II + fast-SWA (240)35.14 ± 0.7122.00 ± 0.2121.29 ± 0.2721.22 ± 0.04
II + SWA (1200)35.35 ± 1.1522.53 ± 0.6421.53 ± 0.1321.26 ± 0.34
II + fast-SWA (1200)34.25 ± 0.1621.78 ± 0.0521.19 ± 0.0520.97 ± 0.08
+ +Table 4: CIFAR-10 semi-supervised errors on test set. All models use Shake-Shake Regularization (Gastaldi, 2017) $^ +$ ResNet-26 (He et al., 2015). + +
Number of labels1000 200040001000050000
Short Schedule (l = 180) MTt (Tarvainen and Valpola, 2017)6.28
MT (180) MT + SWA (240) MT + fast-SWA (240)10.2 9.7 9.6 7.68.0 7.7 7.4 6.47.1 6.2 6.25.8 4.9 4.9 4.63.9 3.4 3.2
MT + SWA (1200) MT+ fast-SWA (1200) II (180) II + SWA (240) II + fast-SWA (240) II + SWA (1200) I + fast-SWA (1200)7.5 12.3 11.0 11.2 8.2 8.06.3 9.1 8.3 8.2 6.7 6.55.8 7.5 6.7 6.7 5.7 5.54.5 6.4 5.5 5.5 4.23.1 3.8 3.3 3.3 3.1
Long Schedule (l = 1500)4.03.1
Supervised-only (Gastaldi,2017)2.86
MT (1500)7.5 6.46.56.05.03.5
MT + fast-SWA (1700)6.95.85.23.8 4.23.4
MT + SWA (1700)5.95.53.2
MT + fast-SWA (3500)6.65.75.13.93.1
MT + SWA (3500)6.75.85.23.93.1
II (1500)8.57.06.35.0
7.56.25.24.03.4
II + fast-SWA (1700)3.1
II + SWA (1700)7.86.45.64.43.2
II + fast-SWA (3500)7.46.05.03.83.0
II + SWA (3500)7.96.25.14.03.0
+ +Table 5: CIFAR-100 semi-supervised errors on test set. Our models use Shake-Shake Regularization (Gastaldi, 2017) $^ +$ ResNet-26 (He et al., 2015). + +
Number of labels10k50k50k + 500k50k+237k*
TE (CNN) (Laine and Aila, 2016)38.65 ± 0.5126.30 ± 0.1523.62 ± 0.1723.79 ± 0.17
Short Schedule (l = 180)
MT (180)29.419.521.919.0
MT + fast-SWA (180)28.919.319.718.3
MT + SWA (240)28.418.819.917.9
MT + fast-SWA (240)28.118.819.517.9
MT + SWA (300)28.118.518.917.5
MT + fast-SWA (300)28.018.419.317.7
+ +![](images/9ad0ecd974df4e3fd730a33484858190944466b4e3c1cc4b4b63089041abeaf8.jpg) +Figure 8: Test errors as a function of training epoch for baseline models, SWA and fast-SWA on CIFAR-10 trained using $1 k$ , $2 k$ , $4 k$ , and $1 0 k$ labels for (top) the MT model (bottom) the ⇧ model. All models are trained using the 13-layer CNN. + +![](images/8b4b83b78db5ca1275e52aab80896f82053eb2592b47f833be0be1cd5b5e5681.jpg) +Figure 9: Test errors versus training epoch for baseline models, SWA and fast-SWA on CIFAR-100 trained using $1 0 k$ , $5 0 k$ , $5 0 k { + } 5 0 0 k$ , and $5 0 k { + } 2 3 7 k ^ { * }$ labels for (top) the MT model (bottom) the ⇧ model. All models are trained using the 13-layer CNN. + +# A.3 EFFECT OF LEARNING RATE SCHEDULES + +The only hyperparameter for the fast-SWA setting is the cycle length $c$ . We demonstrate in Figure 10a that fast-SWA’s performance is not sensitive to $c$ over a wide range of $c$ values. We also demonstrate the performance for constant learning schedule. fast-SWA with cyclical learning rates generally converges faster due to higher variety in the collected weights. + +![](images/7027dd7c8a8d3f9fea2497da4ed35a47295674833e7bc9a4af7f1b0d4dde1e0a.jpg) +Figure 10: The plots are generated using the MT model with CNN trained on CIFAR-10. We randomly select $5 k$ of the $5 0 k$ train images as a validation set. The remaining $4 5 k$ images are splitted into $4 k$ labeled and $4 1 k$ unlabeled data points. (a) Validation accuracy as a function of training epoch for different cycle lengths $c$ (b) fast-SWA with constant learning rate. The “learning rate epoch” corresponds to the epoch in the unmodified cosine annealing schedule (Figure 3, left) at which the learning rate is evaluated. We use this fixed learning rate for all epochs $i \geq \ell$ . + +# A.4 EMA VERSUS SWA AS A TEACHER + +The MT model uses an exponential moving average (EMA) of the student weights as a teacher in the consistency regularization term. We consider two potential effects of using EMA as a teacher: first, averaging weights improves performance of the teacher for the reasons discussed in Sections 3.2, 3.3; second, having a better teacher model leads to better student performance which in turn further improves the teacher. In this section we try to separate these two effects. We apply EMA to the ⇧ model in the same way in which we apply fast-SWA instead of using EMA as a teacher and compare the resulting performance to the Mean Teacher. Figure 11 shows the improvement in error-rate obtained by applying EMA to the ⇧ model in different label settings. As we can see while EMA improves the results over the baseline ⇧ model, the performance of ⇧-EMA is still inferior to that of the Mean Teacher method, especially when the labeled data is scarce. This observation suggests that the improvement of the Mean Teacher over the ⇧ model can not be simply attributed to EMA improving the student performance and we should take the second effect discussed above into account. + +Like SWA, EMA is a way to average weights of the networks, but it puts more emphasis on very recent models compared to SWA. Early in training when the student model changes rapidly EMA significantly improves performance and helps a lot when used as a teacher. However once the student model converges to the vicinity of the optimum, EMA offers little gain. In this regime SWA is a much better way to average weights. We show the performance of SWA applied to ⇧ model in Figure 11 (left). + +![](images/9ce59d666ed4cce3b9b971deca72da32c3d3f8740f3a2c41f0a71ef287179b00.jpg) +Figure 11: (left) Comparison of different averaging methods. The y axis corresponds to the increased error with respect to the MT model with fast-SWA solution (which has $y = 0$ ). All numbers are taken from epoch 180. (right) The effects of using SWA as a teacher. W-T model corresponds to the performance of a model with weight W using a model with a teacher being T. + +Since SWA performs better than EMA, we also experiment with using SWA as a teacher instead of EMA. We start with the usual MT model pretrained until epoch 150. Then we switch to using SWA as a teacher at epoch 150. In Figure 11 (right), our results suggest that using SWA as a teacher performs on par with using EMA as a teacher. We conjecture that once we are at a convex region of test error close to the optimum (epoch 150), having a better teacher doesn’t lead to substantially improved performance. It is possible to start using SWA as a teacher earlier in training; however, during early epochs where the model undergoes rapid improvement EMA is more sensible than SWA as we discussed above. + +# A.5 CONSISTENCY LOSS APPROXIMATES JACOBIAN NORM + +Estimator mean and variance: In the simplified $\Pi$ model with small additive data perturbations that are normally distributed, $z \sim \mathcal { N } ( 0 , I )$ , + +$$ +\begin{array} { r } { \hat { Q } = \underset { \epsilon \to 0 } { \operatorname* { l i m } } \frac { 1 } { \epsilon ^ { 2 } } \frac { 1 } { m } \displaystyle \sum _ { i = 1 } ^ { m } \ell _ { c o n s } ( w , x _ { i } , \epsilon ) = \frac { 1 } { m } \displaystyle \sum _ { i = 1 } ^ { m } \underset { \epsilon \to 0 } { \operatorname* { l i m } } \frac { 1 } { \epsilon ^ { 2 } } \| f ( w , x _ { i } + \epsilon z _ { i } ) - f ( w , x _ { i } ) \| ^ { 2 } } \end{array} +$$ + +Taylor expanding $\ell _ { c o n s }$ in $\epsilon$ , we obtain $\ell _ { c o n s } ( w , x , \epsilon ) = \epsilon ^ { 2 } z ^ { T } J _ { x } ^ { T } J _ { x } z + O ( \epsilon ^ { 4 } )$ , where $J _ { x }$ is the Jacobian of the network outputs $f$ with respect to the input at a particular value of $x$ . Therefore, + +$$ +\begin{array} { r } { \hat { Q } _ { i } = \underset { \epsilon 0 } { \operatorname* { l i m } } \frac { 1 } { \epsilon ^ { 2 } } \ell _ { c o n s } ( w , x _ { i } , \epsilon ) = z _ { i } ^ { T } J ( x _ { i } ) ^ { T } J ( x _ { i } ) z _ { i } . } \end{array} +$$ + +We can now recognize this term as a one sample stochastic trace estimator for $\operatorname { t r } ( J ( x _ { i } ) ^ { T } J ( x _ { i } ) )$ with a Gaussian probe variable $z _ { i }$ ; see Avron and Toledo (2011) for derivations and guarantees on stochastic trace estimators. + +$$ +\mathbb { E } _ { z } [ \hat { Q } _ { i } ] = \mathrm { t r } \left( J ( x _ { i } ) ^ { T } J ( x _ { i } ) \mathbb { E } [ z _ { i } z _ { i } ^ { T } ] \right) = \| J ( x _ { i } ) \| _ { F } ^ { 2 } . +$$ + +Taking an expectation over the $m$ samples of $x$ , we get $\mathbb { E } [ \hat { Q } ] = \mathbb { E } _ { x } [ \| J _ { x } \| _ { F } ^ { 2 }$ . + +In general if we have $m$ samples of $x$ and $n$ sampled perturbations for each $x$ , then for a symmetric matrix $A$ with $z _ { i k } \stackrel { i i d } { \sim } N ( 0 , I )$ and independent $x _ { i } \stackrel { i i d } { \sim } p ( x )$ , + +the estimator + +$$ +\begin{array} { l } { { \displaystyle \hat { Q } = \frac { 1 } { m } \sum _ { i } ^ { m } \frac { 1 } { n } \sum _ { k } ^ { n } z _ { i k } ^ { T } A ( x _ { i } ) z _ { i k } \quad \mathrm { ~ h a s ~ v a r i a n c e ~ } } } \\ { { \displaystyle ~ \mathrm { V a r } [ \hat { Q } ] = \frac { 1 } { m } \biggl ( \mathrm { V a r } [ \mathrm { t r } ( A ) ] + \frac { 2 } { n } \mathbb { E } [ \mathrm { t r } ( A ^ { 2 } ) ] \biggr ) . } } \end{array} +$$ + +Proof: Let $q _ { i k } \equiv z _ { i k } ^ { T } A ( x _ { i } ) z _ { i k }$ . It is easy to show that for fixed $x$ , $\mathbb { E } _ { z } [ q _ { 1 1 } | x _ { 1 } ] = 2 \mathrm { t r } ( A ( x _ { 1 } ) ^ { 2 } ) +$ $\operatorname { t r } ( A ( x _ { 1 } ) ) ^ { 2 }$ , (see e.g. Avron and Toledo, 2011). Note that $\mathbb { E } _ { z _ { 1 } , z _ { 2 } } [ q _ { i 1 } q _ { i 2 } | x _ { i } ] = \operatorname { t r } ( A ( x _ { i } ) ) ^ { 2 }$ . Since $\textstyle { \left\{ { \frac { 1 } { n } } \sum _ { k } ^ { n } q _ { i k } \right\} _ { i = 1 } ^ { m } }$ are i.i.d random variables, + +$$ +\mathrm { V a r } \bigl [ \frac { 1 } { m } \sum _ { i } ^ { m } \frac { 1 } { n } \sum _ { k } ^ { n } q _ { i k } \bigr ] = \frac { 1 } { m } \mathrm { V a r } \bigl [ \frac { 1 } { n } \sum _ { k } ^ { n } q _ { 1 k } \bigr ] , +$$ + +whereas this does not hold for the opposite ordering of the sum. + +$$ +{ \begin{array} { r l } { \displaystyle \left[ \left( { \frac { 1 } { n } } \sum _ { k } ^ { n } q _ { 1 k } \right) ^ { 2 } \right] = \mathbb { E } _ { x _ { 1 } } \mathbb { E } _ { \xi \ z } { \Bigg [ } { \frac { 1 } { n ^ { 2 } } } \sum _ { l } ^ { n } \sum _ { k } ^ { n } q _ { i l } q _ { i k } { \big | } \{ x \} { \Bigg ] } } \\ { \displaystyle } & { = \mathbb { E } _ { x _ { 1 } } \mathbb { E } _ { \{ z \} } { \Bigg [ } { \frac { n } { n ^ { 2 } } } q _ { 1 1 } ^ { 2 } + { \frac { n ( n - 1 ) } { n ^ { 2 } } } q _ { 1 1 } q _ { 1 2 } { \big | } \{ x \} { \Bigg ] } } \\ { \displaystyle } & { = \mathbb { E } _ { x } { \Bigg [ } { \frac { 1 } { n } } { \big ( } 2 \mathrm { t r } ( A ^ { 2 } ) + \mathrm { t r } ( A ) ^ { 2 } { \big ) } + { \big ( } 1 - { \frac { 1 } { n } } \mathrm { ) t r } ( A ) ^ { 2 } { \Bigg ] } = { \Bigg ( } \mathbb { E } _ { x } [ \mathrm { t r } ( A ) ^ { 2 } ] + { \frac { 2 } { n } } \mathbb { E } _ { x } [ \mathrm { t r } ( A ^ { 2 } ) ] { \Bigg ) } } \end{array} } +$$ + +Plugging in $A = J ^ { T } J$ and $n = 1$ , we get + +$$ +\mathrm { V a r } [ \hat { Q } ] = \frac { 1 } { m } \bigg ( \mathrm { V a r } [ \| J _ { x } \| _ { F } ^ { 2 } ] + 2 \mathbb { E } [ \| J _ { x } ^ { T } J _ { x } \| _ { F } ^ { 2 } ] \bigg ) . +$$ + +Non-isotropic perturbations along data manifold Consistency regularization with natural perturbations such as image translation can also be understood as penalizing a Jacobian norm as in Section 3.1. For example, consider perturbations sampled from a normal distribution on the tangent space, $z \sim P ( x ) \mathcal { N } ( \bar { 0 , } I )$ where $\dot { P ( x ) } = P ( x ) ^ { 2 }$ is the orthogonal projection matrix that projects down from $\mathbb { R } ^ { d }$ to $T _ { x } ( \mathcal { M } )$ , the tangent space of the image manifold at $x$ . Then the consistency regularization penalizes the Laplacian norm of the network on the manifold (with the inherited metric from $\mathbb { R } ^ { d }$ ). $\bar { \mathbb { E } } [ z ] = 0$ and $\mathbb { E } [ z z ^ { T } ] = P P ^ { T } ( = ) P ^ { 2 } = P$ which follows if $P$ is an orthogonal projection matrix. Then, + +$$ +\begin{array} { r } { \mathbb E [ z ^ { T } J ^ { T } J z ] = \mathrm { t r } ( J ^ { T } J P P ^ { T } ) = \mathrm { t r } ( P ^ { T } J ^ { T } J P ) = \mathrm { t r } ( J _ { \mathcal { M } } ^ { T } J _ { \mathcal { M } } ) = \| J _ { \mathcal { M } } \| _ { F } ^ { 2 } . } \end{array} +$$ + +We view the standard data augmentations such as random translation (that are applied in the $\Pi$ and MT models) as approximating samples of nearby elements of the data manifold and therefore differences $x ^ { \prime } - x$ approximate elements of its tangent space. + +A.6 RELATIONSHIP BETWEEN $\mathbb { E } _ { x } [ \| J _ { w } \| _ { F } ^ { 2 } ]$ AND RANDOM RAY SHARPNESS + +In the following analysis we review an argument for why smaller $\mathbb { E } _ { x } [ \| J _ { w } \| _ { F } ^ { 2 } ]$ , implies broader optima. To keep things simple, we focus on the MSE loss, but in principle a similar argument should apply for the Cross Entropy and the Error rate. For a single data point $x$ and one hot vector $y$ with $k$ classes, the hessian of $\underline { { \ell } } _ { M S E } ( w ) = \| f ( x , w ) - y \| ^ { 2 }$ can be decomposed into two terms, the Gauss-Newton matrix $G = J _ { w } ^ { T } J _ { w }$ and a term which depends on the labels. + +$$ +H ( w , x , y ) = \nabla ^ { 2 } \ell _ { M S E } ( w ) = J _ { w } ^ { T } J _ { w } + \sum _ { i = 1 } ^ { k } ( \nabla ^ { 2 } f _ { i } ) ( f _ { i } ( x ) - y _ { i } ) , +$$ + +$$ +\mathrm { t r } ( H ) = \| J _ { w } \| _ { F } ^ { 2 } + \underbrace { \sum _ { i = 1 } ^ { k } \mathrm { t r } ( \nabla ^ { 2 } f _ { i } ) ( f _ { i } ( x ) - y _ { i } ) } _ { \alpha ( x , y ) } +$$ + +Thus $\operatorname { t r } ( H )$ is also the sum of two terms, $\| J _ { w } \| _ { F } ^ { 2 }$ and $\alpha$ . As the solution improves, the relative size of $\alpha$ goes down. In terms of random ray sharpness, consider the expected MSE loss, or risk, $R _ { \mathrm { M S E } } ( w ) \stackrel { - } { = } \mathbb { E } _ { ( x , y ) } \Vert f ( x , w ) - y \Vert ^ { 2 }$ along random rays. Let $d$ be a random vector sampled from the unit sphere and $s$ is the distance along the random ray. Evaluating the risk on a random ray, and Taylor expanding in $s$ we have + +$$ +R _ { \mathrm { M S E } } ( w + s d ) = R _ { \mathrm { M S E } } ( w ) + s d ^ { T } \mathbb { E } _ { ( x , y ) } [ J _ { w } ^ { T } ( f - y ) ] + ( 1 / 2 ) s ^ { 2 } d ^ { T } \mathbb { E } _ { ( x , y ) } [ H ] d + O ( s ^ { 3 } ) +$$ + +Since $d$ is from the unit sphere, $\mathbb { E } [ d ] = 0$ and $\mathbb { E } [ d d ^ { T } ] = I / p$ where $p$ is the dimension. Averaging over the rays, $d \sim \operatorname { U n i f } ( { \bar { S ^ { p - 1 } } } )$ , we have + +$\mathfrak { L } _ { d } [ R _ { \mathrm { M S E } } ( w + s d ) ] - R _ { \mathrm { M S E } } ( w ) = \frac { s ^ { 2 } } { 2 p } \mathbb { E } _ { x } [ \mathrm { t r } ( H ) ] + O ( s ^ { 4 } ) = \frac { s ^ { 2 } } { 2 p } \mathbb { E } _ { x } [ \| J _ { w } \| _ { F } ^ { 2 } ] + \frac { s ^ { 2 } } { 2 p } \mathbb { E } _ { ( x , y ) } [ \alpha ( x , y ) ] + O ( s ^ { 4 } )$ All of the odd terms vanish because of the reflection symmetry of the unit sphere. This means that locally, the sharpness of the optima (as measured by random rays) can be lowered by decreasing $\mathbb { E } _ { x } [ \| \dot { J } _ { w } \| _ { F } ^ { 2 } ]$ . + +# A.7 INCLUDING HIGH LEARNING RATE ITERATES INTO SWA + +As discussed in Mandt et al. (2017), under certain assumptions SGD samples from a Gaussian distribution centered at the optimum of the loss $w _ { 0 }$ with covariance proportional to the learning rate. Suppose then that we have $n$ weights sampled at learning rate $\eta _ { 1 }$ , $w _ { i } ^ { ( 1 ) } \stackrel { i i d } { \sim } \mathcal { N } ( w _ { 0 } , \eta _ { 1 } \Sigma )$ and $m$ weights sampled with the higher learning rate $\eta _ { 2 }$ , $w _ { j } ^ { ( 2 ) } \stackrel { i i d } { \sim } \mathcal { N } ( w _ { 0 } , \eta _ { 2 } \Sigma )$ . For the SWA estimator $\begin{array} { r } { \hat { w } _ { \mathrm { S W A } } = \frac { 1 } { n } \sum _ { i } w _ { i } ^ { ( 1 ) } , \mathbb { E } [ \| \hat { w } _ { \mathrm { S W A } } - w _ { 0 } \| ^ { 2 } ] = \mathrm { t r } ( \mathrm { C o v } ( \hat { w } _ { \mathrm { S W A } } ) ) = \frac { \eta _ { 1 } } { n } \mathrm { t r } ( \Sigma ) } \end{array}$ . But if we include the high variance points in the average, as in fast-SWA, wˆfSWA = 1n+m $\begin{array} { r } { \hat { w } _ { \mathrm { f S W A } } = \frac { 1 } { n + m } \big ( \sum _ { i } w _ { i } ^ { ( 1 ) } + \sum _ { j } w _ { j } ^ { ( 2 ) } \big ) } \end{array}$ , then $\begin{array} { r } { \mathbb { E } [ \| \hat { w } _ { \mathrm { f S W A } } - w _ { 0 } \| ^ { 2 } ] = \frac { n \eta _ { 1 } + m \eta _ { 2 } } { ( n + m ) ^ { 2 } } \mathrm { t r } ( \Sigma ) } \end{array}$ . If $\begin{array} { r } { \frac { n \eta _ { 1 } + m \eta _ { 2 } } { ( n + m ) ^ { 2 } } < \frac { \eta _ { 1 } } { n } } \end{array}$ then including the high learning rate points decreases the MSE of the estimator for $\begin{array} { r } { m > n \bigl ( \frac { \eta _ { 2 } } { \eta _ { 1 } } - 2 \bigr ) } \end{array}$ . If we include enough points, we will still improve the estimate. + +# A.8 NETWORK ARCHITECTURES + +In the experiments we use two DNN architectures – 13 layer CNN and Shake-Shake. The architecture of 13-layer CNN is described in Table 6. It closely follows the architecture used in (Laine and Aila, 2017; Miyato et al., 2017; Tarvainen and Valpola, 2017). We re-implement it in PyTorch and removed the Gaussian input noise, since we found having no such noise improves generalization. For Shake-Shake we use $2 6 { - } 2 \mathrm { x } 9 6 \mathrm { d }$ Shake-Shake regularized architecture of Gastaldi (2017) with 12 residual blocks. + +Table 6: A 13-layer convolutional neural networks for the CNN experiments (CIFAR-10 and CIFAR-100) in Section 5.2 and 5.3. Note that the difference from the architecture used in Tarvainen and Valpola (2017) is that we removed a Gaussian noise layer after the horizontal flip. + +
Layer InputHyperparameters
Translation Horizontal flip Convolutional Convolutional Convolutional Pooling Dropout Convolutional Convolutional Convolutional Pooling Dropout Convolutional32 × 32 RGB image Randomly{△x,△y} ~[-4,4] Randomly p = 0.5 128 filters,3 × 3, same padding 128 filters, 3 × 3, same padding 128 filters,3 × 3, same padding Maxpool 2 × 2 p = 0.5 256 filters,3 × 3, same padding 256 filters,3 × 3, same padding 256 filters,3 × 3,same padding
+ +# A.9 HYPERPARAMETERS + +We consider two different schedules. In the short schedule we set the cosine half-period $\ell _ { 0 } = 2 1 0$ and training length $\ell = 1 8 0$ , following the schedule used in Tarvainen and Valpola (2017) in Shake-Shake experiments. For our Shake-Shake experiments we also report results with long schedule where we set $\ell = 1 8 0 0 , \ell _ { 0 } = 1 5 0 0$ following Gastaldi (2017). To determine the initial learning rate $\eta _ { 0 }$ and the cycle length $c$ we used a separate validation set of size 5000 taken from the unlabeled data. After determining these values, we added the validation set to the unlabeled data and trained again. We reuse the same values of $\eta _ { 0 }$ and $c$ for all experiments with different numbers of labeled data for both $\Pi$ model and Mean Teacher for a fixed architecture (13-layer CNN or Shake-Shake). For the short schedule we use cycle length $c = 3 0$ and average models once every $k = 3$ epochs. For long schedule we use $c = 2 0 0$ , $k = 2 0$ . + +In all experiments we use stochastic gradient descent optimizer with Nesterov momentum (Loshchilov and Hutter, 2016). In fast-SWA we average every the weights of the models corresponding to every third epoch. In the $\Pi$ model, we back-propagate the gradients through the student side only (as opposed to both sides in (Laine and Aila, 2016)). For Mean Teacher we use $\alpha = 0 . 9 7$ decay rate in the Exponential Moving Average (EMA) of the student’s weights. For all other hyper-parameters we reuse the values from Tarvainen and Valpola (2017) unless mentioned otherwise. + +Like in Tarvainen and Valpola (2017), we use $\| \cdot \| ^ { 2 }$ for divergence in the consistency loss. Similarly, we ramp up the consistency cost $\lambda$ over the first 5 epochs from 0 up to it’s maximum value of 100 as done in Tarvainen and Valpola (2017). We use cosine annealing learning rates with no learning rate ramp up, unlike in the original MT implementation (Tarvainen and Valpola, 2017). Note that this is similar to the same hyperparameter settings as in Tarvainen and Valpola (2017) for $\mathrm { R e s N e t } ^ { 2 }$ . We note that we use the exact same hyperparameters for the ⇧ and MT models in each experiment setting. In contrast to the original implementation in Tarvainen and Valpola (2017) of CNN experiments, we use SGD instead of Adam. + +Understanding Experiments in Sections 3.2, 3.3 We use the 13-layer CNN with the short learning rate schedule. We use a total batch size of 100 for CNN experiments with a labeled batch size of 50 for the ⇧ and Mean Teacher models. We use the maximum learning rate $\eta _ { 0 } = 0 . 1$ . For Section 3.2 we run SGD only for 180 epochs, so 0 learning rate cycles are done. For Section 3.3 we additionally run 5 learning rate cycles and sample pairs of SGD iterates from epochs 180-330 corresponding to these cycles. + +CIFAR-10 CNN Experiments We use a total batch size of 100 for CNN experiments with a labeled batch size of 50. We use the maximum learning rate $\eta _ { 0 } = 0 . 1$ . + +CIFAR-10 ResNet $^ +$ Shake-Shake We use a total batch size of 128 for ResNet experiments with a labeled batch size of 31. We use the maximum learning rate $\eta _ { 0 } = 0 . 0 5$ for CIFAR-10. This applies for both the short and long schedules. + +CIFAR-100 CNN Experiments We use a total batch size of 128 with a labeled batch size of 31 for $1 0 k$ and $5 0 k$ label settings. For the settings $5 0 k { + } 5 0 0 k$ and $5 0 k { + } 2 3 7 k ^ { * }$ , we use a labeled batch size of 64. We also limit the number of unlabeled images used in each epoch to $1 0 0 k$ images. We use the maximum learning rate $\eta _ { 0 } = 0 . 1$ . + +CIFAR-100 ResNet $^ +$ Shake-Shake We use a total batch size of 128 for ResNet experiments with a labeled batch size of 31 in all label settings. For the settings $5 0 k { + } 5 0 0 k$ and $5 0 k { + } 2 3 7 k ^ { * }$ , we also limit the number of unlabeled images used in each epoch to $1 0 0 k$ images. We use the maximum learning rate $\eta _ { 0 } = 0 . 1$ . This applies for both the short and long schedules. + +# A.10 DOMAIN ADAPTATION + +We apply fast-SWA to the best experiment setting $\mathbf { M T + C T + T F A }$ for CIFAR-10 to STL according to French et al. (2018). This setting involves using confidence thresholding (CT) and also an augmentation scheme with translation, flipping, and affine transformation (TFA). + +We modify the optimizer to use SGD instead of Adam (Kingma and Ba, 2015) and use cosine annealing schedule with $\ell _ { 0 } = 6 0 0 , \ell = 5 5 0$ , $c = 5 0$ . We experimented with two fast-SWA methods: averaging weights once per epoch and averaging once every iteration, which is much more frequent that averaging every epoch as in the semi-supervised case. Interestingly, we found that for this task averaging the weights in the end of every iteration in fast-SWA converges significantly faster than averaging once per epoch and results in better performance. We report the results in Table 7. + +We observe that averaging every iteration converges much faster (600 epochs instead of 3000) and results in better test accuracy. In our experiments with semi-supervised learning averaging more often than once per epoch didn’t improve convergence or final results. We hypothesize that the improvement from more frequent averaging is a result of specific geometry of the loss surfaces and training trajectories in domain adaptation. We leave further analysis of applying fast-SWA to domain adaptation for future work. + +Implementation Details We use the public code3 of French et al. (2018) to train the model and apply fast-SWA. While the original implementation uses Adam (Kingma and Ba, 2015), we use stochastic gradient descent with Nesterov momentum and cosine annealing learning rate with $\ell _ { 0 } =$ $6 0 0 , \ell = 5 5 0 , c = 1 0 0$ and $k = 1 0 0$ . We use the maximum learning rate $\eta _ { 0 } = 0 . 1$ and momentum + +Table 7: Domain Adaptation from CIFAR-10 to STL. VADA results are from (Shu et al., 2018) and the original $\mathrm { S E ^ { * } }$ is from French et al. (2018). SE is the score with our implementation without fast-SWA. fast-SWA 1 performs averaging every epoch and the final result is obtained at epoch 3000. fast-SWA 2 performs the averaging every iteration and the final result is obtained at epoch 600. + +
MethodVADASE*SESE+fast-SWA1SE+fast-SWA 22
Test Error20.019.918.117.116.8
+ +0.9 with weight decay of scale $2 \times 1 0 ^ { - 4 }$ . We use the data augmentation setting $\mathbf { M T + C F + T F A }$ i n Table 1 of French et al. (2018) and apply fast-SWA. The result reported is from epoch 4000. \ No newline at end of file diff --git a/md/train/rklEj2EFvB/rklEj2EFvB.md b/md/train/rklEj2EFvB/rklEj2EFvB.md new file mode 100644 index 0000000000000000000000000000000000000000..579bc95d00b4b09cf064dfd2df07761a79e5d434 --- /dev/null +++ b/md/train/rklEj2EFvB/rklEj2EFvB.md @@ -0,0 +1,788 @@ +# ESTIMATING GRADIENTS FOR DISCRETE RANDOM VARIABLES BY SAMPLING WITHOUT REPLACEMENT + +Herke van Hoof University of Amsterdam h.c.vanhoof@uva.nl + +Wouter Kool +University of Amsterdam ORTEC +w.w.m.kool@uva.nl Max Welling +University of Amsterdam CIFAR +m.welling@uva.nl + +# ABSTRACT + +We derive an unbiased estimator for expectations over discrete random variables based on sampling without replacement, which reduces variance as it avoids duplicate samples. We show that our estimator can be derived as the RaoBlackwellization of three different estimators. Combining our estimator with REINFORCE, we obtain a policy gradient estimator and we reduce its variance using a built-in control variate which is obtained without additional model evaluations. The resulting estimator is closely related to other gradient estimators. Experiments with a toy problem, a categorical Variational Auto-Encoder and a structured prediction problem show that our estimator is the only estimator that is consistently among the best estimators in both high and low entropy settings. + +# 1 INTRODUCTION + +Put replacement in your basement! We derive the unordered set estimator1: an unbiased (gradient) estimator for expectations over discrete random variables based on (unordered sets of) samples without replacement. In particular, we consider the problem of estimating (the gradient of) the expectation of $f ( { \pmb x } )$ where $_ { \textbf { \em x } }$ has a discrete distribution $p$ over the domain $D$ , i.e. + +$$ +\mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ f ( { \pmb x } ) ] = \sum _ { { \pmb x } \in D } p ( { \pmb x } ) f ( { \pmb x } ) . +$$ + +This expectation comes up in reinforcement learning, discrete latent variable modelling (e.g. for compression), structured prediction (e.g. for translation), hard attention and many other tasks that use models with discrete operations in their computational graphs (see e.g. Jang et al. (2016)). In general, $_ { \textbf { \em x } }$ has structure (such as a sequence), but we can treat it as a ‘flat’ distribution, omitting the bold notation, so $x$ has a categorical distribution over $D$ given by $p ( x ) , x \in D$ . Typically, the distribution has parameters $\pmb { \theta }$ , which are learnt through gradient descent. This requires estimating the gradient $\nabla _ { \pmb { \theta } } \bar { \mathbb { E } } _ { \boldsymbol { x } \sim p _ { \pmb { \theta } } ( \boldsymbol { x } ) } [ f ( \boldsymbol { x } ) ]$ , using a set of samples $S$ . A gradient estimate $e ( S )$ is unbiased if + +$$ +\mathbb { E } _ { S } [ e ( S ) ] = \nabla _ { \pmb { \theta } } \mathbb { E } _ { \pmb { x } \sim p _ { \pmb { \theta } } ( \pmb { x } ) } [ f ( \pmb { x } ) ] . +$$ + +The samples $S$ can be sampled independently or using alternatives such as stratified sampling which reduce variance to increase the speed of learning. In this paper, we derive an unbiased gradient estimator that reduces variance by avoiding duplicate samples, i.e. by sampling $S$ without replacement. This is challenging as samples without replacement are dependent and have marginal distributions that are different from $p ( x )$ . We further reduce the variance by deriving a built-in control variate, which maintains the unbiasedness and does not require additional samples. + +Related work. Many algorithms for estimating gradients for discrete distributions have been proposed. A general and widely used estimator is REINFORCE (Williams, 1992). Biased gradients based on a continuous relaxations of the discrete distribution (known as Gumbel-Softmax or Concrete) were jointly introduced by Jang et al. (2016) and Maddison et al. (2016). These can be combined with the straight through estimator (Bengio et al., 2013) if the model requires discrete samples or be used to construct control variates for REINFORCE, as in REBAR (Tucker et al., 2017) or + +RELAX (Grathwohl et al., 2018). Many other methods use control variates and other techniques to reduce the variance of REINFORCE (Paisley et al., 2012; Ranganath et al., 2014; Gregor et al., 2014; Mnih & Gregor, 2014; Gu et al., 2016; Mnih & Rezende, 2016). + +Some works rely on explicit summation of the expectation, either for the marginal distribution (Titsias & Lazaro-Gredilla, 2015) or globally summing some categories while sampling from the re- ´ mainder (Liang et al., 2018; Liu et al., 2019). Other approaches use a finite difference approximation to the gradient (Lorberbom et al., 2018; 2019). Yin et al. (2019) introduced ARSM, which uses multiple model evaluations where the number adapts automatically to the uncertainty. + +In the structured prediction setting, there are many algorithms for optimizing a quantity under a sequence of discrete decisions, using (weak) supervision, multiple samples (or deterministic model evaluations), or a combination both (Ranzato et al., 2016; Shen et al., 2016; He et al., 2016; Norouzi et al., 2016; Bahdanau et al., 2017; Edunov et al., 2018; Leblond et al., 2018; Negrinho et al., 2018). Most of these algorithms are biased and rely on pretraining using maximum likelihood or gradually transitioning from supervised to reinforcement learning. Using Gumbel-Softmax based approaches in a sequential setting is difficult as the bias accumulates because of mixing errors (Gu et al., 2018). + +# 2 PRELIMINARIES + +Throughout this paper, we will denote with $B ^ { k }$ an ordered sample without replacement of size $k$ and with $S ^ { k }$ an unordered sample (of size $k$ ) from the categorical distribution $p$ . + +Restricted distribution. When sampling without replacement, we remove the set $C \subset D$ already sampled from the domain and we denote with $p ^ { D \setminus C }$ the distribution restricted to the domain $D \backslash C$ : + +$$ +p ^ { D \setminus C } ( x ) = \frac { p ( x ) } { 1 - \sum _ { c \in C } p ( c ) } , \quad x \in D \setminus C . +$$ + +Ordered sample without replacement $B ^ { k }$ . Let $B ^ { k } = ( b _ { 1 } , . . . , b _ { k } ) , b _ { i } \in D$ be an ordered sample without replacement, which is generated from the distribution $p$ as follows: first, sample $b _ { 1 } \sim p$ , then sample $b _ { 2 } \sim p ^ { D \setminus \{ b _ { 1 } \} }$ , $b _ { 3 } ^ { ^ { - } } \sim p ^ { D \setminus \{ b _ { 1 } , b _ { 2 } \} }$ , etc. i.e. elements are sampled one by one without replacement. Using this procedure, $B ^ { k }$ can be seen as a (partial) ranking according to the PlackettLuce model (Plackett, 1975; Luce, 1959) and the probability of obtaining the vector $B ^ { k }$ is + +$$ +p ( B ^ { k } ) = \prod _ { i = 1 } ^ { k } p ^ { D \setminus B ^ { i - 1 } } ( b _ { i } ) = \prod _ { i = 1 } ^ { k } \frac { p ( b _ { i } ) } { 1 - \sum _ { j < i } p ( b _ { j } ) } . +$$ + +We can also restrict $B ^ { k }$ to the domain $D \backslash C$ , which means that $b _ { i } \notin C$ for $i = 1 , . . . , k$ : + +$$ +p ^ { D \setminus C } ( B ^ { k } ) = \prod _ { i = 1 } ^ { k } { \frac { p ^ { D \setminus C } ( b _ { i } ) } { 1 - \sum _ { j < i } p ^ { D \setminus C } ( b _ { j } ) } } = \prod _ { i = 1 } ^ { k } { \frac { p ( b _ { i } ) } { 1 - \sum _ { c \in C } p ( c ) - \sum _ { j < i } p ( b _ { j } ) } } . +$$ + +Unordered sample without replacement. Let $S ^ { k } \subseteq D$ be an unordered sample without replacement from the distribution $p$ , which can be generated simply by generating an ordered sample and discarding the order. We denote elements in the sample with $s \in \breve { S } ^ { k }$ (so without index) and we write $B ( S ^ { k } )$ as the set of all $k !$ ! permutations (orderings) $\bar { B ^ { k } }$ that correspond to (could have generated) $S ^ { k }$ . It follows that the probability for sampling $S ^ { k }$ is given by: + +$$ +p ( S ^ { k } ) = \sum _ { B ^ { k } \in B ( S ^ { k } ) } p ( B ^ { k } ) = \sum _ { B ^ { k } \in B ( S ^ { k } ) } \prod _ { i = 1 } ^ { k } \frac { p ( b _ { i } ) } { 1 - \sum _ { j < i } p ( b _ { j } ) } = \left( \prod _ { s \in S ^ { k } } p ( s ) \right) \cdot \sum _ { B ^ { k } \in B ( S ^ { k } ) } \prod _ { i = 1 } ^ { k } \frac { 1 } { 1 - \sum _ { j < i } p ( b _ { j } ) } . +$$ + +The last step follows since $B ^ { k } \in B ( S ^ { k } )$ is an ordering of $S ^ { k }$ , such that $\begin{array} { r } { \prod _ { i = 1 } ^ { k } p ( b _ { i } ) = \prod _ { s \in S } p ( s ) } \end{array}$ . +Naive computation of $p ( S ^ { k } )$ is $O ( k ! )$ , but in Appendix $\mathbf { B }$ we show how to compute it efficiently. + +When sampling from the distribution restricted to $D \backslash C$ , we sample $S ^ { k } \subseteq D \setminus C$ with probability: + +$$ +p ^ { D \setminus C } ( S ^ { k } ) = \left( \prod _ { s \in S ^ { k } } p ( s ) \right) \cdot \sum _ { B ^ { k } \in \mathcal { B } ( S ^ { k } ) } \prod _ { i = 1 } ^ { k } \frac { 1 } { 1 - \sum _ { c \in C } p ( c ) - \sum _ { j < i } p ( b _ { j } ) } . +$$ + +The Gumbel-Top- $k$ trick. As an alternative to sequential sampling, we can also sample $B ^ { k }$ and $S ^ { k }$ by taking the top $k$ of Gumbel variables (Yellott, 1977; Vieira, 2014; Kim et al., 2016). Following notation from Kool et al. $( 2 0 1 9 \mathrm { c } )$ , we define the perturbed log-probability $g _ { \phi _ { i } } = \phi _ { i } + g _ { i }$ , where $\phi _ { i } = \log p ( i )$ and $g _ { i } \sim \mathrm { G u m b e l } ( 0 )$ . Then let $b _ { 1 } = \arg \operatorname* { m a x } _ { i \in D } g _ { \phi _ { i } }$ , $b _ { 2 } = \arg \operatorname* { m a x } _ { i \in D \backslash \{ b _ { 1 } \} } g _ { \phi _ { i } }$ , etc., so $B ^ { k }$ is the top $k$ of the perturbed log-probabilities in decreasing order. The probability of obtaining $B _ { k }$ using this procedure is given by equation 4, so this provides an alternative sampling method which is effectively a (non-differentiable) reparameterization of sampling without replacement. For a differentiable reparameterization, see Grover et al. (2019). + +It follows that taking the top $k$ perturbed log-probabilities without order, we obtain the unordered sample set $S ^ { k }$ . This way of sampling underlies the efficient computation of $p ( S ^ { k } )$ in Appendix B. + +# 3 METHODOLOGY + +In this section, we derive the unordered set policy gradient estimator: a low-variance, unbiased estimator of $\nabla _ { \pmb { \theta } } \mathbb { E } _ { p _ { \pmb { \theta } } ( \pmb { x } ) } [ f ( \pmb { x } ) ]$ based on an unordered sample without replacement $S ^ { k }$ . First, we derive the generic (non-gradient) estimator for $\mathbb { E } [ f ( x ) ]$ as the Rao-Blackwellized version of a single sample Monte Carlo estimator (and two other estimators!). Then we combine this estimator with REINFORCE (Williams, 1992) and we show how to reduce its variance using a built-in baseline. + +# 3.1 RAO-BLACKWELLIZATION OF THE SINGLE SAMPLE ESTIMATOR + +A very crude but simple estimator for $\mathbb { E } [ f ( x ) ]$ based on the ordered sample $B ^ { k }$ is to only use the first element $b _ { 1 }$ , which by definition is a sample from the distribution $p$ . We define this estimator as the single sample estimator, which is unbiased, since + +$$ +\begin{array} { r } { \mathbb { E } _ { B ^ { k } \sim p ( B ^ { k } ) } [ f ( b _ { 1 } ) ] = \mathbb { E } _ { b _ { 1 } \sim p ( b _ { 1 } ) } [ f ( b _ { 1 } ) ] = \mathbb { E } _ { x \sim p ( x ) } [ f ( x ) ] . } \end{array} +$$ + +Discarding all but one sample, the single sample estimator is inefficient, but we can use RaoBlackwellization (Casella $\&$ Robert, 1996) to signficantly improve it. To this end, we consider the distribution $B ^ { k } | S ^ { k }$ , which is, knowing the unordered sample $S ^ { k }$ , the conditional distribution over ordered samples $B ^ { k } \in B ( S ^ { k } )$ that could have generated $S ^ { \hat { k } }$ .2 Using $B ^ { k } | S ^ { k }$ , we rewrite $\mathbb { E } [ f ( b _ { 1 } ) ]$ as + +$$ +\begin{array} { r } { \mathbb { E } _ { B ^ { k } \sim p ( B ^ { k } ) } [ f ( b _ { 1 } ) ] = \mathbb { E } _ { S ^ { k } \sim p ( S ^ { k } ) } \left[ \mathbb { E } _ { B ^ { k } \sim p ( B ^ { k } \mid S ^ { k } ) } \left[ f ( b _ { 1 } ) \right] \right] = \mathbb { E } _ { S ^ { k } \sim p ( S ^ { k } ) } \left[ \mathbb { E } _ { b _ { 1 } \sim p ( b _ { 1 } \mid S ^ { k } ) } \left[ f ( b _ { 1 } ) \right] \right] . } \end{array} +$$ + +The Rao-Blackwellized version of the single sample estimator computes the inner conditional expectation exactly. Since $B ^ { k }$ is an ordering of $S ^ { k }$ , we have $b _ { 1 } \in S ^ { k }$ and we can compute this as + +$$ +\mathbb { E } _ { b _ { 1 } \sim p ( b _ { 1 } | S ^ { k } ) } \left[ f ( b _ { 1 } ) \right] = \sum _ { s \in S ^ { k } } P ( b _ { 1 } = s | S ^ { k } ) f ( s ) +$$ + +where, in a slight abuse of notation, $P ( b _ { 1 } = s | S ^ { k } )$ is the probability that the first sampled element $b _ { 1 }$ takes the value $s$ , given that the complete set of $k$ samples is $S ^ { k }$ . Using Bayes’ Theorem we find + +$$ +P ( b _ { 1 } = s | S ^ { k } ) = \frac { p ( S ^ { k } | b _ { 1 } = s ) P ( b _ { 1 } = s ) } { p ( S ^ { k } ) } = \frac { p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) p ( s ) } { p ( S ^ { k } ) } . +$$ + +The step $p ( S ^ { k } | b _ { 1 } = s ) = p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} )$ comes from analyzing sequential sampling without replacement: given that the first element sampled is $s$ , the remaining elements have a distribution restricted to $D \backslash \{ s \}$ , so sampling $S ^ { k }$ (including $s$ ) given the first element $s$ is equivalent to sampling the remainder $S ^ { k } \setminus \{ s \}$ from the restricted distribution, which has probability $p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} )$ (see equation 7). + +The unordered set estimator. For notational convenience, we introduce the leave-one-out ratio. +Definition 1. The leave-one-out ratio of $s$ w.r.t. the set $S$ is given by $\begin{array} { r } { R ( S ^ { k } , s ) = \frac { p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) } { p ( S ^ { k } ) } } \end{array}$ . + +Rewriting equation 10 as $P ( b _ { 1 } = s | S ^ { k } ) = p ( s ) R ( S ^ { k } , s )$ shows that the probability of sampling $s$ first, given $S ^ { k }$ , is simply the unconditional probability multiplied by the leave-one-out ratio. We now define the unordered set estimator as the Rao-Blackwellized version of the single-sample estimator. + +Theorem 1. The unordered set estimator, given by + +$$ +e ^ { U S } ( S ^ { k } ) = \sum _ { s \in S ^ { k } } p ( s ) R ( S ^ { k } , s ) f ( s ) +$$ + +is the Rao-Blackwellized version of the (unbiased!) single sample estimator. + +Proof. Using $P ( b _ { 1 } = s | S ^ { k } ) = p ( s ) R ( S ^ { k } , s )$ in equation 9 we have + +$$ +\mathbb { E } _ { b _ { 1 } \sim p ( b _ { 1 } | S ^ { k } ) } \left[ f ( b _ { 1 } ) \right] = \sum _ { s \in S ^ { k } } P ( b _ { 1 } = s | S ^ { k } ) f ( s ) = \sum _ { s \in S ^ { k } } p ( s ) R ( S ^ { k } , s ) f ( s ) . +$$ + +The implication of this theorem is that the unordered set estimator, in explicit form given by equation 11, is an unbiased estimator of $\mathbb { E } [ f ( x ) ]$ since it is the Rao-Blackwellized version of the unbiased single sample estimator. Also, as expected by taking multiple samples, it has variance equal or lower than the single sample estimator by the Rao-Blackwell Theorem (Lehmann & Scheffe, 1950). ´ + +# 3.2 RAO-BLACKWELLIZATION OF OTHER ESTIMATORS + +The unordered set estimator is also the result of Rao-Blackwellizing two other unbiased estimators: the stochastic sum-and-sample estimator and the importance-weighted estimator. + +The sum-and-sample estimator. We define as sum-and-sample estimator any estimator that relies on the identity that for any $C \subset D$ + +$$ +\mathbb { E } _ { x \sim p ( x ) } [ f ( x ) ] = \mathbb { E } _ { x \sim p ^ { D \setminus C } ( x ) } \left[ \sum _ { c \in C } p ( c ) f ( c ) + \left( 1 - \sum _ { c \in C } p ( c ) \right) f ( x ) \right] . +$$ + +For the derivation, see Appendix C.1 or Liang et al. (2018); Liu et al. (2019). In general, a sum-andsample estimator with a budget of $k > 1$ evaluations sums expectation terms for a set of categories $C$ (s.t. $| C | < k )$ explicitly (e.g. selected by their value $f$ (Liang et al., 2018) or probability $p$ (Liu et al., 2019)), and uses $k - | C |$ (down-weighted) samples from $D \backslash C$ to estimate the remaining terms. As is noted by Liu et al. (2019), selecting $C$ such that $\frac { 1 - \sum _ { c \in C } p ( c ) } { k - | C | }$ is minimized guarantees to reduce variance compared to a standard minibatch of $k$ samples (which is equivalent to setting $C = \varnothing$ ). See also Fearnhead $\&$ Clifford (2003) for a discussion on selecting $C$ optimally. The ability to optimize $C$ depends on whether $p ( c )$ can be computed efficiently a-priori (before sampling). This is difficult in high-dimensional settings, e.g. sequence models which compute the probability incrementally while ancestral sampling. An alternative is to select $C$ stochastically (as equation 13 holds for any $C$ ), and we choose $C = B ^ { k - 1 }$ to define the stochastic sum-and-sample estimator: + +$$ +e ^ { { \mathrm { S S A S } } } ( B ^ { k } ) = \sum _ { j = 1 } ^ { k - 1 } p ( b _ { j } ) f ( b _ { j } ) + \left( 1 - \sum _ { j = 1 } ^ { k - 1 } p ( b _ { j } ) \right) f ( b _ { k } ) . +$$ + +For simplicity, we consider the version that sums $k - 1$ terms here, but the following results also hold for a version that sums $k - m$ terms and uses $m$ samples (without replacement) (see Appendix C.3). Sampling without replacement, it holds that bk|Bk−1 ∼ pD\Bk−1, so the unbiasedness follows from equation 13 by separating the expectation over $B ^ { k }$ into expectations over $B ^ { k - 1 }$ and $b _ { k } | B ^ { k - 1 }$ : + +$$ +\begin{array} { r } { \mathbb { E } _ { B ^ { k - 1 } \sim p ( B ^ { k - 1 } ) } \left[ \mathbb { E } _ { b _ { k } \sim p ( b _ { k } | B ^ { k - 1 } ) } \left[ e ^ { S S A S } ( B ^ { k } ) \right] \right] = \mathbb { E } _ { B ^ { k - 1 } \sim p ( B ^ { k - 1 } ) } \left[ \mathbb { E } [ f ( x ) ] \right] = \mathbb { E } [ f ( x ) ] . } \end{array} +$$ + +In general, a sum-and-sample estimator reduces variance if the probability mass is concentrated on the summed categories. As typically high probability categories are sampled first, the stochastic sum-and-sample estimator sums high probability categories, similar to the estimator by Liu et al. (2019) which we refer to as the deterministic sum-and-sample estimator. As we show in Appendix C.2, Rao-Blackwellizing the stochastic sum-and-sample estimator also results in the unordered set estimator. This even holds for a version that uses $m$ samples and $k - m$ summed terms (see Appendix C.3), which means that the unordered set estimator has equal or lower variance than the optimal (in terms of $m$ ) stochastic sum-and-sample estimator, but conveniently does not need to choose $m$ . + +The importance-weighted estimator. The importance-weighted estimator (Vieira, 2017) is + +$$ +e ^ { \mathrm { I W } } ( S ^ { k } , \kappa ) = \sum _ { s \in S ^ { k } } { \frac { p ( s ) } { q ( s , \kappa ) } } f ( s ) . +$$ + +This estimator is based on the idea of priority sampling (Duffield et al., 2007). It does not use the order of the sample, but assumes sampling using the Gumbel-Top- $k$ trick and requires access to $\kappa$ , the $( k + 1 )$ -th largest perturbed log-probability, which can be seen as the ‘threshold’ since $g _ { \phi _ { s } } ~ > ~ \kappa ~ \forall s ~ \in ~ S ^ { k }$ . $\bar { q ( s , a ) } = P ( g _ { \phi _ { s } } > a )$ can be interpreted as the inclusion probability of $s \in S ^ { k }$ (assuming a fixed threshold $a$ instead of a fixed sample size $k$ ). For details and a proof of unbiasedness, see Vieira (2017) or Kool et al. (2019c). As the estimator has high variance, Kool et al. (2019c) resort to normalizing the importance weights, resulting in biased estimates. Instead, we use Rao-Blackwellization to eliminate stochasticity by $\kappa$ . Again, the result is the unordered set estimator (see Appendix D.1), which thus has equal or lower variance. + +# 3.3 THE UNORDERED SET POLICY GRADIENT ESTIMATOR + +Writing $p _ { \pmb { \theta } }$ to indicate the dependency on the model parameters $\pmb { \theta }$ , we can combine the unordered set estimator with REINFORCE (Williams, 1992) to obtain the unordered set policy gradient estimator. + +Corollary 1. The unordered set policy gradient estimator, given by + +$$ +e ^ { U S P G } ( S ^ { k } ) = \sum _ { s \in S ^ { k } } p _ { \theta } ( s ) R ( S ^ { k } , s ) \nabla _ { \theta } \log p _ { \theta } ( s ) f ( s ) = \sum _ { s \in S ^ { k } } \nabla _ { \theta } p _ { \theta } ( s ) R ( S ^ { k } , s ) f ( s ) , +$$ + +is an unbiased estimate of the policy gradient. + +Proof. Using REINFORCE (Williams, 1992) combined with the unordered set estimator we find: + +$$ +\nabla _ { \theta } \mathbb { E } _ { p _ { \theta } ( x ) } [ f ( x ) ] = \mathbb { E } _ { p _ { \theta } ( x ) } [ \nabla _ { \theta } \log p _ { \theta } ( x ) f ( x ) ] = \mathbb { E } _ { S ^ { k } \sim p _ { \theta } ( S ^ { k } ) } \left[ \sum _ { s \in S ^ { k } } p _ { \theta } ( s ) R ( S ^ { k } , s ) \nabla _ { \theta } \log p _ { \theta } ( s ) f ( s ) \right] . +$$ + +Variance reduction using a built-in control variate. The variance of REINFORCE can be reduced by subtracting a baseline from $f$ . When taking multiple samples (with replacement), a simple and effective baseline is to take the mean of other (independent!) samples (Mnih & Rezende, 2016). Sampling without replacement, we can use the same idea to construct a baseline based on the other samples, but we have to correct for the fact that the samples are not independent. + +Theorem 2. The unordered set policy gradient estimator with baseline, given by + +$$ +e ^ { U S P G B L } ( S ^ { k } ) = \sum _ { s \in S ^ { k } } \nabla _ { \theta } p _ { \theta } ( s ) R ( S ^ { k } , s ) \left( f ( s ) - \sum _ { s ^ { \prime } \in S ^ { k } } p _ { \theta } ( s ^ { \prime } ) R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) f ( s ^ { \prime } ) \right) , +$$ + +where + +$$ +R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) = { \frac { p _ { \theta } ^ { D \setminus \{ s , s ^ { \prime } \} } ( S ^ { k } \setminus \{ s , s ^ { \prime } \} ) } { p _ { \theta } ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) } } +$$ + +is the second order leave-one-out ratio, is an unbiased estimate of the policy gradient. + +Proof. See Appendix E.1. + +This theorem shows how to include a built-in baseline based on dependent samples (without replacement), without introducing bias. By having a built-in baseline, the value $f ( s )$ for sample $s$ is compared against an estimate of its expectation $\mathbb { E } [ f ( s ) ]$ , based on the other samples. The difference is an estimate of the advantage (Sutton & Barto, 2018), which is positive if the sample $s$ is ‘better’ than average, causing $p _ { \pmb { \theta } } ( s )$ to be increased (reinforced) through the sign of the gradient, and vice versa. By sampling without replacement, the unordered set estimator forces the estimator to compare different alternatives, and reinforces the best among them. + +Including the pathwise derivative. So far, we have only considered the scenario where $f$ does not depend on $\pmb \theta$ . If $f$ does depend on $\pmb \theta$ , for example in a VAE (Kingma & Welling, 2014; Rezende et al., 2014), then we use the notation $f _ { \theta }$ and we can write the gradient (Schulman et al., 2015) as + +$$ +\nabla _ { \pmb { \theta } } \mathbb { E } _ { p _ { \pmb { \theta } } ( \pmb { x } ) } [ f _ { \pmb { \theta } } ( \pmb { x } ) ] = \mathbb { E } _ { p _ { \pmb { \theta } } ( \pmb { x } ) } [ \nabla _ { \pmb { \theta } } \log p _ { \pmb { \theta } } ( \pmb { x } ) f _ { \pmb { \theta } } ( \pmb { x } ) + \nabla _ { \pmb { \theta } } f _ { \pmb { \theta } } ( \pmb { x } ) ] . +$$ + +The additional second (‘pathwise’) term can be estimated (using the same samples) with the standard unordered set estimator. This results in the full unordered set policy gradient estimator: + +$$ +\begin{array} { l } { { \displaystyle e ^ { \mathrm { F U S P G } } ( S ^ { k } ) = \sum _ { s \in S ^ { k } } \nabla _ { \theta } p _ { \theta } ( s ) R ( S ^ { k } , s ) f _ { \theta } ( s ) + \sum _ { s \in S ^ { k } } p _ { \theta } ( s ) R ( S ^ { k } , s ) \nabla _ { \theta } f _ { \theta } ( s ) } } \\ { { \displaystyle \quad = \sum _ { s \in S ^ { k } } R ( S ^ { k } , s ) \nabla _ { \theta } \left( p _ { \theta } ( s ) f _ { \theta } ( s ) \right) } } \end{array} +$$ + +Equation 20 is straightforward to implement using an automatic differentiation library. We can also include the baseline (as in equation 17) but we must make sure to call STOP GRADIENT (DETACH in PyTorch) on the baseline (but not on $f _ { \pmb \theta } ( s ) ! )$ . Importantly, we should never track gradients through the leave-one-out ratio $R ( S ^ { k } , s )$ which means it can be efficiently computed in pure inference mode. + +Scope & limitations. We can use the unordered set estimator for any discrete distribution from which we can sample without replacement, by treating it as a univariate categorical distribution over its domain. This includes sequence models, from which we can sample using Stochastic Beam Search (Kool et al., 2019c), as well as multivariate categorical distributions which can also be treated as sequence models (see Section 4.2). In the presence of continuous variables or a stochastic function $f$ , we may separate this stochasticity from the stochasticity over the discrete distribution, as in Lorberbom et al. (2019). The computation of the leave-one-out ratios adds some overhead, although they can be computed efficiently, even for large $k$ (see Appendix B). For a moderately sized model, the costs of model evaluation and backpropagation dominate the cost of computing the estimator. + +# 3.4 RELATION TO OTHER MULTI-SAMPLE ESTIMATORS + +Relation to Murthy’s estimator. We found out that the ‘vanilla’ unordered set estimator (equation 11) is actually a special case of the estimator by Murthy (1957), known in statistics literature for estimation of a population total $\begin{array} { r } { \Theta = \sum _ { i \in D } y _ { i } } \end{array}$ . Using $y _ { i } = p ( i ) f ( i )$ , we have $\Theta = \mathbb { E } [ f ( i ) ]$ , so Murthy’s estimator can be used to estimate expectations (see equation 11). Murthy derives the estimator by ‘unordering’ a convex combination of Raj (1956) estimators, which, using $y _ { i } = p ( i ) f ( i )$ , are stochastic sum-and-sample estimators in our analogy. + +Murthy (1957) also provides an unbiased estimator of the variance, which may be interesting for future applications. Since Murthy’s estimator can be used with arbitrary sampling distribution, it is straightforward to derive importance-sampling versions of our estimators. In particular, we can sample $S$ without replacement using $q ( x ) > 0 , x \in D$ , and use equations 11, 16, 17 and 20, as long as we compute the leave-one-out ratio $R ( S ^ { k } , s )$ using $q$ . + +While part of our derivation coincides with Murthy (1957), we are not aware of previous work using this estimator to estimate expectations. Additionally, we discuss practical computation of $p ( S )$ (Appendix B), we show the relation to the importance-weighted estimator, and we provide the extension to estimating policy gradients, especially including a built-in baseline without adding bias. + +Relation to the empirical risk estimator. The empirical risk loss (Edunov et al., 2018) estimates the expectation in equation 1 by summing only a subset $S$ of the domain, using normalized probabilities $\begin{array} { r } { \hat { p } _ { \pmb { \theta } } ( s ) = \frac { \bar { p } _ { \pmb { \theta } } ( s ) } { \sum _ { s ^ { \prime } \in S } p _ { \pmb { \theta } } ( s ) } } \end{array}$ . Using this loss, the (biased) estimate of the gradient is given by + +$$ +e ^ { \mathrm { R I S K } } ( S ^ { k } ) = \sum _ { s \in S ^ { k } } \nabla _ { \pmb { \theta } } \left( \frac { p _ { \pmb { \theta } } ( s ) } { \sum _ { s ^ { \prime } \in S ^ { k } } p _ { \pmb { \theta } } ( s ^ { \prime } ) } \right) f ( s ) . +$$ + +The risk estimator is similar to the unordered set policy gradient estimator, with two important differences: 1) the individual terms are normalized by the total probability mass rather than the leave-one-out ratio and 2) the gradient w.r.t. the normalization factor is taken into account. As a result, samples ‘compete’ for probability mass and only the best can be reinforced. This has the same effect as using a built-in baseline, which we prove in the following theorem. + +Theorem 3. By taking the gradient w.r.t. the normalization factor into account, the risk estimator has a built-in baseline, which means it can be written as + +$$ +e ^ { R I S K } ( S ^ { k } ) = \sum _ { s \in S ^ { k } } \nabla _ { \theta } p _ { \theta } ( s ) \frac { 1 } { \sum _ { s ^ { \prime \prime } \in S ^ { k } } p _ { \theta } ( s ^ { \prime \prime } ) } \left( f ( s ) - \sum _ { s ^ { \prime } \in S ^ { k } } p _ { \theta } ( s ^ { \prime } ) \frac { 1 } { \sum _ { s ^ { \prime \prime } \in S ^ { k } } p _ { \theta } ( s ^ { \prime \prime } ) } f ( s ^ { \prime } ) \right) . +$$ + +Proof. See Appendix F.1 + +This theorem highlights the similarity between the biased risk estimator and our unbiased estimator (equation 17), and suggests that their only difference is the weighting of terms. Unfortunately, the implementation by Edunov et al. (2018) has more sources of bias (e.g. length normalization), which are not compatible with our estimator. However, we believe that our analysis helps analyze the bias of the risk estimator and is a step towards developing unbiased estimators for structured prediction. + +Relation to VIMCO. VIMCO (Mnih & Rezende, 2016) is an estimator that uses $k$ samples (with replacement) to optimize an objective of the form log $\textstyle { \frac { 1 } { k } } \sum _ { i } f ( x _ { i } )$ , which is a multi-sample stochastic lower bound in the context of variational inference. VIMCO reduces the variance by using a local baseline for each of the $k$ samples, based on the other $k - 1$ samples. While we do not have a log term, as our goal is to optimize general $\mathbb { E } [ f ( x ) ]$ , we adopt the idea of forming a baseline based on the other samples, and we define REINFORCE with replacement (with built-in baseline) as the estimator that computes the gradient estimate using samples with replacement $X ^ { k } = ( x _ { 1 } , . . . , x _ { k } )$ as + +$$ +e ^ { \mathrm { R F W R } } ( X ^ { k } ) = \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \nabla _ { \theta } \log p _ { \theta } ( x _ { i } ) \left( f ( x _ { i } ) - \frac { 1 } { k - 1 } \sum _ { j \ne i } f ( x _ { j } ) \right) . +$$ + +This estimator is unbiased, as $\mathbb { E } _ { x _ { i } , x _ { j } } [ \nabla _ { \pmb { \theta } } \log p _ { \pmb { \theta } } ( x _ { i } ) f ( x _ { j } ) ] = 0$ for $i \neq j$ (see also Kool et al. (2019b)). We think of the unordered set estimator as the without-replacement version of this estimator, which weights terms by $p _ { \pmb { \theta } } ( s ) R ( S ^ { k } , s )$ instead of $\frac { 1 } { k }$ . This puts more weight on higher probability elements to compensate for sampling without replacement. If probabilities are small and (close to) uniform, there are (almost) no duplicate samples and the weights will be close to $\frac { 1 } { k }$ , so the gradient estimate of the with- and without-replacement versions are similar. + +Relation to ARSM. ARSM (Yin et al., 2019) also uses multiple evaluations (‘pseudo-samples’) of $p _ { \theta }$ and $f$ . This can be seen as similar to sampling without replacement, and the estimator also has a built-in control variate. Compared to ARSM, our estimator allows direct control over the computational cost (through the sample size $k$ ) and has wider applicability, for example it also applies to multivariate categorical variables with different numbers of categories per dimension. + +Relation to stratified/systematic sampling. Our estimator aims to reduce variance by changing the sampling distribution for multiple samples by sampling without replacement. There are alternatives, such as using stratified or systematic sampling (see, e.g. Douc & Cappe (2005)). Both partition ´ the domain $D$ into $k$ strata and take a single sample from each stratum, where systematic sampling uses common random numbers for each stratum. In applications involving high-dimensional or structured domains, it is unclear how to partition the domain and how to sample from each partition. Additionally, as samples are not independent, it is non-trivial to include a built-in baseline, which we find is a key component that makes our estimator perform well. + +![](images/1827e94fdb564b2088e10a208547d35fffe208d74d3041a8d194d3868ada9f35.jpg) +Figure 1: Bernoulli gradient variance (on log scale) as a function of the number of model evaluations (including baseline evaluations, so the sum-and-sample estimators with sampled baselines use twice as many evaluations). Note that for some estimators, the variance is 0 (log variance $- \infty )$ for $k = 8$ . + +# 4 EXPERIMENTS + +# 4.1 BERNOULLI TOY EXPERIMENT + +We use the code by Liu et al. (2019) to reproduce their Bernoulli toy experiment. Given a vector $\mathbf { p } =$ (0.6, 0.51, 0.48) the goal is to minimize the loss $\begin{array} { r } { \mathcal { L } ( \eta ) \ : = \ : \mathbb { E } _ { x _ { 1 } , x _ { 2 } , x _ { 3 } \sim \mathrm { B e r n } ( \sigma ( \eta ) ) } \left[ \sum _ { i = 1 } ^ { 3 } ( x _ { i } - p _ { i } ) ^ { 2 } \right] } \end{array}$ . Here $x _ { 1 } , x _ { 2 } , x _ { 3 }$ are i.i.d. from the Bernoulli $( \sigma ( \eta ) )$ distribution, parameterized by a scalar $\eta \in \mathbb { R }$ , where $\sigma ( \eta ) = ( 1 + \exp ( - \eta ) ) ^ { - 1 }$ is the sigmoid function. We compare different estimators, with and without baseline (either ‘built-in’ or using additional samples, referred to as REINFORCE+ in Liu et al. (2019)). We report the (log-)variance of the scalar gradient $\frac { \partial \mathcal { L } } { \partial \eta }$ as a function of the number of model evaluations, which is twice as high when using a sampled baseline (for each term). + +As can be seen in Figure 1, the unordered set estimator is the only estimator that has consistently the lowest (or comparable) variance in both the high $\langle \eta = 0 \rangle$ ) and low entropy $\hphantom { - } \eta = - 4 )$ regimes and for different number of samples/model evaluations. This suggests that it combines the advantages of the other estimators. We also ran the actual optimization experiment, where with as few as $k = 3$ samples the trajectory was indistinguishable from using the exact gradient (see Liu et al. (2019)). + +# 4.2 CATEGORICAL VARIATIONAL AUTO-ENCODER + +We use the code from Yin et al. (2019) to train a categorical Variational Auto-Encoder (VAE) with 20 dimensional latent space, with 10 categories per dimension (details in Appendix G.1). To use our estimator, we treat this as a single factorized distribution with $1 0 ^ { 2 0 }$ categories from which we can sample without replacement using Stochastic Beam Search (Kool et al., 2019c), sequentially sampling each dimension as if it were a sequence model. We also perform experiments with $1 0 ^ { \dot { 2 } }$ latent space, which provides a lower entropy setting, to highlight the advantage of our estimator. + +Measuring the variance. In Table 1, we report the variance of different gradient estimators with $k = 4$ samples, evaluated on a trained model. The unordered set estimator has the lowest variance in both the small and large domain (low and high entropy) setting, being on-par with the best of the (stochastic3) sum-and-sample estimator and REINFORCE with replacement4. This confirms the toy experiment, suggesting that the unordered set estimator provides the best of both estimators. In Appendix G.2 we repeat the same experiment at different stages of training, with similar results. + +![](images/38fff474333f745080d8627c5fb4566e88f353059b7a66955110f7f26afb9b13.jpg) +Figure 2: VAE smoothed training curves (-ELBO) of two independent runs when training with different estimators with $k = 1$ , 4 or 8 (thicker lines) samples (ARSM has a variable number). Some lines coincide, so we sort the legend by the lowest -ELBO achieved and report this value. + +ELBO optimization. We use different estimators to optimize the ELBO (details in Appendix G.1). Additionally to the baselines by Yin et al. (2019) we compare against REINFORCE with replacement and the stochastic sum-and-sample estimator. In Figure 2 we observe that our estimator performs on par with REINFORCE with replacement (and built-in baseline, equation 23) and outperforms other estimators in at least one of the settings. There are a lot of other factors, e.g. exploration that may explain why we do not get a strictly better result despite the lower variance. We note some overfitting (see validation curves in Appendix G.2), but since our goal is to show improved optimization, and to keep results directly comparable to Yin et al. (2019), we consider regularization a separate issue outside the scope of this paper. These results are using MNIST binarized by a threshold of 0.5. In Appendix G.2 we report results using the standard binarized MNIST dataset from Salakhutdinov & Murray (2008). + +# 4.3 STRUCTURED PREDICTION FOR THE TRAVELLING SALESMAN PROBLEM + +To show the wide applicability of our estimator, we consider the structured prediction task of predicting routes (sequences) for the Travelling Salesman Problem (TSP) (Vinyals et al., 2015; Bello et al., 2016; Kool et al., 2019a). We use the code by Kool et al. (2019a)5 to reproduce their TSP experiment with 20 nodes. For details, see Appendix H. + +We implement REINFORCE with replacement (and built-in baseline) as well as the stochastic sumand-sample estimator and our estimator, using Stochastic Beam Search (Kool et al., 2019c) for sampling. Also, we include results using the biased normalized importance-weighted policy gradient estimator with built-in baseline (derived in Kool et al. (2019b), see Appendix D.2). Additionally, we compare against REINFORCE with greedy rollout baseline (Rennie et al., 2017) used by Kool et al. (2019c) and a batch-average baseline. For reference, we also include the biased risk estimator, either ‘sampling’ using stochastic or deterministic beam search (as in Edunov et al. (2018)). + +In Figure 3a, we compare training progress (measured on the validation set) as a function of the number of training steps, where we divide the batch size by $k$ to keep the total number of samples equal. Our estimator outperforms REINFORCE with replacement, the stochastic sum-and-sample estimator and the strong greedy rollout baseline (which uses additional baseline model evaluations) and performs on-par with the biased risk estimator. In Figure 3b, we plot the same results against the number of instances, which shows that, compared to the single sample estimators, we can train with less data and less computational cost (as we only need to run the encoder once for each instance). + +![](images/3cf7aa8c67e64f59fc3b77ff931ff72bff898a29559db5fa6f7eddaa573687f1.jpg) +Figure 3: TSP validation set optimality gap measured during training. Raw results are light, smoothed results are darker (2 random seeds). We compare our estimator against different unbiased and biased (dotted) multi-sample estimators and against single-sample REINFORCE, with batch-average or greedy rollout baseline. + +# 5 DISCUSSION + +We introduced the unordered set estimator, a low-variance, unbiased gradient estimator based on sampling without replacement, which can be used as an alternative to the popular biased GumbelSoftmax estimator (Jang et al., 2016; Maddison et al., 2016). Our estimator is the result of RaoBlackwellizing three existing estimators, which guarantees equal or lower variance, and is closely related to a number of other estimators. It has wide applicability, is parameter free (except for the sample size $k$ ) and has competitive performance to the best of alternatives in both high and low entropy regimes. + +In our experiments, we found that REINFORCE with replacement, with multiple samples and a built-in baseline as inspired by VIMCO (Mnih & Rezende, 2016), is a simple yet strong estimator which has performance similar to our estimator in the high entropy setting. We are not aware of any recent work on gradient estimators for discrete distributions that has considered this estimator as baseline, while it may be often preferred given its simplicity. In future work, we want to investigate if we can apply our estimator to estimate gradients ‘locally’ (Titsias & Lazaro-Gredilla, 2015), as ´ locally we have a smaller domain and expect more duplicate samples. + +# ACKNOWLEDGMENTS + +This research was funded by ORTEC. We would like to thank anonymous reviewers for their feedback that helped improve the paper. + +# REFERENCES + +Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. An actor-critic algorithm for sequence prediction. In International Conference on Learning Representations, 2017. + +Irwan Bello, Hieu Pham, Quoc V Le, Mohammad Norouzi, and Samy Bengio. Neural combinatorial optimization with reinforcement learning. arXiv preprint arXiv:1611.09940, 2016. + +Yoshua Bengio, Nicholas Leonard, and Aaron Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013. + +George Casella and Christian P Robert. Rao-Blackwellisation of sampling schemes. Biometrika, 83 (1):81–94, 1996. + +Randal Douc and Olivier Cappe. Comparison of resampling schemes for particle filtering. In ´ ISPA 2005. Proceedings of the 4th International Symposium on Image and Signal Processing and Analysis, 2005., pp. 64–69. IEEE, 2005. + +Nick Duffield, Carsten Lund, and Mikkel Thorup. Priority sampling for estimation of arbitrary subset sums. Journal of the ACM (JACM), 54(6):32, 2007. + +Sergey Edunov, Myle Ott, Michael Auli, David Grangier, et al. Classical structured prediction losses for sequence to sequence learning. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), volume 1, pp. 355–364, 2018. + +Paul Fearnhead and Peter Clifford. On-line inference for hidden markov models via particle filters. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 65(4):887–899, 2003. + +Will Grathwohl, Dami Choi, Yuhuai Wu, Geoffrey Roeder, and David Duvenaud. Backpropagation through the void: Optimizing control variates for black-box gradient estimation. In International Conference on Learning Representations, 2018. + +Karol Gregor, Ivo Danihelka, Andriy Mnih, Charles Blundell, and Daan Wierstra. Deep autoregressive networks. In International Conference on Machine Learning, pp. 1242–1250, 2014. + +Aditya Grover, Eric Wang, Aaron Zweig, and Stefano Ermon. Stochastic optimization of sorting networks via continuous relaxations. In International Conference on Learning Representations, 2019. + +Jiatao Gu, Daniel Jiwoong Im, and Victor OK Li. Neural machine translation with Gumbel-greedy decoding. In Thirty-Second AAAI Conference on Artificial Intelligence (AAAI), 2018. + +Shixiang Gu, Sergey Levine, Ilya Sutskever, and Andriy Mnih. Muprop: Unbiased backpropagation for stochastic neural networks. In International Conference on Learning Representations, 2016. + +Di He, Yingce Xia, Tao Qin, Liwei Wang, Nenghai Yu, Tie-Yan Liu, and Wei-Ying Ma. Dual learning for machine translation. In Advances in Neural Information Processing Systems, pp. 820–828, 2016. + +Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In International Conference on Learning Representations, 2016. + +Carolyn Kim, Ashish Sabharwal, and Stefano Ermon. Exact sampling with integer linear programs and random perturbations. In Thirtieth AAAI Conference on Artificial Intelligence, 2016. + +Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015. + +Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In International Conference on Learning Representations, 2014. + +Wouter Kool, Herke van Hoof, and Max Welling. Attention, learn to solve routing problems! In International Conference on Learning Representations, 2019a. + +Wouter Kool, Herke van Hoof, and Max Welling. Buy 4 reinforce samples, get a baseline for free! In Deep Reinforcement Learning Meets Structured Prediction Workshop at the International Conference on Learning Representations, 2019b. + +Wouter Kool, Herke Van Hoof, and Max Welling. Stochastic beams and where to find them: The gumbel-top-k trick for sampling sequences without replacement. In International Conference on Machine Learning, pp. 3499–3508, 2019c. + +Hugo Larochelle and Iain Murray. The neural autoregressive distribution estimator. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 29–37, 2011. + +Remi Leblond, Jean-Baptiste Alayrac, Anton Osokin, and Simon Lacoste-Julien. Searnn: Training ´ RNNs with global-local losses. In 6th International Conference on Learning Representations, 2018. + +EL Lehmann and Henry Scheffe. Completeness, similar regions, and unbiased estimation: Part i. ´ Sankhya: The Indian Journal of Statistics ¯ , pp. 305–340, 1950. + +Chen Liang, Mohammad Norouzi, Jonathan Berant, Quoc V Le, and Ni Lao. Memory augmented policy optimization for program synthesis and semantic parsing. In Advances in Neural Information Processing Systems, pp. 9994–10006, 2018. + +Runjing Liu, Jeffrey Regier, Nilesh Tripuraneni, Michael Jordan, and Jon Mcauliffe. RaoBlackwellized stochastic gradients for discrete distributions. In International Conference on Machine Learning, pp. 4023–4031, 2019. + +Guy Lorberbom, Andreea Gane, Tommi Jaakkola, and Tamir Hazan. Direct optimization through argmax for discrete variational auto-encoder. arXiv preprint arXiv:1806.02867, 2018. + +Guy Lorberbom, Chris J Maddison, Nicolas Heess, Tamir Hazan, and Daniel Tarlow. Direct policy gradients: Direct optimization of policies in discrete action spaces. arXiv preprint arXiv:1906.06062, 2019. + +R Duncan Luce. Individual choice behavior: A theoretical analysis. John Wiley, 1959. + +Chris J Maddison, Daniel Tarlow, and Tom Minka. A\* sampling. In Advances in Neural Information Processing Systems, pp. 3086–3094, 2014. + +Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In International Conference on Learning Representations, 2016. + +Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. In International Conference on Machine Learning, pp. 1791–1799, 2014. + +Andriy Mnih and Danilo Rezende. Variational inference for Monte Carlo objectives. In International Conference on Machine Learning, pp. 2188–2196, 2016. + +MN Murthy. Ordered and unordered estimators in sampling without replacement. Sankhya: The ¯ Indian Journal of Statistics (1933-1960), 18(3/4):379–390, 1957. + +Renato Negrinho, Matthew Gormley, and Geoffrey J Gordon. Learning beam search policies via imitation learning. In Advances in Neural Information Processing Systems, pp. 10673–10682, 2018. + +Mohammad Norouzi, Samy Bengio, Navdeep Jaitly, Mike Schuster, Yonghui Wu, Dale Schuurmans, et al. Reward augmented maximum likelihood for neural structured prediction. In Advances In Neural Information Processing Systems, pp. 1723–1731, 2016. + +John Paisley, David M Blei, and Michael I Jordan. Variational Bayesian inference with stochastic search. In International Conference on Machine Learning, pp. 1363–1370, 2012. + +Robin L Plackett. The analysis of permutations. Journal of the Royal Statistical Society: Series C (Applied Statistics), 24(2):193–202, 1975. + +Des Raj. Some estimators in sampling with varying probabilities without replacement. Journal of the American Statistical Association, 51(274):269–284, 1956. + +Rajesh Ranganath, Sean Gerrish, and David Blei. Black box variational inference. In Artificial Intelligence and Statistics, pp. 814–822, 2014. + +Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. In International Conference on Learning Representations, 2016. + +Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. Self-critical sequence training for image captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7008–7024, 2017. + +Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pp. 1278–1286, 2014. + +Geoffrey Roeder, Yuhuai Wu, and David K Duvenaud. Sticking the landing: Simple, lower-variance gradient estimators for variational inference. In Advances in Neural Information Processing Systems, pp. 6925–6934, 2017. + +Ruslan Salakhutdinov and Iain Murray. On the quantitative analysis of deep belief networks. In International Conference on Machine Learning, pp. 872–879, 2008. + +John Schulman, Nicolas Heess, Theophane Weber, and Pieter Abbeel. Gradient estimation using stochastic computation graphs. In Advances in Neural Information Processing Systems, pp. 3528– 3536, 2015. + +Shiqi Shen, Yong Cheng, Zhongjun He, Wei He, Hua Wu, Maosong Sun, and Yang Liu. Minimum risk training for neural machine translation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 1683–1692, 2016. + +Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018. + +Michalis K Titsias and Miguel Lazaro-Gredilla. Local expectation gradients for black box varia- ´ tional inference. In Advances in Neural Information Processing Systems-Volume 2, pp. 2638– 2646, 2015. + +George Tucker, Andriy Mnih, Chris J Maddison, John Lawson, and Jascha Sohl-Dickstein. Rebar: Low-variance, unbiased gradient estimates for discrete latent variable models. In Advances in Neural Information Processing Systems, pp. 2627–2636, 2017. + +Tim Vieira. Gumbel-max trick and weighted reservoir sampling, 2014. URL https://timvieira.github.io/blog/post/2014/08/01/ gumbel-max-trick-and-weighted-reservoir-sampling/. + +Tim Vieira. Estimating means in a finite universe, 2017. URL https://timvieira.github. io/blog/post/2017/07/03/estimating-means-in-a-finite-universe/. + +Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015. + +Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992. + +John I Yellott. The relationship between Luce’s choice axiom, Thurstone’s theory of comparative judgment, and the double exponential distribution. Journal of Mathematical Psychology, 15(2): 109–144, 1977. + +Mingzhang Yin, Yuguang Yue, and Mingyuan Zhou. Arsm: Augment-reinforce-swap-merge estimator for gradient backpropagation through categorical variables. In International Conference on Machine Learning, pp. 7095–7104, 2019. + +# A NOTATION + +Throughout this appendix we will use the following notation from Maddison et al. (2014): + +$$ +\begin{array} { l } { { e _ { \phi } ( g ) = \exp ( - g + \phi ) } } \\ { { F _ { \phi } ( g ) = \exp ( - \exp ( - g + \phi ) ) } } \\ { { f _ { \phi } ( g ) = e _ { \phi } ( g ) F _ { \phi } ( g ) . } } \end{array} +$$ + +This means that $F _ { \phi } ( g )$ is the CDF and $f _ { \phi } ( g )$ the PDF of the Gumbel $\left( \phi \right)$ distribution. Additionally we will use the identities by Maddison et al. (2014): + +$$ +\begin{array} { c } { { F _ { \phi } ( g ) F _ { \gamma } ( g ) = F _ { \log ( \exp ( \phi ) + \exp ( \gamma ) ) } ( g ) } } \\ { { \displaystyle \int _ { g = a } ^ { b } e _ { \gamma } ( g ) F _ { \phi } ( g ) \partial g = ( F _ { \phi } ( b ) - F _ { \phi } ( a ) ) \frac { \exp ( \gamma ) } { \exp ( \phi ) } . } } \end{array} +$$ + +Also, we will use the following notation, definitions and identities (see Kool et al. (2019c)): + +$$ +\begin{array} { r l } & { \displaystyle \phi _ { i } = \log p ( i ) } \\ & { \displaystyle \phi _ { S } = \log \displaystyle \sum _ { i \in S } p ( i ) = \log \sum _ { i \in S } \exp \phi _ { i } } \\ & { \displaystyle \phi _ { D \setminus S } = \log \sum _ { i \in D \setminus S } p ( i ) = \log \left( 1 - \sum _ { i \in S } p ( i ) \right) = \log ( 1 - \exp ( \phi _ { S } ) ) } \\ & { \displaystyle { G _ { \phi _ { i } } \sim \mathrm { G u m b e l } ( \phi _ { i } ) } } \\ & { \displaystyle { G _ { \phi _ { S } } = \sum _ { i \in S } G _ { \phi _ { i } } \sim \mathrm { G u m b e l } ( \phi _ { S } ) } } \end{array} +$$ + +For a proof of equation 30, see Maddison et al. (2014). + +$$ +p ( S ^ { k } ) , p ^ { D \setminus C } ( S \setminus C ) \ \mathrm { A N D } \ R ( S ^ { k } , s ) +$$ + +We can sample the set $S ^ { k }$ from the Plackett-Luce distribution using the Gumbel-Top- $k$ trick by drawing Gumbel variables $G _ { \phi _ { i } } \sim \mathrm { G u m b e l } ( \phi _ { i } )$ for each element and returning the indices of the $k$ largest Gumbels. If we ignore the ordering, this means we will obtain the set $S ^ { k }$ if $\mathrm { m i n } _ { i \in S ^ { k } } G _ { \phi _ { i } } >$ $\operatorname* { m a x } _ { i \in D \setminus S ^ { k } } G _ { \phi _ { i } }$ . Omitting the superscript $k$ for clarity, we can use the Gumbel-Max trick, i.e. that $G _ { \phi _ { D \setminus S } } = \operatorname* { m a x } _ { i \notin S } G _ { \phi _ { i } } \sim \mathrm { G u m b e l } ( \phi _ { D \setminus S } )$ (equation 30) and marginalize over $G _ { \phi _ { D \setminus S } }$ : + +$$ +\begin{array} { r l } { \displaystyle p ( S ) = P ( \underset { i \in S } { \operatorname* { m i n } } G _ { \phi _ { i } \setminus } \ G _ { \phi _ { D \setminus S } } ) } \\ { \displaystyle } & { = P ( G _ { \phi _ { i } } > G _ { \phi _ { D \setminus S } } , i \in S ) } \\ { \displaystyle } & { = \int _ { g _ { \phi _ { D \setminus S } } = - \infty } ^ { \infty } f _ { \phi _ { D \setminus S } } ( g _ { \phi _ { D \setminus S } } ) P ( G _ { \phi _ { i } } > g _ { \phi _ { D \setminus S } } , i \in S ) \partial g _ { \phi _ { D \setminus S } } } \\ { \displaystyle } & { = \int _ { g _ { \phi _ { D \setminus S } } = - \infty } ^ { \infty } f _ { \phi _ { D \setminus S } } ( g _ { \phi _ { D \setminus S } } ) \prod _ { i \in S } \left( 1 - F _ { \phi _ { \star } } ( g _ { \phi _ { D \setminus S } } ) \right) \partial g _ { \phi _ { D \setminus S } } } \\ { \displaystyle } & { = \int _ { u = 0 } ^ { 1 } \prod _ { i \in S } \left( 1 - F _ { \phi _ { i } } \left( F _ { \phi _ { D \setminus S } } ^ { - 1 } ( u ) \right) \right) \partial u } \end{array} +$$ + +Here we have used a change of variables $u = F _ { \phi _ { D \setminus S } } ( g _ { \phi _ { D \setminus S } } )$ . This expression can be efficiently numerically integrated (although another change of variables may be required for numerical stability depending on the values of $\phi$ ). + +Exact computation in $O ( 2 ^ { k } )$ . The integral in equation 31 can be computed exactly using the identity + +$$ +\prod _ { i \in S } ( a _ { i } - b _ { i } ) = \sum _ { C \subseteq S } ( - 1 ) ^ { | C | } \prod _ { i \in C } b _ { i } \prod _ { i \in S \setminus C } a _ { i } +$$ + +which gives + +$$ +\begin{array} { r l } { { \mu ( S ) = \int _ { s _ { \phi ( S ) - } - \infty } ^ { \infty } \longrightarrow \int _ { \partial \sigma _ { \phi ( S ) } } \bigl ( g _ { \phi ( S ) , s } \bigr ) \prod ( 1 - F _ { \phi _ { \phi } } ( g _ { \phi ( S ) , s } ) ) \partial g _ { \phi _ { \phi ( S ) , s } } } } \\ & { = \sum _ { c \in S } ^ { \infty } ( - 1 ) ^ { C } \big | \int _ { s _ { \phi ( S ) - } - \infty } ^ { \infty } \int _ { \Phi _ { \phi ( S ) - } ( \partial g _ { \phi ( S ) - } ) } \prod \int _ { s _ { \phi } } F _ { \phi _ { \phi } } ( g _ { \phi ( S ) - s } ) \prod \big | \partial g _ { \phi _ { \phi ( S ) - } s } } \\ & { = \sum _ { c \in S } ^ { \infty } ( - 1 ) ^ { C } \big | \int _ { s _ { \phi ( S ) - } - \infty } ^ { \infty } e _ { \phi _ { \phi ( S ) - } ( \partial g _ { \phi ( S ) - } ) } F _ { \phi _ { \phi _ { \phi ( S ) - } s } } ( g _ { \phi _ { S } , s } ) F _ { \phi _ { \phi ( S ) - } } ( g _ { \phi _ { S } , s } ) \big | \mathcal { P } _ { \phi _ { \phi ( S ) - } } \big | \mathcal { P } _ { \phi _ { \phi ( S ) - } } \big | \mathcal { P } _ { \phi _ { \phi ( S ) - } } } \\ & { = \sum _ { c \in S } ^ { \infty } ( - 1 ) ^ { C } \big | \int _ { s _ { \phi ( S ) - } - \infty } ^ { \infty } e _ { \phi _ { \phi ( S ) - } ( \partial g _ { \phi ( S ) - } ) } F _ { \phi _ { \phi ( S ) - } , \phi _ { \phi ( S ) - } } ( g _ { \phi _ { S } , s } ) \big | \partial g _ { \phi _ { \phi ( S ) - } } } \\ & { = \sum _ { c \in S } ^ { \infty } ( - 1 ) ^ { C } ( 1 - 0 ) \frac { \exp ( \phi _ { \phi ( S ) - } ) } { \exp ( \phi _ { \phi ( S ) - } ) } } \\ & { = \sum _ { c \in S } ^ { \infty } ( - 1 ) ^ { C } ( 1 - 0 ) \exp ( \phi _ { \phi ( S ) - } ) } \\ & = \sum _ { c \in S } ^ { \infty } ( - 1 ) ^ { C } ( 1 - \sum \end{array} +$$ + +Computation of $p ^ { D \setminus C } ( S \setminus C )$ . When using the Gumbel-Top- $k$ trick over the restricted domain $D \backslash C$ , we do not need to renormalize the log-probabilities $\phi _ { s } , s \in D \setminus C$ since the Gumbel-Top- $k$ trick applies to unnormalized log-probabilities. Also, assuming $C \subseteq S ^ { k }$ , it holds that $\left( D \backslash C \right) \backslash ( \mathbf { \bar { S } } )$ $C ) = D \backslash S$ . This means that we can compute $p ^ { D \setminus C } ( S \setminus C )$ similar to equation 31: + +$$ +\begin{array} { r l } { \displaystyle p ^ { D \setminus C } ( S \setminus C ) = P ( \underset { i \in S \backslash C } { \mathrm { m i n } } G _ { \phi _ { i } } > G _ { \phi _ { ( D \setminus C ) \setminus ( S \setminus C ) } } ) } & { } \\ { = P ( \underset { i \in S \backslash C } { \mathrm { m i n } } G _ { \phi _ { i } } > G _ { \phi _ { D \setminus S } } ) } & { } \\ { = \displaystyle \int _ { g _ { \phi _ { D \setminus S } } = - \infty } ^ { \infty } f _ { \phi _ { D \setminus S } } \big ( g _ { \phi _ { D \setminus S } } \big ) \prod _ { i \in S \backslash C } \left( 1 - F _ { \phi _ { i } } \big ( g _ { \phi _ { D \setminus S } } \big ) \right) \partial g _ { \phi _ { D \setminus S } } . } \end{array} +$$ + +Computation of $R ( S ^ { k } , s )$ . Note that, using equation 10, it holds that + +$$ +\sum _ { s \in S ^ { k } } { \frac { p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) p ( s ) } { p ( S ^ { k } ) } } = \sum _ { s \in S ^ { k } } P ( b _ { 1 } = s | S ^ { k } ) = 1 +$$ + +from which it follows that + +$$ +p ( S ^ { k } ) = \sum _ { s \in S ^ { k } } p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) p ( s ) +$$ + +such that + +$$ +R ( S ^ { k } , s ) = { \frac { p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) } { p ( S ^ { k } ) } } = { \frac { p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) } { \sum _ { s ^ { \prime } \in S ^ { k } } p ^ { D \setminus \{ s ^ { \prime } \} } ( S ^ { k } \setminus \{ s ^ { \prime } \} ) p ( s ^ { \prime } ) } } . +$$ + +This means that, to compute the leave-one-out ratio for all $s ~ \in ~ S ^ { k }$ , we only need to compute $p ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} )$ for $s \in S ^ { k }$ . When using the numerical integration or summation in $O ( 2 ^ { k } )$ , we can reuse computation, whereas using the naive method, the cost is $O ( k \cdot ( k - 1 ) ! ) = O ( k ! )$ , making the total computational cost comparable to computing just $p ( S ^ { k } )$ , and the same holds when computing the ‘second-order’ leave one out ratios for the built-in baseline (equation 17). + +Details of numerical integration. For computation of the leave-one-out ratio (equation 35) for large $k$ we can use the numerical integration, where we need to compute equation 34 with $C = \{ s \}$ . For this purpose, we rewrite the integral as + +$$ +\begin{array} { l } { \displaystyle p ^ { D \setminus C } ( S \setminus C ) = \int _ { \phi _ { \partial \setminus \mathcal { D } } \setminus \phi = - \phi } ^ { \phi _ { \partial \setminus \mathcal { D } } } f _ { \phi _ { D \setminus \mathcal { D } } } ( g _ { \phi \phi _ { D \setminus \mathcal { D } } } , s ) \prod _ { i \in S \setminus \mathcal { C } } \left( 1 - F _ { \phi _ { i } } ( g _ { \phi _ { D \setminus i } } , s ) \right) \partial g _ { \phi _ { D \setminus i } } } \\ { \displaystyle \qquad = \int _ { u = 0 } ^ { 1 } \prod _ { i \in S \setminus \mathcal { C } } \Big ( 1 - F _ { \phi _ { i } } \Big ( F _ { \phi _ { D \setminus i } } ^ { - 1 } \Big ( u \Big ) \Big ) \Big ) \partial u } \\ { \displaystyle \qquad = \int _ { u = 0 } ^ { 1 } \prod _ { i \in S \setminus \mathcal { C } } \Big ( 1 - u ^ { \alpha \setminus \phi _ { i } ( \phi _ { i } - \phi _ { D \setminus i } ) s } \Big ) \partial u } \\ { \displaystyle \qquad = \exp ( b ) \cdot \int _ { v = 0 } ^ { 1 } v ^ { \alpha \setminus \phi _ { i } ( b ) - 1 } \prod _ { i \in S \setminus \mathcal { C } } \Big ( 1 - v ^ { \alpha \setminus \Phi _ { i } ( \phi _ { i } - \phi _ { D \setminus i } - \phi _ { i } ) } \Big ) \partial v } \\ { \displaystyle \qquad = \exp ( a + \phi _ { D \setminus S } ) \cdot \int _ { v = 0 } ^ { 1 } v ^ { \alpha \setminus \Phi _ { i } ( \phi _ { i } + \phi _ { D \setminus i } - s ) - 1 } \prod _ { i \in S \setminus \mathcal { C } } \Big ( 1 - v ^ { \alpha \setminus \Phi _ { i } ( \phi _ { i } + s ) } \Big ) \partial v } \\ { \displaystyle \qquad = \exp ( a + \phi _ { D \setminus \mathcal { D } } ) \cdot \int _ { v = 0 } ^ { 1 } v ^ { \alpha \setminus \Phi _ { i } ( \phi _ { i } + \phi _ { D \setminus i } - s ) - 1 } v \in \mathrm { S } ^ { \setminus \Phi _ { i } } } \end{array} +$$ + +Here we have used change of variables $v = u ^ { e x p ( - b ) }$ and $a = b - \phi _ { D \backslash S }$ . This form allows to compute the integrands efficiently, as + +$$ +\prod _ { i \in S \setminus C } \left( 1 - v ^ { \exp ( \phi _ { i } + a ) } \right) = \frac { \prod _ { i \in S } \left( 1 - v ^ { \exp ( \phi _ { i } + a ) } \right) } { \prod _ { i \in C } \left( 1 - v ^ { \exp ( \phi _ { i } + a ) } \right) } +$$ + +where the numerator only needs to computed once, and, since $C = \{ s \}$ when computing equation 35, the denominator only consists of a single term. + +The choice of $a$ may depend on the setting, but we found that $a \ : = \ : 5$ is a good default option which leads to an integral that is generally smooth and can be accurately approximated using the trapezoid rule. We compute the integrands in logarithmic space and sum the terms using the stable LOGSUMEXP trick. In our code we provide an implementation which also computes all second-order leave-one-out ratios efficiently. + +# C THE SUM-AND-SAMPLE ESTIMATOR + +# C.1 UNBIASEDNESS OF THE SUM-AND-SAMPLE ESTIMATOR + +We show that the sum-and-sample estimator is unbiased for any set $C \subset D$ (see also Liang et al. (2018); Liu et al. (2019)): + +$$ +\begin{array} { r l } & { \mathbb { E } _ { \mathrm { s e } \sim p ^ { N } \times ( \pi ) } \left[ \underset { s \in \mathcal { C } } { \sum } p ( c ) f ( c ) + \left( 1 - \underset { s \in \mathcal { C } } { \sum } p ( c ) \right) f ( s ) \right] } \\ & { = \underset { s \in \mathcal { C } } { \sum } p ( c ) f ( e ) + \left( 1 - \underset { s \in \mathcal { C } } { \sum } p ( c ) \right) \mathbb { E } _ { \alpha \sim p ^ { N } \times ( \pi ) } [ f ( x ) ] } \\ & { = \underset { s \in \mathcal { C } } { \sum } p ( c ) f ( e ) + \left( 1 - \underset { s \in \mathcal { C } } { \sum } p ( c ) \right) \underset { s \in \mathcal { C } } { \sum } \frac { p ( x ) } { 1 - \sum _ { s \in \mathcal { C } } p ( c ) } f ( x ) } \\ & { = \underset { s \in \mathcal { C } } { \sum } p ( c ) f ( e ) + \underset { s \in \mathcal { D } } { \sum } p ( x ) f ( x ) } \\ & { = \underset { s \in \mathcal { C } } { \sum } p ( c ) f ( x ) + \underset { s \in \mathcal { D } \backslash \mathcal { C } } { \sum } } \\ & { = \underset { s \in \mathcal { D } } { \sum } p ( x ) f ( x ) } \\ & { = \underset { c \in \mathcal { C } \sim ( \mathcal { C } ) } { \sum } [ f ( x ) ] } \end{array} +$$ + +In this section we give the proof that Rao-Blackwellizing the stochastic sum-and-sample estimator results in the unordered set estimator. + +Theorem 4. Rao-Blackwellizing the stochastic sum-and-sample estimator results in the unordered set estimator, i.e. + +$$ +\mathbb { E } _ { B ^ { k } \sim p ( B ^ { k } | S ^ { k } ) } \left[ \sum _ { j = 1 } ^ { k - 1 } p ( b _ { j } ) f ( b _ { j } ) + \left( 1 - \sum _ { j = 1 } ^ { k - 1 } p ( b _ { j } ) \right) f ( b _ { k } ) \right] = \sum _ { s \in S ^ { k } } p ( s ) R ( S ^ { k } , s ) f ( s ) . +$$ + +Proof. To give the proof, we first prove three Lemmas. + +Lemma 1. + +$$ +P ( b _ { k } = s | S ^ { k } ) = { \frac { p ( S ^ { k } \setminus \{ s \} ) } { p ( S ^ { k } ) } } { \frac { p ( s ) } { 1 - \sum _ { s ^ { \prime } \in S ^ { k } \setminus \{ s \} } p ( s ^ { \prime } ) } } +$$ + +Proof. Similar to the derivation of $P ( b _ { 1 } = s | S ^ { k } )$ (equation 10 in the main paper), we can write: + +$$ +\begin{array} { r l } & { P ( b _ { k } = s | S ^ { k } ) = \displaystyle \frac { P ( S ^ { k } \cap b _ { k } = s ) } { p ( S ^ { k } ) } } \\ & { \qquad = \displaystyle \frac { p ( S ^ { k } \setminus \{ s \} ) p ^ { D \setminus ( S ^ { k } \setminus \{ s \} ) } ( s ) } { p ( S ^ { k } ) } } \\ & { \qquad = \displaystyle \frac { p ( S ^ { k } \setminus \{ s \} ) } { p ( S ^ { k } ) } \displaystyle \frac { p ( s ) } { 1 - \sum _ { s ^ { \prime } \in S ^ { k } \setminus \{ s \} } p ( s ^ { \prime } ) } . } \end{array} +$$ + +The step from the first to the second row comes from analyzing the event $S ^ { k } \cap b _ { k } = s$ using sequential sampling: to sample $S ^ { k }$ (including $s$ ) with $s$ being the $k$ -th element means that we should first sample $S ^ { k } \setminus \{ s \bar { \} }$ (in any order), and then sample $s$ from the distribution restricted to $D \setminus \left( S ^ { k } \setminus \left\{ s \right\} \right)$ . □ + +Lemma 2. + +$$ +p ( S ) + p ( S \setminus \{ s \} ) { \frac { 1 - \sum _ { s ^ { \prime } \in S } p ( s ^ { \prime } ) } { 1 - \sum _ { s ^ { \prime } \in S \setminus \{ s \} } p ( s ^ { \prime } ) } } = p ^ { D \setminus \{ s \} } ( S \setminus \{ s \} ) +$$ + +Dividing equation 33 by $\begin{array} { r } { 1 - \sum _ { s ^ { \prime } \in S } p ( s ^ { \prime } ) } \end{array}$ on both sides, we obtain + +Proof. + +$$ +\begin{array} { r l } & { \quad _ { 1 } - \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } ( \mathsf { E } ^ { ( k ) } , \mathsf { \Lambda } _ { k } ^ { 2 } ) } \\ & { = \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } ( \mathsf { E } ^ { ( k ) } , \mathsf { \Lambda } _ { k } ^ { 2 } ) \le \epsilon _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } } \\ & { \quad _ { 1 } - \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } \Big ( \mathsf { E } ^ { ( k ) } \frac { \epsilon _ { k \in \mathcal { N } _ { k } } } { 1 - \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } ( \mathsf { E } ^ { ( k ) } , \mathsf { \Lambda } _ { k } ^ { 2 } ) } + \mathsf { E } \eta ^ { \mathsf { C P S } _ { k } } \Big ) + \mathsf { E } ^ { ( k ) } \frac { \epsilon _ { k \in \mathcal { N } _ { k } } } { 1 - \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } ( \mathsf { E } ^ { ( k ) } , \mathsf { \Lambda } _ { k } ^ { 2 } ) } } \\ & = \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } ( \mathsf { E } ^ { ( k ) } , \mathsf { \Lambda } _ { k } ^ { 2 } ) \le \epsilon _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } \le \epsilon _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } \le \epsilon _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } - \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } \frac { \mathsf { E } ^ { ( k ) } } { 1 - \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } ( \mathsf { E } ^ { ( k ) } , \mathsf { \Lambda } _ { k } ^ { 2 } ) } \\ & \quad _ { 1 } - \sum _ { k \in \mathcal { N } _ { k } } ^ { \mathsf { C P S } _ { k } } ( \mathsf { E } ^ { ( k ) } \frac { \epsilon _ { k \in \mathcal { N } _ { k } } } 1 - \sum _ k \ \end{array} +$$ + +Multiplying by $\begin{array} { r } { 1 - \sum _ { s ^ { \prime } \in S } p ( s ^ { \prime } ) } \end{array}$ and rearranging terms proves Lemma 2. + +Lemma 3. + +$$ +p ( s ) + \left( 1 - \sum _ { s ^ { \prime } \in S ^ { k } } p ( s ^ { \prime } ) \right) P ( b _ { k } = s | S ^ { k } ) = p ( s ) R ( S ^ { k } , s ) +$$ + +Proof. First using Lemma 1 and then Lemma 2 we find + +$$ +\begin{array} { r l } & { \quad p ( s ) + \left( 1 - \displaystyle \sum _ { s ^ { \prime } \in S ^ { k } } p ( s ^ { \prime } ) \right) P ( b _ { k } = s | S ^ { k } ) } \\ & { = p ( s ) + \left( 1 - \displaystyle \sum _ { s ^ { \prime } \in S ^ { k } } p ( s ^ { \prime } ) \right) \frac { p ( S ^ { k } \setminus \{ S \} ) } { p ( S ^ { k } ) } \frac { p ( s ) } { 1 - \sum _ { s ^ { \prime } \in S ^ { k } \setminus \{ S \} } p ( s ^ { \prime } ) } } \\ & { = \frac { p ( S ) } { p ( S ^ { k } ) } \left( p ( S ^ { k } ) + \displaystyle \frac { 1 - \sum _ { s ^ { \prime } \in S ^ { k } \setminus \{ P ( s ^ { \prime } ) \} } p ( s ^ { \prime } ) } { 1 - \sum _ { s ^ { \prime } \in S ^ { k } \setminus \{ S \} } p ( s ^ { \prime } ) } p ( S ^ { k } \setminus \{ s \} ) \right) } \\ & { = \frac { p ( s ) } { p ( S ^ { k } ) } p ^ { D \setminus \{ S \} } ( S ^ { k } \setminus \{ s \} ) } \\ & { \quad - p ( s ) R ( S ^ { k } , s ) . } \end{array} +$$ + +Now we can complete the proof of Theorem 4 by adding $p ( b _ { k } ) f ( b _ { k } ) - p ( b _ { k } ) f ( b _ { k } ) = 0$ to the estimator, moving the terms independent of $B ^ { k }$ outside the expectation and using Lemma 3: + +$$ +\begin{array} { r l } & \quad \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } \\ & \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } \\ & \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } \\ & { \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \infty } [ ( 1 - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } ) f ^ { ( i i i i ) } } ] f ^ { ( i i i i ) } } \\ & \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } \\ & { \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } [ f ^ { ( i i ) } + \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } ] f ^ { ( i i i i ) } } \\ & { \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } ( f ^ { ( i i i ) } + \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } ) f ^ { ( i i i i ) } } \\ & { \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } ( f ^ { ( i i i ) } + \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } ) f ^ { ( i i i ) } } \\ & \quad \quad - \sum _ { \varrho ^ { \prime } \to \varrho ^ { \prime } \to \overline { { \wp } } } ( f ^ { ( i i ) } + \sum _ \end{array} +$$ + +# C.3 THE STOCHASTIC SUM-AND-SAMPLE ESTIMATOR WITH MULTIPLE SAMPLES + +As was discussed in Liu et al. (2019), one can trade off the number of summed terms and number of sampled terms to maximize the achieved variance reduction. As a generalization of Theorem 4 (the stochastic sum-and-sample estimator with $k - 1$ summed terms), we introduce here the stochastic sum-and-sample estimator that sums $k - m$ terms and samples $m > 1$ terms without replacement. To estimate the sampled term, we use the unordered set estimator on the $m$ samples without replacement, on the domain restricted to $D \setminus B ^ { k - m }$ . In general, we denote the unordered set estimator restricted to the domain $D \backslash C$ by + +$$ +e ^ { { \bf U S } , D \setminus C } ( S ^ { k } ) = \sum _ { s \in S ^ { k } \setminus C } p ( s ) R ^ { D \setminus C } ( S ^ { k } , s ) f ( s ) +$$ + +where $R ^ { D \setminus C } ( S ^ { k } , s )$ is the leave-one-out ratio restricted to the domain $D \backslash C$ , similar to the second order leave-one-out ratio in equation 18: + +$$ +R ^ { D \setminus C } ( S ^ { k } , s ) = { \frac { p _ { \theta } ^ { ( D \setminus C ) \setminus \{ s \} } ( ( S ^ { k } \setminus C ) \setminus \{ s \} ) } { p _ { \theta } ^ { D \setminus C } ( S ^ { k } \setminus C ) } } . +$$ + +While we can also constrain $S ^ { k } \subseteq ( D \backslash C )$ , this definition is consistent with equation 18 and allows simplified notation. + +Theorem 5. Rao-Blackwellizing the stochastic sum-and-sample estimator with $m \ > \ 1$ samples results in the unordered set estimator, i.e. + +$$ +\ ? \ ? \complement _ { B ^ { k } \sim p ( B ^ { k } \mid S ^ { k } ) } \left[ \sum _ { j = 1 } ^ { k - m } p ( b _ { j } ) f ( b _ { j } ) + \left( 1 - \sum _ { j = 1 } ^ { k - m } p ( b _ { j } ) \right) e ^ { U S , D \setminus B ^ { k - m } } ( S ^ { k } ) \right] = \sum _ { s \in S ^ { k } } p ( s ) R ( S ^ { k } , s ) f ( s ) . +$$ + +Proof. Recall that for the unordered set estimator, it holds that + +$$ +e ^ { \mathrm { U S } } ( S ^ { k } ) = \mathbb { E } _ { b _ { 1 } \sim p ( b _ { 1 } | S ^ { k } ) } \left[ f ( b _ { 1 } ) \right] = \mathbb { E } _ { x \sim p ( x ) } \left[ f ( x ) \middle | x \in S ^ { k } \right] +$$ + +which for the restricted equivalent (with restricted distribution $p ^ { D \setminus C }$ ) translates into + +$$ +e ^ { \mathrm { U S } , D \setminus C } ( S ^ { k } ) = \mathbb { E } _ { x \sim p ^ { D \setminus C } ( x ) } \left[ f ( x ) \big | x \in S ^ { k } \right] = \mathbb { E } _ { x \sim p ( x ) } \left[ f ( x ) \big | x \in S ^ { k } , x \not \in C \right] . +$$ + +Now we consider the distribution $b _ { k - m + 1 } | S ^ { k } , B ^ { k - m }$ : the distribution of the first element sampled (without replacement) after sampling $B ^ { k - m }$ , given (conditionally on the event) that the set of $k$ samples is $S ^ { k }$ , so we have $b _ { k - m + 1 } \stackrel { - } { \in } S ^ { k }$ and $\mathsf { \bar { b } } _ { k - m + 1 } \notin B ^ { k - m }$ . This means that its conditional expectation of $f ( b _ { k - m + 1 } )$ is the restricted unordered set estimator for $C = B ^ { k - m }$ since + +$$ +\begin{array} { r l } { { e ^ { \mathrm { U S } , D \setminus B ^ { k - m } } ( S ^ { k } ) = \mathbb { E } _ { x \sim p ( x ) } [ f ( x ) \vert x \in S ^ { k } , x \not \in B ^ { k - m } ] } \quad } & { } \\ & { = \mathbb { E } _ { b _ { k - m + 1 } \sim p ( b _ { k - m + 1 } \mid S ^ { k } , B ^ { k - m } ) } [ f ( b _ { k - m + 1 } ) ] . } \end{array} +$$ + +Observing that the definition (equation 42) of the stochastic sum-and-sample estimator does not depend on the actual order of the $m$ samples, and using equation 45, we can reduce the multisample estimator to the stochastic sum-and-sample estimator with $k ^ { \prime } = k - m + 1$ , such that the result follows from equation 36. + +$$ +\begin{array} { c } { { \displaystyle \begin{array} { l } { { { \cal L } _ { \mathrm { e x c } , \mathrm { t r i g h } , \mathrm { \scriptsize ~ 1 . . } } \sum _ { j = 0 } ^ { N } \phi _ { j } \Big | Z _ { j } ^ { ( k ) } \phi _ { j } \Big | + ( \displaystyle { 1 - \sum _ { j = 0 } ^ { N } \phi _ { j } } ) Z _ { j } ^ { ( k ) } z ^ { ( k ) } z ^ { ( k ) } - ( \beta _ { j } - \gamma ) \delta _ { j } ^ { \prime } \Big | } } } \\ { { \displaystyle - \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \mathrm { \cdots ~ 1 } } } \end{array} \} } \\ \displaystyle - \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } ( \displaystyle { 1 - \sum _ { j = 0 } ^ { N } \phi _ { j } } ) \Bigg | \displaystyle { 1 - \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { k = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { l = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { l = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { l = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { j = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } \sum _ { l = 0 } ^ { N } \mathrm { \scriptsize ~ 1 . } } \\ \displaystyle - \sum _ j = \end{array} +$$ + +# D THE IMPORTANCE-WEIGHTED ESTIMATOR + +# D.1 RAO-BLACKWELLIZATION OF THE IMPORTANCE-WEIGHTED ESTIMATOR + +In this section we give the proof that Rao-Blackwellizing the importance-weighted estimator results in the unordered set estimator. + +Theorem 6. Rao-Blackwellizing the importance-weighted estimator results in the unordered set estimator, i.e.: + +$$ +\mathbb { E } _ { \kappa \sim p ( \kappa | S ^ { k } ) } \left[ \sum _ { s \in S ^ { k } } \frac { p ( s ) } { 1 - F _ { \phi _ { s } } ( \kappa ) } f ( s ) \right] = \sum _ { s \in S ^ { k } } p ( s ) R ( S ^ { k } , s ) f ( s ) . +$$ + +Here we have slightly rewritten the definition of the importance-weighted estimator, using that $q ( s , a ) = P ( g _ { \phi _ { s } } ^ { \mathrm { ~ ~ } } > \stackrel { \cdot } { a } ) = 1 - F _ { \phi _ { s } } ( a )$ , where $F _ { \phi _ { s } }$ is the CDF of the Gumbel distribution (see Appendix A). + +Proof. We first prove the following Lemma: + +Lemma 4. + +$$ +\mathbb { E } _ { \kappa \sim p ( \kappa | S ^ { k } ) } \left[ \frac { 1 } { 1 - F _ { \phi _ { s } } ( \kappa ) } \right] = R ( S ^ { k } , s ) +$$ + +Proof. Conditioning on $S ^ { k }$ , we know that the elements in $S ^ { k }$ have the $k$ largest perturbed logprobabilities, so $\kappa$ , the $( k + 1 )$ -th largest perturbed log-probability is the largest perturbed logprobability in $D \backslash S ^ { k }$ , and satisfies $\begin{array} { r } { \kappa = \operatorname* { m a x } _ { s \in D \backslash S ^ { k } } g _ { \phi _ { s } } = g _ { \phi _ { D \backslash S ^ { k } } } \sim \mathrm { G u m b e l } ( \phi _ { D \backslash S ^ { k } } ) } \end{array}$ . Computing $p ( \kappa | S ^ { k } )$ using Bayes’ Theorem, we have + +$$ +p ( \kappa | S ^ { k } ) = \frac { p ( S ^ { k } | \kappa ) p ( \kappa ) } { p ( S ^ { k } ) } = \frac { \prod _ { s \in S ^ { k } } ( 1 - F _ { \phi _ { s } } ( \kappa ) ) f _ { \phi _ { D \setminus S ^ { k } } } ( \kappa ) } { p ( S ^ { k } ) } +$$ + +which allows us to compute (using equation 34 with $C = \{ s \}$ and $g _ { \phi _ { D \setminus S } } = \kappa$ + +$$ +\begin{array} { r l } & { \mathbb { E } _ { n \sim p ( n | S ^ { k } ) } \left[ \frac { 1 } { 1 - F _ { \phi _ { n } } ( \kappa ) } \right] } \\ & { = \int _ { n = - \infty } ^ { \infty } p ( \kappa | S ^ { k } ) \frac { 1 } { 1 - F _ { \phi _ { n } } ( \kappa ) } \partial \kappa } \\ & { = \int _ { \kappa = - \infty } ^ { \infty } \frac { \prod _ { s \in S ^ { k } } ( 1 - F _ { \phi _ { s } } ( \kappa ) ) f _ { \phi _ { n ; s } } ( \kappa ) } { p ( S ^ { k } ) } \frac { 1 } { 1 - F _ { \phi _ { n } } ( \kappa ) } \partial \kappa } \\ & { = \frac { 1 } { p ( S ^ { k } ) } \int _ { \kappa = - \infty } ^ { \infty } \underset { s \in S ^ { k } \backslash \{ s \} } { \prod } \ ( 1 - F _ { \phi _ { s } } ( \kappa ) ) f _ { \phi _ { n ; s } \mu \kappa } ( \kappa ) \partial \kappa } \\ & { = \frac { 1 } { p ( S ^ { k } ) } p ^ { D \cup S } ( S \setminus \{ s \} ) } \\ & { = R ( S ^ { k } , s ) , } \end{array} +$$ + +Using Lemma 4 we find + +$$ +\begin{array} { r l } & { \mathbb { E } _ { \kappa \sim p ( \kappa | S ^ { k } ) } \left[ \displaystyle \sum _ { s \in S ^ { k } } \frac { p ( s ) } { 1 - F _ { \phi _ { s } } ( \kappa ) } f ( s ) \right] } \\ & { = \displaystyle \sum _ { s \in S ^ { k } } p ( s ) \mathbb { E } _ { \kappa \sim p ( \kappa | S ^ { k } ) } \left[ \frac { 1 } { 1 - F _ { \phi _ { s } } ( \kappa ) } \right] f ( s ) } \\ & { = \displaystyle \sum _ { s \in S ^ { k } } p ( s ) R ( S ^ { k } , s ) f ( s ) . } \end{array} +$$ + +# D.2 THE IMPORTANCE-WEIGHTED POLICY GRADIENT ESTIMATOR WITH BUILT-IN BASELINE + +For self-containment we include this section, which is adapted from our unpublished workshop paper (Kool et al., 2019b). The importance-weighted policy gradient estimator combines REINFORCE (Williams, 1992) with the importance-weighted estimator (Duffield et al., 2007; Vieira, 2017) in equation 15 which results in an unbiased estimator of the policy gradient $\nabla _ { \pmb { \theta } } \mathbb { E } _ { p _ { \pmb { \theta } } ( \pmb { x } ) } [ f _ { \pmb { \theta } } ( \pmb { x } ) ]$ : + +$$ +e ^ { \mathrm { I W P G } } ( S ^ { k } , \kappa ) = \sum _ { s \in S ^ { k } } \frac { p _ { \theta } ( s ) } { q _ { \theta , \kappa } ( s ) } \nabla _ { \theta } \log p _ { \theta } ( s ) f ( s ) = \sum _ { s \in S ^ { k } } \frac { \nabla _ { \theta } p _ { \theta } ( s ) } { q _ { \theta , \kappa } ( s ) } f ( s ) +$$ + +Recall that $\kappa$ is the $( k + 1 )$ -th largest perturbed log-probability (see Section 3.2). We compute a lower variance but biased variant by normalizing the importance weights using the normalization W (Sk) = Ps∈Sk pθ(s)qθ,κ(s) . + +As we show in Kool et al. (2019b), we can include a ‘baseline’ B(Sk) = Ps∈Sk pθ(s)qθ,κ(s) f and correct for the bias (since it depends on the complete sample $S ^ { k }$ ) by weighting individual terms of the estimator by $\begin{array} { r } { 1 - p _ { \pmb { \theta } } ( s ) + \frac { p _ { \pmb { \theta } } ( s ) } { q _ { \pmb { \theta } , \kappa } ( s ) } } \end{array}$ : + +$$ +e ^ { \mathrm { I W P G B L } } ( S ^ { k } , \kappa ) = \sum _ { s \in S ^ { k } } { \frac { \nabla _ { \theta } p _ { \theta } ( s ) } { q _ { \theta , \kappa } ( s ) } } \left( f ( s ) \left( 1 - p _ { \theta } ( s ) + { \frac { p _ { \theta } ( s ) } { q _ { \theta , \kappa } ( s ) } } \right) - B ( S ^ { k } ) \right) +$$ + +For the normalized version, we use the normalization W (Sk) = Ps∈Sk q for the baseline, and $\begin{array} { r } { W _ { i } ( S ^ { k } ) = W ( S ^ { k } ) - \frac { p _ { \theta } ( s ) } { q _ { \theta , \kappa } ( s ) } + p _ { \theta } ( s ) } \end{array}$ to normalize the individual terms: + +$$ +\nabla _ { \pmb \theta } \mathbb { E } _ { \pmb \theta \sim p _ { \pmb \theta } ( \pmb y ) } \left[ f ( \pmb y ) \right] \approx \sum _ { s \in S ^ { k } } \frac { 1 } { W _ { i } ( S ^ { k } ) } \cdot \frac { \nabla _ { \pmb \theta } p _ { \pmb \theta } ( s ) } { q _ { \pmb \theta , \kappa } ( s ) } \left( f ( s ) - \frac { B ( S ^ { k } ) } { W ( S ^ { k } ) } \right) +$$ + +It seems odd to normalize the terms in the outer sum by $\frac { 1 } { W _ { i } ( S ^ { k } ) }$ instead of 1W (Sk) , but equation 52 can be rewritten into a form similar to equation 17, i.e. with a different baseline for each sample, but this form is more convenient for implementation (Kool et al., 2019b). + +# E THE UNORDERED SET POLICY GRADIENT ESTIMATOR + +E.1 PROOF OF UNBIASEDNESS OF THE UNORDERED SET POLICY GRADIENT ESTIMATOR WITH BASELINE + +To prove the unbiasedness of result we need to prove that the control variate has expectation 0: Lemma 5. + +$$ +\mathbb { E } _ { S ^ { k } \sim p _ { \theta } ( S ^ { k } ) } \left[ \sum _ { s \in S ^ { k } } \nabla _ { \theta } p _ { \theta } ( s ) R ( S ^ { k } , s ) \sum _ { s ^ { \prime } \in S ^ { k } } p _ { \theta } ( s ^ { \prime } ) R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) f ( s ^ { \prime } ) \right] = 0 . +$$ + +Proof. Similar to equation 10, we apply Bayes’ Theorem conditionally on $b _ { 1 } ~ = ~ s$ to derive for $s ^ { \prime } \neq s$ + +$$ +\begin{array} { c } { P ( b _ { 2 } = s ^ { \prime } | S ^ { k } , b _ { 1 } = s ) = \displaystyle { \frac { P ( S ^ { k } | b _ { 2 } = s ^ { \prime } , b _ { 1 } = s ) P ( b _ { 2 } = s ^ { \prime } | b _ { 1 } = s ^ { \prime } ) } { P ( S ^ { k } | b _ { 1 } = s ) } } } \\ { = \displaystyle { \frac { p _ { \theta } ^ { D \setminus \{ s , s ^ { \prime } \} } ( S ^ { k } \setminus \{ s , s ^ { \prime } \} ) p _ { \theta } ^ { D \setminus \{ s \} } ( s ^ { \prime } ) } { p _ { \theta } ^ { D \setminus \{ s \} } ( S ^ { k } \setminus \{ s \} ) } } } \\ { { = \displaystyle { \frac { p _ { \theta } ( s ^ { \prime } ) } { 1 - p _ { \theta } ( s ) } R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) } . } } \end{array} +$$ + +For $s ^ { \prime } = s$ we have $R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) = 1$ by definition, so using equation 54 we can show that + +$$ +\begin{array} { r l } & { \displaystyle \sum _ { s ^ { \prime } \in S ^ { k } } p _ { \theta } ( s ^ { \prime } ) R ^ { D N \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) f ( s ^ { \prime } ) } \\ & { = p _ { \theta } ( s ) f ( s ) + \displaystyle \sum _ { s ^ { \prime } \in S ^ { k \setminus \{ s \} } } p _ { \theta } ( s ^ { \prime } ) R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) f ( s ^ { \prime } ) } \\ & { = p _ { \theta } ( s ) f ( s ) + ( 1 - p _ { \theta } ( s ) ) \displaystyle \sum _ { s ^ { \prime } \in S ^ { k \setminus \{ s \} } \setminus \{ s \} } \frac { p _ { \theta } ( s ^ { \prime } ) } { 1 - p _ { \theta } ( s ) } R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) f ( s ^ { \prime } ) } \\ & { = p _ { \theta } ( s ) f ( s ) + ( 1 - p _ { \theta } ( s ) ) \displaystyle \sum _ { s ^ { \prime } \in S ^ { k \setminus \{ s \} } \setminus \{ s \} } P ( b _ { 2 } = s ^ { \prime } | S ^ { k } , b _ { 1 } = s ) f ( s ^ { \prime } ) } \\ & { = p _ { \theta } ( s ) f ( s ) + ( 1 - p _ { \theta } ( s ) ) \| g _ { s ^ { \prime } \in S ^ { k \setminus \{ s \} } \setminus \{ s \} } } \\ & { = p _ { \theta } ( s ) f ( s ) + ( 1 - p _ { \theta } ( s ) ) \| g _ { s ^ { \prime } \circ p _ { \theta } ( b _ { 2 } \mid S ^ { k } , b _ { 1 } = s ) } [ f ( b _ { 2 } ) ] } \\ & { = \mathbb { E } _ { \delta \to p _ { \theta } ( b _ { 2 } \mid S ^ { k } , b _ { 1 } = s ) } [ p _ { \theta } ( b _ { 1 } ) f ( b _ { 1 } ) + ( 1 - p _ { \theta } ( b _ { 1 } ) ) f ( b _ { 2 } ) ] . } \end{array} +$$ + +Now we can show that the control variate is actually the result of Rao-Blackwellization: + +$$ +\begin{array} { r l } & { \mathbb { E } _ { \theta ^ { \star } \sim \Theta ( \theta ^ { ( k ) } ) } [ \displaystyle \sum _ { \ell \in \mathbb { N } ^ { k } } \nabla \theta ^ { ( k ) } ( \theta ^ { k ) } H ^ { ( S ^ { k } , \ell ) } \cdot \sum _ { \ell \in \mathbb { N } ^ { k } } \mathcal { P } \varphi ( \theta ^ { ( k ) } H ^ { ( S ^ { k } , \ell ) } ( \theta ^ { k } , s ^ { \prime } ) f ( s ^ { \prime } ) ] } \\ & { = \mathbb { E } _ { \theta ^ { \star } \sim \Theta ( \theta ^ { ( k ) } ) } [ \displaystyle \sum _ { \ell \in \mathbb { N } ^ { k } } \mathcal { P } ( \theta ^ { ( k ) } ) H ( \theta ^ { ( k ) } , s ^ { \prime } ) \nabla \theta ( \theta , \theta ^ { \prime } ) \wedge \sum _ { \ell \in \mathbb { N } ^ { k } } \mathcal { P } ( \theta ^ { ( k ) } H ^ { ( S ^ { k } , \ell ) } ( \theta ^ { k } ) \cdot \xi ^ { \prime } ) f ( s ^ { \prime } ) ] } \\ & { = \mathbb { E } _ { \theta ^ { \star } \sim \Theta ( \theta ^ { ( k ) } ) } [ \displaystyle \sum _ { \ell \in \mathbb { N } ^ { k } } \mathcal { P } ( \theta ^ { ( k ) } - s | S ^ { k } | \nabla \theta ) \cdot \Big ( \displaystyle \sum _ { \ell \in \mathbb { N } ^ { k } } \mathcal { P } ( \theta ^ { ( k ) } ) H ^ { ( S ^ { k } , \ell ) } ( \theta ^ { k } ) \Big ) ] } \\ & { = \mathbb { E } _ { \theta ^ { \star } \sim \Theta ( \theta ^ { ( k ) } ) } [ \displaystyle \sum _ { \ell \in \mathbb { N } ^ { k } } \mathcal { P } ( \hat { b } _ { 1 } - s | S ^ { k } | \nabla \theta ) \cdot \Big ( \displaystyle \sum _ { \ell \in \mathbb { N } ^ { k } } \mathcal { P } ( \theta ^ { ( k ) } ) H ^ { ( S ^ { k } , \ell ) } ( \theta ^ { ( k ) } , \theta ^ { \prime } ) f ( s ^ { \prime } ) ] } \\ & = \mathbb { E } _ { \theta ^ { \star } \sim \Theta ( \theta ^ { ( k ) } ) } [ \displaystyle \operatorname* { m i n } _ { \theta ^ { \star } \sim \Theta ( \theta ^ { ( k ) } ) } [ \nabla \theta ^ { ( k ) } \theta ^ { ( k ) } H ^ { ( S ^ { k } , \ell ) } ] \xi ^ { \prime } s ^ \end{array} +$$ + +This expression depends only on $b _ { 1 }$ and $b _ { 2 }$ and we recognize the stochastic sum-and-sample estimator for $k = 2$ used as ‘baseline’. As a special case of equation 13 for $C = \{ b _ { 1 } \}$ , we have + +$$ +\mathbb { E } _ { b _ { 2 } \sim p _ { \theta } ( b _ { 2 } \mid b _ { 1 } ) } \left[ \left( p _ { \theta } ( b _ { 1 } ) f ( b _ { 1 } ) + ( 1 - p _ { \theta } ( b _ { 1 } ) ) f ( b _ { 2 } ) \right) \right] = \mathbb { E } _ { i \sim p _ { \theta } ( i ) } \left[ f ( i ) \right] . +$$ + +Using this, and the fact that $\begin{array} { r } { \mathbb { E } _ { b _ { 1 } \sim p _ { \theta } ( b _ { 1 } ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( b _ { 1 } ) \right] = \nabla _ { \theta } \mathbb { E } _ { b _ { 1 } \sim p _ { \theta } ( b _ { 1 } ) } \left[ 1 \right] = \nabla _ { \theta } 1 = 0 } \end{array}$ we find + +$$ +\begin{array} { r l } & { \mathbb { E } _ { S ^ { k } \sim p _ { \theta } ( S ^ { k } ) } \left[ \displaystyle \sum _ { s \in S ^ { k } } \nabla _ { \theta } p _ { \theta } ( s ) R ( S ^ { k } , s ) \displaystyle \sum _ { s ^ { \prime } \in S ^ { k } } p _ { \theta } ( s ^ { \prime } ) R ^ { D \setminus \{ s \} } ( S ^ { k } , s ^ { \prime } ) f ( s ^ { \prime } ) \right] } \\ & { = \mathbb { E } _ { B ^ { k } \sim p _ { \theta } ( B ^ { k } ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( b _ { 1 } ) \left( p _ { \theta } ( b _ { 1 } ) f ( b _ { 1 } ) + ( 1 - p _ { \theta } ( b _ { 1 } ) ) f ( b _ { 2 } ) \right) \right] } \\ & { = \mathbb { E } _ { b _ { 1 } \sim p _ { \theta } ( b _ { 1 } ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( b _ { 1 } ) \mathbb { E } _ { b _ { 2 } \sim p _ { \theta } ( b _ { 2 } | b _ { 1 } ) } \left[ ( p _ { \theta } ( b _ { 1 } ) f ( b _ { 1 } ) + ( 1 - p _ { \theta } ( b _ { 1 } ) ) f ( b _ { 2 } ) ) \right] \right] } \\ & { = \mathbb { E } _ { b _ { 1 } \sim p _ { \theta } ( b _ { 1 } ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( b _ { 1 } ) \mathbb { E } _ { x \sim p _ { \theta } ( x ) } \left[ f ( x ) \right] \right] } \\ & { = \mathbb { E } _ { b _ { 1 } \sim p _ { \theta } ( b _ { 1 } ) } \left[ \nabla _ { \theta } \log p _ { \theta } ( b _ { 1 } ) \right] \mathbb { E } _ { x \sim p _ { \theta } ( x ) } \left[ f ( x ) \right] } \\ & { = 0 \cdot \mathbb { E } _ { x \sim p _ { \theta } ( x ) } \left[ f ( x ) \right] } \\ & { = 0 } \end{array} +$$ + +# F THE RISK ESTIMATOR + +# F.1 PROOF OF BUILT-IN BASELINE + +We show that the RISK estimator, taking gradients through the normalization factor actually has a built-in baseline. We first use the log-derivative trick to rewrite the gradient of the ratio as the ratio times the logarithm of the gradient, and then swap the summation variables in the double sum that arises: + +$$ +\begin{array} { r l } \varepsilon ^ { \mathrm { s c } } > 5 1 - \sum _ { j \in \mathcal { K } } \frac { \partial } { \partial x _ { j } } \varepsilon ( \frac \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \cdot \partial \end{array} +$$ + +# G CATEGORICAL VARIATIONAL AUTO-ENCODER + +# G.1 EXPERIMENTAL DETAILS + +We use the code6 by Yin et al. (2019) to reproduce their categorical VAE experiment, of which we include details here for self-containment. The dataset is MNIST, statically binarized by thresholding at 0.5 (although we include results using the standard binarized dataset by Salakhutdinov & Murray (2008); Larochelle & Murray (2011) in Section G.2). The latent representation $_ { z }$ is $K = 2 0$ dimensional with $C = 1 0$ categories per dimension with a uniform prior $p ( z _ { k } = c ) = 1 / C , k = 1 , . . . , K$ . The encoder is parameterized by $\phi$ as $\begin{array} { r } { q _ { \phi } ( z | \pmb { x } ) = \prod _ { k } q _ { \phi } ( z _ { k } | \pmb { \bar { x } } ) } \end{array}$ and has two fully connected hidden layers with 512 and 256 hidden nodes respectively, with LeakyReLU $\mathit { \Phi } _ { \mathrm { ( \alpha ) } } = 0 . 1$ ) activations. The decoder, parameterized by $\pmb \theta$ , is given by $\begin{array} { r } { \bar { p _ { \pmb \theta } } ( \pmb x | z ) \dot { = } \prod _ { i } p _ { \pmb \theta } ( x _ { i } | \pmb z ) } \end{array}$ , where $x _ { i } \in \{ 0 , 1 \}$ are the pixel values, and has fully connected hidden layers with 256 and 512 nodes and LeakyReLU activation. + +ELBO optimization. The evidence lower bound (ELBO) that we optimize is given by + +$$ +\begin{array} { r } { \mathcal { L } ( \phi , \pmb { \theta } ) = \mathbb { E } _ { z \sim q _ { \phi } ( z \vert x ) } \left[ \ln p _ { \pmb { \theta } } ( \pmb { x } \vert z ) + \ln p ( z ) - \ln q _ { \phi } ( z \vert x ) \right] } \\ { = \mathbb { E } _ { z \sim q _ { \phi } ( z \vert x ) } \left[ \ln p _ { \pmb { \theta } } ( \pmb { x } \vert z ) \right] - K L ( q _ { \phi } ( z \vert x ) \vert \vert p ( z ) ) . } \end{array} +$$ + +For the decoder parameters $\pmb \theta$ , since $q _ { \phi } ( z | \boldsymbol { x } )$ does not depend on $\pmb \theta$ , it follows that + +$$ +\nabla _ { \pmb \theta } \mathcal L ( \phi , \pmb \theta ) = \mathbb E _ { z \sim q _ { \phi } ( z | x ) } \left[ \nabla _ { \pmb \theta } \ln p _ { \pmb \theta } ( \pmb x | z ) \right] . +$$ + +or the encoder parameters $\phi$ , we can write $\nabla _ { \phi } \mathcal { L } ( \phi , \theta )$ using equation 57 and equation 19 as + +$$ +\nabla _ { \phi } \mathcal { L } ( \phi , \pmb { \theta } ) = \mathbb { E } _ { z \sim q _ { \phi } ( z | \pmb { x } ) } \left[ \nabla _ { \phi } \ln q _ { \phi } ( z | \pmb { x } ) \ln p _ { \theta } ( \pmb { x } | z ) \right] - \nabla _ { \phi } K L ( q _ { \phi } ( z | \pmb { x } ) | | p ( z ) ) . +$$ + +This assumes we can compute the $\mathrm { K L }$ divergence analytically. Alternatively, we can use a sample estimate for the KL divergence, and use equation 56 with equation 19 to obtain + +$$ +\begin{array} { l } { \nabla _ { \phi } \mathcal { L } ( \phi , \theta ) = \mathbb { E } _ { z \sim q _ { \phi } ( z | x ) } \left[ \nabla _ { \phi } \ln q _ { \phi } ( z | x ) ( \ln p _ { \theta } ( x | z ) + \ln p ( z ) - \ln q _ { \phi } ( z | x ) ) + \nabla _ { \phi } \ln q _ { \phi } ( z | x ) \right] , } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { = \mathbb { E } _ { z \sim q _ { \phi } ( z | x ) } \left[ \nabla _ { \phi } \ln q _ { \phi } ( z | x ) ( \ln p _ { \theta } ( x | z ) - \ln q _ { \phi } ( z | x ) ) \right] . } \end{array} +$$ + +Here we have left out the term $\begin{array} { r } { \mathbb { E } _ { z \sim q _ { \phi } ( z | \pmb { x } ) } \left[ \nabla _ { \phi } \ln q _ { \phi } ( z | \pmb { x } ) \right] = 0 } \end{array}$ , similar to Roeder et al. (2017), and, assuming a uniform (i.e. constant) prior $\ln p ( z )$ , the term ${ { \mathbb E } } _ { z \sim q _ { \phi } ( z | x ) } \left[ \nabla _ { \phi } \ln q _ { \phi } ( z | x ) \ln p ( z ) \right] = 0$ . With a built-in baseline, this second term cancels out automatically, even if it is implemented. Despite the similarity of the equation 56 and equation 57, their gradient estimates (equation 60 and equation 59) are structurally dissimilar and care should be taken to implement the REINFORCE estimator (or related estimators such as ARSM and the unordered set estimator) correctly using automatic differentiation software. Using Gumbel-Softmax and RELAX, we take gradients ‘directly’ through the objective in equation 57. + +We optimize the ELBO using the analytic KL for 1000 epochs using the Adam (Kingma & Ba, 2015) optimizer. We use a learning rate of $\mathrm { i 0 ^ { - 3 } }$ for all estimators except Gumbel-Softmax and RELAX, which use a learning rate of $\bar { 1 } 0 ^ { - 4 }$ as we found they diverged with a higher learning rate. For ARSM, as an exception we use the sample KL, and a learning rate of $3 \cdot 1 0 ^ { - \overline { { 4 } } }$ , as suggested by the authors. All reported ELBO values are computed using the analytic KL. Our code is publicly available7. + +# G.2 ADDITIONAL RESULTS + +Gradient variance during training. We also evaluate gradient variance of different estimators during different stages of training. We measure the variance of different estimators with $k = 4$ samples during training with REINFORCE with replacement, such that all estimators are computed for the same model parameters. The results during training, given in Figure 4, are similar to the results for the trained model in Table 1, except for at the beginning of training, although the rankings of different estimator are mostly the same. + +Negative ELBO on validation set. Figure 5 shows the -ELBO evaluated during training on the validation set. For the large latent space, we see validation error quickly increase (after reaching a minimum) which is likely because of overfitting (due to improved optimization), a phenomenon observed before (Tucker et al., 2017; Grathwohl et al., 2018). Note that before the overfitting starts, both REINFORCE without replacement and the unordered set estimator achieve a validation error similar to the other estimators, such that in a practical setting, one can use early stopping. + +Results using standard binarized MNIST dataset. Instead of using the MNIST dataset binarized by thresholding values at 0.5 (as in the code and paper by Yin et al. (2019)) we also experiment with the standard (fixed) binarized dataset by Salakhutdinov & Murray (2008); Larochelle & Murray (2011), for which we plot train and validation curves for two runs on the small and large domain in Figure 6. This gives more realistic (higher) -ELBO scores, although we still observe the effect of overfitting. As this is a bit more unstable setting, one of the runs using REINFORCE with replacement diverged, but in general the relative performance of estimators is similar to using the dataset with 0.5 threshold. + +![](images/3cf64085ef97333430dfc6ae343dba9cc3bb81a28a8d5d46e4e908f59c58c425.jpg) +Training log variance (10 2 latent space), $k = 4$ samples +Figure 4: Gradient log variance of different unbiased estimators with $k = 4$ samples, estimated every 100 (out of 1000) epochs while training using REINFORCE with replacement. Each estimator is computed 1000 times with different latent samples for a fixed minibatch (the first 100 records of training data). We report (the logarithm of) the sum of the variances per parameter (trace of the covariance matrix). Some lines coincide, so we sort the legend by the last measurement and report its value. + +![](images/9db0e1232d97d8b19cc6e8b5122295f21e9ef07cda2dbb6e7624da7dadc43d3b.jpg) +Figure 5: Smoothed validation -ELBO curves during training of two independent runs when with different estimators with $k = 1$ , 4 or 8 (thicker lines) samples (ARSM has a variable number). Some lines coincide, so we sort the legend by the lowest -ELBO achieved and report this value. + +![](images/d1fca44c1c3c18bdebf0fcdc5ea9a18b01b73cd2389f61f27b68f5e6d89e5bae.jpg) +Figure 6: Smoothed training and validation -ELBO curves during training on the standard binarized MNIST dataset (Salakhutdinov & Murray, 2008; Larochelle & Murray, 2011) of two independent runs when with different estimators with $k = 1$ , 4 or 8 (thicker lines) samples (ARSM has a variable number). Some lines coincide, so we sort the legend by the lowest -ELBO achieved and report this value. + +# H TRAVELLING SALESMAN PROBLEM + +The Travelling Salesman Problem (TSP) is a discrete optimization problem that consists of finding the order in which to visit a set of locations, given as $x , y$ coordinates, to minimize the total length of the tour, starting and ending at the same location. As a tour can be considered a sequence of locations, this problem can be set up as a sequence modelling problem, that can be either addressed using supervised (Vinyals et al., 2015) or reinforcement learning (Bello et al., 2016; Kool et al., 2019a). + +Kool et al. (2019a) introduced the Attention Model, which is an encoder-decoder model which considers a TSP instances as a fully connected graph. The encoder computes embeddings for all nodes (locations) and the decoder produces a tour, which is sequence of nodes, selecting one note at the time using an attention mechanism, and uses this autoregressively as input to select the next node. In Kool et al. (2019a), this model is trained using REINFORCE, with a greedy rollout used as baseline to reduce variance. + +We use the code by Kool et al. (2019a) to train the exact same Attention Model (for details we refer to Kool et al. (2019a)), and minimize the expected length of a tour predicted by the model, using different gradient estimators. We did not do any hyperparameter optimization and used the exact same training details, using the Adam optimizer (Kingma & Ba, 2015) with a learning rate of $1 0 ^ { - 4 }$ (no decay) for 100 epochs for all estimators. For the baselines, we used the same batch size of 512, but for estimators that use $k = 4$ samples, we used a batch size of $\frac { 5 1 2 } { 4 } = 1 2 8$ to compensate for the additional samples (this makes multi-sample methods actually faster since the encoder still needs to be evaluated only once). \ No newline at end of file diff --git a/md/train/rkxJus0cFX/rkxJus0cFX.md b/md/train/rkxJus0cFX/rkxJus0cFX.md new file mode 100644 index 0000000000000000000000000000000000000000..32cded4fdab1a88eb31ec26f644e78a3e989c42d --- /dev/null +++ b/md/train/rkxJus0cFX/rkxJus0cFX.md @@ -0,0 +1,210 @@ +# REDSYNC : REDUCING SYNCHRONIZATION TRAFFIC FOR DISTRIBUTED DEEP LEARNING + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Data parallelism has become a dominant method to scale Deep Neural Network (DNN) training across multiple nodes. Since the synchronization of the local models or gradients can be a bottleneck for large-scale distributed training, compressing communication traffic has gained widespread attention recently. Among several recent proposed compression algorithms, Residual Gradient Compression (RGC) is one of the most successful approaches—it can significantly compress the transmitting message size $0 . 1 \%$ of the gradient size) of each node and still preserve accuracy. However, the literature on compressing deep networks focuses almost exclusively on achieving good compression rate, while the efficiency of RGC in real implementation has been less investigated. In this paper, we develop an RGC method that achieves significant training time improvement in real-world multi-GPU systems. Our proposed RGC system design called RedSync, introduces a set of optimizations to reduce communication bandwidth while introducing limited overhead. We examine the performance of RedSync on two different multiple GPU platforms, including a supercomputer and a multi-card server. Our test cases include image classification on Cifar10 and ImageNet, and language modeling tasks on Penn Treebank and Wiki2 datasets. For DNNs featured with high communication to computation ratio, which has long been considered with poor scalability, RedSync shows significant performance improvement. + +# 1 INTRODUCTION + +For training large-scale deep neural networks (DNNs) on multiple computing nodes, data parallelism has emerged as the most popular choice due to its simplicity and effectiveness (Dean et al. (2012); Recht et al. (2011)). However, the communication bandwidth of network fabric has become the bottleneck limiting data parallel performance. On one hand, models of DNNs, which already contain tens to hundreds of layers and totaling 10-20 million parameters today, continue to grow bigger. Therefore, the requirement of communicating model parameter updates among all computing nodes poses a higher challenge to network bandwidth. On the other hand, the development of DNN training accelerators has shifted the bottleneck of training towards communication across models. As the evolution of the inter-connected network bandwidth is not as fast as computing hardware, synchronization overhead has become the bottleneck of data parallelism on distributed systems using new computing hardware. + +Many recent studies focused on reducing the communication cost between nodes by reducing the size of the gradients to be transmitted. One line of work (Seide et al. (2014); Alistarh et al. (2017); Wen et al. (2017)) propose to quantize the gradients to low-precision values. Considering compression ratio (ratio of compressed gradients size to their original size) achieved by quantization is limited, another line of research orthogonal to quantization is to sparsify communication gradients and restrict weight-updates to a small subset of parameters. Residual Gradient Compression (RGC) method (Strom (2015); Aji & Heafield (2017); Chen et al. (2017); Lin et al. (2017); Sattler et al. (2018)) is currently the most promising pruning method to achieve good compression ratio while ensuring no loss of training accuracy. It transmits only a small subset of gradients and maintains the remaining gradients locally as residuals to be added to gradients of the next iteration. The first RGC implementation is proposed by Strom (2015) and uses a threshold-based method to only send gradients larger than a predefined constant threshold for fully-connected layers. Considering a predefined threshold is hard to be chosen appropriately, Aji & Heafield (2017) improve the robustness of RGC by selecting top $1 \%$ gradients to communicate according to their magnitude. Because these two implementations are tuned for some specific network structures, applying them to other DNNs will lead to accuracy loss as indicated in Chen et al. (2017). Based on their work, the latest RGC variants, such as (Sattler et al. (2018); Chen et al. (2017); Lin et al. (2017)), are able to achieve a $0 . 1 \%$ compression ratio on local gradients while ensuring almost no loss of model accuracy on a variety of DNN structures after introducing some key modifications. + +Despite of good model accuracy achieved with simulation experiments, no recent studies have discussed the potential performance gain after integrating the latest RCG methods to real distributed training system, especially to the multi-GPU systems equipped with high-quality network infrastructures. The challenges of applying RGC to distributed GPU systems come from two aspects. First, there is no efficient compression algorithm proposed for RGC method. According to our experimental results, selecting top- $0 . 1 \%$ elements with the state-of-the-art GPU-based top- $\mathbf { \nabla \cdot k }$ algorithm are so expensive that the overhead of compression is much higher than the benefits of network bandwidth reduction. Second, synchronization of sparse data structures is nontrivial to be supported with existing efficient communication libraries, such as Message Passing Interface (MPI), which are designed for dense data structures. + +Targeting multi-GPU systems, a highly-efficient RGC implementation called RedSync is proposed. Our contributions are listed as follows: + +• We combined pruning and quantization techniques together to compress transmitting gradients. A set of parallel-friendly top- $0 . 1 \%$ selection methods are designed to support pruning operations inside GPU device memory, which are orders of magnitude faster than the stateof-the-art GPU-based top-k selection method. Considering the distribution characteristics of communication data, we apply allgather operation using MPI for a sparse synchronization scheme. A cost model is derived to analyze both communication cost and calculation overhead. Based on it, we pointed out potential performance gain and the bottleneck of our implementation. RedSync is able to ensure almost no accuracy loss to train a set of DNNs after integrating with the latest algorithm improvements. This is the first work, as far as we known, to evaluate the performance of RGC method on the scale of 128 GPUs. RedSync provides significant performance improvements for communication-intensive networks, like VGG, AlexNet and some LSTMs. + +# 2 DESIGN AND IMPLEMENTATION OF REDSYNC + +We first give an overview of a simple RGC workflow used in RedSync (see more details in Algorithm 1). We denote a DNN model as $f ( \mathbf { w } )$ , where $\mathbf { w }$ is the vector of parameters. We assume a system has $N$ workers. Each worker, say the $k$ -th worker, holds a local dataset $\chi _ { k } ^ { t }$ at iteration $t$ with size $b$ and a local copy of the global weight w. Synchronous SGD method is adopted in RedSync. At each iteration, node $k$ computes the gradient $G ^ { k }$ using local data, where $G _ { j } ^ { k }$ indicates gradients of layer $j$ . Each node also maintains a residual $V ^ { k }$ , which is initialized as 0 and used to accumulate untransmitted gradient from previous iterations. After added with latest gradient, a subset of residuals is selected as the communication-set, and is compressed into sparse data structures. The select operation in Algorithm 1 chooses more important elements based on magnitude. Those selected elements (denoted ask Masks) are synchronized among all the nodes using allreduce operations, which is able to take advantage of the highly-optimized allreduce operation on HPC systems (Thakur et al. (2005)). Synchronous SGD + +# Algorithm 1 Residual Gradient Compression + +Input: node id $k$ , the number of node $N$ +Input: dataset $\chi$ +Input: mini batch size $^ { b }$ per node +Input: initial model $w \stackrel { \cdot } { = } w [ 0 ] , . . . , w [ \# l a y e r ]$ +Input: compression ratio $D$ $\mathbf { \hat { \boldsymbol { V } } } ^ { k } \gets 0$ for $t = 0 , 1 , . . . m a x . i t e r \ \mathbf { d o }$ sample $b$ elements as $\chi _ { k } ^ { t }$ $G ^ { k } \dot { \mathbf { \Omega } } \nabla \ f ( \chi _ { k } ^ { t } \ ; \ \mathbf { w } )$ by forward and backward propagation for $j = \# l a y e r$ , $\# l a y e r - 1 , . . . , 0$ do ${ V } _ { j } ^ { k } { + } = G _ { j } ^ { k }$ Masks select $( V _ { j } ^ { k } , D )$ Gkj ← Allreduce(compress(V kj · Masks)) V kj ← V kj (1 - Masks) end for w ← SGD(w, decompress $( G ^ { k } ) _ { \ l } ^ { \ l }$ ) end for + +![](images/d37f0f10ce77164fe591a6b4c00fec54fc1f9f2660bb92d8eb3cf87d0d7b8867.jpg) +Figure 1: Performance of four communication-set selection methods under message sizes. Elements in the data list are generated randomly from a standard uniform distribution. Comm. illustrates the time taken to synchronize the message through a network with a peak bandwidth of 3.5GBps by allreduce operation. Performance is measured as total time cost for 100 times independent operations. + +implemented with allreduce has been widely adopted in state-of-the-art large-scale CNN training tasks (Goyal et al. (2017) and You et al. (2017)). Remaining elements outside the communicationset are assigned as new residuals of the next iteration. The workflow of this algorithm is the same as an RGC variant called Deep Gradient Compression Method mentioned Lin et al. (2017). In the following, we details our contribution in implementations of select, Allreduce and decompress to make this workflow efficient in practice. + +# 2.1 PARALLEL-FRIENDLY COMPRESSION + +The efficiency of communication-set selection method is critical for the RGC system’s overall performance. Since a predefined threshold is difficult to determine, recent work (Lin et al. (2017); Sattler et al. (2018)) suggest to select top $0 . 1 \%$ elements from residuals of each layer as the communication-set. However, the top- $0 . 1 \%$ selection is nontrivial to be implemented on GPU. One of the most efficient top- $k$ selection methods designed for GPU can be implemented based on radixSelect algorithm (Alabi et al. (2012)), which determines each bit of the $k$ -th largest element by scan and scatter. Serial scan (Sengupta et al. (2007)) and scatter operations are extremely timeconsuming. As shown in Figure 1, the computation time for top- $0 . 1 \%$ with radixSelect on a Titan X GPU sometimes is even slightly higher than the time for synchronizing these parameters through a 3.5 GBps network. To avoid performing a top- $0 . 1 \%$ operation on a large number of parameters, we propose two communication-set selection algorithms called trimmed top- $k$ selection and threshold binary search selection, which are more efficient on GPUs. + +Trimmed top- $k$ selection. Observing that the distribution of residuals is usually similar to a normal distribution, we can use statistical features to remove most of the smaller elements and limit radixSelect operation on a relatively small subset. As shown in Algorithm 2, we first calculate the mean and maximum of residuals’ absolute values of this layer. A relative large threshold value is chosen according to mean and maximum value, for example, $0 . 8 \times ( m a x - m e a n ) + m e a n$ . Operation count nonzero gets the number of elements whose absolute values are greater than the threshold. If the number is smaller than $k$ (the number of top- $0 . 1 \%$ elements ), we dynamically decrease the threshold until we find the number of parameters whose absolute value above the threshold is larger than $k$ . Then we trim all elements that are less than the threshold and perform a top- $k$ selection operation using radixSelect on the remaining elements. Operation mean, max and count nonzero can all be efficiently implemented with a single reduction operation. nonzero indices is a typical stream compaction problem, which uses just one scan operation as its backbone (Sengupta et al. (2006)). + +Threshold binary search selection. For some layers with very large numbers of parameter elements, even conducting radixSelect on a small subset of elements will still be a very time-consuming operation. In order to completely avoid using radixSelect operation on GPU, we propose a method to select approximate top- $0 . 1 \%$ elements as communication-set. Instead of identifying the kth (top $0 . 1 \%$ th) largest element, we search for a threshold to make it between the $k$ th to $2 k$ th largest element, and then select elements larger than the threshold as communication-set. In this case, at least $0 . 1 \%$ largest elements are included in the communication-set. As shown in Algorithm 3, we use a binary search algorithm to find such a threshold. To avoid excessive searching, it will always be terminated when the difference of left bound and right bound is less than a small value $\epsilon$ . + +
Algorithm2 trimmed top-k SelectionAlgorithm 3 Top-k selection with threshold bi-
Input: tensor to be compressed Xnary search selection
Input:number of elements remained kInput: tensor to be compressed X
Output:<indice,values > 1:mean ← mean(abs(X))Input: number of elements remained k
2:max ←max(abs(X))Input:Termination condition parameter é
3:∈←0.2Output:<indice,values >
4:ratio←(1-∈)1:mean ← mean(abs(X)); max ← max(abs(X))
5:l←0.0;r ←1.0; threshold=0.0
nnz=count_nonzero(abs(X)>threshold) 6: while nnz >k dowhiler-l>εdo
ratio=l+(r-l)/2
7: threshold←mean+ratio× (max-mean)threshold← mean+ratio × (max-mean)
8: nnz=count_nonzero(abs(X)>threshold)nnz=count_nonzero(abs(X)> threshold)
9: ratio=ratio-eif nnz >k and 2k >nnz then
10:end whilebreak
11:indice ←nonzero_indices(abs(X) >threshold))else if nnz<k/2 then
12:values ← Xlindice]r=threshold
else
l=threshold
12: end if
13: 14: end while
15: indice ← nonzero_indices(abs(X)> threshold))
16:values← X[indice]
+ +For layers with large sizes, such as the first fully-connected layer in VGG16 and softmax layer in LSTM, the time for count nonzero operation is still not negligible. We further improve the efficiency of the selection algorithm by reducing the number of count nonzero operations. We recommend that, after a threshold binary search for this layer, the threshold element can be reused in the next few iterations. The interval of search is empirically set to 5, and the selection algorithm introduces only one nonzero count overhead on average. + +In Figure 1, we compared the time cost of different selection approaches on parameter lists of different sizes. Compared with directly performing radixSelect, both proposed methods significantly reduce the selection time for large sizes. For top- $0 . 1 \%$ selection on 64MB elements, trimmed top- $\mathbf { \nabla } \cdot \mathbf { k }$ and sampled threshold binary search selection are 38.13 and $1 6 . 1 7 \ \times$ faster than radixSelect. In practice, we dynamically choose compression strategies: For smaller parameter sets such as biases and batch norm layers, we do not compress residuals or directly use radixSelect to select top- $0 . 1 \%$ significant elements. Trimmed top-k selection is suitable for parameters of middle size layers, like convolutional layers, because it can ensure the compression ratio to be exactly $0 . 1 \%$ and introduce no extra communication bandwidth requirements. Threshold binary search based selection is suitable for large size layers, like hidden layers and softmax layers in LSTMs, for which the compression cost is more critical to be optimized than the communication cost. + +# 2.1.1 QUANTIZATION OF COMPRESSED RESIDUALS + +Compressed residuals should include $k$ indices and $k$ values. We further investigate the possibility of quantizing these values. By setting the values of all elements of the same sign in the communicationset to their mean, we can almost eliminate the communication bandwidth requirement of value information transmitting by using only one floating-point number instead of $k$ . In order to facilitate quantization compression, we slightly modify our select method to ensure that elements in the communication-set are all of the same sign. It can be achieved by choosing the largest $k$ elements and the smallest $k$ elements as communication-set in turns. In other words, if we select the largest $k$ elements (all positive numbers) in this layer as the communication-set at current iteration, we will choose smallest $k$ elements (all negative numbers) as the communication-set for the next iteration. It is worth noting that sampled threshold binary search selection cannot be used with quantization. In addition, we do not quantify the output layer of the DNN, in order to distinguish the correct classification information. + +# 2.2 SPARSE SYNCHRONIZATION AND DECOMPRESSION + +Synchronization of dense gradient structures in traditional distributed DNN systems can be simply implemented with an allreduce operation, which has been well-studied on multiple-GPU systems (Awan et al. (2017)). However, the design of a sparse allreduce in a distributed setting is not as simple because each worker may contribute different non-zero indices in its compressed residuals. + +According to our observation, there are very few overlapping indices of the communication-set distribution of different nodes. For example, training VGG16 on Cifar10 dataset using 16 GPUs with a compression ratio as $0 . 1 \%$ for each node, the averaged compression ratio of synchronized residuals of all nodes is $1 . 5 5 \%$ . We utilize the allgather operation, an operation in which the data contributed by each node is gathered at all nodes, to implement sparse allreduce. The message representing compressed residuals of each node should include the information of indices and values of elements in communication-set. When using threshold binary search selection, the length of each node’s message is different. As a result, the packaged message should also include an initial element, which indicates the length of the compressed elements. Instead of using two allgather operations for indices and values message separately, we package the indices and values into a single message to reduce latency. + +After finishing the allgather operation, each node collects $N$ compressed residuals of this layer from all the other nodes. We add the compressed residuals to the corresponding weights in the local model after scaling with the learning rate. It can be seen as an operation that adds a sparse array to a dense array, which has been fully-optimized in Level 1 function axpyi() of cuSparse library on GPU. + +# 2.3 OTHER TECHNIQUES + +RedSync implements a set of algorithm improvement techniques proposed in Lin et al. (2017). We details momentum correction, momentum factor masking and our modification to warmup training in Appendix C, as well as local gradient clipping in Appendix B. + +# 2.4 PERFORMANCE MODEL FOR RGC COMMUNICATION + +To analyze the potential performance gain of sparse synchronization, we adopt a widely-used performance model to estimate the communication cost in terms of latency and bandwidth used. We assume that the time taken to send a message between any two nodes can be modeled as $\alpha + n \beta$ , where $\alpha$ is the latency (or startup time) per message, independent of message size, $\beta$ is the transfer time per byte, and $n$ is the number of bytes transferred. The node’s network interface is assumed to be single ported; i.e. at most one message can be sent and one message can be received simultaneously. $M$ is the number of elements in residuals of current layer. $D$ is the compression ratio. In the case of reduction operations, we assume that $\gamma _ { 2 }$ is the computational cost for performing the reduction operation for a message of size $M$ , and $\gamma _ { 1 }$ is the cost to decompress the collected sparse message of size $M$ . For the case where the compression ratio of each node is different, which is always true for the binary search method, $D$ represents the average compression ratio of all nodes. + +Suppose that we use recursive doubling for allgather and Rabenseifners algorithm mentioned in Thakur et al. (2005) for allreduce communication. The cost of quantized sparse and dense synchronization is illustrated Equation 1 and 2, respectively. The derivations are left in Appendix A. + +$$ +T _ { s p a r s e } = T _ { s e l e c t } + \log ( p ) \alpha + ( p - 1 ) ( M D ) \beta + p \gamma _ { 1 } \quad T _ { d e n s e } = 2 \log ( p ) \alpha + 2 \frac { p - 1 } { p } M \beta + \frac { p - 1 } { p } \gamma _ { 2 } +$$ + +As implicated by the performance model, the compression rate for the model is not equal to the compression rate for communication bandwidth. The bandwidth term of sparse synchronization is $( p - 1 ) D M \beta$ , which is proportional to the number of nodes $p$ . Even if the sparseness $D$ is $0 . 1 \%$ for all $p$ node, when $p$ is 128, the communication bandwidth for sparse synchronization will be $12 . 8 \%$ of dense synchronization rather than $0 . 1 \%$ of dense synchronization. Second, the overhead of reduction may be a new bottleneck when scaling RedSync to larger scale. The last term $p \gamma _ { 1 }$ in Eq. 1 indicates that the overhead to do reduction also increases linearly with the number of nodes $p$ . However, in Eq. 2, reduction overhead almost does not increase with number of nodes. + +# 3 EXPERIMENTAL RESULTS + +# 3.1 SETUPS + +We tested the accuracy and performance of our proposed implementation on two different multiGPU systems, including a world’s top GPU supercomputer and a multi-GPU server. Muradin is a + +![](images/e6f25b2f1217e969175533d70fb9b7f7669cce2afe8225a43f1009345eea8b10.jpg) +Figure 2: Left : top-1 validation accuracy vs number of epochs of training VGG16 on Cifar10 (4 GPUs, total batch size $=$ 256). Center : top-1 validation accuracy vs number of epochs of training ResNet50 on ImageNet (8 GPUs, total batch size $= 2 5 6$ ). Right : Perplexity vs number of epochs of training LSTM on PTB (4 GPUs, total batch size $= 2 0$ ). + +
SizeGflopSGDRGCqRGC
Cifar10ResNet442.650.207.48%7.17%7.87%
VGG16590.318.31%8.45%8.13%
ImageNetAlexNet2330.7244.73%44.91%44.80%
ResNet501038.2224.07%23.98%23.85%
VGG1652815.529.5%29.1%29.3%
PTBLSTM2042.5275.8675.1474.69
Wiki2LSTM3442.5288.2388.0187.84
+ +
Batch Size 128 256 512 1024 2048
ResNet44
SGD7.097.488.1810.0216.8
RGC6.407.177.47110.1310.87
qRGC7.067.877.6211.8610.83
VGG1616
SGD7.748.319.069.4910.09
RGC7.438.459.319.9011.12
qRGC8.178.139.099.979.81
+ +Table 1: Results of RGC are achieved by non-quantized RGC method, and results of qRGC are achieved from quantized RGC method using RedSync. The left table : Accuracy results for various networks. Size indicates the model size in MB. GFlop shows Giga Floating-Point Operations required for a forward pass using a single input sample. Accuracy of CNNs was measured as top-1 validation errors, and accuracy of LSTMs is measured as perplexity on validating dataset. Results on Cifar10 were measured using 4 nodes with batch-size as 64 for each node. Results on ImageNet were measured using 6 nodes with batch-size as 32 for each node. Results of LSTM were measured using 4 nodes with batch-size as 5 for each node. The right table: Test errors of RCG and SGD methods under different batch sizes on Cifar10. + +server with eight GPUs in the same node. It is equipped with one Intel(R) Xeon(R) CPU E5-2640 v4 and 8 TITAN Vs, which is connected to the CPU through PCI-E 3.0. Piz Daint is a GPU supercomputer. Each node of it includes two Intel Xeon E5-2690v3 CPUs and one NVIDIA Tesla P100 GPUs. In total, there are 5320 nodes connected by Aries interconnect with Dragonfly topology. We used pytorch v4.0 to conduct basic DNN training operations. For communication library, horovod an MPI wrapper upon pytorch, is used to provide collective communication operations. Horovod was compiled with OpenMPI v3.1 with cuda-aware supported on both systems. + +We tested our performance on two major types of mainstream deep learning applications. For Image Classification tasks, we studied ResNet-44 and VGG16 on Cifar10 (Krizhevsky & Hinton (2009)), AlexNet, VGG16 and ResNet-50 on ImageNet (Deng et al. (2009)). For all CNNs, we used Nesterov’s momentum SGD as optimizer. We used the same learning rate strategies as the SGD for the RGC methods. Warm-up technique was applied to the first 5 epochs of ResNet50 and VGG16 for both SGD and RGC. For Language Modeling tasks, we picked two datasets for evaluation. The Penn Treebank corpus (PTB) dataset consists of 923,000 training, 73,000 validation and 82,000 test words (Marcus et al. (1993)). The WikiText language modeling dataset is a collection of over 100 million tokens extracted from the set of verified Good and Featured articles on Wikipedia (Merity et al. (2016)). It consists 2,088,628 training, 217,646 and 245,569 test words. We adopted a 2-layer LSTM language model architecture with 1500 hidden units per layer (Press & Wolf (2016)) to evaluate both datasets. We tied the weights of encoder and decoder and use vanilla SGD with gradient clipping. Learning rate decays when no improvement has been made in validation loss. + +# 3.2 EVALUATION OF ACCURACY + +We examined the convergence of RedSycn on the datasets mentioned before. For the Cifar10 dataset, we used two CNNs, i.e. ResNet44 and VGG16, as test cases. Both DNNs were tested on 4 GPUs, and the total mini-batch size is 256. On the ImageNet dataset, we tested AlexNet, ResNet50, and + +VGG16. On the PTB and Wiki2 dataset, we examined the perplexity of the 2-layer LSTM mentioned before. + +Figure 2 shows the validation error of RGC and quantized RGC provided by RedSync on three test cases compared with original SGD. More comprehensive results are shown in the left side of Table 1. We also tested the sensitivity of the RGC method to large training data batch size. As shown in the right side of Table 1 when increasing the batch size to 2048, RedSync got no loss of accuracy compared to the original SGD. + +# 3.3 EVALUATION OF SCALABILITY AND SPEED + +Next we tested the performance and scalability of RedSync as number of GPUs grow. Fig. 5 illustrates scalability of RedSync on Piz Daint with four test cases. Fig. 3 and Fig. 4 show the performance of RedSync on Muradin with six test cases. We compared RedSync and its quantization version Quantized-RedSync with a baseline data parallel implementation provided by horovod. Data was collected by averaging training time in 1000 training iterations. We used trimmed top-k algorithm to compress layers in CNNs larger than 128KB and used threshold binary search algorithm for hidden layers and the softmax layer for LSTM. Fig. 6 illustrates the cost of different parts using RedSync when scaling it to 128 GPUs on Piz Daint. Our observations are summarized as follows. + +1. Using our parallel-friendly selection methods for compression is critical for system overall performance. In Fig. 3 and Fig. 4, we added an RGC implementation called pure RGC, which uses radixSelect to select top $0 . 1 \%$ elements as communication-set rather than our proposed methods. The performance of pure $R G C$ is even slower than the baseline version, because compression time is too long. + +2. RedSync is suitable for accelerating data parallel training on DNNs with high communication to computation ratio. For VGG16, AlexNet and LSTM, although performance of RedSync on a single GPU is not as good as baseline version due to compression and decompression overhead, RedSync can achieve significant speedup with more than 2 GPUs. However, we observed no performance gain for ResNet50 both on Piz Daint and Muradin. As implicated in Table 1, the ratio of computation to communication of ResNet50 is the highest in the DNNs we investigated. On large scale, most of time during ResNet50 training with RedSync is wasted on decompression phase, as shown in Fig. 6, which overdrafts the benefit of communication bandwidth reduction. + +3. The scalability curve of RedSync on Piz Daint shows a concave shape. For example, as shown in Fig. 5, RedSync gets a better speedup to baseline version on 32 GPUs than 128 GPUs for AlexNet. It is because that communication bandwidth requirement and decompression overhead both grow linearly with the number of GPU in use. Such phenomenon verifies our analysis using communication performance model. + +4. Quantized-RedSync always achieves better performance than RedSync for CNNs. However, for LSTM training on small scale, Quantized-RedSync achieves worse performance than RedSync. This is due to the balance of communication and computational overhead. CNN adopts trimmed top- $\mathbf { \nabla } \cdot \mathbf { k }$ as the communication-set selection method and its quantized version has similar computation cost. As shown in Fig. 6, no significant difference of selection cost in CNN training. Therefore, the reducing of communication cost by quantization improves the system’s overall performance. As for LSTMs, they use sampled threshold binary search as selection for non-quantized RedSync, but use threshold binary search for quantized RedSync. Sampled selection is much more faster. Therefore, on small-scale, RedSync has better performance than Quantized-RedSync due to less selection overhead. When scaling to more than 16 GPUs, benefit from the reduction of communication compensates for the cost of the communication-set selection. + +# 4 CONCLUSION + +This paper proposes a distributed implementation called RedSync to accelerate data parallel DNN training by utilizing a type of gradient sparsification method named as Residual Gradient Compression (RGC). We solved two major obstacles to implement RGC on multi-GPU systems $:$ high overhead of compression using GPU and lack of support for collective communication implementation for sparse data structures. We tested the performance of RedSync on two GPU platforms, including a supercomputer system and a multi-GPU server. For AlexNet, VGG16, and LSTM, we observed significant speedup for large-scale DNN training. + +![](images/7ffecbe560b70a61fba10e3d4a1f6fdebf4d7351b8d7ae8f0a5e7cfaeb9d6e88.jpg) +Figure 3: Scalability of RedSync for CNNs training on ImageNet using Muradin. + +![](images/54be3dc109e4f6eb4bc68e4df07aa139ded23fbb56eeab3b2fc3f1418f6fb3c6.jpg) +Figure 4: Scalability of RedSync for LSTM on PTB and Wiki2 datasets. Scalability of RedSync for LSTM VGG16 on Muradin. + +![](images/a4be5f9491c9224318eb7e46081f9ffaef2f8069e6b7db65a8c4cf80fa1eeecf.jpg) +Figure 5: Scalability of RedSync for CNNs with ImageNet and LSTM with PTB on Piz Daint. + +![](images/c5839fafb3f3a50fc6f486ea0c3e51bffc6489ed7e4f840300b64a9f425d522d.jpg) +Figure 6: The time cost of different parts in RedSync on Piz Daint. Time is the average 10 iterations cost. For each two column group, the left column illustrates time decomposition for RedSync and right column illustrates time decomposition for quantized RedSync. + +# REFERENCES + +Alham Fikri Aji and Kenneth Heafield. Sparse communication for distributed gradient descent. arXiv preprint arXiv:1704.05021, 2017. + +Tolu Alabi, Jeffrey D Blanchard, Bradley Gordon, and Russel Steinbach. Fast k-selection algorithms for graphics processing units. Journal of Experimental Algorithmics (JEA), 17:4–2, 2012. + +Dan Alistarh, Demjan Grubic, Jerry Liu, Ryota Tomioka, and Milan Vojnovic. Communicationefficient stochastic gradient descent, with applications to neural networks. 2017. + +Ammar Ahmad Awan, Khaled Hamidouche, Jahanzeb Maqbool Hashmi, and Dhabaleswar K Panda. S-caffe: Co-designing mpi runtimes and caffe for scalable deep learning on modern gpu clusters. In Proceedings of the 22nd ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, pp. 193–205. ACM, 2017. + +Chia-Yu Chen, Jungwook Choi, Daniel Brand, Ankur Agrawal, Wei Zhang, and Kailash Gopalakrishnan. Adacomp: Adaptive residual gradient compression for data-parallel distributed training. arXiv preprint arXiv:1712.02679, 2017. + +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. + +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009. + +Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An-´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017. + +Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009. + +Yujun Lin, Song Han, Huizi Mao, Yu Wang, and William J Dally. Deep gradient compression: Reducing the communication bandwidth for distributed training. arXiv preprint arXiv:1712.01887, 2017. + +Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 19(2):313–330, 1993. + +Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016. + +Ofir Press and Lior Wolf. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016. + +Benjamin Recht, Christopher Re, Stephen Wright, and Feng Niu. Hogwild: A lock-free approach to parallelizing stochastic gradient descent. In Advances in neural information processing systems, pp. 693–701, 2011. + +Felix Sattler, Simon Wiedemann, Klaus-Robert Muller, and Wojciech Samek. Sparse binary ¨ compression: Towards distributed deep learning with minimal communication. arXiv preprint arXiv:1805.08768, 2018. + +Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and its application to data-parallel distributed training of speech dnns. In Fifteenth Annual Conference of the International Speech Communication Association, 2014. + +Shubhabrata Sengupta, Aaron E Lefohn, and John D Owens. A work-efficient step-efficient prefix sum algorithm. In Workshop on edge computing using new commodity architectures, pp. 26–27, 2006. + +Shubhabrata Sengupta, Mark Harris, Yao Zhang, and John D Owens. Scan primitives for gpu computing. In Graphics hardware, volume 2007, pp. 97–106, 2007. + +Nikko Strom. Scalable distributed dnn training using commodity gpu cloud computing. In Sixteenth Annual Conference of the International Speech Communication Association, 2015. + +Rajeev Thakur, Rolf Rabenseifner, and William Gropp. Optimization of collective communication operations in mpich. The International Journal of High Performance Computing Applications, 19 (1):49–66, 2005. + +Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. In Advances in Neural Information Processing Systems, pp. 1508–1518, 2017. + +Yang You, Zhao Zhang, C Hsieh, James Demmel, and Kurt Keutzer. Imagenet training in minutes. CoRR, abs/1709.05011, 2017. + +# A COST MODEL FOR SPARSE AND DENSE SYNCHRONIZATIONS + +The left part of Figure 7 illustrates how sparse allgather works by recursive doubling method. We assume the compression rate on all of the node is the same as $D$ . If we use threshold binary search for communication-set selection, $D$ here should be the average compression ratio of all nodes for a good approximation. In the first step, nodes that are a distance 1 apart exchange their compressed residuals, the size of which is $M \times D$ . In the second step, nodes that are a distance 2 apart exchange their own data as well as the data they received in the previous step, which is $2 M \times D$ in total. In the third step, nodes that are a distance 4 apart exchange their own data as well the data they received in the previous two steps. In this way, for a power-of-two number of processes, all processes get all the data in $\boldsymbol { \mathrm { l g } } \boldsymbol { p }$ steps. The amount of data exchanged by each node is $M \times D$ in the first step, $2 M \times D$ in the second step, and so forth, up to $2 ^ { l g ( \bar { p } ) - 1 } \dot { M } \times D$ in the last step. Therefore, The time for message transfer taken by this algorithm is $T _ { t r a n s f e r } = l g ( p ) \alpha + ( p - 1 ) M \times D \beta$ . After including decompressing overhead $\gamma$ for collected $p$ different compressed residuals and communication selection overhead $T _ { s e l e c t }$ , the time for all-gather based synchronization should be Ttransf er $= T _ { s e l e c t } + l g ( p ) \alpha + ( p - 1 ) M \times D \beta + p \gamma _ { 1 }$ + +As shown in the right part of Figure 7, the Rabenseifners algorithm is adopted for allreduce operation on messages. It does a reduce-scatter followed by an allgather. Reduce-scatter is a variant of reduce in which the result, instead of being stored at the root, is scattered among all $p$ nodes. We use a recursive halving algorithm, which is analogous to the recursive doubling algorithm used for allgather but in reverse way. In the first step, each node exchanges data with a node that is a distance $p / 2$ away: Each process sends the data needed by all processes in the other half, which is of size $M / 2$ . They also receives the data needed by all processes in its own half, and performs the reduction operation on the received data. In the second step, each process exchanges data with a process that is a distance $p / 4$ away. This procedure continues recursively, halving the data communicated at each step, for a total of $\boldsymbol { \mathrm { l g } } \boldsymbol { p }$ steps. After reduce-scatter, allgather phase will have the the same bandwidth and latency requirements. The time taken by Rabenseifners algorithm is the sum of the times taken by reduce-scatter (recursive halving), allgather and reduction operations. The total time should be $\begin{array} { r } { \dot { T } _ { t r a n s f e r } = 2 l g ( p ) \alpha + 2 \frac { p - 1 } { p } M \beta + \frac { p - 1 } { p } \bar { M } \gamma _ { 2 } } \end{array}$ . + +# B OVERLAPPING COMMUNICATION AND COMPUTATION + +It is necessary to improve data parallel efficiency by overlapping communication with computation through pipelining communication and gradient calculation. Before updating aggregated gradients after scaling with learning rate to weights, gradient clipping is usually adopted to avoid gradient explosion. It rescales all of the gradients when the sum of their norms exceeds a threshold. For RGC methods, the local clipping technique (Lin et al. (2017)) is adopted to perform gradient clipping by a new threshold $N ^ { - 1 / 2 }$ of original) locally before adding the current gradients to previous residuals. The difference is that traditional data parallel does clipping after communication of all layers are completed, while the RGC algorithm needs to do clipping before communication. In this case, we need to wait for the completion of the entire back-propagation to get gradients of all layers. And then we do clipping on gradients and then perform compression for communication. Local clipping is equivalent to introducing synchronization between computing and communication and thus eliminating the possibility of Communication hiding. + +![](images/7fdb265138a5791b5c4d32c07775e841225320568170aca39ef82a070f52fb25.jpg) +Figure 7: Communication pattern of sparse synchronization with allgather and dense synchronization with allreduce. + +As shown in Figure 8, We have abandoned gradient clipping for CNNs, which seldom have gradient exploration problem for the deep networks in order to explore the potential overlapping. As for RNNs, gradients are achieved after backpropagation of all time steps using Back Propagation Through Time (BPTT). When backpropagation of the last layer is completed, we use the gradients of all layers to conduct local gradient clipping. In this case, the communication time can only overlap with the compression calculation. Because even with the original data parallel approach, the computation and communication overlap for each layer can only be made at the last time step, RGC dose not introduce too much overhead. + +![](images/7f2800522513d0bc5671d01ea9c77eedb8eb1631a87bcc2244ad723e32450100.jpg) +Figure 8: Two different schemes to overlap communication with computation for CNNs and RNNs. + +# C CORRECTNESS FOR MOMENTUM SGD AND WARM-UP TRAINING + +We integrate the momentum masking and momentum correction schemes as proposed in Lin et al. (2017) for momentum SGD and Nesterov momentum SGD optimizers in RedSync. The Momentum SGD version of RGC method adopted by RedSync is illustrated in Algorithm 4. A warm-up training, by exponentially decreasing the compression ratio of the residuals in communication-set in first few epochs, is generally adopted to accelerate convergence in the first few iterations. For example, it is recommended to decrease the compression ratio of residuals in the warm-up period as follows: $2 5 \%$ , $6 . 2 5 \%$ , $1 . 5 6 2 5 \%$ , $0 . 4 \%$ , $0 . 1 \%$ . However, we find it could be inefficient for large-scale. As analyzed in the previous section, even synchronization of compressed residual with a compression ratio as $1 . 5 6 2 5 \%$ requires $100 \%$ bandwidth of dense allreduce for quantized RedSync on 64 GPUs. Instead of adopting high-compression-ratio RGC method of warm-up training, we use original SGD optimizer synchronized by allreduce in first few epochs if necessary. + +# Algorithm 4 Residual Gradient Compression using MSGE + +Input: node id $k$ , the number of node $N$ +Input: dataset $\chi$ +Input: use momentum, momentum, use nesterov +Input: mini batch size $^ { b }$ per node +Input: initial model $w = w [ 0 ] , . . . , w [ \# l a y e r ]$ +Input: compression ratio $D$ $\mathbf { \Delta } ^ { \mathbf { \triangleq } } V ^ { k } \gets 0$ $U ^ { k } \gets 0$ for $t = 0 , 1$ , ...max iter do sample $b$ elements as $\chi _ { k } ^ { t }$ $G ^ { k } \hat { \mathbf { \xi } } \nabla f ( \chi _ { k } ^ { t } ; \mathbf { w } )$ by forward and backward propagation for $j = \# l a y e r$ , $\# l a y e r - 1 , . . . , 0$ do if use momentum then $U _ { j } ^ { k } = m o m e n t u m \cdot U _ { j } ^ { k } + G _ { j } ^ { k }$ V kj = V kj + U kj if use nesterov then $V _ { j } ^ { k } = V _ { j } ^ { k } + G _ { j } ^ { k }$ end if else $V _ { j } ^ { k } = V _ { j } ^ { k } + G _ { j } ^ { k }$ end if Masks selection $( V _ { j } ^ { k } , D )$ $G _ { j } ^ { k } \gets$ Allreduce(compress $\cdot V _ { j } ^ { k }$ · Masks)) $V _ { j } ^ { k } V _ { j } ^ { k } \odot$ (1 - Masks) if use momentum then $U _ { j } ^ { k } \gets U _ { j } ^ { k } \odot$ (1 - Masks) end if end for w ← SGD(w, decompress $( G ^ { k } ) _ { \ l }$ ) end for \ No newline at end of file diff --git a/md/train/rygG4AVFvH/rygG4AVFvH.md b/md/train/rygG4AVFvH/rygG4AVFvH.md new file mode 100644 index 0000000000000000000000000000000000000000..8305aa916dcc14188d21f510fb12d1e492d68933 --- /dev/null +++ b/md/train/rygG4AVFvH/rygG4AVFvH.md @@ -0,0 +1,334 @@ +# CHAMELEON: ADAPTIVE CODE OPTIMIZATION FOR EXPEDITED DEEP NEURAL NETWORK COMPILATION + +Byung Hoon $\mathbf { A } \mathbf { h } \mathbf { n } ^ { 1 }$ , Prannoy Pilligundla1, Amir Yazdanbakhsh2, Hadi Esmaeilzadeh1 + +1 University of California, San Diego +2 Google Research +bhahn@eng.ucsd.edu, ppilligu@eng.ucsd.edu, ayazdan@google.com +hadi@eng.ucsd.edu + +# ABSTRACT + +Achieving faster execution with shorter compilation time can foster further diversity and innovation in neural networks. However, the current paradigm of executing neural networks either relies on hand-optimized libraries, traditional compilation heuristics, or very recently genetic algorithms and other stochastic methods. These methods suffer from frequent costly hardware measurements rendering them not only too time consuming but also suboptimal. As such, we devise a solution that can learn to quickly adapt to a previously unseen design space for code optimization, both accelerating the search and improving the output performance. This solution dubbed CHAMELEON leverages reinforcement learning whose solution takes fewer steps to converge, and develops an adaptive sampling algorithm that not only focuses on the costly samples (real hardware measurements) on representative points but also uses a domain-knowledge inspired logic to improve the samples itself. Experimentation with real hardware shows that CHAMELEON provides $4 . 4 5 \times$ speed up in optimization time over AutoTVM, while also improving inference time of the modern deep networks by $5 . 6 \%$ . + +# 1 INTRODUCTION + +The enormous computational intensity of Deep Neural Networks (DNNs) have resulted in developing either hand-optimized kernels, such as NVIDIA cuDNN or Intel MKL that serve as backend for a variety of programming environment such as TensorFlow (Abadi et al., 2016) and PyTorch (Paszke et al., 2019). However, the complexity of the tensor operations in DNNs and the volatility of algorithms, which has led to unprecedented rate of innovation (LeCun, 2019), calls for developing automated compilation frameworks. To imitate or even surpass the success of hand-optimized libraries, recent research has developed stochastic optimization passes: for general code, STOKE (Schkufza et al., 2013), and neural network code, TVM (Chen et al., 2018a) and TensorComprehensions (Vasilache et al., 2018). TVM and TensorComprehensions are based on random or genetic algorithms to search the space of optimized code for neural networks. AutoTVM (Chen et al., 2018b) builds on top of TVM and leverage boosted trees (Chen & Guestrin, 2016) as part of the search cost model to avoid measuring the fitness of each solution (optimized candidate neural network code), and instead predict its fitness. However, even with these innovations the optimizing compilation time can be around 10 hours for ResNet-18 (He et al., 2016), and even more for deeper or wider networks. + +Since the general objective is to unleash new possibilities by developing automatic optimization passes, long compilation time hinders innovation and could put the current solutions in a position of questionable utility. To solve this problem, we first question the very statistical guarantees which the aforementioned optimization passes rely on. The current approaches are oblivious to the patterns in the design space of schedules that are available for exploitation, and causes inefficient search or even converges to solutions that may even be suboptimal. Also, we notice that current approaches rely on greedy sampling that neglects the distribution of the candidate solutions (configurations). While greedy sampling that passively filter samples based on the fitness estimations from the cost models work, many of their hardware measurements (required for optimization) tend to be redundant and wasteful. Moreover, we found that current solutions that rely on greedy sampling lead to significant fractions of the candidate configurations being redundant over iterations, and that any optimizing compiler are prone to invalid configurations which significantly prolongs the optimization time. As such, this work sets out to present an Adaptive approach dubbed CHAMELEON to significantly reduce the compilation time and offer automation while avoiding dependence to hand-optimization, enabling far more diverse tensor operations in the next generation DNNs. We tackle this challenge from two fronts with the following contributions: + +(1) Devising an Adaptive Exploration module that utilizes reinforcement learning to adapt to unseen design space of new networks to reduce search time yet achieve better performance. (2) Proposing an Adaptive Sampling algorithm that utilizes clustering to adaptively reduce the number of costly hardware measurements, and devising a domain-knowledge inspired Sample Synthesis to find configurations that would potentially yield better performance. + +Real hardware experimentation with modern DNNs (AlexNet, VGG-16, and ResNet-18) on a highend GPU (Titan $\mathrm { X p }$ ), shows that the combination of these two innovations, dubbed CHAMELEON, yields $4 . 4 5 \times$ speedup over the leading framework, AutoTVM. CHAMELEON is publicly available in the project page: https://bitbucket.org/act-lab/chameleon. + +# 2 CHALLENGES IN DEEP NEURAL NETWORK COMPILATION + +The general life-cycle of deep learning models from its birth to deployment comprises of two major stages. First stage is the designing and the training of a deep learning model by a research scientist, with the primary goal of achieving the highest feasible accuracy. Then, with a general demand to enable the intelligence on a wide range of devices (from mobile CPUs in the edge to cloud-scale GPUs), the second stage has emerged for the deployment of the pre-trained deep learning model to a target hardware by a deployment engineer. These stages are each iterative processes: research scientists iterate until it reaches the target performance in terms of accuracy whereas the deployment engineers iterate until the performance in terms of inference speed with a given hardware satisfies the given constraints. Importantly, these two stages are most often separate processes, and this paper mainly focuses on the second stage (deployment) of the cycle with an overarching goal of accelerating the overall deployment cycle by reducing the optimizing compilation time without compromising the performance of the output code. + +# 2.1 COMPILATION WORKFLOW FOR DEEP NEURAL NETWORKS + +![](images/4c1eda16cc68693383186b7adabf42830ab5f161819979c3ab152bb6ba67eb96.jpg) +Figure 1: Overview of our model compilation workflow, and highlighted is the scope of this work. + +Figure 1 illustrates how a compiler for DNNs takes an input model $\mathcal { M }$ and emits an optimized code $\tau ( \bar { \Theta } ^ { * } )$ that runs the model efficiently on a given hardware. This flow is commensurate with TensorComprehensions (Vasilache et al., 2018) and TVM (Chen et al., 2018a), using which we implement CHAMELEON that is available as a separate package for adoption in even other frameworks. The first phase of the workflow is the frontend compiler which performs the translation from the compiler and applies target-independent and white-box target-dependent optimizations that do not incorporate a measure of runtime. Target-independent passes transform the input DNN model without specificity to the target hardware. Operator fusion and data layout transformation in TVM are some examples of these passes, which lie in the same category as dead-code elimination or loop-invariant code motion in GCC (Stallman & DeveloperCommunity, 2009) or LLVM (Lattner & Adve, 2004). Target-dependent passes, on the other hand, the compiler takes the hardware architecture (target) into account while optimizing the program; however, this also does not actively leverage runtime measures. The last stage is a black-box optimization pass, called optimizing compiler, that given a measure of performance at runtime from the hardware can further optimize the code. CHAMELEON falls in this class by offering an optimizing compiler that adapts to different design space to be more swift in optimizing deep neural networks compared to conventional approaches. + +Table 1: Knobs in the design space to optimize convolution. + +
KNOBSDEFINITION
tile_f, tile-y, tile_xFactors for tiling and binding # of filters height,and width of feature maps.
tile_rc,tile_ry, tile_rxFactors for tiling reduction axis such as # of channels,height,and width of filters.
auto_unroll_max_stepThreshold of number of steps in the loop to be automatically unrolled.
unroll_explicitExplicitly unroll loop, this may let code generator to generate pragma unroll hint.
+ +![](images/a82336e7fd8660ed1af7676a9258e1f38a623d17fb06729397d666a7e6612433.jpg) +Figure 2: AutoTVM optimization time for ResNet-18 on Titan Xp. + +# 2.2 OPTIMIZING COMPILER FOR DEEP NEURAL NETWORKS + +Optimizing compilers (Kennedy & Allen, 2001) usually take a black-box approach and use hardware measurements to configure the optimization based on a measure of fitness $f$ of each solution. In order to make the problem tractable, the optimizing compilers for deep neural networks reduce the problem down to tuning the knobs $\theta$ for the output code template $\tau$ , and can be formulated as: + +$$ +\Theta ^ { * } = \operatorname * { a r g m a x } _ { \Theta } f ( \tau ( \Theta ) ) , \qquad \mathrm { f o r } \Theta \in \mathcal { D } _ { \Theta } . +$$ + +A combination of assignment to the knobs is said to be a configuration $\boldsymbol { \Theta } = ( \theta _ { 1 } , \theta _ { 2 } , . . . , \theta _ { n } )$ while the dimensions of the design space $\mathcal { D } _ { \Theta }$ is defined by the knobs. As such, in Equation 1, an optimizing compiler starts from a code template $\tau$ for each layer, and makes use of a search algorithm and real hardware measurements to efficiently find the best configuration $\Theta ^ { \ast } \in { \mathcal { D } } _ { \Theta }$ . In this context, there are three variables that determine the effectiveness of the optimizing compiler: (1) a large and diverse enough design space that covers a variety of transformations, (2) an effective search algorithm to adequately navigate this space, and (3) a mechanism to cut down the number of costly hardware measurements that check the fitness of a solution. Table 1 lists the knobs for performing convolution on a GPU, where it is crucial that the code (1) maximizes data reuse, (2) uses the shared memory wisely, and (3) minimizes bank conflicts. The knobs optimize various aspects of the execution, including tiling (e.g., tile x, tile y, . . . ), unrolling (e.g., auto unroll max step and unroll explicit), and these knobs define a design space with $1 0 ^ { 1 0 }$ possibilities. Given the vastness of the design space, the remaining challenges are designing an effective search algorithm and designing a mechanism that reduces the cost of each step in the search (i.e. reducing the need to measure the hardware). + +# 2.3 CHALLENGES IN DEEP NEURAL NETWORK COMPILATION + +As shown in Figure 2, optimizing compilation for DNNs may still take an eon even with the advances from prior works (Chen et al., 2018a;b; Vasilache et al., 2018) With active research (You et al., 2017; Goyal et al., 2017; Codreanu et al., 2017; Akiba et al., 2017; You et al., 2018; Mattson et al., 2019) that has been able to cut down the training time to only few hours (You et al., 2017; Goyal et al., 2017) and even minutes (You et al., 2018; Akiba et al., 2017) on big models (e.g., ResNet-50 (He et al., 2016)) for ImageNet, it renders the optimizing compilation time of the current solutions seem even more prominent. Especially, since the above-mentioned compilers have been integrated to the deep learning pipelines of major players in the industry (Liu et al., 2019; Rotem et al., 2018; Vasilache et al., 2018), many users of these pipelines including the deployment engineers must go through the compilation workflow depicted in Figure 1 numerous times. Therefore, current long compilation time can be a hindrance to deploying DNN in various hardware, hence a major bottleneck in enabling intelligence on wider range of target platforms. + +Furthermore, as we explore various neural topologies (Xie et al., 2019; Wortsman et al., 2019) for better performance as illustrated in Ahn et al. (2020), even deeper or wider networks (Szegedy et al., 2015; Zagoruyko & Komodakis, 2016), and new operations (Howard et al., 2017) to achieve higher performance (LeCun, 2019), we are forced to optimize the networks more frequently. The long optimization times are multiplied with such trend, leaving the practical utility of the current compiler solutions to question. As such, the primary goal of this work is reducing the optimizing compilation time to meet the immediate needs of the industry for expedited DNN compilation to foster further diversity and innovation in designing DNNs. + +![](images/29fcf8d4209155d1093cb560684815d3387661eb22015843e0cbad9b14a22354.jpg) +Figure 3: Overall design and compilation overview of the CHAMELEON. + +Such long optimization time results from the inefficiency of simulated annealing which (while it stochastically guarantees a reasonable solution after huge number of iterations) fails to capture the patterns in the design space that can be exploited during the search. On the other hand, we can see in the figure that majority of the optimization time is spent on reaching for measurements on real hardware that is used as a feedback for the aforementioned search. Also, current approach even suffers from numerous invalid configurations that not only wastes the limited hardware measurement budget that the compiler starts with, but also incurs serious overhead to reset the target hardware for subsequent hardware measurements. As such, it is important that a sampling mechanism that selects potential configurations for hardware measurements to be smarter to ensure that each measurement is maximizing the chances of achieving a good solution and that it evades the invalid configurations. However, the current approaches rely on greedy sampling that passively sample based on the estimations from the cost models. This not only has a tendency to overfit but also neglect that solutions are distributed non-uniformly and that there are numerous invalid configurations. + +# 3 CHAMELEON: ADAPTIVE CODE OPTIMIZATION FOR EXPEDITED DEEP NEURAL NETWORK COMPILATION + +As discussed in Section 2, current solutions fall short of providing a swift optimization framework for optimizing emergent deep neural networks, because of the futility of the search in adapting to the design space from a random walk based search algorithm and the inefficiency of the physical hardware measurements from the greedy sampling. Therefore, developing a new framework that can overcome current challenges to unfetter neural network innovation from a prolonged optimization times can be boiled down to two problems: $\textcircled{4}$ improving the the search algorithm to better adapt to the design space, and $\textcircled { \bullet }$ improving the sampling algorithm to both better adapt to the distribution of the solutions and decrease the possibility of running into invalid configurations. As such we make two innovations in the optimizing compiler for deep neural networks to develop CHAMELEON by applying reinforcement learning to the search that can adapt to new design spaces (Adaptive Exploration) and devising an Adaptive Sampling that replaces the current greedy sampling. + +# 3.1 OVERALL DESIGN OF CHAMELEON + +Figure 3 outlines the overall design of our optimizing compiler, dubbed CHAMELEON1, and gives an overview of the optimizing compilation process. CHAMELEON takes code template $\tau$ for each layer in the network and the corresponding design space $\mathcal { D } _ { \Theta }$ as its input, and iteratively optimizes the code for configuration $\Theta$ to finally output $\tau ( \Theta ^ { * } )$ . The proposed Adaptive Exploration maneuvers the design space while using a cost model as a proxy for hardware measurements to the output set of candidate configurations $S _ { \Theta }$ . These configurations are then sampled with Adaptive Sampling so that the sampled configurations $S _ { \Theta } ^ { \prime }$ subsume the initial candidate configurations while reducing its number significantly. The sampled configurations $S _ { \Theta } ^ { \prime }$ are then passed to the code generator which combines the input template $\tau$ and the configurations $S _ { \Theta } ^ { \prime }$ to create a set of $\tau ( \Theta )$ that are sent to real hardware for runtime measurements. Runtimes from the hardware are used as the measure of fitness $f$ and update the cost model to enhance the exploration of the subsequent iterations. After multiple iterations, $\tau ( \Theta ^ { * } )$ with the best fitness $f$ (shortest runtime) is selected as an output for the layer. + +3.2 ADAPTIVE EXPLORATION: LEARNING ABOUT THE UNSEEN DESIGN SPACE TO EXPEDITE CONVERGENCE OF OPTIMIZATION + +As stated in Section 2, the current state-of-the-art approach (Chen et al., 2018b) that leverages simulated annealing relies on the stochastic guarantees of its random walks. Therefore, the current approach requires numerous iterations of exploration to converge to a reasonable solution causing long compilation hours, thus insufficient to enable disruptive innovations in neural networks. We take an inspiring approach that avoids naive dependence on the stochastic guarantee of simulated annealing and leverage a technique that can learn to adapt to unseen design space to not only accelerate convergence but also bring some performance gains. As such, we develop Adaptive Exploration by leveraging Reinforcement Learning $( R L )$ , which is concerned with learning to maximize reward given an environment by making good exploration and exploitation tradeoffs, in our case maximizing fitness $f$ of the explored configurations $S _ { \Theta }$ . + +Reinforcement learning formulation. Our RL-based Adaptive Exploration module uses an actor-critic style $R L$ , where policy network learns to emit a set of directions (vector of increment/decrement/stay) for each knob in the design space that will increase $f$ of the next configuration and the value network learns the design space $\mathcal { D } _ { \Theta }$ to estimate the value of the action. The first layer of these networks that takes the current configuration $\Theta$ as input is shared to foster information sharing among the two networks, and its output is fed into the subsequent layers the networks. These networks not only learn the dependencies among the different knobs of the design space (which are interrelated) that helps our module navigate through the design space but also lean the potential gains of the modifications to the configurations. + +![](images/97d024af12ac3c4f745d8b752f71ea358c4b67e85da0a104058710f13b015c4e.jpg) +Figure 4: Adaptive Exploration Module of CHAMELEON in action. + +Learning procedure. Having formulated the RL-based Adaptive Exploration Module, an iteration of our optimization begins with a set of initial configurations and takes multiple search steps (episode) for each of the configurations. As shown in Figure 4, the agent makes an action and applies it to the configuration using configuration updater to get another configuration that potentially has better $f$ . After finishing multiple search steps in the episode, all configurations $S _ { \Theta }$ are evaluated using a cost model, which its return values are used as a surrogate reward to update our agent, to reduce the number of costly hardware measurements. By taking this approach, $f$ of $S _ { \Theta }$ improves as our module progresses through the episodes. In other words, by repeating multiple episodes and iterations, our Adaptive Exploration Module gradually learns to locate good configurations. + +# 3.3 ADAPTIVE SAMPLING: ADAPTING TO THE DISTRIBUTION TO REDUCE COSTLY HARDWARE MEASUREMENTS + +Reducing number of costly hardware measurements. After the exploration step (regardless of the exploration method), we observe that the candidate configurations are clustered in subregions of the design space and these clusters are non-uniformly distributed (Figure 5). We also find that, while the design space’s surface is discrete and un-smooth, a large fraction of configurations within each cluster achieve similar runtime (Figure 6). Utilizing these characteristics of the design space, we devise Adaptive Sampling that can sample a new set of candidates, by adapting to the shape of the design space and the non-uniformity of the distribution while leaving the performance of optimization intact. We first leverage clustering algorithm to find configurations that are representative of each cluster; the sampling module uses centroids as the representative configurations. Our Adaptive Sampling iterates over a different number of clusters for their respective centroids and the L2 loss. + +![](images/ed941247342c26d8e1fad3ef4dd55690ccc085092361400e5fd016f0b22e4c39.jpg) +Figure 5: Clusters of candidate configurations. + +![](images/d9a9b79e18493ca91b94c446e32aee7cb3ed27107e9f4a93ee28dc4354aa45ac.jpg) +Figure 6: Cumulative Distribution Function (CDF) of the difference in runtime among the configurations in the cluster. + +In the context of optimizing compiler, selecting the number of centroids for clustering entails making the important tradeoff between selecting more centroids for better performance or fewer centroids for a reduced number of hardware measurements. As such, we must devise a method that would automatically make the tradeoff in a reasonable manner. We take advantage of the decreasing trend in the aforementioned L2 loss as we increase the number of centroids, and devise a Threshold-based Swift Meta-Search to determine the number of clusters. By setting the threshold (hyperparameter) it allows the compiler to determine the point of diminishing return (knee of the curve), inflection point beyond which fewer centroids may lead to performance degradation and more clusters would prolong the optimization substantially. Overall, our sampling curtails the number of hardware measurements so that it is just enough to subsume the entire subspace of the candidate configurations. + +Improving candidate configurations using sample synthesis. While the above sampling algorithm significantly reduces the number of hardware measurements compared to the conventional greedy sampling, without impacting the performance of the output code, we are still left with a critical issue of redundancy among the candidate configurations. We find that the exploration algorithm (regardless of the type) combined with the greedy sampling frequently leads to redundancy among the candidate configurations over different iterations of optimization due to the overfitting of the cost model from the greediness of the sampling. Even though the exploration algorithm tries to explore unvisited regions of the design space, these explored (not exploited) configurations are discarded due to the greedy sampling which entirely depends on the cost model for its selections of the configurations. Therefore, the current greedy sampling algorithm has its limitation in focusing the hardware measurements to the same region over and over. + +On the other hand, we find that from a code optimization point of view, we know that many of the automated approaches for black-box optimization are prone to invalid configurations, which results from too large a tile that goes over the input feature map boundary or errors during memory accesses (cannot be solved analytically). These invalid configurations not only blow the chances for better exploration but also leads to an extra optimization time overhead to reset the physical hardware for the subsequent hardware measurement. We try to overcome both of these limitations by devising Sample Synthesis. When our compiler runs into redundant samples, the proposed synthesis method analyzes the candidate samples to determine the most probable (most frequent $=$ mode function) non-invalid choice for each knob to come up with a new configuration. This statistical combination of the most frequent knob settings yield configurations that combine the strengths of different knobs to converge to a better overall solution. In spirit, the recombination (crossover) operator in genetic algorithms also tries to combine the best features of the solutions with high fitness values. Algorithm 1 presents the integration of our Adaptive Sampling and the Sample Synthesis. + +# 3.4 IMPLEMENTATION DETAILS + +Architecture exploration for the adaptive exploration. We use Proximal Policy Optimization $( P P O )$ (Schulman et al., 2017), a policy gradient that has been shown to adapt to various problems and have good sample complexity, as our reinforcement learning algorithm. Since reinforcement learning could incur computational overhead that could prolong the optimization time, we optimize the actor-critic networks through architecture exploration to find good tradeoff for size of these networks (that determines the computational overhead) and the optimization performance. + +Algorithm 1 Adaptive Sampling and Sample Synthesis + +
1: procedure ADAPTIVESAMPLING(SΘ, UΘ)
2:V se: candidate configs, ve: visited configs new_candidates ← @,previous_loss ←0
3:for k in range(8, 64) do
4:new_candidates,clusters,L2_loss ← K-means.run(se,k)
5:if Threshold × L2_loss ≥ previous_loss then break>Exit loop at knee of loss curve
6:previous_loss ←L2_loss
7:end for
8:for candidate in new_candidates do Replace visited config with new config
9:if candidate in ve then new_candidates.replace(candidate, mode(s@))
10:end for
11:return new_candidates >Feed to Code Generator to make measurements on hardware end procedure
+ +Design choices for the adaptive sampling. We use a $\kappa$ -means Clustering to determine centroids of the configurations, because $\kappa$ -means has been shown effective in practice and it only requires $\kappa$ , over error $\epsilon$ or radius in other algorithms which are much more challenging to tune. For example, DBSCAN (Ester et al., 1996) or mean-shift clustering (Comaniciu & Meer, 2002) are very sensitive to the above hyperparameters. On the other hand, $\kappa$ can be framed as a lever to balance the performance and speed of optimizing compilation which abstracts away the aforementioned challenges, enabling the Threshold-based Swift Meta-Search that identifies the optimal number of clusters. + +Hyperparameter tuning. Hyperparameter tuning is a very important task in machine learningbased tools and models. As such, we present the hyperparameters we used for the evaluation in Table 7 (in appendix), which its tuning took several days. For the hyperparameters in Table 8 (in appendix), we used the same set of values that were used in the AutoTVM paper (Chen et al., 2018b) in order to conduct a fair comparison or CHAMELEON. Additionally, for parameters used in the Adaptive Exploration module, which is not present in AutoTVM, we have tuned the hyperparameters using the set of layers presented in Table 5 (in appendix). We emphasize, however, that the hyperparameters have been tuned offline before the deployment of CHAMELEON, and the hyperparameters are not changed during the use of the framework or the experimentation. So the tuning overhead is not part of the compilation after the Adaptive Exploration module is tuned once before releasing the compiler to the deployment practitioners. + +# 4 EVALUATION + +We integrate CHAMELEON into TVM (Chen et al., 2018a) to perform component evaluation and compare with AutoTVM (Chen et al., 2018b). We first evaluate components of CHAMELEON in Section 4.1 and Section 4.2 on set of convolution layers sampled from AlexNet (Krizhevsky et al., 2012), VGG-16 (Simonyan & Zisserman, 2015), and ResNet-18 (He et al., 2016). Then we provide end-to-end evaluation of CHAMELEON on both set of layers and end-to-end deep models, in Section 4.3. Due to space limitations, we present only the representative plots in the paper, and the complete set of results and the details of the parameters are provided in the appendix. + +4.1 ADAPTIVE EXPLORATION: IMPROVING EFFICACY OF SEARCH ALGORITHM + +In the previous approach (Chen et al., 2018b), authors have built a cost model to estimate fitness instead of performing costly measurements on real hardware, then used simulated annealing to find potentially optimal configurations. Figure 7(a) compares the number of search steps taken per iteration to reach or converge to the solution in simulated annealing and Adaptive Exploration, respectively. Overall, observation is that CHAMELEON’s Adaptive Exploration requires $2 . 8 8 \times$ less search steps compared to simulated annealing to find good solution. This comes from the ability of the reinforcement learning algorithm in Adaptive Exploration Module to (1) learn the correlation between different dimensions, and (2) reuse information across different iterations, instead of starting from scratch while naively relying on the stochastic guarantees of simulated annealing process. + +![](images/9ad0ad2777e161304155b61c563bcb6dbb86606a4be75504fda18bc6925fd81c.jpg) +Figure 7: Component evaluation of CHAMELEON. + +# 4.2 ADAPTIVE SAMPLING: REDUCING NUMBER OF COSTLY HARDWARE MEASUREMENTS + +Figure 7(b) summarizes the effect of applying CHAMELEON’s Adaptive Sampling module on simulated annealing and reinforcement learning based search. First, the results show that using Adaptive Sampling helps the framework to make less hardware measurements regardless of the search algorithm used. The Adaptive Sampling algorithm reduces the number of measurements by $1 . 9 8 \times$ when used with simulated annealing and $2 . 3 3 \times$ with reinforcement learning One observation is that the Adaptive Sampling is more effective with reinforcement learning search. This comes from the reinforcement learning agent’s capacity to better localize the search to meaningful samples (exploitation) while still aiming to find good solution by making diverse search (exploration). + +Diversity exploration of AutoTVM aims to spread out the candidate configurations with a regularizing effect that fosters uniform sampling. In contrast, our Adaptive Sampling uses a clustering algorithm to perform more measurements on the regions with higher likelihood of achieving better output performance, leading to a non-uniform sampling. While AutoTVM states that diversity-aware selection had no meaningful impact on + +![](images/80fe02a72091d19f2baf576de93c71118e759109eb64c4eccd2ecdfc04c1cc03.jpg) +Figure 8: Comparison to AutoTVM’s diversity exploration. + +most of the evaluated workloads, our Adaptive Sampling brings significant improvement as depicted in Figure 8. As shown, Adaptive Sampling brings an average of $1 3 . 5 \%$ and $1 9 . 0 \%$ improvement on simulated annealing and reinforcement learning, respectively. + +# 4.3 INTEGRATION: REDUCING OPTIMIZATION TIME AND OUTPUT INFERENCE TIME + +CHAMELEON integrates two components into the workflow: RL-based Adaptive Exploration (AE) and Adaptive Sampling (AS). This section compares the performance of CHAMELEON with AutoTVM (Chen et al., 2018b) that leverages Simulated Annealing (SA) for its exploration. + +Layer evaluation. Figure 9 shows the trend of output code performance of ResNet-18’s 11th layer over number of hardware measurements during optimization. The figure illustrates that our Adaptive Exploration finds better configurations than simulated annealing which results in better output code performance, and the Adaptive Sampling reduces number of hardware measurements significantly during optimization. Also, CHAMELEON’s Adaptive Exploration and Adaptive Sampling working in tandem emits better code with shorter optimization time than others. As such, Figure 10(a) compares optimization time and the performance of the output code in CHAMELEON and AutoTVM to confirm the observation. CHAMELEON achieved $1 . 1 7 \times$ better performance with $4 . 8 2 \times$ shorter optimization time compared to AutoTVM. Overall, the results suggest that our Adaptive Exploration effectively maneuvers the design space, and Adaptive Sampling reduces hardware measurements and the overall optimization time while even improving output performance. + +![](images/902919044cc53df38e045268760dae15b3b4e717f01247ba0a622d6db4bdd025.jpg) +Figure 9: Layer evaluation of output performance for ResNet-18’s 11th layer. + +HAMELEON significantly reduces number of hardware measurements (from 800 to 392) + +
NETWORKSA (AutoTVM)AESA + ASAE+ AS (CHAMELEON)
AlexNet4.31 Hours4.06 Hours1.25 Hours1.20 Hours
VGG-1611.18 Hours8.82 Hours2.57 Hours1.95 Hours
ResNet-189.13 Hours7.39 Hours2.14 Hours2.13 Hours
+ +End-to-end evaluation. Up until now, we have focused on evaluation with subset of layers. Now we continue our discussion to the applicability of CHAMELEON to optimization of end-to-end deep neural networks. Figure 10(b) shows that CHAMELEON spends $3 . 5 9 \times$ , $5 . 7 3 \times$ , and $4 . 2 8 \times$ less time than AutoTVM to optimize AlexNet, VGG-16, and ResNet-18, respectively. On average, our work shows $4 . 4 5 \times$ optimization time speedup while achieving up to $6 . 4 \%$ improvement in terms of performance of output code. Inference time in Figure 10(b) illustrates the speedup for optimized code. Raw numbers are available in Table 2 and Table 3. All in all, such improvements result from efficient Adaptive Exploration and the reduced number of hardware measurements from Adaptive Sampling. + +![](images/5bd4f96ac9884f3aa4fdc206e0be0d33f6da796de011e9711d54ecc3131f0c4e.jpg) +Figure 10: Layer and end-to-end evaluation. Dashed lines denote AutoTVM’s performance. + +Table 2: End-to-end evaluation of the optimization time for deep networks. + +
NETWORKSA (AutoTVM)AESA + ASAE +AS (CHAMELEON)
AlexNet1.0277 ms1.0207 ms0.9762 ms0.9673 ms
VGG-163.9829 ms3.9710 ms3.8733 ms3.8458 ms
ResNet-181.0258 ms0.9897 ms0.9897 ms0.9831 ms
+ +Table 3: End-to-end evaluation of the output performance for deep networks. + +# 5 RELATED WORKS + +CHAMELEON uniquely offers a solution that exclusively enables (i) Reinforcement Learning and (ii) Sampling in the context of (iii) Optimizing Compilers for neural networks. As such, we discuss the related work from each of the three independent research directions. + +Optimizing compilers. TensorComprehensions (Vasilache et al., 2018) and TVM (Chen et al., 2018a) use genetic algorithm and simulated annealing to choose parameters of polyhedral optimization for neural networks. In a more general context, some computing libraries (Whaley & Dongarra, 1998; Frigo & Johnson, 1998) make use of black box optimization and also profiling-based compilation passes (Chang et al., 1991; Novillo, 2014) utilize runtime information to generate optimized code. Later, AutoTVM (Chen et al., 2018b) incorporates learning with boosted trees within the cost model for TVM to reduce the number of real hardware measurements. While CHAMELEON is inspired and builds on these prior works, unlike them, it is based on reinforcement learning for Adaptive Exploration, and Adaptive Sampling that leverages clustering to reduce the number of measurements. + +Reinforcement learning for hyper-parameter optimization. There are a growing body of studies on using reinforcement learning to perform various optimizations (Gao et al., 2018; Mirhoseini et al., 2017; Nareyek, 2003; Mao et al., 2016; Xu et al., 2018; Mao et al., 2019) for a variety of objectives including hyper-parameter optimization for neural networks. For instance, DeepArchitect (Negrinho & Gordon, 2017) and NAS (Zoph & Le, 2017) use reinforcement learning to automate the process of designing deep neural network models and their associated parameters. HAQ (Wang et al., 2019) and ReLeQ (Elthakeb et al., 2018) use reinforcement learning to chose levels of quantization for the layers of a given deep neural network. AMC (He et al., 2018) formulates neural network compression as a RL problem. A most recent effort (Paliwal et al., 2020)–which will be published concurrent to ours in ICLR 2020–combined RL with graph neural networks and genetic algorithms to optimize DNN execution. Our work exclusively explores a different problem, that is optimizing compilers using reinforcement learning. + +Sampling algorithms for learning. Active learning is a broad field (Settles, 2009; Cohn et al., 1996; Sugiyama, 2006; Cai et al., 2013; Goetz et al., 2018; Wu et al., 2019) that uses a measure of the change in the model to decide which training data elements should be used to update the model. Passive learning (Yu & Kim, 2010; O’Neill et al., 2017) is an alternative view that independent of the model, analyze the distribution of the training data set and selects a subset. The Adaptive Sampling algorithm for CHAMELEON shares similarities with Passive learning but it differs in its context. The sampling is designed to reduce the number of samples (configuration) for hardware measurement from the exploration of the design space whilst performing an optimization to accelerate the process. + +# 6 CONCLUSION + +We present CHAMELEON to allow optimizing compilers to adapt to unseen design spaces of code schedules to reduce the optimization time. This paper is also an initial effort to bring reinforcement learning to the realm of optimizing compilers for neural networks, and we also develop an Adaptive Sampling with domain-knowledge inspired Sample Synthesis to not only reduce the number of samples required to navigate the design space but also augment its quality in terms of fitness. Experimentation with real-world deep models shows that CHAMELEON not only reduces the time for compilation significantly, but also improves the quality of the code. This encouraging result suggests a significant potential for various learning techniques to optimizing deep learning models. + +# ACKNOWLEDGEMENT + +We thank the anonymous reviewers for their insightful comments. We also thank Jinwon Lee and Jangho Kim for the fruitful discussions and feedbacks on the manuscript. This work was in part supported by generous gifts from Qualcomm, Google, Microsoft, and Xilinx as well as the Semiconductor Research Corporation (SRC) contract #2019-SD-2884, National Science Foundation (NSF) awards CNS#1703812, ECCS#1609823, CCF#1553192, Air Force Office of Scientific Research (AFOSR) Young Investigator Program (YIP) award #FA9550-17-1-0274, National Institute of Health (NIH) award #R01EB028350, and Air Force Research Laboratory (AFRL) and Defense Advanced Research Project Agency (DARPA) under agreement number #FA8650-20-2-7009. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright notation thereon. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of AFRL, DARPA or the U.S. Government. + +# REFERENCES + +Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. TensorFlow: A system for large-scale machine learning. In OSDI, 2016. + +Byung Hoon Ahn, Jinwon Lee, Jamie Menjay Lin, Hsin-Pai Cheng, Jilei Hou, and Hadi Esmaeilzadeh. Ordering chaos: Memory-aware scheduling of irregularly wired neural networks for edge devices. In MLSys, 2020. + +Takuya Akiba, Shuji Suzuki, and Keisuke Fukuda. Extremely large minibatch SGD: training ResNet-50 on ImageNet in 15 minutes. arXiv, 2017. URL https://arxiv.org/pdf/1711.04325.pdf. + +Wenbin Cai, Ya Zhang, and Jun Zhou. Maximizing expected model change for active learning in regression. In ICDM, 2013. + +Pohua P Chang, Scott A Mahlke, and Wen-Mei W Hwu. Using profile information to assist classic code optimizations. Software: Practice and Experience, 1991. + +Tianqi Chen and Carlos Guestrin. XGBoost: A scalable tree boosting system. In KDD, 2016. + +Tianqi Chen, Thierry Moreau, Ziheng Jiang, Lianmin Zheng, Eddie Yan, Haichen Shen, Meghan Cowan, Leyuan Wang, Yuwei Hu, Luis Ceze, et al. TVM: An automated end-to-end optimizing compiler for deep learning. In OSDI, 2018a. + +Tianqi Chen, Lianmin Zheng, Eddie Yan, Ziheng Jiang, Thierry Moreau, Luis Ceze, Carlos Guestrin, and Arvind Krishnamurthy. Learning to optimize tensor programs. In NeurIPS, 2018b. + +Valeriu Codreanu, Damian Podareanu, and Vikram Saletore. Achieving deep learning training in less than 40 minutes on ImageNet-1K & best accuracy and training time on ImageNet-22K & Places-365 with scale-out Intel R Xeon R /Xeon PhiTM architectures, 2017. URL https://blog.surf.nl/en/ imagenet-1k-training-on-intel-xeon-phi-in-less-than-40-minutes/. + +David A Cohn, Zoubin Ghahramani, and Michael I Jordan. Active learning with statistical models. JAIR, 1996. + +Dorin Comaniciu and Peter Meer. Mean shift: A robust approach toward feature space analysis. TPAMI, 2002. + +Ahmed T Elthakeb, Prannoy Pilligundla, Amir Yazdanbakhsh, Sean Kinzer, and Hadi Esmaeilzadeh. ReLeQ: A reinforcement learning approach for deep quantization of neural networks. arXiv, 2018. URL https: //arxiv.org/pdf/1811.01704.pdf. + +Martin Ester, Hans-Peter Kriegel, Jorg Sander, and Xiaowei Xu. A density-based algorithm for discovering ¨ clusters a density-based algorithm for discovering clusters in large spatial databases with noise. In KDD, 1996. + +Matteo Frigo and Steven G Johnson. FFTW: An adaptive software architecture for the FFT. In ICASSP, 1998. + +Yuanxiang Gao, Li Chen, and Baochun Li. Post: Device placement with cross-entropy minimization and proximal policy optimization. In NeurIPS, 2018. + +Jack Goetz, Ambuj Tewari, and Paul Zimmerman. Active learning for non-parametric regression using purely random trees. In NeurIPS, 2018. + +Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch,´ Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: Training ImageNet in 1 hour. arXiv, 2017. URL https://arxiv.org/pdf/1706.02677.pdf. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. + +Yihui He, Ji Lin, Zhijian Liu, Hanrui Wang, Li-Jia Li, and Song Han. AMC: AutoML for model compression and acceleration on mobile devices. In ECCV, 2018. + +Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. MobileNets: Efficient convolutional neural networks for mobile vision applications. arXiv, 2017. URL https://arxiv.org/pdf/1704.04861.pdf. + +Ken Kennedy and John R Allen. Optimizing compilers for modern architectures: a dependence-based approach. Morgan Kaufmann Publishers Inc., 2001. + +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. ImageNet classification with deep convolutional neural networks. In NIPS, 2012. + +Chris Lattner and Vikram Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO, 2004. + +Yann LeCun. Deep learning hardware: Past, present, and future. In ISSCC, 2019. + +Yizhi Liu, Yao Wang, Ruofei Yu, Mu Li, Vin Sharma, and Yida Wang. Optimizing CNN model inference on CPUs. In USENIX ATC, 2019. + +Hongzi Mao, Mohammad Alizadeh, Ishai Menache, and Srikanth Kandula. Resource management with deep reinforcement learning. In HotNets, 2016. + +Hongzi Mao, Malte Schwarzkopf, Shaileshh Bojja Venkatakrishnan, Zili Meng, and Mohammad Alizadeh. Learning scheduling algorithms for data processing clusters. In SIGCOMM, 2019. + +Peter Mattson, Christine Cheng, Cody Coleman, Greg Diamos, Paulius Micikevicius, David Patterson, Hanlin Tang, Gu-Yeon Wei, Peter Bailis, Victor Bittorf, et al. MLPerf training benchmark. arXiv, 2019. URL https://arxiv.org/pdf/1910.01500.pdf. + +Azalia Mirhoseini, Hieu Pham, Quoc V Le, Benoit Steiner, Rasmus Larsen, Yuefeng Zhou, Naveen Kumar, Mohammad Norouzi, Samy Bengio, and Jeff Dean. Device placement optimization with reinforcement learning. In ICML, 2017. + +Alexander Nareyek. Choosing search heuristics by non-stationary reinforcement learning. In Metaheuristics: Computer Decision-Making. Springer, 2003. + +Renato Negrinho and Geoff Gordon. DeepArchitect: Automatically designing and training deep architectures. arXiv, 2017. URL https://arxiv.org/pdf/1704.08792.pdf. + +Diego Novillo. SamplePGO - the power of profile guided optimizations without the usability burden. In LLVM Compiler Infrastructure in HPC, 2014. + +Jack O’Neill, Sarah Jane Delany, and Brian MacNamee. Model-free and model-based active learning for regression. In Advances in Computational Intelligence Systems. Springer, 2017. + +Aditya Paliwal, Felix Gimeno, Vinod Nair, Yujia Li, Miles Lubin, Pushmeet Kohli, and Oriol Vinyals. Reinforced genetic algorithm learning for optimizing computation graphs. In ICLR, 2020. URL https: //openreview.net/forum?id $=$ rkxDoJBYPB. + +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019. + +Nadav Rotem, Jordan Fix, Saleem Abdulrasool, Garret Catron, Summer Deng, Roman Dzhabarov, Nick Gibson, James Hegeman, Meghan Lele, Roman Levenstein, et al. Glow: Graph lowering compiler techniques for neural networks. arXiv, 2018. URL https://arxiv.org/pdf/1805.00907.pdf. + +Eric Schkufza, Rahul Sharma, and Alex Aiken. Stochastic superoptimization. In ASPLOS, 2013. + +John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv, 2017. URL https://arxiv.org/pdf/1707.06347.pdf. + +Burr Settles. Active learning literature survey. Technical report, University of Wisconsin-Madison Department of Computer Sciences, 2009. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015. + +Richard M Stallman and GCC DeveloperCommunity. Using the GNU compiler collection: a GNU manual for GCC version 4.3.3. CreateSpace, 2009. + +Masashi Sugiyama. Active learning in approximately linear regression based on conditional expectation of generalization error. JMLR, 2006. + +Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015. + +Nicolas Vasilache, Oleksandr Zinenko, Theodoros Theodoridis, Priya Goyal, Zachary DeVito, William S Moses, Sven Verdoolaege, Andrew Adams, and Albert Cohen. Tensor Comprehensions: Frameworkagnostic high-performance machine learning abstractions. arXiv, 2018. URL https://arxiv.org/ pdf/1802.04730.pdf. + +Kuan Wang, Zhijian Liu, Yujun Lin, Ji Lin, and Song Han. HAQ: Hardware-aware automated quantization with mixed precision. In CVPR, 2019. + +R Clinton Whaley and Jack J Dongarra. Automatically tuned linear algebra software. In SC, 1998. + +Mitchell Wortsman, Ali Farhadi, and Mohammad Rastegari. Discovering neural wirings. In NeurIPS, 2019. + +Dongrui Wu, Chin-Teng Lin, and Jian Huang. Active learning for regression using greedy sampling. Information Sciences, 2019. + +Saining Xie, Alexander Kirillov, Ross Girshick, and Kaiming He. Exploring randomly wired neural networks for image recognition. In ICCV, 2019. + +Zhongwen Xu, Hado P van Hasselt, and David Silver. Meta-gradient reinforcement learning. In NeurIPS, 2018. + +Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv, 2017. URL https://arxiv.org/pdf/1708.03888.pdf. + +Yang You, Zhao Zhang, Cho-Jui Hsieh, James Demmel, and Kurt Keutzer. ImageNet training in minutes. In ICPP, 2018. + +Hwanjo Yu and Sungchul Kim. Passive sampling for regression. In ICDM, 2010. + +Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. BMVC, 2016. + +Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. ICLR, 2017. URL https://openreview.net/forum?id $=$ r1Ue8Hcxg. + +# APPENDIX + +A EXPERIMENTAL SETUP + +A.1 DNN MODELS AND LAYERS + +Table 4: Details of the DNN models used in evaluating CHAMELEON. + +
NETWORKDATASETNUMBER OF TASKS
AlexNetImageNet5
VGG-16ImageNet9
ResNet-18ImageNet12
+ +Table 5: Details of the layers used in evaluating CHAMELEON. + +
NAMEMODELLAYER TYPETASK INDEX
L1AlexNetconvolution1
L2AlexNetconvolution4
L3VGG-16convolution1
L4VGG-16convolution2
L5VGG-16convolution4
L6ResNet-18convolution6
L7ResNet-18convolution9
L8ResNet-18convolution11
+ +# A.2 HARDWARE SPECIFICATION + +Table 6: Details of the hardware used for evaluation of CHAMELEON. + +
SPECIFICATIONSDETAILS
GPUTitan Xp
Host CPU3.4G Hz Intel Core i7
Main Memory32GB 2400 MHz DDR3
+ +# A.3 HYPER-PARAMETERS + +Table 7: Hyper-parameters uses in CHAMELEON. + +
HYPERPARAMETERVALUEDESCRIPTION
iterationopt16number of iterations for optimization process (equivalent to 1Ooo hardware measurements)
modeGBT bGBTxgb-regtype of loss used for cost model
64maximum batch size of planning in GBT(Chen & Guestrin,2016) cost model per iteration of optimization process
episoderl128number of episodes for reinforcement learning
steprl500maximum steps of one reinforcement learning episode
thresholdmeta2.5threshold used for meta-search in sampling
+ +Table 8: Hyper-parameters uses in AutoTVM (Chen et al., 2018b). + +
HYPERPARAMETERVALUEDESCRIPTION
£(bGBT)1000totalnumber of hardwaremeasurements
modeGBTxgb-regtype of loss used for cost model
bGBT64batch size of planning in GBT(Chen& Guestrin,2016)
nsa128number of Markov chains in parallel simulated annealing
stepsa500maximum steps of one simulated annealing run
+ +Table 9: Hyper-parameters used in CHAMELEON’s PPO (Schulman et al., 2017) search agent. + +
HYPERPARAMETERVALUE
Adam Step Size Discount Factor1×10-3
GAE Parameter0.9
Number of Epochs0.99
Clipping Parameter3
Value Coefficient0.3
1.0
Entropy Coefficient0.1
+ +# B ADDITIONAL EXPERIMENTAL RESULTS + +# B.1 OPTIMIZATION TIME BREAKDOWN FOR DNN MODELS + +![](images/026a53d0d37fc394dbde9ee260ed92631908ad47f92de723d2f9d7a13438b6e1.jpg) +Figure 11: AutoTVM optimization time for AlexNet (Krizhevsky et al., 2012) and VGG-16 (Simonyan & Zisserman, 2015), and ResNet-18 (He et al., 2016) on Titan Xp. Numbers in bars denote fraction of time for measurements. + +![](images/3c8b2503e8f20893f004a618595f804ee4202bdce892dd2dd37cf5019a6c7a97.jpg) +Figure 12: Layer evaluations for AlexNet (Krizhevsky et al., 2012). + +![](images/01cae0b30b91a657d3523b35270fbc77354a18f41266d34fb3123c16b6bd7b20.jpg) +Figure 13: Layer evaluations for VGG-16 (Simonyan & Zisserman, 2015). + +![](images/8d074821723c328e9d090e41a9d4a947aea4d674ac66384eb9bb3c3baedf687b.jpg) +Figure 14: Layer evaluations for ResNet-18 (He et al., 2016). \ No newline at end of file diff --git a/md/train/tjdHCnPqoo/tjdHCnPqoo.md b/md/train/tjdHCnPqoo/tjdHCnPqoo.md new file mode 100644 index 0000000000000000000000000000000000000000..a37c34d45a1815f970de255ff4c6d95e4d0c52cd --- /dev/null +++ b/md/train/tjdHCnPqoo/tjdHCnPqoo.md @@ -0,0 +1,381 @@ +# Is Automated Topic Model Evaluation Broken?: The Incoherence of Coherence + +# Alexander Hoyle∗ + +Pranav Goel∗ + +Denis Peskov∗ + +Computer Science + +Andrew Hian-Cheong∗ + +Jordan Boyd-Graber + +Philip Resnik + +CS, iSchool, UMIACS, LSC UMIACS, Lingusitics + +University of Maryland {hoyle,pgoel1,dpeskov,andrewhc,jbg,resnik}@cs.umd.edu + +# Abstract + +Topic model evaluation, like evaluation of other unsupervised methods, can be contentious. However, the field has coalesced around automated estimates of topic coherence, which rely on the frequency of word co-occurrences in a reference corpus. Contemporary neural topic models surpass classical ones according to these metrics. At the same time, topic model evaluation suffers from a validation gap: automated coherence, developed for classical models, has not been validated using human experimentation for neural models. In addition, a meta-analysis of topic modeling literature reveals a substantial standardization ${ g a p }$ in automated topic modeling benchmarks. To address the validation gap, we compare automated coherence with the two most widely accepted human judgment tasks: topic rating and word intrusion. To address the standardization gap, we systematically evaluate a dominant classical model and two state-of-the-art neural models on two commonly used datasets. Automated evaluations declare a winning model when corresponding human evaluations do not, calling into question the validity of fully automatic evaluations independent of human judgments. + +# 1 Revisiting Topic Model Evaluation + +Topic models are a machine learning technique widely used outside computer science, including political science (Grimmer and Stewart, 2013; Isoaho et al., 2021), social and cultural studies (Mohr and Bogdanov, 2013), digital humanities (Meeks and Weingart, 2012), and bioinformatics (Liu et al., 2016). Typically, topic model users are domain experts trying to identify global categories or themes present in a document collection (Boyd-Graber et al., 2017). This practice constitutes a computer-assisted form of content analysis (Krippendorff, 2004; Chuang et al., 2014), also related to distant reading in literary studies (Underwood, 2017). In general, topic models help humans understand large corpora.2 + +Evaluation of topic models has vacillated between automated and human-centered. While real-world users of topic models evaluate outputs based on their specific needs, topic model developers have gravitated toward generalized, automated proxies of human judgment to help inform rapid iteration of models (Doogan and Buntine, 2021). Initially, models were evaluated with held-out perplexity, but it disagrees with human interpretability (Chang et al., 2009). Consequently, the field adopted automated coherence metrics like normalized pointwise mutual information (NPMI), a measure of word relatedness that does correlate with topic interpretability (Section 2.2; Newman et al., 2010; Aletras and Stevenson, 2013; Lau et al., 2014). The balance shifted towards automated coherence. + +Human evaluations have been abandoned by topic model developers in the years since automated coherence metrics were adopted. In a thorough meta-analysis of contemporary topic model methods papers, none conduct systematic human evaluations (Section 3). Instead, they rely solely on automated metrics for model comparison.3 However, current neural topic models are a far cry from the classical models that substantiated the original correlations—manifestly, topics produced by neural models are often qualitatively distinct from those of classical models (e.g., Table 1).4 This validation gap raises the question of whether automated metrics are still consistent with human judgments of topic quality. + +
ClassicalNeural
station line bridge railway trainsalbum band music song releasedtropical storm hurricane cyclone depressiontropical landfall cyclone utc weakeningspore basidia spores mycologist hyphaemanhattan_project los_alamos_laboratory robert_oppenheimer enrico_fermi physicist
NPMI0.2740.2850.3940.4460.4560.470
+ +Table 1: The first three columns are the highest-NPMI topics for a classical topic model (LDA estimated via Gibbs sampling using Mallet, McCallum, 2002; Griffiths and Steyvers, 2004). The next three are counterparts from a neural model (our D-VAE reimplementation, Burkhardt and Kramer, 2019). Models are trained on Wikitext (Merity et al., 2017) with fifty topics, and NPMI is estimated over the top five words in each topic using a 4.6M-document reference Wikipedia corpus. The mean top-five NPMI over all topics is 0.156 for the classical and 0.256 for the neural model. + +Moreover, we should always be cautious when extrapolating outside the range of data that was used to establish a relationship between variables. As an example, a neural model in Hoyle et al. (2020) produces much larger NPMI values than those used to determine human correlations in the original Lau et al. (2014) study; the implicit assumption is that greater NPMI corresponds to more humaninterpretable topics. Finally, a myopic focus on a presumed proxy for human preferences can produce low-quality results (Stiennon et al., 2020). Does Goodharts’ law—“when a measure becomes a target, it ceases to be a good measure” (Strathern, 1997)—apply to automated metrics of topic models? + +Another challenge for automated evaluation, whether of classical or neural topic models, is widespread inconsistency (Section 3). Researchers frequently fail to specify the information needed to calculate automated metrics or diverge from the practices that underpin human correlations. Furthermore, evaluation datasets, preprocessing, and hyperparameter optimization vary dramatically, even within a given paper. This standardization gap likely limits the generalizability and reliability of topic model developers’ findings. + +We address the standardization and validation gaps in topic model evaluation: + +1. We present a meta-analysis of neural topic model evaluation (Section 3); +2. we develop standardized, pre-processed versions of two widely-used English-language evaluation datasets, along with a transparent end-to-end code pipeline for reproduction of results (Section 4.1)5; +3. we optimize three topic models—one classical and two neural—using identical preprocessing, model selection criteria, and hyperparameter tuning (Section 4.2); +4. we evaluate these models using human ratings and word intrusion tasks (Section 5); and +5. we provide new evaluations of the correlation between automated and human evaluations (Section 6). + +Our findings challenge the validity of fully-automated evaluations as currently practiced: automated evaluation declares winners between models when the corresponding human evaluations cannot. + +# 2 Operationalizing Topic Coherence + +A topic model is a probabilistic generative model of text that uses latent topics to summarize a larger collection of documents. The most influential variant, latent Dirichlet allocation (Blei et al., 2003, LDA), assumes that $K$ latent topics are distributions over word types, $\beta _ { k }$ , and that the documents $\mathcal { D }$ are admixtures over the topics, $\theta _ { d }$ . Users often evaluate model outputs globally, focusing on the most probable $N$ words of each topic, and locally, considering the most probable topics for each document. + +While techniques for topic modeling have progressed from variational inference (Blei et al., 2003) to Gibbs sampling (Griffiths and Steyvers, 2004) to deep generative approaches (Srivastava and Sutton, 2017; Wang et al., 2020b), the core goal discussed in Section 1, obtaining human-understandable categories, remains central. The latest wave of methods, neural topic models (NTM), use continuous word representations and gradient optimization to fit parameters. These models claim to produce more interpretable topics than other prior methods, including LDA. + +Those claims are supported by improvements on automated measures of topic coherence. + +# 2.1 Human Metrics of Topic Coherence + +Like the concept of interpretability, that of real-world coherence is “simultaneously important and slippery” (Lipton, 2018). We will not attempt to formalize it here—though see discussion in Section 7. For present purposes, the term has its roots in Latin cohaerere, “to stick together,” and we will think of coherence as an intangible sense, available to human readers, that a set of terms, when viewed together, enable human recognition of an identifiable category.6 We review two human ratings of topic quality: direct ratings and intrusion. + +Rating Raters see a topic and then give the topic a quality score, conventionally on a three-point ordinal scale (Newman et al., 2010; Mimno et al., 2011; Aletras and Stevenson, 2013, inter alia). + +Intrusion Chang et al. (2009) devise the word intrusion task as a behavioral way to assess topic coherence. The core idea is that when the top words in a topic identify a coherent latent category, it is easier to identify words that do not belong to that category. Operationally, each topic is represented as its top words plus one “intruder” word which has a low probability of belonging to that topic, but a high probability of belonging to a different topic. Topic coherence is then judged by how well human annotators detect the “intruder” word. + +# 2.2 NPMI: The Standard Automated Topic Model Coherence Evaluation + +Using the word intrusion task, Chang et al. (2009) showed that perplexity—the original topic model evaluation metric—negatively correlates with human evaluations of topic quality. This finding revealed a need for an automated measurement of topic coherence: an automated metric can measure model quality without expensive, time-consuming, and difficult-to-reproduce human experiments. + +Lau et al. (2014) find some metrics that positively correlate with human intrusion and rating scores, particularly when aggregating scores over all topics from a given model. Because of that validation, the prevailing evaluation for model comparison is pairwise normalized pointwise mutual information. NPMI scores topics highly if the top $N$ words—summed over all pairs $w _ { i }$ and $w _ { j }$ —have high joint probability $P ( w _ { j } , w _ { i } )$ compared to their marginal probability:7 + +$$ +\sum _ { j = 2 } ^ { N } \sum _ { i = 1 } ^ { j - 1 } \frac { l o g \frac { P ( w _ { j } , w _ { i } ) } { P ( w _ { i } ) P ( w _ { j } ) } } { - l o g P ( w _ { i } , w _ { j } ) } . +$$ + +The probabilities are estimated using word co-occurrence counts from a reference corpus for a specific context window (which can range from ten words to the entire document). As a result, the choice of reference corpus determines the strength of human correlation (Lau et al., 2014; Röder et al., 2015). + +
ExperimentationCount
Preprocessing
Inconsistent over datasets12(30%)
Ambiguous preprocessing9(23%)
Model comparisons
All models tuned5(13%)
Unclearh.paramsearch16(40%)
UnclearLDA baseline,if used7(24%)
Recent baseline (w/in 2 yrs)31(78%)
Multiple runs /sig. testing11(28%)
+ +Table 2: Meta-analysis of forty neural topic modeling papers (denominator may change, as not all conditions are applicable). No recent neural topic modeling papers use human evaluations of coherence, and the metrics and models are difficult to replicate. + +
EvaluationCount
Number of human evaluations AutomatedCoherence0(0%)
Metric NPMI26(72%)
Other22(61%)
Explicit implementation22(61%)
Explicit ref. corpus10(28%)
Perplexity w/o coherence3(8%)
+ +A measurement is valid to the extent that it measures what it is intended to measure in the real world. Historically, automated coherence has been validated using human judgements from either crowdworkers (Newman et al., 2010; Aletras and Stevenson, 2013) or experts (Mimno et al., 2011). However, correlations based on classical models may not be applicable for NTMs. Our skepticism is motivated by theory, as neural word representations are intimately connected to NPMI, as explicitly used by Aletras and Stevenson (2013) and which produce similar NPMI scores as Lau et al. (2014). Levy and Goldberg (2014) show that multiple representations create factorizations of PMI matrices. Topic models that have access to these rich representations (e.g. Dieng et al., 2020, and others) could thus create topics with good NPMI scores without explaining the corpus well to a user. In contrast to classical topic models, no one has investigated the validity of NPMI evaluation for NTMs. + +Given this lacuna, we conduct experiments aimed at validating that automated topic evaluations still correlate with human judgments of neural topic model quality. We compare against two common human evaluations of individual topic quality: direct rating and intrusion. Human evaluations, like automated topic modeling, lack standardization, which we address in Section 5. + +# 3 A Meta-Analysis of Neural Topic Modeling + +We survey the neural topic modeling (NTM) literature to assess the state of evaluation in contemporary topic model development. First, we take all references made by an existing, comprehensive survey of NTMs (Zhao et al., 2021b), from which we select (a) modeling papers which (b) mention topic interpretability and (c) compare models’ topics with an existing baseline. This yields forty models, which all claim superior topic coherence. We examine data processing steps, hyperparameter tuning, baseline selection, and automated coherence calculations. Table 2 summarizes our results and Appendix A.1 enumerates the papers. + +Our analysis reveals variance in all areas. Preprocessing, which can significantly affect model quality and automated metrics, is often $( 3 0 \% )$ inconsistent across datasets within the same paper. When preprocessing is consistent, authors omit details necessary to fully replicate the pipeline. These issues imply that automated metrics for the same baselines and source datasets vary across papers. Compounding the problem, researchers often train their models on different datasets from those used to establish the relationships between human annotations and automated metrics; Doogan and Buntine (2021) find that the same metrics may not predict interpretability in new domains. Mirroring findings from Dodge et al. (2019), $40 \%$ of papers fail to clearly specify their model tuning procedure, often even the metric used for model selection. + +Calculation of automated coherence metrics is equally fraught. As discussed in Section 2.2, a complete specification for NPMI involves several pieces of information, including the reference corpus used to estimate joint word probabilities, the co-occurrence window size, and the number of words selected from the head of the topic distribution. Three out of four papers fail to explicitly indicate the reference corpus; even when we can assume the input corpus is used (13 cases), it remains uncertain whether authors use, e.g., a held-out set or the training documents themselves. For the $61 \%$ that specify the implementation of their coherence metric (by pointing to a code repository or writing out the formula), some of these factors may still be in question. For instance, six authors reference Lau et al. (2014) and the supporting code,8 but the implications are ambiguous: the original paper suggests a large corpus from the same source as the training data, but the repository script defaults to Wikipedia. In other cases, authors use bespoke implementations, which creates room for errors, or deviate from the settings used in human experiments. For example, several papers use a document-wide context window with NPMI, which has not been correlated with human judgments. + +Last, even $i f$ automated evaluations are consistent, all claims of coherence improvement depend on the validity results in Lau et al. (2014) generalizing to neural topic models. + +# 4 Closing the Standardization Gap for Topic Models + +Our human evaluation of topic model outputs serves multiple purposes: (a) establishing whether NTMs show improved coherence over a classical baseline and (b) re-evaluating the efficacy and reliability of automated coherence metrics. In addition, a key goal is (c) to provide a standardized preprocessing pipeline to support head-to-head comparisons as new methods are developed.9 + +We identify two commonly-used datasets, which we in turn process using a standard pipeline. We then estimate topic models on each dataset following a computationally fair hyperparameter search. Our standardization efforts are similar to concurrent work by Terragni et al. (2021); the main differences are that we (a) mandate consistent preprocessing between training and reference corpora, (b) support multi-word expressions during vocabulary creation (see below), and (c) support distributed hyperparameter searches. + +# 4.1 Datasets and Preprocessing + +Following Chang et al. (2009), we use English articles from Wikipedia and the New York Times (Table 7). For Wikipedia, we use Wikitext-103 (WIKI, Merity et al., 2017), and for the Times, we subsample roughly $15 \%$ of documents from LDC2008T19 (NYT, Sandhaus, 2008), making it an order of magnitude larger than WIKI. To compute reference counts, we use a 4.6M document Wikipedia dump from September 2017 and the full 1.8M document LDC2008T19 set, processed identically to the training data. + +We use SpaCy (Honnibal et al., 2020) to tokenize and identify entities in the text. We create new tokens for detected entities of the form New_York_City, per Krasnashchok and Jouili (2018). Schofield and Mimno (2016) find that lemmatization and word-stemming can hurt English topic interpretability, so we do not lemmatize. To maintain a roughly equal vocabulary size over datasets, we use a power-law relationship of corpus size (c.f. Zipf, 1949) to rule out tokens occurring in fewer than a given number of documents.10 In addition to a standard stopword list, we define corpus-specific stopwords as tokens appearing in more than $90 \%$ of documents. See Appendix A.2 for complete preprocessing details. + +# 4.2 Models + +We evaluate one venerable classical model and two newer neural models: + +Gibbs-LDA As a strong classical baseline, we use the widely-loved Mallet (McCallum, 2002) implementation of Gibbs-sampling for LDA (Griffiths and Steyvers, 2004). Mallet produces topics of (qualitatively) competitive quality to neural models (Srivastava and Sutton, 2017). + +Dirichlet-VAE We reimplement Dirichlet-VAE (Burkhardt and Kramer, 2019), a state-of-the-art NTM. For simplicitly, we use pathwise gradients for the Dirichlet (Jankowiak and Obermeyer, 2018), rather than the rejection sampling variational inference of the authors’ primary variant.11 DirichletVAE is a wholesale improvement on one of the first successful NTMs, the popular ProdLDA (Srivastava and Sutton, 2017), and is competitive against recent models on automated coherence. The generative + +![](images/b78bf2833c66347f64516d418b096007d4f44b4af7667f0dc917e03dd66a25a5.jpg) + +Figure 1: The word intrusion task presented to crowdworkers (the ratings task is in Appendix A.4). + +model is simple and retains a broad similarity to LDA. The primary difference is that it does not constrain the estimated topic-word distributions to the simplex. + +ETM Thanks to their improved flexiblity, many NTMs incorporate external word representations, on the premise that large-scale, general language knowledge improves topic quality (Bianchi et al., 2021; Hoyle et al., 2020). The Embedded Topic Model (Dieng et al., 2020) is a popular NTM that relies on word embeddings in its generative model.12 + +We maintain a fixed computational budget per model following the exhortation of Dodge et al. (2019) and use a random set of 164 hyperparameter settings across datasets for each model type.13 We train models for a variable number of steps (a hyperparameter); to calculate automated coherence for the model, we use the topics produced at the last step. For human evaluations, we select the models that maximize NPMI, estimated using the reference corpus with a ten-word window over the top ten topic words, per Lau et al. (2014). We follow the recommendation of Dieng et al. (2020) and learn skip-gram embeddings on the training corpus for ETM (experiments with external pretrained embeddings did not yield substantially different results). As in Hoyle et al. (2020), we eliminate models with highly redundant topics, a known degeneracy of NTMs (Burkhardt and Kramer, 2019): (a) models in which any of the top five words of one topic overlap with another and (b) models that have a topic uniqueness score (Nan et al., 2019) above 0.7. Ranges for hyperparameters and other details are in Appendix A.3. + +# 5 Human Evaluations of Topic Quality + +We use the ratings and word intrusion tasks from Section 2.2 as human evaluations of topic quality. We recruit crowdworkers using Prolific.co, an online panel provider and collect data with the Qualtrics survey platform. We pay workers 2.5 USD per ratings survey and 3 USD per word intrusion survey, equivalent to 15 USD/hour. + +In order to draw meaningful conclusions from human annotations, we require an adequate number of participants to ensure acceptable statistical power. However, Card et al. (2020) show that many NLP experiments, including those relying on human evaluation, are insufficiently powered to detect model differences at reported levels. Adopting a straightforward generative model of annotations (Appendix A.5), we select enough crowdworkers per task to ensure sufficient statistical power (at least $1 - \beta = 0 . 9 ,$ ) to obtain significance at $\alpha = 0 . 0 5$ , resulting in a minimum of fifteen crowdworkers per topic for both tasks. On this criterion, both Chang et al. (2009) and thus Lau et al. (2014), with eight annotators, are underpowered. + +For each of our two datasets, we generate fifty topics each from the three models in Section 4.2. In the word intrusion task, we sample five of the top ten topic words plus one intruder; for the ratings task, we present the top ten words in order (Figure 4). We separate the datasets for each task and randomly sample 40 of the 150 topics. In the ratings task, we include an additional sixteen synthetic poor-quality topics to help calibrate scores and filter out low-quality respondents.14 + +![](images/d4b91800d9e7b7ff7997c7159fa9a556a5d2a977b8f0c42eea33a90c0248c366.jpg) +Figure 2: While automated evaluations (here, NPMI) suggest a clear winner between models, human evaluation is more nuanced. Human judgments exhibit greater variability over a smaller range of values. Colored circles correspond to pairwise one-tailed significance tests between model scores at $\alpha = 0 . 0 5$ ; for example, the rightmost orange circle at bottom right shows that human intrusion ratings for D-VAE are significantly higher than ETM for topics derived from Wikipedia. + +Phrasing of questions closely follows the wording used by Chang et al. (2009), and crowdworkers received detailed instructions with examples (Appendix A.4) before responding to items.15 As topics can be esoteric (e.g., last columns of Table 1), we ask crowdworkers about their familiarity with the words in each question. We speculate that this question can help protect against spurious low scores for otherwise coherent topics, as real-world users of topic models are usually familiar with domain-specific terminology (see further discussion in Section 7). + +# 6 Human Judgment Differs From Automated Metrics + +We compare human judgments to automated methods on topics estimated using our three models. + +# 6.1 Human Assessment + +To establish model differences using human ratings, we use pairwise significance tests: a proportion test for the intrusion scores, a $U$ test (Mann and Whitney, 1947) for the ratings, and a $t$ -test for automated metrics (Figure 2), using one-tailed tests for each pair in both directions. Although D-VAE fares better on the intrusion task, evaluation using ratings favors G-LDA.16 + +Our human evaluation results are consistent with past iterations of the ratings and word intrusion tasks for topic models. Mimno et al. (2011) report an average of 2.36 on the ratings task on a dataset of medical paper abstracts.17 Our ratings means are 2.5 to 2.8 across all variations (Figure 2). Our word intrusion means range from 0.7 to 0.8, which is comparable to the roughly 0.8 accuracy on the LDA model evaluated in Chang et al. (2009). Median time taken on the tasks was 8–9 minutes. + +Table 3: Spearman correlation coefficients between mean human scores and automated metrics. Underlined values have overlapping bootstrapped $9 5 \%$ confidence intervals with that of the largest value in each row. “Concatenated” refers to correlations computed on a concatenation of values for the NYT and WIKI items. “Val” is a small held-out set of $15 \%$ of the training corpus. Using the more data-appropriate logistic and ordered probit regressions for word intrusion and ratings data leads to different conclusions about relative metric strength (Appendix Table 10). CIs are estimated using 1,000 samples. + +
Ref. Corpus→ Train Corpus↓NPMI (10-token window)Cu (110-token window)
NYTWIKITrainValNYTWIKITrainVal
IntrusionNYT0.270.430.270.240.340.450.350.34
WIKI0.340.360.390.170.320.340.340.20
Concatenated0.290.400.320.170.320.400.350.24
RatingNYT0.370.480.370.390.410.460.440.45
WIKI0.340.410.440.280.320.400.400.34
Concatenated0.370.440.410.350.380.420.420.42
+ +Following Aletras and Stevenson (2013), we calculate inter-annotator agreement with the mean Spearman correlation between each respondent’s score per topic and the average of other respondent scores, obtaining a value of 0.75 (compare to their value of 0.7 on the NYT corpus). Additionally, we include synthetic poor-quality topics (footnote 14)—correctly identified by annotators—and we monitor the duration taken for the survey to hedge against insincere submissions. + +# 6.2 Automated Metrics + +NPMI declares D-VAE the unequivocal victor among the three models (with G-LDA a clear second), a very different story from the human judgments. To understand the relationship between automated metrics and human ratings, we estimate the Spearman correlation between the two sets of values for each task and dataset for metric variants (Table 3). Although previous studies have used mean human ratings over topics, this decision obscures the inherent variance of the human ratings and leads to overconfident estimates. We therefore construct $9 5 \%$ confidence intervals by resampling ratings, with replacement, equal to the number of annotators per task (Table 3). We estimate NPMI with the standard 10-word window and $C _ { v }$ (Röder et al., 2015) with the recommended 110-word window.18 The Wikipedia corpus appears to be best correlated with human judgments, even for the models trained on the NYT corpus—this contradicts Lau et al. (2014), where within-domain data have the highest correlations. + +While all correlation coefficients are statistically significant, the strength of the correlation alone does not justify their use in model selection, as is standard in the NTM literature (Section 3). In particular, the inherent uncertainty of human judgments means that it is difficult to determine when an increase in a model’s mean automated coherence implies a significant improvement in the corresponding human scores.19 + +As noted above (Figure 2), automated metrics exaggerate model differences compared to human judgments. To help clarify the utility of automated metrics for model selection, we ask how often an automated metric incorrectly asserts that one model is superior to another. To do so, we generate a bootstrapped estimate of the false discovery rate of each model. First, for each dataset, we randomly sample two independent sets of $K = 5 0$ topics (without replacement) from the original pool of 150, along with their corresponding automated and human scores (resampled with replacement, as in Table 3). Treating the two sampled sets as outputs from two different models, we compute pairwise significance tests between each set for both the $K$ automated metrics and $K \times M$ human scores (using a proportions $z$ -test for the intrusion scores and $t$ -tests for all other values). After repeating this process for $N = 1 0 0 0$ iterations, we report the proportion of significant differences detected using + +
Ref. Corpus→ Train Corpus ↓NPMI (10-token window)Cu (110-token window)
NYTWIKITrainNYTWIKITrain
IntrusionNYT46/5334/4848/5035/3830 /2934/35
RatingWIKI44/7633/7833/7545/4838/4937 /45
Concatenated42/6740/6641/6436/4631/4430/45
NYT45/5045/5141/4727/2926/2621/26
WIKI40/7331/7333/7138/4031/4028 /34
Concatenated39 /6636/6637/6231/3828/3819 /36
+ +Table 4: False discovery rate (1−precision, lower is better) and false omission rate of significant model differences when using automated metrics; automated metrics often overstate meaningful model differences. Bolded values are those with the lowest geometric mean of FDR and FOR. We sample two independent sets of 50 topics along with their human scores and automated metrics; these sets act as the outputs of two “models”. We then compute significance tests between sets (per Figure 2) on both the automated scores and human scores. A false positive occurs when one set has significantly larger automated scores despite no meaningful difference in actual human scores. Estimates are over 1,000 samples. + +![](images/7c93a79f520ef9c7705d69318a21f9cbb9c645542c5025b7c7b1f9c5756e0d16.jpg) +Figure 3: Mean human evaluation on the ratings and word intrusion tasks, after filtering out respondents who reported a lack of familiarity with the topic words. When filtering, D-VAE scores improve, highlighting its tendency to produce esoteric topics. + +the predicted scores despite equivalent human scores (after correcting for the probability of type I errors, $\alpha = 0 . 0 5$ ).20 Even the best-performing automated metrics predict significant differences absent a meaningful human effect roughly one-fifth of the time (Table 4). + +These results suggest that automated metrics alone may be inadequate for model comparison. + +# 6.3 Explaining the discrepancy + +One reason for the discrepancy between human judgments and automated metrics is that metrics favor more esoteric topics. Specifically, there is a significant negative correlation between a topic’s NPMI or $C _ { v }$ and the share of respondents reporting familiarity with topic words (Pearson’s $\rho = - 0 . 2 9 )$ . And while D-VAE achieves the highest automated metric scores of the three models, it produces topics with the fewest familiar words: respondents report familiarity with terms over $90 \%$ of the time on both tasks for G-LDA and ETM, but they do so only $70 \%$ of the time for D-VAE. This difference suggests that the topics selected by D-VAE are narrower in scope than those of the other models. As shown in Figure 3, removing item annotations where respondents indicate unfamiliarity causes both accuracy in the word intrusion task and the ratio of “Very related” terms in the ratings task for D-VAE to increase substantially. + +Qualitatively, this result is apparent when examining topics with a high NPMI but low humans ratings. In Table 5, the top rows consists of financial terms that frequently appear together in NYT articles, + +
DataModelTopicNPMIRat.Int.
NYTD-VAEinc 6mo earns otc rev qtr 9mo nyse outst dec0.561.600.77
WIKID-VAEWaterline conning turrets boilers amidships aft knots armament guns mounts0.331.930.65
NYTG-LDAbedroom room bath taxes year market listed kitchen broker weeks0.302.000.23
NYTD-VAEcondolences mourns mourn board_of_directors heartfelt deepest esteemed0.382.600.23
NYTD-VAEshareholders earnings federated mci shares takeover new_york_stock_exchange0.183.000.81
WIKID-VAEcontinental_army expedition militia frigate musket frigates muskets skirmish0.113.000.69
NYTD-VAEmedicaid medicare hospitals welfare uninsured patients0.132.800.96
NYTG-LDAcity mayor state new_york new_york_city officials county yesterday governor0.092.531.00
+ +Table 5: Topics with the largest human–NPMI discrepancies; top half are topics where NPMI is high and human preferences are low, bottom half is the reverse. NPMI favors esoteric and corpus-specific topics. NPMI is calculated with a 10-token sliding window over the in-domain reference corpus, Rat. is the average 3-point rating for a topic, and Int. refers to the percentage of annotators who identify the intruder word. + +and the second row contains rare terms about boating—arguably both are reasonable topics for their respective corpora. We can also see instances where words are qualitatively very related (bottom half of table), but that NPMI fails to score high—perhaps because these words, while related, may not frequently appear together within a ten-word sliding window (Equation 1). + +Even for familiar words, some topics may be sensible in the context of the specific corpus, despite their component words lacking an immediately obvious semantic relationship. For example, the topic words in the third and fourth rows appear somewhat unrelated (e.g., “taxes” and “bedroom” in the third row), but they are in fact characteristic of common document types in the New York Times: real estate listings and obituaries. Topics like these render the word intrusion task more difficult: only $23 \%$ of crowdworkers identified the intruder for both topics. + +Furthermore, using term familiarity as a proxy for domain expertise does not address the key problems with topic model evaluation: even after filtering out respondents who are not familiar with topic terms, automated metrics still overstate model differences (Appendix A.7). The problems with topic model evaluation may therefore extend to our choice of human evaluations as well. + +# 7 So. . . is Automated Topic Modeling Evaluation Broken? + +To the extent that our experimentation accurately represents current practice, our results do suggest that topic model evaluation—both automated and human—is overdue for a careful reconsideration. In this, we agree with Doogan and Buntine (2021), who write that “coherence measures designed for older models [. . . ] may be incompatible with newer models” and instead argue for evaluation paradigms centered on corpus exploration and labeling. The right starting point for this reassessment is the recognition that both automated and human evaluations are abstractions of a real-world problem. The familiar use of precision-at-10 in information retrieval, for example, corresponds to a user who is only willing to consider the top ten retrieved documents. In future work, we intend to explore automated metrics that better approximate the preferences of real-world topic model users. + +One primary use of topic models is in computer-assisted content analysis. In that context, rather than taking a methods-driven approach to evaluation, it would make sense to take a needs-driven approach.21 Generic evaluation of topic models using domain-general corpora like NYT needs to be revisited, since there is no such thing as a “generic” corpus for content analysis, nor a generic analyst. Content analysis can be formulated in a broad way, as Krippendorff (2004) has shown, but its actual application is always in a domain, by people familiar with that domain. This fact stands in tension with the desirable practicalities of general corpora and crowdworker annotation, and the field will need to address this tension. We have identified “coherence” as calling out a latent concept in the mind of a reader. It follows that we must think about who the relevant human readers are and the conceptual spaces that matter to them. + +# Acknowledgements + +This material is based upon work supported by the National Science Foundation under Grants 2031736, 2008761, 1822494, ARLIS, and by an Amazon Research Award. We thank Sweta Agrawal for her suggestion to conduct a meta-analysis. We owe much appreciation to Dallas Card for his keen advice on power analyses. Thanks to Frank Fineis for help on several statistical questions, as well as Shuo Chen for his suggestions regarding the false discovery rate calculations. Finally, we thank Caitie Doogan for her helpful comments on the clarity of argumentation, as well as our anonymous reviewers. + +# References + +Nikolaos Aletras and Mark Stevenson. 2013. Evaluating topic coherence using distributional semantics. In International Conference on Computational Semantics (IWCS). Association for Computational Linguistics. + +Daniel Allington, Sarah Brouillette, and David Golumbia. 2016. Neoliberal tools (and archives): A political history of digital humanities. In LA Review of Books. + +Areej Alokaili, Nikolaos Aletras, and Mark Stevenson. 2019. Re-ranking words to improve interpretability of automatically generated topics. In International Conference on Computational Semantics. Association for Computational Linguistics. + +Shraey Bhatia, Jey Han Lau, and Timothy Baldwin. 2017. An automatic approach for document-level topic model evaluation. In Conference on Computational Natural Language Learning, Vancouver, Canada. Association for Computational Linguistics. + +Federico Bianchi, Silvia Terragni, and Dirk Hovy. 2021. Pre-training is a hot topic: Contextualized document embeddings improve topic coherence. In Proceedings of the Association for Computational Linguistics, Online. Association for Computational Linguistics. + +David M. Blei, Andrew Ng, and Michael I. Jordan. 2003. Latent Dirichlet Allocation. Journal of Machine Learning Research, 3:993–1022. + +Samuel R. Bowman, Luke Vilnis, Oriol Vinyals, Andrew Dai, Rafal Jozefowicz, and Samy Bengio. 2016. Generating sentences from a continuous space. In Conference on Computational Natural Language Learning. Association for Computational Linguistics. + +Jordan Boyd-Graber, Yuening Hu, and David Mimno. 2017. Applications of Topic Models. NOW Publishers. + +Marc Brysbaert, Michaël Stevens, Paweł Mandera, and Emmanuel Keuleers. 2016. How many words do we know? Practical estimates of vocabulary size dependent on word definition, the degree of language input and the participant’s age. In Frontiers in Psychology. + +Sophie Burkhardt and Stefan Kramer. 2019. Decoupling Sparsity and Smoothness in the Dirichlet Variational Autoencoder Topic Model. In Journal of Machine Learning Research. + +Dallas Card, Peter Henderson, Urvashi Khandelwal, Robin Jia, Kyle Mahowald, and Dan Jurafsky. 2020. With little power comes great responsibility. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Dallas Card, Chenhao Tan, and Noah A. Smith. 2018. Neural models for documents with metadata. In Proceedings of the Association for Computational Linguistics. Association for Computational Linguistics. + +Jonathan Chang, Jordan L. Boyd-Graber, Sean Gerrish, Chong Wang, and David M. Blei. 2009. Reading tea leaves: How humans interpret topic models. In Proceedings of Advances in Neural Information Processing Systems. Curran Associates, Inc. + +Jason Chuang, John D. Wilkerson, Rebecca Weiss, Dustin Tingley, Brandon M. Stewart, Margaret E. Roberts, Forough Poursabzi-Sangdeh, Justin Grimmer, Leah Findlater, Jordan Boyd-Graber, and Jeff Heer. 2014. Computer-assisted content analysis : Topic models for exploring multiple subjective interpretations. In Advances in Neural Information Processing Systems Workshop on Human-Propelled Machine Learning. + +Matthew J Denny and Arthur Spirling. 2018. Text preprocessing for unsupervised learning: Why it matters, when it misleads, and what to do about it. In Political Analysis. Cambridge University Press. + +Adji B. Dieng, Francisco J. R. Ruiz, and David M. Blei. 2020. Topic modeling in embedding spaces. Transactions of the Association for Computational Linguistics. + +Ran Ding, Ramesh Nallapati, and Bing Xiang. 2018. Coherence-aware neural topic modeling. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Jesse Dodge, Suchin Gururangan, Dallas Card, Roy Schwartz, and Noah A. Smith. 2019. Show your work: Improved reporting of experimental results. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Caitlin Doogan and Wray Buntine. 2021. Topic model or topic twaddle? Re-evaluating semantic interpretability measures. In Conference of the North American Chapter of the Association for Computational Linguistics. Association for Computational Linguistics. + +Jacob Eisenstein, Amr Ahmed, and Eric P. Xing. 2011. Sparse additive generative models of text. In Proceedings of the International Conference of Machine Learning. Omnipress. + +Kawin Ethayarajh and Dan Jurafsky. 2020. Utility is in the eye of the user: A critique of NLP leaderboard design. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Alan H. Feiveson. 2002. Power by simulation. In The Stata Journal. + +Jiachun Feng, Zusheng Zhang, Cheng Ding, Yanghui Rao, and Haoran Xie. 2020. Context reinforced neural topic modeling over short texts. In ArXiv. + +Thomas L Griffiths and Mark Steyvers. 2004. Finding scientific topics. In Proceedings of the National Academy of Sciences. National Academy of Sciences. + +Justin Grimmer and Brandon M Stewart. 2013. Text as data: The promise and pitfalls of automatic content analysis methods for political texts. In Political Analysis. Cambridge University Press. + +Lin Gui, Jia Leng, Gabriele Pergola, Yu Zhou, Ruifeng Xu, and Yulan He. 2019. Neural topic model with reinforcement learning. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Pankaj Gupta, Yatin Chaudhary, F. Buettner, and Hinrich Schütze. 2019a. textTOvec: Deep contextualized neural autoregressive models of language with distributed compositional prior. In Proceedings of the International Conference on Learning Representations. + +Pankaj Gupta, Yatin Chaudhary, Florian Buettner, and Hinrich Schütze. 2019b. Document informed neural autoregressive topic models with distributional prior. In Association for the Advancement of Artificial Intelligence. AAAI Press. + +Ruifang He, Xuefei Zhang, Di Jin, Longbiao Wang, Jianwu Dang, and Xiangang Li. 2018. Interactionaware topic model for microblog conversations through network embedding and user attention. In International Conference on Computational Linguistics. Association for Computational Linguistics. + +Matthew Honnibal, Ines Montani, Sofie Van Landeghem, and Adriane Boyd. 2020. spaCy: Industrialstrength Natural Language Processing in Python. + +Alexander Miserlis Hoyle, Pranav Goel, and Philip Resnik. 2020. Improving Neural Topic Models using Knowledge Distillation. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Xuemeng Hu, Rui Wang, Deyu Zhou, and Yuxuan Xiong. 2020. Neural topic modeling with cycle-consistent adversarial training. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Karoliina Isoaho, Daria Gritsenko, and Eetu Mäkelä. 2021. Topic modeling and text analysis for qualitative policy research. In Policy Studies Journal. + +Masaru Isonuma, Junichiro Mori, Danushka Bollegala, and Ichiro Sakata. 2020. Tree-Structured Neural Topic Model. In Proceedings of the Association for Computational Linguistics. Association for Computational Linguistics. + +Martin Jankowiak and Fritz Obermeyer. 2018. Pathwise derivatives beyond the reparameterization trick. In Proceedings of the International Conference of Machine Learning. PMLR. + +Weonyoung Joo, Wonsung Lee, Sungrae Park, and Il-Chul Moon. 2020. Dirichlet variational autoencoder. Pattern Recognition, 107:107514. + +Namkyu Jung and Hyeong In Choi. 2017. Continuous semantic topic embedding model using variational autoencoder. In ArXiv. + +Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In Proceedings of the International Conference on Learning Representations. + +Katsiaryna Krasnashchok and Salim Jouili. 2018. Improving topic quality by promoting named entities in topic modeling. In Proceedings of the Association for Computational Linguistics. Association for Computational Linguistics. + +Klaus Krippendorff. 2004. Content Analysis: an Introduction to its Methodology. SAGE. + +Jey Han Lau, David Newman, and Timothy Baldwin. 2014. Machine reading tea leaves: Automatically evaluating topic coherence and topic model quality. In Conference of the North American Chapter of the Association for Computational Linguistics. Association for Computational Linguistics. + +Omer Levy and Yoav Goldberg. 2014. Neural word embedding as implicit matrix factorization. In Proceedings of Advances in Neural Information Processing Systems. Curran Associates, Inc. + +Lihui Lin, Hongyu Jiang, and Yanghui Rao. 2020. Copula guided neural topic modelling for short texts. In Proceedings of the ACM SIGIR Conference on Research and Development in Information Retrieval. ACM. + +Tianyi Lin, Zhiyue Hu, and Xin Guo. 2019. Sparsemax and relaxed wasserstein for topic sparsity. In International Conference on Web Search and Data Mining (WSDM). ACM. + +Zachary C Lipton. 2018. The mythos of model interpretability: In machine learning, the concept of interpretability is both important and slippery. In Queue. ACM. + +Lin Liu, Lin Tang, Wen Dong, Shaowen Yao, and Wei Zhou. 2016. An overview of topic modeling and its current applications in bioinformatics. In SpringerPlus. + +Luyang Liu, Heyan Huang, Yang Gao, Yongfeng Zhang, and Xiaochi Wei. 2019. Neural variational correlated topic modeling. In Proceedings of the World Wide Web Conference. ACM. + +Jeffrey Lund, Piper Armstrong, Wilson Fearn, Stephen Cowley, Emily Hales, and Kevin Seppi. 2019. Cross-referencing using fine-grained topic modeling. In Proceedings of the Association for Computational Linguistics, Minneapolis, Minnesota. Association for Computational Linguistics. + +Henry Berthold Mann and Donald Ransom Whitney. 1947. On a Test of Whether one of Two Random Variables is Stochastically Larger than the Other. In The Annals of Mathematical Statistics. Institute of Mathematical Statistics. + +Stephen Marche. 2012. Literature is not data: Against digital humanities. In LA Review of Books. + +Andrew Kachites McCallum. 2002. MALLET: A machine learning for language toolkit. + +Elijah Meeks and Scott B Weingart. 2012. The digital humanities contribution to topic modeling. In Journal of Digital Humanities. + +Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. 2017. Pointer sentinel mixture models. In Proceedings of the International Conference on Learning Representations. + +Yishu Miao, Edward Grefenstette, and Phil Blunsom. 2017. Discovering discrete latent topics with neural variational inference. In Proceedings of the International Conference of Machine Learning. PMLR. + +Yishu Miao, Lei Yu, and Phil Blunsom. 2016. Neural variational inference for text processing. In Proceedings of the International Conference of Machine Learning. PMLR. + +David Mimno, Hanna Wallach, Edmund Talley, Miriam Leenders, and Andrew McCallum. 2011. Optimizing semantic coherence in topic models. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +John W. Mohr and Petko Bogdanov. 2013. Introduction—topic models: What they are and why they matter. In Poetics. + +Fred Morstatter and Huan Liu. 2018. In search of coherence and consensus: Measuring the interpretability of statistical topics. Journal of Machine Learning Research. + +Feng Nan, Ran Ding, Ramesh Nallapati, and Bing Xiang. 2019. Topic modeling with Wasserstein autoencoders. In Proceedings of the Association for Computational Linguistics. Association for Computational Linguistics. + +David Newman, Jey Han Lau, Karl Grieser, and Timothy Baldwin. 2010. Automatic evaluation of topic coherence. In Conference of the North American Chapter of the Association for Computational Linguistics. Association for Computational Linguistics. + +Dat Quoc Nguyen, Richard Billingsley, Lan Du, and Mark Johnson. 2015. Improving topic models with latent feature word representations. Transactions of the Association for Computational Linguistics. + +Xuefei Ning, Y. Zheng, Zhuxi Jiang, Y. Wang, H. Yang, and J. Huang. 2020. Nonparametric topic modeling with neural inference. In Neurocomputing. + +Madhur Panwar, Shashank Shailabh, Milan Aggarwal, and Balaji Krishnamurthy. 2020. TANNTM: Topic attention networks for neural topic modeling. In Proceedings of the Association for Computational Linguistics. + +Min Peng, Qianqian Xie, Yanchun Zhang, Hua Wang, Xiuzhen Zhang, Jimin Huang, and Gang Tian. 2018. Neural sparse topical coding. In Proceedings of the Association for Computational Linguistics. Association for Computational Linguistics. + +Radim Reh˚u ˇ ˇrek and Petr Sojka. 2010. Software Framework for Topic Modelling with Large Corpora. In Proceedings of the Language Resources and Evaluation Conference. ELRA. + +Mehdi Rezaee and Francis Ferraro. 2020. A discrete variational recurrent topic model without the reparametrization trick. In Proceedings of Advances in Neural Information Processing Systems. Curran Associates, Inc. + +Michael Röder, Andreas Both, and Alexander Hinneburg. 2015. Exploring the space of topic coherence measures. In International Conference on Web Search and Data Mining (WSDM). ACM. + +Evan Sandhaus. 2008. The New York Times annotated corpus. In Linguistic Data Consortium. + +Benjamin M Schmidt. 2012. Words alone: Dismantling topic models in the humanities. In Journal of Digital Humanities. + +Alexandra Schofield and David Mimno. 2016. Comparing apples to apple: The effects of stemmers on topic models. Transactions of the Association for Computational Linguistics. + +Donald J Schuirmann. 1987. A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. In Journal of pharmacokinetics and biopharmaceutics. Springer. + +Denys Silveira, André Carvalho, Marco Cristo, and Marie-Francine Moens. 2018. Topic Modeling using Variational Auto-Encoders with Gumbel-Softmax and Logistic-Normal Mixture Distributions. In International Joint Conference on Neural Networks (IJCNN). + +Akash Srivastava and Charles Sutton. 2017. Autoencoding variational inference for topic models. In Proceedings of the International Conference on Learning Representations. + +Nisan Stiennon, Long Ouyang, Jeff Wu, Daniel M. Ziegler, Ryan J. Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul Christiano. 2020. Learning to summarize from human feedback. In Proceedings of Advances in Neural Information Processing Systems. Curran Associates, Inc. + +Marilyn Strathern. 1997. Improving Ratings: Audit in the british university system. In European Review. Cambridge University Press. + +Silvia Terragni, Elisabetta Fersini, Bruno Giovanni Galuzzi, Pietro Tropeano, and Antonio Candelieri. 2021. OCTIS: Comparing and optimizing topic models is simple! In Conference of the North American Chapter of the Association for Computational Linguistics. Association for Computational Linguistics. + +Laure Thompson and D. Mimno. 2020. Topic modeling with contextualized word representation clusters. In ArXiv. + +Runzhi Tian, Yongyi Mao, and Richong Zhang. 2020. Learning VAE-LDA models with rounded reparameterization trick. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +William E Underwood. 2017. A genealogy of distant reading. In Digital Humanities Quarterly. Alliance of Digital Humanities Organisations. + +Rui Wang, Xuemeng Hu, Deyu Zhou, Yulan He, Yuxuan Xiong, Chenchen Ye, and Haiyang Xu. 2020a. Neural topic modeling with bidirectional adversarial training. In Proceedings of the Association for Computational Linguistics. Association for Computational Linguistics. + +Rui Wang, Deyu Zhou, and Yulan He. 2020b. ATM: Adversarial-neural topic model. In Proceedings of the Association for Computational Linguistics. + +Stefan Wellek. 2010. Testing Statistical Hypotheses of Equivalence and Noninferiority. Chapman and Hall/CRC. + +Jiemin Wu, Yanghui Rao, Zusheng Zhang, Haoran Xie, Qing Li, Fu Lee Wang, and Ziye Chen. 2020a. Neural mixed counting models for dispersed topic discovery. In Proceedings of the Association for Computational Linguistics. Association for Computational Linguistics. + +Xiaobao Wu, Chunping Li, Yan Zhu, and Yishu Miao. 2020b. Short text topic modeling with topic distribution quantization and negative sampling decoder. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. + +Liang Yang, Fan Wu, Junhua Gu, Chuan Wang, Xiaochun Cao, Di Jin, and Yuanfang Guo. 2020. Graph attention topic modeling network. In Proceedings of the World Wide Web Conference. ACM. + +Hao Zhang, Bo Chen, Dandan Guo, and Mingyuan Zhou. 2018. WHAI: weibull hybrid autoencoding inference for deep topic modeling. In Proceedings of the International Conference on Learning Representations. +He Zhao, Lan Du, Wray L. Buntine, and Mingyuan Zhou. 2018. Dirichlet belief networks for topic structure learning. In Proceedings of Advances in Neural Information Processing Systems. Curran Associates, Inc. +He Zhao, Dinh Phung, Viet Huynh, Trung Le, and Wray Buntine. 2021a. Neural topic model via optimal transport. In Proceedings of the International Conference on Learning Representations. +He Zhao, Dinh Q. Phung, Viet Huynh, Y. Jin, Lan Du, and W. Buntine. 2021b. Topic modelling meets deep neural networks: A survey. In ArXiv. +Deyu Zhou, Xuemeng Hu, and Rui Wang. 2020. Neural topic modeling by incorporating document relationship graph. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. +Qile Zhu, Zheng Feng, and Xiaolin Li. 2018. GraphBTM: Graph enhanced autoencoded variational inference for biterm topic model. In Proceedings of Empirical Methods in Natural Language Processing. Association for Computational Linguistics. +George K. Zipf. 1949. Human Behaviour and the Principle of Least Effort. Addison-Wesley. \ No newline at end of file diff --git a/md/train/wl0Kr_jqM2a/wl0Kr_jqM2a.md b/md/train/wl0Kr_jqM2a/wl0Kr_jqM2a.md new file mode 100644 index 0000000000000000000000000000000000000000..4c6f89149aea19a1539457ef632cede6bb8c8b5f --- /dev/null +++ b/md/train/wl0Kr_jqM2a/wl0Kr_jqM2a.md @@ -0,0 +1,396 @@ +# TESTING ROBUSTNESS AGAINST UNFORESEEN AD-VERSARIES + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Most existing adversarial defenses only measure robustness to $L _ { p }$ adversarial attacks. Not only are adversaries unlikely to exclusively create small $L _ { p }$ perturbations, adversaries are unlikely to remain fixed. Adversaries adapt and evolve their attacks; hence adversarial defenses must be robust to a broad range of unforeseen attacks. We address this discrepancy between research and reality by proposing a new evaluation framework called ImageNet-UA. Our framework enables the research community to test ImageNet model robustness against attacks not encountered during training. To create ImageNet-UA’s diverse attack suite, we introduce a total of four novel adversarial attacks. We also demonstrate that, in comparison to ImageNet-UA, prevailing $L _ { \infty }$ robustness assessments give a narrow account of adversarial robustness. By evaluating current defenses with ImageNet-UA, we find they provide little robustness to unforeseen attacks. We hope the greater variety and realism of ImageNet-UA enables development of more robust defenses which can generalize beyond attacks seen during training. + +# 1 INTRODUCTION + +Neural networks perform well on many datasets (He et al., 2016) yet can be consistently fooled by minor adversarial distortions (Goodfellow et al., 2014). The research community has responded by quantifying and developing adversarial defenses against such attacks (Madry et al., 2017), but these defenses and metrics have two key limitations. + +First, the vast majority of existing defenses exclusively defend against and quantify robustness to $L _ { p }$ -constrained attacks (Madry et al., 2017; Cohen et al., 2019; Raff et al., 2019; Xie et al., 2018). Though real-world adversaries are not $L _ { p }$ constrained (Gilmer et al., 2018) and can attack with diverse distortions (Brown et al., 2017; Sharif et al., 2019), the literature largely ignores this and evaluates against the $L _ { p }$ adversaries already seen during training (Madry et al., 2017; Xie et al., 2018), resulting in optimistic robustness assessments. The attacks outside the $L _ { p }$ threat model that have been proposed (Song et al., 2018; Qiu et al., 2019; Engstrom et al., 2017; Evtimov et al., 2017; Sharif et al., 2016) are not intended for general defense evaluation and suffer from narrow dataset applicability, difficulty of optimization, or fragility of auxiliary generative models. + +Second, existing defenses assume that attacks are known in advance (Goodfellow, 2019) and use knowledge of their explicit form during training (Madry et al., 2017). In practice, adversaries can deploy unforeseen attacks not known to the defense creator. For example, online advertisers use attacks such as perturbed pixels in ads to defeat ad blockers trained only on the previous generation of ads in an ever-escalating arms race (Tramer et al., 2018). However, current evaluation setups \` implicitly assume that attacks encountered at test-time are the same as those seen at train-time, which is unrealistic. The reality that future attacks are unlike those encountered during training is akin to a train-test distribution mismatch—a problem studied outside of adversarial robustness (Recht et al., 2019; Hendrycks & Dietterich, 2019)—but now brought to the adversarial setting. + +The present work addresses these limitations by proposing an evaluation framework ImageNet-UA to measure robustness against unforeseen attacks. ImageNet-UA assesses a defense which may have been created with knowledge of the commonly used $L _ { \infty }$ or $L _ { 2 }$ attacks with six diverse attacks (four of which are novel) distinct from $L _ { \infty }$ or $L _ { 2 }$ . We intend these attacks to be used at test-time only and not during training. Performing well on ImageNet-UA thus demonstrates generalization to a diverse set of distortions not seen during defense creation. While ImageNet-UA does not provide an exhaustive guarantee over all conceivable attacks, it evaluates over a diverse unforeseen test distribution similar to those used successfully in other studies of distributional shift (Rajpurkar et al., 2018; Hendrycks & Dietterich, 2019; Recht et al., 2019). ImageNet-UA works for ImageNet models and can be easily used with our code available at https://github.com/ anon-submission-2020/anon-submission-2020. + +![](images/72eabe59f152e3897920095e4f84dd4933ffc01851599aa0ed478cd8695201a7.jpg) +Figure 1: Adversarially distorted chow chow dog images created with old attacks and our new attacks. The JPEG, Fog, Snow, and Gabor adversarial attacks are visually distinct from previous attacks, result in distortions which do not obey a small $L _ { p }$ norm constraint, and serve as unforeseen attacks for the ImageNet-UA attack suite. + +Designing ImageNet-UA requires new attacks that are strong and varied, since real-world attacks are diverse in structure. To meet this challenge, we contribute four novel and diverse adversarial attacks which are easily optimized. Our new attacks produce distortions with occlusions, spatial similarity, and simulated weather, all of which are absent in previous attacks. Performing well on ImageNet-UA thus demonstrates that a defense generalizes to a diverse set of distortions distinct from the commonly used $L _ { \infty }$ or $L _ { 2 }$ . + +With ImageNet-UA, we show weaknesses in existing evaluation practices and defenses through a study of 8 attacks against 48 models adversarially trained on ImageNet-100, a 100-class subset of ImageNet. While most adversarial robustness evaluations use only $L _ { \infty }$ attacks, ImageNet-UA reveals that models with high $L _ { \infty }$ attack robustness can remain susceptible to other attacks. Thus, $L _ { \infty }$ evaluations are a narrow measure of robustness, even though much of the literature treats this evaluation as comprehensive (Madry et al., 2017; Qian & Wegman, 2019; Schott et al., 2019; Zhang et al., 2019). We address this deficiency by using the novel attacks in ImageNet-UA to evaluate robustness to a more diverse set of unforeseen attacks. Our results demonstrate that $L _ { \infty }$ adversarial training, the current state-of-the-art defense, has limited generalization to unforeseen adversaries, and is not easily improved by training against more attacks. This adds to the evidence that achieving robustness against a few train-time attacks is insufficient to impart robustness to unforeseen test-time attacks (Jacobsen et al., 2019; Jordan et al., 2019; Tramer & Boneh, 2019). \` + +In summary, we propose the framework ImageNet-UA to measure robustness to a diverse set of attacks, made possible by our four new adversarial attacks. Since existing defenses scale poorly to multiple attacks (Jordan et al., 2019; Tramer & Boneh, 2019), finding defense techniques which \` generalize to unforeseen attacks is crucial to create robust models. We suggest ImageNet-UA as a way to measure progress towards this goal. + +# 2 RELATED WORK + +Adversarial robustness is notoriously difficult to correctly evaluate (Papernot et al., 2017; Athalye et al., 2018a). To that end, Carlini et al. (2019a) provide extensive guidance for sound adversarial robustness evaluation. By measuring attack success rates across several distortion sizes and using a broader threat model with diverse differentiable attacks, ImageNet-UA has several of their recommendations built-in, while greatly expanding the set of attacks over previous work on evaluation. + +![](images/0d933b5ba46f02323a61ef2eaeabe64038d059880c93820e49e8b9b94f3288c5.jpg) +Figure 2: Randomly sampled distortions and adversarially optimized distortions from our new attacks, targeted to the target class in red. Stochastic average-case versions of our attacks affect classifiers minimally, while adversarial versions are optimized to reveal high-confidence errors. The snowflakes in Snow decrease in intensity after optimization, demonstrating that lighter adversarial snowflakes are more effective than heavy random snowfall at uncovering model weaknesses. + +We are only aware of a few prior works which evaluate on unforeseen attacks in specific limited circumstances. Wu et al. (2020) evaluate against physically-realizable attacks from Evtimov et al. (2017) and Sharif et al. (2016), though this limits the threat model to occlusion attacks on narrow datasets. Outside of vision, Pierazzi et al. (2020) proposes constraining attacks by a more diverse set of problem-space constraints in diverse domains such as text and malware or source code generation; however, even in this framework, analytically enumerating all such constraints is impossible. + +Within vision, prior attacks outside the $L _ { p }$ threat model exist, but they lack the general applicability and fast optimization of ours. Song et al. (2018) and Qiu et al. (2019) attack using variational autoencoders and StarGANs, respectively, resulting in weaker attacks which require simple image distributions suitable for VAEs and GANs. Engstrom et al. (2017) apply Euclidean transformations determined by brute-force search. Zhao et al. (2019) use perceptual color distances to align human perception and $L _ { 2 }$ perturbations. Evtimov et al. (2017) and Sharif et al. (2016) attack stop signs and face-recognition systems with carefully placed patches or modified eyeglass frames, requiring physical object creation and applying only to specific image types. + +# 3 NEW ATTACKS FOR A BROADER THREAT MODEL + +There are few diverse, easily optimizable, plug-and-play adversarial attacks in the current literature; outside of Elastic (Xiao et al., 2018), most are $L _ { p }$ attacks such as $L _ { \infty }$ (Goodfellow et al., 2014), $L _ { 2 }$ (Szegedy et al., 2013; Carlini & Wagner, 2017), $L _ { 1 }$ (Chen et al., 2018). We rectify this deficiency with four novel adversarial attacks: JPEG, Fog, Snow, and Gabor. Our attacks are differentiable and fast, while optimizing over enough parameters to be strong. We show example adversarial images in Figure 1 and compare stochastic and adversarial distortions in Figure 2. + +Our novel attacks provide a range of test-time adversaries visually and semantically distinct from $L _ { \infty }$ and $L _ { 2 }$ attacks. Namely, they cause distortions with large $L _ { \infty }$ and $L _ { 2 }$ norm, but result in images that are perceptually close to the original. These attacks are intended as unforeseen attacks not used during training, allowing them to evaluate whether a defense can generalize from $L _ { \infty }$ or $L _ { 2 }$ to a more varied set of distortions than current evaluations. Though our attacks are not exhaustive, performing well against them already demonstrates robustness to occlusion, spatial similarity, and simulated weather, which are absent from previous evaluations. + +Our attacks create an adversarial image $x ^ { \prime }$ from a clean image $x$ with true label $y$ . Let model $f$ map images to a softmax distribution, and let $\ell ( f ( x ) , y )$ be the cross-entropy loss. Given a target class $y ^ { \prime } \ne y$ , our attacks attempt to find a valid image $x ^ { \prime }$ such that (1) the attacked image $x ^ { \prime }$ is obtained by applying a distortion (of size controlled by a parameter $\varepsilon$ ) to $x$ , and (2) the loss $\ell ( f ( x ^ { \prime } ) , y ^ { \prime } )$ is minimized. An unforeseen adversarial attack is a white- or black-box adversarial attack unknown to the defense designer which does not change the true label of $x$ according to an oracle or human. + +# 3.1 FOUR NEW UNFORESEEN ATTACKS + +JPEG. JPEG applies perturbations in a JPEG-encoded space of compressed images rather than raw pixel space. More precisely, JPEG compression is a linear transform JPEG which applies colorspace conversion, the discrete cosine transform, and then quantization. Our JPEG attack imposes the $L _ { \infty }$ -constraint + +$$ +\| \mathsf { J P E G } ( x ) - \mathsf { J P E G } ( x ^ { \prime } ) \| _ { \infty } \leq \varepsilon +$$ + +on the attacked image $x ^ { \prime }$ . We optimize $z = \mathsf { J P E G } ( x ^ { \prime } )$ under this constraint to find an adversarial perturbation in the resulting frequency space. The perturbed frequency coefficients are quantized, and we then apply a right-inverse of JPEG to obtain the attacked image $x ^ { \prime }$ in pixel space. We use ideas from Shin & Song (2017) to make this differentiable. The resulting attack is conspicuously distinct from $L _ { p }$ attacks. + +Fog. Fog simulates worst-case weather conditions. Robustness to adverse weather is a safety critical priority for autonomous vehicles, and Figure 2 shows Fog provides a more rigorous stress-test than stochastic fog (Hendrycks & Dietterich, 2019). Fog creates adversarial fog-like occlusions by adversarially optimizing parameters in the diamond-square algorithm (Fournier et al., 1982) typically used to render stochastic fog effects. + +This algorithm starts with random perturbations to the four corner pixels of the image. At step $t$ , it iteratively perturbs pixels at the centers of squares and diamonds formed by those pixels perturbed at step $t - 1$ . The perturbation of a step $t$ pixel is the average of the neighboring step $t - 1$ perturbations plus a parameter value which we adversarially optimize. We continue this process until all pixels have been perturbed; the outcome is a fog-like distortion to the original image. + +Snow. Snow simulates snowfall with occlusions of randomly located small image regions representing snowflakes. Because the distortions caused by snowflakes are not differentiable in their locations, we instead place occlusions representing snowflakes at randomly chosen locations and orientations and adversarially optimize their intensities. This choice results in a fast, differentiable, and strong attack. Compared to synthetic stochastic snow (Hendrycks & Dietterich, 2019), our adversarial snow is faster and includes snowflakes at differing angles. Figure 2 shows adversarial snow exposes model weaknesses more effectively than the easier stochastic, average-case snow. + +Gabor. Gabor spatially occludes the image with visually diverse Gabor noise Lagae et al. (2009). Gabor noise is a form of band-limited anisotropic procedural noise which convolves a parameter mask with a Gabor kernel which is a product of a Gaussian kernel and a harmonic kernel. We choose the Gabor kernel randomly and adversarially optimize the parameters of the mask starting from a sparse initialization. We apply spectral variance normalization $\mathbf { \boldsymbol { C } } \mathbf { \boldsymbol { o } }$ et al., 2019) to the resulting distortion and add it to the input image to create the attack. + +# 3.2 IMPROVING EXISTING ATTACKS + +Elastic modifies the attack of Xiao et al. (2018); it warps the image by distortions $\boldsymbol { x } ^ { \prime } = \mathsf { F l o w } ( \boldsymbol { x } , V )$ , where $V : \{ 1 , . . . , 2 2 4 \} ^ { 2 } \to \mathbb { R } ^ { 2 }$ is a vector field on pixel space, and Flow sets the value of pixel $( i , j )$ to the bilinearly interpolated original value at $( i , j ) + V ( i , j )$ . We construct $V$ by smoothing a vector field $W$ by a Gaussian kernel (size $2 5 \times 2 5$ , $\sigma \approx 3$ for a $2 2 4 \times 2 2 4$ image) and optimize $W$ under $\| W ( i , j ) \| _ { \infty } \leq \varepsilon$ for all $i , j$ . The resulting attack is suitable for large-scale images. + +The other three attacks are $L _ { 1 } , L _ { 2 } , L _ { \infty }$ attacks, but we improve the $L _ { 1 }$ attack. For $L _ { \infty }$ and $L _ { 2 }$ constraints, we use randomly-initialized projected gradient descent (PGD), which applies gradient descent and projection to the $L _ { \infty }$ and $L _ { 2 }$ balls (Madry et al., 2017). Projection is difficult for $L _ { 1 }$ , and previous $L _ { 1 }$ attacks rely on computationally intensive methods for it (Chen et al., 2018; Tramer\` & Boneh, 2019). We replace PGD with the Frank-Wolfe algorithm (Frank & Wolfe, 1956), which optimizes a linear function instead of projecting at each step (pseudocode in Appendix D). This makes our $L _ { 1 }$ attack more principled than previous implementations. + +![](images/f2979ce70f310462983db1a96978b6783177c7e65e34a0f1d5053dc2f95ea1cb.jpg) +Figure 3: Accuracies of $L _ { 2 }$ and Elastic attacks at different distortion sizes against a ResNet-50 model adversarially trained against $L _ { 2 }$ at $\varepsilon = 9 6 0 0$ on ImageNet-100. At small distortion sizes, the model appears to defend well against Elastic, but large distortion sizes reveal that robustness does not transfer from $L _ { 2 }$ to Elastic. + +# 4 ImageNet-UA: MEASURING ROBUSTNESS TO UNFORESEEN ATTACKS + +We propose the framework ImageNet-UA and its CIFAR-10 analogue CIFAR-10-UA to measure and summarize model robustness while fulfilling the following desiderata: (1) defenses should be evaluated against a broad threat model through a diverse set of attacks, (2) defenses should exhibit generalization to attacks not exactly identical to train-time attacks, and (3) the range of distortion sizes used for an attack must be wide enough to avoid misleading conclusions caused by overly weak or strong versions of that attack (Figure 3). + +The ImageNet-UA evaluation framework aggregates robustness information into a single measure, the mean Unforeseen Adversarial Robustness (mUAR). The mUAR is an average over six different attacks of the Unforeseen Adversarial Robustness (UAR), a metric which assesses the robustness of a defense against a specific attack by using a wide range of distortion sizes. UAR is normalized using a measure of attack strength, the ATA, which we now define. + +Adversarial Training Accuracy (ATA). The Adversarial Training Accuracy $\mathsf { A T A } ( A , \varepsilon )$ estimates the strength of an attack $A$ against adversarial training (Madry et al., 2017), one of the strongest known defense methods. For a distortion size $\varepsilon$ , it is the best adversarial test accuracy against $A$ achieved by adversarial training against $A$ . We allow a possibly different distortion size $\varepsilon ^ { \prime }$ during training, since this can improves accuracy, and we choose a fixed architecture for each dataset. + +For ImageNet-100, we choose ResNet-50 for the architecture, and for CIFAR-10 we choose ResNet56. When evaluating a defense with architecture other than ResNet-50 or ResNet-56, we recommend using ATA values computed with these architectures to enable consistent comparison. To estimate $\mathsf { A T A } ( A , \varepsilon )$ in practice, we evaluate models adversarially trained against distortion size $\varepsilon ^ { \prime }$ for $\varepsilon ^ { \prime }$ in a large range (we describe this range at this section’s end). + +UAR: Robustness Against a Single Attack. The UAR, a building block for the mUAR, averages a model’s robustness to a single attack over six distortion sizes $\varepsilon _ { 1 } , \ldots , \varepsilon _ { 6 }$ chosen for each attack (we describe the selection procedure at the end of this section). It is defined as + +$$ +{ \mathsf { U A R } } ( A ) : = 1 0 0 \times { \frac { \sum _ { k = 1 } ^ { 6 } { \mathsf { A c c } } ( A , \varepsilon _ { k } , M ) } { \sum _ { k = 1 } ^ { 6 } { \mathsf { A T A } } ( A , \varepsilon _ { k } ) } } , +$$ + +where $\mathsf { A c c } ( A , \varepsilon _ { k } , M )$ is the accuracy $\mathsf { A c c } ( A , \varepsilon _ { k } , M )$ of a model $M$ after attack $A$ at distortion size $\varepsilon _ { k }$ . The normalization in (1) makes attacks of different strengths more commensurable in a stable way. We give values of $\mathsf { A T A } ( A , \varepsilon _ { k } )$ and $\varepsilon _ { k }$ for our attacks on ImageNet-100 and CIFAR-10 in Tables 4 and 5 (Appendix B), allowing computation of UAR of a defense against a single attack with six adversarial evaluations and no adversarial training. + +mUAR: Mean Unforeseen Attack Robustness. We summarize a defense’s performance on ImageNet-UA with the mean Unforeseen Attack Robustness (mUAR), an average of UAR scores for the $L _ { 1 }$ , Elastic, JPEG, Fog, Snow, and Gabor attacks: + +![](images/b2bdb0bcf529eac154ceb5335013349e0b7f3c00faf9fce8d56b9f3e08640ce5.jpg) +Figure 4: UAR for adv trained defenses (row) against attacks (col) on ImageNet-100. Defenses from $L _ { \infty }$ to Gabor were trained with $\varepsilon = 3 2$ , $4 . 8 k$ , $6 1 2 k$ , 2, 16, 8192, 8, and $1 . 6 k$ . + +![](images/b337d69ffb514a39f0b845bff48d146a9740409026eb5d31e6d4b470f7cad2d7.jpg) +Figure 5: UAR $\left( L _ { \infty } \right)$ and mUAR for $L _ { \infty }$ -trained models at different distortion sizes. Increasing distortion size in $L _ { \infty }$ -training improves $\mathsf { U A R } ( L _ { \infty } )$ but hurts the mUAR, suggesting models heavily fit $L _ { \infty }$ at the cost of generalization. + +$$ +{ \mathrm { n U A R : } } = { \frac { 1 } { 6 } } { \Big [ } { \mathrm { U A R } } ( L _ { 1 } ) + { \mathrm { U A R } } ( { \mathrm { E l a s t i c } } ) + { \mathrm { U A R } } ( { \mathrm { J P E G } } ) + { \mathrm { U A R } } ( { \mathrm { F o g } } ) + { \mathrm { U A R } } ( { \mathrm { S n o w } } ) + { \mathrm { U A R } } ( { \mathrm { G a b o r } } ) { \Big ] } . +$$ + +Our measure mUAR estimates robustness to a broad threat model containing six unforeseen attacks at six distortion sizes each, meaning high mUAR requires generalization to several held-out attacks. In particular, it cannot be achieved by the common practice of engineering defenses to a single attack, which Figure 4 shows does not necessarily provide robustness to different attacks. + +Our four novel attacks play a crucial role in mUAR by allowing us to estimate robustness to a sufficiently large set of adversarial attacks. As is customary when studying train-test mismatches and distributional shift, we advise against adversarially training with these six attacks when evaluating ImageNet-UA to preserve the validity of mUAR, though we encourage training with other attacks. + +Distortion Sizes. We explain the $\varepsilon ^ { \prime }$ values used to estimate ATA and the choice of $\varepsilon _ { 1 } , \ldots , \varepsilon _ { 6 }$ used to define UAR. This calibration of distortion sizes adjusts for the fact (Figure 3) that adversarial robustness against an attack may vary drastically with distortion size. Further, the relation between distortion size and attack strength varies between attacks, so too many or too few $\varepsilon _ { k }$ values in a certain range may cause an attack to appear artificially strong or weak according to UAR. + +We choose distortion sizes between $\varepsilon _ { \mathrm { { m i n } } }$ and $\varepsilon _ { \mathrm { m a x } }$ as follows. The minimum distortion size $\varepsilon _ { \mathrm { { m i n } } }$ is the largest $\varepsilon$ for which the adversarial accuracy of an adversarially trained model at distortion size $\varepsilon$ is comparable to that of a model trained and evaluated on unattacked data (for ImageNet-100, within 3 of 87). The maximum distortion size $\varepsilon _ { \mathrm { m a x } }$ is the smallest $\varepsilon$ which either reduces adversarial accuracy of an adversarially trained model at distortion size $\varepsilon$ below 25 or yields images confusing humans (adversarial accuracy can remain non-zero in this case). + +As is typical in recent work on adversarial examples (Athalye et al., 2018b; Evtimov et al., 2017; Dong et al., 2019; Qin et al., 2019), our attacks can be perceptible at large distortion sizes. We make this choice to reflect perceptibility of attacks in real world threat models per Gilmer et al. (2018). + +For ATA, we evaluate against models adversarially trained with $\varepsilon ^ { \prime }$ increasing geometrically from $\varepsilon _ { \mathrm { { m i n } } }$ to $\varepsilon _ { \mathrm { m a x } }$ by factors of 2. We then choose $\varepsilon _ { k }$ as follows: We compute ATA at $\varepsilon$ increasing geometrically from $\varepsilon _ { \mathrm { { m i n } } }$ to $\varepsilon _ { \mathrm { m a x } }$ by factors of 2 and take the size-6 subset whose ATA values have minimum $\ell _ { 1 }$ -distance to the ATA values of the $L _ { \infty }$ attack in Table 4 (Appendix B.1). For example, for Gabor, $( \varepsilon _ { \operatorname* { m i n } } , \varepsilon _ { \operatorname* { m a x } } ) = ( 6 . 2 5 , 3 2 0 0 )$ , so we compute ATAs at the 10 values $\varepsilon = 6 . 2 5 , \dots , 3 2 0 0$ . Viewing size-6 subsets of the ATAs as vectors with decreasing coordinates, we select $\varepsilon _ { k }$ for Gabor corresponding to the vector with minimum $\ell _ { 1 }$ -distance to the ATA vector for $L _ { \infty }$ . + +Table 1: Clean Accuracy, UAR, and mUAR scores for models adv trained against $L _ { \infty }$ and $L _ { 2 }$ attacks. $L _ { \infty }$ training, the most popular defense, provides less robustness than $L _ { 2 }$ training. Comparing the highest mUAR achieved to individual UAR values in Figure 4 indicates a large robustness gap. + +
Clean AccuracyL8L2mUARClean AccuracyLL2mUAR
Normal Training86.77.317.214.0Normal Training86.77.317.214.0
Loε=186.246.454.230.7L2ε=15086.638.049.427.1
Lε=285.559.8 64.436.9L2ε=30085.949.7 60.133.3
Lε=483.972.173.642.3L2ε= 60084.761.971.640.0
Lαε=879.882.6 72.042.2L2ε=120082.372.982.046.8
Lε=1674.589.160.037.5L2ε= 240076.879.6 88.550.7
Lε=3270.888.141.931.8L2ε=480068.380.4 87.750.5
+ +Table 2: Clean Accuracy, UAR, and mUAR scores for models jointly trained against $( L _ { \infty } , L _ { 2 } )$ . Joint training does not provide much additional robustness. + +
Clean AccuracyL8L2mUAR
L∞ε=1,L2ε=30086.150.360.233.6
L∞ε=2,L2ε=60085.162.872.541.0
L∞ε=4,L2ε=120081.372.981.246.9
L∞ε=8,L2ε= 240076.580.087.350.8
Loε=16,L2ε= 480068.481.587.950.9
+ +# 5 NEW INSIGHTS FROM ImageNet-UA + +We use ImageNet-UA to assess existing methods for adversarial defense and evaluation. First, ImageNet-UA reveals that $L _ { \infty }$ trained defenses fail to generalize to different attacks, indicating substantial weakness in current $L _ { \infty }$ adversarial robustness evaluation. We establish a baseline for ImageNet-UA using $L _ { 2 }$ adversarial training which is difficult to improve upon by adversarial training alone. Finally, we show non-adversarially trained models can still improve robustness on ImageNet-UA over standard models and suggest this as a direction for further inquiry. + +# 5.1 EXPERIMENTAL SETUP + +We adversarially train 48 models against the 8 attacks from Section 3 and evaluate against targeted attacks. We use the CIFAR-10 and ImageNet-100 datasets for ImageNet-UA and CIFAR-10-UA. ImageNet-100 is a 100-class subset of ImageNet-1K (Deng et al., 2009) containing every tenth class by WordNet ID order; we use a subset of ImageNet-1K due to the high compute cost of adversarial training. We use ResNet-56 for CIFAR-10 and ResNet-50 from torchvision for ImageNet-100 (He et al., 2016). We provide training hyperparameters in Appendix A. + +To adversarially train against attack $A$ , at each mini-batch we select a uniform random (incorrect) target class for each training image. For maximum distortion size $\varepsilon$ , we apply targeted attack $A$ to the current model with distortion size $\varepsilon ^ { \prime } \sim \operatorname { U n i f o r m } ( 0 , \varepsilon )$ and take a SGD step using only the attacked images. Randomly scaling $\varepsilon ^ { \prime }$ improves performance against smaller distortions. + +We train on 10-step attacks for attacks other than Elastic, where we use 30 steps due to a harder optimization. For $L _ { p }$ , JPEG, and Elastic, we use step size $\varepsilon / \sqrt { \mathrm { s t e p s } }$ ; for Fog, Gabor, and Snow, we use step size $\sqrt { 0 . 0 0 1 / \mathrm { s t e p s } }$ because the latent space is independent of $\varepsilon$ . These choices have optimal rates for non-smooth convex functions (Nemirovski & Yudin, 1978; 1983). We evaluate on 200-step targeted attacks with uniform random (incorrect) target, using more steps for evaluation than training per best practices (Carlini et al., 2019b). + +Figure 4 summarizes ImageNet-100 results. Full results for ImageNet-100 and CIFAR-10 are in Appendix E and robustness checks to random seed and attack iterations are in Appendix F. + +# 5.2 ImageNet-UA REVEALS WEAKNESSESS IN $L _ { \infty }$ TRAINING AND TESTING + +We use ImageNet-UA to reveal weaknesses in the common practices of $L _ { \infty }$ robustness evaluation and $L _ { \infty }$ adversarial training. We compute the mUAR and $\mathsf { U A R } ( L _ { \infty } )$ for models trained against the $L _ { \infty }$ attack with distortion size $\varepsilon$ and show results in Figure 5. For small $\varepsilon \leq 4$ , mUAR and $\mathsf { U A R } ( L _ { \infty } )$ increase together with $\varepsilon$ . For larger $\varepsilon \ge 8$ , $\mathsf { U A R } ( L _ { \infty } )$ continues to increase with $\varepsilon$ , but the mUAR decreases, a fact which is not apparent from $L _ { \infty }$ evaluation. + +Table 3: Non-adversarial defenses can noticeably improve ImageNet-UA performance. ResNeXt101 $( 3 2 \times 8 \mathrm { d } ) + \mathrm { W S L }$ is trained on approximately 1 billion images Mahajan et al. (2018). Stylized ImageNet is trained on a modification of ImageNet using style transfer Geirhos et al. (2019). Patch Gaussian augments using Gaussian distortions on small portions of the image Lopes et al. (2019). AugMix mixes simple random augmentations of the image Hendrycks et al. (2020). These results suggest that ImageNet-UA performance may be achieved through non-adversarial defenses. + +
Clean Acc.L8L2L1ElasticJPEGFogSnowGabormUAR
SqueezeNet84.15.211.214.925.91.920.19.84.412.8
ResNeXt-101 (32×8d)95.92.55.520.726.51.814.112.45.313.4
ResNeXt-101 (32×8d) +WSL97.13.05.728.329.41.926.220.38.019.0
ResNet-1891.62.78.213.522.61.820.39.54.212.0
ResNet-5094.22.76.620.124.91.815.811.94.913.2
ResNet-50 + Stylized ImageNet94.62.97.422.826.01.816.212.58.114.6
ResNet-50 +Patch Gaussian93.64.510.927.428.21.823.910.55.216.2
ResNet-50 +AugMix95.16.113.434.338.81.828.624.711.123.2
+ +The decrease in mUAR while $\mathsf { U A R } ( L _ { \infty } )$ increases suggests that $L _ { \infty }$ adversarial training begins to heavily fit $L _ { \infty }$ distortions at the expense of generalization at larger distortion sizes. Thus, while it is the most commonly used defense procedure, $L _ { \infty }$ training may not lead to improvements on other attacks or to real-world robustness. + +Worse, $L _ { \infty }$ evaluation against $L _ { \infty }$ adversarial training at higher distortions indicates higher robustness. In contrast, mUAR reveals that $L _ { \infty }$ adversarial training at higher distortions in fact hurts robustness against a more diverse set of attacks. Thus, $L _ { \infty }$ evaluation gives a misleading picture of robustness. This is particularly important because $L _ { \infty }$ evaluation is the most ubiquitous measure of robustness in deep learning (Goodfellow et al., 2014; Madry et al., 2017; Xie et al., 2018). + +5.3 LIMITS OF ADVERSARIAL TRAINING FOR ImageNet-UA + +We establish a baseline on ImageNet-UA using $L _ { 2 }$ adversarial training but show a significant performance gap even for more sophisticated existing adversarial training methods. To do so, we evaluate several adversarial training methods on ImageNet-UA and show results in Table 1. + +Our results show that $L _ { 2 }$ trained models outperform $L _ { \infty }$ trained models and have significantly improved absolute performance, increasing mUAR from 14.0 to 50.7 compared to an undefended model. The individual UAR values in Figure 7 (Appendix E.1) improve substantially against all attacks other than Fog, including several (Elastic, Gabor, Snow) of extremely different nature to $L _ { 2 }$ . + +This result suggests pushing adversarial training further by training against multiple attacks simultaneously via joint adversarial training (Jordan et al., 2019; Tramer & Boneh, 2019) detailed in \` Appendix C. Table 2 shows that, despite using twice the compute of $L _ { 2 }$ training, $( L _ { \infty } , L _ { 2 } )$ joint training only improves the mUAR from 50.7 to 50.9. We thus recommend $L _ { 2 }$ training as a baseline for ImageNet-UA, though there is substantial room for improvement compared to the highest UARs against individual attacks in Figure 4, which are all above 80 and often above 90. + +# 5.4 ImageNet-UA ROBUSTNESS THROUGH NON-ADVERSARIAL DEFENSES + +We find that methods can improve robustness to unforeseen attacks without adversarial training. Table 3 shows mUAR for SqueezeNet (Iandola et al., 2017), ResNeXts (Xie et al., 2016), and ResNets. For ImageNet-1K models, we mask 900 logits to predict ImageNet-100 classes. + +A popular defense against average case distortions (Hendrycks & Dietterich, 2019) is Stylized ImageNet (Geirhos et al., 2019), which modifies training images using image style transfer in hopes of making networks rely less on textural features. Table 3 shows it provides some improvement on ImageNet-UA. More recently, Lopes et al. (2019) propose to train against Gaussian noise applied to small image patches, improving the mUAR by $3 \%$ over the ResNet-50 baseline. The second largest mUAR improvement comes from training a ResNeXt on approximately 1 billion images (Mahajan et al., 2018). This three orders of magnitude increase in training data yields a $5 . 4 \%$ mUAR increase over a vanilla ResNeXt baseline. Finally, Hendrycks et al. (2020) create AugMix, which randomly mixes stochastically generated augmentations. Although AugMix did not use random nor adversarial noise, it improves robustness to unforeseen attacks by $10 \%$ . + +These results imply that defenses not relying on adversarial examples can improve ImageNet-UA performance. They indicate that training on more data only somewhat increases robustness on ImageNet-UA, unlike many other robustness benchmarks (Hendrycks & Dietterich, 2019; Hendrycks et al., 2019) where more data helps tremendously (Orhan, 2019). While models with lower clean accuracy (e.g., SqueezeNet and ResNet-18) have higher $\mathsf { U A R } ( L _ { \infty } )$ and $\mathsf { U A R } ( L _ { 2 } )$ than many other models, there is no clear difference in mUAR. Last, these non-adversarial defenses have minimal cost to accuracy on clean examples, unlike adversarial defenses. Much remains to explore, and we hope non-adversarial defenses will be a promising avenue toward adversarial robustness. + +# 6 CONCLUSION + +This work proposes a framework ImageNet-UA to evaluate robustness of a defense against unforeseen attacks. Because existing adversarial defense techniques do not scale to multiple attacks, developing models which can defend against attacks not seen at train-time is essential for robustness. Our results using ImageNet-UA show that the common practice of $L _ { \infty }$ training and evaluation fails to achieve or measure this broader form of robustness. As a result, it can provide a misleading sense of robustness. By incorporating our 4 novel and strong adversarial attacks, ImageNet-UA enables evaluation on the diverse held-out attacks necessary to measure progress towards robustness more broadly. + +# REFERENCES + +Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. arXiv preprint arXiv:1802.00420, 2018a. + +Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. 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. 284–293, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018b. PMLR. URL http://proceedings.mlr.press/ $\mathtt { v 8 0 }$ /athalye18b.html. + +Tom B. Brown, Dandelion Mane, Aurko Roy, Mart ´ ´ın Abadi, and Justin Gilmer. Adversarial patch. CoRR, abs/1712.09665, 2017. URL http://arxiv.org/abs/1712.09665. + +Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy (SP), pp. 39–57. IEEE, 2017. + +Nicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras, Ian G Goodfellow, and Aleksander Madry. On evaluating adversarial robustness: Principles of rigorous evaluations. 2019a. + +Nicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras, Ian J. Goodfellow, Aleksander Madry, and Alexey Kurakin. On evaluating adversarial robustness. CoRR, abs/1902.06705, 2019b. URL http://arxiv.org/abs/1902.06705. + +Pin-Yu Chen, Yash Sharma, Huan Zhang, Jinfeng Yi, and Cho-Jui Hsieh. EAD: Elastic-net attacks to deep neural networks via adversarial examples. In Thirty-second AAAI conference on artificial intelligence, 2018. + +Kenneth T. Co, Luis Munoz-Gonz ˜ alez, and Emil C. Lupu. Sensitivity of deep convolutional net-´ works to Gabor noise. CoRR, abs/1906.03455, 2019. URL http://arxiv.org/abs/ 1906.03455. + +Jeremy M. Cohen, Elan Rosenfeld, and J. Zico Kolter. Certified adversarial robustness via randomized smoothing. CoRR, abs/1902.02918, 2019. URL http://arxiv.org/abs/1902. 02918. + +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. + +Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Evading defenses to transferable adversarial examples by translation-invariant attacks. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2019. + +Logan Engstrom, Brandon Tran, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. A rotation and a translation suffice: Fooling CNNs with simple transformations. arXiv preprint arXiv:1712.02779, 2017. + +Ivan Evtimov, Kevin Eykholt, Earlence Fernandes, Tadayoshi Kohno, Bo Li, Atul Prakash, Amir Rahmati, and Dawn Xiaodong Song. Robust physical-world attacks on deep learning models. 2017. + +Alain Fournier, Don Fussell, and Loren Carpenter. Computer rendering of stochastic models. Commun. ACM, 25(6):371–384, June 1982. ISSN 0001-0782. doi: 10.1145/358523.358553. URL http://doi.acm.org/10.1145/358523.358553. + +Marguerite Frank and Philip Wolfe. An algorithm for quadratic programming. Naval research logistics quarterly, 3(1-2):95–110, 1956. + +Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ Bygh9j09KX. + +Justin Gilmer, Ryan P. Adams, Ian J. Goodfellow, David Andersen, and George E. Dahl. Motivating the rules of the game for adversarial example research. ArXiv, abs/1807.06732, 2018. + +Ian J. Goodfellow. A research agenda: Dynamic models to defend against correlated attacks. ArXiv, abs/1903.06293, 2019. + +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014. + +Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An- ´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: Training ImageNet in 1 hour. arXiv preprint arXiv:1706.02677, 2017. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016. + +Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019. + +Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. arXiv preprint arXiv:1907.07174, 2019. + +Dan Hendrycks, Norman Mu, Ekin D. Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. AugMix: A simple data processing method to improve robustness and uncertainty. Proceedings of the International Conference on Learning Representations (ICLR), 2020. + +Forrest N. Iandola, Matthew W. Moskewicz, Khalid Ashraf, Song Han, William J. Dally, and Kurt Keutzer. Squeezenet: AlexNet-level accuracy with $5 0 \mathrm { x }$ fewer parameters and ${ < } 1 \mathrm { m b }$ model size. ArXiv, abs/1602.07360, 2017. + +Jrn-Henrik Jacobsen, Jens Behrmannn, Nicholas Carlini, Florian Tramr, and Nicolas Papernot. Exploiting excessive invariance caused by norm-bounded adversarial robustness, 2019. + +Matt Jordan, Naren Manoj, Surbhi Goel, and Alexandros G. Dimakis. Quantifying perceptual distortion of adversarial examples. arXiv e-prints, art. arXiv:1902.08265, Feb 2019. + +Ares Lagae, Sylvain Lefebvre, George Drettakis, and Philip Dutre. Procedural noise using sparse ´ Gabor convolution. ACM Trans. Graph., 28(3):54:1–54:10, July 2009. ISSN 0730-0301. doi: 10. 1145/1531326.1531360. URL http://doi.acm.org/10.1145/1531326.1531360. + +Raphael Gontijo Lopes, Dong Yin, Ben Poole, Justin Gilmer, and Ekin Dogus Cubuk. Improving robustness without sacrificing accuracy with patch gaussian augmentation. ArXiv, abs/1906.02611, 2019. + +Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017. + +Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Vittorio Ferrari, Martial Hebert, Cristian Sminchisescu, and Yair Weiss (eds.), Computer Vision – ECCV 2018, pp. 185–201, Cham, 2018. Springer International Publishing. ISBN 978-3-030-01216-8. + +Arkadi Nemirovski and D Yudin. On Cezari’s convergence of the steepest descent method for approximating saddle point of convex-concave functions. In Soviet Math. Dokl, volume 19, pp. 258–269, 1978. + +Arkadi Nemirovski and D Yudin. Problem Complexity and Method Efficiency in Optimization. Intersci. Ser. Discrete Math. Wiley, New York, 1983. + +A. Emin Orhan. Robustness properties of Facebook’s ResNeXt WSL models. ArXiv, abs/1907.07640, 2019. + +Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia conference on computer and communications security, pp. 506–519. ACM, 2017. + +Fabio Pierazzi, Feargus Pendlebury, Jacopo Cortellazzi, and Lorenzo Cavallaro. Intriguing properties of adversarial ml attacks in the problem space. In 2020 IEEE Symposium on Security and Privacy $( S P )$ , pp. 1308–1325. IEEE Computer Society, 2020. doi: 10.1109/SP40000. 2020.00073. URL https://doi.ieeecomputersociety.org/10.1109/SP40000. 2020.00073. + +Haifeng Qian and Mark N. Wegman. $L _ { 2 }$ -nonexpansive neural networks. In International Conference on Learning Representations (ICLR), 2019. URL https://openreview.net/forum? id $=$ ByxGSsR9FQ. + +Chongli Qin, James Martens, Sven Gowal, Dilip Krishnan, Krishnamurthy Dvijotham, Alhussein Fawzi, Soham De, Robert Stanforth, and Pushmeet Kohli. Adversarial robustness through local linearization, 2019. + +Haonan Qiu, Chaowei Xiao, Lei Yang, Xinchen Yan, Honglak Lee, and Bo Li. Semanticadv: Generating adversarial examples via attribute-conditional image editing. ArXiv, abs/1906.07927, 2019. + +Edward Raff, Jared Sylvester, Steven Forsyth, and Mark McLean. Barrage of random transforms for adversarially robust defense. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6528–6537, 2019. + +P. Rajpurkar, R. Jia, and P. Liang. Know what you don’t know: Unanswerable questions for SQuAD. In Association for Computational Linguistics (ACL), 2018. + +Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In ICML, 2019. + +L. Schott, J. Rauber, W. Brendel, and M. Bethge. Towards the first adversarially robust neural network model on MNIST. May 2019. URL https://arxiv.org/pdf/1805.09190. pdf. + +Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K. Reiter. Accessorize to a crime: Real and stealthy attacks on state-of-the-art face recognition. In Proceedings of the 23rd ACM SIGSAC Conference on Computer and Communications Security, 2016. + +Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K Reiter. A general framework for adversarial examples with objectives. ACM Transactions on Privacy and Security (TOPS), 22(3): 1–30, 2019. + +Richard Shin and Dawn Song. JPEG-resistant adversarial images. In NIPS 2017 Workshop on Machine Learning and Computer Security, 2017. + +Yang Song, Rui Shu, Nate Kushman, and Stefano Ermon. Constructing unrestricted adversarial examples with generative models. In NeurIPS, 2018. + +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013. + +Florian Tramer and Dan Boneh. Adversarial training and robustness for multiple perturbations.\` arXiv e-prints, art. arXiv:1904.13000, Apr 2019. + +Florian Tramer, Pascal Dupr\` e, Gili Rusak, Giancarlo Pellegrino, and Dan Boneh. Ad-versarial:´ Defeating perceptual ad-blocking. CoRR, abs/1811.03194, 2018. URL http://arxiv.org/ abs/1811.03194. + +Tong Wu, Liang Tong, and Yevgeniy Vorobeychik. Defending against physically realizable attacks on image classification. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ H1xscnEKDr. + +Chaowei Xiao, Jun-Yan Zhu, Bo Li, Warren He, Mingyan Liu, and Dawn Song. Spatially transformed adversarial examples. arXiv preprint arXiv:1801.02612, 2018. + +Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. arXiv preprint arXiv:1812.03411, 2018. + +Saining Xie, Ross B. Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual ´ transformations for deep neural networks. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5987–5995, 2016. + +Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric Xing, Laurent El Ghaoui, and Michael Jordan. Theoretically principled trade-off between robustness and accuracy. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 7472–7482, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/ v97/zhang19p.html. + +Zhengyu Zhao, Zhuoran Liu, and Marisa Larson. Towards large yet imperceptible adversarial image perturbations with perceptual color distance. ArXiv, abs/1911.02466, 2019. + +# A TRAINING HYPERPARAMETERS + +For ImageNet-100, we trained on machines with 8 NVIDIA V100 GPUs using standard data augmentation (He et al., 2016). Following best practices for multi-GPU training (Goyal et al., 2017), we ran synchronized SGD for 90 epochs with batch size $3 2 \times 8$ and a learning rate schedule with 5 “warm-up” epochs and a decay at epochs 30, 60, and 80 by a factor of 10. Initial learning rate after warm-up was 0.1, momentum was 0.9, and weight decay was $1 0 ^ { - 4 }$ . For CIFAR-10, we trained on a single NVIDIA V100 GPU for 200 epochs with batch size 32, initial learning rate 0.1, momentum 0.9, and weight decay $1 0 ^ { - 4 }$ . We decayed the learning rate at epochs 100 and 150. + +B CALIBRATION OF ImageNet-UA AND CIFAR-10-UA + +B.1 CALIBRATION FOR ImageNet-UA + +Calibrated distortion sizes and ATA values are in Table 4. + +# B.2 CALIBRATION FOR CIFAR-10-UA + +The $\varepsilon$ calibration procedure for CIFAR-10 was similar to that used for ImageNet-100. We started with small $\varepsilon _ { \mathrm { { m i n } } }$ values and increased $\varepsilon$ geometrically with ratio 2 until adversarial accuracy of an adversarially trained model dropped below 40. Note that this threshold is higher for CIFAR-10 than ImageNet-100 because there are fewer classes. The resulting ATA values for CIFAR-10 are shown in Table 5. + +# C JOINT ADVERSARIAL TRAINING + +Our joint adversarial training procedure for two attacks $A$ and $A ^ { \prime }$ is as follows. At each training step, we compute the attacked image under both $A$ and $A ^ { \prime }$ and backpropagate with respect to gradients induced by the image with greater loss. This corresponds to the “max” loss of Tramer & Boneh \` (2019). We train ResNet-50 models for $( L _ { \infty } , L _ { 2 } )$ , $( L _ { \infty } , L _ { 1 } )$ , and $( L _ { \infty }$ , Elastic) on ImageNet-100. + +Table 6 shows training against $( L _ { \infty } , L _ { 1 } )$ is worse than training against $L _ { 1 }$ at the same distortion size and performs particularly poorly at large distortion sizes. Table 7 shows joint training against + +Table 4: Calibrated distortion sizes and ATA values for different distortion types on ImageNet-100. + +
Attack ε12E3E456ATA1ATA2ATA3ATA4ATA5ATA6
L81248163284.682.176.266.940.112.9
L215030060012002400480085.083.579.672.659.119.9
L19562.5 19125 76500 153000 306000 61200084.482.776.368.956.436.1
Elastic0.250.52481685.983.278.175.657.022.5
JPEG0.0620.1250.250 0.5001285.083.279.372.834.81.1
Fog12825651220484096819285.883.879.068.467.964.7
Snow 0.0625 0.125 0.2524884.081.177.765.659.541.2
Gabor6.2512.525400800160084.079.879.866.244.714.6
+ +Table 5: Calibrated distortion sizes and ATA values for ResNet-56 on CIFAR-10 + +
Attack ε1E2E3E456ATA1ATA2ATA3ATA4ATA5ATA6
L81248163291.087.881.671.346.523.1
L24080160320640256090.186.479.667.349.917.3
L1195390780156062402496092.290.083.273.847.435.3
JPEG0.031250.06250.1250.250.5189.787.083.178.669.735.4
Elastic0.1250.250.512887.481.372.158.245.427.8
+ +Table 6: UAR scores for $L _ { 1 }$ -trained models and $( L _ { \infty } , L _ { 1 } )$ -jointly trained models. At each distortion size, $L _ { 1 }$ -training performs better than joint training. + +
UARLUARL1
Lε=2,L1ε=76500 Lαε=4,L1ε= 1530004866
Lε= 8,Liε= 30600051 4472
L1ε= 765005062 70
L1ε= 1530005481
Liε= 3060005987
+ +Table 7: UAR scores for $L _ { \infty }$ - and Elastic-trained models and $L _ { \infty }$ , Elastic)-jointly trained models. No jointly trained model matches a Elastic-trained model on UAR vs. Elastic. + +
UARLoUARElastic
Lε=4,Elasticε=2 Lαε=8,Elastic ε= 4 Lε=16,Elasticε=86863
3565
6943
Elastic ε= 23768
Elastic ε= 43681
Elastic ε=83191
+ +( $L _ { \infty }$ , Elastic) also performs poorly, never matching the UAR score of training against Elastic at moderate distortion size $\varepsilon = 2 ,$ ). + +# D THE FRANK-WOLFE ALGORITHM + +We chose to use the Frank-Wolfe algorithm for optimizing the $L _ { 1 }$ attack, as Projected Gradient Descent would require projecting onto a truncated $L _ { 1 }$ ball, which is a complicated operation. In contrast, Frank-Wolfe only requires optimizing linear functions $g ^ { \top } x$ over a truncated $L _ { 1 }$ ball; this can be done by sorting coordinates by the magnitude of $g$ and moving the top $k$ coordinates to the boundary of their range (with $k$ chosen by binary search). This is detailed in Algorithm 1. + +# E FULL EVALUATION RESULTS + +# E.1 FULL EVALUATION RESULTS AND ANALYSIS FOR IMAGENET-100 + +We show the full results of all adversarial attacks against all adversarial defenses for ImageNet-100 in Figure 6. These results also include $L _ { 1 }$ -JPEG and $L _ { 2 }$ -JPEG attacks, which are modifications of the JPEG attack applying $L _ { p }$ -constraints in the compressed JPEG space instead of $L _ { \infty }$ constraints. Full UAR scores are provided for ImageNet-100 in Figure 7. + +# E.2 FULL EVALUATION RESULTS AND ANALYSIS FOR CIFAR-10 + +We show the results of adversarial attacks and defenses for CIFAR-10 in Figure 8. We experienced difficulty training the $L _ { 2 }$ and $L _ { 1 }$ attacks at distortion sizes greater than those shown and have omitted those runs, which we believe may be related to the small size of CIFAR-10 images. Full UAR values for CIFAR-10 are shown in Figure 9. + +# F ROBUSTNESS OF OUR RESULTS + +# F.1 REPLICATION + +We replicated our results for the first three rows of Figure 6 with different random seeds to see the variation in our results. As shown in Figure 10, deviations in results are minor. + +![](images/404efb72d211b6b6e50702ccfed85eab40bacf52dc45086313c00722f153b563.jpg) + +1: Input: function $f$ , initial input $x \in [ 0 , 1 ] ^ { d }$ , $L _ { 1 }$ radius $\rho$ , number of steps $T$ . +2: Output: approximate maximizer $\bar { x }$ of $f$ over the truncated $L _ { 1 }$ ball $\mathring { B _ { 1 } } ( \rho ; x ) \cap [ 0 , 1 ] ^ { d }$ cen +at $x$ . +3: +4: $x ^ { ( 0 ) } \gets \mathrm { R a n d o m I n i t } ( x )$ {Random initialization} +5: for $t = 1 , \dots , T$ do +6: $g \gets \nabla f ( x ^ { ( t - 1 ) } )$ {Obtain gradient} +7: for $k = 1 , \ldots , d { \bf d }$ o +8: $s _ { k } \gets$ index of the coordinate of $g$ by with $k ^ { \mathrm { { t h } } }$ largest norm +9: end for +10: $S _ { k } \gets \{ s _ { 1 } , . . . , s _ { k } \} .$ +11: +12: {Compute move to boundary of $[ 0 , 1 ]$ for each coordinate.} +13: for $i = 1 , \ldots , d$ do +14: if $g _ { i } > 0$ then +15: $b _ { i } \gets 1 - x _ { i }$ +16: else +17: $b _ { i } \gets - x _ { i }$ +18: end if +19: end for +20: $\begin{array} { r } { M _ { k } \gets \sum _ { i \in S _ { k } } | b _ { i } | } \end{array}$ {Compute $L _ { 1 }$ -perturbation of moving $k$ largest coordinates.} +21: $k ^ { * } \operatorname* { m a x } \{ k \mid M _ { k } \leq \rho \}$ {Choose largest $k$ satisfying $L _ { 1 }$ constraint.} +22: +23: {Compute $\hat { x }$ maximizing $g ^ { \top } x$ over the $L _ { 1 }$ ball.} +24: for $i = 1 , \ldots , d$ do +25: if $i \in S _ { k ^ { * } }$ then +26: $\hat { x } _ { i } \gets x _ { i } + b _ { i }$ +27: else if $i = s _ { k ^ { * } + 1 }$ then +28: $\hat { x } _ { i } \gets x _ { i } + ( \rho - M _ { k ^ { * } } ) \operatorname { s i g n } ( g _ { i } )$ +29: else +30: $\hat { x } _ { i } \gets x _ { i }$ +31: end if +32: end for +33: $x ^ { ( t ) } \gets ( 1 - \textstyle \frac { 1 } { t } ) x ^ { ( t - 1 ) } + \textstyle \frac { 1 } { t } \hat { x }$ {Average $\hat { x }$ with previous iterates} +34: end for +35: $\bar { x } x ^ { ( T ) }$ + +# F.2 CONVERGENCE + +We replicated the results in Figure 6 with 50 instead of 200 steps to see how the results changed based on the number of steps in the attack. As shown in Figure 11, the deviations are minor. + +![](images/0ff9187a372af102f36bca2582d41a759338cf89aa45d5e031efb3161dca09ec.jpg) +Figure 7: UAR scores for adv. trained defenses (rows) against distortion types (columns) for ImageNet-100. + +![](images/16c09130d989c2848ec1c806368b8159ffd97d15ad4be3744492794e2c868c01.jpg) + +![](images/5f6f5952e74a01e51a0a578b064eeb7581e0471bffc2167745ae22cc382dce30.jpg) +Figure 9: UAR scores on CIFAR-10. Displayed UAR scores are multiplied by 100 for clarity. + +![](images/9b6cb1813f6ed1ff3054795aa4b375580ec3375a6d25393bd5ea96c6f9f4e194.jpg) +Figure 10: Replica of the first three block rows of Figure 6 with different random seeds. Deviations in results are minor. + +![](images/f13d8ad4e99155d65ec8a639321320c1a895a5791bceee19d5a08d6fe1ae65de.jpg) \ No newline at end of file diff --git a/md/train/xCy9thPPTb_/xCy9thPPTb_.md b/md/train/xCy9thPPTb_/xCy9thPPTb_.md new file mode 100644 index 0000000000000000000000000000000000000000..a512eb2546ba30f6272410576551e3d215cec870 --- /dev/null +++ b/md/train/xCy9thPPTb_/xCy9thPPTb_.md @@ -0,0 +1,247 @@ +# THE COMPACT SUPPORT NEURAL NETWORK + +Anonymous authors Paper under double-blind review + +# ABSTRACT + +Neural networks are popular and useful in many fields, but they have the problem of giving high confidence responses for examples that are away from the training data. This makes the neural networks very confident in their prediction while making gross mistakes, thus limiting their reliability for safety critical applications such as autonomous driving, space exploration, etc. In this paper, we present a neuron generalization that has the standard dot-product based neuron and the RBF neuron as two extreme cases of a shape parameter. Using ReLU as the activation function we obtain a novel neuron that compact support, which means its output is zero outside a bounded domain. We show how to avoid difficulties in training a neural network with such neurons, by starting with a trained standard neural network and gradually increasing the shape parameter to the desired value. Through experiments on standard benchmark datasets, we show the promise of the proposed approach, in that it can have good prediction on in-distribution samples, while being able to consistently detect and have low confidence on out of distribution samples. + +# 1 INTRODUCTION + +Neural networks have been proven to be extremely useful in all sorts of applications, including object detection, speech and handwriting recognition, medical imaging, etc. They have become the state of the art in these applications, and in some cases they even surpass human performance. However, neural networks have been observed to have a major disadvantage: they don’t know when they don’t know, i.e. don’t know when the input is far away from the type of data they have been trained on. Instead of saying “I don’t know”, they give some output with high confidence (Goodfellow et al., 2015; Nguyen et al., 2015). An explanation of why this is happening for ReLU based networks has been given in Hein et al. (2019). This issue is very important for safety-critical applications such as space exploration, autonomous driving, medical diagnosis, etc. In these cases it is important that the system know when the input data is outside its nominal range, to alert the human (e.g. driver for autonomous driving or radiologist for medical diagnostic) to take charge in such cases. + +In this paper we suspect that the root of this problem is actually the neuron design, and propose a different type of neuron to address what we think are its issues. The standard neuron can be written as $f ( x ) = \dot { \sigma } ( \mathbf { w } ^ { T } \mathbf { x } + b )$ , which can be regarded as a projection (dot product) $\mathbf { x } \to \mathbf { w } ^ { T } \mathbf { x } + b$ onto a direction w, followed by a nonlinearity $\tilde { \sigma } ( \cdot )$ . In this design, the neuron has a large response for vectors $\mathbf { x } \in \mathbb { R } ^ { p }$ that are in a half-space. This can be an advantage when training the NN since it creates high connectivity in the weight space and makes the neurons sensitive to far-away signals. However, it is a disadvantage when using the trained NN, since it can lead to the neurons unpredictably firing with high responses to far-away signals, which can result (with some probability) in high confidence responses of the whole network for examples that are far away from the training data. + +To address these problems, we use a type of radial basis function neuron (Broomhead & Lowe, 1988), $f ( \mathbf { x } ) = g ( \| \mathbf { x } - \mathbf { \bar { \mu } } \| ^ { 2 } )$ , which we modify to have a high response only for examples that are close to $\pmb { \mu }$ , and to have zero response at distance at least $R$ from $\pmb { \mu }$ . Therefore the neuron has compact support, and the same applies to a layer formed entirely of such neurons. Using one such compact support layer before the output layer we can guarantee that the space where the NN has a non-zero response is bounded, obtaining a more reliable neural network. + +In this formulation, the parameter vector $\pmb { \mu }$ is directly comparable to the neuron inputs $\mathbf { x }$ , thus $\pmb { \mu }$ has a simple and direct interpretation as a "template". A layer consisting of such neurons forms can be interpreted as a sparse coordinate system on the manifold containing the inputs of that layer. + +Because of the compact support, the loss function of such a compact support NN has many flat areas and it can be difficult to training it directly by backpropagation. However, we will show how to train such a NN, by starting with a trained regular NN and gradually bending the neuron decision boundaries to make them have smaller and smaller support. + +The contributions of this paper are the following: + +• We introduce a type of neuron formulation that generalizes the standard neuron and the RBF neuron as two extreme cases of a shape parameter. Moreover one can smoothly transition from a regular neuron to a RBF neuron by gradually changing this parameter. We introduce the RBF correspondent to a ReLU neuron and observe that it has compact support, i.e. its output is zero outside a bounded domain. The above construction allows us to smoothly bend the decision boundary of a standard ReLU based neuron, obtaining a compact support neuron. We use this idea to train a compact support neural network (CSNN) starting from a pre-trained regular neural network. We show through experiments on standard datasets that the proposed CSNN can achieve comparable test errors with regular CNNs, and at the same time it can detect and have low confidence on out-of-distribution data. + +# 1.1 RELATED WORK + +A common way to address the problem of high confidence predictions for out of distribution (OOD) examples is through ensembles (Lakshminarayanan et al., 2017), where multiple neural networks are trained with different random initializations and their outputs are averaged in some way. The reason why ensemble methods have low confidence on OOD samples is that the high-confidence domain of each NN is random outside the training data, and the common high-confidence domain is therefore shrunk by the averaging process. This reasoning works well when the representation space (the space of the NN before the output layer) is high dimensional, but it fails when this space is low dimensional (see van Amersfoort et al. (2020) for example). + +Another popular approach is adversarial training (Madry et al., 2018), where the training set is augmented with adversarial examples generated by maximizing the loss starting from slightly perturbed examples. This method is modified in adversarial confidence enhanced training (ACET) (Hein et al., 2019) where the adversarial samples are added through a hybrid loss function. However, we believe that training with out of distribution samples could be a computationally expensive if not hopeless endeavor, since the instance space is extremely vast when it is high dimensional. Consequently, a finite number of training examples can only cover an insignificant part of it and no matter how many out-of-distribution examples are used, there always will be other parts of the instance space that have not been explored. Other methods include the estimation of the uncertainty using dropout (Gal & Ghahramani, 2016), softmax calibration (Guo et al., 2017), and the detection of out-of-distribution inputs (Hendrycks & Gimpel, 2017). CutMix Yun et al. (2019) is a method to generate training samples with larger variability, which help improve generalization and OOD detection. All these methods are complementary to our approach and could be used together with our classifiers to improve accuracy and OOD detection. + +In Ren et al. (2019) are trained two auto-regressive models, one for the foreground in-distribution data and one for the background, and the likelihood ratio is used to decide for each observation whether it is OOD or not. This is a generative model, while our model is discriminative. + +A number of works assume that the distance in the representation space (the space of outputs of the last layer before the final classification layer) is meaningful. They will be reviewed next. + +Recently, Jiang et al. (2018) proposed a trust score that measures the agreement between a given classifier and a modified version of a $k$ -nearest neighbor classifier. While this approach does consider the distance of the test samples to the training set, it only does so to a certain extent since the $k$ -NN does not have a concept of “too far”, and is also computationally expensive. + +A simple method based on the Mahalanobis distance is presented in Lee et al. (2018). It assumes that the observations are normally distributed in the representation space, with a shared covariance matrix for all classes. While we also assume that the distance in the representation space is meaningful, we make a much weaker assumption that the observations for each class are clustered in a number of clusters, not necessarily Gaussian. In our representation, each class is usually covered by more than one compact support neuron, and each neuron could be involved in multiple classes. Furthermore, the method in Lee et al. (2018) simply replaces the last layer of the NN with their Mahalanobis measure and makes no attempt to further train the new model, while we can train our layers together with the whole network. + +![](images/c7b11b621b86f77faf4f46292c6a7bf7a8dc8bd8c59ec1ae6b0410e5b178460a.jpg) +Figure 1: The construction (3) smoothly interpolates between a standard neuron $( \alpha = 0$ ) and an RBF-type of neuron $( \alpha = 1$ ). Shown are the neuron decision boundaries for various values of $\alpha$ . + +The Generalized ODIN Hsu et al. (2020) decomposes the output prediction into the ratio of a classspecific function $h _ { i } ( x )$ and a common denominator $g ( x )$ , both defined over instances $x$ from the representation space. Good results are obtained using $h _ { i }$ based on the Euclidean distance or the cosine similarity. Again, this approach assumes that the observations are grouped in a single cluster for each class, which explains it uses very deep models (with 34-100 layers) that are more capable to obtain representations where this assumption is satisfied. Our method does not make the single cluster per class assumption, and can use deep or shallow models. + +The Deterministic Uncertainty Quantification (DUQ) (van Amersfoort et al., 2020) method uses an RBF network and a special gradient penalty to decrease the prediction confidence away from the training examples. The authors also propose a centroid updating scheme to handle the difficulties in training an RBF network. In contrast, our paper proposes a generalized neuron model that has the RBF neurons and the standard neurons as two extreme cases, and trains all models starting from a standard NN where the local minima are more well behaved. + +# 2 THE COMPACT SUPPORT NEURAL NETWORK + +The compact support neural network consists of a number of layers, where the last layer before the output layer contains only compact support neurons, which will be described next. The other layers could be regular neural network or convolutional neural network layers, or compact support layers. The final output layer is a regular linear layer without a bias term, so that it can output a vector of all zeros when appropriate. + +# 2.1 THE COMPACT SUPPORT NEURON + +We start with the radial basis function (RBF) neuron (Broomhead & Lowe, 1988), + +$$ +f _ { \mathbf { w } } ( \mathbf { x } ) = g ( \| \mathbf { x } - \mathbf { w } \| ^ { 2 } ) . +$$ + +The RBF neuron has $g ( u ) = \exp ( - \beta u )$ as the activation function, but in this paper we will use $g ( u ) = \operatorname* { m a x } ( R ^ { 2 } - u , \bar { 0 } )$ because it is related to the ReLU. + +A flexible representation. We can introduce an extra parameter $\alpha = 1$ and rewrite eq. (1) as + +$$ +f _ { \mathbf { w } } ( \mathbf { x } ) = g ( \mathbf { x } ^ { T } \mathbf { x } + \mathbf { w } ^ { t } \mathbf { w } - 2 \mathbf { w } ^ { T } \mathbf { x } ) = g ( \alpha ( \| \mathbf { x } \| ^ { 2 } + \| \mathbf { w } \| ^ { 2 } ) - 2 \mathbf { w } ^ { T } \mathbf { x } ) . +$$ + +Using the parameter $\alpha$ , we obtain a representation that smoothly changes between an RBF neuron when $\alpha = 1$ and a standard projection neuron when $\alpha = 0$ . However, starting with an RBF neuron with $g ( u ) = \exp ( - \beta u )$ , we obtain the projection neuron for $\alpha = 0$ as $f _ { \mathbf { w } } ( \mathbf { x } ) = \exp ( 2 \mathbf { w } ^ { T } \mathbf { x } )$ , which has an exponential activation function. + +The compact support neuron. We want to obtain a standard ReLU based neuron $f _ { \mathbf { w } } ( \mathbf { x } ) = \sigma ( \mathbf { w } ^ { T } \mathbf { x } )$ with $\sigma ( u ) = \operatorname* { m a x } ( u , 0 )$ for $\alpha = 0$ . For this purpose we will use $g ( u ) = \sigma ( R ^ { 2 } - \dot { u } )$ , and modify the above construction to obtain the compact support neuron: + +$$ +f _ { \mathbf { w } } ( \mathbf { x } ) = \sigma ( R ^ { 2 } - \mathbf { x } ^ { T } \mathbf { x } - \mathbf { w } ^ { T } \mathbf { w } + 2 \mathbf { w } ^ { T } \mathbf { x } ) = \sigma [ \alpha ( R ^ { 2 } - \| \mathbf { x } \| ^ { 2 } - \| \mathbf { w } \| ^ { 2 } - b ) + 2 \mathbf { w } ^ { T } \mathbf { x } + b ] , +$$ + +![](images/4f4fba9ba6cebb9ff56d470944d1274f28dea0a59e233283cba4a0b94d59d6ae.jpg) +Figure 2: Left: Diagram of the compact support neural network (CSNN), with the CSN layer described in Eq. (6). Right: an example of the CSNN with normalized input from ResNet. Only the full arrows have backpropagation. + +where we also introduced a bias term $b$ for the standard neuron. We usually make $b = 0$ for simplicity. +The parameter $R$ defines the radius of the support of the neuron when $\alpha = 1$ . + +One can easily check that the support of $f _ { \mathbf { w } } ( \mathbf { x } )$ from eq. (3) (i.e. the domain where it takes nonzero values) is in a sphere of radius + +$$ +R _ { \alpha } ^ { 2 } = R ^ { 2 } + b ( 1 / \alpha - 1 ) + \| \mathbf { w } \| ^ { 2 } ( 1 / \alpha ^ { 2 } - 1 ) +$$ + +centered at $\mathbf { w } _ { \alpha } = \mathbf { w } / \alpha$ . Therefore the neuron from eq. (3) has compact support for any $\alpha > 0$ and the larger the value of $\alpha$ , the smaller the support of the neuron will be. In Figure 1 is shown the support for several values of $\alpha \in [ 0 , 1 ]$ of the neuron (3) with $\mathbf { w } = ( 0 , 2 ) ^ { T } , b = \mathbf { \bar { 0 } }$ and $R = 1$ . + +Convolutional version. If one desires to make a compact support convolutional neuron, let w be its $k \times k$ matrix of weights. Then the convolutional version can be obtained by taking into consideration that each $k \times k$ patch of an image I is a candidate $\mathbf { x }$ in eq. (3). Therefore one can easily check that the convolutional compact support neuron should be: + +$$ +f _ { \mathbf { w } } ( { \mathbf { I } } ) = \sigma [ \alpha ( R ^ { 2 } - b - { \mathbf { I } } ^ { 2 } * { \mathbf { 1 } } - \| \mathbf { w } \| ^ { 2 } ) + 2 { \mathbf { I } } * { \mathbf { w } } + b ] +$$ + +where 1 is a $k \times k$ matrix of ones, $\mathbf { I } ^ { 2 }$ is done elementwise and $^ *$ is the convolution. + +# 2.2 THE COMPACT SUPPORT NEURAL NETWORK + +If we have a layer containing only compact support neurons (CSN), combining the weights into a matrix ${ \bf W } ^ { T } = \dot { ( } { \bf w } _ { 1 } , . . . , { \bf w } _ { K } \dot { ) }$ and the biases into a vector $\mathbf { b } = ( b _ { 1 } , . . . , b _ { K } )$ , we can write the CSN layer as: + +$$ +\mathbf { f } _ { \mathbf { W } } ( \mathbf { x } ) = \sigma ( \alpha [ R ^ { 2 } - \mathbf { b } - \mathbf { x } ^ { T } \mathbf { x } - \mathrm { T r } ( \mathbf { W } \mathbf { W } ^ { T } ) ] + 2 \mathbf { W } \mathbf { x } + \mathbf { b } ) . +$$ + +where $\mathbf { f _ { W } } ( \mathbf { x } ) = ( f _ { 1 } ( \mathbf { x } ) , . . . , f _ { K } ( \mathbf { x } ) ) ^ { T }$ is the vector of neuron outputs of that layer. This formulation enables the use of standard neural network machinery (e.g. PyTorch) to train a CSN. In practice we will have no bias term (i.e. $\mathbf { b } = 0$ ), except in low dimensional experiments. + +The simplest compact support neural network (CSNN) has two layers: a hidden layer containing compact support neurons (3) or their convolutional counterparts (5), and an output layer which is a standard fully connected layer without bias. It is illustrated in Figure 2, left. + +Normalization. For best results, all variables of the input data $\mathbf { x }$ should be on the same scale. For better control, it is also preferable that $\| \mathbf { x } \|$ be approximately 1 on the training examples. These goals√ can be achieved by standardizing the variables to have zero mean and standard deviation $1 / \sqrt { d }$ on the training examples (where $d$ is the dimension of $\mathbf { x }$ ). This way $\| \mathbf { x } \| ^ { 2 } \sim 1$ when the dimension $d$ is large (under assumptions of normality and independence of the variables of $\mathbf { x }$ ). Our experiments on three datasets indicate that indeed $\| \mathbf { x } \| \sim 1$ on real data when the inputs $\mathbf { x }$ are normalized as described above, as exemplified by the histograms of $\| \mathbf { x } \|$ from Figure 3. + +![](images/163b3dd0b3e49e18d2d13f933c6c4551e29ecb0c2dc6c102da09cd14ecebc0e7.jpg) +Figure 3: Histogram of the norms $\left\| \mathbf { v } _ { i } \right\|$ of the normalized input features $\mathbf { v } _ { i }$ to the CSN layer for the three datasets trained in our experiments. + +Training. Like the RBF network, training a neural network with such neurons with $\alpha = 1$ is difficult because the loss function has many local optima. To make matters even worse, the compact support neurons have small support when $\alpha$ is close to 1, and consequently the loss function has flat regions between the local minima. + +This is why we take another approach to training. Using equations (6) or (5) we can train a CSNN by first training a regular NN $( \alpha = 0$ ) and then gradually increasing the shape parameter $\alpha$ from 0 towards 1 while continuing to update the NN parameters. Observe that whenever $\alpha > 0$ the NN has compact support, but the support gets smaller as $\alpha$ gets closer to 1. The training procedure is described in detail in Algorithm 1. + +Algorithm 1 Compact Support Neural Network (CSNN) Training + +
Output: Trained CSNN.Input: Training set T = {(xi, yi) ∈ RP × R}=1,
1: Train a regular CNN f(x) = Lo(2Wg(x) + b) where W,L are the last two layer weight
matrices and g(x) is the rest of the CNN.2: Freeze g(x), compute ui = g(xi),i = 1,.,n, their mean μ and standard deviation o.
3: Obtain normalized versions Vi of ui as Vi = (ui - μ)/√do,i = 1,., n.
4:for e= 1 to Nepochs do
5:Set α = e/Nepochs
6: Use the examples (Vi, yi) to update (W,L,b) based on one epoch of
f(ν)=Lσ(α[R²-vTv- Tr(WWT)-b]+ 2Wv +b)
7:(optional) Remove any neurons Wj of WT = (w1,.*,Wk) that are dead,i.e. satisfy:
σ(a[R²-||vill²-|/wjl²)-bj]+2wTνi+bj)=0,i=1,.,n
+ +8: end for + +In the synthetic experiment in Figure 4 we succeeded to bring the train and test errors close to 0 for $\alpha = 1$ using a carefully crafted schedule for increasing the $\alpha$ . However, in the real data applications, the training, test and validation errors might first decrease a little bit but ultimately increase as $\alpha$ approaches 1. For example one could see the test errors vs $\alpha$ for the synthetic dataset in Figure 6 and for the real datasets in Figure 9. For this reason, in practice we stop the training at an $\alpha < 1$ where the training and validation errors still take acceptable values, e.g. a validation error less than the validation error for $\alpha = 0$ . However, we noticed that the larger the value of $\alpha$ , the tighter the support around the training data and the better the generalization. + +It is worth noting that in contrast to the weights of a standard neuron, the weights of the compact support neuron exist in the same space as the neuron inputs and they can be regarded as templates. Thus they have more meaning, and one could easily visualize the type of responses that make them maximal, using standard neuron visualization techniques such as Zeiler & Fergus (2014). Furthermore, one can also obtain samples from the compact support neurons, e.g. for generative or GAN models. + +# 3 EXPERIMENTS + +In this section we first present an experiment on 2D data to showcase what can be achieved with the proposed compact support neural network, and then experiments on real datasets to show the power of the CSNN to model real data and how it can detect out-of-distribution samples. + +# 3.1 2D EXAMPLE + +We present a first experiment with the moons 2D dataset, where the data is organized on two intertwining half-circle like shapes, one containing the positives and one the negatives. The data is scaled so that all observations are in the interval $[ 0 , 1 ] ^ { \dot { 2 } }$ (shown as a white rectangle in Figure 4. As out of distribution data (OOD) we started with $1 0 0 \times 1 0 0 = 1 0 0 0 0$ samples on a grid spanning $[ - 0 . 5 , 1 . 5 ] ^ { 2 }$ and we removed all samples at distance at most 0.1 from the moons data, obtaining 8763 samples. + +We used a two layer CSNN, with the first layer having 128 CSNN neurons, and the second layer being a standard NN layer without bias, as illustrated in Figure 2, left. The second layer is used to integrate the evidence from the CSNN neurons into the class prediction. We used 200 training examples and trained the CSNN using Algorithm 1. We trained 2000 epochs with $R ^ { 2 }$ decreasing linearly from 0.04 to 0.01, and $\alpha$ increasing from 0 to 1 as $\alpha _ { i } = \operatorname* { m i n } ( 1 , \operatorname* { m a x } ( 0 , ( i ^ { 0 . 1 } - 1 . 5 ) / . 6 ) )$ , $i = 1 , . . . , 2 0 0 0$ . This way $\alpha$ increases slower as it gets closer to 1. Using this special training we avoided the training and test errors blowing up when $\alpha$ gets close to 1. As specified in line 7 of Algorithm 1, the NN nodes that had zero response on all training examples were eliminated. These neurons cannot be trained anymore and only give uncontrolled responses on unseen data. This way from the 128 neurons, only 73 were left at the end of training. + +![](images/f0ed37566c4e463b84591db9ea935cc99dd785929ad3663b924e1ea041c39021.jpg) +Figure 4: The confidence map (0.5 for white and 1 for black) of the trained CSNN on the moons dataset for different values of $\alpha \in [ 0 , 1 ]$ . Top: zoom out on the interval $[ - 5 , 6 ] ^ { 2 }$ . Bottom: zoom in view of the interval $[ - 0 . 5 , 1 . 5 ] ^ { 2 }$ . + +![](images/0b9c8c6dd4e1fc416ec92903d00f1372faf8c9ddd2df5d650f39ba511e70915b.jpg) +Figure 5: Example of activation pattern domains for $\alpha = 0$ and $\alpha ~ = ~ 0 . 8 2 5$ and the resulting confidence map (0.5 for white and 1 for black) for $\alpha = 0 . 8 2 5$ for a 32 neuron 2-layer CSNN. + +The training/test errors and the AUROC and NZ confidence measures for the OOD data described above vs. $\alpha$ are shown in Figure 6. Observe that the training and test errors for $\alpha = 0$ are quite large, because the standard NN with 128 neurons cannot fit the data well enough, and they decrease as the neuron support decreases and the model is better capable to fit the data. + +The confidence map for the obtained classifier is shown in Figure 4. We can see that the confidence is 0.5 (white) almost everywhere except close to the training data, where it is close to 1 (black). This gives us an insight that the method works as expected, shrinking the support of the neurons to a small domain around the training data. We also see that the support is already reasonably small for $\alpha = 0 . 6$ and it gets tighter and tighter as $\alpha$ gets closer to 1. + +![](images/9d5e97c1bb2e292effd8e47c9118422de96af1861d74126ed5bb59b31adcae74.jpg) +Figure 6: CSNN train and test errors, AUROC and percent nonzero outputs (NZ) vs. $\alpha$ for the moons data. + +It is known Croce & Hein (2018); Hein et al. (2019) that the output of a ReLU-based neural network is piecewise linear and the domains of linearity are given by the activation pattern of the neurons. The activation pattern of the neurons consists of the domains where the set of neurons that are active (i.e. their output is positive) does not change. These activation pattern domains are polytopes, as shown in in Figure 5, left, for a two-layer NN with 32 neurons. The activation domains for a CSNN are intersections of circles, as illustrated in Figure 5, middle, with the domain where all neurons are inactive shown in white. The corresponding confidence map is shown in Figure 5, right. + +In real data applications we don’t need to go all the way to $\alpha =$ 1 since even for smaller $\alpha$ the support is still bounded and if the instance space is high dimensional (e.g. 512 to 1024 in the real data experiments below), the volume of the support of the CNN will be very small compared to the instance space, making it unlikely to have high confidence on out-of-distribution data. + +The role of pruning dead neurons. Due to the random initialization of the neurons, there might exist neurons that have zero response on all the training observations. These neurons are dead in the sense that they are not updated in the back-propagation, since their response is always zero. We have observed that in some cases these dead neurons will produce some small high confidence regions far away from the training examples (see Fig. 7). This problem can be eliminated by removing these neurons during training, which is done by line 7 of Algorithm 1. + +![](images/d6acabc6bfd51c9b56e29d682d1c93eab60c24247e4a4853209a72a34efec83c.jpg) +Figure 7: Confidence map without pruning, $\alpha = 0 . 9 8 5$ . + +![](images/5853098c38710f2d8261c9a369a5635256653dac968d9254e11a70ced307af4a.jpg) +Figure 8: The CSNN-F with LeNet backbone, where all layers are trained by backpropagation. + +# 3.2 REAL DATA EXPERIMENTS + +We conduct experiments by training on three different datasets: MNIST (LeCun & Cortes, 2010), CIFAR-10 and CIFAR-100 (Krizhevsky et al., 2009). We evaluate the confidence on in-sample and out-of-sample data, by testing them on their respective test sets (in-sample) and on other datasets as shown in Table 1, including the test sets of EMNIST (Cohen et al.), FashionMNIST (Xiao et al., 2017) and SVHN (Netzer et al., 2011), and the validation set of ImageNet (Deng et al., 2009). For MNIST we also tested on a grayscale version of CIFAR-10, obtained by converting the 10,000 test images to gray-scale and resizing them to $2 8 \times 2 8$ . + +CNN architecture. For MNIST we use a 4-layer LeNet CNN as backbone, with two $5 \times 5$ convolution layers with 32 and 64 filters respectively, followed by ReLU and $2 \times 2$ max pooling, and two fully connected layers with 256 and 10 neurons. For the other two datasets, we used as backbone a ResNet-18 architecture (He et al., 2016) with 4 residual blocks with 64, 128, 256 and 512 filters respectively. After the backbone CNN has been trained, the FC layers were removed and only the convolutional layers were kept, as illustrated in Figure 2, right and Figure 8. + +For the CSNN we will experiment with two architectures, illustrated in Figure 2 and Figure 8. The first is a small one (called CSNN) that takes as input the output of the last convolutional layer of the backbone, normalized as described in Section 2.2. The normalization of the CSNN input can also be achieved using a batch normalization layer without any learnable affine parameters. The second one is a full network (called CSNN-F), illustrated in Figure 8, where the backbone (LeNet or ResNet) is part of the backpropagation and a batch normalization layer (BN) without any learnable parameters has been introduced between the backbone and the CSN layer. + +Training details. For all datasets we used data augmentation with padding (3 pixels for MNIST, 4 pixels for the rest) and random cropping to train the backbones. For CIFAR-100 we also used random rotation up to 15 degrees.We used no data augmentation when training the CSNN and CSNN-F. + +The training/test data was passed though the backbone without the FC layers, and the output was normalized. A CSNN without bias term was trained for 510 epochs with $R = 0 . 1$ , of which 10 epochs at $\alpha = 0$ . For the CSNN training we used the Adam optimizer with learning rate 0.001 and weight decay 0.0001. We also tried SGD and obtained similar results. The CSNN-F was trained with SGD with a learning rate of 0.001 and weight decay 0.0005. Its layers were initialized with the trained backbone and the trained CSNN. Then $\alpha$ was kept fixed for two epochs and increased by 0.005 every epoch for 4 more epochs. + +![](images/2fecf33cc6072abb3692e728485b4933f30675a06e928fe55d9a7841f8e931db.jpg) +Figure 9: Train and test errors, Area under ROC Curve (AUROC) and percent nonzero outputs (NZ) vs $\alpha$ for CSNN classifiers trained on three real datasets. These results are obtained from one training run. + +Training the CSNN from $\alpha = 0$ to $\alpha = 1$ for 510 epochs takes less than an hour on a MSI GS-60 Core I7 laptop with 16Gb RAM and Nvidia GTX 970M GPU. Each epoch of the CSNN-F took less than a minute with the LeNet backbone and about 3 minutes with the ResNet-18 backbone. + +OOD detection. The out of distribution (OOD) detection is performed similarly to the way it is done in a standard CNN. For any observation, the maximum value of CSNN raw outputs is used as the OOD score for predicting whether the observation is OOD or not. If the observation is in-distribution, its score will usually be large, and if it is OOD, it will be usually close to zero or even zero. The ROC curve based on these scores for the test set of the in-distribution data (as class 0) and one OOD dataset (as class 1) will give us the AUROC. If the two distributions are not separable (have concept overlap), some of the OOD scores will be large, but for the OOD observations that are away from the area of overlap they will be small or even zero. + +In Figure 9 are shown the train/test errors vs $\alpha$ for the CSNN on the three datasets. Also shown are the Area under the ROC curve (AUROC) for OOD detection on CIFAR-10 or CIFAR-100 and the percentage of OOD samples with nonzero outputs (NZ). Observe that all curves on the real data are very smooth, even though they are obtained from one run, not averaged. We see that the training and test errors stay flat for a while then they start increasing from a certain $\alpha$ that depends on the dataset. At the same time, the AUROC stays flat and slightly increases, and there is a range of values of $\alpha$ where the test error is low and the AUROC is large. Looking in more detail at the CIFAR-10 dataset (middle plot in Figure 9), we see that for $\alpha = 0 . 7$ the NZ-CIFAR100 is about 0.6, which means that about $40 \%$ of the CIFAR-100 observations have all 0 CSNN outputs, therefore an OOD score of 0. Combined with the scores of the other observations and the fact that at most $10 \%$ of the CIFAR-10 test observations have an OOD score of 0 (because the test error is less than 0.1) it results in a slight increase in AUROC. + +In practice, $\alpha$ should be chosen as large as possible where an acceptable validation error is still obtained, to have the smallest support possible. For example one could choose the largest $\alpha$ such that the validation error at $\alpha$ is less then or equal to the validation error at $\alpha = 0$ . However, for better comparison with the other methods, for each dataset we chose the CSNN classifier corresponding to the largest $\alpha$ where the test error takes a value comparable to the other methods compared, and reported the AUROC values in Table 1. The CSNN-F was obtained by merging the corresponding CSNN head with the ResNet or LeNet backbone and training them together for 6 epochs. + +Methods compared. We compare our results with the Adversarial Confidence Enhanced Training (ACET) (Hein et al., 2019), Deterministic Uncertainty Quantification (DUQ) (van Amersfoort et al., 2020), a standard CNN, and an ensemble of five or 10 CNNs trained with different random initializations. The ACET results are taken directly from Hein et al. (2019), and the DUQ, CNN and ensemble results were obtained using the DUQ authors’ code. For DUQ we trained multiple models with various combinations of the length scales $\sigma \in \{ 0 . 0 5 , 0 . 1 , 0 . 2 , 0 . 3 , 0 . 5 , 1 . 0 \}$ and gradient penalty $\lambda \in \{ 0 , 0 . 0 5 , 0 . 1 , 0 . 2 , 0 . 3 , 0 . 5 , 1 . 0 \}$ and selected the combination with the best test error-AUROC trade-off. + +
Train on MNISTCNN 0.53% (.05)ACET 0.66DUQ 0.57 (.04)5Ens 0.50 (.02)10 Ens 0.51 (.03)CSNN 0.52 (.01)CSNN-F 0.50 (0.02)
EMNIST0.983 (.001)0.9120.988 (.001)0.985 (.001)0.985 (.001)0.992 (.001)0.990 (.002)
FashionMNIST0.989 (.001)0.9980.998 (.001)0.992 (.001)0.992 (.001)0.998 (.001)0.997 (.001)
grayCIFAR-100.995 (.001)1.0000.978 (.005)0.992 (.003)0.992 (.002)1.000 (.0001)1.000 (.0001)
Average0.9897.005)0.9700.988(.009)0.9907.004)0.990 (.004)0.996(.003)0.996 (.004)
Train on CIFAR-105.99% (.09)8.446.88 (.40)4.83 (.16)4.59 (.08)7.28 (.06)6.18 (.09)
CIFAR-1000.860 (.001)0.8520.827 (.016)0.891(.001)0.897 (.001)0.865 (.001)0.882(.003)
SVHN0.899 (.012)0.9810.912 (.031)0.917 (.006)0.924 (.002)0.908 (.001)0.900 (.013)
ImageNet0.834 (.002)0.8590.816 (.021)0.863 (.001)0.869 (.001)0.848 (.001)0.854 (.004)
Average0.8657.029)0.8970.852 (.050)0.8907.023)0.897 (.023)0.874(.026)0.879(.021)
Train on CIFAR10026.18% (.28)32.2431.14(.23)22.43 (.20)21.86 (.11)30.89 (0.10)24.46 (.12)
CIFAR-100.750 (.002)0.7200.722 (.008)0.781(.001)0.786 (.001)0.783 (.001)0.762 (.002)
SVHN0.781 (.035)0.9120.774 (.006)0.832 (.013)0.834 (.009)0.872 (.001)0.860 (.006)
ImageNet0.766 (.002)0.7520.742 (.006)0.798 (.001)0.803 (.001)0.755 (.001)0.793 (.001)
Average0.7667.023)0.7950.746(.024)0.8047.022)0.808 (.021)0.804(.050)0.805 (.042)
+ +Table 1: OOD detection comparison in terms of Area under the ROC curve (AUROC) for models trained and tested on several datasets. For each model the test error in $\%$ is shown in the "Train on" row. The ACET results are taken from Hein et al. (2019). All other results are averaged over 10 runs and the standard deviation is shown in parentheses. + +Results. The results are shown in Table 1. All results except the ACET results are averaged over 10 runs and the standard deviation is shown in parentheses. From Table 1 we observe that our methods obtain the best results on MNIST and the 10-ensemble obtains the best results on the other two datasets. The test errors of the CSNN-F approach are smaller than the CSNN, and the AUROCs are comparable. Compared to ACET both CSNN and CSNN-F obtain smaller test errors on all three dataset and better average AUROC on two out of three datasets. Compared to DUQ, the CSNN and CSNN-F obtain comparable test errors and better average AUROC on all three datasets. Compare to the 5-ensemble, the CSNN-F obtains comparable errors on two datasets and comparable or better AUROC on two datasets. Comparing the training time, both our methods are about 4 times faster than training a 5-ensemble, 8 times faster than a 10- ensemble and about 3 times faster than DUQ. + +# 4 CONCLUSION + +In this paper, we presented a generic neuron formulation that encompasses the standard projection based neuron and the RBF neuron as two extreme cases of a shape parameter $\alpha \in [ 0 , 1 ]$ . By using ReLU as the activation function we obtained a novel type of neuron that has compact support. We showed how to avoid the difficulties in training the compact support NN by training a standard neural network first $\alpha = 0$ ) and gradually shrinking the support by increasing $\alpha$ . We showed the advantages of the proposed compact support neural network in that it can still have good prediction on data coming from the same distribution, but it can detect out of distribution samples consistently well. This feature is important in safety critical applications such as autonomous driving, space exploration and medical imaging. Our results have been obtained without any adversarial training or ensembling, and adversarial training or ensembling could be used in our framework to obtain further improvements. + +In the real data applications we used a compact support layer as the last layer before the output layer. This ensures that the compact support is involved in the most relevant representation space of the CNN. However, because the CNN still has many projection-based layers to obtain this representation space, it means that the corresponding representation in the original image space does not have compact support and high confidence erroneous predictions are still possible. In the future we plan to study architectures with multiple compact support layers that have even smaller support in the image space. + +# REFERENCES + +David S Broomhead and David Lowe. Radial basis functions, multi-variable functional interpolation and adaptive networks. Technical report, Royal Signals and Radar Establishment Malvern (United Kingdom), 1988. + +Gregory Cohen, Saeed Afshar, Jonathan Tapson, and André van Schaik. Emnist: an extension of mnist to handwritten letters (2017). arXiv preprint arXiv:1702.05373. + +Francesco Croce and Matthias Hein. A randomized gradient-free attack on relu networks. In German Conference on Pattern Recognition, pp. 215–227. Springer, 2018. + +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pp. 248–255. Ieee, 2009. + +Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In ICML, pp. 1050–1059, 2016. + +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. ICLR, 2015. + +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In ICML, pp. 1321–1330. JMLR. org, 2017. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016. + +Matthias Hein, Maksym Andriushchenko, and Julian Bitterwolf. Why relu networks yield highconfidence predictions far away from the training data and how to mitigate the problem. In CVPR, pp. 41–50, 2019. + +Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In ICLR, 2017. + +Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized odin: Detecting out-ofdistribution image without learning from out-of-distribution data. In CVPR, pp. 10951–10960, 2020. + +Heinrich Jiang, Been Kim, Melody Guan, and Maya Gupta. To trust or not to trust a classifier. In NeurIPS, pp. 5541–5552, 2018. + +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. + +Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In NeurIPS, pp. 6402–6413, 2017. + +Yann LeCun and Corinna Cortes. MNIST handwritten digit database. 2010. URL http://yann. lecun.com/exdb/mnist/. + +Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In NeurIPS, pp. 7167–7177, 2018. + +Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018. + +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 Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011. URL http://ufldl.stanford. edu/housenumbers/nips2011_housenumbers.pdf. + +Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In CVPR, pp. 427–436, 2015. + +Jie Ren, Peter J Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark Depristo, Joshua Dillon, and Balaji Lakshminarayanan. Likelihood ratios for out-of-distribution detection. In NeurIPS, pp. 14707–14718, 2019. + +Joost van Amersfoort, Lewis Smith, Yee Whye Teh, and Yarin Gal. Uncertainty estimation using a single deep deterministic neural network. In ICML, 2020. + +Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. + +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, pp. 6023–6032, 2019. + +Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In ECCV, pp. 818–833. Springer, 2014. \ No newline at end of file diff --git a/md/train/xHKVVHGDOEk/xHKVVHGDOEk.md b/md/train/xHKVVHGDOEk/xHKVVHGDOEk.md new file mode 100644 index 0000000000000000000000000000000000000000..dbd24389c37c221decb4065b4af24b97b8ff9c4c --- /dev/null +++ b/md/train/xHKVVHGDOEk/xHKVVHGDOEk.md @@ -0,0 +1,354 @@ +# INFLUENCE FUNCTIONS IN DEEP LEARNING ARE FRAGILE + +Samyadeep Basu∗, Phillip Pope ∗& Soheil Feizi + +Department of Computer Science University of Maryland, College Park {sbasu12,pepope,sfeizi}@cs.umd.edu + +# ABSTRACT + +Influence functions approximate the effect of training samples in test-time predictions and have a wide variety of applications in machine learning interpretability and uncertainty estimation. A commonly-used (first-order) influence function can be implemented efficiently as a post-hoc method requiring access only to the gradients and Hessian of the model. For linear models, influence functions are well-defined due to the convexity of the underlying loss function and are generally accurate even across difficult settings where model changes are fairly large such as estimating group influences. Influence functions, however, are not wellunderstood in the context of deep learning with non-convex loss functions. In this paper, we provide a comprehensive and large-scale empirical study of successes and failures of influence functions in neural network models trained on datasets such as Iris, MNIST, CIFAR-10 and ImageNet. Through our extensive experiments, we show that the network architecture, its depth and width, as well as the extent of model parameterization and regularization techniques have strong effects in the accuracy of influence functions. In particular, we find that (i) influence estimates are fairly accurate for shallow networks, while for deeper networks the estimates are often erroneous; (ii) for certain network architectures and datasets, training with weight-decay regularization is important to get high-quality influence estimates; and (iii) the accuracy of influence estimates can vary significantly depending on the examined test points. These results suggest that in general influence functions in deep learning are fragile and call for developing improved influence estimation methods to mitigate these issues in non-convex setups. + +# 1 INTRODUCTION + +In machine learning, influence functions (Cook & Weisberg, 1980) can be used to estimate the change in model parameters when the empirical weight distribution of the training samples is perturbed infinitesimally. This approximation is cheaper to compute compared to the expensive process of repeatedly re-training the model to retrieve the exact parameter changes. Influence functions could thus be used to understand the effect of removing an individual training point (or, groups of training samples) on the model predictions at the test-time. Leveraging a first-order Taylor’s approximation of the loss function, (Koh & Liang, 2017) has shown that a (first-order) influence function, computed using the gradient and the Hessian of the loss function, can be useful to interpret machine learning models, fix mislabelled training samples and create data poisoning attacks. + +Influence functions are in general well-defined and studied for models such as logistic regression (Koh & Liang, 2017), where the underlying loss-function is convex. For convex loss functions, influence functions are also accurate even when the model perturbations are fairly large (e.g. in the group influence case (Koh et al., 2019b; Basu et al., 2020)). However, when the convexity assumption of the underlying loss function is violated, which is the case in deep learning, the behaviour of influence functions is not well understood and is still an open area of research. With recent advances in computer vision (Szeliski, 2010), natural language processing (Sebastiani, 2002), high-stakes applications such as medicine (Lundervold & Lundervold, 2018), it has become particularly important to interpret deep model predictions. This makes it critical to understand influence functions in the context of deep learning, which is the main focus of our paper. + +Despite their non-convexity, it is sometimes believed that influence functions would work for deep networks. The excellent work of (Koh & Liang, 2017) successfully demonstrated one example of influence estimation for a deep network, a small (2600 parameters), "all-convolutional" network (Springenberg et al., 2015). To the best of our knowledge, this is the one of the few cases for deep networks where influence estimation has been shown to work. A question of key importance to practitioners then arises: for what other classes of deep networks does influence estimation work? In this work, we provide a comprehensive study of this question and find a pessimistic answer: influence estimation is quite fragile for a variety of deep networks. + +In the case of deep networks, several factors might have an impact on influence estimates: (i) due to non-convexity of the loss function, different initializations of the perturbed model can lead to significantly different model parameters (with approximately similar loss values); (ii) even if the initialization of the model is fixed, the curvature values of the network (i.e. eigenvalues of the Hessian matrix) at optimal model parameters might be very large in very deep networks, leading to a substantial Taylor’s approximation error of the loss function and thus resulting in poor influence estimates; (iii) for large neural networks, computing the exact inverse-Hessian Vector product, required in computation of influence estimates, can be computationally very expensive. Thus, one needs to use approximate inverse-Hessian Vector product techniques which might be erroneous; resulting in low quality influence estimates; and finally (iv) different architectures can have different loss landscape geometries near the optimal model parameters, leading to varying influence estimates. + +In this paper, we study aforementioned issues of using influence functions in deep learning through an extensive experimental study on progressively-growing complex models and datasets. We first start our analysis with a case study of a small neural network for the Iris dataset where the exact Hessian matrix can be computed. We then progressively increase the complexity of the network and analyse a CNN architecture (depth of 6) trained on $1 0 \%$ of MNIST dataset, similar to (Koh & Liang, 2017). Next, we evaluate the accuracy of influence estimates for more complex deep architectures (e.g. ResNets) trained on MNIST and CIFAR-10. Finally, we compute influence estimates on the ImageNet dataset using ResNet-50. + +We make the following observations through our analysis: + +• We find that the network depth and width have a strong impact on influence estimates. In particular, we show that influence estimates are fairly accurate when the network is shallow, while for deeper models, influence estimates are often erroneous. We attribute this partially to the increasing curvature values of the network as the depth increases. +• We observe that the weight decay regularization is important to obtain high quality influence estimates in certain architectures and datasets. +• We show that the inverse-Hessian Vector product approximation techniques such as stochastic estimation (Agarwal et al., 2016) are erroneous, especially when the network is deep. This can contribute to the low quality of influence estimates in deep models. +• We observe that the choice of test-point has a substantial impact on the quality of influence estimates, across different datasets and architectures. +• In very large-scale datasets such as ImageNet, we have found that even ground-truth influence estimates (obtained by leave-one-out re-training) can be inaccurate and noisy partially due to the model’s training and convergence. + +These results highlight sensitivity of current influence functions in deep learning and call for developing robust influence estimators to be used in large-scale machine learning applications. + +# 2 RELATED WORKS + +Influence functions are primarily used to identify important training samples for test-time predictions and debug machine learning models (Koh & Liang, 2017). Similar to influence functions, (Chaudhuri & Mykland, 1993) tackles the problem of approximating a dataset using a subset of the dataset. In recent times, there is an increase in the applications of influence functions for tasks other than interpretability. For e.g.(Schulam & Saria, 2019) has used influence functions to audit the reliability of test-predictions. In NLP, influence functions have been used to detect biases in word-embeddings (Brunet et al., 2018) whereas in the domain of ML security, influence functions have been shown to be effective in crafting stronger data-poisoning attacks (Koh et al., 2019a). Influence functions are also effective in the identification of important training groups (rather than an individual sample) (Basu et al., 2019; Koh et al., 2019b). Prior theoretical work (Giordano et al., 2018; 2019) have focused on quantifying finite sample error-bounds for influence estimates when compared to the ground-truth re-training procedures. Recently, alternative methods to find influential samples in deep networks have been proposed. In (Yeh et al., 2018), test-time predictions are explained by a kernel function evaluated at the training samples. Influential training examples can also be obtained by tracking the change in loss for a test-prediction through model-checkpoints, which are stored during the training time (Pruthi et al., 2020). While these alternative methods (Yeh et al., 2018; Pruthi et al., 2020) work well for deep networks in interpreting model predictions, they lack the “jackknife" like ability of influence functions which makes it useful in multiple applications other than interpretability (e.g. uncertainty estimation). + +# 3 BASICS OF INFLUENCE FUNCTION + +Consider $h$ to be a function parameterized by $\theta$ which maps from an input feature space $\mathcal { X }$ to an output space denoted by $\mathcal { V }$ . The training samples are denoted by the set $\mathcal { S } = \{ z _ { i } : ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , while the loss function is represented by $\ell ( h _ { \theta } ( z ) )$ for a particular training example $z$ . The standard empirical risk minimization solves the following optimization problem: + +$$ +\theta ^ { * } = \arg \operatorname* { m i n } _ { \theta } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( h _ { \theta } ( z _ { i } ) ) . +$$ + +Up-weighting a training example $z$ by an infinitesimal amount $\epsilon$ leads to a new set of model parameters denoted by $\theta _ { \{ z \} } ^ { \epsilon }$ . This set of new model parameters $\theta _ { \{ z \} } ^ { \epsilon }$ is obtained by solving: + +$$ +\theta _ { \{ z \} } ^ { \epsilon } = \arg \operatorname* { m i n } _ { \theta } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( h _ { \theta } ( z _ { i } ) ) + \epsilon \ell ( h _ { \theta } ( z ) ) . +$$ + +Removing a training point $z$ is similar to up-weighting its corresponding weight by $\epsilon = - 1 / n$ in Equation(2). The main idea used by (Koh & Liang, 2017) is to approximate $\theta _ { \{ z \} } ^ { \epsilon }$ by the first-order Taylor series expansion around the optimal model parameters represented by $\theta ^ { * }$ , which leads to: + +$$ +\theta _ { \{ z \} } ^ { \epsilon } \approx \theta ^ { * } - \epsilon H _ { \theta ^ { * } } ^ { - 1 } \nabla _ { \theta } \ell \big ( h _ { \theta ^ { * } } ( z ) \big ) , +$$ + +where $H _ { \theta ^ { * } }$ represents the Hessian with respect to model parameters $\theta ^ { * }$ . Following the classical result of (Cook & Weisberg, 1980), the change in the model parameters $( \Delta \theta = \theta _ { \{ z \} } ^ { \epsilon } - \theta ^ { * } )$ on upweighting the training example $z$ can be approximated by the influence function $( { \dot { \mathcal { T } } } ( { \tilde { z } } ) )$ as follows: + +$$ +\mathcal { T } ( z ) = \frac { d \theta _ { \{ z \} } ^ { \epsilon } } { d \epsilon } | _ { \epsilon = 0 } = - H _ { \theta ^ { * } } ^ { - 1 } \nabla _ { \theta } \ell \left( h _ { \theta ^ { * } } ( z ) \right) . +$$ + +The change in the loss value for a particular test point $z _ { t }$ when a training point $z$ is up-weighted can be approximated as a closed form expression by the chain rule (Koh $\&$ Liang, 2017): + +$$ +\boldsymbol { \mathcal { T } } ( \boldsymbol { z } , \boldsymbol { z } _ { t } ) = - \nabla \ell ( h _ { \theta ^ { \ast } } ( \boldsymbol { z } _ { t } ) ) ^ { T } H _ { \theta ^ { \ast } } ^ { - 1 } \nabla \ell ( h _ { \theta ^ { \ast } } ( \boldsymbol { z } ) ) . +$$ + +$\textstyle { \mathcal { T } } ( z , z _ { t } ) / n$ is approximately the change in the loss for the test-sample $z _ { t }$ when a training sample $z$ is removed from the training set. This result is, however, based on the assumption that the underlying loss function is strictly convex in the model parameters $\theta$ and the Hessian $H _ { \theta ^ { * } }$ is a positive-definite matrix (Koh & Liang, 2017). For large models, inverting the exact Hessian $H _ { \theta ^ { * } }$ is expensive. In such cases, the inverse-Hessian Vector product can be computed efficiently with a combination of Hessian-vector product (Pearlmutter, 1994) and optimization techniques (see Appendix for details). + +# 4 WHAT CAN GO WRONG FOR INFLUENCE FUNCTIONS IN DEEP LEARNING? + +First-order influence functions (Koh & Liang, 2017) assume that the underlying loss function is convex and the change in model parameters is small when the empirical weight distribution of the training data is infinitesimally perturbed. In essence, this denotes the Taylor’s gap in Equation (3) + +![](images/861a7ab3c7fc2993815f9a49a15480676b8b51e6073cf7341656989b57b530ce.jpg) +Figure 1: Iris dataset experimental results - (a,b) Comparison of norm of parameter changes computed with influence function vs re-training; (a) trained with weight-decay; (b) trained without weight-decay. (c) Spearman correlation vs. network depth. (d) Spearman correlation vs. network width. + +to be small for an accurate influence estimate. However in the case of non-convex loss functions, this assumption is not generally true. Empirically, we find that the Taylor’s gap is strongly affected by common hyper-parameters for deep networks. For example, in Fig. (1)-(a,b), we find that for networks trained without a weight-decay regularization on Iris, the Taylor’s gap is large resulting in low quality influence estimates. In a similar vein, when the network depth and width is considerably large (i.e. the over-parameterized regime), the Taylor’s gap increases and substantially degrades the quality of influence estimates (Fig. (2)). Empirically this increase in Taylor’s gap strongly correlates with the curvature values of the loss function evaluated at the optimal model parameters as observed in Fig. (2-(b)). + +Further complications may arise for larger models, where influence estimations in such settings require an additional approximation to compute the inverse-Hessian vector product. Nonetheless, we observe in Fig. (2)-(a), that on Iris this approximation has only a marginal impact on the influence estimation. These results show that that network architecture, hyper-parameters, and loss curvatures are important factors for proper influence estimations. In the next section, we discuss these issues in details through controlled experiments on datasets and models of increasing complexity. + +# 5 EXPERIMENTS + +Datasets: We first study the behaviour of influence functions in a small Iris dataset (Anderson, 1936), where the exact Hessian can be computed. Further, we progressively increase the complexity of the model and datasets: we use small MNIST (Koh & Liang, 2017) to evaluate the accuracy of influence functions in a small CNN architecture with a depth of 6. Next, we study influence functions on modern deep architectures trained on the standard MNIST (LeCun et al., 1998) and CIFAR-10 (Krizhevsky et al., 2000) datasets. Finally, to understand how influence functions scale to large datasets, we use ImageNet (Deng et al., 2009) to compute the influence estimates. + +Evaluation Metrics: We evaluate the accuracy of influence estimates at a given test point $z _ { t }$ using both Pearson (Kirch, 2008) and Spearman rank-order correlation (Spearman, 1904) with the ground-truth (obtained by re-training the model) across a set of training points. Most of the existing interpretability methods desire that influential examples are ranked in the correct order of their importance (Ghorbani et al., 2017). Therefore, to evaluate the accuracy of influence estimates, Spearman correlation is often a better choice. + +# 5.1 UNDERSTANDING INFLUENCE FUNCTIONS WHEN THE EXACT HESSIAN CAN BE COMPUTED + +Setup: Computing influence estimates with the exact Hessian has certain advantages in our study: a) it bypasses inverse-Hessian Vector product approximation techniques which induce errors in computing influence estimates. Thus, we can compare influence estimates computed with exact vs. approximate inverse-Hessian Vector products to quantify this type of error; b) The deviation of the parameters computed with the influence function from the exact parameters can be computed exactly. This information can be useful to further quantify the error incurred by (first-order) influence estimates in the non-convex setup. However, computations of the exact Hessian matrix and its inverse are only computationally feasible for models with small number of parameters. Thus, we use the Iris dataset along with a small feed-forward neural network to analyse the behaviour of influence function computed with the exact Hessian in a non-convex setup. We train models to convergence for $6 0 \mathrm { k }$ iterations with full-batch gradient descent. To obtain the ground-truth estimates, we retrain the models for $7 . 5 \mathrm { k }$ steps, starting from the optimal model parameters. For our analysis, we choose the test-point with the maximum loss and evaluate the accuracy of influence estimates with the ground-truth amongst of the top $1 6 . 6 \%$ of the training points. Through our experiments with the exact Hessian, we answer some relevant questions related to how properties of the network such as depth, width and regularizers (e.g. weight-decay) affect the influence estimates. + +![](images/b3eb3ddc4583137408d8143b098efa0d46f47954efd647189b0f37ae32a3b633.jpg) +Figure 2: Iris dataset experimental results; (a) Spearman correlation of influence estimates with the ground-truth estimates computed with stochastic estimation vs. exact inverse-Hessian vector product. (b) Top eigenvalue of the Hessian vs. the network depth. (c) Spearman correlation between the norm of parameter changes computed with influence function vs. re-training. + +The Effect of Weight-Decay: One of the simpler and common regularization techniques used to train neural networks is weight-decay regularization. In particular, a term $\lambda \| \boldsymbol { \theta } \| _ { 2 } ^ { 2 }$ , penalizing the scaled norm of the model parameters is added to the objective function, during training, where $\lambda$ is a hyperparameter which needs to be tuned. We train a simple feed-forward network1 with and without weight-decay regularization. For the network trained with weight-decay, we observe a Spearman correlation of 0.97 between the influence estimates and the ground-truth estimates. In comparison, for the network trained without a weight-decay regularization, the Spearman correlation estimates decrease to 0.508. In this case, we notice that the Hessian matrix is singular, thus a damping factor of 0.001 is added to the Hessian matrix, to make it invertible. To further understand the reason for this decrease in the quality of influence estimates, we compare the following metric across all training examples: a) Norm of the model parameter changes computed by re-training; b) Norm of the model parameter changes computed using the influence function (i.e. $\forall H _ { \theta ^ { * } } ^ { - 1 } \nabla \ell ( \check { z } _ { i } ) \rVert _ { 2 } \forall i \in [ 1 , n ] )$ (Fig. 1-(a,b)). We observe that when the network is trained without weight-decay, changes in model parameters computed with the influence function have a substantially larger deviation from those computed using re-training. This essentially suggests that the gap in Taylor expansion, using (firstorder) influence estimates is large, when the model is trained without weight-decay. We observe similar results with smooth activation functions such as tanh (see the Appendix for details). + +The Effect Of Network Depth: From Fig. 1-(c), we see that network depth has a dramatic effect on the quality of influence estimates. For example, when the depth of the network is increased to 8, we notice a considerable decrease in the Spearman correlation estimates. To further our understanding about the decrease in the quality of influence estimates when the network is deeper, we compute the gap in the approximation between the ground-truth parameter changes (computed by re-training) and the approximate parameter changes (computed using the influence function). To quantify the error gap, we compute the Spearman correlation estimates between the norm of true and approximate parameter changes across the top $1 6 . 6 \%$ of the influential examples. We find that with increasing depth, the Spearman correlation estimates between the norm of the true and approximate parameter changes decrease. From Fig. 2-(c), we see that the approximation error gap is particularly large when the depth of the network is more than 5. We also notice a consistent increase in the curvature of the loss function (Fig. 2-(b)), as the network becomes deeper. This possibly suggests that the curvature information of the network can be an upper bound in the approximation error gap between the true parameters and the ones computed using the influence function. Even in case of non-smooth activation functions like ReLU, we have a similar observation. (see the Appendix for more details). + +![](images/b5a6c5986abb22c8c379334ea253f708b12e049d116bb3ace65f63a8764c0e21.jpg) +Figure 3: Experiments on small MNIST using a CNN architecture. (a) Estimation of influence function with and without weight decay on (a) the top influential points, (b) training points at $3 0 ^ { t h }$ percentile of influence score distribution. (c) Correlation vs the weight decay factor (evaluated on the top influential points). + +The Effect Of Network Width: To see the effect of the network width on the quality of influence estimates, we evaluate the influence estimates for a feed-forward network of constant depth, by progressively increasing its width. From Fig. 1-(d), we observe that with an increase in network width, the Spearman correlation decreases consistently. For example, we find that the Spearman correlation decreases from 0.82 to 0.56, when the width of the network is increased from 8 to 50. This observation suggests that over-parameterizing a network by increasing its width has a strong impact in the quality of influence estimates. + +The Effect of Stochastic Estimation on inverse-Hessian Vector Product: For large deep networks, the inverse-Hessian Vector product is computed using stochastic estimation(Agarwal et al., 2016), as the exact Hessian matrix cannot be computed and inverted. To understand the effectiveness of stochastic approximation, we compute the influence estimates with both the exact Hessian and stochastic estimation. We observe that across different network depths, the influence estimates computed with stochastic estimation have a marginally lower Spearman correlation when compared to the ones computed with the exact Hessian. From Fig. 2-(a), we find that the error in the approximation is more, when the network is deeper. + +# 5.2 UNDERSTANDING INFLUENCE FUNCTIONS IN SHALLOW CNN ARCHITECTURES + +Setup: In this section, we perform a case study using a CNN architecture2 on the small MNIST dataset (i.e. $1 0 \%$ of MNIST); a similar setup used in (Koh & Liang, 2017). To assess the accuracy of influence estimates, we select a set of test-points with high test-losses computed at the optimal model parameters. For each of the test points, we select 100 training samples with the highest influence scores and compute the ground-truth influence by re-training the model. We also select 100 training points with influence scores at the $3 0 ^ { t h }$ percentile of the entire influence score distribution. These training points have low influence scores and a lower variance in their scores when compared to the top influential points. The model is trained with and without weight-decay regularization. + +When trained with a weight-decay and evaluated based on the top influential points, we find that the correlation estimates are consistently significant (Fig. 3-(a)). This is consistent with the results reported in (Koh & Liang, 2017). However, when the evaluation is done with the set of training samples at the $3 0 ^ { t h }$ percentile of the influence score distribution, the correlation estimates decrease significantly (Fig. 3-(b)). This shows that influence estimates of only the top influential points are precise when compared to ground-truth re-trainings. Furthermore, without the weight-decay regularization, influence estimates in both cases are poor across all the test-points (Fig. 3-(a,b)). + +To further understand the impact of weight-decay on influence estimates, we train the network with different weight-decay regularization factors. From Fig. 3-(c), we see that the selection of weightdecay factor is important in getting high-quality influence estimates. For this specific CNN architecture, we notice that the correlations start decreasing when the weight-decay factor is greater than 0.01. Moreover, from Fig. 3-(a,b), we find that the selection of test-point also has a strong impact on the quality of influence estimates. For example, when the network is trained with weight-decay and the influence estimates are computed for top influential training points, we notice that the Spearman correlation estimates range from 0.92 to 0.38 across different test-points and have a high variance. + +Table 1: Correlation estimates on MNIST And CIFAR-10 ; $\mathbf { A } { = } ^ { \prime }$ Test-point with highest loss; $\mathbf { B } =$ Testpoint at the $5 0 ^ { t h }$ percentile of test-loss spectrum; $\mathbf { P } =$ Pearson correlation; $\mathbf { S } =$ Spearman correlation + +
DatasetMNISTCIFAR-10
A(WithDecay)B(WithDecay)A(WithoutDecay)A(WithDecay)B(WithDecay)A(WithoutDecay)
ArchitecturePSPSPSPSPSPS
Small CNN0.950.870.920.820.410.35--111-
LeNet0.830.510.280.290.180.120.810.690.450.460.190.09
VGG130.340.440.290.180.380.310.670.630.660.630.790.73
VGG140.320.260.280.220.210.110.610.590.490.410.750.64
ResNet180.490.260.390.350.140.110.640.420.250.260.720.69
ResNet500.240.220.290.190.080.130.460.360.240.090.320.14
+ +These results show that despite some successful applications of influence functions in this nonconvex setup, as reported in (Koh & Liang, 2017), their performances are very sensitive to hyperparameters of the experiment as well as to the training procedure. In the next two sections, we assess the quality of influence estimates on more complex architectures and datasets including MNIST, CIFAR-10 and ImageNet. In particular, we desire to understand, if the insights gained from experiments on smaller networks can be generalized to more complex networks and datasets. + +# 5.3 UNDERSTANDING INFLUENCE FUNCTIONS IN DEEP ARCHITECTURES + +Setup: In this section, we evaluate the accuracy of influence estimates using MNIST and CIFAR-10 datasets across different network architectures including small CNN(Koh & Liang, 2017), LeNet (Lecun et al., 1998), ResNets (He et al., 2015), and VGGNets (Simonyan & Zisserman, $2 0 1 5 ) ^ { 3 }$ . To compute influence estimates, we choose two test points for each architecture: a) the test-point with the highest loss, and b) the test-point at the $5 0 ^ { t h }$ percentile of the losses of all test points. For each of these two test points, we select the top 40 influential training samples and compute the correlation of their influence estimates with the ground-truth estimates. To compute the ground-truth influence estimates, we follow the strategy of (Koh & Liang, 2017), where we re-train the models from optimal parameters for $6 \%$ of the steps used for training the optimal model. When the networks are trained with a weight-decay regularization, we use a constant weight-decay factor of 0.001 across all the architectures (see Appendix for more details). + +Results On MNIST: From Table 1, we observe that for the test-point with the highest loss, the influence estimates in the small CNN and LeNet architectures (trained with the weight-decay regularization) have high qualities. These networks have $2 . 6 \mathrm { k }$ and 44k parameters, respectively, and are relatively smaller and less deep than the other networks used in our experimental setup. As the depth of the network increases, we observe a consistent decrease in quality of influence estimates. For the test-point with a loss at the $5 0 ^ { t h }$ percentile of test-point losses, we observe that influence estimates only in the small CNN architecture have good qualities. + +Results On CIFAR-10: For CIFAR-10, across all architectures trained with the weight-decay regularization, we observe that the correlation estimates for the test-point with the highest loss are highly significant. For example, the correlation estimates are above 0.6 for a majority of the network architectures. However, for the test-point evaluated at the $5 0 ^ { t h }$ percentile of the loss, the correlations decrease marginally across most of the architectures. We find that on CIFAR-10, even architectures trained without weight-decay regularization have highly significant correlation estimates when evaluated with the test-point which incurs the highest loss. + +In case of MNIST, we have found that in shallow networks, the influence estimates are fairly accurate while for deeper networks, the quality of influence estimates decrease. For CIFAR-10, although the influence estimates are significant, we found that the correlations are marginally lower in deeper networks such as ResNet-50. The improved quality of influence estimates in CIFAR-10 can be attributed to the fact that for a similar depth, architectures trained on CIFAR-10 are less over-parameterized compared to architectures trained on MNIST. Note that, in Section 5.1, where the exact Hessian matrix can be computed, we observed that over-parameterization decreases the quality of influence estimates. From Table(1), we also observed that the selection of test-point has a sizeable impact on the quality of influence estimates. Furthermore, we noticed large variations in the quality of influence estimates across different architectures. In general we found that influence estimates for small CNN and LeNet are reasonably accurate, while for ResNet-50, the quality of estimates decrease across both MNIST and CIFAR-10. Precise reasons for these variations are difficult to establish. We hypothesize that it can be due to the following factors: (i) Different architectures trained on different datasets have contrasting characteristics of loss landscapes at the optimal parameters which can have an impact on influence estimates. (ii) The weight-decay factor may need to be set differently in various architectures, to obtain high quality influence estimates. + +Results on CIFAR-100: In the case of CIFAR-100, we train a ResNet-18 model with a weight-decay regularization factor of $5 e ^ { - 4 }$ . The influence estimates are then computed for test-points with the highest losses (Index: 6017, 2407, 9383) and testpoints around the $5 0 ^ { t h }$ percentile of the test loss (Index: 783, 7106) over multiple model initialisations. Unlike in the case of MNIST and CIFAR-10, from Fig. 4 we observe the correlation estimates to be of substantially poor quality. We provide additional visualizations of the influential training examples in the Appendix section. + +![](images/5c7cc8697cf16293a0c41189f612e6a47a870167360fc821614b7d8a2cb20566.jpg) +Figure 4: Influence for CIFAR-100 + +# 5.4 IS SCALING INFLUENCE ESTIMATES TO IMAGENET POSSIBLE? + +The application of influence functions to ImageNet scale models provides an appealing yet challenging opportunity. It is appealing because, if successful, it opens a range of applications to large-scale image models, including interpretability, robustness, data poisoning, and uncertainty estimation. It is challenging for a number of reasons. Notable among these is the high computational cost of training and re-training, which limits the number of ground truth evaluations. In addition, all of the previously discussed difficulties in influence estimations still remain, including (i) non-convexity of the loss, (ii) selection of scaling and damping hyperparameters in the stochastic estimation of the Hessian, and (iii) the lack of convergence of the model parameters. The scale of ImageNet raises additional questions about the feasibility of leave-one-out retraining as the ground truth estimator. Given that there are 1.2M images in the training set, is it even possible that the removal of one image can significantly alter the model? In other words, we question whether or not reliable ground truth estimates may be obtained through leave-one-out re-training at this scale. + +To illustrate this, we conduct an additional influence estimation on ImageNet. After training an initial model to $9 2 . 3 0 2 \%$ top5 test accuracy, we select two test points at random, calculate influence over the entire training set, and then select the top 50 points by their influences as candidates for re-training. We then use the re-training procedure suggested by (Koh & Liang, 2017), which starts leave-one-out re-training from the parameter set obtained after the initial training. We re-train for an additional 2 epochs, approximately $5 \%$ of the original training time, and calculate the correlations. We observe that for both test points, both Pearson and Spearman correlations are very low (less than 0.15, see details in the Appendix). + +In our experiments, we observe high variability among ground-truth estimates obtained by retraining the model (see the appendix for details). We conjecture that this may be partially due to the fact that the original model has not be fully converged. To study this, we train the original model with all training points for an additional 2 epochs and measure the change in the test loss. We find that the overall top5 test accuracy has improved slightly to $9 2 . 3 3 6 \%$ $( + 0 . 0 3 4 )$ and the loss for one of the considered test points has decreased by relatively a significant amount of 0.679. However, the loss for the other point has increased slightly by 0.066. Such changes in loss values can therefore out-power the effect of leave-one-out re-training procedure. Second, we calculate the 2-norm of the weight gradients, which should be close to zero near an optimal point, and compare it to a standard pre-trained ImageNet ResNet-50 model as a baseline. We find these norms to be 20.18 and and 15.89, respectively, showing our model has similar weight gradient norm to the baseline. Although these norms are relatively small given that there are $2 5 . 5 \mathbf { M }$ parameters, further re-training the model still changes loss values for some samples considerably, making the ground-truth estimates noisy. We suggest that one way to obtain reliable ground-truth influence estimates in such large models can be through assessing the influence of a group of samples, rather than a single one. + +![](images/0c907a9c5c9076340560b4e66504ec404f85d8bdfe65ba96906a75ffa1e1fb36.jpg) +Figure 5: (a) Difference in norm of parameters obtained by re-training from scratch vs. re-training from optimal parameters. (b) Correlation estimates with re-training from scratch vs. re-training from optimal parameters. + +# 6 DISCUSSION ON GROUND-TRUTH INFLUENCE + +In our experimental setup, to obtain the ground-truth influence, we follow the strategy of re-training from optimal model parameters as shown in (Koh & Liang, 2017; Koh et al., 2019b). Even for moderately sized datasets and architectures, re-training from scratch (instead of re-training from optimal model parameters) is computationally expensive. Although re-training from optimal model parameters is an approximation compared to re-training from scratch, we notice that the approximation works quite well in practice. To validate the effectiveness of this strategy, we first compute the norm of the difference in parameters obtained by re-training from scratch vs. re-training from optimal parameters. Next we compute the correlation between the influence estimates and ground-truth using both the re-training strategies. From Fig. 5, we observe the norm of parameter differences using the two re-training strategies to be small. Similarly using both the re-training strategies as ground-truth yield similar correlation estimates. These results highlight that re-training from optimal parameters (although an approximation) is close to re-training from scratch. + +# 7 CONCLUSION + +In this paper, we present a comprehensive analysis of the successes and failures of influence functions in deep learning. Through our experiments on datasets including Iris, MNIST, CIFAR-10, CIFAR-100, ImageNet and architectures including LeNet, VGGNets, ResNets, we have demonstrated that influence functions in deep learning are fragile in general. We have shown that several factors such as the weight-decay, depth and width of the network, the network architecture, stochastic approximation and the selection of test points, all have strong effects in the quality of influence estimates. In general, we have observed that influence estimates are fairly accurate in shallow architectures such as small CNN(Koh & Liang, 2017) and LeNet, while in very deep and wide architectures such as ResNet-50, the estimates are often erroneous. Additionally, we have scaled up influence computations to the ImageNet scale, where we have observed influence estimates are highly imprecise. These results call for developing robust influence estimators in the non-convex setups of deep learning. + +# 8 ACKNOWLEDGEMENTS + +Authors thank Daniel Hsu, Alexander D’Amour and Pang Wei Koh for helpful discussions. This project was supported in part by NSF CAREER AWARD 1942230, HR001119S0026-GARD-FP052, AWS Machine Learning Research Award, a sponsorship from Capital One, and Simons Fellowship on “Foundations of Deep Learning". + +# REFERENCES + +Naman Agarwal, Brian Bullins, and Elad Hazan. Second order stochastic optimization in linear time. ArXiv, abs/1602.03943, 2016. + +Anderson. Iris flower dataset. In -, 1936. + +Samyadeep Basu, Xuchen You, and Soheil Feizi. Second-order group influence functions for blackbox predictions. ArXiv, abs/1911.00418, 2019. + +Samyadeep Basu, Xuchen You, and Soheil Feizi. On second-order group influence functions for black-box predictions. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 715–724. PMLR, 13–18 Jul 2020. URL http://proceedings.mlr.press/ v119/basu20b.html. + +Léon Bottou. Large-scale machine learning with stochastic gradient descent. In in COMPSTAT, 2010. + +Marc-Etienne Brunet, Colleen Alkalay-Houlihan, Ashton Anderson, and Richard S. Zemel. Understanding the origins of bias in word embeddings. CoRR, abs/1810.03611, 2018. URL http://arxiv.org/abs/1810.03611. + +Probal Chaudhuri and Per A. Mykland. Nonlinear experiments: Optimal design and inference based on likelihood. Journal of the American Statistical Association, 88(422):538–546, 1993. doi: 10.1080/01621459.1993.10476305. URL https://www.tandfonline.com/doi/abs/ 10.1080/01621459.1993.10476305. + +R. Dennis Cook and Sanford Weisberg. Characterizations of an empirical influence function for detecting influential cases in regression. Technometrics, 22(4):495–508, 1980. ISSN 0040-1706. doi: 10.1080/00401706.1980.10486199. + +J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009. + +Amirata Ghorbani, Abubakar Abid, and James Y. Zou. Interpretation of neural networks is fragile. In AAAI, 2017. + +Ryan Giordano, Will Stephenson, Runjing Liu, Michael I. Jordan, and Tamara Broderick. A swiss army infinitesimal jackknife. In AISTATS, 2018. + +Ryan Giordano, Michael I. Jordan, and Tamara Broderick. A higher-order swiss army infinitesimal jackknife. ArXiv, abs/1907.12116, 2019. + +Priya Goyal, Piotr Dollár, Ross B. Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: training imagenet in 1 hour. CoRR, abs/1706.02677, 2017. URL http://arxiv.org/abs/1706. 02677. + +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. URL http://arxiv.org/abs/1512.03385. + +Jeremy Howard et al. fastai. https://github.com/fastai/fastai, 2018. + +Alon Jacovi and Yoav Goldberg. Towards faithfully interpretable nlp systems: How should we define and evaluate faithfulness? Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.acl-main.386. URL http://dx. doi.org/10.18653/v1/2020.acl-main.386. + +Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014. + +Wilhelm Kirch (ed.). Pearson’s Correlation Coefficient, pp. 1090–1091. Springer Netherlands, Dordrecht, 2008. ISBN 978-1-4020-5614-7. doi: 10.1007/978-1-4020-5614-7_2569. URL https://doi.org/10.1007/978-1-4020-5614-7_2569. + +P. W. Koh, J. Steinhardt, and P. Liang. Stronger data poisoning attacks break data sanitization defenses. arXiv preprint arXiv:1811.00741, 2019a. + +Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. 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. 1885–1894, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http:// proceedings.mlr.press/v70/koh17a.html. + +Pang Wei Koh, Kai-Siang Ang, Hubert H. K. Teo, and Percy Liang. On the accuracy of influence functions for measuring group effects. CoRR, abs/1905.13289, 2019b. URL http://arxiv. org/abs/1905.13289. + +Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). CVPR, 2000. URL cifar.com. + +Yann Lecun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, pp. 2278–2324, 1998. + +Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, volume 86, pp. 2278–2324, 1998. URL http://citeseerx.ist.psu.edu/viewdoc/summary?doi $=$ 10.1.1.42.7665. + +Alexander Selvikvåg Lundervold and Arvid Lundervold. An overview of deep learning in medical imaging focusing on MRI. CoRR, abs/1811.10052, 2018. URL http://arxiv.org/abs/ 1811.10052. + +Barak A. Pearlmutter. Fast exact multiplication by the hessian. Neural Comput., 6(1):147–160, January 1994. ISSN 0899-7667. doi: 10.1162/neco.1994.6.1.147. URL http://dx.doi. org/10.1162/neco.1994.6.1.147. + +Garima Pruthi, Frederick Liu, Mukund Sundararajan, and Satyen Kale. Estimating training data influence by tracking gradient descent. ArXiv, abs/2002.08484, 2020. + +Sebastian Ruder. An overview of gradient descent optimization algorithms. CoRR, abs/1609.04747, 2016. URL http://arxiv.org/abs/1609.04747. + +Peter G. Schulam and Suchi Saria. Can you trust this prediction? auditing pointwise reliability after learning. In AISTATS, 2019. + +Fabrizio Sebastiani. Machine learning in automated text categorization. ACM Comput. Surv., 34(1): 1–47, March 2002. ISSN 0360-0300. doi: 10.1145/505282.505283. URL http://doi.acm. org/10.1145/505282.505283. + +Thiago Serra, Christian Tjandraatmadja, and Srikumar Ramalingam. Bounding and counting linear regions of deep neural networks, 2018. + +Jonathan R Shewchuk. An introduction to the conjugate gradient method without the agonizing pain. -, 1994. + +Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015. + +Leslie N. Smith. A disciplined approach to neural network hyper-parameters: Part 1 - learning rate, batch size, momentum, and weight decay. CoRR, abs/1803.09820, 2018. URL http: //arxiv.org/abs/1803.09820. +C. Spearman. The proof and measurement of association between two things. American Journal of Psychology, 15:88–103, 1904. +Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin A. Riedmiller. Striving for simplicity: The all convolutional net. In Yoshua Bengio and Yann LeCun (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Workshop Track Proceedings, 2015. URL http://arxiv.org/abs/1412.6806. +DAWNBench: An End-to-End Deep Learning Benchmark and Competition, 2017. Stanford. URL https://dawn.cs.stanford.edu/benchmark/papers/nips17-dawnbench. pdf. +Richard Szeliski. Computer Vision: Algorithms and Applications. Springer-Verlag, Berlin, Heidelberg, 1st edition, 2010. ISBN 1848829345, 9781848829343. +Chih-Kuan Yeh, Joon Sik Kim, Ian En-Hsu Yen, and Pradeep Ravikumar. Representer point selection for explaining deep neural networks. CoRR, abs/1811.09720, 2018. URL http: //arxiv.org/abs/1811.09720. + +![](images/f3e9f8c7e514eb3ab897002f8f1ceab6198b40bca9d034a2d84a583fd27cc551.jpg) +Figure 6: Additional Iris experimental results for ReLU networks: (a) Spearman correlation vs. network depth; (b) Top eigenvalue of the Hessian vs.network depth; (c) Spearman correlation between the norm of parameter changes computed with influence function vs. re-training. + +# 9 APPENDIX + +# 9.1 ADDITIONAL EXPERIMENTAL RESULTS ON IRIS DATASET + +In this section, we provide additional experimental results to understand the effect of network depth on the correlation estimates for ReLU networks. From Fig. 6, we observe that even in case of architectures trained with non-smooth activation functions such as ReLU, the correlation estimates consistently decrease with depth. Similar to our findings in case of networks trained with tanh activation (as shown in the main text), we observe that the top eigenvalue of the Hessian matrix and the Taylor’s approximation gap increases with depth. In the main text, we reported that when a network with ReLU activation is trained with a weight-decay regularization, the correlation estimates are significant and the Taylor’s approximation gap is less. We find a similar result even with smoother activation functions such as tanh. From Fig. 7, we observe that when a network with tanh activation is trained with a weight-decay regularization, the Taylor’s approximation gap is less. However when the network is trained without a weight-decay regularization, the Taylor’s expansion gap is large resulting in poor quality of influence estimates. + +![](images/0c5ee5785116ce0d7543569198786c4e8933ab66b99f85d61cf0a674b8fcd747.jpg) +Figure 7: Additional Iris experimental results for tanh networks; (a) When trained with weightdecay, the Taylor’s approximation gap is small; (b) When trained without weight-decay, the Taylor’s expansion gap is large. These results are similar to our findings for ReLU networks which are reported in the main text. + +# 9.2 WHAT DOES WEIGHT-DECAY DO? + +In our experiments, we observe that with increasing network depth, the correlation between the influence estimates and the ground-truth estimates decrease considerably. + +Additionally with increasing depth, the loss curvature values increase. We notice that with a high-value of weight-decay, the loss curvature for deeper networks decrease, which also leads to improvement in correlation values between the influence estimates and the ground-truth. For e.g. in Fig. 8, with a weight-decay value of 0.03, the Spearman correlation estimates are 0.47. With a relatively higher weight-decay factor of 0.075, the correlation values improve to 0.72. Increasing the weight-decay factor from 0.03 to 0.075, also decreases the loss curvature values substantially. These results highlight that the selection of weight-decay factor is crucial to obtain high-quality influence estimates, especially for deeper overparameterized networks. + +![](images/c4ca40eb6d14fcfa4923506040d691a309eaad3a033e1ab829d138624107dcc5.jpg) +Figure 8: Correlations with different training samples + +# 9.3 VISUALISATION OF TOP INFLUENTIAL POINTS + +In this section, we visualise the top influential training samples corresponding to a given test-point. In the main text, we noted that the selection of test-points has a strong impact on the quality of influence estimates. Additionally, we also observe that the selection of test-points has an impact on the semantic-level similarities between inferred influential training points and the test-points being evaluated. For example, in Fig. 9, we observe that 2 out of the top 5 influential points are not from the same class as the test-point with index 1479. However in Fig. 10, we observe that all the top 5 influential training samples are semantically similar and from the same class as the evaluated test-point with index 7196. + +![](images/c272280b568c286b03304b79bd6f511892e982b967b388e81a68f809e53b1be1.jpg) +Figure 9: Top 5 influential points for the test point: 1479 (CIFAR-10). The model is a ResNet-18 trained with a weight-decay regularization; Only 3 out of the 5 points are semantically similar to the test-point with class "Bird". + +![](images/c0e5966c7c4cc69f2a3edd0feaff3d7942b9354fbd7f1687865f89e403d6aed9.jpg) +Figure 10: Top 5 influential points for the test point: 7196 (CIFAR-10). The model is a ResNet-18 trained with a weight-decay regularization; All the 5 training points are semantically similar to the test-point from the class "Airplane". + +
ArchitectureInfluence Computation Time(MNIST)Influence Computation Time(CIFAR-10)
Small CNN141.13 ± 0.51N/A
LeNet162.6 ± 2.20136.39 ± 3.16
VGG133886.23 ± 3.454416.54 ± 2.01
VGG144619.11 ± 5.084620.69 ± 6.11
ResNet-18960.08 ± 4.67910.58 ± 8.49
ResNet-504323.13 ± 8.263857.66 ± 21.6
+ +Table 2: Computational running times for influence function across different architectures + +# 9.4 RUNNING TIMES + +In this section, we provide computational running times for (first-order) influence function estimations. We note that in models with a large number of parameters, the influence computation is relatively slow. However, even in large deep models, it is still faster than re-training the model for every training example. In our implementation, for a given test-point $z _ { t e s t }$ , we first compute $c = H _ { \theta ^ { * } } ^ { \bar { - } 1 } \nabla \ell ( h _ { \theta ^ { * } } ( z _ { t e s t } ) ) $ once which is the most computationally expensive step. We then compute a vector dot product i.e. $c ^ { T } \nabla \ell ( h _ { \theta ^ { \ast } } ( z _ { i } ) ) \forall i \in [ 1 , n ]$ . In Table 2, we provide the computational running times for estimating influence functions in different network architectures. + +# 9.5 ADDITIONAL EXPERIMENTAL DETAILS ON IMAGENET INFLUENCE CALCULATIONS + +In this section we give further details on the influence estimation on ImageNet. To help address the high computational cost of training and re-training, we utilize highly optimized ImageNet training schemes such as those submitted to the DAWNBench competition (Sta, 2017). In particular we use the scheme published from (Howard et al., 2018)4, for the ResNet-50 architecture which uses several training tricks including progressive image resizing, weight decay tuning, dynamic batch sizes (Goyal et al., 2017), learning rates (Smith, 2018), and half-precision floats. Although these techniques are unorthodox, they are sufficient for our purposes since we need only to compare between the fully trained and re-trained models. We replicate this scheme and obtain a top-5 validation accuracy of $9 2 . 3 0 2 \%$ . + +We now give further details on the test points selected. The first has a test loss at the 83rd percentile $\mathrm { 1 o s s } { = } 2 . 6 3 4$ , index $= 1 3 \small { , } 9 2 3$ , class $\vDash$ kit fox), the second has the test loss at the 37th percentile $\mathrm { \ R e s s { = } } 0 . 0 8 1$ , index $= 2 { , } 2 5 7$ , class $=$ gila monster), where the indices refer to where they appear in test_loader.loader.dataset . We visualize these test points in Figure 12. + +Next, for each of these test points, we compute influence across the entire dataset and select the top 50 training points by influence scores. We visualize 25 of these points in Figures 13 and 14. We observe that there is qualitative similarity between the test points and some of their respective most influential training points, but not others. Although there is qualitative similarity is some cases, the results are still overall weak quantitatively + +We plot the obtained correlations in Figure 11. + +For computing the weight gradient norm, we take the mean norm in batches of size 128 over the entire dataset for both our model and a standard PyTorch pretrained model as a baseline, both of which are ResNet-50 models with around 25.5M parameters. + +![](images/bfe5ccded403e4887b7dc2cc23ab6cf09e53da12d93fcf19b033c90736e21a11.jpg) +Figure 11: ImageNet influence estimation results for the selected test points 13,923 (left) and 2,257 (right). X-axis is change in test loss after removal of a training point and retraining as described in the text. Y-axis is the change in test loss estimated with influence function. Pearson and Spearman correlations are shown in the caption. Correlations are low, showing the weakness of this influence estimation. + +![](images/e69c605bc0e46d1fb9129225bd462b5ad882f1cca999d5a7d8ec1cb14b788f93.jpg) +Figure 12: Selected test points for influence estimation. + +# 9.6 COMPUTING INVERSE-HESSIAN VECTOR PRODUCT + +In large over-parameterized deep networks, computing and inverting the exact Hessian $H _ { \theta ^ { * } }$ is expensive. In such cases, the Hessian-vector product rule (Pearlmutter, 1994) is used along with conjugate-gradient (Shewchuk, 1994) or stochastic estimation (Agarwal et al., 2016) to compute the approximate inverse-Hessian Vector product. More specifically, to compute $t = H _ { \theta ^ { * } } ^ { - 1 } v$ , we solve the following optimization problem using conjugate-gradient: $t ^ { * } = \arg \operatorname* { m i n } _ { t } \{ \frac { 1 } { 2 } t ^ { T } H _ { \theta ^ { * } } t - v ^ { T } t \}$ , where $v = \nabla _ { \boldsymbol { \theta } } \bar { \ell } ( \bar { h _ { \boldsymbol { \theta } ^ { \ast } } } ( z _ { t } ) )$ . This optimization, however, requires the Hessian $H _ { \theta ^ { * } }$ to be a positive definite matrix, which is not true in case of deep networks due to the presence of negative eigenvalues. In practice, the Hessian can be regularized by adding a damping factor of $\lambda$ to its eigenvalues (i.e. $H _ { \theta ^ { * } } + \lambda I )$ to make it positive definite. + +In deep models, with a large number of parameters and large training set, conjugate-gradient is often expensive as it requires computing the Hessian-vector product (Pearlmutter, 1994) for every data sample in the training set. In those cases, stochastic estimation techniques (Agarwal et al., + +![](images/7775e1b39b8fdd36efa64795e738b2a001448d74c0af0798728622f7b426ef23.jpg) +Figure 13: Top 25 ImageNet training points by influence for test point 13,293, kit fox. Many of the identified classes are furred mammals, e.g. red wolf, basenji, and dingo, which have visual similarity to the test point. Other examples are questionable, e.g. the common iguana, and African elephant. Although there is qualitative similarity is some cases, the results are still overall weak quantitatively. + +2016) have been used which are fast as they do not require going through all the training samples. In stochastic estimation, the inverse Hessian is computed using a recursive reformulation of the Taylor expansion: $H _ { j } ^ { - 1 } = I + ( I - H ) H _ { j - 1 } ^ { - 1 }$ where $j$ is the recursion depth hyperparameter . A training example $z _ { i }$ is uniformly sampled and $\nabla ^ { 2 } \ell ( h _ { \theta ^ { * } } ( z _ { i } ) )$ is used as an estimator for computing $H$ . This technique also requires tuning a scaling hyperparameter $\gamma$ and a damping hyperparameter $\beta$ 5 . In our experiments with large deep models, we use the stochastic estimation method to compute the inverse-Hessian Vector product. + +![](images/934265cea208344baa4eac59cf57fd4908d23f1ca1c27a638f888b83dc082af4.jpg) +Figure 14: Top 25 ImageNet training points by influence for test point 2,257, gila monster. Many of the identified classes are spotted lizards, e.g. banded gecko ad European fire salamander, which have visual similarity to the test point. Other examples are questionable, e.g. the stingray, coral fungus, and barrow. Although there is qualitative similarity is some cases, the results are still overall weak quantitatively. + +# 9.7 EFFECT OF INITIALISATION AND OPTIMIZERS ON INFLUENCE ESTIMATES + +To understand the effect of network initialisation on the quality of influence estimates, we compute the influence scores across different random initialisations. The influence estimates are computed for the small CNN architecture (Koh & Liang, 2017) and LeNet (Lecun et al., 1998), both trained on the MNIST dataset. Both the architectures are trained with a constant weight-decay factor of 0.001. + +In Fig 15, we observe that across different network initialisations, although both the Pearson and Spearman correlations between the influence estimates and the ground-truth are inconsistent, the variance amongst them is particularly low. Note that for both the network architectures, we compute the influence estimates for the test-point with the highest loss at the optimal model parameters. The correlation between the influence estimates and leave-out retrainings are computed with the top 40 influential training examples. Additionally to understand the impact of the selection of optimizer on the influence estimates, we train the LeNet architecture on MNIST with different optimizers namely Adam (Kingma & Ba, 2014), Gradient Descent (Bottou, 2010), Nesterov and RM + +![](images/6b384b4edf2d2ea5bf3ccac8e7f4c7a837a0ad6473693cc73cd2035993a156bb.jpg) +Figure 15: Correlations with different network initialisation + +SProp (Ruder, 2016). We notice that the Pearson correlation $( 0 . 7 2 \pm 0 . 0 4 )$ has a marginally lower variance when compared to the Spearman rank-order correlation $( 0 . 5 6 \pm 0 . 1 1 )$ ). + +# 9.8 EFFECT OF TRAINING SAMPLE SELECTION FOR GROUND-TRUTH INFLUENCE + +In this section, we understand the effect of selecting different number of training samples on the correlation estimates. We investigate this with a case study for a CNN architecture trained on small MNIST. Keeping a test-point with a high loss fixed, we sample different sets of training examples with the highest and the lowest influence scores over different network initialisations. + +Note that in this setting as shown in the main paper, the quality of influence estimates are relatively good. We observe that when the influence estimates are evaluated with the top influential points, both the Pearson and Spearman correlations are relevant. This is true across different number of training samples. However when the evaluation carried out with respect to the lowest influential training samples, the correlation estimates are of poor quality. These results highlight the importance of the selection of the type of training samples with respect to which the correlation estimates are computed. + +![](images/d6c37d9fc8e6477f91a5f61e3d614bdd32cd5f89ff460b20e287fe3cd5d28556.jpg) +Figure 16: Correlations with different training samples + +# 9.9 FAITHFULNESS AND PLAUSIBILITY OF INFLUENCE FUNCTIONS + +The authors (Jacovi & Goldberg, 2020) primarily tackle the importance and trade-offs between plausibility (i.e. if the interpretations are convincing to humans) and faithfulness (i.e. how accurate an interpretation is to the “true reasoning process of the model”) of existing interpretation methods. To the best of our knowledge such an analysis has not been done for influence functions. We observe that explanations from influence functions for deep networks are sometimes plausible and sometimes not. For instance, in Appendix Fig. 9, we observe that the selection of test-point with (class $=$ bird) leads to training examples with (class $=$ deer) amongst the top influential points. On the other hand, in Appendix Fig. 10, we observe many plausible explanations. Influence functions that work are faithful because they answer the following question:“what would this model have done if certain data were excluded?”. This class of questions, while not exhaustive, have special relevance because they are counterfactuals, which hold both intuitive appeal and for their special status in causal reasoning. However, we must be cautious because they may not be faithful when they incur approximation errors, as highlighted in our paper. + +# 9.10 CIFAR-100 INFLUENTIAL EXAMPLES + +![](images/5dbeb6a8d57f58204da06c41a572d512e0cf897aa420b51af50e65dcc57b751b.jpg) +Figure 17: Top 5 influential points for the test points: 7106 and 2407 (CIFAR-100). The model is a ResNet-18 trained with a weight-decay regularization. For the test-point with index 7106, the influential training samples are semantically dissimilar from the test-point. However for the testpoint with index 2407, 4 out of the top 5 samples share semantic similarity with the test-point. + +# 9.11 PRELIMINARY RESULTS ON GROUP INFLUENCE + +Understanding model changes when a group of training samples are up-weighted is indeed an important research problem. Influence functions (Cook & Weisberg, 1980; Koh & Liang, 2017) in general are accurate when the model perturbation is small. However when a group of samples are up-weighted, the model perturbation is large, which violates the small perturbation assumption of influence functions. Previously it has been shown (Koh et al., 2019b; Basu et al., 2019) that group influence functions are fairly accurate for linear and convex models, even when the model perturbation is substantial. In this section, we present some preliminary results on the + +![](images/88a5ca8f6424880aef6a3cde44df83abd7e59dba8a289a4035a3a4677035559b.jpg) +Figure 18: Group Influence on Iris + +behaviour of group influence functions for non-convex models. Our main observation is that group influence functions are fairly accurate for small networks. Nonetheless for large and complex networks, the influence estimates are of poor quality. For e.g. in Fig. 18, we observe that the correlation estimates for small group sizes are accurate, whereas for larger group sizes, the estimates are of poor quality. For a ResNet-18 model trained on MNIST (with a weight-decay regularization factor of 0.001), we observe the correlation estimates across different group sizes to vary from 0.01 to 0.21. Similarly for a ResNet-18 trained on CIFAR-100, we observe the group influence correlation estimates to range from 0.01 to 0.18. We leave the complete investigation of group influence in deep learning as a direction for future work. + +![](images/ae2aa49d4fe24544d602588da11fd38acc374c94125b3e501c4df8e8df3c8ec9.jpg) +Figure 19: Norm of difference in parameters obtained by training from scratch vs. re-training from optimal parameters + +![](images/40e6b5157000f8c44253c0ffd4a76d7bfe0d1314195955a379c1e2f92e7ab313.jpg) +Figure 20: Width vs. Spearman Correlation for a one-layered network + +# 9.12 ADDITIONAL EXPERIMENTS WITH MULTIPLE TEST-POINTS + +In our experimental setup, we evaluate the correlation estimates with respect to one test-point at a time. Although the evaluation of the correlation estimates with multiple test-points is more robust, it comes at the expense of high computational cost. To illustrate the quality of influence estimates with multiple test-points, we compute the influence estimates for small MNIST with 8 different test-points. We sample two test-points each from $:$ (a) $1 0 0 ^ { t h }$ percentile of the test-loss; (b) $7 5 ^ { t h }$ percentile of the test-loss; (c) $5 0 ^ { t h }$ percentile of the test-loss; (d) $\mathbf { \bar { 2 5 } } ^ { t h }$ percentile of the test-loss. The Pearson and Spearman correlations are 0.91 and 0.78 respectively. In a similar setting, for a complex architecture such as ResNet-18 trained on CIFAR-100, the Pearson and Spearman correlations are 0.15 and 0.11 respectively. + +# 9.13 IMPACT OF ACTIVATION FUNCTIONS + +In our experiments we observe that even with non-smooth activation functions such as ReLU, we obtain high quality influence estimates for certain networks. Understanding influence estimates with ReLU has an additional challenge since there measure zero subsets where the function is nondifferentiable. Recently (Serra et al., 2018) has provided improved bounds on the number of linear regions for shallow ReLU networks. Understanding the impact of the number of linear regions in ReLU networks on the influence estimates is an interesting research direction, however we defer it for future work. \ No newline at end of file diff --git a/md/train/yqj6q_eNTJd/yqj6q_eNTJd.md b/md/train/yqj6q_eNTJd/yqj6q_eNTJd.md new file mode 100644 index 0000000000000000000000000000000000000000..4e9be51cc1593e3c87c7224ae60398f7431804fe --- /dev/null +++ b/md/train/yqj6q_eNTJd/yqj6q_eNTJd.md @@ -0,0 +1,636 @@ +# ActCooLR – High-Level Learning Rate Schedules using Activation Pattern Temperature + +Anonymous Author(s) +Affiliation +Address +email + +# Abstract + +1 We consider the aspect of learning rate (LR-)scheduling in neural networks, which +2 often significantly affects achievable training time and generalization performance. +3 Although schedules such as $^ { l }$ -cycle offer substantial gains over base-line methods, +4 the effect of LR-curves on the training process is not very well understood. In order +5 to gain more insight into the training process, we combine information theoretic +6 ideas and probabilistic optimization, namely simulated annealing. In more detail, +7 we introduce the activation pattern temperature, which (i) captures changes in the +8 non-linear behavior of ReLU networks and (ii) is free of hyperparameters and thus +9 is more interpretable. Examining the training process, 1-cycle simply yields a linear +10 decrease in temperature, reminiscent of successful cooling strategies in simulated +11 annealing. In order to test a causal connection, we devise ActCooLR, an automatic +12 LR-scheduler that produces declining temperature profiles. In experiments with +13 various CNN architectures and different image classification data sets, we obtain +14 results that perform favorably or exceed the performance of hand-tuned schedules. + +# 15 1 Introduction + +16 Despite the huge success of deep networks, their training dynamics is still ground for many discussions. +17 Above all, the reason for the good performance of such a simple algorithm as Stochastic Gradient +18 Descent (SGD) remains an open question. As stated by Bengio [4], the learning rate (LR) of SGD is +19 “[t]he single most important hyperparameter and one should always make sure that has been tuned”. +20 It is considered to steer the amount of noise that regularizes the optimization [6; 22]. Research spans +21 from practical recommendations, such as best practice learning rate schedules of distinct forms [4] +22 to theoretical models that unveil the implicit regularization of SGD that depends on the learning +23 rate [2; 46]. For instance, many training procedures include a warm up phase into the learning rate +24 schedules to adapt training to numerical limitations as well as the distinct behavior of the initial +25 training phase compared to the rest of training [14; 15; 36]. Recent studies divide the whole training +26 process into phases of distinct characteristics. Nevertheless, the number of regimes or phases is still +27 under discussion, most commonly described as two or three phases ([13; 29; 31; 32; 39]). A broad +28 variety of work introduce sharpness based measures that give mathematical characterizations of the +29 loss landscape promising a deeper understanding of the phases, trainability and generalization of deep +30 networks [24]. However, these typically either introduce hyperparameters themselves or describe +31 only a subspace of optimization directions. +32 In this paper, we are trying to understand the effect of varying learning rates on the training process +33 better. As a central tool, we propose a new measure of learning progress, activation pattern temper +34 ature (APT). The key idea is to focus on the “hard” part of optimization, which is the fitting of a +35 non-linear function. We therefore measure changes not by step-size in parameter space but counting +36 changes in activation patterns, i.e., testing if the decomposition of feature maps into piecewise +37 linear regions changes. Due to its independence of changes to the linear mappings, the measure is, +38 unlike the original LR and other simple differential measures in parameter space, more stable under +39 reparametrization. +40 Through the lens of this measure we analyze the training of convolutional neural networks on image +41 classification tasks using several LR schedules (Section 3.2) and find that the commonly used $^ { l }$ -cycle +42 scheduler [45] has a very simple behavior, namely an approximately linear decrease during training. +43 It also provides some additional insights into the training dynamic, such as connections between +44 temperature and generalization behavior, and a visualization of phase-boundaries for different learning +45 rates. +46 Using the analysis, we present a method that adapts the learning rate automatically to match a user +47 specified target temperature profile throughout training. Effective profiles start at high temperature +48 and decrease monotonically until the activation patterns do not change anymore and optimization +49 becomes purely linear. Correspondingly, we name our method ActCooLR. As our method matches +50 the performance of previously hand-tuned learning rate schedules in our experiments, it could be +51 considered as a candidate for an effective and efficient, hyper-parameter free automatic LR-scheduler. +52 The computational overhead is moderate , with only one additional forward-pass. +53 In summary, our main contributions are (i) the introduction of the activation pattern temperature, +54 which reveals a more uniform view of the effect of LR-scheduling on training and (ii), based on +55 this, an automatic learning rate scheduler that provides accuracy for short training times in a fully +56 automatic way. + +# 57 2 Related Work + +Driven by the goal to better understand generalization, the training process of deep network training has been analyzed in a large body of work. We would structure the background as follows: + +60 Training Phases: One approach of understanding the training process is to describe it in different +61 phases. An early variant of this idea is the work of Bengio et al. [5], who showed that increasing +62 the intrinsic complexity of data during training can help to improve generalization performance. +63 Several studies identify two training phases: the network trains low-frequency features first, yielding +64 low generalization error and continues to learn high-frequency features in a second training phase +65 that is more susceptible to overfitting [42; 26]. Similar observations have been made in studies +66 that also take the effect of the learning rate into account [29; 31; 32]. A more recent study stated +67 that their “experiments suggest that this [(two training phases)] is not the complete picture” [39]. +68 Others show evidence of three instead of two training phases [13; 31]. However, there appears to +69 be consensus in literature that at the beginning of the training, the activations of a network mainly +70 perform a random walk [13; 20]. More practically, increasing the randomness has been shown to +71 even improve performance (see e.g. [40; 54]), having dropout as a more prominent example [47]. +72 The other widely accepted fact relates to the end of training, where momentum becomes increasingly +73 important [29] as gradients directions simplify [16] and the loss landscape flattens [2]. Hoffer et al. +74 [20] have shown that this comes from the loss landscape getting smoother the farther the weights +75 travel from initialization. More recently, mode connectivity has been used as a tool to check whether +76 a modification in the training process leads to distinct optimization trajectories in the loss landscape +77 and its found minima [14; 23]. +78 Measures: There are several studies on the correlation between complexity- and norm-based mea +79 sures [24]. In particular, generalization improvements from flatness of the loss landscape has been +80 discussed both affirmatively and negatively [11; 46]. Nevertheless, sharpness or curvature based +81 methods have been utilized to improve generalization in practice [10; 12]. Numerous work have +82 included additional regularization into the training process. The angle between the momentum vector +83 and the local gradient has been utilized to construct a statistical test to determine convergence [28]. +84 The value and statistics of the loss have also been used for regularization during training, either by +85 relaxing the softmax loss [37] or by adapting the gradients in order to make constant progress on the +86 loss [43]. Lastly, Raghu et al. [41] proposed a method to measure the layer-wise complexity of a +87 network by computing the Singular Value Decomposition of the activations. This method is similar in +88 spirit to ours, but it measures the intrinsic dimensions in a stationary fashion, excluding the training +89 process in the measure itself. In contrast to competing measures, our measure is hyperparameter-free +90 and does not depend on the setting it is evaluated in. It avoids the complexity of rescaling due to +91 surrounding layers, which plague many continuous measures, by solely focusing on the discrete +92 activations of a ReLU network. +93 Hyperparameter Schedules: Hyperparameter choice has a strong effect on (generalization) perfor +94 mance and convergence speed. Economically, under fixed training budgets, this leads to a trade-off +95 [8; 49]. In cases of small batch sizes, one crucial invariant control parameter has been shown to be the +96 ratio of learning rate and batch size [15; 20]. SGD has been shown to have an implicit bias towards +97 flat regions theoretically that is reinforced by high learning rates [2; 46]. There is strong empirical +98 evidence that large initial learning rates can help with generalization in over-parameterized networks +99 [31; 32]. However, large networks require a “warm up” phase to prevent divergence of deeper layers +100 [14]. While most schedules let the learning rate approach zero with training time, especially the +101 course of the learning rate in the middle of the training process has not yet been analyzed extensively. +102 Our model suggest here an analogy to annealing schemes in discrete stochastic optimization and +103 provides a holistic perspective on the whole training process. LR scheduling is considered to be +104 directly linked to generalization performance [20; 22; 24; 29; 32]. For instance, a cyclic schedule +105 enables to train networks with a good “anytime performance” [34] and the implicit learning rate +106 schedules that are built into adaptive optimizers such as Adam [27] are topic of current research +107 [1; 36]. However, specific research in learning rate schedules is sparse. Although, correctly tuned, +108 1-cycle achieves the same accuracy using order-of-magnitude fewer training iterations [45], “large +109 models in NLP and vision use schedules which can be easily resumed” [30], such as “clipped” cosine +110 decay [7] or exponential decay [48]. Recently, research in automatic and adaptive hyperparameter +111 tuning has become more prominent. For instance, automatic tuning of decay time for the exponential +112 decay schedule, [28; 30], and meta-networks designed to predict the learning rate based on learned +113 typical training courses ([21], or more specifically, [9; 51]) have been tested. Another approach +114 includes the learning rate into the optimization process by deriving the loss w.r.t. the learning rate +115 as well [3]. Lastly, weight decay has been focus of discussion related generalization gap between +116 SGD and adaptive optimizers [35; 49]. Also, it has been shown to affect the learning rate scheduling +117 directly when used in conjunction with batch norm: every weight decay step increases the effective +118 learning rate by a multiplicative factor for a constant learning rate schedule [33; 52]. The most similar +119 of the named methods to ours from an optimization perspective is probably that of de Roos et al. +120 [10], where successive training steps are used to estimate change of curvature of the loss function to +121 adapt the learning rate automatically; however it requires additional hyperparameters and continuous +122 re-evaluations of the batch-loss. + +# 123 3 Activation Pattern Temperature (APT) + +124 We base our approach on the view that non-linearity is what makes deep networks actually expressive. +125 Throughout this paper, we restrict ourselves to the non-linear aspects of training and study (the +126 popular) ReLU activation function [38], which switches binarily between two linear states. Non +127 linearity of whole networks is thus encoded in the way the network is switching between those discrete +128 states in an orchestrated way. We call these binary patterns assigned to data “activation patterns”. +129 Our idea is very simple: We track the change of activation patterns, by comparing corresponding +130 outputs of ReLU layers for the same input data, and use the neg-log-likelihood of these changes to +131 quantify the “step-size” of the training progress. + +# 3.1 Formal Definition of APT + +Formally, we consider a feed-forward ReLU network $F _ { \theta } ^ { L }$ with parameters $\theta$ , that contains $L$ activation layers. Further, let $f ^ { l } ( x ) \in \mathbb { R } ^ { d _ { l } }$ denote the output of such a layer $l \in \{ 1 , . . . , L \}$ , for an input batch $\boldsymbol { x } \in \mathbb { R } ^ { B \times d _ { 0 } }$ of batch-size $B$ . + +136 We now define the activation pattern for (ReLU) layer $l$ as + +$$ +M _ { \theta } ^ { l } ( x ) : = \left( \mathrm { s i g n } \left( f ^ { l } ( x ) \right) \right) ( x ) \in \{ 0 , 1 \} ^ { d _ { l } } , +$$ + +137 which can be seen as a bit-vector of ReLU activated neurons. + +138 Training: Training is performed in discrete steps $t = 0 , 1 , 2 , \ldots$ At each step, an input batch $x$ +139 is considered and the optimizer computes new parameters $\theta _ { t }$ . $\theta _ { 0 }$ is determined by the network’s +140 initialization, and + +$$ +\theta _ { t + 1 } = \theta _ { t } + \lambda _ { t } \nabla _ { \theta _ { t } } L ( F _ { \theta _ { t } } ^ { L } , x _ { t } ) +$$ + +141 is the update by a single optimization step for batch $x$ under loss $L$ (which, we assume, is informed +142 of the ground-truth outputs $y ( x )$ ). +143 In this context, the incremental updates to $\theta _ { t }$ from randomly drawn batches $x _ { t }$ make the temporal +144 sequence $( \theta _ { 0 } , \theta _ { 1 } , \theta _ { 2 } , \ldots )$ a Markov chain; the same holds for the sequence of activation patterns +145 $M _ { \theta _ { t } } ^ { l } ( x )$ over time $t$ . Additionally, we model the effect of one optimization step on the activation +146 patters as a Markov chain, + +$$ +( X , Y ) \xrightarrow [ \theta _ { \varepsilon \theta _ { t } \theta _ { t } \iota _ { \nabla _ { \theta _ { t } } \sum _ { j } \varepsilon _ { 0 } r _ { i } \gamma _ { j } } ] } { \xrightarrow [ { \mathrm { N e t w o r k ~ E v a l u a t i o n } } ] { \mathrm { N e t w o r k ~ } } } ( M _ { \theta _ { t + 1 } } ^ { 1 } , \dots , M _ { \theta _ { t } } ^ { L } ) \xrightarrow [ ] { \mathrm { N e t w o r k ~ } } ( T _ { t } ^ { 1 } , \dots , T _ { t } ^ { L } ) +$$ + +147 where $X$ denotes the random variables that chooses examples from any distribution, $Y$ describes its +148 true underlying information that we are interested in, and $\mathbf { \dot { \nabla } } T _ { t } ^ { l }$ the change in activation patterns. Each +149 stochastic process, symbolized by an arrow, optionally adds uncorrelated noise to the mapping. +150 Definition: We now define the activation pattern temperature $( A P T )$ on layer $l$ as the self-information +151 of the event that an activation pattern has not changed, + +$$ +T _ { t } ^ { l } ( x ) : = - \log _ { 2 } \left( \mathrm { P r } \left( M _ { \theta _ { t + 1 } } ^ { l } ( x ) = M _ { \theta _ { t } } ^ { l } ( x ) \right) \right) , +$$ + +152 where $\mathrm { P r }$ denotes the probability distribution.1 This estimates the probability of an activation pattern +153 change over the batch $x$ . We also define the average activation pattern temperature $T _ { t }$ as the average +154 of $T _ { t } ^ { \tilde { l } }$ over all (ReLU) layers of the network. This measure is parameter-free and specifies the amount +155 of non-linear change in a network. Its lower bound is 0, stating that no non-linear change occurred +156 and only the linear parts of the network could have been changed during that step. The temperature +157 approaches infinity if all activations have changed during a single optimization step. +158 Computation: To measure $\boldsymbol { T _ { t } ^ { l } }$ , we run the forward-pass of a network twice, recording the activation +159 patterns in the first pass and comparing and accumulating changes in the second. In experiments, +160 we observe that evaluation on a single training batch already give good estimates. Thus, we use the +161 single-batch estimate of APT in the rest of the paper, unless stated otherwise. This allows the measure +162 to be calculated at the cost of only one single additional forward pass of the same batch that has been +163 already used for the previous optimization step. + +# 164 3.2 Training Methods & their Training Dynamics + +165 In this section, we utilize the activation pattern temperature (APT) (Equation (4)) to gain more insight +166 into the non-linear training dynamics affected by the choice of learning rate schedules. As a baseline +167 experiment, we compare the training of ResNet-32 (CIFAR-Variant, [19]) trained on CIFAR-10 +168 with step decay learning rate schedule. 2 We study the effect of three modifications to the ResNet +169 Architecture: ResNet with removed shortcut connections, FixUp [53] (no batch normalization) and +170 Pyramid-Net [17] (linear growing number of filters). In Figure 1, we show the learning rate (top row), +171 the corresponding activation temperature of the first layer $\mathsf { \bar { f } } ^ { 1 }$ (middle row), and the Top-1 validation +172 error (bottom row) for the baseline experiment. In the following, we analyze these plots regarding +173 their temperature profiles, training time and generalization performance. + +APT simplified learning rate description: During the training process, APT reflects changes of the LR (APT is reduced, whenever LR is reduced). APT starts strictly greater than zero, the actual value depends on the architecture as well as the training hyperparameters, and, during the training process, APT is reduced and approaches zero. Most importantly, 1-cycle schedule (blue curves), shows approximately a linear decrease of APT. + +Temperature cools down bottom-to-top: Defined as a per-layer temperature, we discuss the APT on a per-layer basis in the APPENDIX. We observe that deeper layers have a higher temperature (we call these hotter) in comparison to the first layers in a network (we call these cooler). Also, we + +![](images/be02063d82e8f03339d0fd9a40afa207f727fe8833c30e0c141be772005841ec.jpg) +Figure 1: Learning Rates, Validation Accuracy & Temperatures of the first ReLU-Layer in ResNet-32 (and its Variants) on CIFAR-10 for different LR schedules. + +182 observe that in each network the activation pattern temperatures decreases (or “cools down”) from +183 bottom to top, in accordance to recent work [41]. + +APT possibly relates to generalization: On the other hand, we observe that the validation error has similarities to the APT profile, despite having no direct relation between the AT and the loss. In this setting, APT is proportional to the validation error. Architectural adaptions also affect performance, negatively (as ResNet in the absence of shortcut connections), and positively (FixUp and PyramidNet) have that characteristics. + +APT is not explained by learning rate alone: The temperature can change (decrease) despite a constant learning rate. This can be observed, for example, in all experiments of fig. 1(b), especially in the beginning of training, but also with every drop of the learning rate. We conclude: for a fixed setting, the course of APT is not steered by the magnitude of learning rate alone, and APT contains hidden variables responsible for its course. + +This is in comply with previous work that studied the early phase of training in more detail [13]. We think that this view could shed some light on the initial phase of training and possibly explains the requirement of using a warm-up schedule in common training schemes beyond numerical instabilities. + +# 3.3 Learning Rate Range Analysis + +In the following chapter, we want to study the connection between LR and APT. We do so by reevaluating the exact same update step with a fixed range of learning rates. This allows us to observe the training from a global LR-invariant perspective. In more detail, we carry out this experiment for two different architectures on different data sets, using two different LR schedules. First we train a ResNet-56 on ImageNet, and second a ResNet-50 on CIFAR-10. Both networks are trained using step decay (90 rep. 200 epochs) and 1-cycle scheduler (20 resp. 50 epochs) each. For the initialization and every epoch in training, we freeze the network and re-evaluate the temperature for the exact same range of learning rates. The learning rates we use are uniformly sampled on a log scale, ranging from $1 0 ^ { - 4 }$ to $\bar { 1 } 0 ^ { 2 }$ . The results are shown in Figure 2: The top row shows the average activation pattern temperature $T _ { t }$ for each network and for each LR schedule. The white lines indicate the learning rate, which actually has been used for training.3 The theoretical temperature is shown in the background as color gradient from black (cold) to yellow (hot). We observe, that after a short initialization phase the temperature has a rather homogeneous behavior + +![](images/2064de668a20d955dc6af7d00314ec10e3501792a29ca8e7f71da882a7b990b1.jpg) +Figure 2: Learning Rate Range Analysis: For each point in training time of ResNet-50 on ImageNet (left two columns) and ResNet-56 on CIFAR-10 (right two columns) each with 1-cycle LR and step decay schedules, we measure the temperature for a theoretical scaling of the global LR (). + +211 over the whole training process. After few initial epochs, we observe only minor changes to the +212 temperature profile. Furthermore, the temperature profiles of ResNet-56 (ImageNet) show a phase in +213 which, from a global and LR-independent perspective, the networks cool down slowly, independently +214 of the choice of learning rate. Most notably, 1-cycle schedule uses LRs in a higher temperature +215 regime (near the vertex) for a longer period of time during training. In contrast, step decay passes +216 through into the colder temperature regime very quickly (ResNet-56/ImageNet) or already stats in it +217 (ResNet-50/CIFAR-10). + +# 3.4 Model of the Activation Pattern Temperature + +Typically, weight initialization is based on [18], which specifies the initial distribution of the weights in such a way that the output after the ReLU-activation is Gaussian distributed on all layers. As the activation itself zeros the output if the weighted sum of normal distributed variables is smaller than zero, we model the probability of a change in activation patterns itself as the cumulative distribution function of a normal distribution. Thus, we postulate the following closed form formula. + +Hypothesis 1. The probability of an activation pattern change depending on the used learning rate $\lambda$ for a single update step on any layer during training is given by + +$$ +\mathrm { P r } \left( M _ { \theta _ { t + \lambda \cdot \nabla L } } ^ { l } = M _ { \theta _ { t } } ^ { l } \right) = \frac { 1 } { 2 } \cdot \left( 1 + \mathrm { e r f } \left( \frac { \log \lambda - \mu } { \sigma \cdot \sqrt { 2 } } \right) \right) . +$$ + +226 The real numbers $\mu , \sigma \in \mathbb { R }$ depend on the training process, choice of architecture and layer. + +227 We show next that the model, given by Equation (5), actually fits in practice. In more detail, for a +228 fixed network state, we fit the model using non-linear least squares to the data shown in Figure 2. +229 We evaluate the fit by visualizing the the evaluated model together with its reconstruction error +230 against ground truth in the second and third row of Figure 2. The estimated parameters $\mu$ and $\sigma$ of +231 Equation (5) are shown in the bottom row of Figure 2. From our experience its values depends on the +232 layer the temperature has been measured in, the data set and architecture used and varies also with +233 the random seed of the initialization of weights. +234 Most importantly, we could observe favorably only small drifts of the parameter $\sigma$ that defines the +235 width of the Gaussian distribution used in the model. (But we also show an example of larger changes +236 in the APPENDIX). In contrast, the course of $\mu$ seems to be especially affected by the learning rate +237 used for training. We will use this observation and Equation (5) to define an automatic learning rate +238 schedule in Section 4. + +# 239 4 Activation Cooling based Learning Rate Scheduler + +# 4.1 Optimization using ActCooLR + +The goal of the scheduler is to determine learning rates that impose a specified temperature profile. This has to be done online, adapting the learning rate $\lambda$ to the current network state. As a design decision, we have the option to measure temperatures at every layer, and using adaptive learning rates, even to specify them layer-wise. For simplicity we leave fine-grained adaptation for future work and generally operate with a global learning rate (similar to 1-cycle) and use the mean temperature over all layers for control. + +247 In order to determine the learning rate, we simply rearrange Equation (5) from Section 3.4, which +248 describes the probability of a pattern change using only three parameters: $\sigma , \mu$ and $\lambda$ : + +$$ +\begin{array} { r l } & { \mu = \sigma \cdot \sqrt { 2 } \cdot \mathrm { e r f } ^ { - 1 } \left( 2 \cdot P _ { \lambda } - 1 \right) - \log \lambda , } \\ & { \lambda = \exp \left( \sigma \cdot \sqrt { 2 } \cdot \mathrm { e r f } ^ { - 1 } \left( 2 \cdot P _ { \lambda } - 1 \right) - \mu \right) , } \end{array} +$$ + +249 where $P _ { \lambda }$ denotes the probability given the used learning rate $\lambda$ . + +250 Thus, to derive the learning rate $\bar { \lambda }$ required to measure the target temperature $C$ , we first estimate $\mu$ +251 using the measured probability $P _ { \lambda }$ using the learning rate $\lambda$ Equation (6). Assuming that the value of +252 $\mu$ and $\sigma$ only changes slowly (see Section 3.3) we can use Equation (7) to estimate the learning rate +253 that would produce the given temperature $C$ . We call this learning rate adaption technique ActCooLR. +254 Too reduce computational costs, we limit measuring and readjustments to once every 10 optimization +255 steps. In between two measurements, we just interpolate linearly between the new and old learning +256 rate. The computational overhead is thus moderate, in particular as only a forward pass is needed. +257 Note, this requires to estimate $\sigma$ in the beginning of training. The value of $\mu$ can be estimated using +258 the formulas given above. We show in the APPENDIX a dynamic version of this technique, that +259 removes the requirement of estimating $\sigma$ and adapting the learning rate dynamically at the cost of +260 additional hyperparameters. A numerical problem arises from temperatures living on a logarithmic +261 scale (Section 3.4). Due to finite sampling, We might estimate a probability of 1 (all patterns have +262 changed) by chance. According to Equation (5) this would correspond to an infinite learning rate. +263 We remove the singularity by an ad-hoc regularizer: For empirical propabilities of 1, we assume that +264 “half an activation has changed”, but was not measured. + +# 4.2 Designing Target Temperature Curves (CIFAR-10) + +66 Until now we moved the problem of choosing the learning rate curve with a more abstract problem; +67 choosing the temperature curve. It is clear that we want to cool the mean temperature to a value +68 of zero, specifying explicitly that the network shall converge. This temperature is trivially given +69 by a learning rate of 0. We have seen that for sufficiently many data points it becomes increasingly +70 hard to let the network change all patterns with a single optimization step, in the limit this becomes +71 impossible. +272 Many previous work has analyzed the positive effects of large initial learning rates (see Section 2 +273 for a discussion). A large initial learning rate corresponds directly to a larger temperature. Thus, we +274 assume that we want to start training with a high temperature, i.e. a huge flow of information through +275 the network with every optimization step, and end with a very low temperature (mostly only linear +276 regression to be optimized). Empirically, we observed in the Section 3.2 that 1-cycle shows a linear +277 decrease in temperature. Thus, we test next if a linear decrease in temperature accelerates training +278 by actively controlling the temperature with ActCooLR. As a simple baseline experiment, to test +279 against, we use, again, a ResNet-32 on CIFAR-10 and train it using ActCooLR and momentum SGD +280 (see appendix the used Hyperparameters). To test our hypothesis, we define a family of temperature +281 curves of the form + +$$ +C _ { \gamma } ^ { \mathrm { l i n e a r } } ( i , i _ { \mathrm { t o t a l } } , T _ { \mathrm { s t a r t } } ) : = T _ { \mathrm { s t a r t } } \cdot ( 1 - ( i / i _ { \mathrm { t o t a l } } ) ^ { \gamma } ) , +$$ + +starting at $T _ { \mathrm { s t a r t } }$ and cooling down under a reduction factor $\gamma$ to 0. + +283 Figure 3 shows the effect of the selected target temperature curve $C _ { \underline { { { \gamma } } } } ^ { \mathrm { l i n e a r } }$ on the learning rate (Figure 3 +284 (middle row) and the validation error (Figure 3 (bottom row)). From our experience and also in +285 comply with the observations made in Section 3.2, training generally longer on higher temperatures +286 $( \gamma > 1 )$ ) achieves favorable performance compared to a faster reduction of temperature $( \gamma < 1 )$ ). In +287 case of a too big $\gamma$ , the amount of time optimization takes place in a linear way only becomes short at +288 the cost of a worse performance. +289 We test in the following the same setting for varying number of epochs to show the stability of our +290 method for various training budgets. For simplicity, we restrict the analysis to a linear temperature +291 decay $( \gamma = 1 )$ ). In Figure 3(b), we show the disadvantage of our schedule: the validation error remains +292 high for the most number of epochs during training, converging only very late compared to methods +293 like cyclic learning rate or step decay (see Section 3.2). For instance, in contrast to a cyclic learning +294 rate schedules, our method does not show a good anytime performance. On the one hand, cyclic +295 temperatures could also work, but need to be evaluated separately, thus leaving this as topic of future +296 research. We also show in the APPENDIX that our method is independent of the initial learning +297 rate as long as the first few optimization steps do not lead to a diverged network. We believe that +298 finding temperature curves with theoretical bounds is a promising direction for future work to better +299 understand the internal effects. For the rest of our work, we use a linear temperature cool down. + +![](images/1f41f5bf1638ea5678f90f1a62d5031f5c947c6ca57d51301f81e6dd0c352816.jpg) +Figure 3: Training ResNet-32 on CIFAR-10 using a linear target temperature curve and (a) using several values for $\gamma$ and (b) for varying number of epochs using a linear temperature curve each. We choose the same initial target temperature for all experiments to be 3.17 (i.e. a $8 9 \%$ chance that an activation has changed), all other hyperparameters, as well as seeds, are kept the same in each experiment set. Top row: measured mean temperature, Middle Row: resulting learning rates, bottom row corresponding top-1 validation error. + +# 4.3 Comparisons with other Methods + +301 Table 1 shows practical results on three different architectures (simple 4-layer CNN, VGG-16 and +302 ResNet-50) on three different data sets (Fashion-MNIST, CIFAR-10, ImageNet). We compare to +303 baselines and two automatic LR-schedulers (ABEL and AutoLRS). The experiments confirm that +304 we reach, similar to our observations for 1-cycle, comparable generalization performance within a +305 restricted training budget (Note though that ABEL uses 200 epochs, unlike the other methods). More +306 results are provided in the APPENDIX. + +# 07 5 Discussion + +The key hypothesis of this paper is that tracking the changes to the nonlinear behavior only can provide us with the information needed for step-size control. Our experiments support this view (for image classification with feed-forward ReLU CNNs, which is the class of techniques we restrict our analysis to at this point). Specifically, performing a simple linear decrease in activation pattern temperature already yields a LR-scheduler with performance comparable to 1-cycle, and distorting the temperature curve towards staying longer in the high-temperature regime at the beginning appears to improve generalization performance slightly (at least for the training time scales examined).The + +Table 1: Comparison with previous automatic LR-schedulers + +
SetupTest error
Data setNetworkEpochsMethodTop-1 Error
Fashion-MNIST4-layer :ConvNet [50]200constant LR6.95%
Fashion-MNIST4-layer ConvNet [50]200ActCooLR7.29 %
CIFAR-10VGG-16 [44]350 step decay6.30% [25]
CIFAR-10VGG-16 [44]350AutoLRS5.87%[25]
CIFAR-10VGG-16 [44]200ABEL7.1% [30]
CIFAR-10VGG-16 [44]350ActCooLR6.82 %
ImageNetResNet-50[]201-cycle27.27%
ImageNetResNet-50 [20ActCooLR27.88%
+ +Table 2: Test errors for Fig. 3. + +
EpochsTest Error (Top-1)
1037.88%
3018.33%
5011.87%
7010.59%
909.09%
1108.09%
1307.50%
1507.28%
1707.18%
7.15%
190 2106.41%
+ +315 simple Gaussian two-parameter model of Eq. 5 is approximates the temperature well empirically and +316 leads to a simpler and more efficient automatic LR-scheduling algorithm than a direct optimization of +317 the learning rate. The most important result is probably on the conceptual side: We observe that the +318 rather complex LR-curve of a cyclic (or 1-cycle) scheduler appears to just correspond to an annealing +319 of the APT. This is reminiscent of simulated annealing methods which use a very similar strategy in +320 order to solve combinatorial optimization problems. The logarithmic temperature measure has an +321 analogous form to the temperature in the Boltzmann-distribution of a Markov-Chain-Monte-Carlo +322 (MCMC) optimizer used there. In this sense, our paper reveals that a good LR-scheduler for SGD just +323 performs on the discrete, nonlinear network components a process very similar to simulated annealing. +324 More concretely, we would like to point to the results in Fig. 2 which show a smooth transition +325 between a linear training regime, with low probability of nonlinear changes and a high-temperature, +326 presumably chaotic, regime at the high LRs. By controlling the APT, we can steer training within +327 the band of non-linear, but not chaotic learning automatically, and only dive into the purely linear +328 regime at the end, thereby plausibly obtaining a quicker convergence. The drop in temperature at +329 early training steps is handled automatically, and provides a plausible explanation the utility of initial +330 LW-ramp-up in 1-cycle. It is also interesting that the phase boundary drifts only slowly after this, +331 with constant width, but depends more strongly on the LR-schedule (and data set) used. + +Limitations and future work: Our consequential findings are empirical; we do not have an analytical derivation of why the training process has the observed properties, or why the proposed temperature curves reach high performance levels. Our empirical observations are consistent over several data sets and rather different CNN architectures. Nonetheless, a broader study on a large corpus of models and architectures, as well as examining applications beyond image recognition and feed-forward CNNs, is an important next step for future work. Further, a predictive theoretical model of the statistical dynamics of activation patterns under parameter trajectories and exploring a closer connection of SGD and MCMC optimization would be interesting avenues for future work. + +# 340 Broader Impact + +341 From an application perspective, our paper aims at improvements in learning time scheduling, such +342 that fast-training schedulers similar to 1-cycle can be used with little or no tuning of hyperparameters. +343 To the extend of this being successful, we believe that this has a significant positive impact in +344 saving time and (electrical) energy in the development and deployment of deep networks (aside +345 from potential rebound effects applying to any improvement in efficiency). We advise the reader +346 though to use caution in that our key findings are empirical in nature and there is no proof of absence +347 of negative effects in terms of costs, and/or a random or systematic loss of accuracy (the same +348 applies to related methods, too). The paper should be received as a step forward towards a more +349 efficient automatic training schedules, not as a proven solution ready for wide deployment. We would +350 correspondingly emphasize the impact of the conceptual view of tracking nonlinear optimization and +351 the newly introduced techniques for implementing this over the practical aspects. +352 References +353 [1] N. Agarwal, R. Anil, E. Hazan, T. Koren, and C. Zhang. Disentangling adaptive gradient methods from +354 learning rates. CoRR, abs/2002.11803, 2020. URL https://arxiv.org/abs/2002.11803. +355 [2] D. G. T. Barrett and B. Dherin. Implicit gradient regularization. CoRR, abs/2009.11162, 2020. URL +356 https://arxiv.org/abs/2009.11162. +357 [3] A. G. Baydin, R. Cornish, D. Martínez-Rubio, M. Schmidt, and F. Wood. Online learning rate adaptation +358 with hypergradient descent. In 6th International Conference on Learning Representations, ICLR 2018, +359 Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018. +360 URL https://openreview.net/forum?id=BkrsAzWAb. +361 [4] Y. Bengio. Practical recommendations for gradient-based training of deep architectures. In G. Montavon, +362 G. B. Orr, and K. Müller, editors, Neural Networks: Tricks of the Trade - Second Edition, volume 7700 of +363 Lecture Notes in Computer Science, pages 437–478. Springer, 2012. doi: 10.1007/978-3-642-35289-8\_26. +364 URL https://doi.org/10.1007/978-3-642-35289-8_26. +365 [5] Y. Bengio, J. Louradour, R. Collobert, and J. Weston. Curriculum learning. In A. P. Danyluk, L. Bottou, +366 and M. L. Littman, editors, Proceedings of the 26th Annual International Conference on Machine Learning, +367 ICML 2009, Montreal, Quebec, Canada, June 14-18, 2009, volume 382 of ACM International Conference +368 Proceeding Series, pages 41–48. ACM, 2009. doi: 10.1145/1553374.1553380. URL https://doi.org/ +369 10.1145/1553374.1553380. +370 [6] L. Bottou. Online learning and stochastic approximations. On-line learning in neural networks, 17(9):142, +371 1998. +372 [7] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, +373 A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, +374 J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, +375 S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In +376 H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, editors, Advances in Neural Information +377 Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS +378 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips.cc/paper/2020/ +379 hash/1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html. +380 [8] D. Choi, C. J. Shallue, Z. Nado, J. Lee, C. J. Maddison, and G. E. Dahl. On empirical comparisons +381 of optimizers for deep learning. CoRR, abs/1910.05446, 2019. URL http://arxiv.org/abs/1910. +382 05446. +383 [9] C. Daniel, J. Taylor, and S. Nowozin. Learning step size controllers for robust neural network training. In +384 D. Schuurmans and M. P. Wellman, editors, Proceedings of the Thirtieth AAAI Conference on Artificial +385 Intelligence, February 12-17, 2016, Phoenix, Arizona, USA, pages 1519–1525. AAAI Press, 2016. URL +386 http://www.aaai.org/ocs/index.php/AAAI/AAAI16/paper/view/11763. +387 [10] F. de Roos, C. Jidling, A. Wills, T. B. Schön, and P. Hennig. A probabilistically motivated learning rate +388 adaptation for stochastic optimization. CoRR, abs/2102.10880, 2021. URL https://arxiv.org/abs/ +389 2102.10880. +390 [11] L. Dinh, R. Pascanu, S. Bengio, and Y. Bengio. Sharp minima can generalize for deep nets. In D. Precup +391 and Y. W. Teh, editors, Proceedings of the 34th International Conference on Machine Learning, ICML +392 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, +393 pages 1019–1028. PMLR, 2017. URL http://proceedings.mlr.press/v70/dinh17b.html. +394 [12] P. Foret, A. Kleiner, H. Mobahi, and B. Neyshabur. Sharpness-aware minimization for efficiently improving +395 generalization. CoRR, abs/2010.01412, 2020. URL https://arxiv.org/abs/2010.01412. +396 [13] J. Frankle, D. J. Schwab, and A. S. Morcos. The early phase of neural network training. In 8th Interna +397 tional Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. +398 OpenReview.net, 2020. URL https://openreview.net/forum?id=Hkl1iRNFwS. +399 [14] A. Gotmare, N. S. Keskar, C. Xiong, and R. Socher. A closer look at deep learning heuristics: Learning +400 rate restarts, warmup and distillation. In 7th International Conference on Learning Representations, ICLR +401 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019. URL https://openreview.net/ +402 forum?id=r14EOsCqKX. +403 [15] P. Goyal, P. Dollár, R. B. Girshick, P. Noordhuis, L. Wesolowski, A. Kyrola, A. Tulloch, Y. Jia, and +404 K. He. Accurate, large minibatch SGD: training imagenet in 1 hour. CoRR, abs/1706.02677, 2017. URL +405 http://arxiv.org/abs/1706.02677. +406 [16] G. Gur-Ari, D. A. Roberts, and E. Dyer. Gradient descent happens in a tiny subspace. CoRR, +407 abs/1812.04754, 2018. URL http://arxiv.org/abs/1812.04754. +408 [17] D. Han, J. Kim, and J. Kim. Deep pyramidal residual networks. In 2017 IEEE Conference on Computer +409 Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pages 6307–6315. +410 IEEE Computer Society, 2017. doi: 10.1109/CVPR.2017.668. URL https://doi.org/10.1109/CVPR. +411 2017.668. +412 [18] K. He, X. Zhang, S. Ren, and J. Sun. Delving deep into rectifiers: Surpassing human-level performance on +413 imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages +414 1026–1034, 2015. +415 [19] K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In B. Leibe, +416 J. Matas, N. Sebe, and M. Welling, editors, Computer Vision - ECCV 2016 - 14th European Conference, +417 Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part IV, volume 9908 of Lecture Notes +418 in Computer Science, pages 630–645. Springer, 2016. doi: 10.1007/978-3-319-46493-0\_38. URL +419 https://doi.org/10.1007/978-3-319-46493-0_38. +420 [20] E. Hoffer, I. Hubara, and D. Soudry. Train longer, generalize better: closing the generalization gap in large +421 batch training of neural networks. In I. Guyon, U. von Luxburg, S. Bengio, H. M. Wallach, R. Fergus, +422 S. V. N. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30: +423 Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, +424 CA, USA, pages 1731–1741, 2017. URL https://proceedings.neurips.cc/paper/2017/hash/ +425 a5e0ff62be0b08456fc7f1e88812af3d-Abstract.html. +426 [21] T. M. Hospedales, A. Antoniou, P. Micaelli, and A. J. Storkey. Meta-learning in neural networks: A survey. +427 CoRR, abs/2004.05439, 2020. URL https://arxiv.org/abs/2004.05439. +428 [22] S. Jastrzebski, Z. Kenton, D. Arpit, N. Ballas, A. Fischer, Y. Bengio, and A. J. Storkey. Three factors +429 influencing minima in SGD. CoRR, abs/1711.04623, 2017. URL http://arxiv.org/abs/1711.04623. +430 [23] S. Jastrzebski, M. Szymczak, S. Fort, D. Arpit, J. Tabor, K. Cho, and K. Geras. The break-even point +431 on optimization trajectories of deep neural networks. In 8th International Conference on Learning +432 Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL +433 https://openreview.net/forum?id=r1g87C4KwB. +434 [24] Y. Jiang, B. Neyshabur, H. Mobahi, D. Krishnan, and S. Bengio. Fantastic generalization measures and +435 where to find them. In 8th International Conference on Learning Representations, ICLR 2020, Addis +436 Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum? +437 id=SJgIPJBFvH. +438 [25] Y. Jin, T. Zhou, L. Zhao, Y. Zhu, C. Guo, M. Canini, and A. Krishnamurthy. Auto{lrs}: Automatic +439 learning-rate schedule by bayesian optimization on the fly. In International Conference on Learning +440 Representations, 2021. URL https://openreview.net/forum?id=SlrqM9_lyju. +441 [26] D. Kalimeris, G. Kaplun, P. Nakkiran, B. L. Edelman, T. Yang, B. Barak, and H. Zhang. SGD on neural +442 networks learns functions of increasing complexity. In H. M. Wallach, H. Larochelle, A. Beygelzimer, +443 F. d’Alché-Buc, E. B. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32: +444 Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, +445 Vancouver, BC, Canada, pages 3491–3501, 2019. URL https://proceedings.neurips.cc/paper/ +446 2019/hash/b432f34c5a997c8e7c806a895ecc5e25-Abstract.html. +447 [27] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In Y. Bengio and Y. LeCun, editors, +448 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, +449 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/abs/1412.6980. +450 [28] H. Lang, L. Xiao, and P. Zhang. Using statistics to automate stochastic optimization. In +451 H. M. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché-Buc, E. B. Fox, and R. Garnett, +452 editors, Advances in Neural Information Processing Systems 32: Annual Conference on Neu +453 ral Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, +454 Canada, pages 9536–9546, 2019. URL https://proceedings.neurips.cc/paper/2019/hash/ +455 e1054bf2d703bca1e8fe101d3ac5efcd-Abstract.html. +456 [29] G. Leclerc and A. Madry. The two regimes of deep network training. CoRR, abs/2002.10376, 2020. URL +457 https://arxiv.org/abs/2002.10376. +458 [30] A. Lewkowycz. How to decay your learning rate. CoRR, abs/2103.12682, 2021. URL https://arxiv. +459 org/abs/2103.12682. +460 [31] A. Lewkowycz, Y. Bahri, E. Dyer, J. Sohl-Dickstein, and G. Gur-Ari. The large learning rate phase of deep +461 learning: the catapult mechanism. CoRR, abs/2003.02218, 2020. URL https://arxiv.org/abs/2003. +462 02218. +463 [32] Y. Li, C. Wei, and T. Ma. Towards explaining the regularization effect of initial large learning rate in +464 training neural networks. In H. M. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché-Buc, E. B. Fox, +465 and R. Garnett, editors, Advances in Neural Information Processing Systems 32: Annual Conference +466 on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, +467 Canada, pages 11669–11680, 2019. URL https://proceedings.neurips.cc/paper/2019/hash/ +468 bce9abf229ffd7e570818476ee5d7dde-Abstract.html. +469 [33] Z. Li and S. Arora. An exponential learning rate schedule for deep learning. In 8th International Conference +470 on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, +471 2020. URL https://openreview.net/forum?id=rJg8TeSFDH. +472 [34] I. Loshchilov and F. Hutter. SGDR: stochastic gradient descent with warm restarts. In 5th International +473 Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference +474 Track Proceedings. OpenReview.net, 2017. URL https://openreview.net/forum?id=Skq89Scxx. +475 [35] I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In 7th International Conference on +476 Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019. +477 URL https://openreview.net/forum?id=Bkg6RiCqY7. +478 [36] J. Ma and D. Yarats. On the adequacy of untuned warmup for adaptive optimization. CoRR, abs/1910.04209, +479 2019. URL http://arxiv.org/abs/1910.04209. +480 [37] R. Müller, S. Kornblith, and G. E. Hinton. When does label smoothing help? In H. M. +481 Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché-Buc, E. B. Fox, and R. Garnett, edi +482 tors, Advances in Neural Information Processing Systems 32: Annual Conference on Neural +483 Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, +484 Canada, pages 4696–4705, 2019. URL https://proceedings.neurips.cc/paper/2019/hash/ +485 f1748d6b0fd9d439f71450117eba2725-Abstract.html. +486 [38] V. Nair and G. E. Hinton. 3d object recognition with deep belief nets. In Y. Bengio, D. Schuur +487 mans, J. D. Lafferty, C. K. I. Williams, and A. Culotta, editors, Advances in Neural Information Pro +488 cessing Systems 22: 23rd Annual Conference on Neural Information Processing Systems 2009. Pro +489 ceedings of a meeting held 7-10 December 2009, Vancouver, British Columbia, Canada, pages 1339– +490 1347. Curran Associates, Inc., 2009. URL https://proceedings.neurips.cc/paper/2009/hash/ +491 6e7b33fdea3adc80ebd648fffb665bb8-Abstract.html. +492 [39] P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak, and I. Sutskever. Deep double descent: Where +493 bigger models and more data hurt. In 8th International Conference on Learning Representations, ICLR +494 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview. +495 net/forum?id=B1g5sA4twr. +496 [40] A. Neelakantan, L. Vilnis, Q. V. Le, I. Sutskever, L. Kaiser, K. Kurach, and J. Martens. Adding gradient +497 noise improves learning for very deep networks. CoRR, abs/1511.06807, 2015. URL http://arxiv. +498 org/abs/1511.06807. +499 [41] M. Raghu, J. Gilmer, J. Yosinski, and J. Sohl-Dickstein. SVCCA: singular vector canonical correlation +500 analysis for deep learning dynamics and interpretability. In I. Guyon, U. von Luxburg, S. Bengio, H. M. +501 Wallach, R. Fergus, S. V. N. Vishwanathan, and R. Garnett, editors, Advances in Neural Information +502 Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December +503 4-9, 2017, Long Beach, CA, USA, pages 6076–6085, 2017. URL https://proceedings.neurips.cc/ +504 paper/2017/hash/dc6a7e655d7e5840e66733e9ee67cc69-Abstract.html. +505 [42] N. Rahaman, A. Baratin, D. Arpit, F. Draxler, M. Lin, F. A. Hamprecht, Y. Bengio, and A. C. Courville. +506 On the spectral bias of neural networks. In K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the +507 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, +508 USA, volume 97 of Proceedings of Machine Learning Research, pages 5301–5310. PMLR, 2019. URL +509 http://proceedings.mlr.press/v97/rahaman19a.html. +510 [43] M. Rolinek and G. Martius. L4: practical loss-based stepsize adaptation for deep learn +511 ing. In S. Bengio, H. M. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Gar +512 nett, editors, Advances in Neural Information Processing Systems 31: Annual Conference on +513 Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montréal, +514 Canada, pages 6434–6444, 2018. URL https://proceedings.neurips.cc/paper/2018/hash/ +515 98b17f068d5d9b7668e19fb8ae470841-Abstract.html. +516 [44] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In +517 Y. Bengio and Y. LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015, +518 San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/ +519 abs/1409.1556. +520 [45] L. N. Smith and N. Topin. Super-convergence: Very fast training of residual networks using large learning +521 rates. CoRR, abs/1708.07120, 2017. URL http://arxiv.org/abs/1708.07120. +522 [46] S. L. Smith, B. Dherin, D. G. T. Barrett, and S. De. On the origin of implicit regularization in stochastic +523 gradient descent. CoRR, abs/2101.12176, 2021. URL https://arxiv.org/abs/2101.12176. +524 [47] N. Srivastava, G. E. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: a simple +525 way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15(1):1929–1958, 2014. URL +526 http://dl.acm.org/citation.cfm?id $\equiv ^ { \prime }$ 2670313. +527 [48] M. Tan and Q. V. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In +528 K. Chaudhuri and R. Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine +529 Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of +530 Machine Learning Research, pages 6105–6114. PMLR, 2019. URL http://proceedings.mlr.press/ +531 v97/tan19a.html. +532 [49] A. C. Wilson, R. Roelofs, M. Stern, N. Srebro, and B. Recht. The marginal value of adaptive gradient +533 methods in machine learning. In I. Guyon, U. von Luxburg, S. Bengio, H. M. Wallach, R. Fergus, +534 S. V. N. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30: +535 Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, +536 CA, USA, pages 4148–4158, 2017. URL https://proceedings.neurips.cc/paper/2017/hash/ +537 81b3833e2504647f9d794f7d7b9bf341-Abstract.html. +538 [50] H. Xiao, K. Rasul, and R. Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine +539 learning algorithms. CoRR, abs/1708.07747, 2017. URL http://arxiv.org/abs/1708.07747. +540 [51] Z. Xu, A. M. Dai, J. Kemp, and L. Metz. Learning an adaptive learning rate schedule. CoRR, +541 abs/1909.09712, 2019. URL http://arxiv.org/abs/1909.09712. +542 [52] G. Zhang, C. Wang, B. Xu, and R. B. Grosse. Three mechanisms of weight decay regularization. In 7th +543 International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. +544 OpenReview.net, 2019. URL https://openreview.net/forum?id=B1lz-3Rct7. +545 [53] H. Zhang, Y. N. Dauphin, and T. Ma. Fixup initialization: Residual learning without normalization. In +546 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, +547 2019. OpenReview.net, 2019. URL https://openreview.net/forum?id=H1gsz30cKX. +548 [54] Z. Zhu, J. Wu, B. Yu, L. Wu, and J. Ma. The anisotropic noise in stochastic gradient descent: Its behavior +549 of escaping from sharp minima and regularization effects. In K. Chaudhuri and R. Salakhutdinov, editors, +550 Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, +551 Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pages 7654–7663. +552 PMLR, 2019. URL http://proceedings.mlr.press/v97/zhu19e.html. + +# 553 Checklist + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] This is discussed in Section 5. +(c) Did you discuss any potential negative societal impacts of your work? [Yes] This is discussed in Section 5 +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] The assumptions are stated with the results. +(b) Did you include complete proofs of all theoretical results? [Yes] Complete proofs can be found in the APPENDIX + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] A reference implementation is provided under a free license. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Training details are specified with the experiments. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Errors bars are reported for our own experiments, where applicable. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We specify the used compute in the APPENDIX. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] +(b) Did you mention the license of the assets? [No] We only use freely available data sets. +(c) Did you include any new assets either in the supplemental material or as a URL? [No] No new assets / data sets were used. +(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] No additional data was used. +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] For the data sets we use, this is already discussed in the community. + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] Not applicable. +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] Not applicable. +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] Not applicable. \ No newline at end of file diff --git a/md/train/zGsRcuoR5-0/zGsRcuoR5-0.md b/md/train/zGsRcuoR5-0/zGsRcuoR5-0.md new file mode 100644 index 0000000000000000000000000000000000000000..6e8a631e0500893fcb4e071d4ea45e1919191196 --- /dev/null +++ b/md/train/zGsRcuoR5-0/zGsRcuoR5-0.md @@ -0,0 +1,432 @@ +# Sample Selection with Uncertainty of Losses for Learning with Noisy Labels + +Anonymous Author(s) +Affiliation +Address +email + +# Abstract + +1 In learning with noisy labels, the sample selection approach is very popular, which +2 regards small-loss data as correctly labeled during training. However, losses are +3 generated on-the-fly based on the model being trained with noisy labels, and thus +4 large-loss data are likely but not certainly to be incorrect. There are actually +5 two possibilities of a large-loss data point: (a) it is mislabeled, and then its loss +6 decreases slower than other data, since deep neural networks “learn patterns first”; +7 (b) it belongs to an underrepresented group of data and has not been selected yet. In +8 this paper, we incorporate the uncertainty of losses by adopting interval estimation +9 instead of point estimation of losses, where lower bounds of the confidence intervals +10 of losses derived from distribution-free concentration inequalities, but not losses +11 themselves, are used for sample selection. In this way, we also give large-loss but +12 less selected data a try; then, we can better distinguish between the cases (a) and +13 (b) by seeing if the losses effectively decrease with the uncertainty after the try. As +14 a result, we can better explore underrepresented data that are correctly labeled but +15 seem to be mislabeled at first glance. Experiments demonstrate that the proposed +16 method is superior to baselines and robust to a broad range of label noise types. + +# 17 1 Introduction + +18 Learning with noisy labels is one of the most challenging problems in weakly-supervised learning, +19 since noisy labels are ubiquitous in the real world [36, 65, 40, 1, 61]. For instance, both crowdsourcing +20 and web crawling yield large numbers of noisy labels everyday [12]. Noisy labels can severely impair +21 the performance of deep neural networks with strong memorization capacities [67, 69, 42, 30]. +22 To reduce the influence of noisy labels, a lot of approaches have been recently proposed [38, 29, 31, +23 68, 71, 55, 56, 46, 33, 25, 34, 47, 60, 49, 19, 17, 14]. They can be generally divided into two main +24 categories. The first one is to estimate the noise transition matrix [41, 44, 15, 11], which denotes the +25 probabilities that clean labels flip into noisy labels. However, the noise transition matrix is hard to be +26 estimated accurately, especially when the number of classes is large [65]. The second approach is +27 sample selection, which is our focus in this paper. This approach is based on selecting possibly clean +28 examples from a mini-batch for training [12, 62, 50, 65, 23, 50, 51]. Intuitively, if we can exploit less +29 noisy data for network parameter updates, the network will be more robust. +30 A major question in sample selection is what criteria can be used to select possibly clean examples. +31 At the present stage, the selection based on the small-loss criteria is the most common method, and +32 has been verified to be effective in many circumstances [12, 16, 65, 52, 62]. Specifically, since +33 deep networks learn patterns first [2], they would first memorize training data of clean labels and +34 then those of noisy labels with the assumption that clean labels are of the majority in a noisy class. +35 Small-loss examples can thus be regarded as clean examples with high probability. Therefore, in +36 each iteration, prior methods [12, 52] select the small-loss examples based on the predictions of the +37 current network for robust training. +38 However, such a selection procedure is debatable, since it arguably does not consider uncertainty +39 in selection. The uncertainty comes from two aspects. First, this procedure has uncertainty about +40 small-loss examples. Specifically, the procedure uses limited time intervals and only exploits the +41 losses provided by the current predictions. For this reason, the estimation for the noisy class posterior +42 is unstable [63], which causes the network predictions to be equally unstable. It thus takes huge risks +43 to only use losses provided by the current predictions (Figure 1, left). Once wrong selection is made, +44 the inferiority of accumulated errors will arise [65]. Second, this procedure has uncertainty about +45 large-loss examples. To be specific, deep networks learn easy examples at the beginning of training, +46 but ignore some clean examples with large losses. Nevertheless, such examples are always critical for +47 generalization. For instance, when learning with imbalanced data, distinguishing the examples with +48 non-dominant labels are more pivotal during training [35]. Deep networks often give large losses to +49 such examples (Figure 1, right). Therefore, when learning under the realistic scenes, e.g., learning +50 with noisy imbalanced data, prior sample selection methods cannot address such an issue well. +51 To relieve the above issues, we study the uncertainty of losses in the sample selection procedure to +52 combat noisy labels. To reduce the uncertainty of small-loss examples, we extend time intervals and +53 utilize the mean of training losses at different training iterations. In consideration of the bad influence +54 of mislabeled data on training losses, we build two robust mean estimators from the perspectives of +55 soft truncation and hard truncation w.r.t. the truncation level, respectively. Soft truncation makes the +56 mean estimation more robust by holistically changing the behavior of losses. Hard truncation makes +57 the mean estimation more robust by locally removing outliers from losses. To reduce the uncertainty +58 of large-loss examples, we encourage networks to pick the sample that has not been selected in a +59 conservative way. Furthermore, to address the two issues simultaneously, we derive concentration +60 inequalities [5] for robust mean estimation and further employ statistical confidence bounds [3] to +61 consider the number of times an example was selected during training. +62 The study of uncertainty of losses in learning with noisy labels can be justified as follows. In statistical +63 learning, it is known that uncertainty is related to the quality of data [48]. Philosophically, we need +64 variety decrease for selected data and variety search for unselected data, which share a common +65 objective, i.e., reduce the uncertainty of data to improve generalization [37]. This is our original +66 intention, since noisy labels could bring more uncertainty because of the low quality of noisy data. +67 Nevertheless, due to the harm of noisy labels for generalization, we need to strike a good balance +68 between variety decrease and search. Technically, our method is specially designed for handling +69 noisy labels, which robustly uses network predictions and conservatively seeks less selected examples +70 meanwhile to reduce the uncertainty of losses and then generalize well. +71 Before delving into details, we clearly emphasize our contributions in two folds. First, we reveal prior +72 sample selection criteria in learning with noisy labels have some potential weaknesses and discuss +73 them in detail. The new selection criteria are then proposed with detailed theoretical analyses. Second, +74 we experimentally validate the proposed method on both synthetic noisy balanced/imbalanced datasets +75 and real-world noisy datasets, on which it achieves superior robustness compared with the state +76 of-the-art methods in learning with noisy labels. The rest of the paper is organized as follows. In +77 Section 2, we propose our robust learning paradigm step by step. Experimental results are discussed +78 in Section 3. The conclusion is given in Section 4. +80 In this section, we first introduce the problem setting and some background (Section 2.1). Then we +81 discuss how to exploit training losses at different iterations (Section 2.2). Finally, we introduce the +82 proposed method, which exploits training losses at different iterations more robustly and encourages +83 networks to pick the sample that is less selected but could be correctly labeled (Section 2.3). + +![](images/6fa2f40d55f35e96d285db061a4328bb3951bb24a7112e73fcd38ba7e9bfc641.jpg) +Figure 1: Illustrations of uncertainty of losses. Experiments are conducted on the imbalanced noisy MNIST dataset. Left: uncertainty of small-loss examples. At the beginning of training (Epochs 1 and 2), due to the instability of the current prediction, the network gives a larger loss to the clean example and does not select it for updates. If we consider the mean of training losses at different epochs, the clean example can be equipped with a smaller loss and then selected for updates. Right: uncertainty of large-loss examples. Since the deep network learns easy examples at the beginning of training, it gives a large loss to clean imbalanced data with non-dominant labels, which causes such data unable to be selected and severely influence generalization. + +# 84 2.1 Preliminaries + +85 Let $\mathcal { X }$ and $\mathcal { V }$ be the input and output spaces. Consider a $k$ -class classification problem, i.e., $\mathcal { V } = [ k ]$ , +86 where $[ k ] = \{ 1 , \dots , k \}$ . In learning with noisy labels, the training data are all sampled from a +87 corrupted distribution on $\mathcal { X } \times \mathcal { V }$ . We are given a sample with noisy labels, i.e., $\tilde { S } = \{ ( \mathbf { x } , \tilde { y } ) \}$ , where +88 $\tilde { y }$ is the noisy label. The aim is to learn a robust classifier that could assign clean labels to test data by +89 only exploiting a training sample with noisy labels. +90 Let $f : \mathcal { X } \to \mathbb { R } ^ { k }$ be the classifier with learnable parameters w. At the $i$ -th iteration during training, +91 the parameters of the classifier $f$ can be denoted as $\mathbf { w } _ { i }$ . Let $\ell : \mathbb { R } ^ { k } \times \mathcal { Y } \mathbb { R }$ be a surrogate loss +92 function for $k$ -class classification. We exploit the softmax cross entropy loss in this paper. Given an +93 arbitrary training example $( \mathbf { x } , \tilde { y } )$ , at the $i$ -th iteration, we can obtain a loss $\ell _ { i }$ , i.e., $\ell _ { i } = \ell ( f ( \mathbf { w } _ { i } ; \mathbf { x } ) , \tilde { y } )$ +94 Hence, until the $t$ -th iteration, we can obtain a training loss set $L _ { t }$ about the example $( \mathbf { x } , \tilde { y } )$ , i.e., +95 $L _ { t } = \{ \ell _ { 1 } , \ldots , \ell _ { t } \}$ . +96 In this paper, we assume that the training losses in $L _ { t }$ conform to a Markov process, which is to +97 represent a changing system under the assumption that future states only depend on the current state +98 (the Markov property) [43]. More specifically, at the $i$ -th iteration, if we exploit an optimization +99 algorithm for parameter updates (e.g., the stochastic gradient descent algorithm [4]) and omit other +100 dependencies (e.g., $\tilde { S }$ ), we will have $P ( \mathbf { w } _ { i } | \mathbf { w } _ { i - 1 } , \ldots , \mathbf { w } _ { 0 } ) = P ( \mathbf { w } _ { i } | \mathbf { w } _ { i - 1 } )$ , which means that the +101 future state of the classifier $f$ only depends on the current state. Furthermore, given a training example +102 and the parameters of the classifier $f$ , we can determine the loss of the training example as discussed. +103 Therefore, the training losses in $L _ { t }$ will also conform to a Markov process. + +# 2.2 Extended Time Intervals + +105 As limited time interval cannot address the instability issue of the estimation for the noisy class +106 posterior well [42], we extend time intervals and exploit the training losses at different training +107 iterations for sample selection. One straightforward idea is to use the mean of training losses at +108 different training iterations. Hence, the selection criterion could be + +$$ +\tilde { \mu } = \frac { 1 } { t } \sum _ { i = 1 } ^ { t } \ell _ { i } . +$$ + +109 It is intuitive and reasonable to use such a selection criterion for sample selection, since the operation +110 of averaging can mitigate the risks caused by the unstable estimation for the noisy class posterior, +111 following better generalization. Nevertheless, such a method could arguably achieve suboptimal +112 classification performance for learning with noisy labels. The main reason is that, due to the great +113 harm of mislabeled data, part of training losses are with too large uncertainty and could be seen as +114 outliers. Therefore, it could be biased to use the mean of training losses consisting of such outliers +115 [10], which further influences sample selection. More evaluations for our claims are provided in +116 Section 3. + +# 117 2.3 Robust Mean Estimation and Conservative Search + +118 We extend time intervals and meanwhile exploit the training losses at different training iterations more +119 robustly. Specifically, we build two robust mean estimators from the perspectives of soft truncation +120 and hard truncation [7]. Note that for specific tasks, it is feasible to decide the types of robust mean +121 estimation with statistical tests based on some assumptions [8]. We leave the analysis as future work. +122 Two distribution-free robust mean estimators are introduced as follows. +123 Soft truncation. We extend a classical M-estimator from [7] and exploit the widest possible choice of +124 the influence function. More specifically, give a random variable $X$ , let us consider a non-decreasing + +125 influence function $\psi : \mathbb { R } \to \mathbb { R }$ such that + +$$ +\psi ( X ) = \log ( 1 + X + X ^ { 2 } / 2 ) , X \geq 0 . +$$ + +126 The choice of $\psi$ is inspired by the Taylor expansion of the exponential function, which can make the +127 estimation results more robust by reducing the side effect of extremum holistically. The illustration +128 for this influence function is provided in Appendix A.1. For our task, given the observations on +129 training losses, i.e., $L _ { t } = \{ \ell _ { 1 } , \ldots , \ell _ { t } \}$ , we estimate the mean robustly as follows: + +$$ +\tilde { \mu } _ { s } = \frac { 1 } { t } \sum _ { i = 1 } ^ { t } \psi ( \ell _ { i } ) . +$$ + +130 We term the above robust mean estimator (3) the soft estimator. + +131 Hard truncation. We propose a new robust mean estimator based on hard truncation. Specifically, +132 given the observations on training losses $L _ { t }$ , we first exploit the $\mathbf { K }$ -nearest neighbor (KNN) algorithm +133 [27] to remove some underlying outliers in $L _ { t }$ . The number of outliers is denoted by $t _ { \mathrm { o } } ( t _ { \mathrm { o } } < t )$ , which +134 can be adaptively determined as discussed in [70]. Note that we can also employ other algorithms, +135 e.g., principal component analysis [45] and the local outlier factor [6], to identify underlying outliers +136 in $L _ { t }$ . The main reason we employ KNN is because of its relatively low computation costs [70]. +137 The truncated loss observations on training losses are denoted by $L _ { t - t _ { \mathrm { o } } }$ . We then utilize $L _ { t - t _ { \mathrm { o } } }$ for +138 the mean estimation. As the potential outliers are removed with high probability, the robustness of +139 the estimation results will be enhanced. We denote such an estimated mean as ${ \tilde { \mu } } _ { h }$ . We have + +$$ +\tilde { \mu } _ { h } = \frac { 1 } { t - t _ { \mathrm { o } } } \sum _ { \ell _ { i } \in L _ { t - t _ { 0 } } } \ell _ { i } . +$$ + +140 The corresponding estimator (4) is termed the hard estimator. + +141 We derive concentration inequalities for the soft and hard estimators respectively. The search strategy +142 for less selected examples and overall selection criterion are then provided. Note that we do not need +143 to explicitly quantify the mean of training losses. We only need to sort the training examples based +144 on the proposed selection criterion and then use the selected examples for robust training. + +145 Theorem 1. Let $Z _ { n } = \{ z _ { 1 } , \cdots , z _ { n } \}$ be an observation set with mean $\mu _ { z }$ and variance $\sigma ^ { 2 }$ . By exploiting the non-decreasing influence function 46 $\psi ( z ) = \log ( 1 + z + z ^ { 2 } / 2 )$ . For any $\epsilon > 0$ , we have + +$$ +\left| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \psi ( z _ { i } ) - \mu _ { z } \right| \leq \frac { \sigma ^ { 2 } ( n + \frac { \sigma ^ { 2 } \log ( \epsilon ^ { - 1 } ) } { n ^ { 2 } } ) } { n - \sigma ^ { 2 } } , +$$ + +147 with probability at least $1 - 2 \epsilon$ + +148 Proof can be found in Appendix A.1. + +149 Theorem 2. Let $Z _ { n } = \{ z _ { 1 } , \ldots , z _ { n } \}$ be a (not necessarily time homogeneous) Markov chain with +150 mean $\mu _ { z }$ , taking values in a Polish state space $\Lambda _ { 1 } \times \ldots \times \Lambda _ { n }$ , and with a minimal mixing time $\tau _ { \mathrm { m i n } }$ . +151 The truncated set with hard truncation is denoted by $Z _ { n _ { o } }$ , with $n _ { o } < n$ . If $| z _ { i } |$ is upper bounded by $Z$ . +152 For any $\epsilon _ { 1 } > 0$ and $\epsilon _ { 2 } > 0$ , we have + +$$ +\left| \frac { 1 } { n - n _ { o } } \sum _ { z _ { i } \in Z _ { n } \setminus Z _ { n _ { o } } } - \mu _ { z } \right| \leq \frac { 1 } { n - n _ { o } } \left( 2 Z \sqrt { 2 \tau _ { \mathrm { m i n } } \log \frac { 2 } { \epsilon _ { 1 } } } + \frac { 2 Z n _ { o } } { n } \sqrt { 2 \tau _ { \mathrm { m i n } } \log \frac { 2 n } { \epsilon _ { 2 } } } \right) , +$$ + +153 with probability at least $1 - \epsilon _ { 1 } - \epsilon _ { 2 }$ + +154 Proof can be found in Appendix A.2. For our task, let the training loss be upper-bounded by $L$ . The +155 value of $L$ can be determined easily by training networks on noisy datasets and observing the loss +156 distribution [1]. +157 Conservative search and selection criteria. In this paper, we will use the concentration inequalities +158 (5) and (6) to present conservative search and the overall sample selection criterion. Specifically, +159 we exploit their lower bounds and consider the selected number of examples during training. The +160 selection of the examples that are less selected is encouraged. + +# Algorithm 1 CNLCU Algorithm. + +1: Input $\theta _ { 1 }$ and $\theta _ { 2 }$ , learning rate $\eta$ , fixed $\tau$ , epoch $T _ { k }$ and $T _ { \mathrm { m a x } }$ , iteration $t _ { \mathrm { m a x } }$ ; for $T = 1 , 2 , \dots , T _ { \mathrm { m a x } }$ do + +2: Shuffle training dataset $\tilde { S }$ ; + +# end + +8: Update $\begin{array} { r } { R ( T ) = 1 - \operatorname* { m i n } \left\{ \frac { T } { T _ { k } } \tau , \tau \right\} } \end{array}$ + +# end + +9: Output $\theta _ { 1 }$ and $\theta _ { 2 }$ + +Denote the number of times one example was selected by 161 $n _ { t } ( n _ { t } ~ \leq ~ t )$ . Let $\begin{array} { r } { \epsilon = \frac { 1 } { 2 t } } \end{array}$ . For the 162 circumstance with soft truncation, the selection criterion is + +$$ +\ell _ { s } ^ { \star } = \tilde { \mu } _ { s } - \frac { \sigma ^ { 2 } ( t + \frac { \sigma ^ { 2 } \log ( 2 t ) } { t ^ { 2 } } ) } { n _ { t } - \sigma ^ { 2 } } . +$$ + +Let 163 $\begin{array} { r } { \epsilon _ { 1 } = \epsilon _ { 2 } = \frac { 1 } { 2 t } } \end{array}$ , for the situation with hard truncation, by rewriting (6), the selection criterion is + +$$ +\ell _ { h } ^ { \star } = \tilde { \mu } _ { h } - \frac { 2 \sqrt { 2 \tau _ { \mathrm { m i n } } } L ( t + \sqrt { 2 } t _ { \mathrm { o } } ) } { ( t - t _ { \mathrm { o } } ) \sqrt { t } } \sqrt { \frac { \log ( 4 t ) } { n _ { t } } } . +$$ + +164 Note that we directly replace $t$ with $n _ { t }$ . If an example is rarely selected during training, $n _ { t }$ will be far +165 less than $n$ , which causes the lower bounds to change drastically. Hence, we do not use the mean of +166 all training losses, but use the mean of training losses in fixed-length time intervals. More details +167 about this can be checked in Section 3. +168 For the selection criteria (7) and (8), we can see that they consist of two terms and have one term +169 with a minus sign. The first term in Eq. (7) (or Eq. (8)) is to reduce the uncertainty of small-loss +170 examples, where we use robust mean estimation on training losses. The second term, i.e., the +171 statistical confidence bound, is to encourage the network to choose the less selected examples (with a +172 small $n _ { t }$ ). The two terms are constraining and balanced with $\sigma ^ { 2 }$ or $\tau _ { \mathrm { m i n } }$ . To avoid introducing strong +173 assumptions on the underlying distribution of losses [8], we tune $\sigma$ and $\tau _ { \mathrm { m i n } }$ with a noisy validation +174 set. For the mislabeled data, although the model has high uncertainties on them (i.e., a small $n _ { t }$ ) +175 and tends to pick them, the overfitting to the mislabeled data is harmful. Also, the mislabeled data +176 and clean data are rather hard to distinguish in some cases as discussed. Thus, we should search +177 underlying clean data in a conservative way. In this paper, we initialize $\sigma$ and $\tau _ { \mathrm { m i n } }$ with small values. +178 This way can reduce the adverse effects of mislabeled data and meanwhile select the clean examples +179 with large losses, which helps generalize. More evaluations will be presented in Section 3. +180 The overall procedure of the proposed method, which combats noisy labels by concerning uncertainty +181 (CNLCU), is provided in Algorithm 1. CNLCU works in a mini-batch manner since all deep learning +182 training methods are based on stochastic gradient descent. Following [12], we exploit two networks +183 with parameters $\theta _ { 1 }$ and $\theta _ { 2 }$ respectively to teach each other. Specifically, when a mini-batch $\bar { S }$ is +184 formed (Step 3), we let two networks select a small proportion of examples in this mini-batch with +185 Eq. (7) or (8) (Step 4 and Step 5). The number of instances is controlled by the function $R ( T )$ , and +186 two networks only select $R ( T )$ percentage of examples out of the mini-batch. The value of $R ( T )$ +187 should be larger at the beginning of training, and be smaller when the number of epochs goes large, +188 which can make better use of memorization effects of deep networks [12] for sample selection. Then, +189 the selected instances are fed into its peer network for parameter updates (Step 6 and Step 7). + +# 190 3 Experiments + +191 In this section, we evaluate the robustness of our proposed method to noisy labels with comprehensive +192 experiments on the synthetic balanced noisy datasets (Section 3.1), synthetic imbalanced noisy +193 datasets (Section 3.2), and real-world noisy dataset (Section 3.3). + +Datasets. We verify the effectiveness of our method on the manually corrupted version of the following datasets: MNIST [22], $F$ -MNIST [58], CIFAR-10 [21], and CIFAR-100 [21], because these datasets are popularly used for the evaluation of learning with noisy labels in the literature [12, 65, 54, 23]. The four datasets are class-balanced. The important statistics of the used synthetic datasets are summarized in Appendix B.1. + +Generating noisy labels. We consider broad types of label noise: (1). Symmetric noise (abbreviated as Sym.) [53, 31, 26]. (2) Asymmetric noise (abbreviated as Asym.) [32, 57, 52]. (3) Pairflip noise (abbreviated as Pair.) [12, 65, 71]. (4). Tridiagonal noise (abbreviated as Trid.) [68]. (5). Instance noise (abbreviated as Ins.) [9, 56]. The noise rate is set to $20 \%$ and $40 \%$ to ensure clean labels are diagonally dominant [32]. More details about above noise are provided in Appendix B.1. We leave out $10 \%$ of noisy training examples as a validation set. + +Baselines. We compare the proposed method (Algorithm 1) with following methods which focus on sample selection, and implement all methods with default parameters by PyTorch, and conduct all the experiments on NVIDIA Titan Xp GPUs. (1). S2E [62], which properly controls the sample selection process so that deep networks can better benefit from the memorization effects. (2). MentorNet [16], which learns a curriculum to filter out noisy data. We use self-paced MentorNet in this paper. (3). Co-teaching [12], which trains two networks simultaneously and cross-updates parameters of peer networks. (4). SIGUA [13], which exploits stochastic integrated gradient underweighted ascent to handle noisy labels. We use self-teaching SIGUA in this paper. (5). JoCor [52], which reduces the diversity of networks to improve robustness. Other types of baselines such as adding regularization are provided in Appendix B.2. Note that we do not compare the proposed method with some stateof-the-art methods, e.g., SELF [39] and DivideMix [24]. It is because their proposed methods are aggregations of multiple techniques. We mainly focus on sample selectionin in learning with noisy labels. Therefore, the comparison is not fair. Here, we term our methods with soft truncation and hard truncation as CNLCU-S and CNLCU-H respectively. + +Network structure and optimizer. For MNIST, $F$ -MNIST, and CIFAR-10, we use a 9-layer CNN structure from [12]. Due to the limited space, the experimental details on CIFAR-100 are provided in Appendix B.3. All network structures we used here are standard test beds for weakly-supervised learning. For all experiments, the Adam optimizer [20] (momentum $_ { 1 = 0 . 9 }$ ) is used with an initial learning rate of 0.001, and the batch size is set to 128 and we run 200 epochs. We linearly decay learning rate to zero from 80 to 200 epochs as did in [12]. We take two networks with the same architecture but different initializations as two classifiers as did in [12, 65, 52], since even with the same network and optimization method, different initializations can lead to different local optimal [12]. The details of network structures can be checked in Appendix C. + +For the hyper-parameters $\sigma ^ { 2 }$ and $\tau _ { \mathrm { m i n } }$ , we determine them in the range $\{ 1 0 ^ { - 1 } , 1 0 ^ { - 2 } , 1 0 ^ { - 3 } , 1 0 ^ { - 4 } \}$ with a noisy validation set. Here, we assume the noise level $\tau$ is known and set $R ( T ) = 1 -$ $\operatorname* { m i n } \{ \frac { T } { T _ { k } } \tau , \tau \}$ with ${ \mathit { T } } _ { k } { = } 1 0$ . If $\tau$ is not known in advanced, it can be inferred using validation sets [29, 66]. As for performance measurement, we use test accuracy, i.e., test accuracy $=$ (# of correct prediction) / (# of testing). All experiments are repeated five times. We report the mean and standard deviation of experimental results. + +Experimental results. The experimental results about test accuracy are provided in Table 1, 2, and 3. Specifically, for MNIST, as can be seen, our proposed methods, i.e., CNLCU-S and CNLCU-H, produce the best results in the vast majority of cases. In some cases such as asymmetric noise, the baseline S2E outperforms ours, which benefits the accurate estimation for the number of selected small-loss examples. For $F$ -MNIST, the training data becomes complicated. S2E cannot achieve the accurate estimation in such situation and thus has no great performance like it got on MNIST. Our methods achieve varying degrees of lead over baselines. For CIFAR-10, our methods once again outperforms all the baseline methods. Although some baseline, e.g., Co-teaching, can work well in some cases, experimental results show that it cannot handle various noise types. In contrast, the proposed methods achieve superior robustness against broad noise types. The results mean that our methods can be better applied to actual scenarios, where the noise is diversiform. + +46 Ablation study. We first conduct the ablation study to analyze the sensitivity of the length of time intervals. In order to avoid too dense figures, we exploit MNIST and $F$ -MNIST with the mentioned 8 noise settings as representative examples. For CNLCU-S, the length of time intervals is chosen in + +
Noise typeSym.Asym.Pair.Trid.Ins.
Method/Noise ratio20%40%20%40%20%40%20%40%20%40%
S2E98.4695.6299.0598.4598.5694.2299.0297.2397.9394.02
±0.06±0.91±0.02±0.26±0.32±0.79±0.09±1.26±1.26±2.39
MentorNet95.0492.0896.3290.8693.1990.9396.4293.2894.6590.11
±0.03±0.42±0.17±0.97±0.17±1.54±0.09±1.37±0.73±1.26
Co-teaching97.5395.6298.2595.0896.0594.1698.0596.1897.9695.02
±0.12±0.30±0.08±0.43±0.96±1.37±0.06±0.85±0.09±0.39
SIGUA92.3191.8893.9662.5993.7786.2294.9283.4692.9086.34
±1.10±0.92±0.82±0.15±1.40±1.75±0.83±2.98±1.82±3.51
JoCor98.4298.0498.0594.5598.0196.8598.4596.9898.6296.07
±0.14±0.07±0.37±1.08±0.19±0.43±0.17±0.25±0.06±0.31
CNLCU-S98.8298.3198.9397.6798.8697.7199.0998.0298.7797.78
±0.03士0.05±0.06±0.22±0.06±0.64±0.04±0.17±0.08±0.25
CNLCU-H98.7098.2499.01 98.0198.4497.3798.8997.9298.7497.42
±0.06±0.06±0.04±0.03±0.19±0.32±0.15±0.05±0.16±0.39
+ +Table 1: Test accuracy $( \% )$ on MNIST over the last ten epochs. The best two results are in bold. + +
Noise typeSym.Asym.Pair.Trid.Ins.
Method/Noise ratio20%40%20%40%20%40%20%40%20%40%
S2E89.9975.3289.0081.0388.6667.0989.5377.2988.6579.35
±2.07±5.84±0.95±1.93±1.32±4.03±2.63±3.97±2.12±3.04
MentorNet90.3786.5389.6967.2187.9283.7088.7485.6387.5283.27
±0.17士0.65±0.19±2.94±1.08±0.49±0.33±0.59±0.15±1.42
Co-teaching91.4888.8091.0368.0790.7786.9191.2489.1890.6087.90
±0.10±0.29±0.14±4.58±0.23±0.71±0.11±0.36±0.12±0.45
SIGUA87.6487.2376.9745.9669.5968.9379.9776.1476.9274.89
±1.29±0.72±2.59±3.40±5.75±2.80±3.23±4.24±5.09士4.84
JoCor91.9789.9690.9579.7991.5287.4092.0189.4291.4387.59
±0.13±0.19±0.21±2.39士0.24±0.58±0.17士0.33±0.71±0.94
CNLCU-S92.3791.4592.5783.1492.0488.2092.2490.0891.6989.02
±0.15±0.28±0.15±1.77±0.26±0.44±0.17±0.34±0.10±1.02
CNLCU-H92.4291.6092.6082.6991.7087.7092.3390.2291.5088.79
±0.21±0.19±0.18±0.43±0.18±0.69±0.26±0.71±0.21±1.22
+ +Table 2: Test accuracy on F-MNIST over the last ten epochs. The best two results are in bold. + +249 the range from 3 to 8. For CNLCU-H, the length of time intervals is chosen in the range from 10 to +250 15. Note that the reason for their different lengths is that their different mechanisms. Specifically, +251 CNLCU-S holistically changes the behavior of losses, but does not remove any loss from the loss set. +252 We thus do not need too long length of time intervals. As a comparison, CNLCU-H needs to remove +253 some outliers from the loss set as discussed. The length should be longer to guarantee the number of +254 examples available for robust mean estimation. The experimental results are provided in Appendix +255 B.4, which show the proposed CNLCU-S and CNLCU-H are robust to the choices of the length of +256 time intervals. Such robustness to hyperparameters means our methods can be applied in practice and +257 does not need too much effect to tune the hyperparameters. +258 Furthermore, since our methods concern uncertainty from two aspects, i.e., the uncertainty from both +259 small-loss and large-loss examples, we conduct experiments to analyze each part of our methods. +260 Also, as mentioned, we compare robust mean estimation with non-robust mean estimation when +261 learning with noisy labels. More details are provided in Appendix B.4. + +# 3.2 Experiments on Synthetic Imbalanced Noisy Datasets + +Experimental setup. We exploit MNIST and $F$ -MNIST. For these two datasets, we reduce the number of training examples along with the labels from $\mathbf { \bar { \theta } } ^ { 6 } 0 ^ { 9 }$ to $" 4 > "$ to $1 \%$ of previous numbers. We term such synthetic imbalanced noisy datasets as IM-MNIST and IM-F-MNIST respectively. This setting aims to simulate the extremely imbalanced circumstance, which is common in practice. Moreover, we exploit asymmetric noise, since these types of noise can produce more imbalanced case [41, 32]. Other settings such as the network structure and optimizer are the same as those in experiments on synthetic balanced noisy datasets. + +
Noise typeSym.Asym.Pair.Trid.Ins.
Method/Noise ratio20%40%20%40%20%40%20%40%20%40%
S2E80.7869.7284.0375.0481.7261.5081.4464.3979.8962.42
±0.88±3.94±1.01±1.24±0.93±4.63±0.59±2.82±0.26±3.11
MentorNet80.9274.6780.3771.6977.9869.3978.0271.5677.0268.17
±0.48±1.17±0.26±1.06±0.31±1.73±0.29±0.93±0.71±2.52
Co-teaching82.3577.9683.8773.4380.9472.8181.1774.3779.9273.29
±0.16±0.39±0.24±0.62±0.46±0.92±0.60士0.64±0.57±1.62
SIGUA78.1977.6775.1452.7674.4161.9175.7574.0574.3467.98
±0.22±0.41±0.36±0.68±0.81±5.27±0.53±0.41±0.39±1.34
JoCor80.9676.6581.3969.9280.3371.6279.0374.3378.2171.46
±0.25±0.43±0.74±1.63±0.20±1.05±0.13±1.09±0.34±1.27
CNLCU-S83.0378.2585.0675.3483.1673.1982.7774.3782.0373.67
±0.21±0.70±0.17±0.32±0.25±1.25±0.32±1.37士0.37±1.09
CNLCU-H83.0378.3384.9575.2983.3973.4082.5274.79-81.9373.58
±0.47±0.50±0.27±0.80±0.68±1.53±0.71±1.13±0.25±1.39
+ +Table 3: Test accuracy $( \%$ ) on CIFAR-10 over the last ten epochs. The best two results are in bold. + +270 As for performance measurements, we use test accuracy. In addition, we exploit the selected ratio of +271 training examples with the imbalanced classes, i.e., selected ratio=(# of selected imbalanced labels / +272 # of all selected labels). Intuitively, a higher selected ratio means the proposed method can make +273 better use of training examples with the imbalanced classes, following better generalization [18]. + +Experimental results. The test accuracy achieved on IM-MNIST and IM-F-MNIST is presented in Figure 2. Recall the experimental results in Table 1 and 2, we can see that the imbalanced issue is catastrophic to the sample selection approach when learning with noisy labels. For IM-MNIST, as can be seen, all the baselines have serious overfitting in the early stages of training. The curves of test accuracy drop dramatically. As a comparison, the proposed CNLCU-S and CNLCU-H can give a try to large-loss but less selected data which are possible to be clean but equipped with imbalanced labels. Therefore, our methods always outperform baselines clearly. In the case of Asym. $10 \%$ , our methods achieve nearly $30 \%$ lead over baselines. For IM-F-MNIST, we can also see that our methods perform well and always achieve about $5 \%$ lead over all the baselines. Note that due to the huge challenge of this task, some baseline, e.g., S2E, has a large error bar. In addition, the baseline SIGUA performs badly. It is because SIGUA exploits stochastic integrated gradient underweighted ascent on large-loss examples, which makes the examples with imbalanced classes more difficult to be selected than them in other sample selection methods. + +The selected ratio achieved on IM-MNIST and IM-F-MNIST is presented in Table 4. The results explain well why our methods perform better on synthetic imbalanced noisy datasets, i.e., our methods can make better use of training examples with the imbalanced classes. Note that since we give a try to large-loss but less selected data in a conservative way, the selected ratio is still far away from the class prior probability on the test set, i.e., $10 \%$ . However, a little improvement of the selection ratio can bring a considerable improvement of test accuracy. These results tell us that, in the sample selection approach when learning with noisy labels, improving the selected ratio of training examples with the imbalanced classes is challenging but promising for generalization. This practical problem deserves to be studied in depth. + +# 3.3 Experiments on Real-world Noisy Datasets + +Experimental setup. To verify the efficacy of our methods in the real-world scenario, we conduct experiments on the noisy dataset Clothing1M [59]. Specifically, for experiments on Clothing1M, we use the 1M images with noisy labels for training and 10k clean data for test respectively. Note that we do not use the $5 0 \mathrm { k }$ clean training data in all the experiments. For preprocessing, we resize the image to $2 5 6 \times 2 5 6$ , crop the middle $2 2 4 \times 2 2 4$ as input, and perform normalization. The experiments on Clothing1M are performed once due to the huge computational cost. We leave $10 \%$ noisy training data as a validation set for model selection. Note that we do not exploit the resampling trick during training [24]. Here, Best denotes the test accuracy of the epoch where the validation accuracy was optimal. Last denotes test accuracy of the last epoch. For the experiments on Clothing1M, we use a ResNet-18 pretrained on ImageNet as did in [52]. We also use the Adam optimizer and set the batch size to 64. During the training stage, we run 15 epochs in total and set the learning rate $8 \times 1 0 ^ { - 4 }$ , $5 \times 1 0 ^ { - 4 }$ , and $5 \times 1 0 ^ { - 5 }$ for 5 epochs each. + +
DatasetIM-MNISTIM-F-MNIST
Method/Noiseratio10%20%30%40%10%20%30%40%
S2E0.13 ±0.120.11 ±0.050.09 ±0.020.05 ±0.010.13 ±0.040.17 ±0.030.16 ±0.020.12 ±0.04
MentorNet0.10 ±0.020.15 ±0.020.12 ±0.030.13 ±0.020.12 ±0.010.15 ±0.030.09 ±0.010.14 ±0.02
Co-teaching0.09 ±0.030.07 ±0.020.05 ±0.010.12 ±0.010.17 ±0.050.04 ±0.000.13 ±0.040.07 ±0.01
SIGUA0.04 ±0.000.04 ±0.000.01 ±0.000.02 ±0.000.03 ±0.000.02 ±0.000.04 ±0.000.00 ±0.00
JoCor0.11 ±0.040.08 ±0.010.07 ±0.030.06 ±0.020.05 ±0.010.13 ±0.040.13 ±0.030.07 ±0.02
CNLCU-S0.60 ±0.110.37 ±0.090.39 ±0.040.38 ±0.060.35 ±0.030.39 ±0.040.36 ±0.030.30 ±0.02
CNLCU-H0.57 ±0.130.32 ±0.010.37 ±0.070.32' ±0.050.34 ±0.020.35 ±0.060.32'0.28' ±0.03
+ +Table 4: Selected ratio ( $\overline { { \mathcal { \vert } } }$ ) on IM-MNIST and IM-F-MNIST. The best two results are in bold. + +![](images/345618b16a2a497cb1770a7a6b812aef02c9db41ecbd901f24eafd6809680d9e.jpg) +Figure 2: Test accuracy vs. number of epochs on IM-MNIST and IM- $F$ -MNIST. The error bar for standard deviation in each figure has been shaded. + +309 Experimental results. The results on Clothing1M are provided in Table 5. Specifically, the proposed +310 methods get better results than state-of-the-art methods on Best, which achieve an improvement of +311 $+ 1 . 2 8 \%$ and $+ 0 . 9 9 \%$ over the best baseline JoCor. Likewise, the proposed methods outperform all the +312 baselines on Last. We achieve an improvement of $+ 1 . 0 1 \%$ and $+ 0 . 5 4 \%$ over JoCor. Note that the +313 results are a bit lower than some state-of-art methods, e.g., [64] and [46], because of the following +314 reasons. (1). We follow [52] and use ResNet-18 as a backbone. The state-of-art methods [64, 46] +315 use ResNet-50 as a backbone. Our aim is to make the experimental results directly comparable with +316 previous papers [52] in the same area. (2). We only focus on the sample selection approach and do +317 not employ other advanced techniques, e.g., introducing the prior distribution [46] and combining +semi-supervised learning [24, 39, 28]. + +
MethodsS2EMentorNetCo-teachingSIGUAJoCorCNLCU-SCNLCU-H
Best67.3468.3669.3762.8970.0971.3771.08
Last65.9067.4268.6258.7369.7570.7670.29
+ +Table 5: Test accuracy (%) on Clothing1M. The best two results are in bold. + +# 318319 4 Conclusion + +In this paper, we focus on promoting the prior sample selection in learning with noisy labels, which starts from concerning the uncertainty of losses during training. We robustly use the training losses at different iterations to reduce the uncertainty of small-loss examples, and adopt confidence interval estimation to reduce the uncertainty of large-loss examples. Experiments are conducted on benchmark datasets, demonstrating the effectiveness of our method. We believe that this paper opens up new possibilities in the topics of using sample selection to handle noisy labels, especially in improving the robustness of models on imbalanced noisy datasets. + +References [1] Eric Arazo, Diego Ortego, Paul Albert, Noel O’Connor, and Kevin McGuinness. Unsupervised label noise modeling and loss correction. In ICML, pages 312–321, 2019. [2] Devansh Arpit, Stanisław Jastrz˛ebski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S Kanwal, Tegan Maharaj, Asja Fischer, Aaron Courville, Yoshua Bengio, et al. A closer look at memorization in deep networks. In ICML, pages 233–242, 2017. [3] Peter Auer. Using confidence bounds for exploitation-exploration trade-offs. Journal of Machine Learning Research, 3(Nov):397–422, 2002. [4] Léon Bottou. Stochastic gradient descent tricks. In Neural networks: Tricks of the trade, pages 421–436. Springer, 2012. [5] Stéphane Boucheron, Gábor Lugosi, and Pascal Massart. Concentration inequalities: A nonasymptotic theory of independence. Oxford university press, 2013. [6] Markus M Breunig, Hans-Peter Kriegel, Raymond T $\mathrm { N g }$ , and Jörg Sander. Lof: identifying density-based local outliers. In SIGMOD, pages 93–104, 2000. [7] Olivier Catoni. Challenging the empirical mean and empirical variance: a deviation study. In Annales de l’IHP Probabilités et statistiques, volume 48, pages 1148–1185, 2012. [8] Arijit Chakrabarty and Gennady Samorodnitsky. Understanding heavy tails in a bounded world or, is a truncated heavy tail heavy or not? Stochastic models, 28(1):109–143, 2012. [9] Jiacheng Cheng, Tongliang Liu, Kotagiri Ramamohanarao, and Dacheng Tao. Learning with bounded instance-and label-dependent label noise. In ICML, 2020. [10] Ilias Diakonikolas, Daniel M Kane, and Ankit Pensia. Outlier robust mean estimation with subgaussian rates via stability. arXiv preprint arXiv:2007.15618, 2020. [11] Bo Han, Jiangchao Yao, Gang Niu, Mingyuan Zhou, Ivor Tsang, Ya Zhang, and Masashi Sugiyama. Masking: A new perspective of noisy supervision. In NeurIPS, pages 5836–5846, 2018. [12] Bo Han, Quanming Yao, Xingrui Yu, Gang Niu, Miao Xu, Weihua Hu, Ivor Tsang, and Masashi Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In NeurIPS, pages 8527–8537, 2018. +355 [13] Bo Han, Gang Niu, Xingrui Yu, Quanming Yao, Miao Xu, Ivor Tsang, and Masashi Sugiyama. Sigua: Forgetting may make learning with noisy labels more robust. In ICML, pages 4006–4016, 2020. [14] Hrayr Harutyunyan, Kyle Reing, Greg Ver Steeg, and Aram Galstyan. Improving generalization by controlling label-noise information in neural network weights. In ICML, pages 4071–4081, 2020. [15] Dan Hendrycks, Mantas Mazeika, Duncan Wilson, and Kevin Gimpel. Using trusted data to train deep networks on labels corrupted by severe noise. In NeurIPS, 2018. +363 [16] Lu Jiang, Zhengyuan Zhou, Thomas Leung, Li-Jia Li, and Li Fei-Fei. MentorNet: Learning data-driven curriculum for very deep neural networks on corrupted labels. In ICML, pages 2309–2318, 2018. [17] Lu Jiang, Di Huang, Mason Liu, and Weilong Yang. Beyond synthetic noise: Deep learning on controlled noisy labels. In ICML, pages 4804–4815, 2020. [18] 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. [19] Youngdong Kim, Junho Yim, Juseung Yun, and Junmo Kim. Nlnl: Negative learning for noisy labels. In ICCV, pages 101–110, 2019. +373 [20] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +375 [21] Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009. +376 [22] Yann LeCun, Corinna Cortes, and Christopher J.C. Burges. The MNIST database of handwritten digits. http://yann.lecun.com/exdb/mnist/. [23] Kimin Lee, Sukmin Yun, Kibok Lee, Honglak Lee, Bo Li, and Jinwoo Shin. Robust inference via generative classifiers for handling noisy labels. In ICML, pages 3763–3772, 2019. [24] Junnan Li, Richard Socher, and Steven C.H. Hoi. Dividemix: Learning with noisy labels as semi-supervised learning. In ICLR, 2020. [25] Mingchen Li, Mahdi Soltanolkotabi, and Samet Oymak. Gradient descent with early stopping is provably robust to label noise for overparameterized neural networks. In AISTATS, 2020. [26] Xuefeng Li, Tongliang Liu, Bo Han, Gang Niu, and Masashi Sugiyama. Provably end-to-end label-noise learning without anchor points. 2021. [27] Yihua Liao and V Rao Vemuri. Use of k-nearest neighbor classifier for intrusion detection. Computers & security, 21(5):439–448, 2002. [28] Sheng Liu, Jonathan Niles-Weed, Narges Razavian, and Carlos Fernandez-Granda. Earlylearning regularization prevents memorization of noisy labels. In NeurIPS, 2020. [29] Tongliang Liu and Dacheng Tao. Classification with noisy labels by importance reweighting. IEEE Transactions on pattern analysis and machine intelligence, 38(3):447–461, 2016. +392 [30] Michal Lukasik, Srinadh Bhojanapalli, Aditya Menon, and Sanjiv Kumar. Does label smoothing mitigate label noise? In ICML, pages 6448–6458, 2020. [31] Xingjun Ma, Yisen Wang, Michael E Houle, Shuo Zhou, Sarah M Erfani, Shu-Tao Xia, Sudanthi Wijewickrema, and James Bailey. Dimensionality-driven learning with noisy labels. In ICML, pages 3361–3370, 2018. [32] Xingjun Ma, Hanxun Huang, Yisen Wang, Simone Romano, Sarah Erfani, and James Bailey. Normalized loss functions for deep learning with noisy labels. In ICML, pages 6543–6553, 2020. [33] Eran Malach and Shai Shalev-Shwartz. Decoupling" when to update" from" how to update". In NeurIPS, pages 960–970, 2017. +402 [34] Aditya Krishna Menon, Brendan Van Rooyen, and Nagarajan Natarajan. Learning from binary labels with instance-dependent noise. Machine Learning, 107(8-10):1561–1595, 2018. +404 [35] Aditya Krishna Menon, Sadeep Jayasumana, Ankit Singh Rawat, Himanshu Jain, Andreas Veit, and Sanjiv Kumar. Long-tail learning via logit adjustment. arXiv preprint arXiv:2007.07314, 2020. [36] Baharan Mirzasoleiman, Kaidi Cao, and Jure Leskovec. Coresets for robust training of neural networks against noisy labels. In NeurIPS, 2020. [37] David S Moore. Uncertainty. On the shoulders of giants: New approaches to numeracy, pages 95–137, 1990. [38] Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with noisy labels. In NeurIPS, pages 1196–1204, 2013. +413 [39] Duc Tam Nguyen, Chaithanya Kumar Mummadi, Thi Phuong Nhung Ngo, Thi Hoai Phuong Nguyen, Laura Beggel, and Thomas Brox. Self: Learning to filter noisy labels with selfensembling. In ICLR, 2020. +416 [40] Kento Nishi, Yi Ding, Alex Rich, and Tobias Höllerer. Augmentation strategies for learning with noisy labels. arXiv preprint arXiv:2103.02130, 2021. +418 [41] Giorgio Patrini, Alessandro Rozza, Aditya Krishna Menon, Richard Nock, and Lizhen Qu. Making deep neural networks robust to label noise: A loss correction approach. In CVPR, pages 1944–1952, 2017. [42] Geoff Pleiss, Tianyi Zhang, Ethan R Elenberg, and Kilian Q Weinberger. Identifying mislabeled data using the area under the margin ranking. In NeurIPS, 2020. +23 [43] Jeffrey S Rosenthal. Faithful couplings of markov chains: now equals forever. Advances in Applied Mathematics, 18(3):372–381, 1997. +425 [44] Jun Shu, Qian Zhao, Zengben Xu, and Deyu Meng. Meta transition adaptation for robust deep learning with noisy labels. arXiv preprint arXiv:2006.05697, 2020. +27 [45] Mei-Ling Shyu, Shu-Ching Chen, Kanoksri Sarinnapakorn, and LiWu Chang. A novel anomaly detection scheme based on principal component classifier. Technical report, 2003. +429 [46] Daiki Tanaka, Daiki Ikami, Toshihiko Yamasaki, and Kiyoharu Aizawa. Joint optimization framework for learning with noisy labels. In CVPR, 2018. [47] Kiran K Thekumparampil, Ashish Khetan, Zinan Lin, and Sewoong Oh. Robustness of conditional gans to noisy labels. In NeurIPS, pages 10271–10282, 2018. +33 [48] Vladimir Vapnik. The nature of statistical learning theory. Springer science & business media, 2013. +435 [49] Qizhou Wang, Jiangchao Yao, Chen Gong, Tongliang Liu, Mingming Gong, Hongxia Yang, and Bo Han. Learning with group noise. In AAAI, 2021. [50] Xiaobo Wang, Shuo Wang, Jun Wang, Hailin Shi, and Tao Mei. Co-mining: Deep face recognition with noisy labels. In ICCV, pages 9358–9367, 2019. +439 [51] 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, pages 8688–8696, 2018. [52] Hongxin Wei, Lei Feng, Xiangyu Chen, and Bo An. Combating noisy labels by agreement: A joint training method with co-regularization. In CVPR, pages 13726–13735, 2020. [53] Pengxiang Wu, Songzhu Zheng, Mayank Goswami, Dimitris Metaxas, and Chao Chen. A topological filter for learning with label noise. In NeurIPS, 2020. +45 [54] Songhua Wu, Xiaobo Xia, Tongliang Liu, Bo Han, Mingming Gong, Nannan Wang, Haifeng Liu, and Gang Niu. Class2simi: A noise reduction perspective on learning with noisy labels. In ICML, 2021. +48 [55] Xiaobo Xia, Tongliang Liu, Nannan Wang, Bo Han, Chen Gong, Gang Niu, and Masashi Sugiyama. Are anchor points really indispensable in label-noise learning? In NeurIPS, pages 6835–6846, 2019. +51 [56] Xiaobo Xia, Tongliang Liu, Bo Han, Nannan Wang, Mingming Gong, Haifeng Liu, Gang Niu, Dacheng Tao, and Masashi Sugiyama. Part-dependent label noise: Towards instance-dependent label noise. In NeurIPS, 2020. +454 [57] Xiaobo Xia, Tongliang Liu, Bo Han, Chen Gong, Nannan Wang, Zongyuan Ge, and Yi Chang. Robust early-learning: Hindering the memorization of noisy labels. In ICLR, 2021. +56 [58] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. +458 [59] Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. In CVPR, pages 2691–2699, 2015. [60] Yilun Xu, Peng Cao, Yuqing Kong, and Yizhou Wang. L_dmi: A novel information-theoretic loss function for training deep nets robust to label noise. In NeurIPS, pages 6222–6233, 2019. +[61] Shuo Yang, Lu Liu, and Min Xu. Free lunch for few-shot learning: Distribution calibration. In ICLR, 2021. +[62] Quanming Yao, Hansi Yang, Bo Han, Gang Niu, and James Tin-Yau Kwok. Searching to exploit memorization effect in learning with noisy labels. In ICML, pages 10789–10798, 2020. +[63] Yu Yao, Tongliang Liu, Bo Han, Mingming Gong, Jiankang Deng, Gang Niu, and Masashi Sugiyama. Dual t: Reducing estimation error for transition matrix in label-noise learning. In NeurIPS, 2020. +[64] Kun Yi and Jianxin Wu. Probabilistic end-to-end noise correction for learning with noisy labels. In CVPR, pages 7017–7025, 2019. +[65] Xingrui Yu, Bo Han, Jiangchao Yao, Gang Niu, Ivor W Tsang, and Masashi Sugiyama. How does disagreement benefit co-teaching? In ICML, 2019. +[66] Xiyu Yu, Tongliang Liu, Mingming Gong, Kayhan Batmanghelich, and Dacheng Tao. An efficient and provable approach for mixture proportion estimation using linear independence assumption. In CVPR, pages 4480–4489, 2018. +[67] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017. +[68] Yivan Zhang, Gang Niu, and Masashi Sugiyama. Learning noise transition matrix from only noisy labels via total variation regularization. In ICML, 2021. +[69] Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In NeurIPS, pages 8778–8788, 2018. +[70] Yue Zhao, Zain Nasrullah, and Zheng Li. Pyod: A python toolbox for scalable outlier detection. Journal of Machine Learning Research, 20(96):1–7, 2019. +[71] Songzhu Zheng, Pengxiang Wu, Aman Goswami, Mayank Goswami, Dimitris Metaxas, and Chao Chen. Error-bounded correction of noisy labels. In ICML, pages 11447–11457, 2020. + +The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example: + +• Did you include the license to the code and datasets? [No] The code and the data are proprietary. + +Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below. + +1. For all authors... + +(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] +(b) Did you describe the limitations of your work? [Yes] +(c) Did you discuss any potential negative societal impacts of your work? [No] +(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] + +2. If you are including theoretical results... + +(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] + +3. If you ran experiments... + +(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The code and instructions are provided in the supplemental material. The used datasets can be publicly downloaded. Besides, the code for generating noisy labels is provided. +(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 3. +(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Section 3.1 and 3.2. +(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See “Baselines” in Section 3.1. + +4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... + +(a) If your work uses existing assets, did you cite the creators? [Yes] We use MNIST, $F$ -MNIST, CIFAR-10, CIFAR-100, and Clothing1M in this paper. We cite the creators, which can be checked in Section 3. +(b) Did you mention the license of the assets? [N/A] +(c) Did you include any new assets either in the supplemental material or as a URL? [N/A] +(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] +(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] + +5. If you used crowdsourcing or conducted research with human subjects... + +(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] +(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] +(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] \ No newline at end of file